From 426f4305b05c6696994a8ebce17b4c4b7d6b6ac2 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Mon, 20 Jan 2025 11:48:37 +0100 Subject: [PATCH 01/23] FIX delete supplier order when at least one line linked to customer order line --- htdocs/fourn/class/fournisseur.commande.class.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index b98f14aa074..60b6f98f0cf 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -2312,6 +2312,16 @@ class CommandeFournisseur extends CommonOrder $error++; } + if (!$error) { + $sql1 = 'UPDATE '.$this->db->prefix()."commandedet SET fk_commandefourndet = NULL WHERE fk_commandefourndet IN (SELECT rowid FROM ".$main." WHERE fk_commande = ".((int) $this->id).")"; + dol_syslog(__METHOD__." linked order lines", LOG_DEBUG); + if (!$this->db->query($sql1)) { + $error++; + $this->error = $this->db->lasterror(); + $this->errors[] = $this->db->lasterror(); + } + } + $sql = "DELETE FROM ".MAIN_DB_PREFIX."commande_fournisseurdet WHERE fk_commande =".((int) $this->id); dol_syslog(get_class($this)."::delete", LOG_DEBUG); if (!$this->db->query($sql)) { From 7f2a253625148d02dc94a2513e2a8251020e8c3f Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Mon, 20 Jan 2025 12:17:12 +0100 Subject: [PATCH 02/23] Uniformize SQL concat char --- htdocs/fourn/class/fournisseur.commande.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 60b6f98f0cf..6ad989bceb5 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -2313,7 +2313,7 @@ class CommandeFournisseur extends CommonOrder } if (!$error) { - $sql1 = 'UPDATE '.$this->db->prefix()."commandedet SET fk_commandefourndet = NULL WHERE fk_commandefourndet IN (SELECT rowid FROM ".$main." WHERE fk_commande = ".((int) $this->id).")"; + $sql1 = "UPDATE ".$this->db->prefix()."commandedet SET fk_commandefourndet = NULL WHERE fk_commandefourndet IN (SELECT rowid FROM ".$main." WHERE fk_commande = ".((int) $this->id).")"; dol_syslog(__METHOD__." linked order lines", LOG_DEBUG); if (!$this->db->query($sql1)) { $error++; @@ -4147,7 +4147,7 @@ class CommandeFournisseurLigne extends CommonOrderLine return -1; } - $sql1 = 'UPDATE '.MAIN_DB_PREFIX."commandedet SET fk_commandefourndet = NULL WHERE fk_commandefourndet=".((int) $this->id); + $sql1 = "UPDATE ".MAIN_DB_PREFIX."commandedet SET fk_commandefourndet = NULL WHERE fk_commandefourndet=".((int) $this->id); $resql = $this->db->query($sql1); if (!$resql) { $this->db->rollback(); From 576e70c3ce95da7511ce3c13f6b501c7a56d3d4c Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 20 Jan 2025 22:32:30 +0100 Subject: [PATCH 03/23] FIX wrong update function parameter --- htdocs/fourn/class/api_supplier_invoices.class.php | 2 +- htdocs/ticket/class/api_tickets.class.php | 2 +- htdocs/zapier/class/api_zapier.class.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/fourn/class/api_supplier_invoices.class.php b/htdocs/fourn/class/api_supplier_invoices.class.php index 13dc0e8b094..1614552ee5c 100644 --- a/htdocs/fourn/class/api_supplier_invoices.class.php +++ b/htdocs/fourn/class/api_supplier_invoices.class.php @@ -272,7 +272,7 @@ class SupplierInvoices extends DolibarrApi $this->invoice->$field = $value; } - if ($this->invoice->update($id, DolibarrApiAccess::$user)) { + if ($this->invoice->update(DolibarrApiAccess::$user)) { return $this->get($id); } diff --git a/htdocs/ticket/class/api_tickets.class.php b/htdocs/ticket/class/api_tickets.class.php index 62f94b2491b..a40e54934a1 100644 --- a/htdocs/ticket/class/api_tickets.class.php +++ b/htdocs/ticket/class/api_tickets.class.php @@ -389,7 +389,7 @@ class Tickets extends DolibarrApi $this->ticket->$field = $value; } - if ($this->ticket->update($id, DolibarrApiAccess::$user)) { + if ($this->ticket->update(DolibarrApiAccess::$user)) { return $this->get($id); } diff --git a/htdocs/zapier/class/api_zapier.class.php b/htdocs/zapier/class/api_zapier.class.php index 5ff155aebf0..2ed4e984126 100644 --- a/htdocs/zapier/class/api_zapier.class.php +++ b/htdocs/zapier/class/api_zapier.class.php @@ -300,7 +300,7 @@ class Zapier extends DolibarrApi $this->hook->$field = $value; } - if ($this->hook->update($id, DolibarrApiAccess::$user) > 0) { + if ($this->hook->update(DolibarrApiAccess::$user) > 0) { return $this->get($id); } else { throw new RestException(500, $this->hook->error); From cbe15c7c71059ad25315533d60d52dc973e93bba Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Wed, 22 Jan 2025 23:53:16 +0100 Subject: [PATCH 04/23] missing hookmanager like others doc_generic*odt modules --- .../project/task/doc/doc_generic_task_odt.modules.php | 8 ++++++++ .../core/modules/societe/doc/doc_generic_odt.modules.php | 1 + .../mymodule/doc/doc_generic_myobject_odt.modules.php | 5 +++++ .../doc_generic_recruitmentjobposition_odt.modules.php | 5 +++++ 4 files changed, 19 insertions(+) diff --git a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php index 51e53e21d3f..f2cb1eddb78 100644 --- a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php +++ b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php @@ -469,6 +469,14 @@ class doc_generic_task_odt extends ModelePDFTask return -1; } + // Add odtgeneration hook + if (!is_object($hookmanager)) { + include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; + $hookmanager = new HookManager($this->db); + } + $hookmanager->initHooks(array('odtgeneration')); + global $action; + if (!is_object($outputlangs)) { $outputlangs = $langs; } diff --git a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php index 374c44c7a25..49ce657fce7 100644 --- a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php +++ b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php @@ -216,6 +216,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc $hookmanager = new HookManager($this->db); } $hookmanager->initHooks(array('odtgeneration')); + global $action; if (!is_object($outputlangs)) { $outputlangs = $langs; diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php index e35fb604cec..680cf49de6b 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php @@ -233,7 +233,12 @@ class doc_generic_myobject_odt extends ModelePDFMyObject } // Add odtgeneration hook + if (!is_object($hookmanager)) { + include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; + $hookmanager = new HookManager($this->db); + } $hookmanager->initHooks(array('odtgeneration')); + global $action; if (!is_object($outputlangs)) { $outputlangs = $langs; diff --git a/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php b/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php index da7640d708a..128293c9d85 100644 --- a/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php +++ b/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php @@ -221,7 +221,12 @@ class doc_generic_recruitmentjobposition_odt extends ModelePDFRecruitmentJobPosi } // Add odtgeneration hook + if (!is_object($hookmanager)) { + include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; + $hookmanager = new HookManager($this->db); + } $hookmanager->initHooks(array('odtgeneration')); + global $action; if (!is_object($outputlangs)) { $outputlangs = $langs; From c7ee83b3b9164e33288ee0c925c054c5496c7adc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 27 Jan 2025 10:33:38 +0100 Subject: [PATCH 05/23] FIX can not delete files in task card --- htdocs/core/lib/files.lib.php | 1 + htdocs/projet/tasks/task.php | 14 ++++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 2ed990205ad..ee9b55b21c3 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1448,6 +1448,7 @@ function dol_delete_file($file, $disableglob = 0, $nophperrors = 0, $nohook = 0, } } } else { + $ok = false; // to avoid false positive dol_syslog("No files to delete found", LOG_DEBUG); } } else { diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index b8ff5a6f9bc..4f1ca11848b 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -65,7 +65,10 @@ if ($reshook < 0) { } if ($id > 0 || $ref) { - $object->fetch($id, $ref); + $ret = $object->fetch($id, $ref); + if ($ret > 0) { + $projectstatic->fetch($object->fk_project); + } } // Security check @@ -204,14 +207,14 @@ if ($action == 'remove_file' && $user->rights->projet->creer) { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $langs->load("other"); - $upload_dir = $conf->project->dir_output; + $upload_dir = $conf->project->dir_output."/".dol_sanitizeFileName($projectstatic->ref)."/".dol_sanitizeFileName($object->ref); $file = $upload_dir.'/'.dol_sanitizeFileName(GETPOST('file')); $ret = dol_delete_file($file); if ($ret) { - setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs'); + setEventMessages($langs->trans("FileWasRemoved", GETPOST('file')), null, 'mesgs'); } else { - setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors'); + setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), null, 'errors'); } } @@ -222,7 +225,6 @@ if ($action == 'remove_file' && $user->rights->projet->creer) { $form = new Form($db); $formother = new FormOther($db); $formfile = new FormFile($db); -$result = $projectstatic->fetch($object->fk_project); $title = $object->ref; if (!empty($withproject)) { @@ -692,7 +694,7 @@ if ($id > 0 || !empty($ref)) { /* * Generated documents */ - $filename = dol_sanitizeFileName($projectstatic->ref)."/".dol_sanitizeFileName($object->ref); + $filename = ''; $filedir = $conf->project->dir_output."/".dol_sanitizeFileName($projectstatic->ref)."/".dol_sanitizeFileName($object->ref); $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; $genallowed = ($user->rights->projet->lire); From 837b2ff06079da158c049a72d583e0879e858a02 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 27 Jan 2025 13:59:12 +0100 Subject: [PATCH 06/23] FIX wrong left margin (v18 to develop ?) --- htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php index 555079ad3bc..a56088b5a40 100644 --- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php +++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php @@ -317,7 +317,7 @@ class pdf_soleil extends ModelePDFFicheinter $desc = dol_htmlentitiesbr($text, 1); //print $outputlangs->convToOutputCharset($desc); exit; - $pdf->writeHTMLCell(180, 3, 10, $tab_top + 5, $outputlangs->convToOutputCharset($desc), 0, 1); + $pdf->writeHTMLCell(180, 3, $this->posxdesc - 1, $tab_top + 5, $outputlangs->convToOutputCharset($desc), 0, 1); $nexY = $pdf->GetY(); $pdf->line($this->marge_gauche, $nexY, $this->page_largeur - $this->marge_droite, $nexY); From 83bc7b70a04546876a93ef519b988421d3a54c71 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Tue, 28 Jan 2025 13:34:49 +0100 Subject: [PATCH 07/23] Backport from v20 missing executeHooks printFieldListFrom in product list page --- htdocs/product/list.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index e99857ee454..9e5c8772293 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -484,6 +484,11 @@ if (!empty($conf->global->PRODUCT_USE_UNITS)) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_units cu ON cu.rowid = p.fk_unit"; } +// Add table from hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by hook +$sql .= $hookmanager->resPrint; + $sql .= ' WHERE p.entity IN ('.getEntity('product').')'; if ($sall) { // Clean $fieldstosearchall From 17d1c279abfcb64b1fda7b88615d6c27f359a2c1 Mon Sep 17 00:00:00 2001 From: tnegre Date: Tue, 28 Jan 2025 14:44:10 +0100 Subject: [PATCH 08/23] action/list.php : replace comma-joins by INNER JOIN --- htdocs/comm/action/list.php | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index d3d1ecfb833..cbe3f8b94ee 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -442,20 +442,19 @@ if (empty($user->rights->societe->client->voir) && !$socid) { } $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid"; -$sql .= " ,".MAIN_DB_PREFIX."c_actioncomm as c"; +$sql .= " INNER JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON c.id = a.fk_action"; // We must filter on resource table if ($resourceid > 0) { - $sql .= ", ".MAIN_DB_PREFIX."element_resources as r"; + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."element_resources as r ON r.element_type = 'action' AND r.element_id = a.id"; } // We must filter on assignement table if ($filtert > 0 || $usergroup > 0) { - $sql .= ", ".MAIN_DB_PREFIX."actioncomm_resources as ar"; + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."actioncomm_resources as ar ON ar.fk_actioncomm = a.id AND ar.element_type='user'"; } if ($usergroup > 0) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element"; } -$sql .= " WHERE c.id = a.fk_action"; -$sql .= ' AND a.entity IN ('.getEntity('agenda').')'; +$sql .= " WHERE a.entity IN (".getEntity('agenda').")"; // Condition on actioncode if (!empty($actioncode)) { if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) { @@ -486,7 +485,7 @@ if (!empty($actioncode)) { } } if ($resourceid > 0) { - $sql .= " AND r.element_type = 'action' AND r.element_id = a.id AND r.resource_id = ".((int) $resourceid); + $sql .= " AND r.resource_id = ".((int) $resourceid); } if ($pid) { $sql .= " AND a.fk_project=".((int) $pid); @@ -497,10 +496,6 @@ if (empty($user->rights->societe->client->voir) && !$socid) { if ($socid > 0) { $sql .= " AND s.rowid = ".((int) $socid); } -// We must filter on assignement table -if ($filtert > 0 || $usergroup > 0) { - $sql .= " AND ar.fk_actioncomm = a.id AND ar.element_type='user'"; -} if ($type) { $sql .= " AND c.id = ".((int) $type); } From bdcd7b5ef399ab26c6774119d28ce7ba572e7012 Mon Sep 17 00:00:00 2001 From: Irvine Fleith Date: Tue, 28 Jan 2025 14:47:10 +0100 Subject: [PATCH 09/23] fix(services-list): added missing hook printFieldListWhere --- htdocs/contrat/services_list.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/contrat/services_list.php b/htdocs/contrat/services_list.php index 7b75c4aa9d3..0b3666a295e 100644 --- a/htdocs/contrat/services_list.php +++ b/htdocs/contrat/services_list.php @@ -348,6 +348,11 @@ if (!empty($filter_opcloture) && $filter_opcloture == ' BETWEEN ') { } // Add where from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; +// Add where from hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook +$sql .= $hookmanager->resPrint; + $sql .= $db->order($sortfield, $sortorder); //print $sql; From 510da33c338f3f6be53cb9ec90626bcb404aeab7 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 29 Jan 2025 08:35:55 +0100 Subject: [PATCH 10/23] FIX #32840 --- htdocs/categories/class/categorie.class.php | 35 ++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 330baf65469..b3721d1bee7 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -285,6 +285,38 @@ class Categorie extends CommonObject */ public $imgHeight; + /** + * 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password') + * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" + * 'label' the translation key. + * 'enabled' is a condition when the field must be managed (Example: 1 or 'getDolGlobalString("MY_SETUP_PARAM")' + * 'position' is the sort order of field. + * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). + * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing) + * 'noteditable' says if field is not editable (1 or 0) + * 'default' is a default value for creation (can still be overwrote by the Setup of Default Values if field is editable in creation form). Note: If default is set to '(PROV)' and field is 'ref', the default value will be set to '(PROVid)' where id is rowid when a new record is created. + * 'index' if we want an index in database. + * 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommended to name the field fk_...). + * 'searchall' is 1 if we want to search in this field when making a search from the quick search button. + * 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8). + * 'css' is the CSS style to use on field. For example: 'maxwidth200' + * 'help' is a string visible as a tooltip on field + * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record + * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code. + * 'arrayofkeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") + * 'autofocusoncreate' to have field having the focus on a create form. Only 1 field should have this property set to 1. + * 'comment' is not used. You can store here any text of your choice. It is not used by application. + * + * Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor. + */ + + /** + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + */ + public $fields = array( + 'label' => array('type' => 'varchar(255)', 'label' => 'Label', 'enabled' => 1, 'visible' => 1, 'showoncombobox' => 1), + ); + /** * Constructor * @@ -1751,7 +1783,8 @@ class Categorie extends CommonObject } // Check contrast with background and correct text color - $forced_color = 'categtextwhite'; + //$forced_color = 'categtextwhite'; // TODO This css class hide the link + $forced_color = 'categtextblack'; if ($this->color) { if (colorIsLight($this->color)) { $forced_color = 'categtextblack'; From e7088d779415b158720aa3081ca01a44f30ec31c Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 29 Jan 2025 09:14:37 +0100 Subject: [PATCH 11/23] FIX add other fields --- htdocs/categories/class/categorie.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index b3721d1bee7..305649da4e4 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -314,7 +314,9 @@ class Categorie extends CommonObject * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( - 'label' => array('type' => 'varchar(255)', 'label' => 'Label', 'enabled' => 1, 'visible' => 1, 'showoncombobox' => 1), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'index' => 1, 'position' => 1, 'comment' => 'Id'), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'enabled' => 1, 'visible' => 0, 'default' => '1', 'notnull' => 1, 'index' => 1, 'position' => 5), + 'label' => array('type' => 'varchar(255)', 'label' => 'Label', 'enabled' => 1, 'visible' => 1, 'showoncombobox' => 1, 'position' => 15, 'csslist' => 'tdoverflowmax250'), ); /** From f3dc94d3345867b732fcb17a712b043f931a0c44 Mon Sep 17 00:00:00 2001 From: Irvine Fleith Date: Wed, 29 Jan 2025 10:14:46 +0100 Subject: [PATCH 12/23] fix(services-list): added missing hook printFieldListSearchParam --- htdocs/contrat/services_list.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/contrat/services_list.php b/htdocs/contrat/services_list.php index 0b3666a295e..70dc312c2be 100644 --- a/htdocs/contrat/services_list.php +++ b/htdocs/contrat/services_list.php @@ -442,6 +442,10 @@ if ($optioncss != '') { } // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; +// Add $param from hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook +$param .= $hookmanager->resPrint; // List of mass actions available $arrayofmassactions = array( From 4fc66c6ee16062b44747ce3442e8be307af53570 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 29 Jan 2025 19:44:50 +0100 Subject: [PATCH 13/23] FIX missing quick edit for extrafields --- htdocs/core/tpl/extrafields_view.tpl.php | 3 +++ htdocs/projet/card.php | 24 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php index 10481b4ad10..26c11f099a6 100644 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -159,6 +159,9 @@ if (empty($reshook) && !empty($object->table_element) && isset($extrafields->att if ($object->element == 'product') { $keyforperm = 'produit'; } + if ($object->element == 'project') { + $keyforperm = 'projet'; + } if (isset($user->rights->$keyforperm)) { $permok = $user->hasRight($keyforperm, 'creer') || $user->hasRight($keyforperm, 'create') || $user->hasRight($keyforperm, 'write'); } diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 1b17aff16af..fd6fa35d136 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -553,6 +553,30 @@ if (empty($reshook)) { } } + // Quick edit for extrafields + if ($action == 'update_extras' && $permissiontoadd) { + $object->oldcopy = dol_clone($object, 2); + + // Fill array 'array_options' with data from update form + $ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml')); + if ($ret < 0) { + $error++; + } + + if (!$error) { + // Actions on extra fields + $result = $object->insertExtraFields('PROJECT_MODIFY'); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + $error++; + } + } + + if ($error) { + $action = 'edit_extras'; + } + } + // Actions to send emails $triggersendname = 'PROJECT_SENTBYMAIL'; $paramname = 'id'; From 65ebb94181d55c268040d50a0292617ee783e21d Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 30 Jan 2025 01:12:50 +0100 Subject: [PATCH 14/23] FIX wrong var name --- htdocs/societe/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index b00bb69b3fb..bc59136f69e 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1578,7 +1578,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio // Vat is used print ''.$form->editfieldkey('VATIsUsed', 'assujtva_value', '', $object, 0).''; print ''; - print ''; // Assujeti par default en creation + print ''; // Assujeti par default en creation print ''; if ($conf->browser->layout == 'phone') { print ''; From 7848d77830373d1881d5f5851f375eb0e6910c49 Mon Sep 17 00:00:00 2001 From: Irvine Fleith Date: Thu, 30 Jan 2025 09:58:29 +0100 Subject: [PATCH 15/23] fix(contrat,facture-rec): undefined properties --- htdocs/compta/facture/class/facture-rec.class.php | 7 +++++++ htdocs/contrat/class/contrat.class.php | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 228badc04dc..a45feec9cdc 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -125,6 +125,13 @@ class FactureRec extends CommonInvoice public $cond_reglement_code; // Code in llx_c_paiement public $mode_reglement_code; // Code in llx_c_paiement + public $fk_multicurrency; + public $multicurrency_code; + public $multicurrency_tx; + public $multicurrency_total_ht; + public $multicurrency_total_tva; + public $multicurrency_total_ttc; + public $suspended; // status public $auto_validate; // 0 to create in draft, 1 to create and validate the new invoice diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index a29df83b834..d78c636b0f1 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -3097,7 +3097,7 @@ class ContratLigne extends CommonObjectLine $sql .= " t.label,"; // This field is not used. Only label of product $sql .= " p.ref as product_ref,"; $sql .= " p.label as product_label,"; - $sql .= " p.description as product_desc,"; + $sql .= " p.description as product_description,"; $sql .= " p.fk_product_type as product_type,"; $sql .= " t.description,"; $sql .= " t.date_commande,"; From 7fa1baf1ddbf35d4710f175d1a5ad387672abcc0 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Thu, 30 Jan 2025 13:34:26 +0100 Subject: [PATCH 16/23] Fix regression --- htdocs/categories/class/categorie.class.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 305649da4e4..5dd92761cdb 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -1785,10 +1785,9 @@ class Categorie extends CommonObject } // Check contrast with background and correct text color - //$forced_color = 'categtextwhite'; // TODO This css class hide the link - $forced_color = 'categtextblack'; + $forced_color = 'categtextwhite'; // We want color white because the background is dark (grey or other) if ($this->color) { - if (colorIsLight($this->color)) { + if (colorIsLight($this->color)) { // If color is light, we force color to dark $forced_color = 'categtextblack'; } } From 301c189c498c09272bcffe21d7bd1795fd76798c Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Thu, 30 Jan 2025 23:06:03 +0100 Subject: [PATCH 17/23] Restore full list. Close #32092 --- htdocs/hrm/class/position.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/hrm/class/position.class.php b/htdocs/hrm/class/position.class.php index 7d257e5d41c..2002f565869 100644 --- a/htdocs/hrm/class/position.class.php +++ b/htdocs/hrm/class/position.class.php @@ -97,7 +97,7 @@ class Position extends CommonObject 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'position' => 500, 'notnull' => 1, 'visible' => -2,), 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'position' => 501, 'notnull' => 0, 'visible' => -2,), 'fk_contrat' => array('type' => 'integer:Contrat:contrat/class/contrat.class.php', 'label' => 'fk_contrat', 'enabled' => 'isModEnabled("contract")', 'position' => 50, 'notnull' => 0, 'visible' => 0,), - 'fk_user' => array('type' => 'integer:User:user/class/user.class.php:0:(t.statut:=:1)', 'label' => 'Employee', 'enabled' => 1, 'position' => 55, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'picto' => 'user', 'css' => 'maxwidth300 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax150'), + 'fk_user' => array('type' => 'integer:User:user/class/user.class.php:0', 'label' => 'Employee', 'enabled' => 1, 'position' => 55, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'picto' => 'user', 'css' => 'maxwidth300 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax150'), 'fk_job' => array('type' => 'integer:Job:/hrm/class/job.class.php', 'label' => 'JobProfile', 'enabled' => 1, 'position' => 56, 'notnull' => 1, 'visible' => 1, 'picto' => 'jobprofile', 'css' => 'maxwidth300 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax150'), 'date_start' => array('type' => 'date', 'label' => 'DateStart', 'enabled' => 1, 'position' => 101, 'notnull' => 1, 'visible' => 1,), 'date_end' => array('type' => 'date', 'label' => 'DateEnd', 'enabled' => 1, 'position' => 102, 'notnull' => 0, 'visible' => 1,), From b4e9367e3d1e73472751556d3dc9ac482b9d4a61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnter=20Lukas?= Date: Fri, 31 Jan 2025 14:28:34 +0100 Subject: [PATCH 18/23] Fix #32890 --- htdocs/emailcollector/class/emailcollector.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index c6e97db9d6b..4d9b5a5574d 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -3360,7 +3360,7 @@ class EmailCollector extends CommonObject foreach ($attachments as $attachment) { // $attachment->save($destdir.'/'); $typeattachment = (string) $attachment->getDisposition(); - $filename = $attachment->getFilename(); + $filename = $attachment->getName(); $content = $attachment->getContent(); $this->saveAttachment($destdir, $filename, $content); } From 46125921b1efe625686002d386f8a2767e359c31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnter=20Lukas?= Date: Fri, 31 Jan 2025 14:41:19 +0100 Subject: [PATCH 19/23] Fix #32892 --- htdocs/emailcollector/class/emailcollector.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index c6e97db9d6b..755222224ac 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -2872,7 +2872,7 @@ class EmailCollector extends CommonObject $this->errors = $actioncomm->errors; } else { if ($fk_element_type == "ticket" && is_object($objectemail)) { - if ($objectemail->status == Ticket::STATUS_CLOSED || $objectemail->status == Ticket::STATUS_CANCELED) { + if ($objectemail->status == Ticket::STATUS_CLOSED || $objectemail->status == Ticket::STATUS_CANCELED || $objectemail->status == Ticket::STATUS_NEED_MORE_INFO || $objectemail->status == Ticket::STATUS_WAITING) { if ($objectemail->fk_user_assign != null) { $res = $objectemail->setStatut(Ticket::STATUS_ASSIGNED); } else { From ae81f8bf5009ecc81d1be7e666061b5facc64ec1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnter=20Lukas?= Date: Fri, 31 Jan 2025 14:55:04 +0100 Subject: [PATCH 20/23] Fix #32894 --- htdocs/emailcollector/class/emailcollector.class.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index c6e97db9d6b..95aea5f8e36 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -3345,6 +3345,13 @@ class EmailCollector extends CommonObject $tickettocreate->context['actionmsg'] = $langs->trans("ActionAC_EMAIL_IN").' - '.$langs->trans("TICKET_CREATEInDolibarr"); //$tickettocreate->email_fields_no_propagate_in_actioncomm = 0; + // Add sender to context array to make sure that confirmation e-mail can be sent by trigger script + $sender_contact = New Contact($this->db); + $sender_contact->fetch(0, null, '', $from); + if (!empty($sender_contact->id)) { + $tickettocreate->context['contactid'] = $sender_contact->id; + } + $result = $tickettocreate->create($user); if ($result <= 0) { $errorforactions++; From adbaaac256ef225472b05250466731d2d54eb27a Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Fri, 31 Jan 2025 17:19:20 +0100 Subject: [PATCH 21/23] add test on null for situation_percent --- htdocs/compta/facture/class/facture.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 67926aa4bdb..d10bf9fd0b3 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -3870,7 +3870,7 @@ class Facture extends CommonInvoice if (empty($fk_prev_id)) { $fk_prev_id = 'null'; } - if (!isset($situation_percent) || $situation_percent > 100 || (string) $situation_percent == '') { + if (!isset($situation_percent) || $situation_percent > 100 || (string) $situation_percent == '' || $situation_percent == null) { $situation_percent = 100; } if (empty($ref_ext)) { @@ -4131,7 +4131,7 @@ class Facture extends CommonInvoice if (empty($special_code) || $special_code == 3) { $special_code = 0; } - if (!isset($situation_percent) || $situation_percent > 100 || (string) $situation_percent == '') { + if (!isset($situation_percent) || $situation_percent > 100 || (string) $situation_percent == '' || $situation_percent == null) { $situation_percent = 100; } if (empty($ref_ext)) { From c39f295d76c5d1735f3b497ae95a4ac3c9092485 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sat, 1 Feb 2025 06:07:12 +0100 Subject: [PATCH 22/23] FIX #32801 VAT type is inverted in form VAT selector --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index ad27dc50266..a72d7dbd176 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -6774,7 +6774,7 @@ class Form // Keep only the VAT qualified for $type_vat $arrayofvatrates = array(); foreach ($this->cache_vatrates as $cachevalue) { - if (empty($cachevalue['type_vat']) || $cachevalue['type_vat'] != $type_vat) { + if (empty($cachevalue['type_vat']) || $cachevalue['type_vat'] == $type_vat) { $arrayofvatrates[] = $cachevalue; } } From 76ab4d7ce5a554a021f77c47cc855e6d9977e920 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 2 Feb 2025 01:21:57 +0100 Subject: [PATCH 23/23] Update emailcollector.class.php --- htdocs/emailcollector/class/emailcollector.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 95aea5f8e36..082b4ac6f67 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -3346,7 +3346,7 @@ class EmailCollector extends CommonObject //$tickettocreate->email_fields_no_propagate_in_actioncomm = 0; // Add sender to context array to make sure that confirmation e-mail can be sent by trigger script - $sender_contact = New Contact($this->db); + $sender_contact = new Contact($this->db); $sender_contact->fetch(0, null, '', $from); if (!empty($sender_contact->id)) { $tickettocreate->context['contactid'] = $sender_contact->id;