diff --git a/modules/blocklayered/blocklayered.php b/modules/blocklayered/blocklayered.php index a629345d2..03efc8d51 100644 --- a/modules/blocklayered/blocklayered.php +++ b/modules/blocklayered/blocklayered.php @@ -1320,13 +1320,7 @@ class BlockLayered extends Module if (Tools::isSubmit('SubmitFilter')) { if (!Tools::getValue('layered_tpl_name')) - $html .= ' -
- - X - - '.$this->l('Filter template name required (cannot be empty)').' -
'; + $html .= $this->displayError($this->l('Filter template name required (cannot be empty)')); else { if (isset($_POST['id_layered_filter']) && $_POST['id_layered_filter']) @@ -1409,9 +1403,8 @@ class BlockLayered extends Module Db::getInstance()->autoExecute(_DB_PREFIX_.'layered_filter', $values_to_insert, 'INSERT'); $this->buildLayeredCategories(); - $html .= '
'. - $this->l('Your filter').' "'.Tools::safeOutput(Tools::getValue('layered_tpl_name')).'" '. - ((isset($_POST['id_layered_filter']) && $_POST['id_layered_filter']) ? $this->l('was updated successfully.') : $this->l('was added successfully.')).'
'; + $html .= $this->displayConfirmation($this->l('Your filter').' "'.Tools::safeOutput(Tools::getValue('layered_tpl_name')).'" '. + ((isset($_POST['id_layered_filter']) && $_POST['id_layered_filter']) ? $this->l('was updated successfully.') : $this->l('was added successfully.'))); } } } @@ -1442,18 +1435,10 @@ class BlockLayered extends Module Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'layered_filter WHERE id_layered_filter = '.(int)$_GET['id_layered_filter'].' LIMIT 1'); $this->buildLayeredCategories(); - $html .= ' -
'. - $this->l('Filter template deleted, categories updated (reverted to default Filter template).').' -
'; + $html .= $this->displayConfirmation($this->l('Filter template deleted, categories updated (reverted to default Filter template).')); } else - { - $html .= ' -
- '.$this->l('Filter template not found').' -
'; - } + $html .= $this->displayError($this->l('Filter template not found')); } $html .= ' diff --git a/modules/blocktags/blocktags.php b/modules/blocktags/blocktags.php index 98a9dd173..4e4c24414 100644 --- a/modules/blocktags/blocktags.php +++ b/modules/blocktags/blocktags.php @@ -61,9 +61,9 @@ class BlockTags extends Module if (Tools::isSubmit('submitBlockTags')) { if (!($tagsNbr = Tools::getValue('BLOCKTAGS_NBR')) || empty($tagsNbr)) - $output .= $this->displayErrors($this->l('Please complete the "tags displayed" field.')); + $output .= $this->displayError($this->l('Please complete the "tags displayed" field.')); elseif ((int)($tagsNbr) == 0) - $output .= $this->displayErrors($this->l('Invalid number.')); + $output .= $this->displayError($this->l('Invalid number.')); else { Configuration::updateValue('BLOCKTAGS_NBR', (int)$tagsNbr); diff --git a/modules/blockviewed/blockviewed.php b/modules/blockviewed/blockviewed.php index aa6188f9d..d4e92c1bf 100644 --- a/modules/blockviewed/blockviewed.php +++ b/modules/blockviewed/blockviewed.php @@ -62,9 +62,9 @@ class BlockViewed extends Module if (Tools::isSubmit('submitBlockViewed')) { if (!($productNbr = Tools::getValue('PRODUCTS_VIEWED_NBR')) || empty($productNbr)) - $output .= $this->displayErrors($this->l('You must fill in the \'Products displayed\' field.')); + $output .= $this->displayError($this->l('You must fill in the \'Products displayed\' field.')); elseif ((int)($productNbr) == 0) - $output .= $this->displayErrors($this->l('Invalid number.')); + $output .= $this->displayError($this->l('Invalid number.')); else { Configuration::updateValue('PRODUCTS_VIEWED_NBR', (int)$productNbr); diff --git a/modules/cheque/cheque.php b/modules/cheque/cheque.php index eea1aa831..1aae69bda 100644 --- a/modules/cheque/cheque.php +++ b/modules/cheque/cheque.php @@ -121,7 +121,7 @@ class Cheque extends PaymentModule $this->_postProcess(); else foreach ($this->_postErrors as $err) - $this->_html .= $this->displayErrors($err); + $this->_html .= $this->displayError($err); } $this->_html .= $this->_displayCheque(); diff --git a/modules/productcomments/productcomments.php b/modules/productcomments/productcomments.php index 95e87fe61..c6cd8b8ef 100644 --- a/modules/productcomments/productcomments.php +++ b/modules/productcomments/productcomments.php @@ -248,7 +248,7 @@ class ProductComments extends Module $defaultLanguage = new Language((int)(Configuration::get('PS_LANG_DEFAULT'))); if (!Tools::getValue('criterion_'.$defaultLanguage->id)) { - $this->_html .= '
'.$this->l('The field Name is required at least in').' '.$defaultLanguage->name.'
'; + $this->_html .= $this->displayError($this->l('The field Name is required at least in').' '.$defaultLanguage->name); return; } @@ -256,7 +256,7 @@ class ProductComments extends Module $productCommentCriterion->active = (int)Tools::getValue('criterion_active'); if ($productCommentCriterion->save()) - $this->_html .= '
'.(Tools::getValue('editCriterion') ? $this->l('Criterion updated') : $this->l('Criterion added')).'
'; + $this->_html .= $this->displayConfirmation((Tools::getValue('editCriterion') ? $this->l('Criterion updated') : $this->l('Criterion added'))); } else if (!empty($action_criterion) && empty($name)) { diff --git a/modules/referralprogram/referralprogram.php b/modules/referralprogram/referralprogram.php index 0d497e619..4786772ed 100644 --- a/modules/referralprogram/referralprogram.php +++ b/modules/referralprogram/referralprogram.php @@ -655,4 +655,85 @@ class ReferralProgram extends Module } return false; } + + public function renderForm() + { + $fields_form_1 = array( + 'form' => array( + 'legend' => array( + 'title' => $this->l('Settings'), + 'icon' => 'icon-cogs' + ), + 'input' => array( + array( + 'type' => 'text', + 'name' => '', + 'class' => 'fixed-width-md', + 'label' => $this->l('Minimum number of orders a sponsored friend must place to get their voucher:'), + ), + ), + 'submit' => array( + 'title' => $this->l('Delete catalog'), + 'class' => 'btn btn-primary', + 'name' => 'submitTruncateCatalog', + 'id' => 'submitTruncateCatalog', + ) + ), + ); + + $fields_form_2 = array( + 'form' => array( + 'legend' => array( + 'title' => $this->l('Orders and customers'), + 'icon' => 'icon-cogs' + ), + 'description' => $this->l('I understand that all the orders and customers will be removed without possible rollback: customers, carts, orders, connections, guests, messages, stats...'), + 'submit' => array( + 'title' => $this->l('Delete orders & customers'), + 'class' => 'btn btn-primary', + 'name' => 'submitTruncateSales', + 'id' => 'submitTruncateSales', + ) + ), + ); + + $fields_form_3 = array( + 'form' => array( + 'legend' => array( + 'title' => $this->l('Functional integrity constraints'), + 'icon' => 'icon-cogs' + ), + 'submit' => array( + 'title' => $this->l('Check & fix'), + 'class' => 'btn btn-primary', + 'name' => 'submitCheckAndFix', + ) + ), + ); + + $helper = new HelperForm(); + $helper->show_toolbar = false; + $helper->table = $this->table; + $lang = new Language((int)Configuration::get('PS_LANG_DEFAULT')); + $helper->default_form_language = $lang->id; + $helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0; + $this->fields_form = array(); + $helper->id = (int)Tools::getValue('id_carrier'); + $helper->identifier = $this->identifier; + $helper->submit_action = 'btnSubmit'; + $helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false).'&configure='.$this->name.'&tab_module='.$this->tab.'&module_name='.$this->name; + $helper->token = Tools::getAdminTokenLite('AdminModules'); + $helper->tpl_vars = array( + 'fields_value' => $this->getConfigFieldsValues(), + 'languages' => $this->context->controller->getLanguages(), + 'id_language' => $this->context->language->id + ); + + return $helper->generateForm(array($fields_form_1, $fields_form_2, $fields_form_3)); + } + + public function getConfigFieldsValues() + { + return array('value' => ''); + } }