Merge pull request #22656 from atm-maxime/fix_api_product_attribute

Fix api product : rang is now position
This commit is contained in:
Laurent Destailleur 2022-10-24 17:19:44 +02:00 committed by GitHub
commit 6a145bd655
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1014,7 +1014,7 @@ class Products extends DolibarrApi
throw new RestException(401);
}
$sql = "SELECT t.rowid, t.ref, t.ref_ext, t.label, t.rang, t.entity";
$sql = "SELECT t.rowid, t.ref, t.ref_ext, t.label, t.position, t.entity";
$sql .= " FROM ".$this->db->prefix()."product_attribute as t";
$sql .= ' WHERE t.entity IN ('.getEntity('product').')';
@ -1051,7 +1051,7 @@ class Products extends DolibarrApi
$tmp->ref = $result->ref;
$tmp->ref_ext = $result->ref_ext;
$tmp->label = $result->label;
$tmp->rang = $result->rang;
$tmp->position = $result->position;
$tmp->entity = $result->entity;
$return[] = $this->_cleanObjectDatas($tmp);
@ -1088,7 +1088,7 @@ class Products extends DolibarrApi
throw new RestException(404, "Product attribute not found");
}
$fields = ["id", "ref", "ref_ext", "label", "rang", "entity"];
$fields = ["id", "ref", "ref_ext", "label", "position", "entity"];
foreach ($prodattr as $field => $value) {
if (!in_array($field, $fields)) {