diff --git a/classes/Country.php b/classes/Country.php index f1da9b7f0..9dc325b2b 100644 --- a/classes/Country.php +++ b/classes/Country.php @@ -95,8 +95,8 @@ class CountryCore extends ObjectModel protected $webserviceParameters = array( 'objectsNodeName' => 'countries', 'fields' => array( - 'id_zone' => array('sqlId' => 'id_zone', 'xlink_resource'=> 'zones'), - 'id_currency' => array('sqlId' => 'id_currency', 'xlink_resource'=> 'currencies'), + 'id_zone' => array('xlink_resource'=> 'zones'), + 'id_currency' => array('xlink_resource'=> 'currencies'), ), ); diff --git a/classes/ObjectModel.php b/classes/ObjectModel.php index 806cd8757..54a4737c1 100644 --- a/classes/ObjectModel.php +++ b/classes/ObjectModel.php @@ -851,7 +851,7 @@ abstract class ObjectModelCore $resource_parameters = array_merge_recursive($default_resource_parameters, $this->{$ws_params_attribute_name}); $required_fields = (isset(self::$fieldsRequiredDatabase[get_class($this)]) ? self::$fieldsRequiredDatabase[get_class($this)] : array()); - foreach ($this->definition['fields'] as $field_name => $details) + foreach ($this->def['fields'] as $field_name => $details) { if (!isset($resource_parameters['fields'][$field_name])) $resource_parameters['fields'][$field_name] = array(); @@ -910,6 +910,7 @@ abstract class ObjectModelCore WHERE 1 '.$sql_filter.' '.($sql_sort != '' ? $sql_sort : '').' '.($sql_limit != '' ? $sql_limit : ''); + return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query); } diff --git a/classes/TranslatedConfiguration.php b/classes/TranslatedConfiguration.php index cb8d3b134..31cac209f 100755 --- a/classes/TranslatedConfiguration.php +++ b/classes/TranslatedConfiguration.php @@ -36,9 +36,24 @@ class TranslatedConfigurationCore extends Configuration 'date_upd' => array('i18n' => true), ), ); - + + public static $definition = array( + 'table' => 'configuration', + 'primary' => 'id_configuration', + 'multilang' => true, + 'fields' => array( + 'name' => array('type' => self::TYPE_STRING, 'validate' => 'isConfigName', 'required' => true, 'size' => 32), + 'id_group_shop' => array('type' => self::TYPE_NOTHING, 'validate' => 'isUnsignedId'), + 'id_shop' => array('type' => self::TYPE_NOTHING, 'validate' => 'isUnsignedId'), + 'value' => array('type' => self::TYPE_STRING), + 'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'), + 'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'), + ), + ); + public function __construct($id = NULL, $id_lang = NULL) { + $this->def = ObjectModel::getDefinition($this); // Check if the id configuration is set in the configuration_lang table. // Otherwise configuration is not set as translated configuration. if ($id !== null) diff --git a/classes/tax/TaxRule.php b/classes/tax/TaxRule.php index 223bb892b..0c0bfbb32 100644 --- a/classes/tax/TaxRule.php +++ b/classes/tax/TaxRule.php @@ -56,7 +56,7 @@ class TaxRuleCore extends ObjectModel protected $webserviceParameters = array( 'fields' => array( - 'id_tax_rules_group' => array('xlink_resource'=> 'tax_rules_group'), + 'id_tax_rules_group' => array('xlink_resource'=> 'tax_rule_groups'), 'id_state' => array('xlink_resource'=> 'states'), 'id_country' => array('xlink_resource'=> 'countries') ), diff --git a/classes/tax/TaxRulesGroup.php b/classes/tax/TaxRulesGroup.php index a0816147b..758931b00 100644 --- a/classes/tax/TaxRulesGroup.php +++ b/classes/tax/TaxRulesGroup.php @@ -41,10 +41,17 @@ class TaxRulesGroupCore extends ObjectModel 'primary' => 'id_tax_rules_group', 'fields' => array( 'name' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true, 'size' => 64), - 'active' => array('type' => self::TYPE_BOOL), + 'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), ), ); + protected $webserviceParameters = array( + 'objectsNodeName' => 'tax_rule_groups', + 'objectNodeName' => 'tax_rule_group', + 'fields' => array( + ), + ); + protected static $_taxes = array(); public static function getTaxRulesGroups($only_active = true) diff --git a/classes/webservice/WebserviceRequest.php b/classes/webservice/WebserviceRequest.php index cb5d9b909..4b3d31a98 100644 --- a/classes/webservice/WebserviceRequest.php +++ b/classes/webservice/WebserviceRequest.php @@ -277,7 +277,8 @@ class WebserviceRequestCore 'supply_order_histories' => array('description' => 'Supply Order Histories', 'class' => 'SupplyOrderHistory', 'forbidden_method' => array('PUT', 'POST', 'DELETE')), 'supply_order_receipt_histories' => array('description' => 'Supply Order Receipt Histories', 'class' => 'SupplyOrderReceiptHistory', 'forbidden_method' => array('PUT', 'POST', 'DELETE')), 'product_suppliers' => array('description' => 'Product Suppliers', 'class' => 'ProductSupplier', 'forbidden_method' => array('PUT', 'POST', 'DELETE')), - 'tax_rules' => array('description' => 'Tax rules entity', 'class' => 'TaxRule', 'forbidden_method' => array('PUT', 'POST', 'DELETE')), + 'tax_rules' => array('description' => 'Tax rules entity', 'class' => 'TaxRule'), + 'tax_rule_groups' => array('description' => 'Tax rule groups', 'class' => 'TaxRulesGroup'), ); ksort($resources); return $resources;