From 02bc402ae6f43621982c61d97c6d77fbe5fb6d59 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 21 Dec 2025 11:26:14 +0100 Subject: [PATCH 01/19] Debug v23 --- htdocs/categories/viewcat.php | 26 +- htdocs/core/class/html.form.class.php | 355 ++------------------------ 2 files changed, 39 insertions(+), 342 deletions(-) diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 880d202053c..94267d83dd8 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -1145,6 +1145,7 @@ if ($type == Categorie::TYPE_USER) { } else { /** @var User[] $users */ '@phan-var-force User[] $users'; + // Form to add record into a category print '
'; print ''; @@ -1215,6 +1216,7 @@ if ($type == Categorie::TYPE_USER) { if ($type == Categorie::TYPE_WAREHOUSE) { if ($user->hasRight("stock", "read")) { $permission = $user->hasRight('stock', 'creer'); + $showclassifyform = $user->hasRight('stock', 'creer'); require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; @@ -1241,6 +1243,16 @@ if ($type == Categorie::TYPE_WAREHOUSE) { // @phan-suppress-next-line PhanPluginSuspiciousParamOrder print_barre_liste($langs->trans("Warehouses"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'stock', 0, $newcardbutton, '', $limit); + if ($showclassifyform) { + print ''; + print ''; + print ''; + print '
'; + print $langs->trans("AddTicketIntoCategory").'  '; + print $form->selectForForms('Entrepot:product/stock/class/entrepot.class.php', 'elemid', '', 1, '', '', 'maxwidth500'); + print '
'; + } + print ''."\n"; print ''."\n"; @@ -1374,11 +1386,9 @@ if ($type == Categorie::TYPE_FICHINTER) { } else { /** @var Fichinter[] $fichinters */ '@phan-var-force Fichinter[] $fichinters'; + // Form to add record into a category if ($showclassifyform) { - require_once DOL_DOCUMENT_ROOT.'/core/class/html.formintervention.class.php'; - $formfichinter = new FormIntervention($db); - print '
'; print ''; print ''; @@ -1389,7 +1399,7 @@ if ($type == Categorie::TYPE_FICHINTER) { print '
'.$langs->trans("Ref").'
'; print ''; print ''; print '
'; print $langs->trans("AddFichinterIntoCategory").'  '; - print $formfichinter->select_interventions(-1, 0, 'elemid'); + print $form->selectForForms('Fichinter:fichinter/class/fichinter.class.php', 'elemid', '', 1, '', '', 'maxwidth500'); print '
'; @@ -1476,7 +1486,7 @@ if ($type == Categorie::TYPE_ORDER) { print ''; print ''; print ''; print '
'; print $langs->trans("AddOrderIntoCategory").'  '; - $form->selectOrder('', 'elemid'); + print $form->selectForForms('Commande:commande/class/commande.class.php', 'elemid', '', 1, '', '', 'maxwidth500'); print '
'; @@ -1557,7 +1567,7 @@ if ($type == Categorie::TYPE_INVOICE) { print ''; print ''; print ''; print '
'; print $langs->trans("AddInvoiceIntoCategory").'  '; - print $form->selectInvoice(-1, '', 'elemid', 24, 0, '1', 0, 0, 0, 'maxwidth500', '', ''); + print $form->selectForForms('Facture:compta/facture/class/facture.class.php', 'elemid', '', 1, '', '', 'maxwidth500'); print '
'; @@ -1639,7 +1649,7 @@ if ($type == Categorie::TYPE_SUPPLIER_ORDER) { print ''; print ''; print ''; print '
'; print $langs->trans("AddSupplierOrderIntoCategory").'  '; - $form->selectSupplierOrder('', 'elemid'); + print $form->selectForForms('CommandeFournisseur:fourn/class/fournisseur.commande.class.php', 'elemid', '', 1, '', '', 'maxwidth500'); print '
'; @@ -1720,7 +1730,7 @@ if ($type == Categorie::TYPE_SUPPLIER_INVOICE) { print ''; print ''; print ''; print '
'; print $langs->trans("AddSupplierInvoiceIntoCategory").'  '; - $form->selectSupplierInvoice('', 'elemid'); + print $form->selectForForms('FactureFournisseur:fourn/class/fournisseur.facture.class.php', 'elemid', '', 1, '', '', 'maxwidth500'); print '
'; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 7a40fe90595..8994b516642 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -8995,7 +8995,7 @@ class Form * @param string $objectdesc 'ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]'. For hard coded custom needs. Try to prefer method using $objectfield array instead of $objectdesc. * @param string $htmlname Name of HTML select component * @param int $preSelectedValue Preselected value (ID of element) - * @param string|int<0,1> $showempty ''=empty values not allowed, 'string'=value show if we allow empty values (for example 'All', ...) + * @param string|int<0,1> $showempty 0 or ''=empty values not allowed, 1=Add empty value, 'string'=value show if we allow empty values (for example 'All', ...) * @param string $searchkey Search criteria * @param string $placeholder Place holder * @param string $morecss More CSS @@ -11476,11 +11476,11 @@ class Form /** * Return HTML to show the search and clear search button * - * @param int $addcheckuncheckall Add the check all/uncheck all checkbox (use javascript) and code to manage this - * @param string $cssclass CSS class - * @param int $calljsfunction 0=default. 1=call function initCheckForSelect() after changing status of checkboxes - * @param string $massactionname Mass action name - * @return string + * @param int $addcheckuncheckall Add the check all/uncheck all checkbox (use javascript) and code to manage this + * @param string $cssclass CSS class + * @param int $calljsfunction 0=default. 1=call function initCheckForSelect() after changing status of checkboxes + * @param string $massactionname Mass action name + * @return string */ public function showFilterAndCheckAddButtons($addcheckuncheckall = 0, $cssclass = 'checkforaction', $calljsfunction = 0, $massactionname = "massaction") { @@ -11494,15 +11494,15 @@ class Form /** * Return HTML to show the select of expense categories * - * @param string $selected preselected category - * @param string $htmlname name of HTML select list - * @param int<0,1> $useempty 1=Add empty line - * @param int[] $excludeid id to exclude - * @param string $target htmlname of target select to bind event - * @param int $default_selected default category to select if fk_c_type_fees change = EX_KME - * @param array $params param to give - * @param int<0,1> $info_admin Show the tooltip help picto to setup list - * @return string + * @param string $selected preselected category + * @param string $htmlname name of HTML select list + * @param int<0,1> $useempty 1=Add empty line + * @param int[] $excludeid id to exclude + * @param string $target htmlname of target select to bind event + * @param int $default_selected default category to select if fk_c_type_fees change = EX_KME + * @param array $params param to give + * @param int<0,1> $info_admin Show the tooltip help picto to setup list + * @return string */ public function selectExpenseCategories($selected = '', $htmlname = 'fk_c_exp_tax_cat', $useempty = 0, $excludeid = array(), $target = '', $default_selected = 0, $params = array(), $info_admin = 1) { @@ -11623,12 +11623,12 @@ class Form /** * Return HTML to show a select of expense * - * @param string $selected preselected category - * @param string $htmlname name of HTML select list - * @param integer $useempty 1=Add empty choice - * @param integer $allchoice 1=Add all choice - * @param integer $useid 0=use 'code' as key, 1=use 'id' as key - * @return string + * @param string $selected preselected category + * @param string $htmlname name of HTML select list + * @param integer $useempty 1=Add empty choice + * @param integer $allchoice 1=Add all choice + * @param integer $useid 0=use 'code' as key, 1=use 'id' as key + * @return string */ public function selectExpenseFees($selected = '', $htmlname = 'fk_c_type_fees', $useempty = 0, $allchoice = 1, $useid = 0) { @@ -11913,319 +11913,6 @@ class Form } - /** - * Output a combo list with orders qualified for a third party - * TODO Bad method. This is used by viewcat.php. We must use a generic method in viewcat to use an ajax search ad remove this one that download all the database. - * - * @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') - { - global $conf; - - $out = ''; - - $hideunselectables = false; - if (getDolGlobalString('ORDER_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, array(), 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 a combo list with supplier orders qualified for a third party - * TODO Bad method. This is used by viewcat.php. We must use a generic method in viewcat to use an ajax search ad remove this one that download all the database. - * - * @param string $selected Id supplier 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 selectSupplierOrder($selected = '', $htmlname = 'supplierorderid', $maxlength = 24, $option_only = 0, $show_empty = '1', $discard_closed = 0, $forcefocus = 0, $disabled = 0, $morecss = 'maxwidth500') - { - global $conf; - - $out = ''; - - $hideunselectables = false; - if (getDolGlobalString('SUPPLIER_ORDER_HIDE_UNSELECTABLES')) { - $hideunselectables = true; - } - - // Search all supplier orders - $sql = "SELECT cf.rowid, cf.ref"; - $sql .= ' FROM '.$this->db->prefix().'commande_fournisseur as cf'; - $sql .= " ORDER BY cf.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, array(), 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 a combo list with supplier invoices qualified for a third party - * TODO Bad method. This is used by viewcat.php. We must use a generic method in viewcat to use an ajax search ad remove this one that download all the database. - * - * @param string $selected Id supplier 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 selectSupplierInvoice($selected = '', $htmlname = 'supplierinvoiceid', $maxlength = 24, $option_only = 0, $show_empty = '1', $discard_closed = 0, $forcefocus = 0, $disabled = 0, $morecss = 'maxwidth500') - { - global $conf; - - $out = ''; - - $hideunselectables = false; - if (getDolGlobalString('SUPPLIER_INVOICE_HIDE_UNSELECTABLES')) { - $hideunselectables = true; - } - - // Search all supplier orders - $sql = "SELECT ff.rowid, ff.ref"; - $sql .= ' FROM '.$this->db->prefix().'facture_fourn as ff'; - $sql .= " ORDER BY ff.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, array(), 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 criteria * From 26962aeefb50b0d20aeed55a9ac552f7a8f6391e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 21 Dec 2025 11:43:44 +0100 Subject: [PATCH 02/19] Debug v23 --- .../bookcal/admin/availabilities_extrafields.php | 15 +++++---------- htdocs/bookcal/admin/calendar_extrafields.php | 15 ++------------- htdocs/bookcal/admin/setup.php | 15 ++++++++------- 3 files changed, 15 insertions(+), 30 deletions(-) diff --git a/htdocs/bookcal/admin/availabilities_extrafields.php b/htdocs/bookcal/admin/availabilities_extrafields.php index 93098c3c6ae..1694ad378c8 100644 --- a/htdocs/bookcal/admin/availabilities_extrafields.php +++ b/htdocs/bookcal/admin/availabilities_extrafields.php @@ -29,10 +29,6 @@ // Load Dolibarr environment require '../../main.inc.php'; - -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; -require_once '../lib/bookcal.lib.php'; - /** * @var Conf $conf * @var DoliDB $db @@ -40,6 +36,8 @@ require_once '../lib/bookcal.lib.php'; * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; +require_once '../lib/bookcal.lib.php'; // Load translation files required by the page $langs->loadLangs(array('agenda', 'admin')); @@ -66,17 +64,15 @@ if (!$user->admin) { require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; - /* * View */ -$textobject = $langs->transnoentitiesnoconv("Availabilities"); - $help_url = ''; $page_name = "BookCalSetup"; +$title = $langs->trans($page_name); -llxHeader('', $langs->trans("BookCalSetup"), $help_url, '', 0, 0, '', '', '', 'mod-bookcal page-admin_availabilities_extrafields'); +llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-bookcal page-admin_availabilities_extrafields'); $linkback = ''.img_picto($langs->trans("BackToModuleList"), 'back', 'class="pictofixedwidth"').''.$langs->trans("BackToModuleList").''; @@ -85,14 +81,13 @@ print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup'); $head = bookcalAdminPrepareHead(); -print dol_get_fiche_head($head, 'availabilities_extrafields', $langs->trans($page_name), -1, 'fa-calendar-check'); +print dol_get_fiche_head($head, 'availabilities_extrafields', $title, -1, 'fa-calendar-check'); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; print dol_get_fiche_end(); - /* * Creation of an optional field */ diff --git a/htdocs/bookcal/admin/calendar_extrafields.php b/htdocs/bookcal/admin/calendar_extrafields.php index e9a13f4c31b..a4d1f557ffc 100644 --- a/htdocs/bookcal/admin/calendar_extrafields.php +++ b/htdocs/bookcal/admin/calendar_extrafields.php @@ -72,12 +72,11 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; * View */ -$textobject = $langs->transnoentitiesnoconv("Calendar"); - $help_url = ''; $page_name = "BookCalSetup"; +$title = $langs->trans($page_name); -llxHeader('', $langs->trans("BookCalSetup"), $help_url, '', 0, 0, '', '', '', 'mod-bookcal page-admin_calender_extrafields'); +llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-bookcal page-admin_calender_extrafields'); $linkback = ''.img_picto($langs->trans("BackToModuleList"), 'back', 'class="pictofixedwidth"').''.$langs->trans("BackToModuleList").''; @@ -93,16 +92,6 @@ require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; print dol_get_fiche_end(); -// Buttons -if ((float) DOL_VERSION < 17) { // On v17+, the "New Attribute" button is included into tpl. @phpstan-ignore-line - if ($action != 'create' && $action != 'edit') { - print '
'; - print ''.$langs->trans("NewAttribute").''; - print "
"; - } -} - - /* * Creation of an optional field */ diff --git a/htdocs/bookcal/admin/setup.php b/htdocs/bookcal/admin/setup.php index 1a4d4100d36..2b89f1a7ec2 100644 --- a/htdocs/bookcal/admin/setup.php +++ b/htdocs/bookcal/admin/setup.php @@ -26,11 +26,6 @@ // Load Dolibarr environment require '../../main.inc.php'; - -// Libraries -require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"; -require_once '../lib/bookcal.lib.php'; - /** * @var Conf $conf * @var DoliDB $db @@ -38,6 +33,11 @@ require_once '../lib/bookcal.lib.php'; * @var Translate $langs * @var User $user */ +// Libraries +require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"; +require_once '../lib/bookcal.lib.php'; + + // Translations $langs->loadLangs(array("admin", "agenda")); @@ -168,8 +168,9 @@ $form = new Form($db); $help_url = ''; $page_name = "BookCalSetup"; +$title = $langs->trans($page_name); -llxHeader('', $langs->trans($page_name), $help_url, '', 0, 0, '', '', '', 'mod-bookcal page-admin_setup'); +llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-bookcal page-admin_setup'); // Subheader $linkback = ''.img_picto($langs->trans("BackToModuleList"), 'back', 'class="pictofixedwidth"').''.$langs->trans("BackToModuleList").''; @@ -178,7 +179,7 @@ print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup'); // Configuration header $head = bookcalAdminPrepareHead(); -print dol_get_fiche_head($head, 'settings', $langs->trans($page_name), -1, "fa-calendar-check"); +print dol_get_fiche_head($head, 'settings', $title, -1, "fa-calendar-check"); print '
'; From 78ad7b3857e0adcf58c61258a92695758d046a1c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 21 Dec 2025 12:17:00 +0100 Subject: [PATCH 03/19] Fix hard coded value --- htdocs/core/lib/website2.lib.php | 2 +- htdocs/website/class/websitepage.class.php | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php index df8539a0f03..410710b3c98 100644 --- a/htdocs/core/lib/website2.lib.php +++ b/htdocs/core/lib/website2.lib.php @@ -213,7 +213,7 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage, $tplcontent .= ''.dol_string_nohtmltag($objectpage->title, 1, 'UTF-8').''."\n"; $tplcontent .= ''."\n"; $tplcontent .= ''."\n"; - $tplcontent .= ''."\n"; + $tplcontent .= ''."\n"; $tplcontent .= ''."\n"; $tplcontent .= ''."\n"; $tplcontent .= ''."\n"; diff --git a/htdocs/website/class/websitepage.class.php b/htdocs/website/class/websitepage.class.php index 64bb70c9a69..77a7e77e1bf 100644 --- a/htdocs/website/class/websitepage.class.php +++ b/htdocs/website/class/websitepage.class.php @@ -117,6 +117,16 @@ class WebsitePage extends CommonObject */ public $allowed_in_frames; + /** + * @var int Use meta robot tag "index" (else "noindex") + */ + public $index = 1; + + /** + * @var string Use meta robot tag "follow" (else "nofollow") + */ + public $follow = 1; + /** * @var string Disable WAF ('all', 'NOSCANAUDIOFORINJECTION,NOSCANIFRAMEFORINJECTION,NOSCANOBJECTFORINJECTION') */ From c2930e768e69d373e71fe9202b7e5cc04b93f31e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 21 Dec 2025 12:54:03 +0100 Subject: [PATCH 04/19] Debug v23 --- htdocs/compta/facture/list.php | 5 ++ htdocs/core/class/commonobject.class.php | 2 +- htdocs/takepos/invoice.php | 59 ++++++++++++++---------- 3 files changed, 41 insertions(+), 25 deletions(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 00bd396e9ac..b33b69c1913 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -198,6 +198,11 @@ if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('b // If $page is not defined, or '' or -1 or if we click on clear filters $page = 0; } + +if ($contextpage == 'poslist' && !GETPOSTISSET('limit')) { + $limit = 5; +} + $offset = $limit * $page; if (!$sortorder && getDolGlobalString('INVOICE_DEFAULT_UNPAYED_SORT_ORDER') && $search_status == '1') { $sortorder = getDolGlobalString('INVOICE_DEFAULT_UNPAYED_SORT_ORDER'); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 2cb5c18b19b..f9dc571e112 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -230,7 +230,7 @@ abstract class CommonObject private $linkedObjectsFullLoaded = array(); /** - * @var ?static To store a cloned copy of the object before editing it (to keep track of its former properties) + * @var ?static To store a cloned copy of the object before editing it (to keep track of its former properties) by doing $object->oldcopy = dol_clone($object, 2); */ public $oldcopy; diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 7b1aa1c8435..5afcdfc5fd7 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -244,6 +244,8 @@ if (empty($reshook)) { $invoice = new Facture($db); $invoice->fetch($placeid); + $invoice->oldcopy = dol_clone($invoice, 2); + $db->begin(); if ($invoice->total_ttc < 0) { @@ -364,6 +366,7 @@ if (empty($reshook)) { if ($result > 0) { $invoice->paye = 1; $invoice->status = $invoice::STATUS_CLOSED; + $invoice->close_code = ''; } // set payment method $invoice->setPaymentMethods($paiementid); @@ -374,6 +377,7 @@ if (empty($reshook)) { dol_htmloutput_errors($invoice->error, $invoice->errors, 1); } + $warehouseid = 0; // Update stock for batch products if (!$error && $res >= 0) { @@ -422,6 +426,11 @@ if (empty($reshook)) { if (!$error && $res >= 0) { $db->commit(); } else { + $invoice->ref = $invoice->oldcopy->ref; + $invoice->paye = $invoice->oldcopy->paye; + $invoice->status = $invoice->oldcopy->status; + $invoice->statut = $invoice->oldcopy->statut; + $db->rollback(); } } @@ -1321,34 +1330,36 @@ if (empty($reshook)) { $customprinttemplateallowed = false; // Custom printer may be allowed if mandatory information in template are guaranteed. For the moment, we prefer not allow this. } - if (getDolGlobalInt('TAKEPOS_PRINT_INVOICE_DOC_INSTEAD_OF_RECEIPT')) { - $sectionwithinvoicelink .= ' '.$langs->trans("Invoice").''; - } elseif (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector") { - // Used when the external addon takeposconnector is installed. Deprecated. - if (getDolGlobalString('TAKEPOS_PRINT_SERVER') && filter_var(getDolGlobalString('TAKEPOS_PRINT_SERVER'), FILTER_VALIDATE_URL) == true) { - $sectionwithinvoicelink .= ' '; + if ($invoice->status == $invoice::STATUS_CLOSED) { + if (getDolGlobalInt('TAKEPOS_PRINT_INVOICE_DOC_INSTEAD_OF_RECEIPT')) { + $sectionwithinvoicelink .= ' '.$langs->trans("Invoice").''; + } elseif (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector") { + // Used when the external addon takeposconnector is installed. Deprecated. + if (getDolGlobalString('TAKEPOS_PRINT_SERVER') && filter_var(getDolGlobalString('TAKEPOS_PRINT_SERVER'), FILTER_VALIDATE_URL) == true) { + $sectionwithinvoicelink .= ' '; + } else { + $sectionwithinvoicelink .= ' '; + } + } elseif ($customprinterallowed && (isModEnabled('receiptprinter') && getDolGlobalInt('TAKEPOS_PRINTER_TO_USE'.$term) > 0) || getDolGlobalString('TAKEPOS_PRINT_METHOD') == "receiptprinter") { // @phpstan-ignore-line + // If we set to use a specific receipt printer + $nameOfPrinter = dol_getIdFromCode($db, getDolGlobalInt('TAKEPOS_PRINTER_TO_USE'.$term), 'printer_receipt', 'rowid', 'name', 1); + $sectionwithinvoicelink .= ' '; } else { - $sectionwithinvoicelink .= ' '; + $sectionwithinvoicelink .= ' '; + if (getDolGlobalString('TAKEPOS_PRINT_WITHOUT_DETAILS')) { + $sectionwithinvoicelink .= ' '; + } + if (getDolGlobalString('TAKEPOS_GIFT_RECEIPT')) { + $sectionwithinvoicelink .= ' '; + } } - } elseif ($customprinterallowed && (isModEnabled('receiptprinter') && getDolGlobalInt('TAKEPOS_PRINTER_TO_USE'.$term) > 0) || getDolGlobalString('TAKEPOS_PRINT_METHOD') == "receiptprinter") { // @phpstan-ignore-line - // If we set to use a specific receipt printer - $nameOfPrinter = dol_getIdFromCode($db, getDolGlobalInt('TAKEPOS_PRINTER_TO_USE'.$term), 'printer_receipt', 'rowid', 'name', 1); - $sectionwithinvoicelink .= ' '; - } else { - $sectionwithinvoicelink .= ' '; - if (getDolGlobalString('TAKEPOS_PRINT_WITHOUT_DETAILS')) { - $sectionwithinvoicelink .= ' '; + if (getDolGlobalString('TAKEPOS_EMAIL_TEMPLATE_INVOICE') && getDolGlobalInt('TAKEPOS_EMAIL_TEMPLATE_INVOICE') > 0) { + $sectionwithinvoicelink .= ' '; } - if (getDolGlobalString('TAKEPOS_GIFT_RECEIPT')) { - $sectionwithinvoicelink .= ' '; - } - } - if (getDolGlobalString('TAKEPOS_EMAIL_TEMPLATE_INVOICE') && getDolGlobalInt('TAKEPOS_EMAIL_TEMPLATE_INVOICE') > 0) { - $sectionwithinvoicelink .= ' '; - } - if ($remaintopay <= 0 && getDolGlobalString('TAKEPOS_AUTO_PRINT_TICKETS') && $action != "history") { - $sectionwithinvoicelink .= ''; + if ($remaintopay <= 0 && getDolGlobalString('TAKEPOS_AUTO_PRINT_TICKETS') && $action != "history") { + $sectionwithinvoicelink .= ''; + } } } } From 3a4cf15857c58a59342b3b858eec66278802878a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 21 Dec 2025 13:32:32 +0100 Subject: [PATCH 05/19] Debug v23 no propagation of warnings --- htdocs/api/class/api.class.php | 1 + htdocs/compta/paiement/class/paiement.class.php | 2 ++ htdocs/core/class/commondocgenerator.class.php | 5 +++++ htdocs/core/class/commonobject.class.php | 13 +++++++++++-- htdocs/core/lib/functions.lib.php | 4 ++-- .../accountancy/doc/pdf_balance.modules.php | 1 + .../accountancy/doc/pdf_bookkeeping.modules.php | 1 + .../accountancy/doc/pdf_ledger.modules.php | 1 + .../action/doc/pdf_standard_actions.class.php | 1 + .../asset/doc/pdf_standard_asset.modules.php | 1 + .../core/modules/bank/doc/pdf_ban.modules.php | 1 + .../bank/doc/pdf_sepamandate.modules.php | 1 + .../modules/cheque/doc/pdf_blochet.class.php | 1 + .../commande/doc/pdf_einstein.modules.php | 1 + .../commande/doc/pdf_eratosthene.modules.php | 1 + .../modules/contract/doc/pdf_strato.modules.php | 1 + .../modules/delivery/doc/pdf_storm.modules.php | 1 + .../modules/delivery/doc/pdf_typhon.modules.php | 1 + .../expedition/doc/pdf_espadon.modules.php | 1 + .../expedition/doc/pdf_merou.modules.php | 1 + .../expedition/doc/pdf_rouget.modules.php | 1 + .../doc/pdf_standard_expensereport.modules.php | 1 + .../modules/facture/doc/pdf_crabe.modules.php | 1 + .../modules/facture/doc/pdf_octopus.modules.php | 1 + .../modules/facture/doc/pdf_sponge.modules.php | 1 + .../fichinter/doc/pdf_soleil.modules.php | 1 + .../hrm/doc/pdf_standard_evaluation.modules.php | 1 + .../doc/pdf_standard_movementstock.modules.php | 1 + .../core/modules/mrp/doc/pdf_vinci.modules.php | 1 + .../product/doc/pdf_standard.modules.php | 1 + .../modules/project/doc/pdf_baleine.modules.php | 1 + .../modules/project/doc/pdf_beluga.modules.php | 1 + .../project/doc/pdf_timespent.modules.php | 1 + .../modules/propale/doc/pdf_azur.modules.php | 1 + .../modules/propale/doc/pdf_cyan.modules.php | 1 + .../core/modules/rapport/pdf_paiement.class.php | 1 + .../reception/doc/pdf_squille.modules.php | 1 + .../stock/doc/pdf_standard_stock.modules.php | 1 + .../stocktransfer/doc/pdf_eagle.modules.php | 1 + .../doc/pdf_eagle_proforma.modules.php | 1 + .../doc/pdf_canelle.modules.php | 1 + .../supplier_order/doc/pdf_cornas.modules.php | 1 + .../supplier_order/doc/pdf_muscadet.modules.php | 1 + .../pdf_standard_supplierpayment.modules.php | 1 + .../doc/pdf_aurore.modules.php | 1 + .../doc/pdf_zenith.modules.php | 1 + .../doc/pdf_standard_myobject.modules.php | 1 + ..._standard_recruitmentjobposition.modules.php | 1 + htdocs/takepos/invoice.php | 17 ++++++++++++----- 49 files changed, 76 insertions(+), 9 deletions(-) diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index 3fee85da0cd..e2ce16e4aeb 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -225,6 +225,7 @@ class DolibarrApi unset($object->error); unset($object->errors); unset($object->errorhidden); + unset($object->warnings); unset($object->TRIGGER_PREFIX); unset($object->ref_previous); diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 52d15561030..11f566ee519 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -631,6 +631,8 @@ class Paiement extends CommonObject dol_syslog(get_class($this).'::create Regenerate end result='.$result, LOG_DEBUG); + $this->warnings = $invoice->warnings; + if ($result < 0) { $this->error = $invoice->error; $this->errors = $invoice->errors; diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 8b54dd7fd61..ce234468ae7 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -58,6 +58,11 @@ abstract class CommonDocGenerator */ public $errors = array(); + /** + * @var string[] Array of warnings strings + */ + public $warnings = array(); + /** * @var DoliDB Database handler. */ diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index f9dc571e112..7576771cd8a 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -91,6 +91,11 @@ abstract class CommonObject */ public $errors = array(); + /** + * @var string[] Array of warning strings + */ + public $warnings = array(); + /** * @var array To store error results of ->validateField() */ @@ -2724,8 +2729,8 @@ abstract class CommonObject } $sql = "UPDATE ".$this->db->prefix().$this->table_element; - $sql .= " SET ".$fieldname." = ".(($id > 0 || $id == '0') ? ((int) $id) : 'NULL'); - $sql .= ' WHERE rowid='.((int) $this->id); + $sql .= " SET ".$this->db->sanitize($fieldname)." = ".(($id > 0 || $id == '0') ? ((int) $id) : 'NULL'); + $sql .= ' WHERE rowid = '.((int) $this->id); if ($this->db->query($sql)) { $this->mode_reglement_id = $id; @@ -6106,6 +6111,7 @@ abstract class CommonObject } // After call of write_file $obj->result['fullpath'] is set with generated file. It will be used to update the ECM database index. + if ($resultwritefile > 0) { $outputlangs->charset_output = $sav_charset_output; @@ -6135,11 +6141,14 @@ abstract class CommonObject // Success in building document. We build meta file. dol_meta_create($this); + $this->warnings = $obj->warnings; + return 1; } else { $outputlangs->charset_output = $sav_charset_output; $this->error = $obj->error; $this->errors = $obj->errors; + $this->warnings = $obj->warnings; dol_syslog("Error generating document for ".__CLASS__.". Error: ".$obj->error, LOG_ERR); return -1; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index b3281b05fbe..f8030669ac6 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -11289,10 +11289,10 @@ function dol_htmloutput_mesg($mesgstring = '', $mesgarray = array(), $style = 'o } elseif ($mesgstring && preg_match('/class="warning"/i', $mesgstring)) { $iswarning++; } - if ($style == 'error') { + if ($style == 'error' || $style == 'errors') { $iserror++; } - if ($style == 'warning') { + if ($style == 'warning' || $style == 'warnings') { $iswarning++; } diff --git a/htdocs/core/modules/accountancy/doc/pdf_balance.modules.php b/htdocs/core/modules/accountancy/doc/pdf_balance.modules.php index 4c4fef9846a..dd5ddbd50a7 100644 --- a/htdocs/core/modules/accountancy/doc/pdf_balance.modules.php +++ b/htdocs/core/modules/accountancy/doc/pdf_balance.modules.php @@ -559,6 +559,7 @@ class pdf_balance extends ModelePdfAccountancy $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs); global $action; $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $this->warnings = $hookmanager->warnings; if ($reshook < 0) { $this->error = $hookmanager->error; $this->errors = $hookmanager->errors; diff --git a/htdocs/core/modules/accountancy/doc/pdf_bookkeeping.modules.php b/htdocs/core/modules/accountancy/doc/pdf_bookkeeping.modules.php index 997111b4cea..5a285036363 100644 --- a/htdocs/core/modules/accountancy/doc/pdf_bookkeeping.modules.php +++ b/htdocs/core/modules/accountancy/doc/pdf_bookkeeping.modules.php @@ -544,6 +544,7 @@ class pdf_bookkeeping extends ModelePdfAccountancy $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs); global $action; $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $this->warnings = $hookmanager->warnings; if ($reshook < 0) { $this->error = $hookmanager->error; $this->errors = $hookmanager->errors; diff --git a/htdocs/core/modules/accountancy/doc/pdf_ledger.modules.php b/htdocs/core/modules/accountancy/doc/pdf_ledger.modules.php index 78792e65cb7..d5891c02835 100644 --- a/htdocs/core/modules/accountancy/doc/pdf_ledger.modules.php +++ b/htdocs/core/modules/accountancy/doc/pdf_ledger.modules.php @@ -598,6 +598,7 @@ class pdf_ledger extends ModelePdfAccountancy $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs); global $action; $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $this->warnings = $hookmanager->warnings; if ($reshook < 0) { $this->error = $hookmanager->error; $this->errors = $hookmanager->errors; diff --git a/htdocs/core/modules/action/doc/pdf_standard_actions.class.php b/htdocs/core/modules/action/doc/pdf_standard_actions.class.php index 0c5725f874f..a33f721ca56 100644 --- a/htdocs/core/modules/action/doc/pdf_standard_actions.class.php +++ b/htdocs/core/modules/action/doc/pdf_standard_actions.class.php @@ -260,6 +260,7 @@ class pdf_standard_actions $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs); global $action; $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $this->warnings = $hookmanager->warnings; if ($reshook < 0) { $this->error = $hookmanager->error; $this->errors = $hookmanager->errors; diff --git a/htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php b/htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php index 643498355d1..282a8a762ae 100644 --- a/htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php +++ b/htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php @@ -695,6 +695,7 @@ class pdf_standard_asset extends ModelePDFAsset $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs); global $action; $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $this->warnings = $hookmanager->warnings; if ($reshook < 0) { $this->error = $hookmanager->error; $this->errors = $hookmanager->errors; diff --git a/htdocs/core/modules/bank/doc/pdf_ban.modules.php b/htdocs/core/modules/bank/doc/pdf_ban.modules.php index 31c56d5e330..5851570eb87 100644 --- a/htdocs/core/modules/bank/doc/pdf_ban.modules.php +++ b/htdocs/core/modules/bank/doc/pdf_ban.modules.php @@ -258,6 +258,7 @@ class pdf_ban extends ModeleBankAccountDoc $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs); global $action; $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $this->warnings = $hookmanager->warnings; if ($reshook < 0) { $this->error = $hookmanager->error; $this->errors = $hookmanager->errors; diff --git a/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php b/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php index 2be23d86135..ab20fe66d32 100644 --- a/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php +++ b/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php @@ -459,6 +459,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs); global $action; $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $this->warnings = $hookmanager->warnings; if ($reshook < 0) { $this->error = $hookmanager->error; $this->errors = $hookmanager->errors; diff --git a/htdocs/core/modules/cheque/doc/pdf_blochet.class.php b/htdocs/core/modules/cheque/doc/pdf_blochet.class.php index 9122f2fc442..3f4f8a99161 100644 --- a/htdocs/core/modules/cheque/doc/pdf_blochet.class.php +++ b/htdocs/core/modules/cheque/doc/pdf_blochet.class.php @@ -227,6 +227,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs); global $action; $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $this->warnings = $hookmanager->warnings; if ($reshook < 0) { $this->error = $hookmanager->error; $this->errors = $hookmanager->errors; diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 7acda8d89bf..ff5809fc96c 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -671,6 +671,7 @@ class pdf_einstein extends ModelePDFCommandes $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs); global $action; $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $this->warnings = $hookmanager->warnings; if ($reshook < 0) { $this->error = $hookmanager->error; $this->errors = $hookmanager->errors; diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index 30b5db2cc44..634fb8b3788 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -942,6 +942,7 @@ class pdf_eratosthene extends ModelePDFCommandes $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs); global $action; $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $this->warnings = $hookmanager->warnings; if ($reshook < 0) { $this->error = $hookmanager->error; $this->errors = $hookmanager->errors; diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php index 7150763cbd1..baf6265f234 100644 --- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php +++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php @@ -499,6 +499,7 @@ class pdf_strato extends ModelePDFContract $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs); global $action; $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $this->warnings = $hookmanager->warnings; if ($reshook < 0) { $this->error = $hookmanager->error; $this->errors = $hookmanager->errors; diff --git a/htdocs/core/modules/delivery/doc/pdf_storm.modules.php b/htdocs/core/modules/delivery/doc/pdf_storm.modules.php index b467dd600a6..69c4c1b9696 100644 --- a/htdocs/core/modules/delivery/doc/pdf_storm.modules.php +++ b/htdocs/core/modules/delivery/doc/pdf_storm.modules.php @@ -581,6 +581,7 @@ class pdf_storm extends ModelePDFDeliveryOrder $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs); global $action; $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $this->warnings = $hookmanager->warnings; if ($reshook < 0) { $this->error = $hookmanager->error; $this->errors = $hookmanager->errors; diff --git a/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php b/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php index 808f3188840..0fd8c74b620 100644 --- a/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php +++ b/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php @@ -582,6 +582,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs); global $action; $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $this->warnings = $hookmanager->warnings; if ($reshook < 0) { $this->error = $hookmanager->error; $this->errors = $hookmanager->errors; diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index d08d0b34bf5..7c9c13353b0 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -833,6 +833,7 @@ class pdf_espadon extends ModelePdfExpedition $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs); global $action; $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $this->warnings = $hookmanager->warnings; if ($reshook < 0) { $this->error = $hookmanager->error; $this->errors = $hookmanager->errors; diff --git a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php index 2af0b39896b..2fcb7da88ea 100644 --- a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php @@ -401,6 +401,7 @@ class pdf_merou extends ModelePdfExpedition $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs); global $action; $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $this->warnings = $hookmanager->warnings; if ($reshook < 0) { $this->error = $hookmanager->error; $this->errors = $hookmanager->errors; diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index 7cc6234a744..b43234ae387 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -689,6 +689,7 @@ class pdf_rouget extends ModelePdfExpedition $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs); global $action; $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $this->warnings = $hookmanager->warnings; if ($reshook < 0) { $this->error = $hookmanager->error; $this->errors = $hookmanager->errors; diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard_expensereport.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard_expensereport.modules.php index 9594de09a44..8dbee85f438 100644 --- a/htdocs/core/modules/expensereport/doc/pdf_standard_expensereport.modules.php +++ b/htdocs/core/modules/expensereport/doc/pdf_standard_expensereport.modules.php @@ -545,6 +545,7 @@ class pdf_standard_expensereport extends ModeleExpenseReport $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs); global $action; $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $this->warnings = $hookmanager->warnings; if ($reshook < 0) { $this->error = $hookmanager->error; $this->errors = $hookmanager->errors; diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 29b1eadf415..c439fe68215 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -932,6 +932,7 @@ class pdf_crabe extends ModelePDFFactures $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs); global $action; $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $this->warnings = $hookmanager->warnings; if ($reshook < 0) { $this->error = $hookmanager->error; $this->errors = $hookmanager->errors; diff --git a/htdocs/core/modules/facture/doc/pdf_octopus.modules.php b/htdocs/core/modules/facture/doc/pdf_octopus.modules.php index 3a2339b6b07..7443564a9c8 100644 --- a/htdocs/core/modules/facture/doc/pdf_octopus.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_octopus.modules.php @@ -1250,6 +1250,7 @@ class pdf_octopus extends ModelePDFFactures $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs); global $action; $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $this->warnings = $hookmanager->warnings; if ($reshook < 0) { $this->error = $hookmanager->error; $this->errors = $hookmanager->errors; diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 209ead0c0b6..971c4d6872f 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -1142,6 +1142,7 @@ class pdf_sponge extends ModelePDFFactures $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs); global $action; $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $this->warnings = $hookmanager->warnings; if ($reshook < 0) { $this->error = $hookmanager->error; $this->errors = $hookmanager->errors; diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php index 6a5a5655335..5c4e78ada4c 100644 --- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php +++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php @@ -427,6 +427,7 @@ class pdf_soleil extends ModelePDFFicheinter $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs); global $action; $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $this->warnings = $hookmanager->warnings; if ($reshook < 0) { $this->error = $hookmanager->error; $this->errors = $hookmanager->errors; diff --git a/htdocs/core/modules/hrm/doc/pdf_standard_evaluation.modules.php b/htdocs/core/modules/hrm/doc/pdf_standard_evaluation.modules.php index de7fcd230e3..7266d33ab0f 100644 --- a/htdocs/core/modules/hrm/doc/pdf_standard_evaluation.modules.php +++ b/htdocs/core/modules/hrm/doc/pdf_standard_evaluation.modules.php @@ -466,6 +466,7 @@ class pdf_standard_evaluation extends ModelePDFEvaluation $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs); global $action; $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $this->warnings = $hookmanager->warnings; if ($reshook < 0) { $this->error = $hookmanager->error; $this->errors = $hookmanager->errors; diff --git a/htdocs/core/modules/movement/doc/pdf_standard_movementstock.modules.php b/htdocs/core/modules/movement/doc/pdf_standard_movementstock.modules.php index 09445e745f2..c657bdaebbb 100644 --- a/htdocs/core/modules/movement/doc/pdf_standard_movementstock.modules.php +++ b/htdocs/core/modules/movement/doc/pdf_standard_movementstock.modules.php @@ -790,6 +790,7 @@ class pdf_standard_movementstock extends ModelePDFMovement $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs); global $action; $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $this->warnings = $hookmanager->warnings; if ($reshook < 0) { $this->error = $hookmanager->error; $this->errors = $hookmanager->errors; diff --git a/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php b/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php index 7b95c0dbac8..ee77c0a55d7 100644 --- a/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php +++ b/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php @@ -604,6 +604,7 @@ class pdf_vinci extends ModelePDFMo $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs); global $action; $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $this->warnings = $hookmanager->warnings; if ($reshook < 0) { $this->error = $hookmanager->error; $this->errors = $hookmanager->errors; diff --git a/htdocs/core/modules/product/doc/pdf_standard.modules.php b/htdocs/core/modules/product/doc/pdf_standard.modules.php index 5fa750236e4..567f7e4a7fc 100644 --- a/htdocs/core/modules/product/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/product/doc/pdf_standard.modules.php @@ -584,6 +584,7 @@ class pdf_standard extends ModelePDFProduct $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs); global $action; $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $this->warnings = $hookmanager->warnings; if ($reshook < 0) { $this->error = $hookmanager->error; $this->errors = $hookmanager->errors; diff --git a/htdocs/core/modules/project/doc/pdf_baleine.modules.php b/htdocs/core/modules/project/doc/pdf_baleine.modules.php index dbbc1c702f1..66e53525b54 100644 --- a/htdocs/core/modules/project/doc/pdf_baleine.modules.php +++ b/htdocs/core/modules/project/doc/pdf_baleine.modules.php @@ -489,6 +489,7 @@ class pdf_baleine extends ModelePDFProjects $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs); global $action; $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $this->warnings = $hookmanager->warnings; if ($reshook < 0) { $this->error = $hookmanager->error; $this->errors = $hookmanager->errors; diff --git a/htdocs/core/modules/project/doc/pdf_beluga.modules.php b/htdocs/core/modules/project/doc/pdf_beluga.modules.php index 76effdc4297..dc3fd94d215 100644 --- a/htdocs/core/modules/project/doc/pdf_beluga.modules.php +++ b/htdocs/core/modules/project/doc/pdf_beluga.modules.php @@ -744,6 +744,7 @@ class pdf_beluga extends ModelePDFProjects $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs); global $action; $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $this->warnings = $hookmanager->warnings; if ($reshook < 0) { $this->error = $hookmanager->error; $this->errors = $hookmanager->errors; diff --git a/htdocs/core/modules/project/doc/pdf_timespent.modules.php b/htdocs/core/modules/project/doc/pdf_timespent.modules.php index 86ae46a4b7c..d340f1bf68b 100644 --- a/htdocs/core/modules/project/doc/pdf_timespent.modules.php +++ b/htdocs/core/modules/project/doc/pdf_timespent.modules.php @@ -487,6 +487,7 @@ class pdf_timespent extends ModelePDFProjects $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs); global $action; $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $this->warnings = $hookmanager->warnings; if ($reshook < 0) { $this->error = $hookmanager->error; $this->errors = $hookmanager->errors; diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index bb8cbd76641..75e673327d8 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -874,6 +874,7 @@ class pdf_azur extends ModelePDFPropales $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs); global $action; $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $this->warnings = $hookmanager->warnings; if ($reshook < 0) { $this->error = $hookmanager->error; $this->errors = $hookmanager->errors; diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 07bac951771..afd66458274 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -1045,6 +1045,7 @@ class pdf_cyan extends ModelePDFPropales $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs); global $action; $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $this->warnings = $hookmanager->warnings; if ($reshook < 0) { $this->error = $hookmanager->error; $this->errors = $hookmanager->errors; diff --git a/htdocs/core/modules/rapport/pdf_paiement.class.php b/htdocs/core/modules/rapport/pdf_paiement.class.php index 053f9995b6d..9444a297620 100644 --- a/htdocs/core/modules/rapport/pdf_paiement.class.php +++ b/htdocs/core/modules/rapport/pdf_paiement.class.php @@ -407,6 +407,7 @@ class pdf_paiement extends CommonDocGenerator $parameters = array('file' => $file, 'object' => $this, 'outputlangs' => $outputlangs); global $action; $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $this->warnings = $hookmanager->warnings; if ($reshook < 0) { $this->error = $hookmanager->error; $this->errors = $hookmanager->errors; diff --git a/htdocs/core/modules/reception/doc/pdf_squille.modules.php b/htdocs/core/modules/reception/doc/pdf_squille.modules.php index 6e6598fde27..dc8d5bfc1d9 100644 --- a/htdocs/core/modules/reception/doc/pdf_squille.modules.php +++ b/htdocs/core/modules/reception/doc/pdf_squille.modules.php @@ -660,6 +660,7 @@ class pdf_squille extends ModelePdfReception $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs); global $action; $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $this->warnings = $hookmanager->warnings; if ($reshook < 0) { $this->error = $hookmanager->error; $this->errors = $hookmanager->errors; diff --git a/htdocs/core/modules/stock/doc/pdf_standard_stock.modules.php b/htdocs/core/modules/stock/doc/pdf_standard_stock.modules.php index 33d6b725c21..6c6fd033290 100644 --- a/htdocs/core/modules/stock/doc/pdf_standard_stock.modules.php +++ b/htdocs/core/modules/stock/doc/pdf_standard_stock.modules.php @@ -586,6 +586,7 @@ class pdf_standard_stock extends ModelePDFStock $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs); global $action; $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $this->warnings = $hookmanager->warnings; if ($reshook < 0) { $this->error = $hookmanager->error; $this->errors = $hookmanager->errors; diff --git a/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php b/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php index 0dc3ec4070d..62e7e8004f4 100644 --- a/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php +++ b/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php @@ -748,6 +748,7 @@ class pdf_eagle extends ModelePDFStockTransfer $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs); global $action; $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $this->warnings = $hookmanager->warnings; if ($reshook < 0) { $this->error = $hookmanager->error; $this->errors = $hookmanager->errors; diff --git a/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php b/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php index 45ca1dcdf14..34f4cf67364 100644 --- a/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php +++ b/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php @@ -820,6 +820,7 @@ class pdf_eagle_proforma extends ModelePDFStockTransfer $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs); global $action; $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $this->warnings = $hookmanager->warnings; if ($reshook < 0) { $this->error = $hookmanager->error; $this->errors = $hookmanager->errors; diff --git a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php index 4df50eae7bd..d9ea548c74f 100644 --- a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php @@ -590,6 +590,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs); global $action; $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $this->warnings = $hookmanager->warnings; if ($reshook < 0) { $this->error = $hookmanager->error; $this->errors = $hookmanager->errors; diff --git a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php index 187d35df89f..cbf70cf318d 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php @@ -827,6 +827,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs); global $action; $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $this->warnings = $hookmanager->warnings; if ($reshook < 0) { $this->error = $hookmanager->error; $this->errors = $hookmanager->errors; diff --git a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php index 6d997dfba2b..a063e76b2fa 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php @@ -687,6 +687,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs); global $action; $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $this->warnings = $hookmanager->warnings; if ($reshook < 0) { $this->error = $hookmanager->error; $this->errors = $hookmanager->errors; diff --git a/htdocs/core/modules/supplier_payment/doc/pdf_standard_supplierpayment.modules.php b/htdocs/core/modules/supplier_payment/doc/pdf_standard_supplierpayment.modules.php index 0ca4b56efc1..87f7736426b 100644 --- a/htdocs/core/modules/supplier_payment/doc/pdf_standard_supplierpayment.modules.php +++ b/htdocs/core/modules/supplier_payment/doc/pdf_standard_supplierpayment.modules.php @@ -490,6 +490,7 @@ class pdf_standard_supplierpayment extends ModelePDFSuppliersPayments $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs); global $action; $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $this->warnings = $hookmanager->warnings; if ($reshook < 0) { $this->error = $hookmanager->error; $this->errors = $hookmanager->errors; diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php index 7ffe62432d2..109bacfa2f6 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -676,6 +676,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs); global $action; $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $this->warnings = $hookmanager->warnings; if ($reshook < 0) { $this->error = $hookmanager->error; $this->errors = $hookmanager->errors; diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php index dc15e72c366..8e13c399491 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php @@ -806,6 +806,7 @@ class pdf_zenith extends ModelePDFSupplierProposal $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs); global $action; $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $this->warnings = $hookmanager->warnings; if ($reshook < 0) { $this->error = $hookmanager->error; $this->errors = $hookmanager->errors; diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php index f5e006a323c..cd3292ca0c3 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php @@ -817,6 +817,7 @@ class pdf_standard_myobject extends ModelePDFMyObject $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs); global $action; $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $this->warnings = $hookmanager->warnings; if ($reshook < 0) { $this->error = $hookmanager->error; $this->errors = $hookmanager->errors; diff --git a/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php b/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php index c0b22d89e2a..97ddb7a988d 100644 --- a/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php +++ b/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php @@ -628,6 +628,7 @@ class pdf_standard_recruitmentjobposition extends ModelePDFRecruitmentJobPositio $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs); global $action; $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $this->warnings = $hookmanager->warnings; if ($reshook < 0) { $this->error = $hookmanager->error; $this->errors = $hookmanager->errors; diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 5afcdfc5fd7..aed8fe282ca 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -148,10 +148,10 @@ if ($pay == 'cheque') { $paycode = 'CHQ'; // For backward compatibility } -// Retrieve paiementid +// Retrieve paiementid and paiementcode $paiementid = 0; if ($paycode) { - $sql = "SELECT id FROM ".MAIN_DB_PREFIX."c_paiement"; + $sql = "SELECT id, code FROM ".MAIN_DB_PREFIX."c_paiement"; $sql .= " WHERE entity IN (".getEntity('c_paiement').")"; $sql .= " AND code = '".$db->escape($paycode)."'"; $resql = $db->query($sql); @@ -340,18 +340,25 @@ if (empty($reshook)) { // We do not set $payments->multicurrency_amounts because we want payment to be in main currency. $payment->paiementid = $paiementid; + $payment->paiementcode = $paycode; $payment->num_payment = $invoice->ref; if ($pay != "delayed") { - $res = $payment->create($user); + $res = $payment->create($user); // This record payment and regenerate the PDF if ($res < 0) { $error++; - dol_htmloutput_errors($langs->trans('Error').' '.$payment->error, $payment->errors, 1); + //setEventMessages($payment->error, $payment->errors, 'error'); + dol_htmloutput_mesg($payment->error, $payment->errors, 'error', 1); } else { + //setEventMessages(null, $payment->warnings, 'warnings'); + if (!empty($payment->warnings)) { + dol_htmloutput_mesg(null, $payment->warnings, 'warning', 1); + } + $res = $payment->addPaymentToBank($user, 'payment', '(CustomerInvoicePayment)', $bankaccount, '', ''); if ($res < 0) { $error++; - dol_htmloutput_errors($langs->trans('ErrorNoPaymentDefined').' '.$payment->error, $payment->errors, 1); + dol_htmloutput_mesg($langs->trans('ErrorNoPaymentDefined').' '.$payment->error, $payment->errors, 'error', 1); } } $remaintopay = $invoice->getRemainToPay(); // Recalculate remain to pay after the payment is recorded From 69cea28a14f32cbb21b09675caef9f9a493707d0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 21 Dec 2025 14:33:25 +0100 Subject: [PATCH 06/19] Debug v23 --- .../core/triggers/dolibarrtriggers.class.php | 6 +++ ...ce_95_modWebhook_WebhookTriggers.class.php | 30 ++++++++------ htdocs/langs/en_US/cashdesk.lang | 2 + htdocs/takepos/receipt.php | 39 ++++++++++++++----- 4 files changed, 55 insertions(+), 22 deletions(-) diff --git a/htdocs/core/triggers/dolibarrtriggers.class.php b/htdocs/core/triggers/dolibarrtriggers.class.php index 9237d51c7ce..fc88f6eb0c3 100644 --- a/htdocs/core/triggers/dolibarrtriggers.class.php +++ b/htdocs/core/triggers/dolibarrtriggers.class.php @@ -73,6 +73,12 @@ abstract class DolibarrTriggers */ public $errors; + /** + * Warnings reported by the trigger + * @var string[] + */ + public $warnings; + /** * @var string module is in development * @deprecated Use self::VERSIONS diff --git a/htdocs/core/triggers/interface_95_modWebhook_WebhookTriggers.class.php b/htdocs/core/triggers/interface_95_modWebhook_WebhookTriggers.class.php index f260ec47dd6..8d247ed6775 100644 --- a/htdocs/core/triggers/interface_95_modWebhook_WebhookTriggers.class.php +++ b/htdocs/core/triggers/interface_95_modWebhook_WebhookTriggers.class.php @@ -19,16 +19,10 @@ /** * \file core/triggers/interface_99_modWebhook_WebhookTriggers.class.php * \ingroup webhook - * \brief Example trigger. + * \brief Trigger for webhook module. * - * Put detailed description here. - * - * \remarks You can create other triggers by copying this one. - * - File name should be either: - * - interface_99_modWebhook_MyTrigger.class.php - * - interface_99_all_MyTrigger.class.php - * - The file must stay in core/triggers - * - The class name must be InterfaceMytrigger + * This trigger check the setup of the module WebHook. If a target exists for the trigger action code, + * a JSON message is sent. */ require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php'; @@ -81,7 +75,8 @@ class InterfaceWebhookTriggers extends DolibarrTriggers $errors = 0; $errorforhistory = 0; $static_object = new Target($this->db); - $target_url = $static_object->fetchAll(); // TODO Replace this with a search with filter on $action trigger to avoid to filter later. + $filter = ''; // TODO Replace this with a search with filter on $action trigger to avoid to filter later. + $target_url = $static_object->fetchAll('', '', 0, 0, $filter); if (is_numeric($target_url) && $target_url < 0) { dol_syslog("Error Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); @@ -95,7 +90,7 @@ class InterfaceWebhookTriggers extends DolibarrTriggers } // Create new instance of db for webhook history save - $dbhistory = getDoliDBInstance($conf->db->type, $conf->db->host, (string) $conf->db->user, $dolibarr_main_db_pass, $conf->db->name, (int) $conf->db->port); + $dbhistory = null; $sendmanualtriggers = (!empty($object->context['sendmanualtriggers']) ? $object->context['sendmanualtriggers'] : ""); foreach ($target_url as $key => $tmpobject) { @@ -150,7 +145,12 @@ class InterfaceWebhookTriggers extends DolibarrTriggers }*/ } + if (empty($dbhistory)) { + $dbhistory = getDoliDBInstance($conf->db->type, $conf->db->host, (string) $conf->db->user, $dolibarr_main_db_pass, $conf->db->name, (int) $conf->db->port); + } + $dbhistory->begin(); + $triggerhistory = new TriggerHistory($dbhistory); $triggerhistory->trigger_code = $action; $triggerhistory->trigger_data = $jsonstr; @@ -158,10 +158,13 @@ class InterfaceWebhookTriggers extends DolibarrTriggers $triggerhistory->url = $tmpobject->url; $triggerhistory->error_message = $errormsg; $triggerhistory->status = ($errorforhistory == 0 ? 1 : -1); + $resql = $triggerhistory->create($user); + if (!$resql) { $errors++; $this->errors = array_merge($this->errors, $triggerhistory->errors); + $this->warnings = array_merge($this->warnings, $triggerhistory->warnings); $dbhistory->rollback(); } else { $dbhistory->commit(); @@ -169,7 +172,10 @@ class InterfaceWebhookTriggers extends DolibarrTriggers } } - $dbhistory->close(); + if ($dbhistory) { + $dbhistory->close(); + } + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id." -> nbPost=".$nbPosts); if (!empty($errors)) { diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang index 0dff0896ec2..e583cb5d095 100644 --- a/htdocs/langs/en_US/cashdesk.lang +++ b/htdocs/langs/en_US/cashdesk.lang @@ -171,3 +171,5 @@ Printers=Printers PrintOn=Print on printer %s SentToPrinter=Sent to printer FailedToSendToPrinter=Failed to send to printer +TemporaryReceipt=Temporary +SignatureID=Signature ID diff --git a/htdocs/takepos/receipt.php b/htdocs/takepos/receipt.php index 471ccda6e60..5c494e272e2 100644 --- a/htdocs/takepos/receipt.php +++ b/htdocs/takepos/receipt.php @@ -249,23 +249,42 @@ if (getDolGlobalString('TAKEPOS_SHOW_CUSTOMER')) { print "
".$langs->trans("Customer").': '.$soc->name; } } -// Transaction ID -if (isALNERunningVersion()) { - $unalterablelogid = 'TODO'; - print "
".$langs->trans("TransactionID").': '.$unalterablelogid.'
'; -} // Date -print $langs->trans('Date')." ".dol_print_date($object->date ? $object->date : dol_now(), 'day'); +print "
".$langs->trans('Date').": ".dol_print_date($object->date ? $object->date : dol_now(), 'day'); // Date of printing if (isALNERunningVersion() || !getDolGlobalString('TAKEPOS_HIDE_DATE_OF_PRINTING')) { - print "
".$langs->trans("DateOfPrinting").': '.dol_print_date(dol_now(), 'dayhour', 'tzuserrel').'
'; + print "
".$langs->trans("DateOfPrinting").': '.dol_print_date(dol_now(), 'dayhour', 'tzuserrel'); +} +// Transaction ID +if (isALNERunningVersion() && isModEnabled('blockedlog')) { + if ($object->status == $object::STATUS_CLOSED) { + $unalterablelogid = 'UNDEFINED'; + $sql = "SELECT signature FROM ".MAIN_DB_PREFIX."blockedlog"; + $sql .= " WHERE action = 'BILL_VALIDATE' AND element = 'facture' AND ref_object = '".$db->escape($object->ref)."'"; + $sql .= $db->order('rowid', 'DESC'); + $sql .= $db->plimit(1); + + $resql = $db->query($sql); + if ($resql) { + $obj = $db->fetch_object($resql); + if ($obj) { + $unalterablelogid = $obj->signature; + } + } + + print "
".$langs->trans("SignatureID").': '.dol_trunc(strtoupper($unalterablelogid), 10).'
'; + } } // TODO Show if it is a duplicata $isADuplicata = $object->pos_print_counter; -if ($isADuplicata) { - print '*** DUPLICATA***'; // Hard coded string +if ($object->status == $object::STATUS_CLOSED) { + if ($isADuplicata) { + print '*** DUPLICATA***'; // Hard coded string + } +} else { + print '*** '.strtoupper($langs->trans("TemporaryReceipt")).' ***'; // Hard coded string } ?>

@@ -274,7 +293,7 @@ if ($isADuplicata) { - + '."\n"; - $out .= ''."\n"; + $out .= ''."\n"; $out .= "\n"; } } else { @@ -432,8 +436,8 @@ if (empty($error) && !empty($xml)) { $out .= ''; $out .= ''."\n"; $out .= ''."\n"; - $out .= ''."\n"; - $out .= ''."\n"; + $out .= ''."\n"; + $out .= ''."\n"; $out .= ''."\n"; - $out .= ''."\n"; // @phan-suppress-current-line PhanTypeInvalidDimOffset - $out .= ''."\n"; + $out .= ''."\n"; // @phan-suppress-current-line PhanTypeInvalidDimOffset + $out .= ''."\n"; $size = dol_filesize(DOL_DOCUMENT_ROOT.'/'.$file['filename']); $totalsize += $size; $out .= ''."\n"; @@ -525,14 +529,14 @@ if (empty($error) && !empty($xml)) { if (is_object($xml->dolibarr_scripts_dir[0])) { $file_list = array(); $ret = getFilesUpdated($file_list, $xml->dolibarr_htdocs_dir[0], '', ???, $checksumconcat); // Fill array $file_list - '@phan-var-force array{insignature:string[],missing?:array,updated:array} $file_list'; + '@phan-var-force array{insignature:string[],missing?:array,updated:array} $file_list'; }*/ // Section Globalchecksum asort($checksumconcat); // Sort list of checksum - $checksumget = md5(implode(',', $checksumconcat)); + $checksumget = hash($algo, implode(',', $checksumconcat)); if ($mode == 'unalterable') { $nameofsection = 'dolibarr_unalterable_files_checksum'; @@ -585,7 +589,16 @@ if (empty($error) && !empty($xml)) { $outforlistoffiles .= '
trans("Label"); ?>trans("Label"); ?> trans("Qty"); ?> trans("Price"); From c57eb789b4b801c716180d4a313e7743e7f6b03d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 21 Dec 2025 14:46:13 +0100 Subject: [PATCH 07/19] Debug v23 --- htdocs/blockedlog/admin/blockedlog_archives.php | 6 +++--- htdocs/blockedlog/admin/blockedlog_list.php | 6 +++--- htdocs/takepos/receipt.php | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/blockedlog/admin/blockedlog_archives.php b/htdocs/blockedlog/admin/blockedlog_archives.php index ef0c1d01203..270afc6e8cf 100644 --- a/htdocs/blockedlog/admin/blockedlog_archives.php +++ b/htdocs/blockedlog/admin/blockedlog_archives.php @@ -447,14 +447,14 @@ $morehtmlcenter = ''; $registrationnumber = getHashUniqueIdOfRegistration(); $texttop = ''.$langs->trans("RegistrationNumber").': '.dol_trunc($registrationnumber, 10).''; -print load_fiche_titre($title, $linkback, 'blockedlog', 0, '', '', $morehtmlcenter); +print load_fiche_titre($title.'
'.$texttop, $linkback, 'blockedlog', 0, '', '', $morehtmlcenter); $head = blockedlogadmin_prepare_head(GETPOST('withtab', 'alpha')); print dol_get_fiche_head($head, 'archives', '', -1); -print $texttop; -print '

'; +//print $texttop; +//print '

'; print '
'; diff --git a/htdocs/blockedlog/admin/blockedlog_list.php b/htdocs/blockedlog/admin/blockedlog_list.php index eda4843e2a3..6bb1f40cf76 100644 --- a/htdocs/blockedlog/admin/blockedlog_list.php +++ b/htdocs/blockedlog/admin/blockedlog_list.php @@ -405,14 +405,14 @@ $morehtmlcenter = ''; $registrationnumber = getHashUniqueIdOfRegistration(); $texttop = ''.$langs->trans("RegistrationNumber").': '.dol_trunc($registrationnumber, 10).''; -print load_fiche_titre($title, $linkback, 'blockedlog', 0, '', '', $morehtmlcenter); +print load_fiche_titre($title.'
'.$texttop, $linkback, 'blockedlog', 0, '', '', $morehtmlcenter); $head = blockedlogadmin_prepare_head(GETPOST('withtab', 'alpha')); print dol_get_fiche_head($head, 'fingerprints', '', -1); -print $texttop; -print '

'; +//print $texttop; +//print '

'; print '
'; diff --git a/htdocs/takepos/receipt.php b/htdocs/takepos/receipt.php index 5c494e272e2..b4c96414112 100644 --- a/htdocs/takepos/receipt.php +++ b/htdocs/takepos/receipt.php @@ -30,7 +30,7 @@ */ -// Include main (when file in included into send.php, $action is set and main was already loaded) +// Include the main.inc.php (note: when file is included into send.php, $action is already set and main.inc.php was already loaded) /** * @var string $action */ @@ -272,7 +272,7 @@ if (isALNERunningVersion() && isModEnabled('blockedlog')) { } } - print "
".$langs->trans("SignatureID").': '.dol_trunc(strtoupper($unalterablelogid), 10).'
'; + print "
".$langs->trans("SignatureID").': '.dol_trunc(strtoupper($unalterablelogid), 10); } } @@ -281,10 +281,10 @@ $isADuplicata = $object->pos_print_counter; if ($object->status == $object::STATUS_CLOSED) { if ($isADuplicata) { - print '*** DUPLICATA***'; // Hard coded string + print '
*** DUPLICATA***'; // Hard coded string } } else { - print '*** '.strtoupper($langs->trans("TemporaryReceipt")).' ***'; // Hard coded string + print '
*** '.strtoupper($langs->trans("TemporaryReceipt")).' ***'; // Hard coded string } ?>

From f133fce8415a9b559d798be53de68c279926585f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 21 Dec 2025 16:04:12 +0100 Subject: [PATCH 08/19] Debug v23 --- htdocs/core/db/DoliDB.class.php | 13 ++++++++++ htdocs/core/db/mysqli.class.php | 24 ++++++++++++++++- htdocs/core/db/pgsql.class.php | 26 ++++++++++++++----- .../install/mysql/tables/llx_blockedlog.sql | 22 ++++++++-------- test/phpunit/DoliDBTest.php | 19 ++++++++++++++ 5 files changed, 86 insertions(+), 18 deletions(-) diff --git a/htdocs/core/db/DoliDB.class.php b/htdocs/core/db/DoliDB.class.php index 492428696f1..4e144d3356c 100644 --- a/htdocs/core/db/DoliDB.class.php +++ b/htdocs/core/db/DoliDB.class.php @@ -473,6 +473,19 @@ abstract class DoliDB implements Database return false; } + /** + * Get the last ID of an auto-increment field of a table + * + * @param string $table Name of table + * @return int Next ID or -1 if error + */ + public function getNextAutoIncrementId($table) + { + $this->lasterror = 'getNextAutoIncrementId() not implemented for this driver. Failed to get next ID for table '.$table; + + return -1; + } + /** * Prepare a SQL statement for execution * diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 72d713da892..6498e642322 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -603,7 +603,7 @@ class DoliDBMysqli extends DoliDB /** * Get last ID after an insert INSERT * - * @param string $tab Table name concerned by insert. Ne sert pas sous MySql mais requis pour compatibilite avec Postgresql + * @param string $tab Table name concerned by insert. Use of this could be avoided with MySql as last inset id is stored into the Mysqli object but we use it for compatibility with Postgresql * @param string $fieldid Field name * @return int|string Id of row */ @@ -1295,6 +1295,28 @@ class DoliDBMysqli extends DoliDB return $result; } + /** + * Get the last ID of an auto-increment field of a table + * + * @param string $table Name of table + * @return int Next ID or < 0 if error + */ + public function getNextAutoIncrementId($table) + { + // Request to get last status of table + $sql = "SHOW TABLE STATUS LIKE '".$this->escape($table)."'"; + $result = $this->query($sql); + + if ($result) { + $obj = $this->fetch_object($result); + if ($obj && isset($obj->Auto_increment)) { + return (int) $obj->Auto_increment; + } + } + + return -1; + } + /** * Prepare a SQL statement for execution * diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index d2f3f6ee8c8..9edb79fae41 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -855,18 +855,20 @@ class DoliDBPgsql extends DoliDB /** * Get last ID after an insert INSERT * - * @param string $tab Table name concerned by insert. Ne sert pas sous MySql mais requis pour compatibilite avec PostgreSQL + * @param string $table Table name concerned by insert. * @param string $fieldid Field name - * @return int Id of row + * @return int Id of row or -1 if error */ - public function last_insert_id($tab, $fieldid = 'rowid') + public function last_insert_id($table, $fieldid = 'rowid') { // phpcs:enable - //$result = pg_query($this->db,"SELECT MAX(".$fieldid.") FROM ".$tab); - $result = pg_query($this->db, "SELECT currval('".$tab."_".$fieldid."_seq')"); + $sequencename = $table."_".$fieldid."_seq"; + + //$result = pg_query($this->db,"SELECT MAX(".$fieldid.") FROM ".$table); + $result = pg_query($this->db, "SELECT currval('".$sequencename."')"); if (!$result) { print pg_last_error($this->db); - exit; + return -1; } //$nbre = pg_num_rows($result); $row = pg_fetch_result($result, 0, 0); @@ -1513,6 +1515,18 @@ class DoliDBPgsql extends DoliDB return array(); } + /** + * Get the last ID of an auto-increment field of a table + * + * @param string $table Name of table + * @return int Next ID or < 0 if error + */ + public function getNextAutoIncrementId($table) + { + return $this->last_insert_id($table, 'rowid') + 1; + } + + /** * Prepare a SQL statement for execution (PostgreSQL prepared statement) * diff --git a/htdocs/install/mysql/tables/llx_blockedlog.sql b/htdocs/install/mysql/tables/llx_blockedlog.sql index d1f879bd025..1b71992c1d2 100644 --- a/htdocs/install/mysql/tables/llx_blockedlog.sql +++ b/htdocs/install/mysql/tables/llx_blockedlog.sql @@ -1,5 +1,5 @@ -- =================================================================== --- Copyright (C) 2007 Laurent Destailleur +-- Copyright (C) 2007-2025 Laurent Destailleur -- -- 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 @@ -20,19 +20,19 @@ CREATE TABLE llx_blockedlog ( -- fields included into signature rowid integer AUTO_INCREMENT PRIMARY KEY, -- field included into line signature - entity integer DEFAULT 1 NOT NULL, -- field included into line signature - date_creation datetime, -- field included into line signature - action varchar(50), -- The type of event. field included into line signature + entity integer DEFAULT 1 NOT NULL, -- field included into line signature + date_creation datetime, -- field included into line signature + action varchar(50), -- The type of event. field included into line signature amounts double(24,8) NOT NULL, -- field included into line signature (denormalized data from object_data) - ref_object varchar(255), -- field included into line signature (denormalized data from object_data) - date_object datetime, -- field included into line signature (denormalized data from object_data) - user_fullname varchar(255), -- field included into line signature (denormalized data from object_data) - object_data mediumtext, -- field included into line signature - linktoref varchar(255), -- Link to ref. field included into line signature - linktype varchar(16), -- Link type. field included into line signature + ref_object varchar(255), -- field included into line signature (denormalized data from object_data) + date_object datetime, -- field included into line signature (denormalized data from object_data) + user_fullname varchar(255), -- field included into line signature (denormalized data from object_data) + object_data mediumtext, -- field included into line signature + linktoref varchar(255), -- Link to ref. field included into line signature + linktype varchar(16), -- Link type. field included into line signature -- the signature of line signature varchar(100) NOT NULL, -- the hash of the key for signature with previous hash before - -- fields used for debug only or to retreive link to more complete business events + -- fields used for debug only element varchar(50), fk_user integer, fk_object integer, diff --git a/test/phpunit/DoliDBTest.php b/test/phpunit/DoliDBTest.php index 0093f7e500e..a80bafd6f90 100644 --- a/test/phpunit/DoliDBTest.php +++ b/test/phpunit/DoliDBTest.php @@ -126,4 +126,23 @@ class DoliDBTest extends CommonClassTest return $result; } + + /** + * testGetNextAutoIncrementId + * + * @return int + */ + public function testGetNextAutoIncrementId() + { + global $conf,$user,$langs,$db; + $conf = $this->savconf; + $user = $this->savuser; + $langs = $this->savlangs; + $db = $this->savdb; + + print __METHOD__.' db->type = '.$db->type."\n"; + $result = $db->getNextAutoIncrementId(MAIN_DB_PREFIX.'blockedlog'); + $this->assertGreaterThan(0, $result); // Must be strictlyhigher than 0 + print __METHOD__." result=".$result."\n"; + } } From db7cccd588186fe2563fcfdf68cc52226f501401 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 21 Dec 2025 16:18:52 +0100 Subject: [PATCH 09/19] css --- htdocs/compta/facture/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index b33b69c1913..04cb1da6ad5 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -2767,7 +2767,7 @@ if ($num > 0) { // Author if (!empty($arrayfields['u.login']['checked'])) { - print '
'; + print ''; if ($userstatic->id) { print $userstatic->getNomUrl(-1); } else { From 94c06cca90050b0ffa0ad38290da9ff960068a81 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 21 Dec 2025 16:34:22 +0100 Subject: [PATCH 10/19] css --- htdocs/theme/eldy/global.inc.php | 2 ++ htdocs/theme/md/style.css.php | 2 ++ 2 files changed, 4 insertions(+) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 01ead94d236..3d958b06353 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -991,6 +991,8 @@ th .button { .maxwidthsearch { /* Max width of column with the search picto */ width: 54px; min-width: 54px; + padding-left: 4px !important; + padding-right: 4px !important; } .valigntop { vertical-align: top; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 9463c7985ca..9fdb3c2e774 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1156,6 +1156,8 @@ th .button { .maxwidthsearch { /* Max width of column with the search picto */ width: 54px; min-width: 54px; + padding-left: 4px !important; + padding-right: 4px !important; } .valigntop { From f88bb0bd5972f6f93621d70e3c84234deab0a538 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 21 Dec 2025 17:00:04 +0100 Subject: [PATCH 11/19] Debug v23 --- htdocs/core/lib/functions.lib.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index f8030669ac6..a56b072c70c 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -14128,8 +14128,8 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st /** * Function dolGetButtonAction * - * @param string $label Label or tooltip of button if $text is provided. Also used as tooltip in title attribute. Can be escaped HTML content or full simple text. - * @param string $text Optional : short label on button. Can be escaped HTML content or full simple text. + * @param string $label Label or tooltip of button if $text is provided. Also used as tooltip in title attribute. Can be escaped HTML content or full simple text. Used only if $url not defined. + * @param string $text Optional : short label on button. Can be escaped HTML content or full simple text. Used only if $url not defined. * @param string $actionType 'default', 'edit', 'danger', 'email', 'clone', 'cancel', 'delete', ... * @param string|array}> $url Url for link or array of subbutton description * Example when an array is used: @@ -14232,7 +14232,14 @@ function dolGetButtonAction($label, $text = '', $actionType = 'default', $url = $tmpurl = dolCompletUrlForDropdownButton($tmpurl, $params, empty($subbutton['urlroot'])); } - $out .= dolGetButtonAction('', $langs->trans($subbutton['label']), 'default', $tmpurl, '', $subbutton['perm'], $params); + $label = $langs->trans($subbutton['label']); + $text = $subbutton['text'] ?? ''; + if (empty($text)) { + $text = $label; + $label = ''; + } + + $out .= dolGetButtonAction($label, $text, 'default', $tmpurl, '', $subbutton['perm'], $params); } } From 16a7229d852cdedfd2bbe06290f515384709af2f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 21 Dec 2025 17:32:47 +0100 Subject: [PATCH 12/19] Doc --- htdocs/blockedlog/admin/blockedlog.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/blockedlog/admin/blockedlog.php b/htdocs/blockedlog/admin/blockedlog.php index 732dfcf3c90..ffe54611c6b 100644 --- a/htdocs/blockedlog/admin/blockedlog.php +++ b/htdocs/blockedlog/admin/blockedlog.php @@ -106,15 +106,15 @@ $morehtmlcenter = ''; $registrationnumber = getHashUniqueIdOfRegistration(); $texttop = ''.$langs->trans("RegistrationNumber").': '.dol_trunc($registrationnumber, 10).''; -print load_fiche_titre($title, $linkback, 'blockedlog', 0, '', '', $morehtmlcenter); +print load_fiche_titre($title.'
'.$texttop, $linkback, 'blockedlog', 0, '', '', $morehtmlcenter); if ($withtab) { $head = blockedlogadmin_prepare_head(GETPOST('withtab', 'alpha')); print dol_get_fiche_head($head, 'blockedlog', '', -1); } -print $texttop; -print '

'; +//print $texttop; +//print '

'; print ''.$langs->trans("BlockedLogDesc")."
\n"; From 0f30eb5f340bca044aa91da91c289d6382cddaff Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 22 Dec 2025 01:16:07 +0100 Subject: [PATCH 13/19] CSS --- htdocs/blockedlog/admin/blockedlog_archives.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/blockedlog/admin/blockedlog_archives.php b/htdocs/blockedlog/admin/blockedlog_archives.php index 270afc6e8cf..5a1932d2d07 100644 --- a/htdocs/blockedlog/admin/blockedlog_archives.php +++ b/htdocs/blockedlog/admin/blockedlog_archives.php @@ -546,7 +546,7 @@ print ''; print '
'; -print $langs->trans("RestrictYearToExport").': '; +print ''.$langs->trans("RestrictYearToExport").': '; // Month print $formother->select_month((string) GETPOSTINT('monthtoexport'), 'monthtoexport', $langs->trans("Month"), 0, 'minwidth50 maxwidth75imp valignmiddle', true); print ''; From edd53e41b3054646a517807fb7c79848da1fd34f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 22 Dec 2025 03:14:22 +0100 Subject: [PATCH 14/19] Debug v23 --- .travis.yml | 1 + htdocs/install/pgsql/functions/functions.sql | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 98182c9eda0..00d63d929c1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -557,6 +557,7 @@ script: php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_RECEPTION,MAIN_MODULE_RECRUITMENT >> $TRAVIS_BUILD_DIR/enablemodule.log php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_KnowledgeManagement,MAIN_MODULE_EventOrganization,MAIN_MODULE_PARTNERSHIP >> $TRAVIS_BUILD_DIR/enablemodule.log php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_EmailCollector >> $TRAVIS_BUILD_DIR/enablemodule.log + php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_BlockedLog >> $TRAVIS_BUILD_DIR/enablemodule.log echo $? cd - set +e diff --git a/htdocs/install/pgsql/functions/functions.sql b/htdocs/install/pgsql/functions/functions.sql index 3bd648e0c1a..a1a3f268d08 100644 --- a/htdocs/install/pgsql/functions/functions.sql +++ b/htdocs/install/pgsql/functions/functions.sql @@ -74,7 +74,6 @@ CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_bank FOR EACH ROW EX CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_bank_account FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_bank_account_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_blockedlog FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); -CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_blockedlog_authority FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_bordereau_cheque FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_boxes_def FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_c_email_templates FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); From b4a5167e784a33487636f2333014e2fc016b906c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 22 Dec 2025 03:27:48 +0100 Subject: [PATCH 15/19] Log of migration --- .travis.yml | 4 ++-- htdocs/install/upgrade2.php | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 00d63d929c1..032ade6b7be 100644 --- a/.travis.yml +++ b/.travis.yml @@ -535,9 +535,9 @@ script: echo - | - echo Show some debug info like table content or log + echo Show some debug info, like table content, or migration log from some versions #echo '\d llx_adherent' | psql 'postgresql://postgres:postgres@127.0.0.1:5432/travis' - cat $TRAVIS_BUILD_DIR/upgrade18001900.log + cat $TRAVIS_BUILD_DIR/upgrade500600.log cat $TRAVIS_BUILD_DIR/upgrade19002000.log echo diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 130f3d7275b..7b79975a204 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -270,6 +270,8 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ * ***************************************************************************************/ + dol_syslog("Process upgrade2 (step common to all entities)"); + // Force to execute this at begin to avoid the new core code into Dolibarr to be broken. $sql = 'ALTER TABLE '.MAIN_DB_PREFIX.'user ADD COLUMN birth date'; $db->query($sql, 1); @@ -298,7 +300,7 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ $db->begin(); foreach ($listofentities as $entity) { - dol_syslog("Process upgrade2 for entity ".$entity); + dol_syslog("Process upgrade2 (step a) for entity ".$entity); // Set $conf context for entity $conf->setEntityValues($db, $entity); @@ -313,7 +315,7 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ $versiontoarray = array(); $versionranarray = array(); - dol_syslog("Process upgrade2 d for entity ".$entity); + dol_syslog("Process upgrade2 (step b) for entity ".$entity); if (!$error) { if (count($listofentities) > 1) { From a6d1b2235e050aff94db50778d55872781c44748 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 22 Dec 2025 03:45:20 +0100 Subject: [PATCH 16/19] Try to fix CI for pgsql --- .travis.yml | 2 +- test/phpunit/BlockedLogAndLNETest.php | 21 +++++++++++++++++++++ test/phpunit/DoliDBTest.php | 19 ------------------- test/phpunit/PgsqlTest.php | 7 +++++++ 4 files changed, 29 insertions(+), 20 deletions(-) diff --git a/.travis.yml b/.travis.yml index 032ade6b7be..c0207ddc95c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -536,7 +536,7 @@ script: - | echo Show some debug info, like table content, or migration log from some versions - #echo '\d llx_adherent' | psql 'postgresql://postgres:postgres@127.0.0.1:5432/travis' + echo '\d llx_blockedlog' | psql 'postgresql://postgres:postgres@127.0.0.1:5432/travis' cat $TRAVIS_BUILD_DIR/upgrade500600.log cat $TRAVIS_BUILD_DIR/upgrade19002000.log echo diff --git a/test/phpunit/BlockedLogAndLNETest.php b/test/phpunit/BlockedLogAndLNETest.php index 741842d92fc..9f159213d01 100644 --- a/test/phpunit/BlockedLogAndLNETest.php +++ b/test/phpunit/BlockedLogAndLNETest.php @@ -83,6 +83,27 @@ class BlockedLogAndLNETest extends CommonClassTest } + /** + * testGetNextAutoIncrementId + * This test must be done after a creation of a first record. + * + * @return int + */ + public function testGetNextAutoIncrementId() + { + global $conf,$user,$langs,$db; + $conf = $this->savconf; + $user = $this->savuser; + $langs = $this->savlangs; + $db = $this->savdb; + + print __METHOD__.' db->type = '.$db->type."\n"; + $result = $db->getNextAutoIncrementId(MAIN_DB_PREFIX.'blockedlog'); + $this->assertGreaterThan(0, $result); // Must be strictlyhigher than 0 + print __METHOD__." result=".$result."\n"; + } + + // TODO Add more tests // #LNExxx } diff --git a/test/phpunit/DoliDBTest.php b/test/phpunit/DoliDBTest.php index a80bafd6f90..0093f7e500e 100644 --- a/test/phpunit/DoliDBTest.php +++ b/test/phpunit/DoliDBTest.php @@ -126,23 +126,4 @@ class DoliDBTest extends CommonClassTest return $result; } - - /** - * testGetNextAutoIncrementId - * - * @return int - */ - public function testGetNextAutoIncrementId() - { - global $conf,$user,$langs,$db; - $conf = $this->savconf; - $user = $this->savuser; - $langs = $this->savlangs; - $db = $this->savdb; - - print __METHOD__.' db->type = '.$db->type."\n"; - $result = $db->getNextAutoIncrementId(MAIN_DB_PREFIX.'blockedlog'); - $this->assertGreaterThan(0, $result); // Must be strictlyhigher than 0 - print __METHOD__." result=".$result."\n"; - } } diff --git a/test/phpunit/PgsqlTest.php b/test/phpunit/PgsqlTest.php index 2758665304e..9c7e7eddb36 100644 --- a/test/phpunit/PgsqlTest.php +++ b/test/phpunit/PgsqlTest.php @@ -123,6 +123,13 @@ class PgsqlTest extends CommonClassTest print __METHOD__." result=".$result."\n"; $this->assertEquals($result, "SELECT a.b, STRING_AGG(a.c::TEXT, ','::TEXT) FROM table GROUP BY a.b", 'Test GROUP_CONCAT (with SEPARATOR)'); + // Test CREATE TABLE + $sql = "CREATE TABLE llx_blockedlog ( rowid integer AUTO_INCREMENT PRIMARY KEY, tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, action varchar(50), amounts real NOT NULL, signature varchar(100) NOT NULL, signature_line varchar(100) NOT NULL, element varchar(50), fk_object integer, ref_object varchar(100), date_object datetime, object_data text, fk_user integer, entity integer DEFAULT 1 NOT NULL, certified integer ) ENGINE=innodb;"; + $result = $tmpdb->convertSQLFromMysql($sql); + print __METHOD__." result=".$result."\n"; + $this->assertEquals($result, "CREATE TABLE llx_blockedlog ( rowid SERIAL PRIMARY KEY, tms timestamp without time zone DEFAULT now() NOT NULL , action varchar(50), amounts real NOT NULL, signature varchar(100) NOT NULL, signature_line varchar(100) NOT NULL, element varchar(50), fk_object integer, ref_object varchar(100), date_object timestamp, object_data text, fk_user integer, entity integer DEFAULT 1 NOT NULL, certified integer );"); + + return $result; } } From 8db3a2e4fcaf1f42d33c62ddbf82619043ad4ce1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 22 Dec 2025 04:52:12 +0100 Subject: [PATCH 17/19] Move algo for checksum file --- .pre-commit-config.yaml | 17 ++++---- dev/build/.gitignore | 1 + dev/build/generate_filelist_xml.php | 60 ++++++++++++++------------- dev/build/makepack-dolibarr.pl | 2 +- dev/lockedfiles.txt | 4 +- htdocs/blockedlog/admin/filecheck.php | 37 +++++++++++------ htdocs/core/lib/files.lib.php | 29 ++++++++----- htdocs/langs/en_US/admin.lang | 4 +- 8 files changed, 90 insertions(+), 64 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 91babc17efe..b9aab4928c1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -284,11 +284,12 @@ repos: (dev/build/perl/virtualmin/dolibarr.pl )$ args: [ --tabs, --nola ] - - repo: https://github.com/henryykt/pre-commit-perl - rev: v0.0.5 - hooks: - - id: perlcritic - # virtualmin excuded - reason https://github.com/Dolibarr/dolibarr/pull/36370#issuecomment-3565101823 - exclude: (?x)^ - (dev/build/perl/virtualmin/dolibarr.pl - )$ + + #- repo: https://github.com/henryykt/pre-commit-perl + # rev: v0.0.5 + # hooks: + # - id: perlcritic + # # virtualmin excluded - reason https://github.com/Dolibarr/dolibarr/pull/36370#issuecomment-3565101823 + # exclude: (?x)^ + # (dev/build/perl/virtualmin/dolibarr.pl + # )$ diff --git a/dev/build/.gitignore b/dev/build/.gitignore index 54c5d8be9c3..6c69990aaf4 100644 --- a/dev/build/.gitignore +++ b/dev/build/.gitignore @@ -7,3 +7,4 @@ /dolibarr-*.zip /*.exe /html +/makepack-dolibarr.pl.bak diff --git a/dev/build/generate_filelist_xml.php b/dev/build/generate_filelist_xml.php index 9ecf3751344..fb0b976a12d 100755 --- a/dev/build/generate_filelist_xml.php +++ b/dev/build/generate_filelist_xml.php @@ -40,6 +40,8 @@ if (substr($sapi_type, 0, 3) == 'cgi') { define('DOL_DOCUMENT_ROOT', dirname(dirname($path)).'/htdocs'); +$algo = 'sha256'; + require_once $path."../../htdocs/master.inc.php"; require_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"; @@ -231,7 +233,7 @@ if ($release) { $gitcommit = trim($fileforgitcontent); fputs($fp, ''."\n"); - fputs($fp, ''."\n"); + fputs($fp, ''."\n"); foreach ($includeconstants as $countrycode => $tmp) { fputs($fp, ''."\n"); @@ -265,9 +267,9 @@ if ($release) { $needtoclose = 1; } if (filetype($file) == "file") { - $md5 = md5_file($file); - $checksumconcat[] = $md5; - fputs($fp, ' '.$md5.''."\n"); + $hashoffile = hash_file($algo, $file); + $checksumconcat[] = $hashoffile; + fputs($fp, ' <'.$algo.'file name="'.basename($file).'" size="'.filesize($file).'">'.$hashoffile.''."\n"); } } if ($needtoclose) { @@ -277,10 +279,10 @@ if ($release) { fputs($fp, ''."\n"); asort($checksumconcat); // Sort list of checksum - $md5htdocsdir = md5(join(',', $checksumconcat)); + $hashhtdocsdir = hash($algo, join(',', $checksumconcat)); fputs($fp, ''."\n"); - fputs($fp, $md5htdocsdir."\n"); + fputs($fp, $hashhtdocsdir."\n"); fputs($fp, ''."\n\n"); @@ -308,9 +310,9 @@ if ($release) { $needtoclose = 1; } if (filetype($file) == "file") { - $md5 = md5_file($file); - $checksumconcat[] = $md5; - fputs($fp, ' '.$md5.''."\n"); + $hashoffile = hash_file($algo, $file); + $checksumconcat[] = $hashoffile; + fputs($fp, ' <'.$algo.'file name="'.basename($file).'" size="'.filesize($file).'">'.$hashoffile.''."\n"); } } if ($needtoclose) { @@ -320,10 +322,10 @@ if ($release) { fputs($fp, ''."\n"); asort($checksumconcat); // Sort list of checksum - $md5scriptsdir = md5(join(',', $checksumconcat)); + $hashscriptsdir = hash($algo, join(',', $checksumconcat)); fputs($fp, ''."\n"); - fputs($fp, $md5scriptsdir."\n"); + fputs($fp, $hashscriptsdir."\n"); fputs($fp, ''."\n\n"); } @@ -371,10 +373,10 @@ foreach ($arrayofunalterablefiles as $entry) { $needtoclose = 1; } if (filetype($file) == "file") { - $md5 = md5_file($file); - $checksumconcat[] = $md5; + $hashoffile = hash_file($algo, $file); + $checksumconcat[] = $hashoffile; if ($release) { - fputs($fp, ' '.$md5.''."\n"); + fputs($fp, ' <'.$algo.'file name="'.basename($file).'" size="'.filesize($file).'">'.$hashoffile.''."\n"); } } } @@ -407,10 +409,10 @@ foreach ($arrayofunalterablefiles as $entry) { $needtoclose = 1; } if (filetype($file) == "file") { - $md5 = md5_file($file); - $checksumconcat[] = $md5; + $hashoffile = hash_file($algo, $file); + $checksumconcat[] = $hashoffile; if ($release) { - fputs($fp, ' '.$md5.''."\n"); + fputs($fp, ' <'.$algo.'file name="'.basename($file).'" size="'.filesize($file).'">'.$hashoffile.''."\n"); } } if ($needtoclose) { @@ -423,13 +425,13 @@ foreach ($arrayofunalterablefiles as $entry) { } asort($checksumconcat); // Sort list of checksum -$md5unalterable_files = md5(join(',', $checksumconcat)); +$hashunalterable_files = hash($algo, join(',', $checksumconcat)); if ($release) { fputs($fp, ''."\n"); fputs($fp, ''."\n"); - fputs($fp, $md5unalterable_files."\n"); + fputs($fp, $hashunalterable_files."\n"); fputs($fp, ''."\n\n"); // End of file @@ -443,9 +445,9 @@ print "\n"; if ($release) { if (empty($buildzip)) { print "File ".$outputfile." generated.\n"; - print "Signature for htdocs files: ".$md5htdocsdir."\n"; - print "Signature for scripts files: ".$md5scriptsdir."\n"; - print "Signature for the ".count($checksumconcat)." unalterable files: ".$md5unalterable_files."\n"; + print "Signature for htdocs files: ".$hashhtdocsdir."\n"; + print "Signature for scripts files: ".$hashscriptsdir."\n"; + print "Signature for the ".count($checksumconcat)." unalterable files: ".$hashunalterable_files."\n"; } else { if ($buildzip == '1' || $buildzip == 'zip') { $result = dol_compress_file($outputfile, $outputfile.'.zip', 'zip'); @@ -464,7 +466,7 @@ if ($release) { } if ($checklock) { - print "Signature for unalterable files: ".$md5unalterable_files."\n"; + print "Signature for unalterable files: ".$algo." ".$hashunalterable_files."\n"; $lockedfile = DOL_DOCUMENT_ROOT.'/../dev/lockedfiles.txt'; $checksuminlockedfile = ''; @@ -475,15 +477,15 @@ if ($checklock) { // Now we check the content of lockedfiles.txt $arraylocked = file($lockedfile); foreach ($arraylocked as $line) { - $tmparray = preg_split("/\s+/", $line, 3); - if ($tmparray[0] == $checklockmajorversion) { - $checksuminlockedfile = $tmparray[2]; + $tmparray = preg_split("/\s+/", $line, 4); + if ($tmparray[0] == $checklockmajorversion && $tmparray[2] == $algo) { + $checksuminlockedfile = $tmparray[3]; } } if (empty($checksuminlockedfile)) { - print "The major version ".$checklockmajorversion." is not locked on the scope ".$checksource." (file found but no matching entry found into dev/lockedfiles.txt).\n"; - } elseif ($checksuminlockedfile != $md5unalterable_files) { - print "The major version ".$checklockmajorversion." is locked on scope '".$checksource."' to checksum ".$checksuminlockedfile."\n"; + print "The major version ".$checklockmajorversion." is not locked on the scope '".$checksource."' (file found but no matching entry found into dev/lockedfiles.txt).\n"; + } elseif ($checksuminlockedfile != $hashunalterable_files) { + print "The major version ".$checklockmajorversion." is locked on scope '".$checksource."' to checksum ".$algo." ".$checksuminlockedfile."\n"; if ($checklockmajorversion != $checksource) { print "The checksum now differs from the locked one, so we return an error.\n"; print "\n"; diff --git a/dev/build/makepack-dolibarr.pl b/dev/build/makepack-dolibarr.pl index 6aa331f050d..29b1285cce0 100755 --- a/dev/build/makepack-dolibarr.pl +++ b/dev/build/makepack-dolibarr.pl @@ -14,7 +14,7 @@ #---------------------------------------------------------------------------- ## no critic (InputOutput::ProhibitExplicitStdin,InputOutput::RequireBriefOpen) -use strict; +#use strict; use warnings; use Cwd; use Term::ANSIColor; diff --git a/dev/lockedfiles.txt b/dev/lockedfiles.txt index 687076e05ab..656c64e857e 100644 --- a/dev/lockedfiles.txt +++ b/dev/lockedfiles.txt @@ -2,6 +2,6 @@ This file is the list of the signatures of some set of files locked to block a commit if files are tried to be modified for a given version. It is used by the CI or the script to check and guarantee that no change is done on a given scope of files. -Version Scope Signature (generated by dev/build/generate_filelist_xml.php) that must remain unchanged for this couple version/scope +Version Scope Algo Signature (generated by dev/build/generate_filelist_xml.php) that must remain unchanged for this couple version/scope -x.0.0 unalterable_files 123456 +23.0.0 unalterable_files sha256 123456 diff --git a/htdocs/blockedlog/admin/filecheck.php b/htdocs/blockedlog/admin/filecheck.php index 7045dc93e3b..87c976b9f7f 100644 --- a/htdocs/blockedlog/admin/filecheck.php +++ b/htdocs/blockedlog/admin/filecheck.php @@ -233,6 +233,9 @@ if (empty($error) && !empty($xml)) { $file_list = array(); $out = ''; + //$algo = 'md5'; // For v22- + $algo = 'sha256'; // For v23+ + // Forced constants if (is_object($xml->dolibarr_constants[0]) || $mode == 'unalterable') { $out .= load_fiche_titre($langs->trans("ForcedConstants")); @@ -349,6 +352,7 @@ if (empty($error) && !empty($xml)) { $onlymodifiedorremoved = 0; } + // Scan htdocs if (is_object($listoffilestoanalyze)) { // @phan-suppress-next-line PhanTypeArraySuspicious @@ -361,15 +365,15 @@ if (empty($error) && !empty($xml)) { // Fill file_list with files in signature, new files, modified files getFilesUpdated($file_list, $listoffilestoanalyze, '', DOL_DOCUMENT_ROOT, $checksumconcat); // Fill array $file_list - '@phan-var-force array{insignature:string[],missing?:array,updated:array} $file_list'; + '@phan-var-force array{insignature:string[],missing?:array,updated:array} $file_list'; // Complete with list of new files into $file_list['added'] - if ($onlymodifiedorremoved) { + if (empty($onlymodifiedorremoved)) { foreach ($scanfiles as $valfile) { $tmprelativefilename = preg_replace('/^'.preg_quote(DOL_DOCUMENT_ROOT, '/').'/', '', $valfile['fullname']); if (!in_array($tmprelativefilename, $file_list['insignature'])) { - $md5newfile = @md5_file($valfile['fullname']); // Can fails if we don't have permission to open/read file - $file_list['added'][] = array('filename' => $tmprelativefilename, 'md5' => $md5newfile); + $hashnewfile = @hash_file($algo, $valfile['fullname']); // Can fails if we don't have permission to open/read file + $file_list['added'][] = array('filename' => $tmprelativefilename, 'hash' => $hashnewfile, 'algo' => $algo); } } } @@ -398,7 +402,7 @@ if (empty($error) && !empty($xml)) { $out .= dol_print_size((int) $file['expectedsize']); } $out .= '
'.dol_escape_htmltag($file['expectedmd5']).''.dol_escape_htmltag($file['expectedhash']).'
'.$i.''.dol_escape_htmltag($file['filename']).''.dol_escape_htmltag($file['expectedmd5']).''.dol_escape_htmltag($file['md5']).''.dol_escape_htmltag($file['expectedhash']).''.dol_escape_htmltag($file['hash']).''; if ($file['expectedsize']) { $out .= dol_print_size((int) $file['expectedsize']); @@ -490,8 +494,8 @@ if (empty($error) && !empty($xml)) { $out .= ' '.$form->textwithpicto('', $htmltext, 1, 'help', '', 0, 2, 'helprm'.$i); } $out .= ''.dol_escape_htmltag((string) $file['expectedmd5']).''.dol_escape_htmltag($file['md5']).''.dol_escape_htmltag((string) $file['expectedhash']).''.dol_escape_htmltag($file['hash']).''.dol_print_size($size).'