diff --git a/htdocs/adherents/class/api_members.class.php b/htdocs/adherents/class/api_members.class.php
index 8a26cd5d070..0f6e9c40625 100644
--- a/htdocs/adherents/class/api_members.class.php
+++ b/htdocs/adherents/class/api_members.class.php
@@ -348,6 +348,12 @@ class Members extends DolibarrApi
}
}
} else {
+ if ($field == 'array_options' && is_array($value)) {
+ foreach ($value as $index => $val) {
+ $member->array_options[$index] = $this->_checkValForAPI($field, $val, $member);
+ }
+ continue;
+ }
$member->$field = $value;
}
}
diff --git a/htdocs/adherents/class/api_memberstypes.class.php b/htdocs/adherents/class/api_memberstypes.class.php
index da43514a1d0..9d22e47cabf 100644
--- a/htdocs/adherents/class/api_memberstypes.class.php
+++ b/htdocs/adherents/class/api_memberstypes.class.php
@@ -193,6 +193,12 @@ class MembersTypes extends DolibarrApi
if ($field == 'id') {
continue;
}
+ if ($field == 'array_options' && is_array($value)) {
+ foreach ($value as $index => $val) {
+ $membertype->array_options[$index] = $this->_checkValForAPI($field, $val, $membertype);
+ }
+ continue;
+ }
// Process the status separately because it must be updated using
// the validate(), resiliate() and exclude() methods of the class AdherentType.
$membertype->$field = $value;
diff --git a/htdocs/adherents/class/api_subscriptions.class.php b/htdocs/adherents/class/api_subscriptions.class.php
index a60078769a0..d338792a5a0 100644
--- a/htdocs/adherents/class/api_subscriptions.class.php
+++ b/htdocs/adherents/class/api_subscriptions.class.php
@@ -186,6 +186,12 @@ class Subscriptions extends DolibarrApi
if ($field == 'id') {
continue;
}
+ if ($field == 'array_options' && is_array($value)) {
+ foreach ($value as $index => $val) {
+ $subscription->array_options[$index] = $this->_checkValForAPI($field, $val, $subscription);
+ }
+ continue;
+ }
$subscription->$field = $value;
}
diff --git a/htdocs/bom/class/api_boms.class.php b/htdocs/bom/class/api_boms.class.php
index 776bcd54b7f..2d25ea52631 100644
--- a/htdocs/bom/class/api_boms.class.php
+++ b/htdocs/bom/class/api_boms.class.php
@@ -240,6 +240,12 @@ class Boms extends DolibarrApi
if ($field == 'id') {
continue;
}
+ if ($field == 'array_options' && is_array($value)) {
+ foreach ($value as $index => $val) {
+ $this->bom->array_options[$index] = $this->_checkValForAPI($field, $val, $this->bom);
+ }
+ continue;
+ }
$this->bom->$field = $value;
}
diff --git a/htdocs/categories/class/api_categories.class.php b/htdocs/categories/class/api_categories.class.php
index 8b20fdec7d9..8922ef4ba60 100644
--- a/htdocs/categories/class/api_categories.class.php
+++ b/htdocs/categories/class/api_categories.class.php
@@ -237,6 +237,12 @@ class Categories extends DolibarrApi
if ($field == 'id') {
continue;
}
+ if ($field == 'array_options' && is_array($value)) {
+ foreach ($value as $index => $val) {
+ $this->category->array_options[$index] = $this->_checkValForAPI($field, $val, $this->category);
+ }
+ continue;
+ }
$this->category->$field = $value;
}
diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php
index 0f8b9a32a35..8fc7ce59485 100644
--- a/htdocs/comm/action/card.php
+++ b/htdocs/comm/action/card.php
@@ -1960,7 +1960,12 @@ if ($id > 0) {
// related contact
print '
| '.$langs->trans("ActionOnContact").' | ';
print ' ';
- print img_picto('', 'contact', 'class="paddingrightonly"').$form->selectcontacts(empty($conf->global->MAIN_ACTIONCOM_CAN_ADD_ANY_CONTACT) ? $object->socid : 0, array_keys($object->socpeopleassigned), 'socpeopleassigned[]', 1, '', '', 1, 'quatrevingtpercent', false, 0, 0, array(), 'multiple', 'contactid');
+ if (getDolGlobalInt('MAIN_ACTIONCOM_CAN_ADD_ANY_CONTACT')) {
+ $select_contact_default = 0; // select "all" contacts by default : avoid to use it if there is a lot of contacts
+ } else {
+ $select_contact_default = -1; // select "none" by default
+ }
+ print img_picto('', 'contact', 'class="paddingrightonly"').$form->selectcontacts(!empty($object->socid) ? $object->socid : $select_contact_default, array_keys($object->socpeopleassigned), 'socpeopleassigned[]', 1, '', '', 1, 'quatrevingtpercent', false, 0, 0, array(), 'multiple', 'contactid');
print ' ';
print ' | ';
print '
';
diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php
index 43fb40704a1..f75bf073e1e 100644
--- a/htdocs/comm/action/class/actioncomm.class.php
+++ b/htdocs/comm/action/class/actioncomm.class.php
@@ -619,7 +619,7 @@ class ActionComm extends CommonObject
foreach ($this->userassigned as $key => $val) {
// Common value with new behavior is to have $val = array('id'=>iduser, 'transparency'=>0|1) and $this->userassigned is an array of iduser => $val.
if (!is_array($val)) { // For backward compatibility when $val='id'.
- $val = array('id'=>$val);
+ $val = array('id' => $val);
}
if ($val['id'] > 0) {
@@ -1258,9 +1258,11 @@ class ActionComm extends CommonObject
$already_inserted = array();
foreach (array_keys($this->socpeopleassigned) as $key => $val) {
if (!is_array($val)) { // For backward compatibility when val=id
- $val = array('id'=>$val);
+ $val = array('id' => $val);
+ }
+ if (!empty($already_inserted[$val['id']])) {
+ continue;
}
- if (!empty($already_inserted[$val['id']])) continue;
$sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm_resources(fk_actioncomm, element_type, fk_element, mandatory, transparency, answer_status)";
$sql .= " VALUES(".((int) $this->id).", 'socpeople', ".((int) $val['id']).", 0, 0, 0)";
diff --git a/htdocs/comm/action/class/api_agendaevents.class.php b/htdocs/comm/action/class/api_agendaevents.class.php
index 7a33d26064f..2366fc9cdad 100644
--- a/htdocs/comm/action/class/api_agendaevents.class.php
+++ b/htdocs/comm/action/class/api_agendaevents.class.php
@@ -270,6 +270,12 @@ class AgendaEvents extends DolibarrApi
continue;
}
+ if ($field == 'array_options' && is_array($value)) {
+ foreach ($value as $index => $val) {
+ $this->actioncomm->array_options[$index] = $this->_checkValForAPI($field, $val, $this->actioncomm);
+ }
+ continue;
+ }
$this->actioncomm->$field = $this->_checkValForAPI($field, $value, $this->actioncomm);
}
diff --git a/htdocs/comm/propal/class/api_proposals.class.php b/htdocs/comm/propal/class/api_proposals.class.php
index a2ff96ec37d..998e7a79a2d 100644
--- a/htdocs/comm/propal/class/api_proposals.class.php
+++ b/htdocs/comm/propal/class/api_proposals.class.php
@@ -695,6 +695,12 @@ class Proposals extends DolibarrApi
if ($field == 'id') {
continue;
}
+ if ($field == 'array_options' && is_array($value)) {
+ foreach ($value as $index => $val) {
+ $this->propal->array_options[$index] = $this->_checkValForAPI($field, $val, $this->propal);
+ }
+ continue;
+ }
$this->propal->$field = $value;
}
diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php
index 5498f22a3c8..f0d511d4b09 100644
--- a/htdocs/commande/class/api_orders.class.php
+++ b/htdocs/commande/class/api_orders.class.php
@@ -653,6 +653,12 @@ class Orders extends DolibarrApi
if ($field == 'id') {
continue;
}
+ if ($field == 'array_options' && is_array($value)) {
+ foreach ($value as $index => $val) {
+ $this->commande->array_options[$index] = $this->_checkValForAPI($field, $val, $this->commande);
+ }
+ continue;
+ }
$this->commande->$field = $value;
}
diff --git a/htdocs/compta/bank/class/api_bankaccounts.class.php b/htdocs/compta/bank/class/api_bankaccounts.class.php
index e81981a7490..89712b4bb59 100644
--- a/htdocs/compta/bank/class/api_bankaccounts.class.php
+++ b/htdocs/compta/bank/class/api_bankaccounts.class.php
@@ -332,6 +332,12 @@ class BankAccounts extends DolibarrApi
if ($field == 'id') {
continue;
}
+ if ($field == 'array_options' && is_array($value)) {
+ foreach ($value as $index => $val) {
+ $account->array_options[$index] = $this->_checkValForAPI($field, $val, $account);
+ }
+ continue;
+ }
$account->$field = $this->_checkValForAPI($field, $value, $account);
}
diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php
index 26a609da09b..820bcb6e955 100644
--- a/htdocs/compta/facture/class/api_invoices.class.php
+++ b/htdocs/compta/facture/class/api_invoices.class.php
@@ -622,6 +622,12 @@ class Invoices extends DolibarrApi
if ($field == 'id') {
continue;
}
+ if ($field == 'array_options' && is_array($value)) {
+ foreach ($value as $index => $val) {
+ $this->invoice->array_options[$index] = $this->_checkValForAPI($field, $val, $this->invoice);
+ }
+ continue;
+ }
$this->invoice->$field = $value;
}
diff --git a/htdocs/contrat/class/api_contracts.class.php b/htdocs/contrat/class/api_contracts.class.php
index d8c44316bd5..241a06dcde4 100644
--- a/htdocs/contrat/class/api_contracts.class.php
+++ b/htdocs/contrat/class/api_contracts.class.php
@@ -509,6 +509,12 @@ class Contracts extends DolibarrApi
if ($field == 'id') {
continue;
}
+ if ($field == 'array_options' && is_array($value)) {
+ foreach ($value as $index => $val) {
+ $this->contract->array_options[$index] = $this->_checkValForAPI($field, $val, $this->contract);
+ }
+ continue;
+ }
$this->contract->$field = $value;
}
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 0a302e0b514..b117df69d03 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -9155,10 +9155,11 @@ function dol_osencode($str)
* @param string $fieldid Field to get
* @param int $entityfilter Filter by entity
* @param string $filters Filters to add. WARNING: string must be escaped for SQL and not coming from user input.
+ * @param bool $useCache If true (default), cache will be queried and updated.
* @return int <0 if KO, Id of code if OK
* @see $langs->getLabelFromKey
*/
-function dol_getIdFromCode($db, $key, $tablename, $fieldkey = 'code', $fieldid = 'id', $entityfilter = 0, $filters = '')
+function dol_getIdFromCode($db, $key, $tablename, $fieldkey = 'code', $fieldid = 'id', $entityfilter = 0, $filters = '', $useCache = true)
{
global $cache_codes;
@@ -9168,8 +9169,8 @@ function dol_getIdFromCode($db, $key, $tablename, $fieldkey = 'code', $fieldid =
}
// Check in cache
- if (isset($cache_codes[$tablename][$key][$fieldid])) { // Can be defined to 0 or ''
- return $cache_codes[$tablename][$key][$fieldid]; // Found in cache
+ if ($useCache && isset($cache_codes[$tablename][$fieldkey][$fieldid][$entityfilter][$filters][$key])) { // Can be defined to 0 or ''
+ return $cache_codes[$tablename][$fieldkey][$fieldid][$entityfilter][$filters][$key]; // Found in cache
}
dol_syslog('dol_getIdFromCode (value for field '.$fieldid.' from key '.$key.' not found into cache)', LOG_DEBUG);
@@ -9187,13 +9188,15 @@ function dol_getIdFromCode($db, $key, $tablename, $fieldkey = 'code', $fieldid =
$resql = $db->query($sql);
if ($resql) {
$obj = $db->fetch_object($resql);
+ $valuetoget = '';
if ($obj) {
- $cache_codes[$tablename][$key][$fieldid] = $obj->valuetoget;
- } else {
- $cache_codes[$tablename][$key][$fieldid] = '';
+ $valuetoget = $obj->valuetoget;
}
$db->free($resql);
- return $cache_codes[$tablename][$key][$fieldid];
+ if ($useCache) {
+ $cache_codes[$tablename][$fieldkey][$fieldid][$entityfilter][$filters][$key] = $valuetoget;
+ }
+ return $valuetoget;
} else {
return -1;
}
@@ -11158,11 +11161,11 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st
* 'classOverride' => '' // to replace class attribute of the button
* ],
* 'confirm' => [
- * 'url' => 'http://', // Overide Url to go when user click on action btn, if empty default url is $url.?confirm=yes, for no js compatibility use $url for fallback confirm.
- * 'title' => '', // Overide title of modal, if empty default title use "ConfirmBtnCommonTitle" lang key
- * 'action-btn-label' => '', // Overide label of action button, if empty default label use "Confirm" lang key
- * 'cancel-btn-label' => '', // Overide label of cancel button, if empty default label use "CloseDialog" lang key
- * 'content' => '', // Overide text of content, if empty default content use "ConfirmBtnCommonContent" lang key
+ * 'url' => 'http://', // Override Url to go when user click on action btn, if empty default url is $url.?confirm=yes, for no js compatibility use $url for fallback confirm.
+ * 'title' => '', // Override title of modal, if empty default title use "ConfirmBtnCommonTitle" lang key
+ * 'action-btn-label' => '', // Override label of action button, if empty default label use "Confirm" lang key
+ * 'cancel-btn-label' => '', // Override label of cancel button, if empty default label use "CloseDialog" lang key
+ * 'content' => '', // Override text of content, if empty default content use "ConfirmBtnCommonContent" lang key
* 'modal' => true, // true|false to display dialog as a modal (with dark background)
* 'isDropDrown' => false, // true|false to display dialog as a dropdown (with dark background)
* ],
diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php
index cfb2c97db44..cb7114032dc 100644
--- a/htdocs/core/lib/pdf.lib.php
+++ b/htdocs/core/lib/pdf.lib.php
@@ -1425,12 +1425,7 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0,
{
global $db, $conf, $langs;
- $idprod = (!empty($object->lines[$i]->fk_product) ? $object->lines[$i]->fk_product : false);
- $label = (!empty($object->lines[$i]->label) ? $object->lines[$i]->label : (!empty($object->lines[$i]->product_label) ? $object->lines[$i]->product_label : ''));
- $desc = (!empty($object->lines[$i]->desc) ? $object->lines[$i]->desc : (!empty($object->lines[$i]->description) ? $object->lines[$i]->description : ''));
- $ref_supplier = (!empty($object->lines[$i]->ref_supplier) ? $object->lines[$i]->ref_supplier : (!empty($object->lines[$i]->ref_fourn) ? $object->lines[$i]->ref_fourn : '')); // TODO Not yet saved for supplier invoices, only supplier orders
- $note = (!empty($object->lines[$i]->note) ? $object->lines[$i]->note : '');
- $dbatch = (!empty($object->lines[$i]->detail_batch) ? $object->lines[$i]->detail_batch : false);
+ $multilangsactive = getDolGlobalInt('MAIN_MULTILANGS');
if ($issupplierline) {
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
@@ -1444,10 +1439,54 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0,
}
}
+ //id
+ $idprod = (!empty($object->lines[$i]->fk_product) ? $object->lines[$i]->fk_product : false);
if ($idprod) {
$prodser->fetch($idprod);
+ //load multilangs
+ if ($multilangsactive) {
+ $prodser->getMultiLangs();
+ $object->lines[$i]->multilangs = $prodser->multilangs;
+ }
+ }
+ //label
+ if (!empty($object->lines[$i]->label)) {
+ $label = $object->lines[$i]->label;
+ } else {
+ if (!empty($object->lines[$i]->multilangs[$outputlangs->defaultlang]['label']) && $multilangsactive) {
+ $label = $object->lines[$i]->multilangs[$outputlangs->defaultlang]['label'];
+ } else {
+ if (!empty($object->lines[$i]->product_label)) {
+ $label = $object->lines[$i]->product_label;
+ } else {
+ $label = '';
+ }
+ }
+ }
+ //description
+ if (!empty($object->lines[$i]->desc)) {
+ $desc = $object->lines[$i]->desc;
+ } else {
+ if (!empty($object->lines[$i]->multilangs[$outputlangs->defaultlang]['description']) && $multilangsactive) {
+ $desc = $object->lines[$i]->multilangs[$outputlangs->defaultlang]['description'];
+ } else {
+ if (!empty($object->lines[$i]->description)) {
+ $desc = $object->lines[$i]->description;
+ } else {
+ $desc = '';
+ }
+ }
+ }
+ //ref supplier
+ $ref_supplier = (!empty($object->lines[$i]->ref_supplier) ? $object->lines[$i]->ref_supplier : (!empty($object->lines[$i]->ref_fourn) ? $object->lines[$i]->ref_fourn : '')); // TODO Not yet saved for supplier invoices, only supplier orders
+ //note
+ $note = (!empty($object->lines[$i]->note) ? $object->lines[$i]->note : '');
+ //dbatch
+ $dbatch = (!empty($object->lines[$i]->detail_batch) ? $object->lines[$i]->detail_batch : false);
+
+ if ($idprod) {
// If a predefined product and multilang and on other lang, we renamed label with label translated
- if (getDolGlobalInt('MAIN_MULTILANGS') && ($outputlangs->defaultlang != $langs->defaultlang)) {
+ if ($multilangsactive && ($outputlangs->defaultlang != $langs->defaultlang)) {
$translatealsoifmodified = (!empty($conf->global->MAIN_MULTILANG_TRANSLATE_EVEN_IF_MODIFIED)); // By default if value was modified manually, we keep it (no translation because we don't have it)
// TODO Instead of making a compare to see if param was modified, check that content contains reference translation. If yes, add the added part to the new translation
diff --git a/htdocs/don/class/api_donations.class.php b/htdocs/don/class/api_donations.class.php
index 7c78275e913..6b7a5ae9aa1 100644
--- a/htdocs/don/class/api_donations.class.php
+++ b/htdocs/don/class/api_donations.class.php
@@ -231,6 +231,12 @@ class Donations extends DolibarrApi
if ($field == 'id') {
continue;
}
+ if ($field == 'array_options' && is_array($value)) {
+ foreach ($value as $index => $val) {
+ $this->don->array_options[$index] = $this->_checkValForAPI($field, $val, $this->don);
+ }
+ continue;
+ }
$this->don->$field = $value;
}
diff --git a/htdocs/expedition/class/api_shipments.class.php b/htdocs/expedition/class/api_shipments.class.php
index 3297b70cd93..32dafee3b2a 100644
--- a/htdocs/expedition/class/api_shipments.class.php
+++ b/htdocs/expedition/class/api_shipments.class.php
@@ -447,6 +447,12 @@ class Shipments extends DolibarrApi
if ($field == 'id') {
continue;
}
+ if ($field == 'array_options' && is_array($value)) {
+ foreach ($value as $index => $val) {
+ $this->shipment->array_options[$index] = $this->_checkValForAPI($field, $val, $this->shipment);
+ }
+ continue;
+ }
$this->shipment->$field = $value;
}
diff --git a/htdocs/expensereport/class/api_expensereports.class.php b/htdocs/expensereport/class/api_expensereports.class.php
index 1a3955f11d6..f29c43850e6 100644
--- a/htdocs/expensereport/class/api_expensereports.class.php
+++ b/htdocs/expensereport/class/api_expensereports.class.php
@@ -420,6 +420,12 @@ class ExpenseReports extends DolibarrApi
if ($field == 'id') {
continue;
}
+ if ($field == 'array_options' && is_array($value)) {
+ foreach ($value as $index => $val) {
+ $this->expensereport->array_options[$index] = $this->_checkValForAPI($field, $val, $this->expensereport);
+ }
+ continue;
+ }
$this->expensereport->$field = $value;
}
diff --git a/htdocs/fourn/class/api_supplier_invoices.class.php b/htdocs/fourn/class/api_supplier_invoices.class.php
index 337d1c264f4..13dc0e8b094 100644
--- a/htdocs/fourn/class/api_supplier_invoices.class.php
+++ b/htdocs/fourn/class/api_supplier_invoices.class.php
@@ -263,6 +263,12 @@ class SupplierInvoices extends DolibarrApi
if ($field == 'id') {
continue;
}
+ if ($field == 'array_options' && is_array($value)) {
+ foreach ($value as $index => $val) {
+ $this->invoice->array_options[$index] = $this->_checkValForAPI($field, $val, $this->invoice);
+ }
+ continue;
+ }
$this->invoice->$field = $value;
}
diff --git a/htdocs/fourn/class/api_supplier_orders.class.php b/htdocs/fourn/class/api_supplier_orders.class.php
index 120b3d9ef99..5a578306242 100644
--- a/htdocs/fourn/class/api_supplier_orders.class.php
+++ b/htdocs/fourn/class/api_supplier_orders.class.php
@@ -288,6 +288,12 @@ class SupplierOrders extends DolibarrApi
if ($field == 'id') {
continue;
}
+ if ($field == 'array_options' && is_array($value)) {
+ foreach ($value as $index => $val) {
+ $this->order->array_options[$index] = $this->_checkValForAPI($field, $val, $this->order);
+ }
+ continue;
+ }
$this->order->$field = $value;
}
diff --git a/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php b/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php
index 570d09a0cdd..2dadeefa382 100644
--- a/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php
+++ b/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php
@@ -298,6 +298,12 @@ class KnowledgeManagement extends DolibarrApi
if ($field == 'id') {
continue;
}
+ if ($field == 'array_options' && is_array($value)) {
+ foreach ($value as $index => $val) {
+ $this->knowledgerecord->array_options[$index] = $this->_checkValForAPI($field, $val, $this->knowledgerecord);
+ }
+ continue;
+ }
$this->knowledgerecord->$field = $this->_checkValForAPI($field, $value, $this->knowledgerecord);
}
diff --git a/htdocs/modulebuilder/template/class/api_mymodule.class.php b/htdocs/modulebuilder/template/class/api_mymodule.class.php
index 20daec19bd1..6ffd48c013c 100644
--- a/htdocs/modulebuilder/template/class/api_mymodule.class.php
+++ b/htdocs/modulebuilder/template/class/api_mymodule.class.php
@@ -257,6 +257,12 @@ class MyModuleApi extends DolibarrApi
if ($field == 'id') {
continue;
}
+ if ($field == 'array_options' && is_array($value)) {
+ foreach ($value as $index => $val) {
+ $this->myobject->array_options[$index] = $this->_checkValForAPI($field, $val, $this->myobject);
+ }
+ continue;
+ }
$this->myobject->$field = $this->_checkValForAPI($field, $value, $this->myobject);
}
diff --git a/htdocs/mrp/class/api_mos.class.php b/htdocs/mrp/class/api_mos.class.php
index 9723d5b2070..1587b6597ab 100644
--- a/htdocs/mrp/class/api_mos.class.php
+++ b/htdocs/mrp/class/api_mos.class.php
@@ -238,6 +238,12 @@ class Mos extends DolibarrApi
if ($field == 'id') {
continue;
}
+ if ($field == 'array_options' && is_array($value)) {
+ foreach ($value as $index => $val) {
+ $this->mo->array_options[$index] = $this->_checkValForAPI($field, $val, $this->mo);
+ }
+ continue;
+ }
$this->mo->$field = $value;
}
diff --git a/htdocs/partnership/class/api_partnership.class.php b/htdocs/partnership/class/api_partnership.class.php
index 47e801cf662..21a81d5db05 100644
--- a/htdocs/partnership/class/api_partnership.class.php
+++ b/htdocs/partnership/class/api_partnership.class.php
@@ -255,6 +255,12 @@ class PartnershipApi extends DolibarrApi
if ($field == 'id') {
continue;
}
+ if ($field == 'array_options' && is_array($value)) {
+ foreach ($value as $index => $val) {
+ $this->partnership->array_options[$index] = $this->_checkValForAPI($field, $val, $this->partnership);
+ }
+ continue;
+ }
$this->partnership->$field = $this->_checkValForAPI($field, $value, $this->partnership);
}
diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php
index d08c3cfb77d..4f4eeeba43c 100644
--- a/htdocs/product/class/api_products.class.php
+++ b/htdocs/product/class/api_products.class.php
@@ -361,6 +361,12 @@ class Products extends DolibarrApi
if ($field == 'stock_reel') {
throw new RestException(400, 'Stock reel cannot be updated here. Use the /stockmovements endpoint instead');
}
+ if ($field == 'array_options' && is_array($value)) {
+ foreach ($value as $index => $val) {
+ $this->product->array_options[$index] = $this->_checkValForAPI($field, $val, $this->product);
+ }
+ continue;
+ }
$this->product->$field = $value;
}
diff --git a/htdocs/product/stock/class/api_warehouses.class.php b/htdocs/product/stock/class/api_warehouses.class.php
index c7b9e67fce7..eb6a03c7d45 100644
--- a/htdocs/product/stock/class/api_warehouses.class.php
+++ b/htdocs/product/stock/class/api_warehouses.class.php
@@ -206,6 +206,12 @@ class Warehouses extends DolibarrApi
if ($field == 'id') {
continue;
}
+ if ($field == 'array_options' && is_array($value)) {
+ foreach ($value as $index => $val) {
+ $this->warehouse->array_options[$index] = $this->_checkValForAPI($field, $val, $this->warehouse);
+ }
+ continue;
+ }
$this->warehouse->$field = $value;
}
diff --git a/htdocs/projet/class/api_projects.class.php b/htdocs/projet/class/api_projects.class.php
index c26264aaccf..f9cfb446f6f 100644
--- a/htdocs/projet/class/api_projects.class.php
+++ b/htdocs/projet/class/api_projects.class.php
@@ -461,6 +461,12 @@ class Projects extends DolibarrApi
if ($field == 'id') {
continue;
}
+ if ($field == 'array_options' && is_array($value)) {
+ foreach ($value as $index => $val) {
+ $this->project->array_options[$index] = $this->_checkValForAPI($field, $val, $this->project);
+ }
+ continue;
+ }
$this->project->$field = $value;
}
diff --git a/htdocs/projet/class/api_tasks.class.php b/htdocs/projet/class/api_tasks.class.php
index 0320a13e5b2..0b0a4de5e27 100644
--- a/htdocs/projet/class/api_tasks.class.php
+++ b/htdocs/projet/class/api_tasks.class.php
@@ -461,6 +461,12 @@ class Tasks extends DolibarrApi
if ($field == 'id') {
continue;
}
+ if ($field == 'array_options' && is_array($value)) {
+ foreach ($value as $index => $val) {
+ $this->task->array_options[$index] = $this->_checkValForAPI($field, $val, $this->task);
+ }
+ continue;
+ }
$this->task->$field = $value;
}
diff --git a/htdocs/reception/class/api_receptions.class.php b/htdocs/reception/class/api_receptions.class.php
index 7161401b292..9a0eba5d97b 100644
--- a/htdocs/reception/class/api_receptions.class.php
+++ b/htdocs/reception/class/api_receptions.class.php
@@ -448,6 +448,12 @@ class Receptions extends DolibarrApi
if ($field == 'id') {
continue;
}
+ if ($field == 'array_options' && is_array($value)) {
+ foreach ($value as $index => $val) {
+ $this->reception->array_options[$index] = $this->_checkValForAPI($field, $val, $this->reception);
+ }
+ continue;
+ }
$this->reception->$field = $value;
}
diff --git a/htdocs/societe/class/api_contacts.class.php b/htdocs/societe/class/api_contacts.class.php
index 6ca6f21bb03..0a5f93a0796 100644
--- a/htdocs/societe/class/api_contacts.class.php
+++ b/htdocs/societe/class/api_contacts.class.php
@@ -331,7 +331,7 @@ class Contacts extends DolibarrApi
continue;
} elseif ($field == 'array_options' && is_array($value)) {
foreach ($value as $index => $val) {
- $this->contact->array_options[$index] = $val;
+ $this->contact->array_options[$index] = $this->_checkValForAPI($field, $val, $this->contact);
}
} else {
$this->contact->$field = $value;
diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php
index a33238e0d7d..351a178d318 100644
--- a/htdocs/societe/class/api_thirdparties.class.php
+++ b/htdocs/societe/class/api_thirdparties.class.php
@@ -302,6 +302,12 @@ class Thirdparties extends DolibarrApi
if ($field == 'id') {
continue;
}
+ if ($field == 'array_options' && is_array($value)) {
+ foreach ($value as $index => $val) {
+ $this->company->array_options[$index] = $this->_checkValForAPI($field, $val, $this->company);
+ }
+ continue;
+ }
$this->company->$field = $value;
}
diff --git a/htdocs/ticket/class/api_tickets.class.php b/htdocs/ticket/class/api_tickets.class.php
index fa2ae9597ae..62f94b2491b 100644
--- a/htdocs/ticket/class/api_tickets.class.php
+++ b/htdocs/ticket/class/api_tickets.class.php
@@ -377,6 +377,15 @@ class Tickets extends DolibarrApi
}
foreach ($request_data as $field => $value) {
+ if ($field == 'id') {
+ continue;
+ }
+ if ($field == 'array_options' && is_array($value)) {
+ foreach ($value as $index => $val) {
+ $this->ticket->array_options[$index] = $this->_checkValForAPI($field, $val, $this->ticket);
+ }
+ continue;
+ }
$this->ticket->$field = $value;
}
diff --git a/htdocs/user/class/api_users.class.php b/htdocs/user/class/api_users.class.php
index 5090539814b..be5b0b9195e 100644
--- a/htdocs/user/class/api_users.class.php
+++ b/htdocs/user/class/api_users.class.php
@@ -406,6 +406,12 @@ class Users extends DolibarrApi
throw new RestException(500, 'Error when updating status of user: '.$this->useraccount->error);
}
} else {
+ if ($field == 'array_options' && is_array($value)) {
+ foreach ($value as $index => $val) {
+ $this->useraccount->array_options[$index] = $this->_checkValForAPI($field, $val, $this->useraccount);
+ }
+ continue;
+ }
$this->useraccount->$field = $value;
}
}