// Refactoring of admin options

This commit is contained in:
rMalie
2011-08-05 15:52:45 +00:00
parent 9570d3d44f
commit 826d258e70
20 changed files with 338 additions and 234 deletions
+13 -7
View File
@@ -50,14 +50,20 @@ class AdminBackup extends AdminTab
'date' => array('title' => $this->l('Date'), 'type' => 'datetime', 'width' => 120, 'align' => 'right'), 'date' => array('title' => $this->l('Date'), 'type' => 'datetime', 'width' => 120, 'align' => 'right'),
'age' => array('title' => $this->l('Age')), 'age' => array('title' => $this->l('Age')),
'filename' => array('title' => $this->l('File name'), 'width' => 200), 'filename' => array('title' => $this->l('File name'), 'width' => 200),
'filesize' => array('title' => $this->l('File size'))); 'filesize' => array('title' => $this->l('File size'))
$this->optionTitle = $this->l('Backup options'); );
$this->_fieldsOptions = array(
'PS_BACKUP_ALL' => array('title' => $this->l('Ignore statistics tables:'),
'desc' => $this->l('The following tables will NOT be backed up if you enable this option:').'<br />'._DB_PREFIX_.'connections, '._DB_PREFIX_.'connections_page, '._DB_PREFIX_.'connections_source, '._DB_PREFIX_.'guest, '._DB_PREFIX_.'statssearch', 'cast' => 'intval', 'type' => 'bool'),
'PS_BACKUP_DROP_TABLE' => array('title' => $this->l('Drop existing tables during import:'),
'desc' => $this->l('Select this option to instruct the backup file to drop your tables prior to restoring the backed up data').'<br />(ie. "DROP TABLE IF EXISTS")', 'cast' => 'intval', 'type' => 'bool'));
$this->optionsList = array(
'general' => array(
'title' => $this->l('Backup options'),
'fields' => array(
'PS_BACKUP_ALL' => array('title' => $this->l('Ignore statistics tables:'),
'desc' => $this->l('The following tables will NOT be backed up if you enable this option:').'<br />'._DB_PREFIX_.'connections, '._DB_PREFIX_.'connections_page, '._DB_PREFIX_.'connections_source, '._DB_PREFIX_.'guest, '._DB_PREFIX_.'statssearch', 'cast' => 'intval', 'type' => 'bool'),
'PS_BACKUP_DROP_TABLE' => array('title' => $this->l('Drop existing tables during import:'),
'desc' => $this->l('Select this option to instruct the backup file to drop your tables prior to restoring the backed up data').'<br />(ie. "DROP TABLE IF EXISTS")', 'cast' => 'intval', 'type' => 'bool'),
),
),
);
$this->identifier = 'filename'; $this->identifier = 'filename';
} }
+7 -3
View File
@@ -50,9 +50,13 @@ class AdminCarriers extends AdminTab
'is_free' => array('title' => $this->l('Is Free'), 'align' => 'center', 'icon' => array(0 => 'disabled.gif', 1 => 'enabled.gif', 'default' => 'disabled.gif'), 'type' => 'bool', 'orderby' => false) 'is_free' => array('title' => $this->l('Is Free'), 'align' => 'center', 'icon' => array(0 => 'disabled.gif', 1 => 'enabled.gif', 'default' => 'disabled.gif'), 'type' => 'bool', 'orderby' => false)
); );
$this->optionTitle = $this->l('Carrier options'); $this->optionsList = array(
$this->_fieldsOptions = array( 'general' => array(
'PS_CARRIER_DEFAULT' => array('title' => $this->l('Default carrier:'), 'desc' => $this->l('The default carrier used in shop'), 'cast' => 'intval', 'type' => 'select', 'identifier' => 'id_carrier', 'list' => Carrier::getCarriers((int)(Configuration::get('PS_LANG_DEFAULT')), true , false,false, NULL, Carrier::ALL_CARRIERS)), 'title' => $this->l('Carrier options'),
'fields' => array(
'PS_CARRIER_DEFAULT' => array('title' => $this->l('Default carrier:'), 'desc' => $this->l('The default carrier used in shop'), 'cast' => 'intval', 'type' => 'select', 'identifier' => 'id_carrier', 'list' => Carrier::getCarriers((int)Configuration::get('PS_LANG_DEFAULT'), true , false,false, NULL, Carrier::ALL_CARRIERS)),
),
),
); );
parent::__construct(); parent::__construct();
+13 -10
View File
@@ -43,16 +43,19 @@ class AdminContacts extends AdminTab
'email' => array('title' => $this->l('E-mail address'), 'width' => 130), 'email' => array('title' => $this->l('E-mail address'), 'width' => 130),
'description' => array('title' => $this->l('Description'), 'width' => 150), 'description' => array('title' => $this->l('Description'), 'width' => 150),
); );
$this->optionTitle = $this->l('Contact options'); $this->optionsList = array(
$this->_fieldsOptions = array( 'general' => array(
'PS_CUSTOMER_SERVICE_FILE_UPLOAD' => array('title' => $this->l('Allow file upload'), 'desc' => $this->l('Allow customers to upload file using contact page'), 'cast' => 'intval', 'type' => 'select', 'identifier' => 'value', 'list' => array( 'title' => $this->l('Contact options'),
'0' => array('value' => 0, 'name' => $this->l('No')), 'fields' => array(
'1' => array('value' => 1, 'name' => $this->l('Yes')) 'PS_CUSTOMER_SERVICE_FILE_UPLOAD' => array('title' => $this->l('Allow file upload'), 'desc' => $this->l('Allow customers to upload file using contact page'), 'cast' => 'intval', 'type' => 'select', 'identifier' => 'value', 'list' => array(
)), '0' => array('value' => 0, 'name' => $this->l('No')),
'PS_CUSTOMER_SERVICE_SIGNATURE' => array('title' => $this->l('Pre-defined message'), 'desc' => $this->l('Please fill the message that appears by default when you answer a thread on the customer service page'), 'cast' => 'pSQL', 'type' => 'textareaLang', 'identifier' => 'value', '1' => array('value' => 1, 'name' => $this->l('Yes'))
'cols' => 40, 'rows' => 8 )),
)); 'PS_CUSTOMER_SERVICE_SIGNATURE' => array('title' => $this->l('Pre-defined message'), 'desc' => $this->l('Please fill the message that appears by default when you answer a thread on the customer service page'), 'cast' => 'pSQL', 'type' => 'textareaLang', 'identifier' => 'value', 'cols' => 40, 'rows' => 8),
),
),
);
parent::__construct(); parent::__construct();
} }
+15 -10
View File
@@ -40,17 +40,22 @@ class AdminCountries extends AdminTab
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'zone` z ON (z.`id_zone` = a.`id_zone`)'; $this->_join = 'LEFT JOIN `'._DB_PREFIX_.'zone` z ON (z.`id_zone` = a.`id_zone`)';
$this->fieldsDisplay = array( $this->fieldsDisplay = array(
'id_country' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25), 'id_country' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
'name' => array('title' => $this->l('Country'), 'width' => 130, 'filter_key' => 'b!name'), 'name' => array('title' => $this->l('Country'), 'width' => 130, 'filter_key' => 'b!name'),
'iso_code' => array('title' => $this->l('ISO code'), 'width' => 70, 'align' => 'center'), 'iso_code' => array('title' => $this->l('ISO code'), 'width' => 70, 'align' => 'center'),
'call_prefix' => array('title' => $this->l('Call prefix'), 'width' => 40, 'align' => 'center', 'callback' => 'displayCallPrefix'), 'call_prefix' => array('title' => $this->l('Call prefix'), 'width' => 40, 'align' => 'center', 'callback' => 'displayCallPrefix'),
'zone' => array('title' => $this->l('Zone'), 'width' => 100, 'filter_key' => 'z!name'), 'zone' => array('title' => $this->l('Zone'), 'width' => 100, 'filter_key' => 'z!name'),
'a!active' => array('title' => $this->l('Enabled'), 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false, 'filter_key' => 'a!active')); 'a!active' => array('title' => $this->l('Enabled'), 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false, 'filter_key' => 'a!active'),
);
$this->optionTitle = $this->l('Countries options'); $this->optionsList = array(
$this->_fieldsOptions = array( 'general' => array(
'PS_COUNTRY_DEFAULT' => array('title' => $this->l('Default country:'), 'desc' => $this->l('The default country used in shop'), 'cast' => 'intval', 'type' => 'select', 'identifier' => 'id_country', 'list' => Country::getCountries(Context::getContext()->language->id)), 'title' => $this->l('Countries options'),
'PS_RESTRICT_DELIVERED_COUNTRIES' => array('title' => $this->l('Restrict countries in FO by those delivered by active carriers'), 'cast' => 'intval', 'type' => 'bool', 'default' => '0') 'fields' => array(
'PS_COUNTRY_DEFAULT' => array('title' => $this->l('Default country:'), 'desc' => $this->l('The default country used in shop'), 'cast' => 'intval', 'type' => 'select', 'identifier' => 'id_country', 'list' => Country::getCountries(Context::getContext()->language->id)),
'PS_RESTRICT_DELIVERED_COUNTRIES' => array('title' => $this->l('Restrict countries in FO by those delivered by active carriers'), 'cast' => 'intval', 'type' => 'bool', 'default' => '0')
),
),
); );
parent::__construct(); parent::__construct();
+24 -23
View File
@@ -46,21 +46,25 @@ class AdminCurrencies extends AdminTab
'conversion_rate' => array('title' => $this->l('Conversion rate'), 'float' => true, 'align' => 'center', 'width' => 50, 'search' => false), 'conversion_rate' => array('title' => $this->l('Conversion rate'), 'float' => true, 'align' => 'center', 'width' => 50, 'search' => false),
'active' => array('title' => $this->l('Enabled'), 'width' => 25, 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false), 'active' => array('title' => $this->l('Enabled'), 'width' => 25, 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false),
); );
$this->optionTitle = $this->l('Currencies options');
$this->_fieldsOptions = array(
'PS_CURRENCY_DEFAULT' => array(
'title' => $this->l('Default currency:'),
'desc' => $this->l('The default currency used in shop')
.'<div class=warn"><img src="../img/admin/warn2.png" />'.$this->l('If you change default currency, you will have to manually edit every product price.').'</div>',
'cast' => 'intval',
'type' => 'select',
'identifier' => 'id_currency',
'list' => Currency::getCurrencies()
),
);
$this->_where = 'AND a.`deleted` = 0'; $this->_where = 'AND a.`deleted` = 0';
$this->optionsList = array(
'general' => array(
'title' => $this->l('Currencies options'),
'fields' => array(
'PS_CURRENCY_DEFAULT' => array(
'title' => $this->l('Default currency:'),
'desc' => $this->l('The default currency used in shop')
.'<div class=warn"><img src="../img/admin/warn2.png" />'.$this->l('If you change default currency, you will have to manually edit every product price.').'</div>',
'cast' => 'intval',
'type' => 'select',
'identifier' => 'id_currency',
'list' => Currency::getCurrencies()
),
),
),
);
parent::__construct(); parent::__construct();
} }
@@ -104,16 +108,6 @@ class AdminCurrencies extends AdminTab
else else
$this->_errors[] = Tools::displayError('You do not have permission to edit here.'); $this->_errors[] = Tools::displayError('You do not have permission to edit here.');
} }
elseif (Tools::getValue('submitOptions'.$this->table))
{
foreach ($this->_fieldsOptions as $key => $field)
{
Configuration::updateValue($key, $field['cast'](Tools::getValue($key)));
if ($key == 'PS_CURRENCY_DEFAULT')
Currency::refreshCurrencies();
}
Tools::redirectAdmin(self::$currentIndex.'&conf=6'.'&token='.$this->token);
}
elseif (Tools::isSubmit('submitExchangesRates')) elseif (Tools::isSubmit('submitExchangesRates'))
{ {
if (!$this->_errors[] = Currency::refreshCurrencies()) if (!$this->_errors[] = Currency::refreshCurrencies())
@@ -122,10 +116,17 @@ class AdminCurrencies extends AdminTab
else else
parent::postProcess(); parent::postProcess();
} }
public function updateOptionPsCurrencyDefault($value)
{
Configuration::updateValue('PS_CURRENCY_DEFAULT', $value);
Currency::refreshCurrencies();
}
public function displayOptionsList() public function displayOptionsList()
{ {
parent::displayOptionsList(); parent::displayOptionsList();
echo '<br /><br /> echo '<br /><br />
<form action="'.self::$currentIndex.'&token='.$this->token.'" method="post"> <form action="'.self::$currentIndex.'&token='.$this->token.'" method="post">
<fieldset> <fieldset>
+20 -14
View File
@@ -47,23 +47,29 @@ class AdminCustomers extends AdminTab
) as connect'; ) as connect';
$genders = array(1 => $this->l('M'), 2 => $this->l('F'), 9 => $this->l('?')); $genders = array(1 => $this->l('M'), 2 => $this->l('F'), 9 => $this->l('?'));
$this->fieldsDisplay = array( $this->fieldsDisplay = array(
'id_customer' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25), 'id_customer' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
'id_gender' => array('title' => $this->l('Gender'), 'width' => 25, 'align' => 'center', 'icon' => array(1 => 'male.gif', 2 => 'female.gif', 'default' => 'unknown.gif'), 'orderby' => false, 'type' => 'select', 'select' => $genders, 'filter_key' => 'a!id_gender'), 'id_gender' => array('title' => $this->l('Gender'), 'width' => 25, 'align' => 'center', 'icon' => array(1 => 'male.gif', 2 => 'female.gif', 'default' => 'unknown.gif'), 'orderby' => false, 'type' => 'select', 'select' => $genders, 'filter_key' => 'a!id_gender'),
'lastname' => array('title' => $this->l('Last Name'), 'width' => 80), 'lastname' => array('title' => $this->l('Last Name'), 'width' => 80),
'firstname' => array('title' => $this->l('First name'), 'width' => 60), 'firstname' => array('title' => $this->l('First name'), 'width' => 60),
'email' => array('title' => $this->l('E-mail address'), 'width' => 120, 'maxlength' => 19), 'email' => array('title' => $this->l('E-mail address'), 'width' => 120, 'maxlength' => 19),
'age' => array('title' => $this->l('Age'), 'width' => 30, 'search' => false), 'age' => array('title' => $this->l('Age'), 'width' => 30, 'search' => false),
'active' => array('title' => $this->l('Enabled'), 'width' => 25, 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false), 'active' => array('title' => $this->l('Enabled'), 'width' => 25, 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false),
'newsletter' => array('title' => $this->l('News.'), 'width' => 25, 'align' => 'center', 'type' => 'bool', 'callback' => 'printNewsIcon', 'orderby' => false), 'newsletter' => array('title' => $this->l('News.'), 'width' => 25, 'align' => 'center', 'type' => 'bool', 'callback' => 'printNewsIcon', 'orderby' => false),
'optin' => array('title' => $this->l('Opt.'), 'width' => 25, 'align' => 'center', 'type' => 'bool', 'callback' => 'printOptinIcon', 'orderby' => false), 'optin' => array('title' => $this->l('Opt.'), 'width' => 25, 'align' => 'center', 'type' => 'bool', 'callback' => 'printOptinIcon', 'orderby' => false),
'date_add' => array('title' => $this->l('Registration'), 'width' => 30, 'type' => 'date', 'align' => 'right'), 'date_add' => array('title' => $this->l('Registration'), 'width' => 30, 'type' => 'date', 'align' => 'right'),
'connect' => array('title' => $this->l('Connection'), 'width' => 60, 'type' => 'datetime', 'search' => false)); 'connect' => array('title' => $this->l('Connection'), 'width' => 60, 'type' => 'datetime', 'search' => false),
);
$this->shopLinkType = 'shop'; $this->shopLinkType = 'shop';
$this->shopShareDatas = true; $this->shopShareDatas = true;
$this->optionTitle = $this->l('Customers options');
$this->_fieldsOptions = array( $this->optionsList = array(
'PS_PASSWD_TIME_FRONT' => array('title' => $this->l('Regenerate password:'), 'desc' => $this->l('Security minimum time to wait to regenerate the password'),'validation' => 'isUnsignedInt', 'cast' => 'intval', 'size' => 5, 'type' => 'text', 'suffix' => ' '.$this->l('minutes')) 'general' => array(
'title' => $this->l('Customers options'),
'fields' => array(
'PS_PASSWD_TIME_FRONT' => array('title' => $this->l('Regenerate password:'), 'desc' => $this->l('Security minimum time to wait to regenerate the password'),'validation' => 'isUnsignedInt', 'cast' => 'intval', 'size' => 5, 'type' => 'text', 'suffix' => ' '.$this->l('minutes'))
),
),
); );
parent::__construct(); parent::__construct();
+10 -5
View File
@@ -30,11 +30,15 @@ class AdminDeliverySlip extends AdminTab
public function __construct() public function __construct()
{ {
$this->table = 'delivery'; $this->table = 'delivery';
$this->optionTitle = $this->l('Delivery slips options'); $this->optionsList = array(
$this->_fieldsOptions = array( 'general' => array(
'PS_DELIVERY_PREFIX' => array('title' => $this->l('Delivery prefix:'), 'desc' => $this->l('Prefix used for delivery slips'), 'size' => 6, 'type' => 'textLang'), 'title' => $this->l('Delivery slips options'),
'PS_DELIVERY_NUMBER' => array('title' => $this->l('Delivery number:'), 'desc' => $this->l('The next delivery slip will begin with this number, and then increase with each additional slip'), 'size' => 6, 'type' => 'text'), 'fields' => array(
'PS_DELIVERY_PREFIX' => array('title' => $this->l('Delivery prefix:'), 'desc' => $this->l('Prefix used for delivery slips'), 'size' => 6, 'type' => 'textLang'),
'PS_DELIVERY_NUMBER' => array('title' => $this->l('Delivery number:'), 'desc' => $this->l('The next delivery slip will begin with this number, and then increase with each additional slip'), 'size' => 6, 'type' => 'text'),
),
),
); );
parent::__construct(); parent::__construct();
@@ -71,6 +75,7 @@ class AdminDeliverySlip extends AdminTab
public function display() public function display()
{ {
$this->displayForm(); $this->displayForm();
echo '<br />';
$this->displayOptionsList(); $this->displayOptionsList();
} }
+9 -4
View File
@@ -59,11 +59,16 @@ class AdminDiscounts extends AdminTab
'date_to' => array('title' => $this->l('To'), 'width' => 60, 'type' => 'date', 'align' => 'right'), 'date_to' => array('title' => $this->l('To'), 'width' => 60, 'type' => 'date', 'align' => 'right'),
'active' => array('title' => $this->l('Status'), 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false), 'active' => array('title' => $this->l('Status'), 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false),
); );
$this->optionTitle = $this->l('Discounts options'); $this->optionsList = array(
$this->_fieldsOptions = array( 'general' => array(
'PS_VOUCHERS' => array('title' => $this->l('Enable vouchers:'), 'desc' => $this->l('Allow the use of vouchers in shop'), 'cast' => 'intval', 'type' => 'bool'), 'title' => $this->l('Discounts options'),
'fields' => array(
'PS_VOUCHERS' => array('title' => $this->l('Enable vouchers:'), 'desc' => $this->l('Allow the use of vouchers in shop'), 'cast' => 'intval', 'type' => 'bool'),
),
),
); );
parent::__construct(); parent::__construct();
} }
+18 -13
View File
@@ -50,20 +50,25 @@ class AdminEmployees extends AdminTab
$this->profilesArray[$profile['name']] = $profile['name']; $this->profilesArray[$profile['name']] = $profile['name'];
$this->fieldsDisplay = array( $this->fieldsDisplay = array(
'id_employee' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25), 'id_employee' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
'lastname' => array('title' => $this->l('Last name'), 'width' => 130), 'lastname' => array('title' => $this->l('Last name'), 'width' => 130),
'firstname' => array('title' => $this->l('First name'), 'width' => 130), 'firstname' => array('title' => $this->l('First name'), 'width' => 130),
'email' => array('title' => $this->l('E-mail address'), 'width' => 180), 'email' => array('title' => $this->l('E-mail address'), 'width' => 180),
'profile' => array('title' => $this->l('Profile'), 'width' => 90, 'type' => 'select', 'select' => $this->profilesArray, 'filter_key' => 'pl!name'), 'profile' => array('title' => $this->l('Profile'), 'width' => 90, 'type' => 'select', 'select' => $this->profilesArray, 'filter_key' => 'pl!name'),
'active' => array('title' => $this->l('Can log in'), 'align' => 'center', 'active' => 'status', 'type' => 'bool')); 'active' => array('title' => $this->l('Can log in'), 'align' => 'center', 'active' => 'status', 'type' => 'bool'),
);
$this->optionTitle = $this->l('Employees options'); $this->optionsList = array(
$this->_fieldsOptions = array( 'general' => array(
'PS_PASSWD_TIME_BACK' => array('title' => $this->l('Password regenerate:'), 'desc' => $this->l('Security minimum time to wait to regenerate a new password'), 'cast' => 'intval', 'size' => 5, 'type' => 'text', 'suffix' => ' '.$this->l('minutes'), 'visibility' => Shop::CONTEXT_ALL), 'title' => $this->l('Employees options'),
'PS_BO_ALLOW_EMPLOYEE_FORM_LANG' => array('title' => $this->l('Memorize form language:'), 'desc' => $this->l('Allow employees to save their own default form language'), 'cast' => 'intval', 'type' => 'select', 'identifier' => 'value', 'list' => array( 'fields' => array(
'0' => array('value' => 0, 'name' => $this->l('No')), 'PS_PASSWD_TIME_BACK' => array('title' => $this->l('Password regenerate:'), 'desc' => $this->l('Security minimum time to wait to regenerate a new password'), 'cast' => 'intval', 'size' => 5, 'type' => 'text', 'suffix' => ' '.$this->l('minutes'), 'visibility' => Shop::CONTEXT_ALL),
'1' => array('value' => 1, 'name' => $this->l('Yes')) 'PS_BO_ALLOW_EMPLOYEE_FORM_LANG' => array('title' => $this->l('Memorize form language:'), 'desc' => $this->l('Allow employees to save their own default form language'), 'cast' => 'intval', 'type' => 'select', 'identifier' => 'value', 'list' => array(
), 'visibility' => Shop::CONTEXT_ALL) '0' => array('value' => 0, 'name' => $this->l('No')),
'1' => array('value' => 1, 'name' => $this->l('Yes'))
), 'visibility' => Shop::CONTEXT_ALL)
),
),
); );
parent::__construct(); parent::__construct();
+15 -13
View File
@@ -31,11 +31,15 @@ class AdminInvoices extends AdminTab
{ {
$this->table = 'invoice'; $this->table = 'invoice';
$this->optionTitle = $this->l('Invoice options'); $this->optionsList = array(
$this->_fieldsOptions = array( 'general' => array(
'PS_INVOICE' => array('title' => $this->l('Enable invoices:'), 'desc' => $this->l('Select whether or not to activate invoices for your shop'), 'cast' => 'intval', 'type' => 'bool'), 'title' => $this->l('Invoice options'),
'PS_INVOICE_PREFIX' => array('title' => $this->l('Invoice prefix:'), 'desc' => $this->l('Prefix used for invoices'), 'size' => 6, 'type' => 'textLang'), 'fields' => array(
'PS_INVOICE_START_NUMBER' => array('title' => $this->l('Invoice number:'), 'desc' => $this->l('The next invoice will begin with this number, and then increase with each additional invoice. Set to 0 if you want to keep the current number (#').(Order::getLastInvoiceNumber() + 1).').', 'size' => 6, 'type' => 'text', 'cast' => 'intval') 'PS_INVOICE' => array('title' => $this->l('Enable invoices:'), 'desc' => $this->l('Select whether or not to activate invoices for your shop'), 'cast' => 'intval', 'type' => 'bool'),
'PS_INVOICE_PREFIX' => array('title' => $this->l('Invoice prefix:'), 'desc' => $this->l('Prefix used for invoices'), 'size' => 6, 'type' => 'textLang'),
'PS_INVOICE_START_NUMBER' => array('title' => $this->l('Invoice number:'), 'desc' => $this->l('The next invoice will begin with this number, and then increase with each additional invoice. Set to 0 if you want to keep the current number (#').(Order::getLastInvoiceNumber() + 1).').', 'size' => 6, 'type' => 'text', 'cast' => 'intval')
),
),
); );
parent::__construct(); parent::__construct();
@@ -139,15 +143,13 @@ class AdminInvoices extends AdminTab
$this->_errors[] = $this->l('No invoice found for this status'); $this->_errors[] = $this->l('No invoice found for this status');
} }
} }
elseif (Tools::isSubmit('submitOptionsinvoice'))
{
if ((int)(Tools::getValue('PS_INVOICE_START_NUMBER')) != 0 AND (int)(Tools::getValue('PS_INVOICE_START_NUMBER')) <= Order::getLastInvoiceNumber())
$this->_errors[] = $this->l('Invalid invoice number (must be > ').Order::getLastInvoiceNumber() .')';
else
parent::postProcess();
}
else else
parent::postProcess(); parent::postProcess();
} }
public function beforeUpdateOptions()
{
if ((int)Tools::getValue('PS_INVOICE_START_NUMBER') != 0 AND (int)Tools::getValue('PS_INVOICE_START_NUMBER') <= Order::getLastInvoiceNumber())
$this->_errors[] = $this->l('Invalid invoice number (must be > ').Order::getLastInvoiceNumber() .')';
}
} }
+16 -13
View File
@@ -45,12 +45,16 @@ class AdminLanguages extends AdminTab
'language_code' => array('title' => $this->l('Language code'), 'width' => 70, 'align' => 'center'), 'language_code' => array('title' => $this->l('Language code'), 'width' => 70, 'align' => 'center'),
'active' => array('title' => $this->l('Enabled'), 'align' => 'center', 'active' => 'status', 'type' => 'bool'), 'active' => array('title' => $this->l('Enabled'), 'align' => 'center', 'active' => 'status', 'type' => 'bool'),
); );
$this->optionTitle = $this->l('Languages options');
$this->_fieldsOptions = array(
'PS_LANG_DEFAULT' => array('title' => $this->l('Default language:'), 'desc' => $this->l('The default language used in shop'), 'cast' => 'intval', 'type' => 'select', 'identifier' => 'id_lang', 'list' => Language::getlanguages(false)),
);
$this->optionsList = array(
'general' => array(
'title' => $this->l('Languages options'),
'fields' => array(
'PS_LANG_DEFAULT' => array('title' => $this->l('Default language:'), 'desc' => $this->l('The default language used in shop'), 'cast' => 'intval', 'type' => 'select', 'identifier' => 'id_lang', 'list' => Language::getlanguages(false)),
),
),
);
parent::__construct(); parent::__construct();
} }
@@ -229,18 +233,17 @@ class AdminLanguages extends AdminTab
else else
$this->_errors[] = Tools::displayError('You do not have permission to edit here.'); $this->_errors[] = Tools::displayError('You do not have permission to edit here.');
} }
elseif (Tools::isSubmit('submitOptions'.$this->table))
{
$lang = new Language((int)Tools::getValue('PS_LANG_DEFAULT'));
if (!$lang->active)
$this->_errors[] = Tools::displayError('You cannot set this language as default language because it\'s disabled');
else
return parent::postProcess();
}
else else
return parent::postProcess(); return parent::postProcess();
} }
public function beforeUpdateOptions()
{
$lang = new Language((int)Tools::getValue('PS_LANG_DEFAULT'));
if (!$lang->active)
$this->_errors[] = Tools::displayError('You cannot set this language as default language because it\'s disabled');
}
public function displayList() public function displayList()
{ {
$this->displayWarning($this->l('When you delete a language, all related translations in the database will be deleted.')); $this->displayWarning($this->l('When you delete a language, all related translations in the database will be deleted.'));
+27 -23
View File
@@ -47,16 +47,20 @@ class AdminLogs extends AdminTab
'object_id' => array('title' => $this->l('Object ID'), 'width' => 50), 'object_id' => array('title' => $this->l('Object ID'), 'width' => 50),
'error_code' => array('title' => $this->l('Error code'), 'width' => 75, 'prefix' => '0x'), 'error_code' => array('title' => $this->l('Error code'), 'width' => 75, 'prefix' => '0x'),
'date_add' => array('title' => $this->l('Date'), 'width' => 35, 'align' => 'right', 'type' => 'datetime')); 'date_add' => array('title' => $this->l('Date'), 'width' => 35, 'align' => 'right', 'type' => 'datetime'));
$this->optionTitle = $this->l('Logs by e-mail'); $this->optionsList = array(
$this->_fieldsOptions = array( 'general' => array(
'PS_LOGS_BY_EMAIL' => array( 'title' => $this->l('Logs by e-mail'),
'title' => $this->l('Minimum severity level:'), 'fields' => array(
'desc' => $this->l('Put "5" if you don\'t want to receive any emails.').'<br />'.$this->l('Emails will be sent to the shop owner.'), 'PS_LOGS_BY_EMAIL' => array(
'cast' => 'intval', 'title' => $this->l('Minimum severity level:'),
'type' => 'text', 'desc' => $this->l('Put "5" if you don\'t want to receive any emails.').'<br />'.$this->l('Emails will be sent to the shop owner.'),
'size' => 5 'cast' => 'intval',
) 'type' => 'text',
'size' => 5
),
),
),
); );
parent::__construct(); parent::__construct();
@@ -64,19 +68,19 @@ class AdminLogs extends AdminTab
public function displayListHeader($token = NULL) public function displayListHeader($token = NULL)
{ {
echo ' echo '
<fieldset> <fieldset>
<legend>'.$this->l('Severity levels').'</legend> <legend>'.$this->l('Severity levels').'</legend>
<p>'.$this->l('Here\'s the meaning of severity levels:').'</p> <p>'.$this->l('Here\'s the meaning of severity levels:').'</p>
<ol> <ol>
<li style="color: green;">'.$this->l('Informative only').'</li> <li style="color: green;">'.$this->l('Informative only').'</li>
<li style="color: orange;">'.$this->l('Warning').'</li> <li style="color: orange;">'.$this->l('Warning').'</li>
<li style="color: orange;">'.$this->l('Error').'</li> <li style="color: orange;">'.$this->l('Error').'</li>
<li style="color: red;">'.$this->l('Major issue (crash)').'</li> <li style="color: red;">'.$this->l('Major issue (crash)').'</li>
</ol> </ol>
</fieldset>'; </fieldset>';
parent::displayListHeader(); parent::displayListHeader();
} }
} }
+18 -36
View File
@@ -44,15 +44,23 @@ class AdminMeta extends AdminTab
'url_rewrite' => array('title' => $this->l('Friendly URL'), 'width' => 120) 'url_rewrite' => array('title' => $this->l('Friendly URL'), 'width' => 120)
); );
$this->_group = 'GROUP BY a.id_meta'; $this->_group = 'GROUP BY a.id_meta';
$this->optionTitle = $this->l('URLs Setup'); $this->optionsList = array(
$this->_fieldsOptions = array( 'general' => array(
'PS_REWRITING_SETTINGS' => array('title' => $this->l('Friendly URL'), 'desc' => $this->l('Enable only if your server allows URL rewriting (recommended)').'<p class="hint clear" style="display: block;">'.$this->l('If you turn on this feature, you must').' <a href="?tab=AdminGenerator&token='.Tools::getAdminToken('AdminGenerator'.(int)(Tab::getIdFromClassName('AdminGenerator')).(int)$this->context->employee->id).'">'.$this->l('generate a .htaccess file').'</a></p><div class="clear"></div>', 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'title' => $this->l('URLs Setup'),
'PS_CANONICAL_REDIRECT' => array('title' => $this->l('Automatically redirect to Canonical url'), 'desc' => $this->l('Recommended but your theme must be compliant'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'fields' => array(
'PS_REWRITING_SETTINGS' => array('title' => $this->l('Friendly URL'), 'desc' => $this->l('Enable only if your server allows URL rewriting (recommended)').'<p class="hint clear" style="display: block;">'.$this->l('If you turn on this feature, you must').' <a href="?tab=AdminGenerator&token='.Tools::getAdminToken('AdminGenerator'.(int)(Tab::getIdFromClassName('AdminGenerator')).(int)$this->context->employee->id).'">'.$this->l('generate a .htaccess file').'</a></p><div class="clear"></div>', 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'),
'PS_CANONICAL_REDIRECT' => array('title' => $this->l('Automatically redirect to Canonical url'), 'desc' => $this->l('Recommended but your theme must be compliant'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'),
),
),
'routes' => array(
'title' => $this->l('Schema of URLs'),
'description' => $this->l('You can change here the pattern of your links. There are some available keywords for each route listed below, keywords with * are required. To add a keyword in URL use {keyword} syntax. You can add some text before or after the keyword IF the keyword is not empty with syntax {prepend:keyword:append}, for example {-hey-:meta_title} will add "-hey-my-title" in URL if meta title is set, or nothing. Friendly URL and rewriting Apache option must be activated on your web server to use this functionality.'),
'fields' => array(),
),
); );
// Display route options only if friendly URL is activated // Display route options only if friendly URL is activated
$this->_fieldsRoutes = array();
if (Configuration::get('PS_REWRITING_SETTINGS')) if (Configuration::get('PS_REWRITING_SETTINGS'))
{ {
$this->addFieldRoute('product_rule', $this->l('Route to products')); $this->addFieldRoute('product_rule', $this->l('Route to products'));
@@ -70,7 +78,7 @@ class AdminMeta extends AdminTab
foreach (Dispatcher::getInstance()->defaultRoutes[$routeID]['keywords'] as $keyword => $data) foreach (Dispatcher::getInstance()->defaultRoutes[$routeID]['keywords'] as $keyword => $data)
$keywords[] = ((isset($data['param'])) ? '<span class="red">'.$keyword.'*</span>' : $keyword); $keywords[] = ((isset($data['param'])) ? '<span class="red">'.$keyword.'*</span>' : $keyword);
$this->_fieldsRoutes['PS_ROUTE_'.$routeID] = array( $this->optionsList['routes']['fields']['PS_ROUTE_'.$routeID] = array(
'title' => $title, 'title' => $title,
'desc' => sprintf($this->l('Keywords: %s'), implode(', ', $keywords)), 'desc' => sprintf($this->l('Keywords: %s'), implode(', ', $keywords)),
'validation' => 'isString', 'validation' => 'isString',
@@ -79,34 +87,7 @@ class AdminMeta extends AdminTab
'defaultValue' => Dispatcher::getInstance()->defaultRoutes[$routeID]['rule'], 'defaultValue' => Dispatcher::getInstance()->defaultRoutes[$routeID]['rule'],
); );
} }
protected function updateOptions($token)
{
if ($this->tabAccess['edit'] === '1')
{
$this->submitConfiguration($this->_fieldsRoutes);
parent::updateOptions($token);
}
else
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
}
public function displayOptionsList($fieldsOptions = null, $optionTitle = null, $optionDescription = null)
{
// Desactivate <form>, we want to add our own tags
$this->formOptions = false;
$tab = Tab::getTab($this->context->language->id, $this->id);
echo '<form action="'.self::$currentIndex.'" id="'.$tab['name'].'" name="'.$tab['name'].'" method="post">';
parent::displayOptionsList();
if ($this->_fieldsRoutes)
{
$desc = $this->l('You can change here the pattern of your links. There are some available keywords for each route listed below, keywords with * are required. To add a keyword in URL use {keyword} syntax. You can add some text before or after the keyword IF the keyword is not empty with syntax {prepend:keyword:append}, for example {-hey-:meta_title} will add "-hey-my-title" in URL if meta title is set, or nothing. Friendly URL and rewriting Apache option must be activated on your web server to use this functionality.');
parent::displayOptionsList($this->_fieldsRoutes, $this->l('Schema of URLs'), $desc);
}
echo '</form>';
}
public function displayForm($isMainTab = true) public function displayForm($isMainTab = true)
{ {
parent::displayForm(); parent::displayForm();
@@ -210,11 +191,13 @@ class AdminMeta extends AdminTab
$defaultLangIsValidated = !Tools::getValue('url_rewrite_'.$default_language) OR Validate::isLinkRewrite(Tools::getValue('url_rewrite_'.$default_language)); $defaultLangIsValidated = !Tools::getValue('url_rewrite_'.$default_language) OR Validate::isLinkRewrite(Tools::getValue('url_rewrite_'.$default_language));
$englishLangIsValidated = !Tools::getValue('url_rewrite_1') OR Validate::isLinkRewrite(Tools::getValue('url_rewrite_1')); $englishLangIsValidated = !Tools::getValue('url_rewrite_1') OR Validate::isLinkRewrite(Tools::getValue('url_rewrite_1'));
} }
if (!$defaultLangIsValidated AND !$englishLangIsValidated) if (!$defaultLangIsValidated AND !$englishLangIsValidated)
{ {
$this->_errors[] = Tools::displayError('Url rewrite field must be filled at least in default or english language.'); $this->_errors[] = Tools::displayError('Url rewrite field must be filled at least in default or english language.');
return false; return false;
} }
foreach ($langs as $lang) foreach ($langs as $lang)
{ {
$current = Tools::getValue('url_rewrite_'.$lang['id_lang']); $current = Tools::getValue('url_rewrite_'.$lang['id_lang']);
@@ -225,9 +208,8 @@ class AdminMeta extends AdminTab
else else
$_POST['url_rewrite_'.$lang['id_lang']] = Tools::getValue('url_rewrite_1'); $_POST['url_rewrite_'.$lang['id_lang']] = Tools::getValue('url_rewrite_1');
} }
}
if (Tools::isSubmit('submitOptions'.$this->table) OR Tools::isSubmit('submitAddmeta'))
Module::hookExec('afterSaveAdminMeta'); Module::hookExec('afterSaveAdminMeta');
}
return parent::postProcess(); return parent::postProcess();
} }
+13 -10
View File
@@ -37,15 +37,20 @@ class AdminReturn extends AdminTab
$this->_join = 'LEFT JOIN '._DB_PREFIX_.'order_return_state_lang orsl ON (orsl.`id_order_return_state` = a.`state` AND orsl.`id_lang` = '.(int)$this->context->language->id.')'; $this->_join = 'LEFT JOIN '._DB_PREFIX_.'order_return_state_lang orsl ON (orsl.`id_order_return_state` = a.`state` AND orsl.`id_lang` = '.(int)$this->context->language->id.')';
$this->fieldsDisplay = array( $this->fieldsDisplay = array(
'id_order_return' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25), 'id_order_return' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
'id_order' => array('title' => $this->l('Order ID'), 'width' => 75, 'align' => 'center'), 'id_order' => array('title' => $this->l('Order ID'), 'width' => 75, 'align' => 'center'),
'name' => array('title' => $this->l('Status'), 'width' => 150, 'align' => 'center'), 'name' => array('title' => $this->l('Status'), 'width' => 150, 'align' => 'center'),
'date_add' => array('title' => $this->l('Date issued'), 'width' => 60, 'type' => 'date', 'align' => 'right')); 'date_add' => array('title' => $this->l('Date issued'), 'width' => 60, 'type' => 'date', 'align' => 'right'),
);
$this->optionTitle = $this->l('Merchandise return (RMA) options'); $this->optionsList = array(
$this->_fieldsOptions = array( 'general' => array(
'PS_ORDER_RETURN' => array('title' => $this->l('Enable returns:'), 'desc' => $this->l('Select whether or not to activate merchandise return for your shop'), 'cast' => 'intval', 'type' => 'bool'), 'title' => $this->l('Merchandise return (RMA) options'),
'PS_ORDER_RETURN_NB_DAYS' => array('title' => $this->l('Time limit of validity:'), 'desc' => $this->l('Number of days the customer can make a return after the delivery date'), 'cast' => 'intval', 'type' => 'text', 'size' => '2'), 'fields' => array(
'PS_ORDER_RETURN' => array('title' => $this->l('Enable returns:'), 'desc' => $this->l('Select whether or not to activate merchandise return for your shop'), 'cast' => 'intval', 'type' => 'bool'),
'PS_ORDER_RETURN_NB_DAYS' => array('title' => $this->l('Time limit of validity:'), 'desc' => $this->l('Number of days the customer can make a return after the delivery date'), 'cast' => 'intval', 'type' => 'text', 'size' => '2'),
),
),
); );
parent::__construct(); parent::__construct();
@@ -281,5 +286,3 @@ class AdminReturn extends AdminTab
</form>'; </form>';
} }
} }
+9 -4
View File
@@ -49,10 +49,15 @@ class AdminShop extends AdminTab
'category_name' => array('title' => $this->l('Category Root'), 'width' => 70), 'category_name' => array('title' => $this->l('Category Root'), 'width' => 70),
'active' => array('title' => $this->l('Enabled'), 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false, 'filter_key' => 'active'), 'active' => array('title' => $this->l('Enabled'), 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false, 'filter_key' => 'active'),
); );
$this->optionTitle = $this->l('Shops options'); $this->optionsList = array(
$this->_fieldsOptions = array('PS_SHOP_DEFAULT' => array('title' => $this->l('Default shop:'), 'desc' => $this->l('The default shop'), 'cast' => 'intval', 'type' => 'select', 'identifier' => 'id_shop', 'list' => Shop::getShops(), 'visibility' => Shop::CONTEXT_ALL)); 'general' => array(
'title' => $this->l('Shops options'),
'fields' => array(
'PS_SHOP_DEFAULT' => array('title' => $this->l('Default shop:'), 'desc' => $this->l('The default shop'), 'cast' => 'intval', 'type' => 'select', 'identifier' => 'id_shop', 'list' => Shop::getShops(), 'visibility' => Shop::CONTEXT_ALL)
),
),
);
parent::__construct(); parent::__construct();
} }
+21 -12
View File
@@ -37,12 +37,12 @@ class AdminStockMvt extends AdminTab
$this->view = true; $this->view = true;
$this->fieldsDisplay = array( $this->fieldsDisplay = array(
'id_stock_mvt' => array('title' => $this->l('ID'), 'width' => 40), 'id_stock_mvt' => array('title' => $this->l('ID'), 'width' => 40),
'product_name' => array('title' => $this->l('Product Name'), 'width' => 250, 'havingFilter' => true), 'product_name' => array('title' => $this->l('Product Name'), 'width' => 250, 'havingFilter' => true),
'quantity' => array('title' => $this->l('Quantity'), 'width' => 40), 'quantity' => array('title' => $this->l('Quantity'), 'width' => 40),
'reason' => array('title' => $this->l('Reason'), 'width' => 250), 'reason' => array('title' => $this->l('Reason'), 'width' => 250),
'id_order' => array('title' => $this->l('ID Order'), 'width' => 40), 'id_order' => array('title' => $this->l('ID Order'), 'width' => 40),
'employee' => array('title' => $this->l('Employee'), 'width' => 100, 'havingFilter' => true), 'employee' => array('title' => $this->l('Employee'), 'width' => 100, 'havingFilter' => true),
); );
@@ -177,12 +177,21 @@ class AdminStockMvt extends AdminTab
'name' => array('title' => $this->l('Name'), 'width' => 500)); 'name' => array('title' => $this->l('Name'), 'width' => 500));
$reasons = StockMvtReason::getStockMvtReasons($this->context->language->id); $reasons = StockMvtReason::getStockMvtReasons($this->context->language->id);
$this->_fieldsOptions = array('PS_STOCK_MVT_REASON_DEFAULT' => array('title' => $this->l('Default Stock Movement reason:'),
'cast' => 'intval', $this->optionsList = array(
'type' => 'select', 'general' => array(
'list' => $reasons, 'title' => $this->l('Options'),
'identifier' => 'id_stock_mvt_reason')); 'fields' => array(
'PS_STOCK_MVT_REASON_DEFAULT' => array(
'title' => $this->l('Default Stock Movement reason:'),
'cast' => 'intval',
'type' => 'select',
'list' => $reasons,
'identifier' => 'id_stock_mvt_reason'
),
),
),
);
unset($this->_select, $this->_join, $this->_group, $this->_filterHaving, $this->_filter); unset($this->_select, $this->_join, $this->_group, $this->_filterHaving, $this->_filter);
echo '<h2>'.$this->l('Stock movement reason').'</h2>'; echo '<h2>'.$this->l('Stock movement reason').'</h2>';
+13 -9
View File
@@ -63,15 +63,19 @@ class AdminStores extends AdminTab
'fax' => array('title' => $this->l('Fax'), 'width' => 70), 'fax' => array('title' => $this->l('Fax'), 'width' => 70),
'active' => array('title' => $this->l('Enabled'), 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false) 'active' => array('title' => $this->l('Enabled'), 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false)
); );
$this->optionTitle = $this->l('Parameters'); $this->optionsList = array(
$this->_fieldsOptions = array( 'general' => array(
'PS_STORES_DISPLAY_FOOTER' => array('title' => $this->l('Display in the footer:'), 'desc' => $this->l('Display a link to the store locator in the footer'), 'cast' => 'intval', 'type' => 'bool'), 'title' => $this->l('Parameters'),
'PS_STORES_DISPLAY_SITEMAP' => array('title' => $this->l('Display in the sitemap page:'), 'desc' => $this->l('Display a link to the store locator in the sitemap page'), 'cast' => 'intval', 'type' => 'bool'), 'fields' => array(
'PS_STORES_SIMPLIFIED' => array('title' => $this->l('Show a simplified store locator:'), 'desc' => $this->l('No map, no search, only a store directory'), 'cast' => 'intval', 'type' => 'bool'), 'PS_STORES_DISPLAY_FOOTER' => array('title' => $this->l('Display in the footer:'), 'desc' => $this->l('Display a link to the store locator in the footer'), 'cast' => 'intval', 'type' => 'bool'),
'PS_STORES_CENTER_LAT' => array('title' => $this->l('Latitude by default:'), 'desc' => $this->l('Used for the position by default of the map'), 'cast' => 'floatval', 'type' => 'float', 'size' => '10'), 'PS_STORES_DISPLAY_SITEMAP' => array('title' => $this->l('Display in the sitemap page:'), 'desc' => $this->l('Display a link to the store locator in the sitemap page'), 'cast' => 'intval', 'type' => 'bool'),
'PS_STORES_CENTER_LONG' => array('title' => $this->l('Longitude by default:'), 'desc' => $this->l('Used for the position by default of the map'), 'cast' => 'floatval', 'type' => 'float', 'size' => '10')); 'PS_STORES_SIMPLIFIED' => array('title' => $this->l('Show a simplified store locator:'), 'desc' => $this->l('No map, no search, only a store directory'), 'cast' => 'intval', 'type' => 'bool'),
'PS_STORES_CENTER_LAT' => array('title' => $this->l('Latitude by default:'), 'desc' => $this->l('Used for the position by default of the map'), 'cast' => 'floatval', 'type' => 'text', 'size' => '10'),
'PS_STORES_CENTER_LONG' => array('title' => $this->l('Longitude by default:'), 'desc' => $this->l('Used for the position by default of the map'), 'cast' => 'floatval', 'type' => 'text', 'size' => '10')
),
),
);
parent::__construct(); parent::__construct();
} }
+14 -11
View File
@@ -45,17 +45,21 @@ class AdminTaxes extends AdminTab
if (Configuration::get('PS_USE_ECOTAX')) if (Configuration::get('PS_USE_ECOTAX'))
$ecotax_desc = $this->l('If you disable the ecotax, the ecotax for all your products will be set to 0'); $ecotax_desc = $this->l('If you disable the ecotax, the ecotax for all your products will be set to 0');
$this->optionTitle = $this->l('Tax options'); $this->optionsList = array(
$this->_fieldsOptions = array( 'general' => array(
'PS_TAX' => array('title' => $this->l('Enable tax:'), 'desc' => $this->l('Select whether or not to include tax on purchases'), 'cast' => 'intval', 'type' => 'bool'), 'title' => $this->l('Tax options'),
'PS_TAX_DISPLAY' => array('title' => $this->l('Display tax in cart:'), 'desc' => $this->l('Select whether or not to display tax on a distinct line in the cart'), 'cast' => 'intval', 'type' => 'bool'), 'fields' => array(
'PS_TAX_ADDRESS_TYPE' => array('title' => $this->l('Base on:'), 'cast' => 'pSQL', 'type' => 'select', 'list' => array(array('name' => $this->l('Invoice Address'), 'id' => 'id_address_invoice'), array('name' => $this->l('Delivery Address'), 'id' => 'id_address_delivery')), 'identifier' => 'id'), 'PS_TAX' => array('title' => $this->l('Enable tax:'), 'desc' => $this->l('Select whether or not to include tax on purchases'), 'cast' => 'intval', 'type' => 'bool'),
'PS_USE_ECOTAX' => array('title' => $this->l('Use ecotax'), 'desc' => $ecotax_desc, 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_TAX_DISPLAY' => array('title' => $this->l('Display tax in cart:'), 'desc' => $this->l('Select whether or not to display tax on a distinct line in the cart'), 'cast' => 'intval', 'type' => 'bool'),
'PS_TAX_ADDRESS_TYPE' => array('title' => $this->l('Base on:'), 'cast' => 'pSQL', 'type' => 'select', 'list' => array(array('name' => $this->l('Invoice Address'), 'id' => 'id_address_invoice'), array('name' => $this->l('Delivery Address'), 'id' => 'id_address_delivery')), 'identifier' => 'id'),
'PS_USE_ECOTAX' => array('title' => $this->l('Use ecotax'), 'desc' => $ecotax_desc, 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'),
),
),
); );
if (Configuration::get('PS_USE_ECOTAX')) if (Configuration::get('PS_USE_ECOTAX'))
$this->_fieldsOptions['PS_ECOTAX_TAX_RULES_GROUP_ID'] = array('title' => $this->l('Ecotax:'), 'desc' => $this->l('The tax to apply on the ecotax (e.g., French ecotax: 19.6%).'), $this->optionsList['general']['fields']['PS_ECOTAX_TAX_RULES_GROUP_ID'] = array('title' => $this->l('Ecotax:'), 'desc' => $this->l('The tax to apply on the ecotax (e.g., French ecotax: 19.6%).'),
'cast' => 'intval', 'type' => 'select', 'identifier' => 'id_tax', 'identifier' => 'id_tax_rules_group', 'list' => TaxRulesGroup::getTaxRulesGroupsForOptions()); 'cast' => 'intval', 'type' => 'select', 'identifier' => 'id_tax', 'identifier' => 'id_tax_rules_group', 'list' => TaxRulesGroup::getTaxRulesGroupsForOptions());
parent::__construct(); parent::__construct();
} }
@@ -106,7 +110,7 @@ class AdminTaxes extends AdminTab
public function postProcess() public function postProcess()
{ {
if(Tools::getValue('submitAdd'.$this->table)) if (Tools::getValue('submitAdd'.$this->table))
{ {
/* Checking fields validity */ /* Checking fields validity */
$this->validateRules(); $this->validateRules();
@@ -196,7 +200,6 @@ class AdminTaxes extends AdminTab
Product::resetEcoTax(); Product::resetEcoTax();
Configuration::updateValue('PS_USE_ECOTAX', (int)$value); Configuration::updateValue('PS_USE_ECOTAX', (int)$value);
} }
} }
} }
+23 -13
View File
@@ -40,28 +40,37 @@ class AdminWebservice extends AdminTab
$this->id_lang_default = Configuration::get('PS_LANG_DEFAULT'); $this->id_lang_default = Configuration::get('PS_LANG_DEFAULT');
$this->fieldsDisplay = array( $this->fieldsDisplay = array(
'key' => array('title' => $this->l('Key'), 'align' => 'center', 'width' => 32), 'key' => array('title' => $this->l('Key'), 'align' => 'center', 'width' => 32),
'active' => array('title' => $this->l('Enabled'), 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false), 'active' => array('title' => $this->l('Enabled'), 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false),
'description' => array('title' => $this->l('Key description'), 'align' => 'center', 'orderby' => false) 'description' => array('title' => $this->l('Key description'), 'align' => 'center', 'orderby' => false)
); );
$this->optionTitle = $this->l('Configuration');
if (file_exists(_PS_ROOT_DIR_.'/.htaccess')) if (file_exists(_PS_ROOT_DIR_.'/.htaccess'))
$this->_fieldsOptions = array('PS_WEBSERVICE' => array('title' => $this->l('Enable PrestaShop Webservice:'), $this->optionsList = array(
'desc' => $this->l('Before activating the webservice, you must be sure to: '). 'general' => array(
'<ol><li>'.$this->l('be certain URL rewrite is available on this server'). 'title' => $this->l('Configuration'),
'</li><li>'.$this->l('be certain that the 5 methods GET, POST, PUT, DELETE and HEAD are supported by this server'). 'fields' => array(
'</li></ol>', 'PS_WEBSERVICE' => array('title' => $this->l('Enable PrestaShop Webservice:'),
'cast' => 'intval', 'desc' => $this->l('Before activating the webservice, you must be sure to: ').
'type' => 'bool')); '<ol><li>'.$this->l('be certain URL rewrite is available on this server').
'</li><li>'.$this->l('be certain that the 5 methods GET, POST, PUT, DELETE and HEAD are supported by this server').
'</li></ol>',
'cast' => 'intval',
'type' => 'bool'),
),
),
);
parent::__construct(); parent::__construct();
} }
protected function afterAdd($object) { protected function afterAdd($object)
{
WebserviceKey::setPermissionForAccount($object->id, Tools::getValue('resources', array())); WebserviceKey::setPermissionForAccount($object->id, Tools::getValue('resources', array()));
} }
protected function afterUpdate($object) { protected function afterUpdate($object)
{
WebserviceKey::setPermissionForAccount($object->id, Tools::getValue('resources', array())); WebserviceKey::setPermissionForAccount($object->id, Tools::getValue('resources', array()));
} }
@@ -223,6 +232,7 @@ echo '
</fieldset> </fieldset>
</form>'; </form>';
} }
public function postProcess() public function postProcess()
{ {
if (Tools::getValue('key') && strlen(Tools::getValue('key')) < 32) if (Tools::getValue('key') && strlen(Tools::getValue('key')) < 32)
+40 -1
View File
@@ -156,6 +156,12 @@ abstract class AdminTabCore
protected $formOptions = true; protected $formOptions = true;
public $_fieldsOptions = array(); public $_fieldsOptions = array();
/**
* @since 1.5.0
* @var array
*/
public $optionsList = array();
protected $_languages = NULL; protected $_languages = NULL;
protected $_defaultFormLanguage = NULL; protected $_defaultFormLanguage = NULL;
@@ -285,6 +291,7 @@ abstract class AdminTabCore
{ {
$this->getList($this->context->language->id); $this->getList($this->context->language->id);
$this->displayList(); $this->displayList();
echo '<br />';
$this->displayOptionsList(); $this->displayOptionsList();
$this->displayRequiredFields(); $this->displayRequiredFields();
$this->includeSubTab('display'); $this->includeSubTab('display');
@@ -1773,10 +1780,25 @@ abstract class AdminTabCore
{ {
$tab = Tab::getTab($this->context->language->id, $this->id); $tab = Tab::getTab($this->context->language->id, $this->id);
// Retrocompatibility < 1.5.0
if (!$this->optionsList && $this->_fieldsOptions)
{
$this->optionsList = array(
'options' => array(
'title' => ($this->optionTitle) ? $this->optionTitle : $this->l('Options'),
'fields' => $this->_fieldsOptions,
),
);
}
if (!$this->optionsList)
return ;
echo '<br />';
echo '<script type="text/javascript"> echo '<script type="text/javascript">
id_language = Number('.$this->context->language->id.'); id_language = Number('.$this->context->language->id.');
</script>'; </script>';
echo '<form action="'.self::$currentIndex.'&submitOptions'.$this->table.'=1&token='.$this->token.'" method="post" enctype="multipart/form-data">'; echo '<form action="'.self::$currentIndex.'&submitOptions'.$this->table.'=1&token='.$this->token.'" method="post" enctype="multipart/form-data">';
foreach ($this->optionsList as $category => $categoryData) foreach ($this->optionsList as $category => $categoryData)
{ {
@@ -2013,6 +2035,23 @@ abstract class AdminTabCore
$this->displayFlags($languages, $this->context->language->id, $key, $key); $this->displayFlags($languages, $this->context->language->id, $key, $key);
} }
/**
* Type = TextareaLang
*/
public function displayOptionTypeTextareaLang($key, $field, $value)
{
$languages = Language::getLanguages(false);
foreach ($languages as $language)
{
$value = Configuration::get($key, $language['id_lang']);
echo '<div id="'.$key.'_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->context->language->id ? 'block' : 'none').'; float: left;">';
echo '<textarea rows="'.(int)($field['rows']).'" cols="'.(int)($field['cols']).'" name="'.$key.'_'.$language['id_lang'].'">'.str_replace('\r\n', "\n", $value).'</textarea>';
echo '</div>';
}
$this->displayFlags($languages, $this->context->language->id, $key, $key);
echo '<br style="clear:both">';
}
/** /**
* Type = selectLang * Type = selectLang
*/ */