From 72305a92188d5dd09598d0981a594ffa0ffe7490 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 5 Feb 2024 13:35:20 +0100 Subject: [PATCH 01/14] Qual: pre-commit: run phpcs on all files in 'main' branches. (#28018) This change to the workflow will run phpcs on all files in develop, 17.0, 18.0, ... (rule== branch ends in .0). This ensures that phpcs is run in a github workflow for fast phpcs issue detection in the develop and other main branches. Ultimately, this means that the PHPCS action can be disabled in branches where it is active. But I propose to verify that the updated action does the job as expected (tested in a fork it is ok). --- .github/workflows/pre-commit.yml | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 5853729bdd0..e37cecf0a43 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -65,7 +65,17 @@ jobs: - name: Setup PHPCS uses: shivammathur/setup-php@v2 - if: steps.changed-php.outputs.any_changed == 'true' + # Install when we're going to run phpcs + if: | + steps.changed-php.outputs.any_changed == 'true' + || + ( + github.event_name == 'push' + && ( + github.event.ref == 'refs/heads/develop' + || endsWith(github.event.ref, '.0') + ) + ) with: php-version: 8.1 coverage: none # disable xdebug, pcov @@ -79,6 +89,17 @@ jobs: set -o pipefail pre-commit run php-cs --files ${ALL_CHANGED_FILES} | tee -a ${RAW_LOG} + - name: Run some pre-commit hooks on all files on push to "main" branches + if: | + github.event_name == 'push' + && ( + github.event.ref == 'refs/heads/develop' + || endsWith(github.event.ref, '.0') + ) + run: | + set -o pipefail + pre-commit run -a php-cs | tee -a ${RAW_LOG} + # If error, we convert log in the checkstyle format - name: Convert Raw Log to CheckStyle format if: ${{ failure() }} From 015546b07cfc6936e1b1c6e67877fab1d4f1640d Mon Sep 17 00:00:00 2001 From: noec764 <58433943+noec764@users.noreply.github.com> Date: Wed, 7 Feb 2024 16:20:34 +0100 Subject: [PATCH 02/14] FIX: line special_code never saved (#28051) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: NoƩ --- htdocs/fourn/class/fournisseur.commande.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 800ef87b319..ecd8bb390f2 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1968,7 +1968,7 @@ class CommandeFournisseur extends CommonOrder $this->line->total_localtax2 = $total_localtax2; $this->line->total_ttc = $total_ttc; $this->line->product_type = $type; - $this->line->special_code = (!empty($this->special_code) ? $this->special_code : 0); + $this->line->special_code = (!empty($special_code) ? $special_code : 0); $this->line->origin = $origin; $this->line->origin_id = $origin_id; $this->line->fk_unit = $fk_unit; From cdad15bae374bb1cdb379e4adb5c13b6d337bd31 Mon Sep 17 00:00:00 2001 From: lvessiller-opendsi Date: Wed, 7 Feb 2024 16:28:12 +0100 Subject: [PATCH 03/14] FIX user filter in per user view of event list (#28049) --- htdocs/comm/action/peruser.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index aaf9ae7d8ca..3e5a17c3c9a 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -921,6 +921,9 @@ while ($currentdaytoshow < $lastdaytoshow) { $sql .= " WHERE u.entity IN (".getEntity('user').")"; } $sql .= " AND u.statut = 1"; + if ($filtert > 0) { + $sql .= " AND u.rowid = ".((int) $filtert); + } if ($usergroup > 0) { $sql .= " AND ug.fk_usergroup = ".((int) $usergroup); } From 48fff89e9eba65d94141113562bfd1a305833f64 Mon Sep 17 00:00:00 2001 From: William Mead Date: Wed, 7 Feb 2024 16:28:35 +0100 Subject: [PATCH 04/14] Fixed undefined action linkback variable (#28043) --- htdocs/comm/action/document.php | 2 +- htdocs/comm/action/info.php | 2 +- htdocs/resource/element_resource.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php index 1f46ee6df1b..16560b838ba 100644 --- a/htdocs/comm/action/document.php +++ b/htdocs/comm/action/document.php @@ -149,7 +149,7 @@ if ($object->id > 0) { print dol_get_fiche_head($head, 'documents', $langs->trans("Action"), -1, 'action'); // Link to other agenda views - $linkback .= ''; + $linkback = ''; $linkback .= img_picto($langs->trans("BackToList"), 'object_calendarlist', 'class="pictoactionview pictofixedwidth"'); $linkback .= ''.$langs->trans("BackToList").''; $linkback .= ''; diff --git a/htdocs/comm/action/info.php b/htdocs/comm/action/info.php index 2301e3e329c..7b39a4556c9 100644 --- a/htdocs/comm/action/info.php +++ b/htdocs/comm/action/info.php @@ -73,7 +73,7 @@ $head = actions_prepare_head($object); print dol_get_fiche_head($head, 'info', $langs->trans("Action"), -1, 'action'); // Link to other agenda views -$linkback .= ''; +$linkback = ''; $linkback .= img_picto($langs->trans("BackToList"), 'object_calendarlist', 'class="pictoactionview pictofixedwidth"'); $linkback .= ''.$langs->trans("BackToList").''; $linkback .= ''; diff --git a/htdocs/resource/element_resource.php b/htdocs/resource/element_resource.php index 75cf03d1bb8..b4827ac1b78 100644 --- a/htdocs/resource/element_resource.php +++ b/htdocs/resource/element_resource.php @@ -333,7 +333,7 @@ if (!$ret) { print dol_get_fiche_head($head, 'resources', $langs->trans("Action"), -1, 'action'); - $linkback .= ''; + $linkback = ''; $linkback .= img_picto($langs->trans("BackToList"), 'object_calendarlist', 'class="pictoactionview pictofixedwidth"'); $linkback .= ''.$langs->trans("BackToList").''; $linkback .= ''; From 27002a95e40178a4dd0933f3fc0ef530e036e994 Mon Sep 17 00:00:00 2001 From: William Mead Date: Wed, 7 Feb 2024 16:29:57 +0100 Subject: [PATCH 05/14] Fixed undefined thirdparty_id property (#28044) --- htdocs/core/tpl/contacts.tpl.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/tpl/contacts.tpl.php b/htdocs/core/tpl/contacts.tpl.php index 31514673a21..42e0e277797 100644 --- a/htdocs/core/tpl/contacts.tpl.php +++ b/htdocs/core/tpl/contacts.tpl.php @@ -201,6 +201,7 @@ foreach (array('internal', 'external') as $source) { $entry->type = $contact['libelle']; $entry->nature = ""; $entry->nature_html = ""; + $entry->thirdparty_id = 0; $entry->thirdparty_html = ""; $entry->thirdparty_name = ""; $entry->contact_html = ""; From 0ad3581e00ba6545c19aafc6a020c8bb20a001fd Mon Sep 17 00:00:00 2001 From: Quentin-Seekness <72733832+Quentin-Seekness@users.noreply.github.com> Date: Wed, 7 Feb 2024 17:26:17 +0100 Subject: [PATCH 06/14] Update cunits.class.php (#28056) FIX: error SQL when creating a Cunit --- htdocs/core/class/cunits.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/cunits.class.php b/htdocs/core/class/cunits.class.php index e09a6ce88fb..66fcf730b11 100644 --- a/htdocs/core/class/cunits.class.php +++ b/htdocs/core/class/cunits.class.php @@ -103,14 +103,14 @@ class CUnits extends CommonDict $sql .= "code,"; $sql .= "label,"; $sql .= "short_label,"; - $sql .= "unit_type"; + $sql .= "unit_type,"; $sql .= "scale"; $sql .= ") VALUES ("; $sql .= " ".(!isset($this->id) ? 'NULL' : "'".$this->db->escape($this->id)."'").","; $sql .= " ".(!isset($this->code) ? 'NULL' : "'".$this->db->escape($this->code)."'").","; $sql .= " ".(!isset($this->label) ? 'NULL' : "'".$this->db->escape($this->label)."'").","; $sql .= " ".(!isset($this->short_label) ? 'NULL' : "'".$this->db->escape($this->short_label)."'").","; - $sql .= " ".(!isset($this->unit_type) ? 'NULL' : "'".$this->db->escape($this->unit_type)."'"); + $sql .= " ".(!isset($this->unit_type) ? 'NULL' : "'".$this->db->escape($this->unit_type)."'").","; $sql .= " ".(!isset($this->scale) ? 'NULL' : "'".$this->db->escape($this->scale)."'"); $sql .= ")"; From c8fb2d90436b4831e232f6ac3f7655f366e6f4d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 7 Feb 2024 19:36:48 +0100 Subject: [PATCH 07/14] fix can't set odt directory (#28028) --- htdocs/admin/stock.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index a784792ae02..34a511aeb77 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -40,6 +40,7 @@ if (!$user->admin) { $action = GETPOST('action', 'aZ09'); $value = GETPOST('value', 'alpha'); +$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php $label = GETPOST('label', 'alpha'); $scandir = GETPOST('scan_dir', 'alpha'); $type = 'stock'; @@ -48,6 +49,7 @@ $type = 'stock'; /* * Action */ +include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; $reg = array(); From 1ecc0b15c4cdf6ce05b5922786e09ef2fe8724c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 7 Feb 2024 20:20:53 +0100 Subject: [PATCH 08/14] fix display (#28029) --- htdocs/admin/stock.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index 34a511aeb77..b17753d66b8 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -198,7 +198,7 @@ if (isModEnabled('productbatch')) { // STOCK_CALCULATE_ON_RECEPTION_CLOSE $incmode = $langs->trans('StockOnReceptionOnClosing'); } - print info_admin($langs->trans("WhenProductBatchModuleOnOptionAreForced", $descmode, $incmode)); + print info_admin($langs->transnoentitiesnoconv("WhenProductBatchModuleOnOptionAreForced", $descmode, $incmode)); } From 02517b7c3f8370b91a3ff72268c6c19b202b0875 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 7 Feb 2024 20:44:36 +0100 Subject: [PATCH 09/14] Fix #28055 --- htdocs/compta/facture/list.php | 25 +++++++++++++------------ htdocs/fourn/facture/list.php | 10 +++++++++- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index f66b13dca46..078a19d9437 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -65,9 +65,9 @@ $langs->loadLangs(array('bills', 'companies', 'products', 'categories')); $sall = trim((GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); $projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0); -$id = (GETPOST('id', 'int') ? GETPOST('id', 'int') : GETPOST('facid', 'int')); // For backward compatibility +$id = (GETPOST('id', 'int') ? GETPOSTINT('id') : GETPOSTINT('facid')); // For backward compatibility $ref = GETPOST('ref', 'alpha'); -$socid = GETPOST('socid', 'int'); +$socid = GETPOSTINT('socid'); $action = GETPOST('action', 'aZ09'); $massaction = GETPOST('massaction', 'alpha'); @@ -82,7 +82,6 @@ if ($contextpage == 'poslist') { $optioncss = 'print'; } -$lineid = GETPOST('lineid', 'int'); $userid = GETPOST('userid', 'int'); $search_ref = GETPOST('sf_ref') ? GETPOST('sf_ref', 'alpha') : GETPOST('search_ref', 'alpha'); $search_refcustomer = GETPOST('search_refcustomer', 'alpha'); @@ -580,9 +579,19 @@ $facturestatic = new Facture($db); $formcompany = new FormCompany($db); $companystatic = new Societe($db); $companyparent = new Societe($db); + $company_url_list = array(); $subtypearray = $object->getArrayOfInvoiceSubtypes(0); -$title = $langs->trans('BillsCustomers').' '.($socid > 0 ? ' '.$soc->name : ''); + +if ($socid > 0) { + $soc = new Societe($db); + $soc->fetch($socid); + if (empty($search_company)) { + $search_company = $soc->name; + } +} + +$title = $langs->trans('BillsCustomers').' '.($socid > 0 ? ' - '.$soc->name : ''); $help_url = 'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes'; $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; @@ -970,14 +979,6 @@ if ($num == 1 && getDolGlobalString('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $s llxHeader('', $title, $help_url); -if ($socid > 0) { - $soc = new Societe($db); - $soc->fetch($socid); - if (empty($search_company)) { - $search_company = $soc->name; - } -} - $param = '&socid='.urlencode($socid); if (!empty($mode)) { $param .= '&mode='.urlencode($mode); diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index a65fca4d55c..b61ec85ab97 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -407,7 +407,15 @@ $thirdparty = new Societe($db); $subtypearray = $object->getArrayOfInvoiceSubtypes(0); $now = dol_now(); -$title = $langs->trans("BillsSuppliers").($socid ? ' '.$soc->name : ''); +if ($socid > 0) { + $soc = new Societe($db); + $soc->fetch($socid); + if (empty($search_company)) { + $search_company = $soc->name; + } +} + +$title = $langs->trans("BillsSuppliers").($socid ? ' - '.$soc->name : ''); $help_url = 'EN:Suppliers_Invoices|FR:FactureFournisseur|ES:Facturas_de_proveedores'; // Build and execute select From 9acceb8e8eb3b13dfc155e36e3b783fc5e68cb47 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 7 Feb 2024 23:52:03 +0100 Subject: [PATCH 10/14] Debug v19 --- htdocs/ticket/class/ticket.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index f3da2f3e84e..14fa1c659fa 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -344,7 +344,7 @@ class Ticket extends CommonObject 'email_date' => array('type'=>'datetime', 'label'=>'EmailDate', 'visible'=>-2, 'enabled'=>1, 'position'=>541), 'progress' => array('type'=>'integer', 'label'=>'Progression', 'visible'=>-1, 'enabled'=>1, 'position'=>540, 'notnull'=>-1, 'css'=>'right', 'help'=>"", 'isameasure'=>2, 'csslist'=>'width50'), 'resolution' => array('type'=>'integer', 'label'=>'Resolution', 'visible'=>-1, 'enabled'=>'getDolGlobalString("TICKET_ENABLE_RESOLUTION")', 'position'=>550, 'notnull'=>1), - 'fk_statut' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>600, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array(0 => 'Unread', 1 => 'Read', 3 => 'Answered', 4 => 'Assigned', 5 => 'InProgress', 6 => 'Waiting', 8 => 'SolvedClosed', 9 => 'Deleted')), + 'fk_statut' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>600, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array(0 => 'Unread', 1 => 'Read', 2 => 'Assigned', 3 => 'InProgress', 5 => 'NeedMoreInformation', 7 => 'OnHold', 8 => 'SolvedClosed', 9 => 'Deleted')), 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>900), ); // END MODULEBUILDER PROPERTIES From 5d6448a8a23525c77d135e4ce0b0bea786641ecf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 7 Feb 2024 23:54:30 +0100 Subject: [PATCH 11/14] css --- htdocs/ticket/class/ticket.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 14fa1c659fa..b7c75c7a2e9 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -334,7 +334,7 @@ class Ticket extends CommonObject 'fk_contract' => array('type'=>'integer:Contrat:contrat/class/contrat.class.php', 'label'=>'Contract', 'visible'=>-1, 'enabled'=>'$conf->contract->enabled', 'position'=>53, 'notnull'=>-1, 'index'=>1, 'help'=>"LinkToContract"), //'timing' => array('type'=>'varchar(20)', 'label'=>'Timing', 'visible'=>-1, 'enabled'=>1, 'position'=>42, 'notnull'=>-1, 'help'=>""), // what is this ? 'datec' => array('type'=>'datetime', 'label'=>'DateCreation', 'visible'=>1, 'enabled'=>1, 'position'=>500, 'notnull'=>1, 'csslist'=>'nowraponall'), - 'date_read' => array('type'=>'datetime', 'label'=>'TicketReadOn', 'visible'=>-1, 'enabled'=>1, 'position'=>501, 'notnull'=>1), + 'date_read' => array('type'=>'datetime', 'label'=>'TicketReadOn', 'visible'=>-1, 'enabled'=>1, 'position'=>501, 'notnull'=>1, 'csslist'=>'nowraponall'), 'date_last_msg_sent' => array('type'=>'datetime', 'label'=>'TicketLastMessageDate', 'visible'=>0, 'enabled'=>1, 'position'=>502, 'notnull'=>-1), 'fk_user_assign' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'AssignedTo', 'visible'=>1, 'enabled'=>1, 'position'=>505, 'notnull'=>1, 'csslist'=>'tdoverflowmax100 maxwidth150onsmartphone'), 'date_close' => array('type'=>'datetime', 'label'=>'TicketCloseOn', 'visible'=>-1, 'enabled'=>1, 'position'=>510, 'notnull'=>1), From 1322c20f9152a3c4690ef802d45b40c736b33c91 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 8 Feb 2024 00:04:50 +0100 Subject: [PATCH 12/14] Clean code --- htdocs/compta/facture/class/facture-rec.class.php | 4 +--- htdocs/compta/facture/class/facture.class.php | 1 + 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 9a0127134fa..66a8140e252 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -738,8 +738,6 @@ class FactureRec extends CommonInvoice $line->total_tva = $objp->total_tva; $line->total_ttc = $objp->total_ttc; - //$line->code_ventilation = $objp->fk_code_ventilation; - $line->fk_product_fournisseur_price = $objp->fk_product_fournisseur_price; $line->fk_fournprice = $objp->fk_product_fournisseur_price; // For backward compatibility @@ -2276,7 +2274,7 @@ class FactureLigneRec extends CommonInvoiceLine $this->total_ht = $objp->total_ht; $this->total_tva = $objp->total_tva; $this->total_ttc = $objp->total_ttc; - //$this->code_ventilation = $objp->fk_code_ventilation; + $this->rang = $objp->rang; $this->special_code = $objp->special_code; $this->fk_unit = $objp->fk_unit; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index fa7dbe14cde..41daf8bd39c 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2347,6 +2347,7 @@ class Facture extends CommonInvoice $line->total_localtax1 = $objp->total_localtax1; $line->total_localtax2 = $objp->total_localtax2; $line->total_ttc = $objp->total_ttc; + $line->code_ventilation = $objp->fk_code_ventilation; $line->fk_fournprice = $objp->fk_fournprice; $marginInfos = getMarginInfos($objp->subprice, $objp->remise_percent, $objp->tva_tx, $objp->localtax1_tx, $objp->localtax2_tx, $line->fk_fournprice, $objp->pa_ht); From ad141c1e1f59eb4eed72e168d2ccbce00a5f9d15 Mon Sep 17 00:00:00 2001 From: thibdrev Date: Thu, 8 Feb 2024 00:15:16 +0100 Subject: [PATCH 13/14] qual: phpstan for htdocs/core/class/cunits.class.php (#28064) htdocs/core/class/cunits.class.php 88 Property CommonDict::$active (int) does not accept string. htdocs/core/class/cunits.class.php 415 Method CUnits::getUnitFromCode() should return int but returns string. --- htdocs/core/class/cunits.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/cunits.class.php b/htdocs/core/class/cunits.class.php index 66fcf730b11..0c620cb8bd3 100644 --- a/htdocs/core/class/cunits.class.php +++ b/htdocs/core/class/cunits.class.php @@ -85,7 +85,7 @@ class CUnits extends CommonDict $this->libelle = trim($this->short_label); } if (isset($this->unit_type)) { - $this->active = trim($this->unit_type); + $this->unit_type = trim($this->unit_type); } if (isset($this->active)) { $this->active = trim($this->active); @@ -402,7 +402,7 @@ class CUnits extends CommonDict * @param string $code code of unit * @param string $mode 0= id , short_label=Use short label as value, code=use code * @param string $unit_type weight,size,surface,volume,qty,time... - * @return int Return integer <0 if KO, Id of code if OK + * @return int|string Return integer <0 if KO, Id of code if OK (or $code if $mode is different from '', 'short_label' or 'code') */ public function getUnitFromCode($code, $mode = 'code', $unit_type = '') { From 550e4e8c9abccc6be6428945ae6f99bc321d6372 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 8 Feb 2024 00:24:27 +0100 Subject: [PATCH 14/14] Fix compatibility Conflicts: htdocs/resource/class/dolresource.class.php --- htdocs/core/modules/facture/modules_facture.php | 2 +- htdocs/core/triggers/interface_20_all_Logevents.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/facture/modules_facture.php b/htdocs/core/modules/facture/modules_facture.php index c4dd83ddb7e..4b61beba6b2 100644 --- a/htdocs/core/modules/facture/modules_facture.php +++ b/htdocs/core/modules/facture/modules_facture.php @@ -196,7 +196,7 @@ abstract class ModelePDFFactures extends CommonDocGenerator * @param Translate $langs Translation object * @return int Height in mm of the bottom-page QR invoice. Can be zero if not on right page; not enabled */ - protected function getHeightForQRInvoice(int $pagenbr, Facture $object, Translate $langs): int + protected function getHeightForQRInvoice(int $pagenbr, Facture $object, Translate $langs) { if (getDolGlobalString('INVOICE_ADD_SWISS_QR_CODE') == 'bottom') { // Keep it, to reset it after QRinvoice getter diff --git a/htdocs/core/triggers/interface_20_all_Logevents.class.php b/htdocs/core/triggers/interface_20_all_Logevents.class.php index 854d2c37cff..26d36a678db 100644 --- a/htdocs/core/triggers/interface_20_all_Logevents.class.php +++ b/htdocs/core/triggers/interface_20_all_Logevents.class.php @@ -88,7 +88,7 @@ class InterfaceLogevents extends DolibarrTriggers * @return int if KO: <0, if no trigger ran: 0, if OK: >0 * @throws Exception dol_syslog can throw Exceptions */ - public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf): int + public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) { if (getDolGlobalString('MAIN_LOGEVENTS_DISABLE_ALL')) { return 0; // Log events is disabled (hidden features)