// Format definitions

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@11184 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rMalie
2011-12-13 16:34:09 +00:00
parent e816494ec2
commit dff66a14cd
10 changed files with 77 additions and 270 deletions
+9 -20
View File
@@ -43,12 +43,6 @@ class TaxCore extends ObjectModel
/** @var string Account Number */
public $account_number;
/**
* @see ObjectModel::$definition
*/
@@ -56,8 +50,13 @@ class TaxCore extends ObjectModel
'table' => 'tax',
'primary' => 'id_tax',
'fields' => array(
'rate' => array('type' => 'FILL_ME', 'validate' => 'isFloat', 'required' => true),
'name' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 32),
'rate' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat', 'required' => true),
'account_number' => array('type' => self::TYPE_STRING),
'active' => array('type' => self::TYPE_BOOL),
'deleted' => array('type' => self::TYPE_BOOL),
// Lang fields
'name' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 32),
),
);
@@ -69,16 +68,6 @@ class TaxCore extends ObjectModel
'objectsNodeName' => 'taxes',
);
public function getFields()
{
$this->validateFields();
$fields['rate'] = (float)($this->rate);
$fields['active'] = (int)($this->active);
$fields['deleted'] = (int)($this->deleted);
$fields['account_number'] = $this->account_number;
return $fields;
}
/**
* Check then return multilingual fields for database interaction
*
@@ -281,7 +270,7 @@ class TaxCore extends ObjectModel
return $tax_calculator->getTotalRate();
}
/**
* Returns the Account number of a Tax
*
@@ -292,7 +281,7 @@ class TaxCore extends ObjectModel
{
return Db::getInstance()->getValue('
SELECT account_number FROM `'._DB_PREFIX_.'tax`
WHERE id_tax = '.(int)$id_tax);
WHERE id_tax = '.(int)$id_tax);
}
}
+8 -27
View File
@@ -36,9 +36,6 @@ class TaxRuleCore extends ObjectModel
public $behavior;
public $description;
/**
* @see ObjectModel::$definition
*/
@@ -46,33 +43,17 @@ class TaxRuleCore extends ObjectModel
'table' => 'tax_rule',
'primary' => 'id_tax_rule',
'fields' => array(
'id_tax_rules_group' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId', 'required' => true),
'id_country' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId', 'required' => true),
'id_state' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId'),
'zipcode_from' => array('type' => 'FILL_ME', 'validate' => 'isPostCode'),
'zipcode_to' => array('type' => 'FILL_ME', 'validate' => 'isPostCode'),
'id_tax' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId', 'required' => true),
'behavior' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedInt'),
'description' => array('type' => 'FILL_ME', 'validate' => 'isString'),
'id_tax_rules_group' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'id_country' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'id_state' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
'zipcode_from' => array('type' => self::TYPE_INT, 'validate' => 'isPostCode'),
'zipcode_to' => array('type' => self::TYPE_INT, 'validate' => 'isPostCode'),
'id_tax' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'behavior' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'),
'description' => array('type' => self::TYPE_STRING, 'validate' => 'isString'),
),
);
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;
return $fields;
}
public static function deleteByGroupId($id_group)
{
if (empty($id_group))
+2 -14
View File
@@ -33,10 +33,6 @@ class TaxRulesGroupCore extends ObjectModel
/** @var bool active state */
public $active;
/**
* @see ObjectModel::$definition
*/
@@ -44,21 +40,13 @@ class TaxRulesGroupCore extends ObjectModel
'table' => 'tax_rules_group',
'primary' => 'id_tax_rules_group',
'fields' => array(
'name' => array('type' => 'FILL_ME', 'validate' => 'isGenericName', 'required' => true, 'size' => 64),
'name' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true, 'size' => 64),
'active' => array('type' => self::TYPE_BOOL),
),
);
protected static $_taxes = array();
public function getFields()
{
$this->validateFields();
$fields['name'] = ($this->name);
$fields['active'] = (int)$this->active;
return $fields;
}
public static function getTaxRulesGroups($only_active = true)
{
return Db::getInstance()->executeS('