[*] BO #PSFV-94 : Added AdminTaxRulesGroupController
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@9815 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -1198,16 +1198,19 @@ class AdminControllerCore extends Controller
|
||||
$helper->shopLink = $this->shopLink;
|
||||
$helper->shopLinkType = $this->shopLinkType;
|
||||
$helper->identifier = $this->identifier;
|
||||
$helper->tpl_folder = $this->tpl_folder;
|
||||
$helper->token = $this->token;
|
||||
$helper->specificConfirmDelete = $this->specificConfirmDelete;
|
||||
$helper->imageType = $this->imageType;
|
||||
$helper->no_add = isset($this->no_add) ? $this->no_add : false;
|
||||
$helper->simple_header = isset($this->simple_header) ? $this->simple_header : false;
|
||||
$helper->no_link = $this->list_no_link;
|
||||
$helper->colorOnBackground = $this->colorOnBackground;
|
||||
$helper->no_back = isset($this->no_back) ? $this->no_back : true;
|
||||
|
||||
// For each action, try to add the corresponding skip elements list
|
||||
$helper->list_skip_actions = $this->list_skip_actions;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1234,6 +1237,7 @@ class AdminControllerCore extends Controller
|
||||
$helper->allow_employee_form_lang = $this->allow_employee_form_lang;
|
||||
$helper->fields_value = $this->getFieldsValue($this->object);
|
||||
$helper->toolbar_btn = $this->toolbar_btn;
|
||||
$helper->no_back = isset($this->no_back) ? $this->no_back : false;
|
||||
if ($this->tabAccess['view'])
|
||||
{
|
||||
if (Tools::getValue('back'))
|
||||
|
||||
+19
-2
@@ -55,6 +55,9 @@ class HelperListCore extends Helper
|
||||
|
||||
protected $deleted = 0;
|
||||
|
||||
/** @var string Folder of controller */
|
||||
public $tpl_folder;
|
||||
|
||||
/** @var array $cache_lang use to cache texts in current language */
|
||||
public static $cache_lang = array();
|
||||
|
||||
@@ -109,6 +112,12 @@ class HelperListCore extends Helper
|
||||
/** @var boolean ask for simple header : no filters, no paginations and no sorting */
|
||||
public $simple_header = false;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
* Usage : Set the value to false if you want to simply display the back button
|
||||
*/
|
||||
public $no_back = true;
|
||||
|
||||
/**
|
||||
* Return an html list given the data to fill it up
|
||||
*
|
||||
@@ -388,10 +397,16 @@ class HelperListCore extends Helper
|
||||
$this->context->smarty->assign(array(
|
||||
'href' => $this->currentIndex.'&'.$this->identifier.'='.$id.'&update'.$this->table.'&token='.($token != null ? $token : $this->token),
|
||||
'action' => self::$cache_lang['Edit'],
|
||||
'id' => (int)$id
|
||||
));
|
||||
|
||||
return $this->context->smarty->fetch(_PS_ADMIN_DIR_.'/themes/template/helper/list/list_action_edit.tpl');
|
||||
if (file_exists($this->context->smarty->template_dir[0].'/'.$this->tpl_folder.'list_action_edit.tpl'))
|
||||
$tpl = $this->context->smarty->template_dir[0].'/'.$this->tpl_folder.'list_action_edit.tpl';
|
||||
else
|
||||
$tpl = $this->context->smarty->template_dir[0].'/helper/list/list_action_edit.tpl';
|
||||
|
||||
return $this->context->smarty->fetch($tpl);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -540,7 +555,9 @@ class HelperListCore extends Helper
|
||||
'table_dnd' => isset($table_dnd) ? $table_dnd : null,
|
||||
'name' => isset($name) ? $name : null,
|
||||
'name_id' => isset($name_id) ? $name_id : null,
|
||||
'toolbar' => $this->toolbar
|
||||
'toolbar' => $this->toolbar,
|
||||
'back' => Tools::getValue('back'),
|
||||
'no_back' => $this->no_back
|
||||
));
|
||||
|
||||
return $this->context->smarty->fetch(_PS_ADMIN_DIR_.'/themes/template/'.$this->header_tpl);
|
||||
|
||||
+10
-10
@@ -51,17 +51,17 @@ class TaxRuleCore extends ObjectModel
|
||||
|
||||
public function getFields()
|
||||
{
|
||||
$this->validateFields();
|
||||
$fields['id_tax_rules_group'] = (int)$this->id_tax_rules_group;
|
||||
$fields['id_country'] = (int)$this->id_country;
|
||||
$fields['id_state'] = (int)$this->id_state;
|
||||
$fields['zipcode_from'] = (int)$this->zipcode_from;
|
||||
$fields['zipcode_to'] = (int)$this->zipcode_to;
|
||||
$fields['behavior'] = (int)$this->behavior;
|
||||
$fields['id_tax'] = (int)$this->id_tax;
|
||||
$fields['description'] = $this->description;
|
||||
$this->validateFields();
|
||||
$fields['id_tax_rules_group'] = (int)$this->id_tax_rules_group;
|
||||
$fields['id_country'] = (int)$this->id_country;
|
||||
$fields['id_state'] = (int)$this->id_state;
|
||||
$fields['zipcode_from'] = (int)$this->zipcode_from;
|
||||
$fields['zipcode_to'] = (int)$this->zipcode_to;
|
||||
$fields['behavior'] = (int)$this->behavior;
|
||||
$fields['id_tax'] = (int)$this->id_tax;
|
||||
$fields['description'] = $this->description;
|
||||
|
||||
return $fields;
|
||||
return $fields;
|
||||
}
|
||||
|
||||
public static function deleteByGroupId($id_group)
|
||||
|
||||
@@ -31,14 +31,14 @@ class TaxRulesGroupCore extends ObjectModel
|
||||
public $name;
|
||||
|
||||
/** @var bool active state */
|
||||
public $active;
|
||||
public $active;
|
||||
|
||||
protected $fieldsRequired = array('name');
|
||||
protected $fieldsSize = array('name' => 64);
|
||||
protected $fieldsValidate = array('name' => 'isGenericName');
|
||||
protected $fieldsRequired = array('name');
|
||||
protected $fieldsSize = array('name' => 64);
|
||||
protected $fieldsValidate = array('name' => 'isGenericName');
|
||||
|
||||
protected $table = 'tax_rules_group';
|
||||
protected $identifier = 'id_tax_rules_group';
|
||||
protected $table = 'tax_rules_group';
|
||||
protected $identifier = 'id_tax_rules_group';
|
||||
|
||||
protected static $_taxes = array();
|
||||
|
||||
@@ -46,7 +46,7 @@ class TaxRulesGroupCore extends ObjectModel
|
||||
{
|
||||
$this->validateFields();
|
||||
$fields['name'] = ($this->name);
|
||||
$fields['active'] = (int)($this->active);
|
||||
$fields['active'] = (int)$this->active;
|
||||
return $fields;
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ class TaxRulesGroupCore extends ObjectModel
|
||||
);
|
||||
|
||||
$res = array();
|
||||
foreach ($rows AS $row)
|
||||
foreach ($rows as $row)
|
||||
$res[$row['id_tax_rules_group']] = $row['rate'];
|
||||
|
||||
return $res;
|
||||
@@ -113,7 +113,7 @@ class TaxRulesGroupCore extends ObjectModel
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
$rate = 0;
|
||||
foreach (TaxRulesGroup::getTaxes($id_tax_rules_group, $id_country, $id_state, $zipcode) AS $tax)
|
||||
foreach (TaxRulesGroup::getTaxes($id_tax_rules_group, $id_country, $id_state, $zipcode) as $tax)
|
||||
$rate += (float)$tax->rate;
|
||||
|
||||
return $rate;
|
||||
|
||||
Reference in New Issue
Block a user