From dff66a14cda5ebbd824af97abd6b86537b7daa6b Mon Sep 17 00:00:00 2001 From: rMalie Date: Tue, 13 Dec 2011 16:34:09 +0000 Subject: [PATCH] // Format definitions git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@11184 b9a71923-0436-4b27-9f14-aed3839534dd --- classes/stock/SupplyOrderDetail.php | 82 ++++++--------------- classes/stock/SupplyOrderHistory.php | 31 ++------ classes/stock/SupplyOrderReceiptHistory.php | 35 ++------- classes/stock/SupplyOrderState.php | 39 +++------- classes/stock/Warehouse.php | 35 ++------- classes/stock/WarehouseProductLocation.php | 25 +------ classes/tax/Tax.php | 29 +++----- classes/tax/TaxRule.php | 35 ++------- classes/tax/TaxRulesGroup.php | 16 +--- classes/webservice/WebserviceKey.php | 20 +---- 10 files changed, 77 insertions(+), 270 deletions(-) diff --git a/classes/stock/SupplyOrderDetail.php b/classes/stock/SupplyOrderDetail.php index 82b56d2fe..f2c12fd0e 100755 --- a/classes/stock/SupplyOrderDetail.php +++ b/classes/stock/SupplyOrderDetail.php @@ -142,10 +142,6 @@ class SupplyOrderDetailCore extends ObjectModel */ public $price_with_order_discount_te = 0; - - - - /** * @see ObjectModel::$definition */ @@ -153,65 +149,31 @@ class SupplyOrderDetailCore extends ObjectModel 'table' => 'supply_order_detail', 'primary' => 'id_supply_order_detail', 'fields' => array( - 'id_supply_order' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId', 'required' => true), - 'id_product' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId', 'required' => true), - 'id_product_attribute' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId', 'required' => true), - 'reference' => array('type' => 'FILL_ME', 'validate' => 'isReference'), - 'supplier_reference' => array('type' => 'FILL_ME', 'validate' => 'isReference'), - 'name' => array('type' => 'FILL_ME', 'validate' => 'isGenericName', 'required' => true), - 'ean13' => array('type' => 'FILL_ME', 'validate' => 'isEan13'), - 'upc' => array('type' => 'FILL_ME', 'validate' => 'isUpc'), - 'id_currency' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId', 'required' => true), - 'exchange_rate' => array('type' => 'FILL_ME', 'validate' => 'isFloat', 'required' => true), - 'unit_price_te' => array('type' => 'FILL_ME', 'validate' => 'isPrice', 'required' => true), - 'quantity_expected' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedInt', 'required' => true), - 'quantity_received' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedInt'), - 'price_te' => array('type' => 'FILL_ME', 'validate' => 'isPrice', 'required' => true), - 'discount_rate' => array('type' => 'FILL_ME', 'validate' => 'isFloat', 'required' => true), - 'discount_value_te' => array('type' => 'FILL_ME', 'validate' => 'isPrice', 'required' => true), - 'price_with_discount_te' => array('type' => 'FILL_ME', 'validate' => 'isPrice', 'required' => true), - 'tax_rate' => array('type' => 'FILL_ME', 'validate' => 'isFloat', 'required' => true), - 'tax_value' => array('type' => 'FILL_ME', 'validate' => 'isPrice', 'required' => true), - 'price_ti' => array('type' => 'FILL_ME', 'validate' => 'isPrice', 'required' => true), - 'tax_value_with_order_discount' => array('type' => 'FILL_ME', 'validate' => 'isFloat', 'required' => true), - 'price_with_order_discount_te' => array('type' => 'FILL_ME', 'validate' => 'isPrice', 'required' => true), + 'id_supply_order' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true), + 'id_product' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true), + 'id_product_attribute' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true), + 'reference' => array('type' => self::TYPE_STRING, 'validate' => 'isReference'), + 'supplier_reference' => array('type' => self::TYPE_STRING, 'validate' => 'isReference'), + 'name' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true), + 'ean13' => array('type' => self::TYPE_STRING, 'validate' => 'isEan13'), + 'upc' => array('type' => self::TYPE_STRING, 'validate' => 'isUpc'), + 'id_currency' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true), + 'exchange_rate' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat', 'required' => true), + 'unit_price_te' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice', 'required' => true), + 'quantity_expected' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true), + 'quantity_received' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'), + 'price_te' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice', 'required' => true), + 'discount_rate' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat', 'required' => true), + 'discount_value_te' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice', 'required' => true), + 'price_with_discount_te' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice', 'required' => true), + 'tax_rate' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat', 'required' => true), + 'tax_value' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice', 'required' => true), + 'price_ti' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice', 'required' => true), + 'tax_value_with_order_discount' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat', 'required' => true), + 'price_with_order_discount_te' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice', 'required' => true), ), ); - - /** - * @see ObjectModel::getFields() - */ - public function getFields() - { - $this->validateFields(); - - $fields['id_supply_order'] = (int)$this->id_supply_order; - $fields['id_product'] = (int)$this->id_product; - $fields['id_product_attribute'] = (int)$this->id_product_attribute; - $fields['reference'] = pSQL($this->reference); - $fields['supplier_reference'] = pSQL($this->supplier_reference); - $fields['name'] = pSQL($this->name); - $fields['ean13'] = pSQL($this->ean13); - $fields['upc'] = pSQL($this->upc); - $fields['id_currency'] = (int)$this->id_currency; - $fields['exchange_rate'] = (float)$this->exchange_rate; - $fields['unit_price_te'] = (float)$this->unit_price_te; - $fields['quantity_expected'] = (int)$this->quantity_expected; - $fields['quantity_received'] = (int)$this->quantity_received; - $fields['price_te'] = (float)$this->price_te; - $fields['discount_rate'] = (float)$this->discount_rate; - $fields['discount_value_te'] = (float)$this->discount_value_te; - $fields['price_with_discount_te'] = (float)$this->price_with_discount_te; - $fields['tax_rate'] = (float)$this->tax_rate; - $fields['tax_value'] = (float)$this->tax_value; - $fields['price_ti'] = (float)$this->price_ti; - $fields['tax_value_with_order_discount'] = (float)$this->tax_value_with_order_discount; - $fields['price_with_order_discount_te'] = (float)$this->price_with_order_discount_te; - - return $fields; - } - /** * @see ObjectModel::update() */ diff --git a/classes/stock/SupplyOrderHistory.php b/classes/stock/SupplyOrderHistory.php index c84ead76d..f9457b0ae 100755 --- a/classes/stock/SupplyOrderHistory.php +++ b/classes/stock/SupplyOrderHistory.php @@ -60,10 +60,6 @@ class SupplyOrderHistoryCore extends ObjectModel */ public $date_add; - - - - /** * @see ObjectModel::$definition */ @@ -71,27 +67,12 @@ class SupplyOrderHistoryCore extends ObjectModel 'table' => 'supply_order_history', 'primary' => 'id_supply_order_history', 'fields' => array( - 'id_supply_order' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId', 'required' => true), - 'id_employee' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId', 'required' => true), - 'employee_firstname' => array('type' => 'FILL_ME', 'validate' => 'isName'), - 'employee_lastname' => array('type' => 'FILL_ME', 'validate' => 'isName'), - 'id_state' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId', 'required' => true), - 'date_add' => array('type' => 'FILL_ME', 'validate' => 'isDate', 'required' => true), + 'id_supply_order' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true), + 'id_employee' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true), + 'employee_firstname' => array('type' => self::TYPE_STRING, 'validate' => 'isName'), + 'employee_lastname' => array('type' => self::TYPE_STRING, 'validate' => 'isName'), + 'id_state' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true), + 'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate', 'required' => true), ), ); - - - public function getFields() - { - $this->validateFields(); - - $fields['id_supply_order'] = (int)$this->id_supply_order; - $fields['id_employee'] = (int)$this->id_employee; - $fields['employee_lastname'] = pSQL($this->employee_lastname); - $fields['employee_firstname'] = pSQL(Tools::ucfirst($this->employee_firstname)); - $fields['id_state'] = (int)$this->id_state; - $fields['date_add'] = pSQL($this->date_add); - - return $fields; - } } \ No newline at end of file diff --git a/classes/stock/SupplyOrderReceiptHistory.php b/classes/stock/SupplyOrderReceiptHistory.php index 9d394fd1c..a542c3e56 100755 --- a/classes/stock/SupplyOrderReceiptHistory.php +++ b/classes/stock/SupplyOrderReceiptHistory.php @@ -65,10 +65,6 @@ class SupplyOrderReceiptHistoryCore extends ObjectModel */ public $date_add; - - - - /** * @see ObjectModel::$definition */ @@ -76,30 +72,13 @@ class SupplyOrderReceiptHistoryCore extends ObjectModel 'table' => 'supply_order_receipt_history', 'primary' => 'id_supply_order_receipt_history', 'fields' => array( - 'id_supply_order_detail' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId', 'required' => true), - 'id_supply_order_state' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId', 'required' => true), - 'id_employee' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId', 'required' => true), - 'employee_firstname' => array('type' => 'FILL_ME', 'validate' => 'isName'), - 'employee_lastname' => array('type' => 'FILL_ME', 'validate' => 'isName'), - 'quantity' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedInt', 'required' => true), - 'date_add' => array('type' => 'FILL_ME', 'validate' => 'isDate'), + 'id_supply_order_detail' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true), + 'id_supply_order_state' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true), + 'id_employee' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true), + 'employee_firstname' => array('type' => self::TYPE_STRING, 'validate' => 'isName'), + 'employee_lastname' => array('type' => self::TYPE_STRING, 'validate' => 'isName'), + 'quantity' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true), + 'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'), ), ); - - - public function getFields() - { - $this->validateFields(); - - $fields['id_supply_order_detail'] = (int)$this->id_supply_order_detail; - $fields['id_supply_order_state'] = (int)$this->id_supply_order_state; - $fields['id_employee'] = (int)$this->id_employee; - $fields['employee_lastname'] = pSQL($this->employee_lastname); - $fields['employee_firstname'] = pSQL(Tools::ucfirst($this->employee_firstname)); - $fields['quantity'] = (int)$this->quantity; - - $fields['date_add'] = pSQL($this->date_add); - - return $fields; - } } \ No newline at end of file diff --git a/classes/stock/SupplyOrderState.php b/classes/stock/SupplyOrderState.php index e474713b9..28e6214d1 100755 --- a/classes/stock/SupplyOrderState.php +++ b/classes/stock/SupplyOrderState.php @@ -65,12 +65,6 @@ class SupplyOrderStateCore extends ObjectModel */ public $color; - - - - - - /** * @see ObjectModel::$definition */ @@ -79,33 +73,18 @@ class SupplyOrderStateCore extends ObjectModel 'primary' => 'id_supply_order_state', 'multilang' => true, 'fields' => array( - 'delivery_note' => array('type' => 'FILL_ME', 'validate' => 'isBool'), - 'editable' => array('type' => 'FILL_ME', 'validate' => 'isBool'), - 'receipt_state' => array('type' => 'FILL_ME', 'validate' => 'isBool'), - 'pending_receipt' => array('type' => 'FILL_ME', 'validate' => 'isBool'), - 'enclosed' => array('type' => 'FILL_ME', 'validate' => 'isBool'), - 'color' => array('type' => 'FILL_ME', 'validate' => 'isColor'), - 'name' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 128), + 'delivery_note' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), + 'editable' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), + 'receipt_state' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), + 'pending_receipt' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), + 'enclosed' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), + 'color' => array('type' => self::TYPE_STRING, 'validate' => 'isColor'), + + // Lang fields + 'name' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 128), ), ); - - /** - * @see ObjectModel::getFields() - */ - public function getFields() - { - $this->validateFields(); - $fields['delivery_note'] = (bool)$this->delivery_note; - $fields['editable'] = (bool)$this->editable; - $fields['receipt_state'] = (bool)$this->receipt_state; - $fields['pending_receipt'] = (bool)$this->pending_receipt; - $fields['enclosed'] = (bool)$this->enclosed; - $fields['color'] = pSQL($this->color); - - return $fields; - } - /** * @see ObjectModel::getTranslationsFieldsChild() */ diff --git a/classes/stock/Warehouse.php b/classes/stock/Warehouse.php index 085f2b1b6..783920ef5 100644 --- a/classes/stock/Warehouse.php +++ b/classes/stock/Warehouse.php @@ -59,12 +59,6 @@ class WarehouseCore extends ObjectModel */ public $management_type; - - - - - - /** * @see ObjectModel::$definition */ @@ -72,31 +66,16 @@ class WarehouseCore extends ObjectModel 'table' => 'warehouse', 'primary' => 'id_warehouse', 'fields' => array( - 'id_address' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId', 'required' => true), - 'reference' => array('type' => 'FILL_ME', 'validate' => 'isString', 'required' => true, 'size' => 45), - 'name' => array('type' => 'FILL_ME', 'validate' => 'isName', 'required' => true, 'size' => 45), - 'id_employee' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId', 'required' => true), - 'management_type' => array('type' => 'FILL_ME', 'validate' => 'isStockManagement', 'required' => true), - 'id_currency' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId', 'required' => true), - 'stock_management' => array('type' => 'FILL_ME', 'size' => 32), + 'id_address' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true), + 'reference' => array('type' => self::TYPE_STRING, 'validate' => 'isString', 'required' => true, 'size' => 45), + 'name' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'required' => true, 'size' => 45), + 'id_employee' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true), + 'management_type' => array('type' => self::TYPE_STRING, 'validate' => 'isStockManagement', 'required' => true), + 'id_currency' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true), + 'deleted' => array('type' => self::TYPE_BOOL), ), ); - - public function getFields() - { - $this->validateFields(); - $fields['id_address'] = (int)$this->id_address; - $fields['reference'] = $this->reference; - $fields['name'] = pSQL($this->name); - $fields['deleted'] = (int)$this->deleted; - $fields['id_employee'] = (int)$this->id_employee; - $fields['management_type'] = pSQL($this->management_type); - $fields['id_currency'] = (int)$this->id_currency; - - return $fields; - } - /** * Gets the shops (id and name) associated to the current warehouse * diff --git a/classes/stock/WarehouseProductLocation.php b/classes/stock/WarehouseProductLocation.php index d41dff59d..dc5fbed58 100644 --- a/classes/stock/WarehouseProductLocation.php +++ b/classes/stock/WarehouseProductLocation.php @@ -49,10 +49,6 @@ class WarehouseProductLocationCore extends ObjectModel * */ public $location; - - - - /** * @see ObjectModel::$definition */ @@ -60,26 +56,13 @@ class WarehouseProductLocationCore extends ObjectModel 'table' => 'warehouse_product_location', 'primary' => 'id_warehouse_product_location', 'fields' => array( - 'location' => array('type' => 'FILL_ME', 'validate' => 'isReference', 'size' => 64), - 'id_product' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId', 'required' => true), - 'id_product_attribute' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId', 'required' => true), - 'id_warehouse' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId', 'required' => true), + 'location' => array('type' => self::TYPE_STRING, 'validate' => 'isReference', 'size' => 64), + 'id_product' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true), + 'id_product_attribute' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true), + 'id_warehouse' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true), ), ); - - public function getFields() - { - $this->validateFields(); - - $fields['id_product'] = (int)$this->id_product; - $fields['id_product_attribute'] = (int)$this->id_product_attribute; - $fields['id_warehouse'] = (int)$this->id_warehouse; - $fields['location'] = pSQL($this->location); - - return $fields; - } - /** * For a given product and warehouse, get the location * diff --git a/classes/tax/Tax.php b/classes/tax/Tax.php index 40f41138d..55ec0258f 100644 --- a/classes/tax/Tax.php +++ b/classes/tax/Tax.php @@ -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); } } diff --git a/classes/tax/TaxRule.php b/classes/tax/TaxRule.php index 38ca01c48..cfa526378 100644 --- a/classes/tax/TaxRule.php +++ b/classes/tax/TaxRule.php @@ -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)) diff --git a/classes/tax/TaxRulesGroup.php b/classes/tax/TaxRulesGroup.php index 78ed00391..a0816147b 100644 --- a/classes/tax/TaxRulesGroup.php +++ b/classes/tax/TaxRulesGroup.php @@ -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(' diff --git a/classes/webservice/WebserviceKey.php b/classes/webservice/WebserviceKey.php index acb7bdf93..28b1d49e4 100755 --- a/classes/webservice/WebserviceKey.php +++ b/classes/webservice/WebserviceKey.php @@ -36,10 +36,6 @@ class WebserviceKeyCore extends ObjectModel /** @var string Webservice Account description */ public $description; - - - - /** * @see ObjectModel::$definition */ @@ -47,12 +43,12 @@ class WebserviceKeyCore extends ObjectModel 'table' => 'webservice_account', 'primary' => 'id_webservice_account', 'fields' => array( - 'active' => array('type' => 'FILL_ME', 'validate' => 'isBool'), - 'key' => array('type' => 'FILL_ME', 'required' => true, 'size' => 32), + 'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), + 'key' => array('type' => self::TYPE_STRING, 'required' => true, 'size' => 32), + 'description' => array('type' => self::TYPE_STRING), ), ); - public function add($autodate = true, $nullValues = false) { if (WebserviceKey::keyExists($this->key)) @@ -67,16 +63,6 @@ class WebserviceKeyCore extends ObjectModel WHERE `key` = \''.pSQL($key).'\'') ? false : true); } - public function getFields() - { - $this->validateFields(); - - $fields['key'] = pSQL($this->key); - $fields['active'] = (int)$this->active; - $fields['description'] = pSQL($this->description); - return $fields; - } - public function delete() { if (!parent::delete() || $this->deleteAssociations() === false)