// fix norm and change asso_shop for shop call in initForm()
This commit is contained in:
@@ -53,7 +53,7 @@ class GroupShopCore extends ObjectModel
|
||||
'group' => array('type' => 'group_shop'),
|
||||
'manufacturer' => array('type' => 'group_shop'),
|
||||
'supplier' => array('type' => 'group_shop'),
|
||||
'zone' => array('type' => 'shop'),
|
||||
'zone' => array('type' => 'group_shop'),
|
||||
'tax_rules_group' => array('type' => 'group_shop'),
|
||||
);
|
||||
|
||||
|
||||
@@ -83,7 +83,6 @@ class ShopCore extends ObjectModel
|
||||
'referrer' => array('type' => 'shop'),
|
||||
'scene' => array('type' => 'shop'),
|
||||
'store' => array('type' => 'shop'),
|
||||
'zone_shop' => array('type' => 'shop'),
|
||||
'webservice_account' => array('type' => 'shop'),
|
||||
'warehouse' => array('type' => 'shop'),
|
||||
'stock_available' => array('type' => 'fk_shop'),
|
||||
|
||||
@@ -34,9 +34,6 @@ class AdminCurrenciesControllerCore extends AdminController
|
||||
$this->table = 'currency';
|
||||
$this->className = 'Currency';
|
||||
$this->lang = false;
|
||||
$this->addRowAction('edit');
|
||||
$this->addRowAction('delete');
|
||||
$this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?')));
|
||||
|
||||
$this->fieldsDisplay = array(
|
||||
'id_currency' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
|
||||
@@ -47,7 +44,6 @@ class AdminCurrenciesControllerCore extends AdminController
|
||||
'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),
|
||||
);
|
||||
$this->_where = 'AND a.`deleted` = 0';
|
||||
|
||||
$this->options = array(
|
||||
'general' => array(
|
||||
@@ -56,7 +52,8 @@ class AdminCurrenciesControllerCore extends AdminController
|
||||
'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>',
|
||||
.'<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',
|
||||
@@ -79,10 +76,25 @@ class AdminCurrenciesControllerCore extends AdminController
|
||||
'title' => $this->l('Currency rates update'),
|
||||
'image' => '../img/admin/tab-tools.gif',
|
||||
'info' => $this->l('Place this URL in crontab or call it manually daily').':<br />
|
||||
<b>'.Tools::getShopDomain(true, true). __PS_BASE_URI__.basename(_PS_ADMIN_DIR_).'/cron_currency_rates.php?secure_key='.md5(_COOKIE_KEY_.Configuration::get('PS_SHOP_NAME')).'</b></p>',
|
||||
<b>'.Tools::getShopDomain(true, true).__PS_BASE_URI__.basename(_PS_ADMIN_DIR_).'/cron_currency_rates.php?secure_key='.md5(_COOKIE_KEY_.Configuration::get('PS_SHOP_NAME')).'</b></p>',
|
||||
),
|
||||
);
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function initList()
|
||||
{
|
||||
$this->addRowAction('edit');
|
||||
$this->addRowAction('delete');
|
||||
$this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?')));
|
||||
|
||||
$this->_where = 'AND a.`deleted` = 0';
|
||||
|
||||
return parent::initList();
|
||||
}
|
||||
|
||||
public function initForm()
|
||||
{
|
||||
$this->fields_form = array(
|
||||
'legend' => array(
|
||||
'title' => $this->l('Currencies:'),
|
||||
@@ -133,7 +145,8 @@ class AdminCurrenciesControllerCore extends AdminController
|
||||
'size' => 3,
|
||||
'maxlength' => 11,
|
||||
'required' => true,
|
||||
'p' => $this->l('Conversion rate from one unit of your shop\'s default currency (for example, 1€) to this currency. For example, if the default currency is euros and this currency is dollars, type \'1.20\'').' 1€ = $1.20',
|
||||
'p' => $this->l('Conversion rate from one unit of your shop\'s default currency (for example, 1€) to this currency.
|
||||
For example, if the default currency is euros and this currency is dollars, type \'1.20\'').' 1€ = $1.20',
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
@@ -214,21 +227,27 @@ class AdminCurrenciesControllerCore extends AdminController
|
||||
'value' => 0,
|
||||
'label' => $this->l('Disabled')
|
||||
)
|
||||
),
|
||||
),
|
||||
array(
|
||||
'type' => 'asso_shop',
|
||||
'label' => 'Shop:',
|
||||
'name' => ''
|
||||
)
|
||||
)
|
||||
),
|
||||
'submit' => array(
|
||||
'title' => $this->l(' Save '),
|
||||
'class' => 'button'
|
||||
),
|
||||
'asso_shop' => 'shop'
|
||||
)
|
||||
);
|
||||
parent::__construct();
|
||||
|
||||
if (Shop::isFeatureActive())
|
||||
{
|
||||
$this->fields_form['input'][] = array(
|
||||
'type' => 'shop',
|
||||
'label' => $this->l('Shop association:'),
|
||||
'name' => 'checkBoxShopAsso',
|
||||
'values' => Shop::getTree()
|
||||
);
|
||||
}
|
||||
|
||||
$this->fields_form['submit'] = array(
|
||||
'title' => $this->l(' Save '),
|
||||
'class' => 'button'
|
||||
);
|
||||
|
||||
return parent::initForm();
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
@@ -239,29 +258,31 @@ class AdminCurrenciesControllerCore extends AdminController
|
||||
{
|
||||
if ($object->id == Configuration::get('PS_CURRENCY_DEFAULT'))
|
||||
$this->_errors[] = $this->l('You can\'t delete the default currency');
|
||||
elseif ($object->delete())
|
||||
else if ($object->delete())
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=1'.'&token='.$this->token);
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occurred during deletion.');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occurred while deleting object.').' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
$this->_errors[] = Tools::displayError('An error occurred while deleting object.').'
|
||||
<b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
}
|
||||
elseif ($this->action == 'status')
|
||||
else if ($this->action == 'status')
|
||||
{
|
||||
if (Validate::isLoadedObject($object = $this->loadObject()))
|
||||
{
|
||||
if ($object->active AND $object->id == Configuration::get('PS_CURRENCY_DEFAULT'))
|
||||
if ($object->active && $object->id == Configuration::get('PS_CURRENCY_DEFAULT'))
|
||||
$this->_errors[] = $this->l('You can\'t disable the default currency');
|
||||
elseif ($object->toggleStatus())
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=5'.((($id_category = (int)(Tools::getValue('id_category'))) AND Tools::getValue('id_product')) ? '&id_category='.$id_category : '').'&token='.$this->token);
|
||||
else if ($object->toggleStatus())
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=5'.((($id_category = (int)Tools::getValue('id_category')) && Tools::getValue('id_product')) ? '&id_category='.$id_category : '').'&token='.$this->token);
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating status.');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating status for object.').' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating status for object.').'
|
||||
<b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
}
|
||||
elseif (Tools::isSubmit('submitExchangesRates'))
|
||||
else if (Tools::isSubmit('submitExchangesRates'))
|
||||
{
|
||||
if (!$this->_errors[] = Currency::refreshCurrencies())
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=6'.'&token='.$this->token);
|
||||
|
||||
@@ -32,22 +32,42 @@ class AdminZonesControllerCore extends AdminController
|
||||
public function __construct()
|
||||
{
|
||||
$this->table = 'zone';
|
||||
$this->className = 'Zone';
|
||||
$this->className = 'Zone';
|
||||
$this->lang = false;
|
||||
|
||||
$this->addRowAction('edit');
|
||||
$this->addRowAction('delete');
|
||||
$this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?')));
|
||||
|
||||
$this->fieldsDisplay = array(
|
||||
'id_zone' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
|
||||
'name' => array('title' => $this->l('Zone'), 'width' => 'auto'),
|
||||
'active' => array('title' => $this->l('Enabled'), 'width' => '70', 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false)
|
||||
'id_zone' => array(
|
||||
'title' => $this->l('ID'),
|
||||
'align' => 'center',
|
||||
'width' => 25
|
||||
),
|
||||
'name' => array(
|
||||
'title' => $this->l('Zone'),
|
||||
'width' => 'auto'
|
||||
),
|
||||
'active' => array(
|
||||
'title' => $this->l('Enabled'),
|
||||
'width' => '70',
|
||||
'align' => 'center',
|
||||
'active' => 'status',
|
||||
'type' => 'bool',
|
||||
'orderby' => false
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
|
||||
public function initList()
|
||||
{
|
||||
$this->addRowAction('edit');
|
||||
$this->addRowAction('delete');
|
||||
|
||||
$this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?')));
|
||||
|
||||
return parent::initList();
|
||||
}
|
||||
|
||||
public function initForm()
|
||||
{
|
||||
$this->fields_form = array(
|
||||
@@ -84,19 +104,25 @@ class AdminZonesControllerCore extends AdminController
|
||||
)
|
||||
),
|
||||
'p' => $this->l('Allow or disallow shipping to this zone')
|
||||
),
|
||||
array(
|
||||
'type' => 'asso_shop',
|
||||
'label' => 'Shop :',
|
||||
'name' => ''
|
||||
)
|
||||
),
|
||||
'asso_shop' => $this->asso_type,
|
||||
'submit' => array(
|
||||
'title' => $this->l(' Save '),
|
||||
'class' => 'button'
|
||||
)
|
||||
);
|
||||
|
||||
if (Shop::isFeatureActive())
|
||||
{
|
||||
$this->fields_form['input'][] = array(
|
||||
'type' => 'group_shop',
|
||||
'label' => $this->l('Group shop association:'),
|
||||
'name' => 'checkBoxShopAsso',
|
||||
'values' => Shop::getTree()
|
||||
);
|
||||
}
|
||||
|
||||
$this->fields_form['submit'] = array(
|
||||
'title' => $this->l(' Save '),
|
||||
'class' => 'button'
|
||||
);
|
||||
|
||||
return parent::initForm();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user