Add 'Save and stay' button on missing pages at back office

This commit is contained in:
Abhishek Kumar
2024-01-16 17:09:13 +05:30
parent 1f9b7098e6
commit 87e45007bf
24 changed files with 299 additions and 32 deletions

View File

@@ -105,7 +105,19 @@ class AdminCmsCategoriesControllerCore extends AdminController
$object = parent::postProcess();
$this->updateAssoShop((int)Tools::getValue('id_cms_category'));
if ($object !== false) {
Tools::redirectAdmin(self::$currentIndex.'&conf=3&id_cms_category='.(int)$object->id.'&token='.Tools::getValue('token'));
if (Tools::isSubmit('submitAdd'.$this->table.'AndStay')) {
if ($this->id_object) {
Tools::redirectAdmin(self::$currentIndex.'&update'.$this->table.'&conf=4&id_cms_category='.(int)$object->id.'&token='.Tools::getValue('token'));
} else {
Tools::redirectAdmin(self::$currentIndex.'&update'.$this->table.'&conf=3&id_cms_category='.(int)$object->id.'&token='.Tools::getValue('token'));
}
} else {
if ($this->id_object) {
Tools::redirectAdmin(self::$currentIndex.'&conf=4&id_cms_category='.(int)$object->id.'&token='.Tools::getValue('token'));
} else {
Tools::redirectAdmin(self::$currentIndex.'&conf=3&id_cms_category='.(int)$object->id.'&token='.Tools::getValue('token'));
}
}
}
return $object;
}
@@ -289,7 +301,16 @@ class AdminCmsCategoriesControllerCore extends AdminController
),
'submit' => array(
'title' => $this->l('Save'),
)
),
'buttons' => array(
'save-and-stay' => array(
'title' => $this->l('Save and stay'),
'name' => 'submitAdd'.$this->table.'AndStay',
'type' => 'submit',
'class' => 'btn btn-default pull-right',
'icon' => 'process-icon-save',
),
),
);
if (Shop::isFeatureActive()) {

View File

@@ -218,6 +218,13 @@ class AdminCmsControllerCore extends AdminController
'title' => $this->l('Save'),
),
'buttons' => array(
'save-and-stay' => array(
'title' => $this->l('Save and stay'),
'name' => 'submitAdd'.$this->table.'AndStay',
'type' => 'submit',
'class' => 'btn btn-default pull-right',
'icon' => 'process-icon-save',
),
'save_and_preview' => array(
'name' => 'viewcms',
'type' => 'submit',

View File

@@ -113,7 +113,16 @@ class AdminContactsControllerCore extends AdminController
),
'submit' => array(
'title' => $this->l('Save'),
)
),
'buttons' => array(
'save-and-stay' => array(
'title' => $this->l('Save and stay'),
'name' => 'submitAdd'.$this->table.'AndStay',
'type' => 'submit',
'class' => 'btn btn-default pull-right',
'icon' => 'process-icon-save',
),
),
);
if (Shop::isFeatureActive()) {

View File

@@ -368,6 +368,16 @@ class AdminCountriesControllerCore extends AdminController
'title' => $this->l('Save')
);
$this->fields_form['buttons'] = array(
'save-and-stay' => array(
'title' => $this->l('Save and stay'),
'name' => 'submitAdd'.$this->table.'AndStay',
'type' => 'submit',
'class' => 'btn btn-default pull-right',
'icon' => 'process-icon-save',
)
);
return parent::renderForm();
}

View File

@@ -231,6 +231,16 @@ class AdminCurrenciesControllerCore extends AdminController
'title' => $this->l('Save'),
);
$this->fields_form['buttons'] = array(
'save-and-stay' => array(
'title' => $this->l('Save and stay'),
'name' => 'submitAdd'.$this->table.'AndStay',
'type' => 'submit',
'class' => 'btn btn-default pull-right',
'icon' => 'process-icon-save',
)
);
return parent::renderForm();
}

View File

@@ -403,6 +403,16 @@ class AdminEmployeesControllerCore extends AdminController
'title' => $this->l('Save'),
);
$this->fields_form['buttons'] = array(
'save-and-stay' => array(
'title' => $this->l('Save and stay'),
'name' => 'submitAdd'.$this->table.'AndStay',
'type' => 'submit',
'class' => 'btn btn-default pull-right',
'icon' => 'process-icon-save',
)
);
$this->fields_value['passwd'] = false;
$this->fields_value['bo_theme_css'] = $obj->bo_theme.'|'.$obj->bo_css;

View File

@@ -216,6 +216,16 @@ class AdminFeaturesControllerCore extends AdminController
'title' => $this->l('Save'),
);
$this->fields_form['buttons'] = array(
'save-and-stay' => array(
'title' => $this->l('Save and stay'),
'name' => 'submitAdd'.$this->table.'AndStay',
'type' => 'submit',
'class' => 'btn btn-default pull-right',
'icon' => 'process-icon-save',
)
);
return parent::renderForm();
}
@@ -544,9 +554,9 @@ class AdminFeaturesControllerCore extends AdminController
if ($this->table == 'feature_value' && ($this->display == 'edit' || $this->display == 'add')) {
$this->redirect_after = self::$currentIndex.'&addfeature_value&id_feature='.(int)Tools::getValue('id_feature').'&token='.$this->token;
} else {
$this->redirect_after = self::$currentIndex.'&'.$this->identifier.'=&conf=3&update'.$this->table.'&token='.$this->token;
$this->redirect_after = self::$currentIndex.'&'.$this->identifier.'='.(int) $object->id.'&conf=3&update'.$this->table.'&token='.$this->token;
}
} elseif (Tools::isSubmit('submitAdd'.$this->table.'AndStay') && count($this->errors)) {
} elseif (Tools::isSubmit('submitAdd'.$this->table.'AndStay') && count($this->errors) && $this->table == 'feature_value') { // enter only if feature is submitted
$this->display = 'editFeatureValue';
}
@@ -562,7 +572,7 @@ class AdminFeaturesControllerCore extends AdminController
$object = parent::processUpdate();
if (Tools::isSubmit('submitAdd'.$this->table.'AndStay') && !count($this->errors)) {
$this->redirect_after = self::$currentIndex.'&'.$this->identifier.'=&conf=3&update'.$this->table.'&token='.$this->token;
$this->redirect_after = self::$currentIndex.'&'.$this->identifier.'='.(int) Tools::getValue('id_feature').'&conf=4&update'.$this->table.'&token='.$this->token;
}
return $object;

View File

@@ -173,7 +173,16 @@ class AdminGendersControllerCore extends AdminController
),
'submit' => array(
'title' => $this->l('Save'),
)
),
'buttons' => array(
'save-and-stay' => array(
'title' => $this->l('Save and stay'),
'name' => 'submitAdd'.$this->table.'AndStay',
'type' => 'submit',
'class' => 'btn btn-default pull-right',
'icon' => 'process-icon-save',
),
),
);
/** @var Gender $obj */

View File

@@ -232,6 +232,15 @@ class AdminGroupsControllerCore extends AdminController
'submit' => array(
'title' => $this->l('Save'),
),
'buttons' => array(
'save-and-stay' => array(
'title' => $this->l('Save and stay'),
'name' => 'submitAdd'.$this->table.'AndStay',
'type' => 'submit',
'class' => 'btn btn-default pull-right',
'icon' => 'process-icon-save',
),
),
'input' => array(
array(
'type' => 'text',

View File

@@ -403,7 +403,16 @@ class AdminImagesControllerCore extends AdminController
),
'submit' => array(
'title' => $this->l('Save')
)
),
'buttons' => array(
'save-and-stay' => array(
'title' => $this->l('Save and stay'),
'name' => 'submitAdd'.$this->table.'AndStay',
'type' => 'submit',
'class' => 'btn btn-default pull-right',
'icon' => 'process-icon-save',
),
),
);
parent::__construct();

View File

@@ -262,6 +262,16 @@ class AdminLanguagesControllerCore extends AdminController
'title' => $this->l('Save'),
);
$this->fields_form['buttons'] = array(
'save-and-stay' => array(
'title' => $this->l('Save and stay'),
'name' => 'submitAdd'.$this->table.'AndStay',
'type' => 'submit',
'class' => 'btn btn-default pull-right',
'icon' => 'process-icon-save',
),
);
/** @var Language $obj */
if (!($obj = $this->loadObject(true))) {
return;

View File

@@ -381,7 +381,16 @@ class AdminMetaControllerCore extends AdminController
),
'submit' => array(
'title' => $this->l('Save')
)
),
'buttons' => array(
'save-and-stay' => array(
'title' => $this->l('Save and stay'),
'name' => 'submitAdd'.$this->table.'AndStay',
'type' => 'submit',
'class' => 'btn btn-default pull-right',
'icon' => 'process-icon-save',
),
),
);
return parent::renderForm();
}

View File

@@ -91,7 +91,16 @@ class AdminOrderMessageControllerCore extends AdminController
),
'submit' => array(
'title' => $this->l('Save'),
)
),
'buttons' => array(
'save-and-stay' => array(
'title' => $this->l('Save and stay'),
'name' => 'submitAdd'.$this->table.'AndStay',
'type' => 'submit',
'class' => 'btn btn-default pull-right',
'icon' => 'process-icon-save',
),
),
);
parent::__construct();

View File

@@ -76,7 +76,16 @@ class AdminProfilesControllerCore extends AdminController
),
'submit' => array(
'title' => $this->l('Save'),
)
),
'buttons' => array(
'save-and-stay' => array(
'title' => $this->l('Save and stay'),
'name' => 'submitAdd'.$this->table.'AndStay',
'type' => 'submit',
'class' => 'btn btn-default pull-right',
'icon' => 'process-icon-save',
),
),
);
$list_profile = array();

View File

@@ -118,7 +118,16 @@ class AdminQuickAccessesControllerCore extends AdminController
),
'submit' => array(
'title' => $this->l('Save'),
)
),
'buttons' => array(
'save-and-stay' => array(
'title' => $this->l('Save and stay'),
'name' => 'submitAdd'.$this->table.'AndStay',
'type' => 'submit',
'class' => 'btn btn-default pull-right',
'icon' => 'process-icon-save',
),
),
);
parent::__construct();

View File

@@ -285,6 +285,15 @@ class AdminSpecificPriceRuleControllerCore extends AdminController
'submit' => array(
'title' => $this->l('Save')
),
'buttons' => array(
'save-and-stay' => array(
'title' => $this->l('Save and stay'),
'name' => 'submitAdd'.$this->table.'AndStay',
'type' => 'submit',
'class' => 'btn btn-default pull-right',
'icon' => 'process-icon-save',
),
),
);
if (($value = $this->getFieldValue($this->object, 'price')) != -1) {
$price = number_format($value, 6);

View File

@@ -199,7 +199,16 @@ class AdminStatesControllerCore extends AdminController
),
'submit' => array(
'title' => $this->l('Save'),
)
),
'buttons' => array(
'save-and-stay' => array(
'title' => $this->l('Save and stay'),
'name' => 'submitAdd'.$this->table.'AndStay',
'type' => 'submit',
'class' => 'btn btn-default pull-right',
'icon' => 'process-icon-save',
),
),
);
return parent::renderForm();

View File

@@ -238,8 +238,13 @@ class AdminStatusesControllerCore extends AdminController
'show_admin_template' => $mailToSuperadmin || $mailToEmployee || $mailToHotelier,
);
} else {
$name = array();
foreach ($this->_languages as $language) {
$name[$language['id_lang']] = $this->getFieldValue($order_return_state, 'name', $language['id_lang']);
}
$this->fields_value = array(
'name' => $this->getFieldValue($order_return_state, 'name'),
'name' => $name,
'color' => "#ffffff",
);
}
@@ -478,7 +483,16 @@ class AdminStatusesControllerCore extends AdminController
),
'submit' => array(
'title' => $this->l('Save'),
)
),
'buttons' => array(
'save-and-stay' => array(
'title' => $this->l('Save and stay'),
'name' => 'submitAdd'.$this->table.'AndStay',
'type' => 'submit',
'class' => 'btn btn-default pull-right',
'icon' => 'process-icon-save',
),
),
);
return $this->renderOrderStatusForm();
} elseif (Tools::isSubmit('updateorder_return_state')
@@ -683,7 +697,16 @@ class AdminStatusesControllerCore extends AdminController
),
'submit' => array(
'title' => $this->l('Save'),
)
),
'buttons' => array(
'save-and-stay' => array(
'title' => $this->l('Save and stay'),
'name' => 'submitAdd'.$this->table.'AndStay',
'type' => 'submit',
'class' => 'btn btn-default pull-right',
'icon' => 'process-icon-save',
),
),
);
return parent::renderForm();
@@ -789,7 +812,11 @@ class AdminStatusesControllerCore extends AdminController
if (!$order_return_state->save()) {
$this->errors[] = Tools::displayError('An error has occurred: Can\'t save the current order\'s refund status.');
} else {
Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.$this->token);
if (Tools::isSubmit('submitAddorder_return_stateAndStay')) {
Tools::redirectAdmin(self::$currentIndex.'&updateorder_return_state&id_order_return_state='.$id_order_return_state.'&conf=4&token='.$this->token);
} else {
Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.$this->token);
}
}
}
}

View File

@@ -183,7 +183,16 @@ class AdminTabsControllerCore extends AdminController
),
'submit' => array(
'title' => $this->l('Save'),
)
),
'buttons' => array(
'save-and-stay' => array(
'title' => $this->l('Save and stay'),
'name' => 'submitAdd'.$this->table.'AndStay',
'type' => 'submit',
'class' => 'btn btn-default pull-right',
'icon' => 'process-icon-save',
),
),
);
$this->fields_form['input'][] = array(

View File

@@ -233,7 +233,16 @@ class AdminTaxesControllerCore extends AdminController
),
'submit' => array(
'title' => $this->l('Save')
)
),
'buttons' => array(
'save-and-stay' => array(
'title' => $this->l('Save and stay'),
'name' => 'submitAdd'.$this->table.'AndStay',
'type' => 'submit',
'class' => 'btn btn-default pull-right',
'icon' => 'process-icon-save',
),
),
);
return parent::renderForm();
@@ -258,7 +267,11 @@ class AdminTaxesControllerCore extends AdminController
if (!$result) {
$this->errors[] = Tools::displayError('An error occurred while updating an object.').' <b>'.$this->table.'</b>';
} elseif ($this->postImage($object->id)) {
Tools::redirectAdmin(self::$currentIndex.'&id_'.$this->table.'='.$object->id.'&conf=4'.'&token='.$this->token);
if (Tools::isSubmit('submitAdd'.$this->table.'AndStay')) {
Tools::redirectAdmin(self::$currentIndex.'&update'.$this->table.'&id_'.$this->table.'='.$object->id.'&conf=4'.'&token='.$this->token);
} else {
Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.$this->token);
}
}
} else {
$this->errors[] = Tools::displayError('An error occurred while updating an object.').' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
@@ -272,10 +285,17 @@ class AdminTaxesControllerCore extends AdminController
$this->copyFromPost($object, $this->table);
if (!$object->add()) {
$this->errors[] = Tools::displayError('An error occurred while creating an object.').' <b>'.$this->table.'</b>';
} elseif (($_POST['id_'.$this->table] = $object->id /* voluntary */) && $this->postImage($object->id) && $this->_redirect) {
} elseif ($this->postImage($object->id)) {
if (Tools::isSubmit('submitAdd'.$this->table.'AndStay')) {
Tools::redirectAdmin(self::$currentIndex.'&update'.$this->table.'&id_'.$this->table.'='.$object->id.'&conf=3'.'&token='.$this->token);
} else {
Tools::redirectAdmin(self::$currentIndex.'&conf=3&token='.$this->token);
}
Tools::redirectAdmin(self::$currentIndex.'&id_'.$this->table.'='.$object->id.'&conf=3'.'&token='.$this->token);
}
}
} else {
$this->display = 'add';
}
} else {
parent::postProcess();

View File

@@ -358,7 +358,16 @@ class AdminThemesControllerCore extends AdminController
),
'submit' => array(
'title' => $this->l('Save'),
)
),
'buttons' => array(
'save-and-stay' => array(
'title' => $this->l('Save and stay'),
'name' => 'submitAdd'.$this->table.'AndStay',
'type' => 'submit',
'class' => 'btn btn-default pull-right',
'icon' => 'process-icon-save',
),
),
);
// adding a new theme, you can create a directory, and copy from an existing theme
if ($this->display == 'add' || !Validate::isLoadedObject($this->object)) {
@@ -644,7 +653,12 @@ class AdminThemesControllerCore extends AdminController
}
$theme->update();
}
Tools::redirectAdmin(Context::getContext()->link->getAdminLink('AdminThemes').'&conf=29');
if (Tools::isSubmit('submitAdd'.$this->table.'AndStay')) {
Tools::redirectAdmin(self::$currentIndex.'&update'.$this->table.'&id_theme='.$theme->id.'&token='.$this->token.'&conf=4');
} else {
Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token.'&conf=4');
}
}
}

View File

@@ -271,7 +271,7 @@ class AdminOrderRefundRequestsController extends ModuleAdminController
}
/*If Admin update the status of the order cancellation request*/
if (Tools::isSubmit('submitRefundReqBookings')) {
if (Tools::isSubmit('submitRefundReqBookings') || Tools::isSubmit('submitRefundReqBookingsAndStay')) {
$idOrderReturn = Tools::getValue('id_order_return');
$idsReturnDetail = Tools::getValue('id_order_return_detail');
if (Validate::isLoadedObject($objOrderReturn = new OrderReturn($idOrderReturn))) {
@@ -611,10 +611,18 @@ class AdminOrderRefundRequestsController extends ModuleAdminController
} elseif ($objRefundState->refunded) {
$confirmation = 102;
}
Tools::redirectAdmin(
self::$currentIndex.'&conf='.$confirmation.'&id_order_return='.$idOrderReturn.
'&vieworder_return&token='.$this->token
);
if (Tools::isSubmit('submitRefundReqBookingsAndStay')) {
Tools::redirectAdmin(
self::$currentIndex.'&conf='.$confirmation.'&id_order_return='.$idOrderReturn.
'&vieworder_return&token='.$this->token
);
} else {
Tools::redirectAdmin(
self::$currentIndex.'&conf='.$confirmation.'&id_order='.$objOrder->id.
'&id_order_return='.$idOrderReturn.'&vieworder_return&token='.$this->token
);
}
}
}

View File

@@ -358,6 +358,9 @@
<i class="process-icon-cancel"></i>{l s='Cancel' mod='hotelreservationsystem'}
</a>
<button type="submit" name="submitRefundReqBookings" class="btn btn-default pull-right">
<i class="process-icon-save"></i> {l s='Save' mod='hotelreservationsystem'}
</button>
<button type="submit" name="submitRefundReqBookingsAndStay" class="btn btn-default pull-right">
<i class="process-icon-save"></i> {l s='Save and stay' mod='hotelreservationsystem'}
</button>
</div>

View File

@@ -224,7 +224,17 @@ class AdminFeaturesModuleSettingController extends ModuleAdminController
),
'submit' => array(
'title' => $this->l('Save')
));
),
'buttons' => array(
'save-and-stay' => array(
'title' => $this->l('Save and stay'),
'name' => 'submitAdd'.$this->table.'AndStay',
'type' => 'submit',
'class' => 'btn btn-default pull-right',
'icon' => 'process-icon-save',
),
),
);
return parent::renderForm();
}
@@ -318,10 +328,18 @@ class AdminFeaturesModuleSettingController extends ModuleAdminController
);
}
if ($hotelAmenityId) {
Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.$this->token);
if (Tools::isSubmit('submitAdd'.$this->table.'AndStay')) {
if ($hotelAmenityId) {
Tools::redirectAdmin(self::$currentIndex.'&id_features_block='.(int) $hotelAmenityId.'&update'.$this->table.'&conf=4&token='.$this->token);
} else {
Tools::redirectAdmin(self::$currentIndex.'&id_features_block='.(int) $objFeatureData->id.'&update'.$this->table.'&conf=3&token='.$this->token);
}
} else {
Tools::redirectAdmin(self::$currentIndex.'&conf=3&token='.$this->token);
if ($hotelAmenityId) {
Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.$this->token);
} else {
Tools::redirectAdmin(self::$currentIndex.'&conf=3&token='.$this->token);
}
}
} else {
if ($hotelAmenityId) {