//now use displayError() in modules
This commit is contained in:
1 parent
1cb7f27a21
commit
dec213aecf
6 files changed
+93
-27
No files matched your search
@@ -1320,13 +1320,7 @@ class BlockLayered extends Module
|
|||||||
if (Tools::isSubmit('SubmitFilter'))
|
if (Tools::isSubmit('SubmitFilter'))
|
||||||
{
|
{
|
||||||
if (!Tools::getValue('layered_tpl_name'))
|
if (!Tools::getValue('layered_tpl_name'))
|
||||||
$html .= '
|
$html .= $this->displayError($this->l('Filter template name required (cannot be empty)'));
|
||||||
<div class="error">
|
|
||||||
<span style="float:right">
|
|
||||||
<a href="" id="hideError"><img src="../img/admin/close.png" alt="X"></a>
|
|
||||||
</span>
|
|
||||||
<img src="../img/admin/error2.png">'.$this->l('Filter template name required (cannot be empty)').'
|
|
||||||
</div>';
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (isset($_POST['id_layered_filter']) && $_POST['id_layered_filter'])
|
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');
|
Db::getInstance()->autoExecute(_DB_PREFIX_.'layered_filter', $values_to_insert, 'INSERT');
|
||||||
$this->buildLayeredCategories();
|
$this->buildLayeredCategories();
|
||||||
|
|
||||||
$html .= '<div class="conf">'.
|
$html .= $this->displayConfirmation($this->l('Your filter').' "'.Tools::safeOutput(Tools::getValue('layered_tpl_name')).'" '.
|
||||||
$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.')));
|
||||||
((isset($_POST['id_layered_filter']) && $_POST['id_layered_filter']) ? $this->l('was updated successfully.') : $this->l('was added successfully.')).'</div>';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -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');
|
Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'layered_filter WHERE id_layered_filter = '.(int)$_GET['id_layered_filter'].' LIMIT 1');
|
||||||
$this->buildLayeredCategories();
|
$this->buildLayeredCategories();
|
||||||
|
|
||||||
$html .= '
|
$html .= $this->displayConfirmation($this->l('Filter template deleted, categories updated (reverted to default Filter template).'));
|
||||||
<div class="conf">'.
|
|
||||||
$this->l('Filter template deleted, categories updated (reverted to default Filter template).').'
|
|
||||||
</div>';
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
$html .= $this->displayError($this->l('Filter template not found'));
|
||||||
$html .= '
|
|
||||||
<div class="error">
|
|
||||||
<img src="../img/admin/error.png" alt="" title="" /> '.$this->l('Filter template not found').'
|
|
||||||
</div>';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$html .= '
|
$html .= '
|
||||||
|
|||||||
@@ -61,9 +61,9 @@ class BlockTags extends Module
|
|||||||
if (Tools::isSubmit('submitBlockTags'))
|
if (Tools::isSubmit('submitBlockTags'))
|
||||||
{
|
{
|
||||||
if (!($tagsNbr = Tools::getValue('BLOCKTAGS_NBR')) || empty($tagsNbr))
|
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)
|
elseif ((int)($tagsNbr) == 0)
|
||||||
$output .= $this->displayErrors($this->l('Invalid number.'));
|
$output .= $this->displayError($this->l('Invalid number.'));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Configuration::updateValue('BLOCKTAGS_NBR', (int)$tagsNbr);
|
Configuration::updateValue('BLOCKTAGS_NBR', (int)$tagsNbr);
|
||||||
|
|||||||
@@ -62,9 +62,9 @@ class BlockViewed extends Module
|
|||||||
if (Tools::isSubmit('submitBlockViewed'))
|
if (Tools::isSubmit('submitBlockViewed'))
|
||||||
{
|
{
|
||||||
if (!($productNbr = Tools::getValue('PRODUCTS_VIEWED_NBR')) || empty($productNbr))
|
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)
|
elseif ((int)($productNbr) == 0)
|
||||||
$output .= $this->displayErrors($this->l('Invalid number.'));
|
$output .= $this->displayError($this->l('Invalid number.'));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Configuration::updateValue('PRODUCTS_VIEWED_NBR', (int)$productNbr);
|
Configuration::updateValue('PRODUCTS_VIEWED_NBR', (int)$productNbr);
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ class Cheque extends PaymentModule
|
|||||||
$this->_postProcess();
|
$this->_postProcess();
|
||||||
else
|
else
|
||||||
foreach ($this->_postErrors as $err)
|
foreach ($this->_postErrors as $err)
|
||||||
$this->_html .= $this->displayErrors($err);
|
$this->_html .= $this->displayError($err);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_html .= $this->_displayCheque();
|
$this->_html .= $this->_displayCheque();
|
||||||
|
|||||||
@@ -248,7 +248,7 @@ class ProductComments extends Module
|
|||||||
$defaultLanguage = new Language((int)(Configuration::get('PS_LANG_DEFAULT')));
|
$defaultLanguage = new Language((int)(Configuration::get('PS_LANG_DEFAULT')));
|
||||||
if (!Tools::getValue('criterion_'.$defaultLanguage->id))
|
if (!Tools::getValue('criterion_'.$defaultLanguage->id))
|
||||||
{
|
{
|
||||||
$this->_html .= '<div class="error"><img src="../img/admin/error2.png" />'.$this->l('The field <b>Name</b> is required at least in').' '.$defaultLanguage->name.'</div>';
|
$this->_html .= $this->displayError($this->l('The field <b>Name</b> is required at least in').' '.$defaultLanguage->name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -256,7 +256,7 @@ class ProductComments extends Module
|
|||||||
$productCommentCriterion->active = (int)Tools::getValue('criterion_active');
|
$productCommentCriterion->active = (int)Tools::getValue('criterion_active');
|
||||||
|
|
||||||
if ($productCommentCriterion->save())
|
if ($productCommentCriterion->save())
|
||||||
$this->_html .= '<div class="conf confirm">'.(Tools::getValue('editCriterion') ? $this->l('Criterion updated') : $this->l('Criterion added')).'</div>';
|
$this->_html .= $this->displayConfirmation((Tools::getValue('editCriterion') ? $this->l('Criterion updated') : $this->l('Criterion added')));
|
||||||
}
|
}
|
||||||
else if (!empty($action_criterion) && empty($name))
|
else if (!empty($action_criterion) && empty($name))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -655,4 +655,85 @@ class ReferralProgram extends Module
|
|||||||
}
|
}
|
||||||
return false;
|
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' => '');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user