From 5c88e099c5c2b565bd1f59dfe4967aa45d2083f4 Mon Sep 17 00:00:00 2001 From: Florent Poinsaut Date: Tue, 15 Nov 2022 10:20:56 +0000 Subject: [PATCH 1/9] NEW #22848 Add order tags --- .../categories/class/api_categories.class.php | 23 +-- htdocs/categories/class/categorie.class.php | 161 +++++++++--------- htdocs/categories/viewcat.php | 89 +++++++++- htdocs/commande/card.php | 56 ++++++ htdocs/commande/class/commande.class.php | 16 ++ htdocs/core/class/html.form.class.php | 103 +++++++++++ htdocs/core/menus/standard/eldy.lib.php | 6 + .../mysql/tables/llx_categorie_order.key.sql | 25 +++ .../mysql/tables/llx_categorie_order.sql | 26 +++ 9 files changed, 416 insertions(+), 89 deletions(-) create mode 100644 htdocs/install/mysql/tables/llx_categorie_order.key.sql create mode 100644 htdocs/install/mysql/tables/llx_categorie_order.sql diff --git a/htdocs/categories/class/api_categories.class.php b/htdocs/categories/class/api_categories.class.php index 0a618974024bd..303e9fb9e09ea 100644 --- a/htdocs/categories/class/api_categories.class.php +++ b/htdocs/categories/class/api_categories.class.php @@ -44,20 +44,21 @@ class Categories extends DolibarrApi ); static $TYPES = array( - 0 => 'product', - 1 => 'supplier', - 2 => 'customer', - 3 => 'member', - 4 => 'contact', - 5 => 'account', - 6 => 'project', - 7 => 'user', - 8 => 'bank_line', - 9 => 'warehouse', + 0 => 'product', + 1 => 'supplier', + 2 => 'customer', + 3 => 'member', + 4 => 'contact', + 5 => 'account', + 6 => 'project', + 7 => 'user', + 8 => 'bank_line', + 9 => 'warehouse', 10 => 'actioncomm', 11 => 'website_page', 12 => 'ticket', - 13 => 'knowledgemanagement' + 13 => 'knowledgemanagement', + 14 => 'order' ); /** diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 27a301776b889..14e9dd9043349 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -46,20 +46,21 @@ class Categorie extends CommonObject { // Categories types (we use string because we want to accept any modules/types in a future) - const TYPE_PRODUCT = 'product'; - const TYPE_SUPPLIER = 'supplier'; - const TYPE_CUSTOMER = 'customer'; - const TYPE_MEMBER = 'member'; - const TYPE_CONTACT = 'contact'; - const TYPE_USER = 'user'; - const TYPE_PROJECT = 'project'; - const TYPE_ACCOUNT = 'bank_account'; - const TYPE_BANK_LINE = 'bank_line'; - const TYPE_WAREHOUSE = 'warehouse'; - const TYPE_ACTIONCOMM = 'actioncomm'; - const TYPE_WEBSITE_PAGE = 'website_page'; - const TYPE_TICKET = 'ticket'; + const TYPE_PRODUCT = 'product'; + const TYPE_SUPPLIER = 'supplier'; + const TYPE_CUSTOMER = 'customer'; + const TYPE_MEMBER = 'member'; + const TYPE_CONTACT = 'contact'; + const TYPE_USER = 'user'; + const TYPE_PROJECT = 'project'; + const TYPE_ACCOUNT = 'bank_account'; + const TYPE_BANK_LINE = 'bank_line'; + const TYPE_WAREHOUSE = 'warehouse'; + const TYPE_ACTIONCOMM = 'actioncomm'; + const TYPE_WEBSITE_PAGE = 'website_page'; + const TYPE_TICKET = 'ticket'; const TYPE_KNOWLEDGEMANAGEMENT = 'knowledgemanagement'; + const TYPE_ORDER = 'order'; /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png @@ -71,20 +72,21 @@ class Categorie extends CommonObject * @var array Table of mapping between type string and ID used for field 'type' in table llx_categories */ protected $MAP_ID = array( - 'product' => 0, - 'supplier' => 1, - 'customer' => 2, - 'member' => 3, - 'contact' => 4, - 'bank_account' => 5, - 'project' => 6, - 'user' => 7, - 'bank_line' => 8, - 'warehouse' => 9, - 'actioncomm' => 10, - 'website_page' => 11, - 'ticket' => 12, - 'knowledgemanagement' => 13 + 'product' => 0, + 'supplier' => 1, + 'customer' => 2, + 'member' => 3, + 'contact' => 4, + 'bank_account' => 5, + 'project' => 6, + 'user' => 7, + 'bank_line' => 8, + 'warehouse' => 9, + 'actioncomm' => 10, + 'website_page' => 11, + 'ticket' => 12, + 'knowledgemanagement' => 13, + 'order' => 14 ); /** @@ -93,20 +95,21 @@ class Categorie extends CommonObject * @note This array should be removed in future, once previous constants are moved to the string value. Deprecated */ public static $MAP_ID_TO_CODE = array( - 0 => 'product', - 1 => 'supplier', - 2 => 'customer', - 3 => 'member', - 4 => 'contact', - 5 => 'bank_account', - 6 => 'project', - 7 => 'user', - 8 => 'bank_line', - 9 => 'warehouse', + 0 => 'product', + 1 => 'supplier', + 2 => 'customer', + 3 => 'member', + 4 => 'contact', + 5 => 'bank_account', + 6 => 'project', + 7 => 'user', + 8 => 'bank_line', + 9 => 'warehouse', 10 => 'actioncomm', 11 => 'website_page', 12 => 'ticket', - 13 => 'knowledgemanagement' + 13 => 'knowledgemanagement', + 14 => 'order' ); /** @@ -115,9 +118,9 @@ class Categorie extends CommonObject * @todo Move to const array when PHP 5.6 will be our minimum target */ public $MAP_CAT_FK = array( - 'customer' => 'soc', - 'supplier' => 'soc', - 'contact' => 'socpeople', + 'customer' => 'soc', + 'supplier' => 'soc', + 'contact' => 'socpeople', 'bank_account' => 'account', ); @@ -127,8 +130,8 @@ class Categorie extends CommonObject * @note Move to const array when PHP 5.6 will be our minimum target */ public $MAP_CAT_TABLE = array( - 'customer' => 'societe', - 'supplier' => 'fournisseur', + 'customer' => 'societe', + 'supplier' => 'fournisseur', 'bank_account'=> 'account', ); @@ -138,20 +141,21 @@ class Categorie extends CommonObject * @note Move to const array when PHP 5.6 will be our minimum target */ public $MAP_OBJ_CLASS = array( - 'product' => 'Product', - 'customer' => 'Societe', - 'supplier' => 'Fournisseur', - 'member' => 'Adherent', - 'contact' => 'Contact', - 'user' => 'User', - 'account' => 'Account', // old for bank account - 'bank_account' => 'Account', - 'project' => 'Project', - 'warehouse'=> 'Entrepot', - 'actioncomm' => 'ActionComm', - 'website_page' => 'WebsitePage', - 'ticket' => 'Ticket', - 'knowledgemanagement' => 'KnowledgeRecord' + 'product' => 'Product', + 'customer' => 'Societe', + 'supplier' => 'Fournisseur', + 'member' => 'Adherent', + 'contact' => 'Contact', + 'user' => 'User', + 'account' => 'Account', // old for bank account + 'bank_account' => 'Account', + 'project' => 'Project', + 'warehouse' => 'Entrepot', + 'actioncomm' => 'ActionComm', + 'website_page' => 'WebsitePage', + 'ticket' => 'Ticket', + 'knowledgemanagement' => 'KnowledgeRecord', + 'order' => 'Commande' ); /** @@ -160,18 +164,19 @@ class Categorie extends CommonObject * @note Move to const array when PHP 5.6 will be our minimum target */ public static $MAP_TYPE_TITLE_AREA = array( - 'product' => 'ProductsCategoriesArea', - 'customer' => 'CustomersCategoriesArea', - 'supplier' => 'SuppliersCategoriesArea', - 'member' => 'MembersCategoriesArea', - 'contact' => 'ContactsCategoriesArea', - 'user' => 'UsersCategoriesArea', - 'account' => 'AccountsCategoriesArea', // old for bank account - 'bank_account' => 'AccountsCategoriesArea', - 'project' => 'ProjectsCategoriesArea', - 'warehouse'=> 'StocksCategoriesArea', - 'actioncomm' => 'ActioncommCategoriesArea', - 'website_page' => 'WebsitePageCategoriesArea' + 'product' => 'ProductsCategoriesArea', + 'customer' => 'CustomersCategoriesArea', + 'supplier' => 'SuppliersCategoriesArea', + 'member' => 'MembersCategoriesArea', + 'contact' => 'ContactsCategoriesArea', + 'user' => 'UsersCategoriesArea', + 'account' => 'AccountsCategoriesArea', // old for bank account + 'bank_account' => 'AccountsCategoriesArea', + 'project' => 'ProjectsCategoriesArea', + 'warehouse' => 'StocksCategoriesArea', + 'actioncomm' => 'ActioncommCategoriesArea', + 'website_page' => 'WebsitePageCategoriesArea', + 'order' => 'OrderCategoriesArea' ); /** @@ -179,14 +184,15 @@ class Categorie extends CommonObject * This array may be completed by external modules with hook "constructCategory" */ public $MAP_OBJ_TABLE = array( - 'customer' => 'societe', - 'supplier' => 'societe', - 'member' => 'adherent', - 'contact' => 'socpeople', - 'account' => 'bank_account', // old for bank account - 'project' => 'projet', - 'warehouse'=> 'entrepot', - 'knowledgemanagement' => 'knowledgemanagement_knowledgerecord' + 'customer' => 'societe', + 'supplier' => 'societe', + 'member' => 'adherent', + 'contact' => 'socpeople', + 'account' => 'bank_account', // old for bank account + 'project' => 'projet', + 'warehouse' => 'entrepot', + 'knowledgemanagement' => 'knowledgemanagement_knowledgerecord', + 'order' => 'commande' ); /** @@ -245,6 +251,7 @@ class Categorie extends CommonObject * @see Categorie::TYPE_ACTIONCOMM * @see Categorie::TYPE_WEBSITE_PAGE * @see Categorie::TYPE_TICKET + * @see Categorie::TYPE_ORDER */ public $type; diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 7e8a12520956f..0bd61b48e0d9e 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -147,6 +147,11 @@ $tmpobject = new Ticket($db); $result = $tmpobject->fetch($removeelem); $elementtype = 'ticket'; + } elseif ($type == Categorie::TYPE_ORDER && $user->rights->commande->creer) { + require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; + $tmpobject = new Commande($db); + $result = $tmpobject->fetch($removeelem); + $elementtype = 'order'; } $result = $object->del_type($tmpobject, $elementtype); @@ -178,7 +183,8 @@ ($type == Categorie::TYPE_MEMBER && $user->rights->projet->creer) || ($type == Categorie::TYPE_CONTACT && $user->rights->societe->creer) || ($type == Categorie::TYPE_USER && $user->rights->user->user->creer) || - ($type == Categorie::TYPE_ACCOUNT && $user->rights->banque->configurer) + ($type == Categorie::TYPE_ACCOUNT && $user->rights->banque->configurer) || + ($type == Categorie::TYPE_ORDER && $user->rights->commande->creer) )) { if ($type == Categorie::TYPE_PRODUCT) { require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; @@ -216,6 +222,10 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; $newobject = new User($db); $elementtype = 'bank_account'; + } elseif ($type == Categorie::TYPE_ORDER) { + require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; + $newobject = new Commande($db); + $elementtype = 'order'; } $result = $newobject->fetch($elemid); @@ -1229,6 +1239,83 @@ } } +// List of Orders +if ($type == Categorie::TYPE_ORDER) { + require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; + + $permission = $user->rights->commande->creer; + + $objects = $object->getObjectsInCateg($type, 0, $limit, $offset); + if ($objects < 0) { + dol_print_error($db, $object->error, $object->errors); + } else { + // Form to add record into a category + $showclassifyform = 1; + if ($showclassifyform) { + print '
'; + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'; + print $langs->trans("AddOrderIntoCategory").'  '; + $form->selectOrder('', 'elemid'); + print '
'; + print '
'; + } + + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + + print '
'; + $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($objects); $nbtotalofrecords = ''; $newcardbutton = ''; + + print_barre_liste($langs->trans("Orders"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'bill', 0, $newcardbutton, '', $limit); + + print "\n"; + print ''."\n"; + + if (count($objects) > 0) { + $i = 0; + foreach ($objects as $key => $rder) { + $i++; + if ($i > $limit) { + break; + } + + print "\t".''."\n"; + print '\n"; + print '\n"; + // Link to delete from category + print '\n"; + } + } else { + print ''; + } + print "
'.$langs->trans("Ref").'
'; + print $order->getNomUrl(1); + print "'.$order->ref."'; + if ($permission) { + print ""; + print $langs->trans("DeleteFromCat"); + print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft'); + print ""; + } + print "
'.$langs->trans("ThisCategoryHasNoItems").'
\n"; + + print '
'."\n"; + } +} + // End of page llxFooter(); $db->close(); diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 586cf98d60681..998f5cfc972b9 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -36,6 +36,7 @@ */ require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formorder.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmargin.class.php'; @@ -494,6 +495,13 @@ $action = ''; } + if (isModEnabled('categorie')) { + $categories = GETPOST('categories', 'array'); + if (method_exists($object, 'setCategories')) { + $object->setCategories($categories); + } + } + // End of object creation, we show it if ($object_id > 0 && !$error) { $db->commit(); @@ -620,6 +628,11 @@ $result = $object->setDiscount($user, price2num(GETPOST('remise_percent'), '', 2)); } elseif ($action == 'setremiseabsolue' && $usercancreate) { $result = $object->set_remise_absolue($user, price2num(GETPOST('remise_absolue'), 'MU', 2)); + } elseif ($action == 'settags' && isModEnabled('categorie') && $usercancreate) { + $result = $object->setCategories(GETPOST('categories', 'array')); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } } elseif ($action == 'addline' && GETPOST('submitforalllines', 'alpha') && GETPOST('vatforalllines', 'alpha') !== '') { // Define vat_rate $vat_rate = (GETPOST('vatforalllines') ? GETPOST('vatforalllines') : 0); @@ -1844,6 +1857,15 @@ print ''; } + // Categories + if (!empty($conf->categorie->enabled)) { + print ''.$langs->trans("Categories").''; + $cate_arbo = $form->select_all_categories(Categorie::TYPE_ORDER, '', 'parent', 64, 0, 1); + $arrayselected = GETPOST('categories', 'array'); + print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0); + print ""; + } + // Note public print ''; print ''.$langs->trans('NotePublic').''; @@ -2558,6 +2580,40 @@ print ''; } + // Tags-Categories + if (isModEnabled('categorie')) { + print ''; + print '
'; + print $langs->trans("Categories"); + print ''; + if ($usercancreate) { + print ''.img_edit().''; + } else { + print ' '; + } + print '
'; + print ''; + print ''; + $cate_arbo = $form->select_all_categories(Categorie::TYPE_ORDER, '', 'parent', 64, 0, 1); + if ($action == 'edittags') { + print '
'; + print ''; + print ''; + $c = new Categorie($db); + $cats = $c->containing($object->id, Categorie::TYPE_ORDER); + $arrayselected=[]; + foreach ($cats as $cat) { + $arrayselected[] = $cat->id; + } + print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, $arrayselected, 0, 0, 'quatrevingtpercent widthcentpercentminusx', 0, '0'); + print ''; + print '
'; + } else { + print $form->showCategories($object->id, Categorie::TYPE_ORDER, 1); + } + print ""; + } + // Other attributes include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index c2c4eada0b250..c08efc74d1920 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -810,6 +810,22 @@ public function cloture($user, $notrigger = 0) return 0; } + /** + * Sets object to supplied categories. + * + * Deletes object from existing categories not supplied. + * Adds it to non existing supplied categories. + * Existing categories are left untouch. + * + * @param int[]|int $categories Category or categories IDs + * @return void + */ + public function setCategories($categories) + { + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; + return parent::setCategoriesCommon($categories, Categorie::TYPE_ORDER); + } + /** * Cancel an order * If stock is decremented on order validation, we must reincrement it diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 5efbdeae8e191..6ddb94c62de33 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -10064,6 +10064,109 @@ public function selectInvoiceRec($selected = '', $htmlname = 'facrecid', $maxlen } } + + /** + * Output a combo list with orders qualified for a third party + * + * @param int $selected Id order preselected + * @param string $htmlname Name of HTML select + * @param int $maxlength Maximum length of label + * @param int $option_only Return only html options lines without the select tag + * @param string $show_empty Add an empty line ('1' or string to show for empty line) + * @param int $discard_closed Discard closed projects (0=Keep,1=hide completely,2=Disable) + * @param int $forcefocus Force focus on field (works with javascript only) + * @param int $disabled Disabled + * @param string $morecss More css added to the select component + * @return int Nbr of project if OK, <0 if KO + */ + public function selectOrder($selected = '', $htmlname = 'orderid', $maxlength = 24, $option_only = 0, $show_empty = '1', $discard_closed = 0, $forcefocus = 0, $disabled = 0, $morecss = 'maxwidth500') + { + global $user, $conf, $langs; + + $out = ''; + + $hideunselectables = false; + if (!empty($conf->global->PROJECT_HIDE_UNSELECTABLES)) { + $hideunselectables = true; + } + + // Search all orders + $sql = "SELECT c.rowid, c.ref"; + $sql .= ' FROM '.$this->db->prefix().'commande as c'; + $sql .= " ORDER BY c.ref ASC"; + + $resql = $this->db->query($sql); + if ($resql) { + // Use select2 selector + if (!empty($conf->use_javascript_ajax)) { + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; + $comboenhancement = ajax_combobox($htmlname, '', 0, $forcefocus); + $out .= $comboenhancement; + $morecss = 'minwidth200imp maxwidth500'; + } + + if (empty($option_only)) { + $out .= ''; + } + + print $out; + + $this->db->free($resql); + return $num; + } else { + dol_print_error($this->db); + return -1; + } + } + /** * Output the component to make advanced search criteries * diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index cdba19dd38af0..b01998f604ce8 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1325,6 +1325,12 @@ function get_left_menu_commercial($mainmenu, &$newmenu, $usemenuhider = 1, $left $newmenu->add("/commande/list.php?leftmenu=orders&search_status=-1", $langs->trans("StatusOrderCanceledShort"), 2, $user->rights->commande->lire); } $newmenu->add("/commande/stats/index.php?leftmenu=orders", $langs->trans("Statistics"), 1, $user->rights->commande->lire); + + // Categories + if (isModEnabled('categorie')) { + $langs->load("categories"); + $newmenu->add("/categories/index.php?leftmenu=cat&type=14", $langs->trans("Categories"), 1, $user->rights->categorie->lire, '', $mainmenu, 'cat'); + } } // Supplier proposal diff --git a/htdocs/install/mysql/tables/llx_categorie_order.key.sql b/htdocs/install/mysql/tables/llx_categorie_order.key.sql new file mode 100644 index 0000000000000..0f95f31229af8 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_categorie_order.key.sql @@ -0,0 +1,25 @@ +-- ============================================================================ +-- Copyright (C) 2007 Patrick Raguin +-- Copyright (C) 2022 Solution Libre SAS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- ============================================================================ + +ALTER TABLE llx_categorie_order ADD PRIMARY KEY pk_categorie_order (fk_categorie, fk_order); +ALTER TABLE llx_categorie_order ADD INDEX idx_categorie_order_fk_categorie (fk_categorie); +ALTER TABLE llx_categorie_order ADD INDEX idx_categorie_order_fk_order (fk_order); + +ALTER TABLE llx_categorie_order ADD CONSTRAINT fk_categorie_order_categorie_rowid FOREIGN KEY (fk_categorie) REFERENCES llx_categorie (rowid); +ALTER TABLE llx_categorie_order ADD CONSTRAINT fk_categorie_order_fk_order_rowid FOREIGN KEY (fk_order) REFERENCES llx_commande (rowid); \ No newline at end of file diff --git a/htdocs/install/mysql/tables/llx_categorie_order.sql b/htdocs/install/mysql/tables/llx_categorie_order.sql new file mode 100644 index 0000000000000..7e0b8f00c9ec1 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_categorie_order.sql @@ -0,0 +1,26 @@ +-- ============================================================================ +-- Copyright (C) 2007 Patrick Raguin +-- Copyright (C) 2012 Juanjo Menent +-- Copyright (C) 2022 Solution Libre SAS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- ============================================================================ + +create table llx_categorie_order +( + fk_categorie integer NOT NULL, + fk_order integer NOT NULL, + import_key varchar(14) +)ENGINE=innodb; From 669f4fdd1a224b772e48a34cb10a67cebcf79cbd Mon Sep 17 00:00:00 2001 From: Florent Poinsaut <1256948+FlorentPoinsaut@users.noreply.github.com> Date: Tue, 15 Nov 2022 11:36:11 +0100 Subject: [PATCH 2/9] NEW #22848 Fix Typo --- htdocs/categories/viewcat.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 0bd61b48e0d9e..8a6dbd11f0cb7 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -1286,7 +1286,7 @@ if (count($objects) > 0) { $i = 0; - foreach ($objects as $key => $rder) { + foreach ($objects as $key => $order) { $i++; if ($i > $limit) { break; From 4103c655e09a0d1b6e3eb7fe8fda37bb9cd12f55 Mon Sep 17 00:00:00 2001 From: Florent Poinsaut Date: Thu, 15 Dec 2022 15:03:59 +0000 Subject: [PATCH 3/9] NEW #22848 Add import and export functions --- htdocs/core/modules/modCategorie.class.php | 163 ++++++++++++++++++++- 1 file changed, 162 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/modCategorie.class.php b/htdocs/core/modules/modCategorie.class.php index eb3238d4dca3d..0a8cb4a7d7976 100644 --- a/htdocs/core/modules/modCategorie.class.php +++ b/htdocs/core/modules/modCategorie.class.php @@ -163,6 +163,9 @@ public function __construct($db) if (!empty($conf->website->enabled)) { $typeexample .= ($typeexample ? " / " : "")."11=Website page"; } + if (!empty($conf->commande->enabled)) { + $typeexample .= ($typeexample ? " / " : "")."16=Order"; + } // Definition of vars $this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.type'=>"Type", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategoryID", 'pcat.label'=>"ParentCategoryLabel"); @@ -439,6 +442,21 @@ public function __construct($db) // 11 Website Pages, TODO ? + // 16 Order + ++$r; + $this->exportTagLinks( + $r, + 16, + 'commande', + ['commande', 'commande', 'export'], + [ + 'rowid' => [ + 'name' => 'OrderID', + 'type' => 'Numeric' + ] + ] + ); + // Imports //-------- @@ -455,7 +473,7 @@ public function __construct($db) 'ca.label'=>"Label*", 'ca.type'=>"Type*", 'ca.description'=>"Description", 'ca.fk_parent' => 'ParentCategory' ); - $this->import_regex_array[$r] = array('ca.type'=>'^(0|1|2|3|4|5|6|7|8|9|10|11)$'); + $this->import_regex_array[$r] = array('ca.type'=>'^(0|1|2|3|4|5|6|7|8|9|10|11|16)$'); $this->import_convertvalue_array[$r] = array( 'ca.fk_parent' => array( 'rule' => 'fetchidfromcodeandlabel', @@ -618,8 +636,151 @@ public function __construct($db) // 10 Agenda Events, TODO ? // 11 Website Pages, TODO ? + + // 16 Order + if (!empty($conf->commande->enabled)) { + ++$r; + $this->importTagLinks( + $r, + 16, + '/commande/class/commande.class.php', + 'Commande', + 'Commande' + ); + } + } + + /** + * Configure a tag link export + * + * @param int $r Index of import tables + * @param int $cat_id Categorie id + * @param string $class Class of the linked object + * @param string $permission Permission to export the linked object + * @param array $fields_list Additionnal fields of the linked object to export + * + * @return void + */ + protected function exportTagLinks( + int $r, + int $cat_id, + string $class, + array $permission, + array $fields_list + ) { + global $conf; + + $cat_type = Categorie::$MAP_ID_TO_CODE[$cat_id]; + + $this->export_code[$r] = $this->rights_class.'_'.$cat_id.'_'.$cat_type; + $this->export_label[$r] = 'Cat'.ucfirst($cat_type).'sLinks'; + $this->export_icon[$r] = $this->picto; + $this->export_enabled[$r] = '!empty($conf->'.$class.'->enabled)'; + $this->export_permission[$r] = [ + ['categorie', 'lire'], + $permission + ]; + + $entities = []; + $names = []; + $types = []; + foreach ($fields_list as $field => $value) { + $key = 'p.'.$field; + $entities[$key] = $cat_type; + $names[$key] = $value['name']; + $types[$key] = $value['type']; + } + $this->export_fields_array[$r] = array_merge( + [ + 'cat.rowid' => 'CategId', + 'cat.label' => 'Label', + 'cat.description' => 'Description', + 'cat.fk_parent' => 'ParentCategory', + 'pcat.label' => 'ParentCategoryLabel' + ], + $names + ); + $this->export_TypeFields_array[$r] = array_merge( + [ + 'cat.rowid' => 'Numeric', + 'cat.label' => 'Text', + 'cat.description' => 'Text', + 'cat.fk_parent' => 'Numeric', + 'pcat.label' => 'Text' + ], + $names + ); + $this->export_entities_array[$r] = $entities; // We define here only fields that use another picto + + $keyforselect = $class; + $keyforelement = $class; + $keyforaliasextra = 'extra'; + include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; + + $this->export_sql_start[$r] = 'SELECT DISTINCT '; + $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'categorie as cat'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie as pcat ON pcat.rowid = cat.fk_parent'; + $this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'categorie_'.$cat_type.' as cfk ON cfk.fk_categorie = cat.rowid'; + $this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.$class.' as p ON p.rowid = cfk.fk_'.$cat_type; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.$class.'_extrafields as extra ON extra.fk_object = p.rowid'; + $this->export_sql_end[$r] .= ' WHERE cat.entity IN ('.getEntity('category').')'; + $this->export_sql_end[$r] .= ' AND cat.type = '.((int) $cat_id); } + /** + * Configure a tag link import + * + * @param int $r Index of import tables + * @param int $cat_id Categorie id + * @param string $class_file Class file of the linked object + * @param string $class Class of the linked object + * @param string $element Name of the linked object + * + * @return void + */ + protected function importTagLinks( + int $r, + int $cat_id, + string $class_file, + string $class, + string $element, + ) { + $cat_type = Categorie::$MAP_ID_TO_CODE[$cat_id]; + + $this->import_code[$r] = $this->rights_class.'_'.$cat_id.'_'.$cat_type; + $this->import_label[$r] = 'Cat'.ucfirst($cat_type).'sLinks'; // Translation key + $this->import_icon[$r] = $this->picto; + $this->import_entities_array[$r] = []; // We define here only fields that use another icon that the one defined into import_icon + $this->import_tables_array[$r] = ['ci' => MAIN_DB_PREFIX.'categorie_'.$cat_type]; + $this->import_fields_array[$r] = [ + 'ci.fk_categorie' => 'Category*', + 'ci.fk_'.$cat_type => ucfirst($cat_type).'*' + ]; + $this->import_regex_array[$r] = ['ci.fk_categorie' => 'rowid@'.MAIN_DB_PREFIX.'categorie:type='.$cat_id]; + + $this->import_convertvalue_array[$r] = [ + 'ci.fk_categorie' => + [ + 'rule' => 'fetchidfromcodeorlabel', + 'classfile' => '/categories/class/categorie.class.php', + 'class' => 'Categorie', + 'method' => 'fetch', + 'element' => 'category' + ], + 'ci.fk_'.$cat_type => + [ + 'rule' => 'fetchidfromref', + 'classfile' => $class_file, + 'class' => $class, + 'method' => 'fetch', + 'element' => $element + ] + ]; + $this->import_examplevalues_array[$r] = [ + 'ci.fk_categorie' => 'rowid or label', + 'ci.fk_'.$cat_type => 'rowid or ref' + ]; + } /** * Function called when module is enabled. From a217236836b6805881c137b21d2e6249ed9b0b4e Mon Sep 17 00:00:00 2001 From: Florent Poinsaut Date: Thu, 15 Dec 2022 20:27:03 +0000 Subject: [PATCH 4/9] NEW #22848 Use the right tag id --- htdocs/categories/class/api_categories.class.php | 2 +- htdocs/categories/class/categorie.class.php | 4 ++-- htdocs/core/menus/standard/eldy.lib.php | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/categories/class/api_categories.class.php b/htdocs/categories/class/api_categories.class.php index 303e9fb9e09ea..85d03ad397de2 100644 --- a/htdocs/categories/class/api_categories.class.php +++ b/htdocs/categories/class/api_categories.class.php @@ -58,7 +58,7 @@ class Categories extends DolibarrApi 11 => 'website_page', 12 => 'ticket', 13 => 'knowledgemanagement', - 14 => 'order' + 16 => 'order' ); /** diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 14e9dd9043349..4b142dd0b7bcd 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -86,7 +86,7 @@ class Categorie extends CommonObject 'website_page' => 11, 'ticket' => 12, 'knowledgemanagement' => 13, - 'order' => 14 + 'order' => 16 ); /** @@ -109,7 +109,7 @@ class Categorie extends CommonObject 11 => 'website_page', 12 => 'ticket', 13 => 'knowledgemanagement', - 14 => 'order' + 16 => 'order' ); /** diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index b01998f604ce8..a3b9cb7b36517 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1,4 +1,4 @@ - * Copyright (C) 2010 Regis Houssin * Copyright (C) 2012-2015 Juanjo Menent @@ -1329,7 +1329,7 @@ function get_left_menu_commercial($mainmenu, &$newmenu, $usemenuhider = 1, $left // Categories if (isModEnabled('categorie')) { $langs->load("categories"); - $newmenu->add("/categories/index.php?leftmenu=cat&type=14", $langs->trans("Categories"), 1, $user->rights->categorie->lire, '', $mainmenu, 'cat'); + $newmenu->add("/categories/index.php?leftmenu=cat&type=16", $langs->trans("Categories"), 1, $user->rights->categorie->lire, '', $mainmenu, 'cat'); } } From 39e4b10174a61f1dddbb17badf002eb4c4832dad Mon Sep 17 00:00:00 2001 From: Florent Poinsaut <1256948+FlorentPoinsaut@users.noreply.github.com> Date: Mon, 24 Jul 2023 09:42:21 +0200 Subject: [PATCH 5/9] NEW #22848 Remove linked categories --- htdocs/commande/class/commande.class.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 9dd86669df0ec..86464d3f369d4 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3443,6 +3443,18 @@ public function delete($user, $notrigger = 0) $error++; } + // Remove linked categories. + if (!$error) { + $sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_order"; + $sql .= " WHERE fk_order = ".((int) $this->id); + + $result = $this->db->query($sql); + if (!$result) { + $error++; + $this->errors[] = $this->db->lasterror(); + } + } + // Delete extrafields of lines and lines if (!$error && !empty($this->table_element_line)) { $tabletodelete = $this->table_element_line; From f077dc95b3df447d2cd9156eb952596287debf04 Mon Sep 17 00:00:00 2001 From: Florent Poinsaut Date: Tue, 17 Oct 2023 14:45:33 +0200 Subject: [PATCH 6/9] Fix link between invoice and order and tags export / import --- htdocs/core/modules/modCategorie.class.php | 36 ++++++++++++---------- htdocs/langs/en_US/categories.lang | 1 + 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/htdocs/core/modules/modCategorie.class.php b/htdocs/core/modules/modCategorie.class.php index e39f2446d5650..fc8a10e95e2a6 100644 --- a/htdocs/core/modules/modCategorie.class.php +++ b/htdocs/core/modules/modCategorie.class.php @@ -1,8 +1,9 @@ - * Copyright (C) 2005-2014 Laurent Destailleur - * Copyright (C) 2012-2016 Juanjo Menent - * Copyright (C) 2020 Stéphane Lesage +/* Copyright (C) 2005 Matthieu Valleton + * Copyright (C) 2005-2014 Laurent Destailleur + * Copyright (C) 2012-2016 Juanjo Menent + * Copyright (C) 2020 Stéphane Lesage + * Copyright (C) 2022-2023 Solution Libre SAS * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -447,7 +448,8 @@ public function __construct($db) $this->exportTagLinks( $r, 16, - 'commande', + 'Commande', + '!empty($conf->commande->enabled)', ['commande', 'commande', 'export'], [ 'rowid' => [ @@ -653,11 +655,12 @@ public function __construct($db) /** * Configure a tag link export * - * @param int $r Index of import tables - * @param int $cat_id Categorie id - * @param string $class Class of the linked object - * @param string $permission Permission to export the linked object - * @param array $fields_list Additionnal fields of the linked object to export + * @param int $r Index of import tables + * @param int $cat_id Categorie id + * @param string $enabled Condition to enable this export + * @param string $class Class of the linked object + * @param string $permission Permission to export the linked object + * @param array $fields_list Additionnal fields of the linked object to export * * @return void */ @@ -665,6 +668,7 @@ protected function exportTagLinks( int $r, int $cat_id, string $class, + string $enabled, array $permission, array $fields_list ) { @@ -675,7 +679,7 @@ protected function exportTagLinks( $this->export_code[$r] = $this->rights_class.'_'.$cat_id.'_'.$cat_type; $this->export_label[$r] = 'Cat'.ucfirst($cat_type).'sLinks'; $this->export_icon[$r] = $this->picto; - $this->export_enabled[$r] = '!empty($conf->'.$class.'->enabled)'; + $this->export_enabled[$r] = $enabled; $this->export_permission[$r] = [ ['categorie', 'lire'], $permission @@ -730,11 +734,11 @@ protected function exportTagLinks( /** * Configure a tag link import * - * @param int $r Index of import tables - * @param int $cat_id Categorie id - * @param string $class_file Class file of the linked object - * @param string $class Class of the linked object - * @param string $element Name of the linked object + * @param int $r Index of import tables + * @param int $cat_id Categorie id + * @param string $class_file Class file of the linked object + * @param string $class Class of the linked object + * @param string $element Name of the linked object * * @return void */ diff --git a/htdocs/langs/en_US/categories.lang b/htdocs/langs/en_US/categories.lang index 8a4d3783d643b..70591d7be3f30 100644 --- a/htdocs/langs/en_US/categories.lang +++ b/htdocs/langs/en_US/categories.lang @@ -77,6 +77,7 @@ CatMemberList=List of members tags/categories CatContactList=List of contacts tags/categories CatProjectsList=List of projects tags/categories CatUsersList=List of users tags/categories +CatOrdersLinks=Links between orders and tags/categories CatSupLinks=Links between vendors and tags/categories CatCusLinks=Links between customers/prospects and tags/categories CatContactsLinks=Links between contacts/addresses and tags/categories From 7e8bec9189d1d7ae55efa439173e099258a2d258 Mon Sep 17 00:00:00 2001 From: Florent Poinsaut Date: Fri, 20 Oct 2023 10:39:14 +0200 Subject: [PATCH 7/9] Fix doc --- htdocs/core/modules/modCategorie.class.php | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/core/modules/modCategorie.class.php b/htdocs/core/modules/modCategorie.class.php index 1fa532686eae3..aab490f2cd60f 100644 --- a/htdocs/core/modules/modCategorie.class.php +++ b/htdocs/core/modules/modCategorie.class.php @@ -657,20 +657,20 @@ public function __construct($db) * * @param int $r Index of import tables * @param int $cat_id Categorie id - * @param string $enabled Condition to enable this export * @param string $class Class of the linked object + * @param string $enabled Condition to enable this export * @param string $permission Permission to export the linked object * @param array $fields_list Additionnal fields of the linked object to export * * @return void */ protected function exportTagLinks( - int $r, - int $cat_id, - string $class, - string $enabled, - array $permission, - array $fields_list + int $r, + int $cat_id, + string $class, + string $enabled, + array $permission, + array $fields_list ) { global $conf; @@ -743,11 +743,11 @@ protected function exportTagLinks( * @return void */ protected function importTagLinks( - int $r, - int $cat_id, - string $class_file, - string $class, - string $element, + int $r, + int $cat_id, + string $class_file, + string $class, + string $element, ) { $cat_type = Categorie::$MAP_ID_TO_CODE[$cat_id]; From 5a7fd3d0e6a6302522e3a07dee1ccf23a5e0909d Mon Sep 17 00:00:00 2001 From: Florent Poinsaut Date: Thu, 1 Aug 2024 17:38:45 +0200 Subject: [PATCH 8/9] NEW Dolibarr#22848 typo --- htdocs/core/modules/modCategorie.class.php | 2 +- htdocs/langs/en_US/categories.lang | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/modCategorie.class.php b/htdocs/core/modules/modCategorie.class.php index 26079e645430d..59681a537b3c3 100644 --- a/htdocs/core/modules/modCategorie.class.php +++ b/htdocs/core/modules/modCategorie.class.php @@ -664,7 +664,7 @@ public function __construct($db) * @param string $class Class of the linked object * @param string $enabled Condition to enable this export * @param string $permission Permission to export the linked object - * @param array $fields_list Additionnal fields of the linked object to export + * @param array $fields_list Additional fields of the linked object to export * * @return void */ diff --git a/htdocs/langs/en_US/categories.lang b/htdocs/langs/en_US/categories.lang index 70591d7be3f30..16c0c92594022 100644 --- a/htdocs/langs/en_US/categories.lang +++ b/htdocs/langs/en_US/categories.lang @@ -93,6 +93,7 @@ CategorieRecursivHelp=If option is on, when you add an object into a subcategory AddProductServiceIntoCategory=Assign category to the product/service AddCustomerIntoCategory=Assign category to customer AddSupplierIntoCategory=Assign category to supplier +AddOrderIntoCategory=Assign category to order AssignCategoryTo=Assign category to ShowCategory=Show tag/category ByDefaultInList=By default in list From 416c357a3a3a48a871063b798c15ca38b329844b Mon Sep 17 00:00:00 2001 From: Florent Poinsaut Date: Mon, 26 Aug 2024 15:45:38 +0200 Subject: [PATCH 9/9] NEW #22848 Fix CI --- htdocs/categories/viewcat.php | 1 + htdocs/commande/card.php | 6 +++--- htdocs/commande/class/commande.class.php | 9 ++++---- htdocs/core/class/html.form.class.php | 25 +++++++++++----------- htdocs/core/menus/standard/eldy.lib.php | 2 +- htdocs/core/modules/modCategorie.class.php | 4 ++-- 6 files changed, 25 insertions(+), 22 deletions(-) diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 932b8481e467d..84bcd81bcd63e 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -1420,6 +1420,7 @@ print '
'; $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($objects); $nbtotalofrecords = ''; $newcardbutton = ''; + // @phan-suppress-next-line PhanPluginSuspiciousParamOrder print_barre_liste($langs->trans("Orders"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'bill', 0, $newcardbutton, '', $limit); print "\n"; diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 5b5c115acb32c..7cb304fd7237f 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -534,7 +534,7 @@ $action = ''; } - if (isModEnabled('categorie')) { + if (isModEnabled('category')) { $categories = GETPOST('categories', 'array'); if (method_exists($object, 'setCategories')) { $object->setCategories($categories); @@ -667,7 +667,7 @@ // $result = $object->setDiscount($user, price2num(GETPOST('remise_percent'), '', 2)); //} elseif ($action == 'setremiseabsolue' && $usercancreate) { // $result = $object->set_remise_absolue($user, price2num(GETPOST('remise_absolue'), 'MU', 2)); - } elseif ($action == 'settags' && isModEnabled('categorie') && $usercancreate) { + } elseif ($action == 'settags' && isModEnabled('category') && $usercancreate) { $result = $object->setCategories(GETPOST('categories', 'array')); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); @@ -2811,7 +2811,7 @@ } // Tags-Categories - if (isModEnabled('categorie')) { + if (isModEnabled('category')) { print '
'; print '
'; print $langs->trans("Categories"); diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 859afdee86d9f..1018a847ff983 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -832,14 +832,15 @@ public function cloture($user, $notrigger = 0) } /** - * Sets object to supplied categories. + * Sets object to given categories. * - * Deletes object from existing categories not supplied. * Adds it to non existing supplied categories. + * Deletes object from existing categories not supplied. * Existing categories are left untouch. * - * @param int[]|int $categories Category or categories IDs - * @return void + * @param int[]|int $categories Category ID or array of Categories IDs + * + * @return int Return integer <0 if KO, >0 if OK */ public function setCategories($categories) { diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 05037dab66458..ca641bc286a74 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -10920,18 +10920,19 @@ public function selectInvoiceRec($selected = '', $htmlname = 'facrecid', $maxlen /** - * Output a combo list with orders qualified for a third party + * Output a combo list with orders qualified for a third party * - * @param int $selected Id order preselected - * @param string $htmlname Name of HTML select - * @param int $maxlength Maximum length of label - * @param int $option_only Return only html options lines without the select tag - * @param string $show_empty Add an empty line ('1' or string to show for empty line) - * @param int $discard_closed Discard closed projects (0=Keep,1=hide completely,2=Disable) - * @param int $forcefocus Force focus on field (works with javascript only) - * @param int $disabled Disabled - * @param string $morecss More css added to the select component - * @return int Nbr of project if OK, <0 if KO + * @param string $selected Id order preselected + * @param string $htmlname Name of HTML select + * @param int $maxlength Maximum length of label + * @param int $option_only Return only html options lines without the select tag + * @param string $show_empty Add an empty line ('1' or string to show for empty line) + * @param int $discard_closed Discard closed projects (0=Keep,1=hide completely,2=Disable) + * @param int $forcefocus Force focus on field (works with javascript only) + * @param int $disabled Disabled + * @param string $morecss More css added to the select component + * + * @return int Nbr of project if OK, <0 if KO */ public function selectOrder($selected = '', $htmlname = 'orderid', $maxlength = 24, $option_only = 0, $show_empty = '1', $discard_closed = 0, $forcefocus = 0, $disabled = 0, $morecss = 'maxwidth500') { @@ -10954,7 +10955,7 @@ public function selectOrder($selected = '', $htmlname = 'orderid', $maxlength = // Use select2 selector if (!empty($conf->use_javascript_ajax)) { include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; - $comboenhancement = ajax_combobox($htmlname, '', 0, $forcefocus); + $comboenhancement = ajax_combobox($htmlname, array(), 0, $forcefocus); $out .= $comboenhancement; $morecss = 'minwidth200imp maxwidth500'; } diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 4e7fcee2e7837..a38930b16ec28 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1388,7 +1388,7 @@ function get_left_menu_commercial($mainmenu, &$newmenu, $usemenuhider = 1, $left } // Categories - if (isModEnabled('categorie')) { + if (isModEnabled('category')) { $langs->load("categories"); $newmenu->add("/categories/index.php?leftmenu=cat&type=16", $langs->trans("Categories"), 1, $user->hasRight('categorie', 'lire'), '', $mainmenu, 'cat'); } diff --git a/htdocs/core/modules/modCategorie.class.php b/htdocs/core/modules/modCategorie.class.php index 59681a537b3c3..087a71f9540f7 100644 --- a/htdocs/core/modules/modCategorie.class.php +++ b/htdocs/core/modules/modCategorie.class.php @@ -663,7 +663,7 @@ public function __construct($db) * @param int $cat_id Categorie id * @param string $class Class of the linked object * @param string $enabled Condition to enable this export - * @param string $permission Permission to export the linked object + * @param array $permission Permission to export the linked object * @param array $fields_list Additional fields of the linked object to export * * @return void @@ -751,7 +751,7 @@ protected function importTagLinks( int $cat_id, string $class_file, string $class, - string $element, + string $element ) { $cat_type = Categorie::$MAP_ID_TO_CODE[$cat_id];