From 2076d18825817a4ac90f70bd273f7479465d5d90 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 4 Aug 2020 12:47:09 +0200 Subject: [PATCH] FIX Param of fetch_name_optionals_label must be object->table_element --- htdocs/commande/list.php | 2 +- htdocs/compta/facture/invoicetemplate_list.php | 2 +- htdocs/compta/facture/list.php | 2 +- htdocs/contact/list.php | 2 +- htdocs/contrat/list.php | 2 +- htdocs/contrat/services_list.php | 2 +- htdocs/core/class/extrafields.class.php | 3 ++- htdocs/core/modules/stock/doc/pdf_stdmovement.modules.php | 2 +- htdocs/expensereport/list.php | 2 +- htdocs/fichinter/list.php | 2 +- htdocs/fourn/commande/list.php | 2 +- htdocs/modulebuilder/template/class/myobject.class.php | 2 +- htdocs/product/list.php | 2 +- htdocs/projet/activity/perweek.php | 3 +-- htdocs/public/ticket/list.php | 2 +- htdocs/zapier/class/hook.class.php | 4 ++-- 16 files changed, 18 insertions(+), 18 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 3b83e04fe3c..0cc9fa6634b 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -116,7 +116,7 @@ $hookmanager->initHooks(array('orderlist')); $extrafields = new ExtraFields($db); // fetch optionals attributes and labels -$extrafields->fetch_name_optionals_label('commande'); +$extrafields->fetch_name_optionals_label($object->table_element); $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); // List of fields to search into when doing a "search in all" diff --git a/htdocs/compta/facture/invoicetemplate_list.php b/htdocs/compta/facture/invoicetemplate_list.php index d8f51290872..5c353d6f2cd 100644 --- a/htdocs/compta/facture/invoicetemplate_list.php +++ b/htdocs/compta/facture/invoicetemplate_list.php @@ -108,7 +108,7 @@ $hookmanager->initHooks(array('invoicereclist')); $extrafields = new ExtraFields($db); // fetch optionals attributes and labels -$extrafields->fetch_name_optionals_label('facture_rec'); +$extrafields->fetch_name_optionals_label($object->table_element); $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 128e0502344..6d12483e303 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -150,7 +150,7 @@ $hookmanager->initHooks(array('invoicelist')); $extrafields = new ExtraFields($db); // fetch optionals attributes and labels -$extrafields->fetch_name_optionals_label('facture'); +$extrafields->fetch_name_optionals_label($object->table_element); $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index f766c8beeb8..39c588ace15 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -143,7 +143,7 @@ $hookmanager->initHooks(array('contactlist')); $extrafields = new ExtraFields($db); // fetch optionals attributes and labels -$extrafields->fetch_name_optionals_label('contact'); +$extrafields->fetch_name_optionals_label($object->table_element); $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index a7205730817..37fd99a771e 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -100,7 +100,7 @@ $hookmanager->initHooks(array('contractlist')); $extrafields = new ExtraFields($db); // fetch optionals attributes and labels -$extrafields->fetch_name_optionals_label('contrat'); +$extrafields->fetch_name_optionals_label($object->table_element); $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); // List of fields to search into when doing a "search in all" diff --git a/htdocs/contrat/services_list.php b/htdocs/contrat/services_list.php index 2b81ceff5fa..90f6516a499 100644 --- a/htdocs/contrat/services_list.php +++ b/htdocs/contrat/services_list.php @@ -84,7 +84,7 @@ $hookmanager->initHooks(array('contractservicelist')); $extrafields = new ExtraFields($db); // fetch optionals attributes and labels -$extrafields->fetch_name_optionals_label('contratdet'); +$extrafields->fetch_name_optionals_label($object->table_element); $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index eecb5b54330..5ac47f1a478 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -842,7 +842,7 @@ class ExtraFields /** * Load array this->attributes, or old this->attribute_xxx like attribute_label, attribute_type, ... * - * @param string $elementtype Type of element ('' = all, 'adherent', 'commande', 'thirdparty', 'facture', 'propal', 'product', ...). + * @param string $elementtype Type of element ('' = all or $object->table_element like 'adherent', 'commande', 'thirdparty', 'facture', 'propal', 'product', ...). * @param boolean $forceload Force load of extra fields whatever is status of cache. * @return array Array of attributes keys+label for all extra fields. */ @@ -856,6 +856,7 @@ class ExtraFields if ($elementtype == 'thirdparty') $elementtype = 'societe'; if ($elementtype == 'contact') $elementtype = 'socpeople'; if ($elementtype == 'order_supplier') $elementtype = 'commande_fournisseur'; + if ($elementtype == 'stock_mouvement') $elementtype = 'movement'; $array_name_label = array(); diff --git a/htdocs/core/modules/stock/doc/pdf_stdmovement.modules.php b/htdocs/core/modules/stock/doc/pdf_stdmovement.modules.php index d0e9ba9d1e4..69af56d1e17 100644 --- a/htdocs/core/modules/stock/doc/pdf_stdmovement.modules.php +++ b/htdocs/core/modules/stock/doc/pdf_stdmovement.modules.php @@ -183,7 +183,7 @@ class pdf_stdmovement extends ModelePDFMovement /** * Function to build a document on disk using the generic odt module. * - * @param StockMovements $object Object source to build document + * @param MouvementStock $object Object source to build document * @param Translate $outputlangs Lang output object * @param string $srctemplatepath Full path of source filename for generator using a template file * @param int $hidedetails Do not show line details diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index 07f0e332276..ec54b88a31b 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -109,7 +109,7 @@ $hookmanager->initHooks(array('expensereportlist')); $extrafields = new ExtraFields($db); // fetch optionals attributes and labels -$extrafields->fetch_name_optionals_label('expensereport'); +$extrafields->fetch_name_optionals_label($object->table_element); $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index 3ecf9a076dc..42031e25ce5 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -85,7 +85,7 @@ $hookmanager->initHooks(array('interventionlist')); $extrafields = new ExtraFields($db); // fetch optionals attributes and labels -$extrafields->fetch_name_optionals_label('fichinter'); +$extrafields->fetch_name_optionals_label($object->table_element); $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index acd79212052..417e78023a8 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -120,7 +120,7 @@ $hookmanager->initHooks(array('supplierorderlist')); $extrafields = new ExtraFields($db); // fetch optionals attributes and labels -$extrafields->fetch_name_optionals_label('commande_fournisseur'); +$extrafields->fetch_name_optionals_label($object->table_element); $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index bfd1cd46fb5..8fe0b67a233 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -310,7 +310,7 @@ class MyObject extends CommonObject foreach ($object->array_options as $key => $option) { $shortkey = preg_replace('/options_/', '', $key); - if (!empty($extrafields->attributes[$this->element]['unique'][$shortkey])) + if (!empty($extrafields->attributes[$this->table_element]['unique'][$shortkey])) { //var_dump($key); var_dump($clonedObj->array_options[$key]); exit; unset($object->array_options[$key]); diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 57eacb75ed4..19b5c48df8f 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -107,7 +107,7 @@ $extrafields = new ExtraFields($db); $form = new Form($db); // fetch optionals attributes and labels -$extrafields->fetch_name_optionals_label('product'); +$extrafields->fetch_name_optionals_label($object->table_element); $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); if (empty($action)) $action = 'list'; diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php index 3a5ae388f9f..484a93e8631 100644 --- a/htdocs/projet/activity/perweek.php +++ b/htdocs/projet/activity/perweek.php @@ -122,8 +122,7 @@ $object = new Task($db); $extrafields = new ExtraFields($db); // fetch optionals attributes and labels -//$extrafields->fetch_name_optionals_label('projet'); -$extrafields->fetch_name_optionals_label('projet_task'); +$extrafields->fetch_name_optionals_label($object->table_element); $arrayfields = array(); /*$arrayfields=array( diff --git a/htdocs/public/ticket/list.php b/htdocs/public/ticket/list.php index 40e6e55cb33..7d794e99a74 100644 --- a/htdocs/public/ticket/list.php +++ b/htdocs/public/ticket/list.php @@ -201,7 +201,7 @@ if ($action == "view_ticketlist") // fetch optionals attributes and labels $extrafields = new ExtraFields($db); - $extrafields->fetch_name_optionals_label('ticket'); + $extrafields->fetch_name_optionals_label($object->table_element); $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); diff --git a/htdocs/zapier/class/hook.class.php b/htdocs/zapier/class/hook.class.php index b985c77434e..4d3d7296b2f 100644 --- a/htdocs/zapier/class/hook.class.php +++ b/htdocs/zapier/class/hook.class.php @@ -354,10 +354,10 @@ class Hook extends CommonObject // ... // Clear extrafields that are unique if (is_array($object->array_options) && count($object->array_options) > 0) { - $extrafields->fetch_name_optionals_label($this->element); + $extrafields->fetch_name_optionals_label($this->table_element); foreach ($object->array_options as $key => $option) { $shortkey = preg_replace('/options_/', '', $key); - if (!empty($extrafields->attributes[$this->element]['unique'][$shortkey])) { + if (!empty($extrafields->attributes[$this->table_element]['unique'][$shortkey])) { // var_dump($key); // var_dump($clonedObj->array_options[$key]); // exit;