From 76c9b25569e97a805a922fcdf045cf86e4e38f77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= <142790847+clementgde@users.noreply.github.com> Date: Tue, 10 Dec 2024 00:13:38 +0100 Subject: [PATCH 01/77] Add doActions on project documents --- htdocs/projet/document.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/projet/document.php b/htdocs/projet/document.php index 83c5416ceea..6fd7fd80717 100644 --- a/htdocs/projet/document.php +++ b/htdocs/projet/document.php @@ -101,6 +101,12 @@ $permissiontoadd = $user->hasRight('projet', 'creer'); * Actions */ +$parameters = array(); +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); +} + include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; From 2c58bcc0b355f9cec623a273fd0f6b61c5cedadf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= <142790847+clementgde@users.noreply.github.com> Date: Tue, 10 Dec 2024 00:16:02 +0100 Subject: [PATCH 02/77] FIX To avoid sending an empty object to doActions --- htdocs/projet/messaging.php | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/htdocs/projet/messaging.php b/htdocs/projet/messaging.php index 065985317fa..68dc434f4a1 100644 --- a/htdocs/projet/messaging.php +++ b/htdocs/projet/messaging.php @@ -93,6 +93,17 @@ if (!$user->hasRight('projet', 'lire')) { * Actions */ +$object = new Project($db); + +if ($id > 0 || !empty($ref)) { + $object->fetch($id, $ref); + $object->fetch_thirdparty(); + if (getDolGlobalString('PROJECT_ALLOW_COMMENT_ON_PROJECT') && method_exists($object, 'fetchComments') && empty($object->comments)) { + $object->fetchComments(); + } + $object->info($object->id); +} + $parameters = array('id' => $socid); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { @@ -112,16 +123,6 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' */ $form = new Form($db); -$object = new Project($db); - -if ($id > 0 || !empty($ref)) { - $object->fetch($id, $ref); - $object->fetch_thirdparty(); - if (getDolGlobalString('PROJECT_ALLOW_COMMENT_ON_PROJECT') && method_exists($object, 'fetchComments') && empty($object->comments)) { - $object->fetchComments(); - } - $object->info($object->id); -} $agenda = (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) ? '/'.$langs->trans("Agenda") : ''; $title = $langs->trans('Events').$agenda.' - '.$object->ref.' '.$object->name; if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/projectnameonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $object->name) { From 0b0ea7dd7c9b32ff0cb8830bd122d88e81415331 Mon Sep 17 00:00:00 2001 From: Pichi1966 <57623859+josett225@users.noreply.github.com> Date: Tue, 10 Dec 2024 00:36:29 +0100 Subject: [PATCH 03/77] Update card.php with gmt --- htdocs/asset/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/asset/card.php b/htdocs/asset/card.php index 9531347d580..9b6e857f8fa 100644 --- a/htdocs/asset/card.php +++ b/htdocs/asset/card.php @@ -132,7 +132,7 @@ if (empty($reshook)) { // Action dispose object if ($action == 'confirm_disposal' && $confirm == 'yes' && $permissiontoadd) { - $object->disposal_date = dol_mktime(12, 0, 0, GETPOSTINT('disposal_datemonth'), GETPOSTINT('disposal_dateday'), GETPOSTINT('disposal_dateyear')); // for date without hour, we use gmt + $object->disposal_date = dol_mktime(0, 0, 0, GETPOSTINT('disposal_datemonth'), GETPOSTINT('disposal_dateday'), GETPOSTINT('disposal_dateyear'), 'gmt'); // for date without hour, we use gmt $object->disposal_amount_ht = GETPOSTINT('disposal_amount'); $object->fk_disposal_type = GETPOSTINT('fk_disposal_type'); $disposal_invoice_id = GETPOSTINT('disposal_invoice_id'); @@ -273,7 +273,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Disposal $langs->load('bills'); - $disposal_date = dol_mktime(12, 0, 0, GETPOSTINT('disposal_datemonth'), GETPOSTINT('disposal_dateday'), GETPOSTINT('disposal_dateyear')); // for date without hour, we use gmt + $disposal_date = dol_mktime(0, 0, 0, GETPOSTINT('disposal_datemonth'), GETPOSTINT('disposal_dateday'), GETPOSTINT('disposal_dateyear'), 'gmt'); // for date without hour, we use gmt $disposal_amount = GETPOSTINT('disposal_amount'); $fk_disposal_type = GETPOSTINT('fk_disposal_type'); $disposal_invoice_id = GETPOSTINT('disposal_invoice_id'); From 855b609e43983d23c5c83137e58a65db3f7a033b Mon Sep 17 00:00:00 2001 From: Pichi1966 <57623859+josett225@users.noreply.github.com> Date: Tue, 10 Dec 2024 00:52:04 +0100 Subject: [PATCH 04/77] Update assetdepreciationoptions.class.php --- htdocs/asset/class/assetdepreciationoptions.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/asset/class/assetdepreciationoptions.class.php b/htdocs/asset/class/assetdepreciationoptions.class.php index 33bbb0f28cb..ecd6d276726 100644 --- a/htdocs/asset/class/assetdepreciationoptions.class.php +++ b/htdocs/asset/class/assetdepreciationoptions.class.php @@ -262,7 +262,7 @@ class AssetDepreciationOptions extends CommonObject if (in_array($field_info['type'], array('text', 'html'))) { $value = GETPOST($html_name, 'restricthtml'); } elseif ($field_info['type'] == 'date') { - $value = dol_mktime(12, 0, 0, GETPOSTINT($html_name . 'month'), GETPOSTINT($html_name . 'day'), GETPOSTINT($html_name . 'year')); // for date without hour, we use gmt + $value = dol_mktime(0, 0, 0, GETPOSTINT($html_name . 'month'), GETPOSTINT($html_name . 'day'), GETPOSTINT($html_name . 'year'), 'gmt'); // for date without hour, we use gmt } elseif ($field_info['type'] == 'datetime') { $value = dol_mktime(GETPOSTINT($html_name . 'hour'), GETPOSTINT($html_name . 'min'), GETPOSTINT($html_name . 'sec'), GETPOSTINT($html_name . 'month'), GETPOSTINT($html_name . 'day'), GETPOSTINT($html_name . 'year'), 'tzuserrel'); } elseif ($field_info['type'] == 'duration') { From cf83ff70ef8abc3cfddd6e12630c767cecbffc46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 10 Dec 2024 09:47:42 +0100 Subject: [PATCH 05/77] fix CI --- htdocs/compta/bank/class/paymentvarious.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/bank/class/paymentvarious.class.php b/htdocs/compta/bank/class/paymentvarious.class.php index d5f006e609c..836390e4188 100644 --- a/htdocs/compta/bank/class/paymentvarious.class.php +++ b/htdocs/compta/bank/class/paymentvarious.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2018-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024 MDW * * 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 @@ -845,7 +845,7 @@ class PaymentVarious extends CommonObject if ($selected >= 0) { $return .= ''; } - if (!empty($bankline)) { + if (!empty($bankline) && $bankline instanceof AccountLine) { $return .= ' | '.$bankline->getNomUrl(1).''; } if (property_exists($this, 'datep')) { From 0983b8f2e62aecc283895e2af55583ad6502e5b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 10 Dec 2024 09:57:54 +0100 Subject: [PATCH 06/77] Update mails_senderprofile_list.php --- htdocs/admin/mails_senderprofile_list.php | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/htdocs/admin/mails_senderprofile_list.php b/htdocs/admin/mails_senderprofile_list.php index bddeb8ffd1e..9858633014c 100644 --- a/htdocs/admin/mails_senderprofile_list.php +++ b/htdocs/admin/mails_senderprofile_list.php @@ -1,8 +1,8 @@ - * Copyright (C) 2018 Ferran Marcet +/* Copyright (C) 2007-2017 Laurent Destailleur + * Copyright (C) 2018 Ferran Marcet * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024 MDW * * 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 @@ -805,12 +805,9 @@ while ($i < $imaxinloop) { if ($page) { $url .= '&page='.urlencode((string) ($page)); } - if ($sortfield) { - $url .= '&sortfield='.urlencode($sortfield); - } - if ($sortorder) { - $url .= '&page='.urlencode($sortorder); - } + $url .= '&sortfield='.urlencode($sortfield); + $url .= '&page='.urlencode($sortorder); + print ''.img_edit().''; //print '   '; print ''.img_delete().'   '; From 79570abbd4f12234f30debd5a2748fcdfe933829 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 10 Dec 2024 10:17:17 +0100 Subject: [PATCH 07/77] Update mails_senderprofile_list.php --- htdocs/admin/mails_senderprofile_list.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/mails_senderprofile_list.php b/htdocs/admin/mails_senderprofile_list.php index 9858633014c..b49a9c78017 100644 --- a/htdocs/admin/mails_senderprofile_list.php +++ b/htdocs/admin/mails_senderprofile_list.php @@ -803,10 +803,10 @@ while ($i < $imaxinloop) { $url .= '&limit='.((int) $limit); } if ($page) { - $url .= '&page='.urlencode((string) ($page)); + $url .= '&page='.urlencode((string) $page); } - $url .= '&sortfield='.urlencode($sortfield); - $url .= '&page='.urlencode($sortorder); + $url .= '&sortfield='.urlencode((string) $sortfield); + $url .= '&page='.urlencode((string) $sortorder); print ''.img_edit().''; //print '   '; From 573a7b36c6ea46a9b7d8ba9803be69f0281c33f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 10 Dec 2024 10:31:06 +0100 Subject: [PATCH 08/77] Update mails_senderprofile_list.php --- htdocs/admin/mails_senderprofile_list.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/admin/mails_senderprofile_list.php b/htdocs/admin/mails_senderprofile_list.php index b49a9c78017..a586d8407bb 100644 --- a/htdocs/admin/mails_senderprofile_list.php +++ b/htdocs/admin/mails_senderprofile_list.php @@ -824,7 +824,6 @@ while ($i < $imaxinloop) { } } - print ''."\n"; } From d542b21244631b7e2826445d7202fa6b3a35edf7 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Tue, 10 Dec 2024 11:54:33 +0100 Subject: [PATCH 09/77] Debug v2 fix ufs for next_prev_filter --- htdocs/eventorganization/conferenceorbooth_card.php | 2 +- htdocs/eventorganization/conferenceorbooth_contact.php | 2 +- htdocs/eventorganization/conferenceorbooth_document.php | 2 +- htdocs/eventorganization/conferenceorbooth_list.php | 2 +- htdocs/eventorganization/conferenceorboothattendee_card.php | 2 +- htdocs/eventorganization/conferenceorboothattendee_list.php | 2 +- htdocs/projet/agenda.php | 2 +- htdocs/projet/card.php | 2 +- htdocs/projet/comment.php | 2 +- htdocs/projet/contact.php | 2 +- htdocs/projet/document.php | 2 +- htdocs/projet/element.php | 2 +- htdocs/projet/ganttview.php | 2 +- htdocs/projet/messaging.php | 2 +- htdocs/projet/note.php | 2 +- htdocs/projet/tasks.php | 2 +- htdocs/projet/tasks/comment.php | 4 ++-- htdocs/projet/tasks/contact.php | 4 ++-- htdocs/projet/tasks/document.php | 4 ++-- htdocs/projet/tasks/note.php | 4 ++-- htdocs/projet/tasks/task.php | 4 ++-- htdocs/projet/tasks/time.php | 4 ++-- htdocs/societe/class/client.class.php | 2 +- htdocs/ticket/card.php | 2 +- htdocs/ticket/list.php | 2 +- test/other/test_dol_escape_htmltag.php | 2 ++ 26 files changed, 33 insertions(+), 31 deletions(-) diff --git a/htdocs/eventorganization/conferenceorbooth_card.php b/htdocs/eventorganization/conferenceorbooth_card.php index 6df36447088..69162c5fca8 100644 --- a/htdocs/eventorganization/conferenceorbooth_card.php +++ b/htdocs/eventorganization/conferenceorbooth_card.php @@ -228,7 +228,7 @@ if (!empty($withproject)) { // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('project', 'all', 'lire')) { $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0); - $projectstatic->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $projectstatic->next_prev_filter = "rowid:IN:".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0'); } dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/eventorganization/conferenceorbooth_contact.php b/htdocs/eventorganization/conferenceorbooth_contact.php index 8748ea0d15d..dd8d9b6aa3f 100644 --- a/htdocs/eventorganization/conferenceorbooth_contact.php +++ b/htdocs/eventorganization/conferenceorbooth_contact.php @@ -206,7 +206,7 @@ if (!empty($withproject)) { // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('project', 'all', 'lire')) { $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0); - $projectstatic->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $projectstatic->next_prev_filter = "rowid:IN:".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0'); } dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/eventorganization/conferenceorbooth_document.php b/htdocs/eventorganization/conferenceorbooth_document.php index efd21894b7d..e561ae99265 100644 --- a/htdocs/eventorganization/conferenceorbooth_document.php +++ b/htdocs/eventorganization/conferenceorbooth_document.php @@ -180,7 +180,7 @@ if (!empty($withproject)) { // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('project', 'all', 'lire')) { $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0); - $projectstatic->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $projectstatic->next_prev_filter = "rowid:IN:".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0'); } dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/eventorganization/conferenceorbooth_list.php b/htdocs/eventorganization/conferenceorbooth_list.php index d03ffe9ed1b..46bb260a6be 100644 --- a/htdocs/eventorganization/conferenceorbooth_list.php +++ b/htdocs/eventorganization/conferenceorbooth_list.php @@ -342,7 +342,7 @@ if ($projectid > 0) { // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('project', 'all', 'lire')) { $objectsListId = $project->getProjectsAuthorizedForUser($user, 0, 0); - $project->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $project->next_prev_filter = "rowid:IN:".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0'); } dol_banner_tab($project, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/eventorganization/conferenceorboothattendee_card.php b/htdocs/eventorganization/conferenceorboothattendee_card.php index 3014cab7a8d..b7010dadaf5 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_card.php +++ b/htdocs/eventorganization/conferenceorboothattendee_card.php @@ -256,7 +256,7 @@ if (!empty($withproject)) { // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('projet', 'all', 'lire')) { $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0); - $projectstatic->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $projectstatic->next_prev_filter = "rowid:IN:".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0'); } dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/eventorganization/conferenceorboothattendee_list.php b/htdocs/eventorganization/conferenceorboothattendee_list.php index 1474a71eef6..c5934e13ecd 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_list.php +++ b/htdocs/eventorganization/conferenceorboothattendee_list.php @@ -441,7 +441,7 @@ if ($projectstatic->id > 0 || $confOrBooth > 0) { // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('projet', 'all', 'lire')) { $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0); - $projectstatic->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $projectstatic->next_prev_filter = "rowid:IN:".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0'); } dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/projet/agenda.php b/htdocs/projet/agenda.php index 3aa654d4a65..256cf2d74a2 100644 --- a/htdocs/projet/agenda.php +++ b/htdocs/projet/agenda.php @@ -157,7 +157,7 @@ $morehtmlref .= ''; // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('projet', 'all', 'lire')) { $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0); - $object->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $object->next_prev_filter = "rowid:IN:".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0'); } dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 74f93c4505e..0eb947f56a6 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -1365,7 +1365,7 @@ if ($action == 'create' && $user->hasRight('projet', 'creer')) { // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('projet', 'all', 'lire')) { $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0); - $object->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $object->next_prev_filter = "rowid:IN:".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0'); } dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/projet/comment.php b/htdocs/projet/comment.php index e02404f9838..f116b941dcc 100644 --- a/htdocs/projet/comment.php +++ b/htdocs/projet/comment.php @@ -128,7 +128,7 @@ $morehtmlref .= ''; // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('projet', 'all', 'lire')) { $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0); - $object->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $object->next_prev_filter = "rowid:IN:".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0'); } dol_banner_tab($object, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php index ce89643f847..4f2dde28a50 100644 --- a/htdocs/projet/contact.php +++ b/htdocs/projet/contact.php @@ -380,7 +380,7 @@ if ($id > 0 || !empty($ref)) { // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('projet', 'all', 'lire')) { $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0); - $object->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $object->next_prev_filter = "rowid:IN:".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0'); } dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/projet/document.php b/htdocs/projet/document.php index 83c5416ceea..2830d46fa42 100644 --- a/htdocs/projet/document.php +++ b/htdocs/projet/document.php @@ -161,7 +161,7 @@ if ($object->id > 0) { // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('projet', 'all', 'lire')) { $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0); - $object->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $object->next_prev_filter = "rowid:IN:".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0'); } dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 9c23e556c57..6f3e138c587 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -267,7 +267,7 @@ $morehtmlref .= ''; // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('projet', 'all', 'lire')) { $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0); - $object->next_prev_filter = "te.rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $object->next_prev_filter = "te.rowid:IN:".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0'); } dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/projet/ganttview.php b/htdocs/projet/ganttview.php index 12c99a354dc..33f7122723b 100644 --- a/htdocs/projet/ganttview.php +++ b/htdocs/projet/ganttview.php @@ -139,7 +139,7 @@ if (($id > 0 && is_numeric($id)) || !empty($ref)) { // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('projet', 'all', 'lire')) { $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0); - $object->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $object->next_prev_filter = "rowid:IN:".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0'); } dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/projet/messaging.php b/htdocs/projet/messaging.php index 065985317fa..a39534ef57c 100644 --- a/htdocs/projet/messaging.php +++ b/htdocs/projet/messaging.php @@ -157,7 +157,7 @@ $morehtmlref .= ''; // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('projet', 'all', 'lire')) { $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0); - $object->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $object->next_prev_filter = "rowid:IN:".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0'); } dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/projet/note.php b/htdocs/projet/note.php index e80fb0ff9a6..6130564e2da 100644 --- a/htdocs/projet/note.php +++ b/htdocs/projet/note.php @@ -126,7 +126,7 @@ if ($id > 0 || !empty($ref)) { // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('projet', 'all', 'lire')) { $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0); - $object->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $object->next_prev_filter = "rowid:IN:".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0'); } dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 40217eded88..6df3685b01a 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -616,7 +616,7 @@ if ($id > 0 || !empty($ref)) { // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('projet', 'all', 'lire')) { $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0); - $object->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $object->next_prev_filter = "rowid:IN:".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0'); } dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/projet/tasks/comment.php b/htdocs/projet/tasks/comment.php index 4359afad90f..beac0f4cbb2 100644 --- a/htdocs/projet/tasks/comment.php +++ b/htdocs/projet/tasks/comment.php @@ -155,7 +155,7 @@ if ($id > 0 || !empty($ref)) { // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('projet', 'all', 'lire')) { $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0); - $projectstatic->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $projectstatic->next_prev_filter = "rowid:IN:".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0'); } dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref); @@ -308,7 +308,7 @@ if ($id > 0 || !empty($ref)) { if (!GETPOST('withproject') || empty($projectstatic->id)) { $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1); - $object->next_prev_filter = "fk_projet:IN:(".$db->sanitize($projectsListId).")"; + $object->next_prev_filter = "fk_projet:IN:".$db->sanitize($projectsListId); } else { $object->next_prev_filter = "fk_projet:=:".((int) $projectstatic->id); } diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php index 495d4bb5712..f829533062a 100644 --- a/htdocs/projet/tasks/contact.php +++ b/htdocs/projet/tasks/contact.php @@ -212,7 +212,7 @@ if ($id > 0 || !empty($ref)) { // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('projet', 'all', 'lire')) { $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0); - $projectstatic->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $projectstatic->next_prev_filter = "rowid:IN:".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0'); } dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref); @@ -335,7 +335,7 @@ if ($id > 0 || !empty($ref)) { if (!GETPOST('withproject') || empty($projectstatic->id)) { $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1); - $object->next_prev_filter = "fk_projet:IN:(".$db->sanitize($projectsListId).")"; + $object->next_prev_filter = "fk_projet:IN:".$db->sanitize($projectsListId); } else { $object->next_prev_filter = "fk_projet:=:".((int) $projectstatic->id); } diff --git a/htdocs/projet/tasks/document.php b/htdocs/projet/tasks/document.php index c4cf270b6a7..8f091a04a5e 100644 --- a/htdocs/projet/tasks/document.php +++ b/htdocs/projet/tasks/document.php @@ -169,7 +169,7 @@ if ($object->id > 0) { // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('projet', 'all', 'lire')) { $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0); - $projectstatic->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $projectstatic->next_prev_filter = "rowid:IN:".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0'); } dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref); @@ -293,7 +293,7 @@ if ($object->id > 0) { if (!GETPOST('withproject') || empty($projectstatic->id)) { $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1); - $object->next_prev_filter = "fk_projet:IN:(".$db->sanitize($projectsListId).")"; + $object->next_prev_filter = "fk_projet:IN:".$db->sanitize($projectsListId); } else { $object->next_prev_filter = "fk_projet:=:".((int) $projectstatic->id); } diff --git a/htdocs/projet/tasks/note.php b/htdocs/projet/tasks/note.php index 77861e2f681..673c820368b 100644 --- a/htdocs/projet/tasks/note.php +++ b/htdocs/projet/tasks/note.php @@ -159,7 +159,7 @@ if ($object->id > 0) { // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('projet', 'all', 'lire')) { $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0); - $projectstatic->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $projectstatic->next_prev_filter = "rowid:IN:".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0'); } dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref); @@ -277,7 +277,7 @@ if ($object->id > 0) { if (!GETPOST('withproject') || empty($projectstatic->id)) { $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1); - $object->next_prev_filter = " fk_projet:IN:(".$db->sanitize($projectsListId).")"; + $object->next_prev_filter = " fk_projet:IN:".$db->sanitize($projectsListId); } else { $object->next_prev_filter = " fk_projet:=:".((int) $projectstatic->id); } diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index 68ff3707182..45811e74f5c 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -316,7 +316,7 @@ if ($id > 0 || !empty($ref)) { // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('projet', 'all', 'lire')) { $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0); - $projectstatic->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $projectstatic->next_prev_filter = "rowid:IN:".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0'); } dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $param); @@ -597,7 +597,7 @@ if ($id > 0 || !empty($ref)) { if (!GETPOST('withproject') || empty($projectstatic->id)) { $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1); - $object->next_prev_filter = "fk_projet:IN:(".$db->sanitize($projectsListId).")"; + $object->next_prev_filter = "fk_projet:IN:".$db->sanitize($projectsListId); } else { $object->next_prev_filter = "fk_projet:=:".((int) $projectstatic->id); } diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index aad0471027b..1002df365a2 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -959,7 +959,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('projet', 'all', 'lire')) { $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0); - $projectstatic->next_prev_filter = "rowid:IN:(" . $db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0') . ")"; + $projectstatic->next_prev_filter = "rowid:IN:" . $db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0'); } dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $param); @@ -1143,7 +1143,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser if (!GETPOST('withproject') || empty($projectstatic->id)) { $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1); - $object->next_prev_filter = "fk_projet:IN:(" . $db->sanitize($projectsListId) . ")"; + $object->next_prev_filter = "fk_projet:IN:" . $db->sanitize($projectsListId); } else { $object->next_prev_filter = "fk_projet:=:" . ((int) $projectstatic->id); } diff --git a/htdocs/societe/class/client.class.php b/htdocs/societe/class/client.class.php index 45e47ab21b2..81187942d6e 100644 --- a/htdocs/societe/class/client.class.php +++ b/htdocs/societe/class/client.class.php @@ -34,7 +34,7 @@ class Client extends Societe /** * @var string Used to add a filter in Form::showrefnav method */ - public $next_prev_filter = "te.client:in:(1,2,3)"; + public $next_prev_filter = "te.client:in:1,2,3"; /** * @var array diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index f885e2fe1d7..e62e78d332a 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -855,7 +855,7 @@ if ($action == 'create' || $action == 'presend') { // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('projet', 'all', 'lire')) { $objectsListId = $projectstat->getProjectsAuthorizedForUser($user, $mine, 0); - $projectstat->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $projectstat->next_prev_filter = "rowid:IN:".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0'); } print $form->showrefnav($projectstat, 'ref', $linkback, 1, 'ref', 'ref', ''); print ''; diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index d9c82030344..c54ebd897f0 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -620,7 +620,7 @@ if ($projectid > 0 || $project_ref) { // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('projet', 'all', 'lire')) { $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0); - $object->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $object->next_prev_filter = "rowid:IN:".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0'); } dol_banner_tab($object, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/test/other/test_dol_escape_htmltag.php b/test/other/test_dol_escape_htmltag.php index ab0c913d882..ad85469be68 100755 --- a/test/other/test_dol_escape_htmltag.php +++ b/test/other/test_dol_escape_htmltag.php @@ -50,6 +50,8 @@ print "\n\n\n"; //print dolGetFirstLineOfText($a, 7); print dol_escape_htmltag($a, 1, 1); +print forgeSQLFromUniversalSearchCriteria("te.client:IN:1,2"); + print "\n"; //print print_r(unserialize(serialize($object))); From 5398ba82235ea93910f351d83f593aa9567110f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josep=20Llu=C3=ADs?= Date: Tue, 10 Dec 2024 13:16:57 +0100 Subject: [PATCH 10/77] Force the sales representative if they don't have permissions Force the sales representative if they don't have permissions --- htdocs/societe/list.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index a8167de49da..33a7e038248 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -611,6 +611,11 @@ $sql .= " WHERE s.entity IN (".getEntity('societe').")"; if (!$user->hasRight('fournisseur', 'lire')) { $sql .= " AND (s.fournisseur <> 1 OR s.client <> 0)"; // client=0, fournisseur=0 must be visible } + +//Force the sales representative if they don't have permissions +if (!$user->hasRight('societe', 'client', 'voir') && !$socid) { + $search_sale = $user->id; +} // Search on sale representative if (!empty($search_sale) && $search_sale != '-1') { $search_sale_req = array_filter($search_sale, function (string $value): bool { From 11602243f7984a011fbe3242be5725780a264f59 Mon Sep 17 00:00:00 2001 From: atm-florian Date: Tue, 10 Dec 2024 13:38:50 +0100 Subject: [PATCH 11/77] Add class constants: DiscountAbsolute::TYPE_CUSTOMER and DiscountAbsolute::TYPE_SUPPLIER --- htdocs/core/class/discount.class.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/core/class/discount.class.php b/htdocs/core/class/discount.class.php index 7d90b55bfad..3a695df5e97 100644 --- a/htdocs/core/class/discount.class.php +++ b/htdocs/core/class/discount.class.php @@ -181,6 +181,12 @@ class DiscountAbsolute extends CommonObject */ public $type_invoice_supplier_source; + /* Customer Discount */ + const TYPE_CUSTOMER = 0; + + /* Supplier Discount */ + const TYPE_SUPPLIER = 1; + /** * Constructor * From 082e6a7676fe517a6fd1f9e56af2e02086587477 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Tue, 10 Dec 2024 13:57:03 +0100 Subject: [PATCH 12/77] Debug v21 --- htdocs/compta/prelevement/class/bonprelevement.class.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 24ce4487aed..376a958ee6a 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -1090,6 +1090,7 @@ class BonPrelevement extends CommonObject // Pre-store some values into variables to simplify following sql requests if ($sourcetype != 'salary') { $entities = $type != 'bank-transfer' ? getEntity('invoice') : getEntity('supplier_invoice'); + $sqlTable = $type != 'bank-transfer' ? "facture" : "facture_fourn"; $socOrUser = 'fk_soc'; $societeOrUser = 'societe'; } else { @@ -1099,8 +1100,6 @@ class BonPrelevement extends CommonObject $societeOrUser = 'user'; } - $sqlTable = $type != 'bank-transfer' ? "facture" : "facture_fourn"; - $thirdpartyBANId = 0; // Check if there is an iban associated to the bank transfer request or if we take the default @@ -1160,7 +1159,7 @@ class BonPrelevement extends CommonObject $sql .= ", CONCAT(s.firstname,' ',s.lastname) as name"; $sql .= ", f.ref, sr.bic, sr.iban_prefix, 'FRST' as frstrecur"; } - $sql .= " FROM " . $this->db->prefix() . $sqlTable . " as f"; + $sql .= " FROM " . $this->db->prefix() . $sqlTable . " as f"; // f is salary, facture or facture_fourn $sql .= " LEFT JOIN " . $this->db->prefix() . "prelevement_demande as pd ON f.rowid = pd.fk_".$this->db->sanitize($sqlTable); $sql .= " LEFT JOIN " . $this->db->prefix() . $this->db->sanitize($societeOrUser)." as s ON s.rowid = f.".$this->db->sanitize($socOrUser); $sql .= " LEFT JOIN " . $this->db->prefix() . $this->db->sanitize($societeOrUser."_rib")." as sr ON s.rowid = sr.".$this->db->sanitize($socOrUser); From 860f89cc442125c04ba5f6411e0766a126f3f31e Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Tue, 10 Dec 2024 17:14:33 +0100 Subject: [PATCH 13/77] Debug v21 --- .../modules/facture/doc/pdf_crabe.modules.php | 22 ++++++++------- .../facture/doc/pdf_octopus.modules.php | 27 +++++++++---------- .../facture/doc/pdf_sponge.modules.php | 11 +++++--- 3 files changed, 32 insertions(+), 28 deletions(-) diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 0fdcf740020..5297f1839cb 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -102,7 +102,7 @@ class pdf_crabe extends ModelePDFFactures */ public function __construct($db) { - global $conf, $langs, $mysoc; + global $langs, $mysoc; // Translations $langs->loadLangs(array("main", "bills")); @@ -359,10 +359,10 @@ class pdf_crabe extends ModelePDFFactures $certprivate = empty($user->conf->CERTIFICATE_CRT_PRIVATE) ? '' : $user->conf->CERTIFICATE_CRT_PRIVATE; // If user has no certificate, we try to take the company one if (!$cert) { - $cert = !getDolGlobalString('CERTIFICATE_CRT') ? '' : $conf->global->CERTIFICATE_CRT; + $cert = getDolGlobalString('CERTIFICATE_CRT'); } if (!$certprivate) { - $certprivate = !getDolGlobalString('CERTIFICATE_CRT_PRIVATE') ? '' : $conf->global->CERTIFICATE_CRT_PRIVATE; + $certprivate = getDolGlobalString('CERTIFICATE_CRT_PRIVATE'); } // If a certificate is found if ($cert) { @@ -1162,7 +1162,7 @@ class pdf_crabe extends ModelePDFFactures protected function _tableau_info(&$pdf, $object, $posy, $outputlangs, $outputlangsbis) { // phpcs:enable - global $conf, $mysoc, $hookmanager; + global $mysoc, $hookmanager; $default_font_size = pdf_getPDFFontSize($outputlangs); @@ -1170,6 +1170,9 @@ class pdf_crabe extends ModelePDFFactures krsort($this->tva_array); + // Clean data type + $object->total_tva = (float) $object->total_tva; + // Show VAT details if ($object->total_tva != 0 && getDolGlobalInt('PDF_INVOICE_SHOW_VAT_ANALYSIS')) { $pdf->SetFillColor(224, 224, 224); @@ -1227,7 +1230,7 @@ class pdf_crabe extends ModelePDFFactures } } - // If France, show VAT mention if not applicable + // If France, show VAT mention if applicable if ($this->emetteur->country_code == 'FR' && empty($object->total_tva) && (empty($mysoc->tva_assuj) || ($this->emetteur->isInEEC() && $object->thirdparty->isInEEC()))) { $pdf->SetFont('', 'B', $default_font_size - 2); $pdf->SetXY($this->marge_gauche, $posy); @@ -1367,7 +1370,7 @@ class pdf_crabe extends ModelePDFFactures if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CHQ') { // If payment mode unregulated or payment mode forced to CHQ if (getDolGlobalInt('FACTURE_CHQ_NUMBER')) { - $diffsizetitle = (!getDolGlobalString('PDF_DIFFSIZE_TITLE') ? 3 : $conf->global->PDF_DIFFSIZE_TITLE); + $diffsizetitle = getDolGlobalInt('PDF_DIFFSIZE_TITLE', 3); if (getDolGlobalInt('FACTURE_CHQ_NUMBER') > 0) { $account = new Account($this->db); @@ -1385,7 +1388,7 @@ class pdf_crabe extends ModelePDFFactures $posy = $pdf->GetY() + 2; } } - if ($conf->global->FACTURE_CHQ_NUMBER == -1) { + if (getDolGlobalInt('FACTURE_CHQ_NUMBER') == -1) { $pdf->SetXY($this->marge_gauche, $posy); $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle); $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo', $this->emetteur->name), 0, 'L', 0); @@ -1404,7 +1407,7 @@ class pdf_crabe extends ModelePDFFactures // If payment mode not forced or forced to VIR, show payment with BAN if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'VIR') { if ($object->fk_account > 0 || $object->fk_bank > 0 || getDolGlobalInt('FACTURE_RIB_NUMBER')) { - $bankid = ($object->fk_account <= 0 ? $conf->global->FACTURE_RIB_NUMBER : $object->fk_account); + $bankid = ($object->fk_account <= 0 ? getDolGlobalString('FACTURE_RIB_NUMBER') : $object->fk_account); if ($object->fk_bank > 0) { $bankid = $object->fk_bank; // For backward compatibility when object->fk_account is forced with object->fk_bank } @@ -1828,7 +1831,7 @@ class pdf_crabe extends ModelePDFFactures $index++; $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($col2x - $col1x, $tab2_hl, $conf->global->BILL_TEXT_TOTAL_FOOTER, 0, 'L', 0); + $pdf->MultiCell($col2x - $col1x, $tab2_hl, getDolGlobalString('BILL_TEXT_TOTAL_FOOTER'), 0, 'L', 0); } return ($tab2_top + ($tab2_hl * $index)); @@ -1877,7 +1880,6 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 4); $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); - //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230'; if (getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')) { $pdf->RoundedRect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, $this->corner_radius, '1001', 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR'))); } diff --git a/htdocs/core/modules/facture/doc/pdf_octopus.modules.php b/htdocs/core/modules/facture/doc/pdf_octopus.modules.php index 06fa8d0c9d5..b59ecd85c04 100644 --- a/htdocs/core/modules/facture/doc/pdf_octopus.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_octopus.modules.php @@ -1329,7 +1329,7 @@ class pdf_octopus extends ModelePDFFactures */ protected function drawInfoTable(&$pdf, $object, $posy, $outputlangs, $outputlangsbis) { - global $conf, $mysoc, $hookmanager; + global $mysoc, $hookmanager; $default_font_size = pdf_getPDFFontSize($outputlangs); @@ -1337,6 +1337,9 @@ class pdf_octopus extends ModelePDFFactures krsort($this->tva_array); + // Clean data type + $object->total_tva = (float) $object->total_tva; + // Show VAT details if ($object->total_tva != 0 && getDolGlobalInt('PDF_INVOICE_SHOW_VAT_ANALYSIS')) { $pdf->SetFillColor(224, 224, 224); @@ -1394,7 +1397,7 @@ class pdf_octopus extends ModelePDFFactures } } - // If France, show VAT mention if not applicable + // If France, show VAT mention if applicable if ($this->emetteur->country_code == 'FR' && empty($object->total_tva) && (empty($mysoc->tva_assuj) || ($this->emetteur->isInEEC() && $object->thirdparty->isInEEC()))) { $pdf->SetFont('', 'B', $default_font_size - 2); $pdf->SetXY($this->marge_gauche, $posy); @@ -1664,7 +1667,7 @@ class pdf_octopus extends ModelePDFFactures $pdf->SetXY($col1x, $tab2_top + 0); $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("TotalHT") : ''), 0, 'L', 1); - $total_ht = ((!empty($conf->multicurrency->enabled) && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht); + $total_ht = ((isModEnabled('multicurrency') && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht); $pdf->SetXY($col2x, $tab2_top + 0); $pdf->MultiCell($largcol2, $tab2_hl, price($total_ht, 0, $outputlangs), 0, 'R', 1); @@ -2549,7 +2552,7 @@ class pdf_octopus extends ModelePDFFactures */ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0) { - global $conf, $hookmanager; + global $hookmanager; // Default field style for content $this->defaultContentsFieldsStyle = array( @@ -2871,7 +2874,6 @@ class pdf_octopus extends ModelePDFFactures $width = $this->page_largeur - $this->marge_gauche - $this->marge_droite - 83; - //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230'; if (getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')) { //$pdf->Rect($this->posx_cumul_anterieur - 1, $tab_top, $width, 5, 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR'))); $pdf->RoundedRect($this->posx_cumul_anterieur - 1, $tab_top, $width, 5, $this->corner_radius, '1001', 'F', explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR'))); @@ -3069,8 +3071,6 @@ class pdf_octopus extends ModelePDFFactures */ public function getDataSituation(&$object) { - global $conf, $db; - // Fetch previous and next situations invoices. // Return all previous and next invoices (both standard and credit notes) $object->fetchPreviousNextSituationInvoice(); @@ -3233,7 +3233,6 @@ class pdf_octopus extends ModelePDFFactures return $object->displayRetainedWarranty(); } else { // FOR RETROCOMPATIBILITY - global $conf; // TODO : add a flag on invoices to store this conf USE_RETAINED_WARRANTY_ONLY_FOR_SITUATION_FINAL @@ -3365,7 +3364,7 @@ class pdf_octopus extends ModelePDFFactures */ public function btpGetInvoiceAmounts($id, $forceReadFromDB = false) { - global $user,$langs,$conf,$mysoc,$db,$hookmanager,$nblignes; + global $user, $langs, $mysoc, $db, $hookmanager, $nblignes; $object = new Facture($db); $object->fetch($id); @@ -3517,7 +3516,7 @@ class pdf_octopus extends ModelePDFFactures if (count($propals)) { $propal = array_pop($propals); - $total_ht = ($conf->multicurrency->enabled && $propal->multicurrency_tx != 1) ? $propal->multicurrency_total_ht : $propal->total_ht; + $total_ht = (isModEnabled('multicurrency') && $propal->multicurrency_tx != 1) ? $propal->multicurrency_total_ht : $propal->total_ht; $remain_to_pay = $total_ht; $pdf->SetTextColor(0, 0, 60); @@ -3540,7 +3539,7 @@ class pdf_octopus extends ModelePDFFactures } elseif (count($orders)) { $order = array_pop($orders); - $total_ht = ($conf->multicurrency->enabled && $order->multicurrency_tx != 1 ? $order->multicurrency_total_ht : $order->total_ht); + $total_ht = (isModEnabled('multicurrency') && $order->multicurrency_tx != 1 ? $order->multicurrency_total_ht : $order->total_ht); $remain_to_pay = $total_ht; } @@ -3608,7 +3607,7 @@ class pdf_octopus extends ModelePDFFactures $pdf->SetXY($posx, $posy); $pdf->MultiCell($width, $height, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); - $total_ht = ($conf->multicurrency->enabled && $invoice->multicurrency_tx != 1 ? $invoice->multicurrency_total_ht : $invoice->total_ht); + $total_ht = (isModEnabled('multicurrency') && $invoice->multicurrency_tx != 1 ? $invoice->multicurrency_total_ht : $invoice->total_ht); $pdf->SetXY($posx + $width, $posy); $pdf->MultiCell($width2, $height, price($sign * ($total_ht + (!empty($invoice->remise) ? $invoice->remise : 0)), 0, $outputlangs), 0, 'R', 1); @@ -3651,8 +3650,8 @@ class pdf_octopus extends ModelePDFFactures $index++; - $total_ht = ($conf->multicurrency->enabled && $invoice->multicurrency_tx != 1) ? $invoice->multicurrency_total_ht : $invoice->total_ht; - $total_ttc = ($conf->multicurrency->enabled && $invoice->multicurrency_tx != 1) ? $invoice->multicurrency_total_ttc : $invoice->total_ttc; + $total_ht = (isModEnabled('multicurrency') && $invoice->multicurrency_tx != 1) ? $invoice->multicurrency_total_ht : $invoice->total_ht; + $total_ttc = (isModEnabled('multicurrency') && $invoice->multicurrency_tx != 1) ? $invoice->multicurrency_total_ttc : $invoice->total_ttc; // Total TTC $pdf->SetXY($posx, $posy + $height * $index); diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index f2e54f08d90..908d9d2f328 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -1268,6 +1268,9 @@ class pdf_sponge extends ModelePDFFactures krsort($this->tva_array); + // Clean data type + $object->total_tva = (float) $object->total_tva; + // Show VAT details if ($object->total_tva != 0 && getDolGlobalInt('PDF_INVOICE_SHOW_VAT_ANALYSIS')) { $pdf->SetFillColor(224, 224, 224); @@ -1325,7 +1328,7 @@ class pdf_sponge extends ModelePDFFactures } } - // If France, show VAT mention if not applicable + // If France, show VAT mention if applicable if ($this->emetteur->country_code == 'FR' && empty($object->total_tva) && (empty($mysoc->tva_assuj) || ($this->emetteur->isInEEC() && $object->thirdparty->isInEEC()))) { $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($this->marge_gauche, $posy); @@ -1468,7 +1471,7 @@ class pdf_sponge extends ModelePDFFactures if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CHQ') { // If payment mode unregulated or payment mode forced to CHQ if (getDolGlobalInt('FACTURE_CHQ_NUMBER')) { - $diffsizetitle = (!getDolGlobalString('PDF_DIFFSIZE_TITLE') ? 3 : $conf->global->PDF_DIFFSIZE_TITLE); + $diffsizetitle = getDolGlobalInt('PDF_DIFFSIZE_TITLE', 3); if (getDolGlobalInt('FACTURE_CHQ_NUMBER') > 0) { $account = new Account($this->db); @@ -1486,7 +1489,7 @@ class pdf_sponge extends ModelePDFFactures $posy = $pdf->GetY() + 2; } } - if ($conf->global->FACTURE_CHQ_NUMBER == -1) { + if (getDolGlobalInt('FACTURE_CHQ_NUMBER') == -1) { $pdf->SetXY($this->marge_gauche, $posy); $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle); $pdf->MultiCell($posxend - $this->marge_gauche, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo', $this->emetteur->name), 0, 'L', 0); @@ -1570,7 +1573,7 @@ class pdf_sponge extends ModelePDFFactures */ protected function drawTotalTable(&$pdf, $object, $deja_regle, $posy, $outputlangs, $outputlangsbis) { - global $conf, $mysoc, $hookmanager; + global $mysoc, $hookmanager; $sign = 1; if ($object->type == 2 && getDolGlobalString('INVOICE_POSITIVE_CREDIT_NOTE')) { From 99bf3064f175761f3491e7b455ada2214cf3519b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Tue, 10 Dec 2024 20:07:37 +0100 Subject: [PATCH 14/77] fix phpstan --- build/phpstan/phpstan-baseline.neon | 48 ------------------- .../email_unpaid_invoices_to_customers.php | 7 ++- ...ail_unpaid_invoices_to_representatives.php | 7 ++- 3 files changed, 12 insertions(+), 50 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index 838f6d2cb1b..1b4b21e8aa1 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -5280,12 +5280,6 @@ parameters: count: 1 path: ../../htdocs/compta/bank/class/paymentvarious.class.php - - - message: '#^Call to function property_exists\(\) with \$this\(PaymentVarious\) and ''fk_bank'' will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../htdocs/compta/bank/class/paymentvarious.class.php - - message: '#^Property PaymentVarious\:\:\$accountid \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -34242,48 +34236,6 @@ parameters: count: 1 path: ../../scripts/emailings/reset-invalid-emails.php - - - message: '#^Variable \$conf might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../scripts/invoices/email_unpaid_invoices_to_customers.php - - - - message: '#^Variable \$hookmanager might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../scripts/invoices/email_unpaid_invoices_to_customers.php - - - - message: '#^Variable \$langs might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../scripts/invoices/email_unpaid_invoices_to_customers.php - - - - message: '#^Variable \$conf might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../scripts/invoices/email_unpaid_invoices_to_representatives.php - - - - message: '#^Variable \$db might not be defined\.$#' - identifier: variable.undefined - count: 6 - path: ../../scripts/invoices/email_unpaid_invoices_to_representatives.php - - - - message: '#^Variable \$hookmanager might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../scripts/invoices/email_unpaid_invoices_to_representatives.php - - - - message: '#^Variable \$langs might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../scripts/invoices/email_unpaid_invoices_to_representatives.php - - message: '#^Variable \$conf might not be defined\.$#' identifier: variable.undefined diff --git a/scripts/invoices/email_unpaid_invoices_to_customers.php b/scripts/invoices/email_unpaid_invoices_to_customers.php index 0a1bfa90d60..8a0534cc5c1 100755 --- a/scripts/invoices/email_unpaid_invoices_to_customers.php +++ b/scripts/invoices/email_unpaid_invoices_to_customers.php @@ -57,7 +57,12 @@ $targettype = $argv[2]; require $path."../../htdocs/master.inc.php"; require_once DOL_DOCUMENT_ROOT.'/core/lib/functionscli.lib.php'; require_once DOL_DOCUMENT_ROOT."/core/class/CMailFile.class.php"; - +/** + * @var Conf $conf + * @var DoliDB $db + * @var HookManager $hookmanager + * @var Translate $langs + */ $langs->load('main'); // Global variables diff --git a/scripts/invoices/email_unpaid_invoices_to_representatives.php b/scripts/invoices/email_unpaid_invoices_to_representatives.php index ce4347d8ebc..42433c0fea0 100755 --- a/scripts/invoices/email_unpaid_invoices_to_representatives.php +++ b/scripts/invoices/email_unpaid_invoices_to_representatives.php @@ -55,7 +55,12 @@ $mode = $argv[1]; require $path."../../htdocs/master.inc.php"; require_once DOL_DOCUMENT_ROOT.'/core/lib/functionscli.lib.php'; require_once DOL_DOCUMENT_ROOT."/core/class/CMailFile.class.php"; - +/** + * @var Conf $conf + * @var DoliDB $db + * @var HookManager $hookmanager + * @var Translate $langs + */ $langs->load('main'); // Global variables From 89121307ac4d747d76821616a93ad1b6478b795b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Tue, 10 Dec 2024 20:09:39 +0100 Subject: [PATCH 15/77] fix phpstan --- build/phpstan/phpstan-baseline.neon | 24 ------------------------ scripts/invoices/rebuild_merge_pdf.php | 8 +++++++- 2 files changed, 7 insertions(+), 25 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index 1b4b21e8aa1..2b04af2eb8b 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -34236,30 +34236,6 @@ parameters: count: 1 path: ../../scripts/emailings/reset-invalid-emails.php - - - message: '#^Variable \$conf might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../scripts/invoices/rebuild_merge_pdf.php - - - - message: '#^Variable \$db might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../scripts/invoices/rebuild_merge_pdf.php - - - - message: '#^Variable \$hookmanager might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../scripts/invoices/rebuild_merge_pdf.php - - - - message: '#^Variable \$langs might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../scripts/invoices/rebuild_merge_pdf.php - - message: '#^Variable \$user might not be defined\.$#' identifier: variable.undefined diff --git a/scripts/invoices/rebuild_merge_pdf.php b/scripts/invoices/rebuild_merge_pdf.php index 774d5a78754..d7ee2915281 100755 --- a/scripts/invoices/rebuild_merge_pdf.php +++ b/scripts/invoices/rebuild_merge_pdf.php @@ -47,6 +47,12 @@ require_once DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php"; require_once DOL_DOCUMENT_ROOT."/core/modules/facture/modules_facture.php"; require_once DOL_DOCUMENT_ROOT."/core/lib/date.lib.php"; require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice2.lib.php'; +/** + * @var Conf $conf + * @var DoliDB $db + * @var HookManager $hookmanager + * @var Translate $langs + */ // Load main language strings $langs->load("main"); @@ -77,7 +83,7 @@ if (!empty($dolibarr_main_db_readonly)) { exit(1); } -$diroutputpdf = $conf->facture->dir_output.'/temp'; +$diroutputpdf = $conf->invoice->dir_output.'/temp'; $newlangid = 'en_EN'; // To force a new lang id $filter = array(); $regenerate = ''; // Ask regenerate (contains name of model to use) From 0e85534a2d6c4380eab13e2626cec8f556e32c13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Tue, 10 Dec 2024 20:22:52 +0100 Subject: [PATCH 16/77] fix phpstan --- build/phpstan/phpstan-baseline.neon | 54 ------------------- .../default/tpl/adherentcard_create.tpl.php | 3 ++ .../default/tpl/adherentcard_edit.tpl.php | 7 ++- .../default/tpl/adherentcard_view.tpl.php | 7 ++- 4 files changed, 13 insertions(+), 58 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index 2b04af2eb8b..a0712df2731 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -882,60 +882,6 @@ parameters: count: 1 path: ../../htdocs/adherents/admin/member.php - - - message: '#^Cannot access property \$control on mixed\.$#' - identifier: property.nonObject - count: 23 - path: ../../htdocs/adherents/canvas/default/tpl/adherentcard_create.tpl.php - - - - message: '#^Variable \$canvas might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/adherents/canvas/default/tpl/adherentcard_create.tpl.php - - - - message: '#^Variable \$this might not be defined\.$#' - identifier: variable.undefined - count: 23 - path: ../../htdocs/adherents/canvas/default/tpl/adherentcard_create.tpl.php - - - - message: '#^Cannot access property \$control on mixed\.$#' - identifier: property.nonObject - count: 27 - path: ../../htdocs/adherents/canvas/default/tpl/adherentcard_edit.tpl.php - - - - message: '#^Variable \$canvas might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/adherents/canvas/default/tpl/adherentcard_edit.tpl.php - - - - message: '#^Variable \$this might not be defined\.$#' - identifier: variable.undefined - count: 26 - path: ../../htdocs/adherents/canvas/default/tpl/adherentcard_edit.tpl.php - - - - message: '#^Cannot access property \$control on mixed\.$#' - identifier: property.nonObject - count: 30 - path: ../../htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php - - - - message: '#^Variable \$canvas might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php - - - - message: '#^Variable \$this might not be defined\.$#' - identifier: variable.undefined - count: 28 - path: ../../htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php - - message: '#^Negated boolean expression is always true\.$#' identifier: booleanNot.alwaysTrue diff --git a/htdocs/adherents/canvas/default/tpl/adherentcard_create.tpl.php b/htdocs/adherents/canvas/default/tpl/adherentcard_create.tpl.php index e80c263c78e..630205413d3 100644 --- a/htdocs/adherents/canvas/default/tpl/adherentcard_create.tpl.php +++ b/htdocs/adherents/canvas/default/tpl/adherentcard_create.tpl.php @@ -19,8 +19,11 @@ /** * @var Adherent $object + * @var Canvas $this * @var Conf $conf * @var Translate $langs + * + * @var string $canvas */ // Protection to avoid direct call of template diff --git a/htdocs/adherents/canvas/default/tpl/adherentcard_edit.tpl.php b/htdocs/adherents/canvas/default/tpl/adherentcard_edit.tpl.php index 0b19fcb851a..626833d8385 100644 --- a/htdocs/adherents/canvas/default/tpl/adherentcard_edit.tpl.php +++ b/htdocs/adherents/canvas/default/tpl/adherentcard_edit.tpl.php @@ -1,6 +1,6 @@ - * Copyright (C) 2012 Philippe Grand +/* Copyright (C) 2010 Regis Houssin + * Copyright (C) 2012 Philippe Grand * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -19,8 +19,11 @@ /** * @var Adherent $object + * @var Canvas $this * @var Conf $conf * @var Translate $langs + * + * @var string $canvas */ // Protection to avoid direct call of template diff --git a/htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php b/htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php index 30bd5eded83..54c3acafa6a 100644 --- a/htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php +++ b/htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php @@ -1,6 +1,6 @@ - * Copyright (C) 2012-2022 Philippe Grand +/* Copyright (C) 2010-2012 Regis Houssin + * Copyright (C) 2012-2022 Philippe Grand * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -19,9 +19,12 @@ /** * @var Adherent $object + * @var Canvas $this * @var Conf $conf * @var Translate $langs * @var User $user + * + * @var string $canvas */ // Protection to avoid direct call of template From ad40c290a3ee49e2273c7ea98381504111ea2afa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Tue, 10 Dec 2024 20:33:20 +0100 Subject: [PATCH 17/77] fix phpstan --- build/phpstan/phpstan-baseline.neon | 18 ------------- htdocs/admin/openid_connect.php | 40 +++++++++++------------------ 2 files changed, 15 insertions(+), 43 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index a0712df2731..3343254563d 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -1584,24 +1584,6 @@ parameters: count: 1 path: ../../htdocs/admin/oauthlogintokens.php - - - message: '#^Negated boolean expression is always false\.$#' - identifier: booleanNot.alwaysFalse - count: 5 - path: ../../htdocs/admin/openid_connect.php - - - - message: '#^Negated boolean expression is always true\.$#' - identifier: booleanNot.alwaysTrue - count: 5 - path: ../../htdocs/admin/openid_connect.php - - - - message: '#^Variable \$bc might not be defined\.$#' - identifier: variable.undefined - count: 10 - path: ../../htdocs/admin/openid_connect.php - - message: '#^Negated boolean expression is always true\.$#' identifier: booleanNot.alwaysTrue diff --git a/htdocs/admin/openid_connect.php b/htdocs/admin/openid_connect.php index 7a42c90369d..c5f80897c5e 100644 --- a/htdocs/admin/openid_connect.php +++ b/htdocs/admin/openid_connect.php @@ -37,10 +37,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/openid_connect.lib.php'; * @var User $user */ -$langs->load("admin"); -$langs->load("openidconnect"); +$langs->loadLangs(["admin", "openidconnect"]); -if (!$user->admin) accessforbidden(); +if (!$user->admin) { + accessforbidden(); +} $action = GETPOST('action', 'alpha'); @@ -143,8 +144,6 @@ print '
'; print ''; print ''; -$var=true; - print ''; print ''; print ''."\n"; @@ -153,8 +152,7 @@ print ''."\n"; print "\n"; // MAIN_AUTHENTICATION_OIDC_LOGIN_CLAIM -$var = !$var; -print '' . "\n"; +print '' . "\n"; print ''."\n"; print ''."\n"; print '' . "\n"; print ''."\n"; print ''."\n"; print '' . "\n"; print ''."\n"; print ''."\n"; print '' . "\n"; print ''."\n"; print ''."\n"; print '' . "\n"; print ''."\n"; print ''."\n"; print '' . "\n"; print ''."\n"; print ''."\n"; print '' . "\n"; print ''."\n"; print ''."\n"; print '' . "\n"; print ''."\n"; print ''."\n"; print '' . "\n"; print ''."\n"; print ''."\n"; print '' . "\n"; print ''."\n"; print ''."\n"; print ''; From 4ec1b7a5465441ab951db4948a806ae9b194d2ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Dec 2024 21:03:15 +0100 Subject: [PATCH 44/77] fix phpstan --- htdocs/paypal/admin/paypal.php | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/htdocs/paypal/admin/paypal.php b/htdocs/paypal/admin/paypal.php index fab3c789429..0c3f08e241d 100644 --- a/htdocs/paypal/admin/paypal.php +++ b/htdocs/paypal/admin/paypal.php @@ -374,17 +374,19 @@ print 'Your API authentication information can be found with following steps. We print ''; if (!empty($conf->use_javascript_ajax)) { - print "\n".''; + print ' + + '; } print '

'; From f2430b0d7f31945fc1abcc203e2070957aa900ee Mon Sep 17 00:00:00 2001 From: sonikf <93765174+sonikf@users.noreply.github.com> Date: Thu, 12 Dec 2024 10:42:03 +0200 Subject: [PATCH 45/77] Fix space --- htdocs/langs/en_US/mails.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/mails.lang b/htdocs/langs/en_US/mails.lang index c2a7d07b030..b7ca6c62f19 100644 --- a/htdocs/langs/en_US/mails.lang +++ b/htdocs/langs/en_US/mails.lang @@ -32,7 +32,7 @@ NewMailing=New mass Email NewSMSing=New smsing EditMailing=Edit mass Email ResetMailing=Resend mass Email -ConfirmResetMailingTargetMassaction=Confirmation of the reset of targets statusin error +ConfirmResetMailingTargetMassaction=Confirmation of the reset of targets status in error ResetMailingTargetMassaction=Reset status in error DeleteMailing=Delete mass Email PreviewMailing=Preview mass Email From f07ca2a9141d0aa39ceba2995ffba7e79e2c36a8 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Thu, 12 Dec 2024 14:39:49 +0100 Subject: [PATCH 46/77] css --- htdocs/theme/eldy/global.inc.php | 5 ++--- htdocs/theme/md/style.css.php | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 15558ad11d7..88adc86552b 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -4695,12 +4695,11 @@ table.hidepaginationnext .paginationnext { } - /* Set the color for hover lines */ -.oddeven:hover, .evenodd:hover, .oddevenimport:hover, .evenoddimport:hover, .impair:hover, .pair:hover -{ +.oddeven:hover:not(.nohover), .evenodd:hover:not(.nohover), .oddevenimport:hover:not(.nohover), .evenoddimport:hover:not(.nohover), .impair:hover:not(.nohover), .pair:hover:not(.nohover) { background: var(--colorbacklinepairhover) !important; /* Must be background to be stronger than background of odd or even */ } + .tredited, .tredited td { background: var(--colorbacklinepairchecked) !important; /* Must be background to be stronger than background of odd or even */ border-bottom: 0 !important; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index fcdc79aeb95..8dbb46a008d 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -4761,7 +4761,6 @@ ul.noborder li:nth-child(odd):not(.liste_titre) { /* Set the color for hover lines */ - .tmenucompanylogo.nohover, .tmenucompanylogo.nohover:hover { opacity: unset !important; } @@ -4770,11 +4769,11 @@ ul.noborder li:nth-child(odd):not(.liste_titre) { box-shadow: unset; -webkit-box-shadow: unset; } - -.oddeven:hover, .evenodd:hover, .oddevenimport:hover, .evenoddimport:hover, .impair:hover, .pair:hover +.oddeven:hover:not(.nohover), .evenodd:hover:not(.nohover), .oddevenimport:hover:not(.nohover), .evenoddimport:hover:not(.nohover), .impair:hover:not(.nohover), .pair:hover:not(.nohover) { { background: rgb() !important; } + .tredited { background: rgb() !important; /* Must be background to be stronger than background of odd or even */ } From f5206566904279370f8ae3ead1e6077c2b970f3e Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Thu, 12 Dec 2024 14:47:48 +0100 Subject: [PATCH 47/77] Fix warning --- htdocs/admin/index.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/index.php b/htdocs/admin/index.php index 2fe24da05e9..0aa392a0c52 100644 --- a/htdocs/admin/index.php +++ b/htdocs/admin/index.php @@ -61,16 +61,16 @@ print load_fiche_titre($langs->trans("SetupArea"), '', 'tools'); if (getDolGlobalString('MAIN_MOTD_SETUPPAGE')) { - $conf->global->MAIN_MOTD_SETUPPAGE = preg_replace('//i', '
', $conf->global->MAIN_MOTD_SETUPPAGE); + $conf->global->MAIN_MOTD_SETUPPAGE = preg_replace('//i', '
', getDolGlobalString('MAIN_MOTD_SETUPPAGE')); if (getDolGlobalString('MAIN_MOTD_SETUPPAGE')) { $i = 0; $reg = array(); - while (preg_match('/__\(([a-zA-Z|@]+)\)__/i', $conf->global->MAIN_MOTD_SETUPPAGE, $reg) && $i < 100) { + while (preg_match('/__\(([a-zA-Z|@]+)\)__/i', getDolGlobalString('MAIN_MOTD_SETUPPAGE'), $reg) && $i < 100) { $tmp = explode('|', $reg[1]); if (!empty($tmp[1])) { $langs->load($tmp[1]); } - $conf->global->MAIN_MOTD_SETUPPAGE = preg_replace('/__\('.preg_quote($reg[1]).'\)__/i', $langs->trans($tmp[0]), $conf->global->MAIN_MOTD_SETUPPAGE); + $conf->global->MAIN_MOTD_SETUPPAGE = preg_replace('/__\('.preg_quote($reg[1]).'\)__/i', $langs->trans($tmp[0]), getDolGlobalString('MAIN_MOTD_SETUPPAGE')); $i++; } From 32924c1811383f9ac93290ee1e483c3f3fd0a0c9 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Thu, 12 Dec 2024 14:59:47 +0100 Subject: [PATCH 48/77] Debug v21 --- htdocs/core/class/extrafields.class.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index ecb4ada7f88..752a1527f5b 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -2011,7 +2011,6 @@ class ExtraFields } //if ($computed) $value = // $value is already calculated into $value before calling this method - $showsize = 0; if ($type == 'date') { $showsize = 10; @@ -2039,9 +2038,9 @@ class ExtraFields } elseif ($type == 'double') { if (!empty($value)) { //$value=price($value); - $sizeparts = explode(",", $size); - $number_decimals = array_key_exists(1, $sizeparts) ? $sizeparts[1] : 0; - $value = price($value, 0, $outputlangs, 0, 0, $number_decimals, ''); + //$sizeparts = explode(",", $size); + //$number_decimals = array_key_exists(1, $sizeparts) ? $sizeparts[1] : 0; + $value = price($value, 0, $outputlangs, 0, 0, -2, ''); } } elseif ($type == 'boolean') { $checked = ''; From 02ae579a3f864943d17e3c9d6622579bce378b11 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Thu, 12 Dec 2024 15:42:14 +0100 Subject: [PATCH 49/77] Add information to help debug --- htdocs/core/lib/functions.lib.php | 21 ++++++++++++++++++++- htdocs/core/tpl/objectline_view.tpl.php | 17 +++++++++++++++-- htdocs/langs/en_US/main.lang | 3 +++ 3 files changed, 38 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index dac7bfdc92f..a3849578d8b 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -11733,7 +11733,7 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0) */ function showDirectDownloadLink($object) { - global $conf, $langs; + global $langs; $out = ''; $url = $object->getLastMainDocLink($object->element); @@ -11845,6 +11845,25 @@ function getAdvancedPreviewUrl($modulepart, $relativepath, $alldata = 0, $param } } +/** + * Make content of an input box selected when we click into input field. + * + * @param int $idcode Id of special code + * @return string + */ +function getLabelSpecialCode($idcode) +{ + global $langs; + + $arrayspecialines = array(1 => 'Transport', 2 => 'EcoTax', 3 => 'Option'); + if ($idcode > 10) { + return 'Module ID '.$idcode; + } + if (!empty($arrayspecialines[$idcode])) { + return $langs->trans($arrayspecialines[$idcode]); + } + return ''; +} /** * Make content of an input box selected when we click into input field. diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index e50370f4c45..1d9e118cee3 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -312,8 +312,8 @@ $tooltiponpricemultiprice = ''; $tooltiponpriceend = ''; $tooltiponpriceendmultiprice = ''; if (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { - $tooltiponprice = $langs->transcountry("TotalHT", $mysoc->country_code).'='.price($line->total_ht, 0, '', 0, 0); - $tooltiponpricemultiprice = $langs->transcountry("TotalHT", $mysoc->country_code).'='.price($line->multicurrency_total_ht, 0, '', 0, 0); + $tooltiponprice .= $langs->transcountry("TotalHT", $mysoc->country_code).'='.price($line->total_ht, 0, '', 0, 0); + $tooltiponpricemultiprice .= $langs->transcountry("TotalHT", $mysoc->country_code).'='.price($line->multicurrency_total_ht, 0, '', 0, 0); $tooltiponprice .= '
'.$langs->transcountry("TotalVAT", ($senderissupplier ? $object->thirdparty->country_code : $mysoc->country_code)).'='.price($line->total_tva, 0, '', 0, 0); $tooltiponpricemultiprice .= '
'.$langs->transcountry("TotalVAT", ($senderissupplier ? $object->thirdparty->country_code : $mysoc->country_code)).'='.price($line->multicurrency_total_tva, 0, '', 0, 0); if (is_object($object->thirdparty)) { @@ -347,6 +347,19 @@ if (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { $tooltiponprice .= '
'.$langs->transcountry("TotalTTC", $mysoc->country_code).'='.price($line->total_ttc, 0, '', 0, 0); $tooltiponpricemultiprice .= '
'.$langs->transcountry("TotalTTC", $mysoc->country_code).'='.price($line->multicurrency_total_ttc, 0, '', 0, 0); + if (!empty($line->special_code) || $line->product_type == 9) { + $tooltiponprice .= '
'; + $tooltiponpricemultiprice .= '
'; + if (!empty($line->special_code)) { + $tooltiponprice .= '
'.$langs->trans("SpecialLine").' : '.getLabelSpecialcode($line->special_code); + $tooltiponpricemultiprice .= '
'.$langs->trans("SpecialLine").' : '.getLabelSpecialcode($line->special_code); + } + if ($line->product_type == 9) { + $tooltiponprice .= '
'.$langs->trans("SpecialLine").' : '.$langs->trans("GroupingLine"); + $tooltiponpricemultiprice .= '
'.$langs->trans("SpecialLine").' : '.$langs->trans("GroupingLine"); + } + } + $tooltiponprice = ''; $tooltiponpricemultiprice = ''; diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 4b451e58c72..744d4dfed24 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -1341,3 +1341,6 @@ Operator=Operator AllFieldsRequired=All fields are required. IsDefined=Is defined IsNotDefined=Is not defined +SpecialLine=Special Line +EcoTax=Eco-Tax +GroupingLine=Grouping line From c7eb63f41f490c90557ac7f17ddd6cbcf6cf5edd Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Thu, 12 Dec 2024 16:44:06 +0100 Subject: [PATCH 50/77] Try to close a TODO --- htdocs/admin/mails.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index b4e9267eec0..afda0e31733 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -1059,9 +1059,24 @@ if ($action == 'edit') { $text .= /* ($text ? '

' : ''). */$langs->trans("WarningPHPMailSPF", getDolGlobalString('MAIN_EXTERNAL_SMTP_SPF_STRING_TO_ADD')); } if (getDolGlobalString('MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS')) { // Not defined by default. Depend on platform. + $ipstoshow = ''; // List of IP shown as record to add as allowed IP if we use the smtp method. Value is '1.2.3.4, [aaaa:bbbb:cccc:dddd]' - // TODO Add a key to allow to show the IP/name of server detected dynamically - $text .= ($text ? '

' : '').$langs->trans("WarningPHPMail2", getDolGlobalString('MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS')); + $arrayipstoshow = explode(',', getDolGlobalString('MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS')); + foreach ($arrayipstoshow as $iptoshow) { + // If MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS is an URL to get/show the public IP/name of server detected dynamically + if (preg_match('/^http/i', $iptoshow)) { + $tmpresult = getURLContent($iptoshow, 'GET', '', 1, array(), array('http', 'https'), 0); + if (!empty($tmpresult['content'])) { + $iptoshow = $tmpresult['content']; + } else { + $iptoshow = ''; // Failed to get IP + } + } + $ipstoshow .= ($ipstoshow ? ', ' : '').trim($iptoshow); + } + if ($ipstoshow) { + $text .= ($text ? '

' : '').$langs->trans("WarningPHPMail2", $ipstoshow); + } } } From c2c3f2ff45687e0e9ecdf7ce1d723c59d81bba08 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Thu, 12 Dec 2024 16:47:31 +0100 Subject: [PATCH 51/77] FIX to have two lists with total on same screen --- htdocs/core/tpl/list_print_total.tpl.php | 77 ++++++++++++------------ 1 file changed, 40 insertions(+), 37 deletions(-) diff --git a/htdocs/core/tpl/list_print_total.tpl.php b/htdocs/core/tpl/list_print_total.tpl.php index 3e6af0c8a20..d79d844484c 100644 --- a/htdocs/core/tpl/list_print_total.tpl.php +++ b/htdocs/core/tpl/list_print_total.tpl.php @@ -23,6 +23,46 @@ */ '@phan-var-force array{nbfield:int,type?:array,pos?:array,val?:array} $totalarray'; +if (!function_exists('printTotalValCell')) { // allow two list with total on same screen + + /** print a total cell value according to its type + * + * @param string $type of field (duration, string..) + * @param string $val the value to display + * + * @return void (direct print) + */ + function printTotalValCell($type, $val) + { + // if $totalarray['type'] not present we consider it as number + if (empty($type)) { + $type = 'real'; + } + switch ($type) { + case 'duration': + print '
'; + break; + case 'string': // This type is no more used. type is now varchar(x) + print ''; + break; + case 'stock': + print ''; + break; + default: + print ''; + break; + } + } +} + // Move fields of totalizable into the common array pos and val if (!empty($totalarray['totalizable']) && is_array($totalarray['totalizable'])) { foreach ($totalarray['totalizable'] as $keytotalizable => $valtotalizable) { @@ -107,40 +147,3 @@ if (isset($totalarray['pos'])) { } //print ''; } - -/** print a total cell value according to its type - * - * @param string $type of field (duration, string..) - * @param string $val the value to display - * - * @return void (direct print) - */ -function printTotalValCell($type, $val) -{ - // if $totalarray['type'] not present we consider it as number - if (empty($type)) { - $type = 'real'; - } - switch ($type) { - case 'duration': - print ''; - break; - case 'string': // This type is no more used. type is now varchar(x) - print ''; - break; - case 'stock': - print ''; - break; - default: - print ''; - break; - } -} From 3d02e406d82acb3009cc77737015b3c56680fc7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Cendrier?= Date: Thu, 12 Dec 2024 17:05:21 +0100 Subject: [PATCH 52/77] FIX: camelcase for getLabelSpecialCode() calling --- htdocs/core/tpl/objectline_view.tpl.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 1d9e118cee3..9e34f4ba39f 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -351,8 +351,8 @@ if (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { $tooltiponprice .= '
'; $tooltiponpricemultiprice .= '
'; if (!empty($line->special_code)) { - $tooltiponprice .= '
'.$langs->trans("SpecialLine").' : '.getLabelSpecialcode($line->special_code); - $tooltiponpricemultiprice .= '
'.$langs->trans("SpecialLine").' : '.getLabelSpecialcode($line->special_code); + $tooltiponprice .= '
'.$langs->trans("SpecialLine").' : '.getLabelSpecialCode($line->special_code); + $tooltiponpricemultiprice .= '
'.$langs->trans("SpecialLine").' : '.getLabelSpecialCode($line->special_code); } if ($line->product_type == 9) { $tooltiponprice .= '
'.$langs->trans("SpecialLine").' : '.$langs->trans("GroupingLine"); From b4bf92018ec6f87d4269df6843c8b89877bc1fda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Thu, 12 Dec 2024 20:46:16 +0100 Subject: [PATCH 53/77] fix phpstan --- build/phpstan/phpstan-baseline.neon | 12 ------------ htdocs/core/tpl/objectline_view.tpl.php | 4 ++-- htdocs/cron/class/cronjob.class.php | 4 ++-- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index b436d3ce5d3..d64771c69b9 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -17394,18 +17394,6 @@ parameters: count: 4 path: ../../htdocs/cron/class/cronjob.class.php - - - message: '#^Variable \$ExecTimeLimit in empty\(\) always exists and is not falsy\.$#' - identifier: empty.variable - count: 1 - path: ../../htdocs/cron/class/cronjob.class.php - - - - message: '#^Variable \$MemoryLimit in empty\(\) always exists and is always falsy\.$#' - identifier: empty.variable - count: 1 - path: ../../htdocs/cron/class/cronjob.class.php - - message: '#^Ternary operator condition is always true\.$#' identifier: ternary.alwaysTrue diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 1d9e118cee3..9e34f4ba39f 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -351,8 +351,8 @@ if (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { $tooltiponprice .= '
'; $tooltiponpricemultiprice .= '
'; if (!empty($line->special_code)) { - $tooltiponprice .= '
'.$langs->trans("SpecialLine").' : '.getLabelSpecialcode($line->special_code); - $tooltiponpricemultiprice .= '
'.$langs->trans("SpecialLine").' : '.getLabelSpecialcode($line->special_code); + $tooltiponprice .= '
'.$langs->trans("SpecialLine").' : '.getLabelSpecialCode($line->special_code); + $tooltiponpricemultiprice .= '
'.$langs->trans("SpecialLine").' : '.getLabelSpecialCode($line->special_code); } if ($line->product_type == 9) { $tooltiponprice .= '
'.$langs->trans("SpecialLine").' : '.$langs->trans("GroupingLine"); diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index f7bb85395c8..455002b097a 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -1223,7 +1223,7 @@ class Cronjob extends CommonObject dol_syslog(get_class($this)."::run_jobs jobtype=".$this->jobtype." userlogin=".$userlogin, LOG_DEBUG); // Increase limit of time. Works only if we are not in safe mode - $ExecTimeLimit = 600; + $ExecTimeLimit = getDolGlobalInt('MAIN_CRON_EXEC_TIME_LIMIT', 600); if (!empty($ExecTimeLimit)) { $err = error_reporting(); error_reporting(0); // Disable all errors @@ -1231,7 +1231,7 @@ class Cronjob extends CommonObject @set_time_limit($ExecTimeLimit); // Need more than 240 on Windows 7/64 error_reporting($err); } - $MemoryLimit = 0; + $MemoryLimit = getDolGlobalString('MAIN_CRON_EXEC_TIME_LIMIT'); if (!empty($MemoryLimit)) { @ini_set('memory_limit', $MemoryLimit); } From 923e85f0a811e061174d141b8da31f2acdee2c64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Thu, 12 Dec 2024 20:55:03 +0100 Subject: [PATCH 54/77] fix phpstan --- build/phpstan/phpstan-baseline.neon | 6 ------ htdocs/projet/tasks.php | 1 + 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index d64771c69b9..58850605ffd 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -27804,12 +27804,6 @@ parameters: count: 2 path: ../../htdocs/projet/tasks.php - - - message: '#^Variable \$param might not be defined\.$#' - identifier: variable.undefined - count: 17 - path: ../../htdocs/projet/tasks.php - - message: '#^Variable \$permissiontodelete might not be defined\.$#' identifier: variable.undefined diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 6df3685b01a..7d41c983205 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -448,6 +448,7 @@ $help_url = "EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos"; llxHeader("", $title, $help_url, '', 0, 0, '', '', '', 'mod-project page-card_tasks'); $arrayofselected = is_array($toselect) ? $toselect : array(); +$param = ''; if ($id > 0 || !empty($ref)) { $result = $object->fetch($id, $ref); From f5f4e500bdfe176612b34b6ee61371df02b2d076 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Thu, 12 Dec 2024 21:06:51 +0100 Subject: [PATCH 55/77] fix phpstan --- build/phpstan/phpstan-baseline.neon | 18 ------------------ htdocs/core/actions_massactions.inc.php | 3 +++ htdocs/cron/class/cronjob.class.php | 2 +- 3 files changed, 4 insertions(+), 19 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index 58850605ffd..36791e8dce0 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -8196,12 +8196,6 @@ parameters: count: 1 path: ../../htdocs/core/actions_massactions.inc.php - - - message: '#^Variable \$action might not be defined\.$#' - identifier: variable.undefined - count: 14 - path: ../../htdocs/core/actions_massactions.inc.php - - message: '#^Variable \$from might not be defined\.$#' identifier: variable.undefined @@ -8220,12 +8214,6 @@ parameters: count: 1 path: ../../htdocs/core/actions_massactions.inc.php - - - message: '#^Variable \$month might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/core/actions_massactions.inc.php - - message: '#^Variable \$newlang in empty\(\) always exists and is always falsy\.$#' identifier: empty.variable @@ -8256,12 +8244,6 @@ parameters: count: 1 path: ../../htdocs/core/actions_massactions.inc.php - - - message: '#^Variable \$year might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/core/actions_massactions.inc.php - - message: '#^Variable \$classfile might not be defined\.$#' identifier: variable.undefined diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 94964dfae8e..82a25fd2678 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -55,10 +55,13 @@ * @var ?string $objectlabel * @var ?string $option * @var ?int $deliveryreceipt + * @var string $action * @var string $massaction * @var string $objectclass * @var string $uploaddir * @var string $confirm + * @var string $month + * @var string $year * @var int $error */ ' diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index 455002b097a..b814567f710 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -1231,7 +1231,7 @@ class Cronjob extends CommonObject @set_time_limit($ExecTimeLimit); // Need more than 240 on Windows 7/64 error_reporting($err); } - $MemoryLimit = getDolGlobalString('MAIN_CRON_EXEC_TIME_LIMIT'); + $MemoryLimit = getDolGlobalString('MAIN_CRON_MEMORY_LIMIT'); if (!empty($MemoryLimit)) { @ini_set('memory_limit', $MemoryLimit); } From 064846f4c99f5ced9f047d7c6867097643d3a059 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 13 Dec 2024 00:53:18 +0100 Subject: [PATCH 56/77] Trans --- htdocs/langs/en_US/main.lang | 2 +- htdocs/langs/fr_FR/main.lang | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 744d4dfed24..16db52a9770 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -498,7 +498,7 @@ ActionRunningNotStarted=To start ActionRunningShort=In progress ActionDoneShort=Finished ActionUncomplete=Incomplete -LatestLinkedEvents=Latest %s linked events +LatestLinkedEvents=The last %s events CompanyFoundation=Company/Organization Accountant=Accountant ContactsForCompany=Contacts for this third party diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index 22a9411997d..3c45a60d556 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -496,7 +496,7 @@ ActionRunningNotStarted=A réaliser ActionRunningShort=En cours ActionDoneShort=Terminé ActionUncomplete=Incomplet -LatestLinkedEvents=Les %s derniers événements liés +LatestLinkedEvents=Les %s derniers événements CompanyFoundation=Société/Organisation Accountant=Comptable ContactsForCompany=Contacts de ce tiers From 1443e48a309e6356543010905ffdedc38ad357d8 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 13 Dec 2024 07:34:49 +0100 Subject: [PATCH 57/77] FIX missing init function to create accounting table --- htdocs/core/modules/modAccounting.class.php | 33 +++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php index 1dc084ee7cd..a630b1f9fd3 100644 --- a/htdocs/core/modules/modAccounting.class.php +++ b/htdocs/core/modules/modAccounting.class.php @@ -400,4 +400,37 @@ class modAccounting extends DolibarrModules 'b.multicurrency_code'=>"US (Necessary if devise is different than EUR)", ); } + + /** + * Function called when module is enabled. + * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. + * It also creates data directories + * + * @param string $options Options when enabling module ('', 'noboxes') + * @return int 1 if OK, 0 if KO + */ + public function init($options = '') + { + $result = $this->_load_tables('/install/mysql/', 'accounting'); + if ($result < 0) { + return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default') + } + + $sql = array(); + return $this->_init($sql, $options); + } + + /** + * Function called when module is disabled. + * Remove from database constants, boxes and permissions from Dolibarr database. + * Data directories are not deleted + * + * @param string $options Options when enabling module ('', 'noboxes') + * @return int 1 if OK, 0 if KO + */ + public function remove($options = '') + { + $sql = array(); + return $this->_remove($sql, $options); + } } From 977aa546f1f24c29651df2994a4c726a10e2ba51 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 13 Dec 2024 07:43:15 +0100 Subject: [PATCH 58/77] FIX phpstan error --- htdocs/core/tpl/objectline_view.tpl.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 1d9e118cee3..9e34f4ba39f 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -351,8 +351,8 @@ if (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { $tooltiponprice .= '
'; $tooltiponpricemultiprice .= '
'; if (!empty($line->special_code)) { - $tooltiponprice .= '
'.$langs->trans("SpecialLine").' : '.getLabelSpecialcode($line->special_code); - $tooltiponpricemultiprice .= '
'.$langs->trans("SpecialLine").' : '.getLabelSpecialcode($line->special_code); + $tooltiponprice .= '
'.$langs->trans("SpecialLine").' : '.getLabelSpecialCode($line->special_code); + $tooltiponpricemultiprice .= '
'.$langs->trans("SpecialLine").' : '.getLabelSpecialCode($line->special_code); } if ($line->product_type == 9) { $tooltiponprice .= '
'.$langs->trans("SpecialLine").' : '.$langs->trans("GroupingLine"); From dd918323cf9fca2c1a286e1ee8dd07a6da193ccd Mon Sep 17 00:00:00 2001 From: Hystepik Date: Fri, 13 Dec 2024 09:50:29 +0100 Subject: [PATCH 59/77] Fix #32352 upload file and URL form on firefox --- htdocs/core/class/html.formfile.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 8c7524cd1a2..8623377e7ad 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1387,7 +1387,7 @@ class FormFile // Show title of list of existing files $morehtmlright = ''; if (!empty($moreoptions['showhideaddbutton']) && $conf->use_javascript_ajax) { - $tmpurlforbutton = 'javascript:console.log("open add file form");jQuery(".divattachnewfile").toggle(); if (!jQuery(".divattachnewfile").is(":hidden")) { jQuery("input[type=\'file\']").click(); }'; + $tmpurlforbutton = 'javascript:console.log("open add file form");jQuery(".divattachnewfile").toggle(); if (!jQuery(".divattachnewfile").is(":hidden")) { jQuery("input[type=\'file\']").click(); void(0);}'; $morehtmlright .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', $tmpurlforbutton, '', $permtoeditline); } @@ -2221,7 +2221,7 @@ class FormFile $morehtmlright = ''; if (!empty($moreoptions['showhideaddbutton']) && $conf->use_javascript_ajax) { - $morehtmlright .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', 'javascript:console.log("open addlink form"); jQuery(".divlinkfile").toggle();', '', $permissiontoedit); + $morehtmlright .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', 'javascript:console.log("open addlink form"); jQuery(".divlinkfile").toggle(); void(0);', '', $permissiontoedit); } // Show list of associated links From a5d4be4a66a0c6e94c4786a60927a4a628334c39 Mon Sep 17 00:00:00 2001 From: Hystepik Date: Fri, 13 Dec 2024 09:55:50 +0100 Subject: [PATCH 60/77] better fix for file --- htdocs/core/class/html.formfile.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 8623377e7ad..b7f6f705ece 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1387,7 +1387,7 @@ class FormFile // Show title of list of existing files $morehtmlright = ''; if (!empty($moreoptions['showhideaddbutton']) && $conf->use_javascript_ajax) { - $tmpurlforbutton = 'javascript:console.log("open add file form");jQuery(".divattachnewfile").toggle(); if (!jQuery(".divattachnewfile").is(":hidden")) { jQuery("input[type=\'file\']").click(); void(0);}'; + $tmpurlforbutton = 'javascript:console.log("open add file form");jQuery(".divattachnewfile").toggle(); if (!jQuery(".divattachnewfile").is(":hidden")) { jQuery("input[type=\'file\']").click();}void(0);'; $morehtmlright .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', $tmpurlforbutton, '', $permtoeditline); } From 9c5d76cbd9d494a9d7b5fe0ab4114df3f78a6dd5 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 13 Dec 2024 12:00:57 +0100 Subject: [PATCH 61/77] FIX #32355 Add mising POS ID in unalterable log --- htdocs/blockedlog/class/blockedlog.class.php | 5 +++-- htdocs/compta/facture/list.php | 6 ++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index ef209ae6b85..00a158952f0 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -169,7 +169,7 @@ class BlockedLog // Customer Invoice/Facture / Payment if (isModEnabled('invoice')) { $this->trackedevents['BILL_VALIDATE'] = 'logBILL_VALIDATE'; - $this->trackedevents['BILL_DELETE'] = 'logBILL_DELETE'; + //$this->trackedevents['BILL_UPDATE'] = 'logBILL_UPDATE'; $this->trackedevents['BILL_SENTBYMAIL'] = 'logBILL_SENTBYMAIL'; $this->trackedevents['DOC_DOWNLOAD'] = 'BlockedLogBillDownload'; $this->trackedevents['DOC_PREVIEW'] = 'BlockedLogBillPreview'; @@ -532,7 +532,8 @@ class BlockedLog continue; // Discard some properties } if (!in_array($key, array( - 'ref', 'ref_client', 'ref_supplier', 'date', 'datef', 'datev', 'type', 'total_ht', 'total_tva', 'total_ttc', 'localtax1', 'localtax2', 'revenuestamp', 'datepointoftax', 'note_public', 'lines' + 'ref', 'ref_client', 'ref_supplier', 'date', 'datef', 'datev', 'type', 'total_ht', 'total_tva', 'total_ttc', 'localtax1', 'localtax2', 'revenuestamp', 'datepointoftax', 'note_public', 'lines', + 'module_source', 'pos_source' ))) { continue; // Discard if not into a dedicated list } diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 33f8026d589..a13fce05ea5 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -2343,10 +2343,10 @@ if ($num > 0) { } // Type ent if (!empty($arrayfields['typent.code']['checked'])) { - print '
'; if (!$i) { @@ -2532,8 +2532,6 @@ if ($num > 0) { } } //else print $langs->trans("NoSalesRepresentativeAffected"); - } else { - print ' '; } print ''; if (!$i) { From 48336356524a063b91f89e0c7790916935a38156 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 13 Dec 2024 12:40:05 +0100 Subject: [PATCH 62/77] Debug v21 --- htdocs/blockedlog/admin/blockedlog_list.php | 28 +++++++++++--------- htdocs/blockedlog/class/blockedlog.class.php | 8 +++--- htdocs/langs/en_US/blockedlog.lang | 2 +- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/htdocs/blockedlog/admin/blockedlog_list.php b/htdocs/blockedlog/admin/blockedlog_list.php index 95da9f8f9ee..71178aff819 100644 --- a/htdocs/blockedlog/admin/blockedlog_list.php +++ b/htdocs/blockedlog/admin/blockedlog_list.php @@ -502,9 +502,6 @@ print ''; // Ref print ''; -// Link to ref -print ''; - // Amount print ''; @@ -521,6 +518,9 @@ print $form->selectarray('search_showonlyerrors', $array, $search_showonlyerrors print ''; // Status note +//print ''; + +// Link to original ref into business software print ''; // Action column @@ -543,12 +543,12 @@ print getTitleFieldOfList($langs->trans('Date'), 0, $_SERVER["PHP_SELF"], 'date_ print getTitleFieldOfList($langs->trans('Author'), 0, $_SERVER["PHP_SELF"], 'user_fullname', '', $param, '', $sortfield, $sortorder, '')."\n"; print getTitleFieldOfList($langs->trans('Action'), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, '')."\n"; print getTitleFieldOfList($langs->trans('Ref'), 0, $_SERVER["PHP_SELF"], 'ref_object', '', $param, '', $sortfield, $sortorder, '')."\n"; -print getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, '')."\n"; print getTitleFieldOfList($langs->trans('Amount'), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right ')."\n"; print getTitleFieldOfList($langs->trans('DataOfArchivedEvent'), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ', 0, $langs->trans('DataOfArchivedEventHelp').'
'.$langs->trans('DataOfArchivedEventHelp2'), 1)."\n"; print getTitleFieldOfList($langs->trans('Fingerprint'), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, '')."\n"; print getTitleFieldOfList($langs->trans('Status'), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ')."\n"; -print getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ')."\n"; +//print getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ')."\n"; +print getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, '')."\n"; // Action column if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"], '', '', $param, 'class="center"', $sortfield, $sortorder, '')."\n"; @@ -633,12 +633,6 @@ if (is_array($blocks)) { print dol_escape_htmltag($block->ref_object); print ''; - // Link to source object - print ''; @@ -666,13 +660,15 @@ if (is_array($blocks)) { } else { print 'OK'; } - print ''; + //print ''; // Note - print ''; + // Link to source object + print ''; // Actions code print ''; // Ref diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index dda8647e791..b970612e1c5 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -1141,17 +1141,17 @@ class BlockedLog /** * Return array of log objects (with criteria) * - * @param string $element element to search - * @param int $fk_object id of object to search - * @param int<0,max> $limit max number of element, 0 for all - * @param string $sortfield sort field - * @param string $sortorder sort order - * @param int $search_fk_user id of user(s) - * @param int $search_start start time limit - * @param int $search_end end time limit - * @param string $search_ref search ref - * @param string $search_amount search amount - * @param string $search_code search code + * @param string $element element to search + * @param int $fk_object id of object to search + * @param int<0,max> $limit max number of element, 0 for all + * @param string $sortfield sort field + * @param string $sortorder sort order + * @param int $search_fk_user id of user(s) + * @param int $search_start start time limit + * @param int $search_end end time limit + * @param string $search_ref search ref + * @param string $search_amount search amount + * @param string|array $search_code search code * @return BlockedLog[]|int<-2,-1> Array of object log or <0 if error */ public function getLog($element, $fk_object, $limit = 0, $sortfield = '', $sortorder = '', $search_fk_user = -1, $search_start = -1, $search_end = -1, $search_ref = '', $search_amount = '', $search_code = '') @@ -1194,8 +1194,14 @@ class BlockedLog if ($search_amount != '') { $sql .= natural_search("amounts", $search_amount, 1); } - if ($search_code != '' && $search_code != '-1') { - $sql .= natural_search("action", $search_code, 3); + if (is_array($search_code)) { + if (!empty($search_code)) { + $sql .= natural_search("action", implode(',', $search_code), 3); + } + } else { + if ($search_code != '' && $search_code != '-1') { + $sql .= natural_search("action", $search_code, 3); + } } $sql .= $this->db->order($sortfield, $sortorder); From 738abd9d5cb2ec7e1a1efc4bae8a1f25167533c8 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 13 Dec 2024 13:03:26 +0100 Subject: [PATCH 64/77] Fix missing unit price in the unalterable log --- htdocs/blockedlog/class/blockedlog.class.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index b970612e1c5..eafe04365f7 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -543,7 +543,13 @@ class BlockedLog $lineid++; foreach ($tmpline as $keyline => $valueline) { if (!in_array($keyline, array( - 'ref', 'multicurrency_code', 'multicurrency_total_ht', 'multicurrency_total_tva', 'multicurrency_total_ttc', 'qty', 'product_type', 'product_label', 'vat_src_code', 'tva_tx', 'info_bits', 'localtax1_tx', 'localtax2_tx', 'total_ht', 'total_tva', 'total_ttc', 'total_localtax1', 'total_localtax2' + 'ref', 'product_type', 'product_label', + 'qty', + 'subprice', + 'vat_src_code', 'tva_tx', 'localtax1_tx', 'localtax2_tx', + 'total_ht', 'total_tva', 'total_ttc', 'total_localtax1', 'total_localtax2', + 'multicurrency_code', 'multicurrency_total_ht', 'multicurrency_total_tva', 'multicurrency_total_ttc', + 'info_bits', 'special_code', ))) { continue; // Discard if not into a dedicated list } From 6d7350541a1a39fb101025562f0f92c041ad08b0 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 13 Dec 2024 13:14:22 +0100 Subject: [PATCH 65/77] FIX prepare the possibility of having different payment methods per entity (eg RUM/SEPA) --- .../install/mysql/migration/20.0.0-21.0.0.sql | 5 + .../mysql/tables/llx_societe_rib.key.sql | 5 +- .../install/mysql/tables/llx_societe_rib.sql | 111 +++++++++--------- 3 files changed, 64 insertions(+), 57 deletions(-) diff --git a/htdocs/install/mysql/migration/20.0.0-21.0.0.sql b/htdocs/install/mysql/migration/20.0.0-21.0.0.sql index 47cc3f8d6c0..1b84473354c 100644 --- a/htdocs/install/mysql/migration/20.0.0-21.0.0.sql +++ b/htdocs/install/mysql/migration/20.0.0-21.0.0.sql @@ -385,3 +385,8 @@ ALTER TABLE llx_facture_rec ADD COLUMN fk_societe_rib integer DEFAULT NULL; ALTER TABLE llx_facture ADD COLUMN is_also_delivery_note tinyint DEFAULT 0 NOT NULL; ALTER TABLE llx_user MODIFY COLUMN signature LONGTEXT; + +-- Add entity field +ALTER TABLE llx_societe_rib DROP INDEX uk_societe_rib; +ALTER TABLE llx_societe_rib ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER rowid; +ALTER TABLE llx_societe_rib ADD UNIQUE INDEX uk_societe_rib(entity, label, fk_soc); diff --git a/htdocs/install/mysql/tables/llx_societe_rib.key.sql b/htdocs/install/mysql/tables/llx_societe_rib.key.sql index 23be102c418..8bdab216fa4 100644 --- a/htdocs/install/mysql/tables/llx_societe_rib.key.sql +++ b/htdocs/install/mysql/tables/llx_societe_rib.key.sql @@ -1,5 +1,6 @@ -- =================================================================== --- Copyright (C) 2016 Laurent Destailleur +-- Copyright (C) 2016 Laurent Destailleur +-- Copyright (C) 2024 Regis Houssin -- -- 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 @@ -17,6 +18,6 @@ -- =================================================================== -ALTER TABLE llx_societe_rib ADD UNIQUE INDEX uk_societe_rib(label, fk_soc); +ALTER TABLE llx_societe_rib ADD UNIQUE INDEX uk_societe_rib(entity, label, fk_soc); ALTER TABLE llx_societe_rib ADD CONSTRAINT llx_societe_rib_fk_societe FOREIGN KEY (fk_soc) REFERENCES llx_societe(rowid); diff --git a/htdocs/install/mysql/tables/llx_societe_rib.sql b/htdocs/install/mysql/tables/llx_societe_rib.sql index 9fb4370c243..e5ef25a45b3 100644 --- a/htdocs/install/mysql/tables/llx_societe_rib.sql +++ b/htdocs/install/mysql/tables/llx_societe_rib.sql @@ -1,9 +1,9 @@ -- ============================================================================= --- Copyright (C) 2000-2004 Rodolphe Quiedeville --- Copyright (C) 2005-2009 Regis Houssin --- Copyright (C) 2012 Juanjo Menent --- Copyright (C) 2013 Peter Fontaine --- Copyright (C) 2023 Alexandre Spangaro +-- Copyright (C) 2000-2004 Rodolphe Quiedeville +-- Copyright (C) 2005-2024 Regis Houssin +-- Copyright (C) 2012 Juanjo Menent +-- Copyright (C) 2013 Peter Fontaine +-- Copyright (C) 2023 Alexandre Spangaro -- -- 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 @@ -23,72 +23,73 @@ create table llx_societe_rib ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - type varchar(32) DEFAULT 'ban' NOT NULL, -- 'ban' or 'paypal' or 'card' or 'stripe' - label varchar(200), - fk_soc integer NOT NULL, - datec datetime, - tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + rowid integer AUTO_INCREMENT PRIMARY KEY, + entity integer DEFAULT 1 NOT NULL, -- multi company id + type varchar(32) DEFAULT 'ban' NOT NULL, -- 'ban' or 'paypal' or 'card' or 'stripe' + label varchar(200), + fk_soc integer NOT NULL, + datec datetime, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- For BAN - bank varchar(255), -- bank name - code_banque varchar(128), -- bank code - code_guichet varchar(6), -- desk code - number varchar(255), -- account number - cle_rib varchar(5), -- key of bank account + bank varchar(255), -- bank name + code_banque varchar(128), -- bank code + code_guichet varchar(6), -- desk code + number varchar(255), -- account number + cle_rib varchar(5), -- key of bank account - bic varchar(20), -- 11 according to ISO 9362 (we keep 20 for backward compatibility) - bic_intermediate varchar(11), -- 11 according to ISO 9362. Same as bic but for intermediate bank - iban_prefix varchar(80), -- full iban. 34 according to ISO 13616 but we set 80 to allow to store it with encryption information + bic varchar(20), -- 11 according to ISO 9362 (we keep 20 for backward compatibility) + bic_intermediate varchar(11), -- 11 according to ISO 9362. Same as bic but for intermediate bank + iban_prefix varchar(80), -- full iban. 34 according to ISO 13616 but we set 80 to allow to store it with encryption information - domiciliation varchar(255), - proprio varchar(60), - owner_address varchar(255), - default_rib smallint NOT NULL DEFAULT 0, - state_id integer, - fk_country integer, - currency_code varchar(3), + domiciliation varchar(255), + proprio varchar(60), + owner_address varchar(255), + default_rib smallint NOT NULL DEFAULT 0, + state_id integer, + fk_country integer, + currency_code varchar(3), - model_pdf varchar(255), -- last template used to generate main document - last_main_doc varchar(255), -- relative filepath+filename of last main generated document + model_pdf varchar(255), -- last template used to generate main document + last_main_doc varchar(255), -- relative filepath+filename of last main generated document -- For BAN direct debit feature - rum varchar(32), -- RUM value to use for SEPA generation - date_rum date, -- Date of mandate - frstrecur varchar(16) DEFAULT 'FRST', -- 'FRST' or 'RECUR' + rum varchar(32), -- RUM value to use for SEPA generation + date_rum date, -- Date of mandate + frstrecur varchar(16) DEFAULT 'FRST', -- 'FRST' or 'RECUR' -- For credit card - last_four varchar(4), -- last 4 - card_type varchar(255), -- card type 'VISA', 'MC' , ... - cvn varchar(255), - exp_date_month integer, - exp_date_year integer, - country_code varchar(10), + last_four varchar(4), -- last 4 + card_type varchar(255), -- card type 'VISA', 'MC' , ... + cvn varchar(255), + exp_date_month integer, + exp_date_year integer, + country_code varchar(10), -- For Paypal - approved integer DEFAULT 0, - email varchar(255), - ending_date date, - max_total_amount_of_all_payments double(24,8), - preapproval_key varchar(255), - starting_date date, - total_amount_of_all_payments double(24,8), + approved integer DEFAULT 0, + email varchar(255), + ending_date date, + max_total_amount_of_all_payments double(24,8), + preapproval_key varchar(255), + starting_date date, + total_amount_of_all_payments double(24,8), --For Stripe, Stancer, ... - stripe_card_ref varchar(128), -- card_...' - stripe_account varchar(128), -- 'pk_live_...' + stripe_card_ref varchar(128), -- card_...' + stripe_account varchar(128), -- 'pk_live_...' - ext_payment_site varchar(128), -- name of external paymentmode (for example 'StripeLive') + ext_payment_site varchar(128), -- name of external paymentmode (for example 'StripeLive') - extraparams varchar(255), -- for other parameters with json format + extraparams varchar(255), -- for other parameters with json format -- For Online Sign - date_signature datetime, - online_sign_ip varchar(48), - online_sign_name varchar(64), + date_signature datetime, + online_sign_ip varchar(48), + online_sign_name varchar(64), - comment varchar(255), - ipaddress varchar(68), - status integer NOT NULL DEFAULT 1, -- 1=ACTIVE, 0=IN_TRASH - import_key varchar(14) -- import key + comment varchar(255), + ipaddress varchar(68), + status integer NOT NULL DEFAULT 1, -- 1=ACTIVE, 0=IN_TRASH + import_key varchar(14) -- import key )ENGINE=innodb; From 5da555e7eb1764bf11cb4fb3935a4d8ecb8f702c Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 13 Dec 2024 13:05:42 +0100 Subject: [PATCH 66/77] Trans --- htdocs/blockedlog/admin/blockedlog_list.php | 6 ++++-- htdocs/langs/en_US/blockedlog.lang | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/htdocs/blockedlog/admin/blockedlog_list.php b/htdocs/blockedlog/admin/blockedlog_list.php index 376120d7981..01cb2c58f1c 100644 --- a/htdocs/blockedlog/admin/blockedlog_list.php +++ b/htdocs/blockedlog/admin/blockedlog_list.php @@ -545,9 +545,9 @@ print getTitleFieldOfList($langs->trans('Author'), 0, $_SERVER["PHP_SELF"], 'use print getTitleFieldOfList($langs->trans('Action'), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, '')."\n"; print getTitleFieldOfList($langs->trans('Ref'), 0, $_SERVER["PHP_SELF"], 'ref_object', '', $param, '', $sortfield, $sortorder, '')."\n"; print getTitleFieldOfList($langs->trans('Amount'), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right ')."\n"; -print getTitleFieldOfList($langs->trans('DataOfArchivedEvent'), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ', 0, $langs->trans('DataOfArchivedEventHelp').'
'.$langs->trans('DataOfArchivedEventHelp2'), 1)."\n"; +print getTitleFieldOfList($langs->trans('DataOfArchivedEvent'), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ', 0, $langs->trans('DataOfArchivedEventHelp'), 1)."\n"; print getTitleFieldOfList($langs->trans('Fingerprint'), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, '')."\n"; -print getTitleFieldOfList($langs->trans('Status'), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ')."\n"; +print getTitleFieldOfList($form->textwithpicto($langs->trans('Status'), $langs->trans('DataOfArchivedEventHelp2')), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ')."\n"; //print getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ')."\n"; print getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, '')."\n"; // Action column @@ -671,6 +671,8 @@ if (is_array($blocks)) { } else { //print $form->textwithpicto('', $langs->trans('KoCheckFingerprintValidity')); } + } else { + //print $form->textwithpicto('', $langs->trans('DataOfArchivedEventHelp2')); } if (getDolGlobalString('BLOCKEDLOG_USE_REMOTE_AUTHORITY') && getDolGlobalString('BLOCKEDLOG_AUTHORITY_URL')) { diff --git a/htdocs/langs/en_US/blockedlog.lang b/htdocs/langs/en_US/blockedlog.lang index 9b74b8a787c..3b399063ad2 100644 --- a/htdocs/langs/en_US/blockedlog.lang +++ b/htdocs/langs/en_US/blockedlog.lang @@ -18,9 +18,9 @@ BlockedlogInfoDialog=Log Details ListOfTrackedEvents=List of tracked events Fingerprint=Fingerprint DownloadLogCSV=Export archived logs (CSV) -DataOfArchivedEvent=Full data of archived event -DataOfArchivedEventHelp=This field contains the unalterable and structured data that was archived on real time. Even if some parent business event could have been purged or modified, the data archived here is the original data, and it can't be modified. -DataOfArchivedEventHelp2=Its integrity is guaranteed if the status of the line is OK +DataOfArchivedEvent=Complementary data of archived event +DataOfArchivedEventHelp=This field contains the complementary data that was archived on real time. Even if some parent business event could have been purged or modified, the data archived here is the original data, and it can't be modified. +DataOfArchivedEventHelp2=The integrity of data on each lines is guaranteed if the status of the line is OK ImpossibleToReloadObject=Original object (type %s, id %s) not linked (see 'Full datas' column to get unalterable saved data) BlockedLogAreRequiredByYourCountryLegislation=Unalterable Logs module may be required by the legislation of your country. Disabling this module may render any future transactions invalid with respect to the law and the use of legal software as they can not be validated by a tax audit. BlockedLogActivatedBecauseRequiredByYourCountryLegislation=Unalterable Logs module was activated because of the legislation of your country. Disabling this module may render any future transactions invalid with respect to the law and the use of legal software as they cannot be validated by a tax audit. From 33ca018120e561bf24fd82a75a44d3264447765b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 13 Dec 2024 14:03:20 +0100 Subject: [PATCH 67/77] fix CI --- htdocs/blockedlog/class/blockedlog.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index eafe04365f7..c539f2774a9 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -1157,7 +1157,7 @@ class BlockedLog * @param int $search_end end time limit * @param string $search_ref search ref * @param string $search_amount search amount - * @param string|array $search_code search code + * @param string|string[] $search_code search code * @return BlockedLog[]|int<-2,-1> Array of object log or <0 if error */ public function getLog($element, $fk_object, $limit = 0, $sortfield = '', $sortorder = '', $search_fk_user = -1, $search_start = -1, $search_end = -1, $search_ref = '', $search_amount = '', $search_code = '') From 426e12a5cae1e8a0c12c336b3c63740ff4ac2d32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 13 Dec 2024 14:08:13 +0100 Subject: [PATCH 68/77] fix CI --- build/phpstan/phpstan-baseline.neon | 6 ------ htdocs/blockedlog/class/blockedlog.class.php | 8 ++++---- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index 36791e8dce0..9783c4edad9 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -2652,12 +2652,6 @@ parameters: count: 1 path: ../../htdocs/blockedlog/class/blockedlog.class.php - - - message: '#^Variable \$aaa might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/blockedlog/class/blockedlog.class.php - - message: '#^Property BOM\:\:\$status \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index c539f2774a9..30bd80915b4 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -853,12 +853,12 @@ class BlockedLog */ public function dolEncodeBlockedData($data, $mode = 0) { + $aaa = ''; try { $aaa = json_encode($data); } catch (Exception $e) { - //print $e->getErrs); + // print $e->getErrs); } - //var_dump($aaa); return $aaa; } @@ -873,12 +873,12 @@ class BlockedLog */ public function dolDecodeBlockedData($data, $mode = 0) { + $aaa = null; try { $aaa = (object) jsonOrUnserialize($data); } catch (Exception $e) { - //print $e->getErrs); + // print $e->getErrs); } - //var_dump($aaa); return $aaa; } From 10698ebf2a49e6b88685dc3c0f2186caf62e5309 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 13 Dec 2024 14:13:17 +0100 Subject: [PATCH 69/77] Doc --- htdocs/adherents/class/adherent.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index ffe840e9483..26833536fee 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -374,7 +374,7 @@ class Adherent extends CommonObject */ const STATUS_VALIDATED = 1; /** - * Resiliated + * Resiliated (membership end and was not renew) */ const STATUS_RESILIATED = 0; /** From c403fc901b1918d747febe6fb5d3091b23c15600 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 13 Dec 2024 14:17:46 +0100 Subject: [PATCH 70/77] fix CI --- htdocs/blockedlog/class/blockedlog.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index 30bd80915b4..f80cca3d489 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -873,7 +873,6 @@ class BlockedLog */ public function dolDecodeBlockedData($data, $mode = 0) { - $aaa = null; try { $aaa = (object) jsonOrUnserialize($data); } catch (Exception $e) { From 532435f6e100062583d37f559787fb20a5faff29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 13 Dec 2024 14:22:35 +0100 Subject: [PATCH 71/77] fix CI --- htdocs/blockedlog/class/blockedlog.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index f80cca3d489..30bd80915b4 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -873,6 +873,7 @@ class BlockedLog */ public function dolDecodeBlockedData($data, $mode = 0) { + $aaa = null; try { $aaa = (object) jsonOrUnserialize($data); } catch (Exception $e) { From 3bb56e6dd11e87e63d3c8be8da50e39f9cd378af Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 13 Dec 2024 14:25:44 +0100 Subject: [PATCH 72/77] Fix phpunit --- htdocs/blockedlog/class/blockedlog.class.php | 24 ++++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index eafe04365f7..f5b1f9ce64d 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -1147,18 +1147,18 @@ class BlockedLog /** * Return array of log objects (with criteria) * - * @param string $element element to search - * @param int $fk_object id of object to search - * @param int<0,max> $limit max number of element, 0 for all - * @param string $sortfield sort field - * @param string $sortorder sort order - * @param int $search_fk_user id of user(s) - * @param int $search_start start time limit - * @param int $search_end end time limit - * @param string $search_ref search ref - * @param string $search_amount search amount - * @param string|array $search_code search code - * @return BlockedLog[]|int<-2,-1> Array of object log or <0 if error + * @param string $element element to search + * @param int $fk_object id of object to search + * @param int<0,max> $limit max number of element, 0 for all + * @param string $sortfield sort field + * @param string $sortorder sort order + * @param int $search_fk_user id of user(s) + * @param int $search_start start time limit + * @param int $search_end end time limit + * @param string $search_ref search ref + * @param string $search_amount search amount + * @param string|array $search_code search code + * @return BlockedLog[]|int<-2,-1> Array of object log or <0 if error */ public function getLog($element, $fk_object, $limit = 0, $sortfield = '', $sortorder = '', $search_fk_user = -1, $search_start = -1, $search_end = -1, $search_ref = '', $search_amount = '', $search_code = '') { From 6ed584e425a17bb4a1bf3cb6283c9f6e33aee36b Mon Sep 17 00:00:00 2001 From: Mohamed DAOUD Date: Fri, 13 Dec 2024 14:53:05 +0100 Subject: [PATCH 73/77] fix phpstan --- htdocs/public/payment/paymentok.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index 180f0390336..ed3954c0598 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -180,6 +180,7 @@ $error = 0; // Check if we have redirtodomain to do. if ($ws) { + $ws_virtuelhost = null; $doactionsthenredirect = 1; include_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php'; $website = new Website($db); From d48be543416f425d52acf26a120706a0c5111763 Mon Sep 17 00:00:00 2001 From: Mohamed DAOUD Date: Fri, 13 Dec 2024 15:00:11 +0100 Subject: [PATCH 74/77] fix phpstan --- htdocs/public/payment/paymentok.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index ed3954c0598..eacf879e404 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -2131,7 +2131,7 @@ if (!empty($doactionsthenredirect)) { if ($ispaymentok) { // Redirect to a success page // Paymentok page must be created for the specific website - if (!defined('USEDOLIBARRSERVER') && $ws_virtuelhost) { + if (!defined('USEDOLIBARRSERVER') && !empty($ws_virtuelhost)) { $ext_urlok = $ws_virtuelhost . '/paymentok.php?fulltag='.$FULLTAG; } else { $ext_urlok = DOL_URL_ROOT.'/public/website/index.php?website='.urlencode($ws).'&pageref=paymentok&fulltag='.$FULLTAG; @@ -2140,7 +2140,7 @@ if (!empty($doactionsthenredirect)) { } else { // Redirect to an error page // Paymentko page must be created for the specific website - if (!defined('USEDOLIBARRSERVER') && $ws_virtuelhost) { + if (!defined('USEDOLIBARRSERVER') && !empty($ws_virtuelhost)) { $ext_urlko = $ws_virtuelhost . '/paymentko.php?fulltag='.$FULLTAG; } else { $ext_urlko = DOL_URL_ROOT.'/public/website/index.php?website='.urlencode($ws).'&pageref=paymentko&fulltag='.$FULLTAG; From 480f2e34443edd98ce7e076d1b0f971816078413 Mon Sep 17 00:00:00 2001 From: Mohamed DAOUD Date: Fri, 13 Dec 2024 15:38:37 +0100 Subject: [PATCH 75/77] fix phpstan --- htdocs/public/payment/paymentok.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index eacf879e404..4cc55e8b4f7 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -285,11 +285,11 @@ if (empty($doactionsthenredirect)) { // Another step to validate the payment (for payment modes like Paypal that need another step after the callback return for this). if (isModEnabled('paypal') && $paymentmethod === 'paypal') { // We call this page only if payment is ok on payment system - if ($PAYPALTOKEN) { + if (!empty($PAYPALTOKEN)) { // Get on url call $onlinetoken = $PAYPALTOKEN; $fulltag = $FULLTAG; - $payerID = $PAYPALPAYERID; + $payerID = !empty($PAYPALPAYERID) ? $PAYPALPAYERID : ''; // Set by newpayment.php $currencyCodeType = $_SESSION['currencyCodeType']; $FinalPaymentAmt = $_SESSION["FinalPaymentAmt"]; From bf59577fc6a9578b0c7dc8f5a82d875e911e1c89 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 13 Dec 2024 15:49:58 +0100 Subject: [PATCH 76/77] Update list.php --- htdocs/societe/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 33a7e038248..6a81aeede43 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -612,7 +612,7 @@ if (!$user->hasRight('fournisseur', 'lire')) { $sql .= " AND (s.fournisseur <> 1 OR s.client <> 0)"; // client=0, fournisseur=0 must be visible } -//Force the sales representative if they don't have permissions +// Force the sales representative if they don't have permissions if (!$user->hasRight('societe', 'client', 'voir') && !$socid) { $search_sale = $user->id; } From eeb3e812114658383c097eb356c5a8299dbb9761 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 13 Dec 2024 15:57:44 +0100 Subject: [PATCH 77/77] Update paymentok.php --- htdocs/public/payment/paymentok.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index 4cc55e8b4f7..01741876f4d 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -173,14 +173,9 @@ $object = new stdClass(); // For triggers $error = 0; - -/* - * Actions and view - */ - // Check if we have redirtodomain to do. +$ws_virtuelhost = null; if ($ws) { - $ws_virtuelhost = null; $doactionsthenredirect = 1; include_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php'; $website = new Website($db); @@ -191,6 +186,10 @@ if ($ws) { } +/* + * Actions and view + */ + $now = dol_now(); dol_syslog("Callback url when a payment was done. query_string=".(empty($_SERVER["QUERY_STRING"]) ? '' : dol_escape_htmltag($_SERVER["QUERY_STRING"]))." script_uri=".(empty($_SERVER["SCRIPT_URI"]) ? '' : dol_escape_htmltag($_SERVER["SCRIPT_URI"])), LOG_DEBUG, 0, '_payment');
'.$langs->trans("Parameters").''.$langs->trans("Value").'
'.$langs->trans("MainAuthenticationOidcLoginClaimName").''.$langs->trans("MainAuthenticationOidcLoginClaimDesc").'' . "\n"; @@ -162,8 +160,7 @@ print '' . "\n"; +print '
'.$langs->trans("MainAuthenticationOidcClientIdName").''.$langs->trans("MainAuthenticationOidcClientIdDesc").'' . "\n"; @@ -171,8 +168,7 @@ print '' . "\n"; +print '
'.$langs->trans("MainAuthenticationOidcClientSecretName").''.$langs->trans("MainAuthenticationOidcClientSecretDesc").'' . "\n"; @@ -180,8 +176,7 @@ print '' . "\n"; +print '
'.$langs->trans("MainAuthenticationOidcScopesName").''.$langs->trans("MainAuthenticationOidcScopesDesc").'' . "\n"; @@ -189,8 +184,7 @@ print '' . "\n"; +print '
'.$langs->trans("MainAuthenticationOidcAuthorizeUrlName").''.$langs->trans("MainAuthenticationOidcAuthorizeUrlDesc").'' . "\n"; @@ -198,8 +192,7 @@ print '' . "\n"; +print '
'.$langs->trans("MainAuthenticationOidcTokenUrlName").''.$langs->trans("MainAuthenticationOidcTokenUrlDesc").'' . "\n"; @@ -207,8 +200,7 @@ print '' . "\n"; +print '
'.$langs->trans("MainAuthenticationOidcUserinfoUrlName").''.$langs->trans("MainAuthenticationOidcUserinfoUrlDesc").'' . "\n"; @@ -216,8 +208,7 @@ print '' . "\n"; +print '
'.$langs->trans("MainAuthenticationOidcLogoutUrlName").''.$langs->trans("MainAuthenticationOidcLogoutUrlDesc").'' . "\n"; @@ -225,8 +216,7 @@ print '' . "\n"; +print '
'.$langs->trans("MainAuthenticationOidcRedirectUrlName").''.$langs->trans("MainAuthenticationOidcRedirectUrlDesc").'' . "\n"; @@ -234,8 +224,7 @@ print '' . "\n"; +print '
'.$langs->trans("MainAuthenticationOidcLogoutRedirectUrlName").''.$langs->trans("MainAuthenticationOidcLogoutRedirectUrlDesc").'' . "\n"; @@ -256,3 +245,4 @@ print '
'; print dol_get_fiche_end(); llxFooter(); +$db->close(); From 20d98ed4fa9fd45d2e01ab9b4b078b8c24c2aa0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Tue, 10 Dec 2024 20:55:49 +0100 Subject: [PATCH 18/77] fix phpstan --- build/phpstan/phpstan-baseline.neon | 24 ------------------------ htdocs/admin/sms.php | 14 +++++++------- 2 files changed, 7 insertions(+), 31 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index 3343254563d..b436d3ce5d3 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -1614,30 +1614,6 @@ parameters: count: 1 path: ../../htdocs/admin/security_file.php - - - message: '#^Parameter \#4 \$deliveryreceipt of class CSMSFile constructor expects int, array\\|string given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/admin/sms.php - - - - message: '#^Parameter \#5 \$deferred of class CSMSFile constructor expects int, array\\|string given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/admin/sms.php - - - - message: '#^Parameter \#6 \$priority of class CSMSFile constructor expects int, array\\|string given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/admin/sms.php - - - - message: '#^Parameter \#7 \$class of class CSMSFile constructor expects int, array\\|string given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/admin/sms.php - - message: '#^Variable \$smsfile might not be defined\.$#' identifier: variable.undefined diff --git a/htdocs/admin/sms.php b/htdocs/admin/sms.php index dbfb0e7a8e9..ad815dc5bc8 100644 --- a/htdocs/admin/sms.php +++ b/htdocs/admin/sms.php @@ -1,7 +1,7 @@ - * Copyright (C) 2009 Regis Houssin - * Copyright (C) 2013 Juanjo Menent +/* Copyright (C) 2007-2011 Laurent Destailleur + * Copyright (C) 2009 Regis Houssin + * Copyright (C) 2013 Juanjo Menent * Copyright (C) 2020-2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -83,10 +83,10 @@ if ($action == 'send' && !$cancel) { } $sendto = GETPOST("sendto", 'alphanohtml'); $body = GETPOST('message', 'alphanohtml'); - $deliveryreceipt = GETPOST("deliveryreceipt", 'alphanohtml'); - $deferred = GETPOST('deferred', 'alphanohtml'); - $priority = GETPOST('priority', 'alphanohtml'); - $class = GETPOST('class', 'alphanohtml'); + $deliveryreceipt = GETPOSTINT("deliveryreceipt"); + $deferred = GETPOSTINT('deferred'); + $priority = GETPOSTINT('priority'); + $class = GETPOSTINT('class'); $errors_to = GETPOST("errorstosms", 'alphanohtml'); // Create form object From 14a341fb8c7edb5650efca3a3f8524b1c79993ab Mon Sep 17 00:00:00 2001 From: Ronan Pozzi Date: Tue, 10 Dec 2024 21:20:53 +0100 Subject: [PATCH 19/77] Enhance regex patterns to support underscores in keys Updated regular expressions in `translate.class.php` to allow underscores in key matches for civility, sending methods, payment types, opportunity status, and order source. This improves compatibility with broader key naming conventions. --- htdocs/core/class/translate.class.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index 4de285710c3..ec0900a8ae7 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -629,17 +629,17 @@ class Translate $newstr = $key; $reg = array(); - if (preg_match('/^Civility([0-9A-Z]+)$/i', $key, $reg)) { + if (preg_match('/^Civility([0-9A-Z_]+)$/i', $key, $reg)) { $newstr = $this->getLabelFromKey($db, $reg[1], 'c_civility', 'code', 'label'); } elseif (preg_match('/^Currency([A-Z][A-Z][A-Z])$/i', $key, $reg)) { $newstr = $this->getLabelFromKey($db, $reg[1], 'c_currencies', 'code_iso', 'label'); - } elseif (preg_match('/^SendingMethod([0-9A-Z]+)$/i', $key, $reg)) { + } elseif (preg_match('/^SendingMethod([0-9A-Z_]+)$/i', $key, $reg)) { $newstr = $this->getLabelFromKey($db, $reg[1], 'c_shipment_mode', 'code', 'libelle'); - } elseif (preg_match('/^PaymentType(?:Short)?([0-9A-Z]+)$/i', $key, $reg)) { + } elseif (preg_match('/^PaymentType(?:Short)?([0-9A-Z_]+)$/i', $key, $reg)) { $newstr = $this->getLabelFromKey($db, $reg[1], 'c_paiement', 'code', 'libelle', '', 1); - } elseif (preg_match('/^OppStatus([0-9A-Z]+)$/i', $key, $reg)) { + } elseif (preg_match('/^OppStatus([0-9A-Z_]+)$/i', $key, $reg)) { $newstr = $this->getLabelFromKey($db, $reg[1], 'c_lead_status', 'code', 'label'); - } elseif (preg_match('/^OrderSource([0-9A-Z]+)$/i', $key, $reg)) { + } elseif (preg_match('/^OrderSource([0-9A-Z_]+)$/i', $key, $reg)) { // TODO OrderSourceX must be replaced with content of table llx_c_input_reason or llx_c_input_method //$newstr=$this->getLabelFromKey($db,$reg[1],'llx_c_input_reason','code','label'); } From 33a2be35fbcb28fdd2595abcd56a7a5f003419e8 Mon Sep 17 00:00:00 2001 From: sonikf <93765174+sonikf@users.noreply.github.com> Date: Wed, 11 Dec 2024 10:16:05 +0200 Subject: [PATCH 20/77] Fix trans --- htdocs/langs/en_US/admin.lang | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 90e30555733..3a7196da08f 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2144,10 +2144,10 @@ MAIN_PDF_NO_RECIPENT_FRAME=Hide borders on recipient address frame MAIN_PDF_HIDE_CUSTOMER_CODE=Hide customer code MAIN_PDF_HIDE_CUSTOMER_ACCOUNTING_CODE=Hide customer accounting code MAIN_PDF_HIDE_SENDER_NAME=Hide sender/company name in address block -TERMSOFSALE=Conditions de vente -MAIN_PDF_ADD_TERMSOFSALE_PROPAL=Add the conditions of sale after the proposal -MAIN_PDF_ADD_TERMSOFSALE_ORDER=Add the conditions of sale after the order -MAIN_PDF_ADD_TERMSOFSALE_INVOICE=Add the conditions of sale after the invoice +TERMSOFSALE=Terms and conditions of sale +MAIN_PDF_ADD_TERMSOFSALE_PROPAL=Add the terms and conditions of sale after the proposal +MAIN_PDF_ADD_TERMSOFSALE_ORDER=Add the terms and conditions of sale after the order +MAIN_PDF_ADD_TERMSOFSALE_INVOICE=Add the terms and conditions of sale after the invoice PROPOSAL_PDF_HIDE_PAYMENTTERM=Hide payments conditions PROPOSAL_PDF_HIDE_PAYMENTMODE=Hide payment mode MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING=Add a hidden markup into the signature area to allow electronic signature tool to reuse it. May be used by external tools or in the future by the online signature feature. @@ -2582,7 +2582,7 @@ DolibarrStandardCaptcha=A native captcha generated by Dolibarr SALES_ORDER_SHOW_SHIPPING_ADDRESS=Show shipping address SALES_ORDER_SHOW_SHIPPING_ADDRESSMore=Compulsory indication in some countries (France, ...) PDF_INVOICE_SHOW_VAT_ANALYSIS=Show vat analysis per rate -MaxNbOfRecordOnListIsOk=You have a max size for lists is set to %s lines. This is a good value. +MaxNbOfRecordOnListIsOk=You have a max size for lists set to %s lines. This is a good value. YouHaveALargeAmountOfRecordOnLists=You have a default max size for lists set to %s lines. This is a large value that need scrolling to see all answers. It is better to have a value lower than %s and use pagination to see record over this number. Change this in menu Home - Setup - Display. RoundBorders=Round borders CheckIfModuleIsNotBlackListed=Block install for modules found into the Remote blacklist @@ -2593,7 +2593,7 @@ SensitiveData=Sensitive data ToolToDecryptAString=Tool to decrypt a string Decrypt=Decrypt FilesIntegrityDesc=If you want to check the integrity of files instead of database, you can do it by using this tool. -AttributeCodeHelp=A code of your choice (without special char and space) to identify the property.
Note that if an object B is created from an existing object A that has a different type (for example creation of an invoice from an order), the value of the complementary attributes of A are also copied into the complementary attributes of B when the code of the attribute is the same. +AttributeCodeHelp=A code of your choice (without special chars and spaces) to identify the property.
Note that if an object B is created from an existing object A that has a different type (for example creation of an invoice from an order), the value of the complementary attributes of A are also copied into the complementary attributes of B when the code of the attribute is the same. ThereIsMoreThanXAnswers=There is more than %s answers with your filter. Please add more filters... -PdfAddTermOfSaleHelp=Upload the condition of sales from file input at the bottom of this setup page -WarningOnlineSignature=Please note that this function allows a person (customer, supplier...) to insert, online, the image of his signature in the PDF document. As for a handwritten signature, such a signature can be made by anyone and does not have the same legal value as a legal electronic signature system going through a paying trusted third party. If you need this level of security, you can contact an integrator for more information or check for addons on www.dolistore.org. +PdfAddTermOfSaleHelp=You can upload the terms and conditions of sale file at the bottom of this setup page +WarningOnlineSignature=Please note that this function allows a person (customer, supplier...) to insert, online, the image of his signature in the PDF document. As for a handwritten signature, such a signature can be made by anyone and might not have the same legal value as a legal electronic signature system going through an authorized trusted third party. If you need this level of security, you can contact an integrator for more information or check for addons on www.dolistore.org. From ef5acbbd74fd8be80f3ad90da3358b2a2cdb04cd Mon Sep 17 00:00:00 2001 From: Mohamed DAOUD Date: Wed, 11 Dec 2024 12:00:18 +0100 Subject: [PATCH 21/77] redirect to virtualhost after paymentok --- htdocs/public/payment/paymentok.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index 8fa92e88b89..180f0390336 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -181,6 +181,12 @@ $error = 0; // Check if we have redirtodomain to do. if ($ws) { $doactionsthenredirect = 1; + include_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php'; + $website = new Website($db); + $result = $website->fetch(0, $ws); + if ($result > 0) { + $ws_virtuelhost = $website->virtualhost; + } } @@ -2124,12 +2130,20 @@ if (!empty($doactionsthenredirect)) { if ($ispaymentok) { // Redirect to a success page // Paymentok page must be created for the specific website - $ext_urlok = DOL_URL_ROOT.'/public/website/index.php?website='.urlencode($ws).'&pageref=paymentok&fulltag='.$FULLTAG; + if (!defined('USEDOLIBARRSERVER') && $ws_virtuelhost) { + $ext_urlok = $ws_virtuelhost . '/paymentok.php?fulltag='.$FULLTAG; + } else { + $ext_urlok = DOL_URL_ROOT.'/public/website/index.php?website='.urlencode($ws).'&pageref=paymentok&fulltag='.$FULLTAG; + } print ""; } else { // Redirect to an error page // Paymentko page must be created for the specific website - $ext_urlko = DOL_URL_ROOT.'/public/website/index.php?website='.urlencode($ws).'&pageref=paymentko&fulltag='.$FULLTAG; + if (!defined('USEDOLIBARRSERVER') && $ws_virtuelhost) { + $ext_urlko = $ws_virtuelhost . '/paymentko.php?fulltag='.$FULLTAG; + } else { + $ext_urlko = DOL_URL_ROOT.'/public/website/index.php?website='.urlencode($ws).'&pageref=paymentko&fulltag='.$FULLTAG; + } print ""; } } From 5591e3a8c0e3c3c91dacac139e4c6dbd3c381b01 Mon Sep 17 00:00:00 2001 From: sonikf <93765174+sonikf@users.noreply.github.com> Date: Wed, 11 Dec 2024 14:19:22 +0200 Subject: [PATCH 22/77] Fix trans --- htdocs/langs/en_US/errors.lang | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 0e6576f3176..485917e7d86 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -344,8 +344,8 @@ ErrorStartHourIsNull=Start date field cannot be empty ErrorTooManyLinesToProcessPleaseUseAMoreSelectiveFilter=Too many lines to process. Please use a more selective filter. ErrorEmptyValueForQty=Quantity cannot be zero. ErrorNoCloneWithoutName=The new user must have a name -ErrorNoCloneWithoutEmail=The new user must have a email -ErrorUserClone=Error when clone categories user +ErrorNoCloneWithoutEmail=The new user must have an email +ErrorUserClone=Error in user clone categories ErrorQtyOrderedLessQtyShipped = The quantity ordered cannot be less than the quantity shipped. ErrorVariousPaymentOnBankAccountWithADifferentCurrencyNotYetSupported=Error, creating a various payment on a bank account with a currency different than the currency of the company is not yet supported. ErrorStreamMustBeEnabled=The PHP stream %s is not available. Check your PHP modules and Dolibarr parameter $dolibarr_main_stream_to_disable. From 2c988d28c9455bb76f0da30a134a956f0b128c29 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Wed, 11 Dec 2024 14:05:28 +0100 Subject: [PATCH 23/77] Debug v21 - fix multiselect --- htdocs/modulebuilder/template/myobject_list.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 6bde6bf10d1..864ad8adf9d 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -343,8 +343,14 @@ foreach ($search as $key => $val) { } $mode_search = 2; } - if ($search[$key] != '') { - $sql .= natural_search("t.".$db->sanitize($key), $search[$key], (($key == 'status') ? 2 : $mode_search)); + if (empty($object->fields[$key]['searchmulti'])) { + if (!is_array($search[$key]) && $search[$key] != '') { + $sql .= natural_search("t.".$db->escape($key), $search[$key], (($key == 'status') ? 2 : $mode_search)); + } + } else { + if (is_array($search[$key]) && !empty($search[$key])) { + $sql .= natural_search("t.".$db->escape($key), implode(',', $search[$key]), (($key == 'status') ? 2 : $mode_search)); + } } } else { if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') { @@ -632,7 +638,11 @@ foreach ($object->fields as $key => $val) { if (!empty($arrayfields['t.'.$key]['checked'])) { print '
'; if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) { - print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), 1, 0, 0, '', 1, 0, 0, '', 'maxwidth100'.($key == 'status' ? ' search_status width100 onrightofpage' : ''), 1); + if (empty($val['searchmulti'])) { + print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), 1, 0, 0, '', 1, 0, 0, '', 'maxwidth100'.($key == 'status' ? ' search_status width100 onrightofpage' : ''), 1); + } else { + print $form->multiselectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), 0, 0, 'maxwidth100'.($key == 'status' ? ' search_status width100 onrightofpage' : ''), 1); + } } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) { print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', $cssforfield.' maxwidth250', 1); } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) { From ba6bbdda0e84f3bff2b35ec11831127844ebec87 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Wed, 11 Dec 2024 15:05:03 +0100 Subject: [PATCH 24/77] Fix legal mention of VAT intra europe --- .../modules/facture/doc/pdf_crabe.modules.php | 17 ++++++++++------- .../modules/facture/doc/pdf_octopus.modules.php | 17 ++++++++++------- .../modules/facture/doc/pdf_sponge.modules.php | 15 +++++++++------ htdocs/langs/en_US/bills.lang | 1 + 4 files changed, 30 insertions(+), 20 deletions(-) diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 5297f1839cb..a5c514576e1 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -1231,15 +1231,18 @@ class pdf_crabe extends ModelePDFFactures } // If France, show VAT mention if applicable - if ($this->emetteur->country_code == 'FR' && empty($object->total_tva) && (empty($mysoc->tva_assuj) || ($this->emetteur->isInEEC() && $object->thirdparty->isInEEC()))) { - $pdf->SetFont('', 'B', $default_font_size - 2); + if (in_array($this->emetteur->country_code, array('FR')) && empty($object->total_tva)) { + $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($this->marge_gauche, $posy); - if ($mysoc->forme_juridique_code == 92) { - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoiceAsso"), 0, 'L', 0); - } else { - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0); + if (empty($mysoc->tva_assuj)) { + if ($mysoc->forme_juridique_code == 92) { + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoiceAsso"), 0, 'L', 0); + } else { + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0); + } + } elseif (getDolGlobalString("INVOICE_VAT_SHOW_REVERSE_CHARGE_MENTION") && $this->emetteur->country_code != $object->thirdparty->country_code && $this->emetteur->isInEEC() && $object->thirdparty->isInEEC()) { + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedReverseChargeProcedure"), 0, 'L', 0); } - $posy = $pdf->GetY() + 4; } diff --git a/htdocs/core/modules/facture/doc/pdf_octopus.modules.php b/htdocs/core/modules/facture/doc/pdf_octopus.modules.php index b59ecd85c04..6c75e61ae9c 100644 --- a/htdocs/core/modules/facture/doc/pdf_octopus.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_octopus.modules.php @@ -1398,15 +1398,18 @@ class pdf_octopus extends ModelePDFFactures } // If France, show VAT mention if applicable - if ($this->emetteur->country_code == 'FR' && empty($object->total_tva) && (empty($mysoc->tva_assuj) || ($this->emetteur->isInEEC() && $object->thirdparty->isInEEC()))) { - $pdf->SetFont('', 'B', $default_font_size - 2); + if (in_array($this->emetteur->country_code, array('FR')) && empty($object->total_tva)) { + $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($this->marge_gauche, $posy); - if ($mysoc->forme_juridique_code == 92) { - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoiceAsso"), 0, 'L', 0); - } else { - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0); + if (empty($mysoc->tva_assuj)) { + if ($mysoc->forme_juridique_code == 92) { + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoiceAsso"), 0, 'L', 0); + } else { + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0); + } + } elseif (getDolGlobalString("INVOICE_VAT_SHOW_REVERSE_CHARGE_MENTION") && $this->emetteur->country_code != $object->thirdparty->country_code && $this->emetteur->isInEEC() && $object->thirdparty->isInEEC()) { + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedReverseChargeProcedure"), 0, 'L', 0); } - $posy = $pdf->GetY() + 4; } diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 908d9d2f328..7fa776dff12 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -1329,15 +1329,18 @@ class pdf_sponge extends ModelePDFFactures } // If France, show VAT mention if applicable - if ($this->emetteur->country_code == 'FR' && empty($object->total_tva) && (empty($mysoc->tva_assuj) || ($this->emetteur->isInEEC() && $object->thirdparty->isInEEC()))) { + if (in_array($this->emetteur->country_code, array('FR')) && empty($object->total_tva)) { $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($this->marge_gauche, $posy); - if ($mysoc->forme_juridique_code == 92) { - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoiceAsso"), 0, 'L', 0); - } else { - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0); + if (empty($mysoc->tva_assuj)) { + if ($mysoc->forme_juridique_code == 92) { + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoiceAsso"), 0, 'L', 0); + } else { + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0); + } + } elseif (getDolGlobalString("INVOICE_VAT_SHOW_REVERSE_CHARGE_MENTION") && $this->emetteur->country_code != $object->thirdparty->country_code && $this->emetteur->isInEEC() && $object->thirdparty->isInEEC()) { + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedReverseChargeProcedure"), 0, 'L', 0); } - $posy = $pdf->GetY() + 4; } diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 8e2381466f8..e6f04f74572 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -523,6 +523,7 @@ SendTo=sent to PaymentByTransferOnThisBankAccount=Payment by transfer to the following bank account VATIsNotUsedForInvoice=* Non applicable VAT art-293B of CGI VATIsNotUsedForInvoiceAsso=* Non applicable VAT art-261-7 of CGI +VATIsNotUsedReverseChargeProcedure=* Non applicable VAT art-259-1 of CGI LawApplicationPart1=By application of the law 80.335 of 12/05/80 LawApplicationPart2=the goods remain the property of LawApplicationPart3=the seller until full payment of From 88465b7b422fbd5e8e42b64db3416c747e944a3c Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Wed, 11 Dec 2024 17:51:16 +0100 Subject: [PATCH 25/77] Add TODO --- htdocs/core/modules/modStock.class.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/modStock.class.php b/htdocs/core/modules/modStock.class.php index c9bc793fb36..1531a9245ae 100644 --- a/htdocs/core/modules/modStock.class.php +++ b/htdocs/core/modules/modStock.class.php @@ -44,7 +44,7 @@ class modStock extends DolibarrModules */ public function __construct($db) { - global $conf, $langs; + global $langs; $this->db = $db; $this->numero = 52; @@ -156,6 +156,17 @@ class modStock extends DolibarrModules $this->rights[$r][4] = 'mouvement'; $this->rights[$r][5] = 'creer'; + if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { + // Not yet implemented. TODO + $r++; + $this->rights[$r][0] = 1008; + $this->rights[$r][1] = 'Read stock value'; + $this->rights[$r][2] = 'w'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'value_advance'; + $this->rights[$r][5] = 'read'; + } + $r++; $this->rights[$r][0] = 1011; $this->rights[$r][1] = 'inventoryReadPermission'; // Permission label From 19e4b8f269beb9ab036f32d1da5d1701eeb806e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Dec 2024 17:55:20 +0100 Subject: [PATCH 26/77] fix phpstan --- build/phpstan/phpstan-baseline.neon | 6 ------ 1 file changed, 6 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index b436d3ce5d3..3c007cca51a 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -25470,12 +25470,6 @@ parameters: count: 2 path: ../../htdocs/product/class/product.class.php - - - message: '#^Ternary operator condition is always true\.$#' - identifier: ternary.alwaysTrue - count: 1 - path: ../../htdocs/product/class/product.class.php - - message: '#^Negated boolean expression is always true\.$#' identifier: booleanNot.alwaysTrue From bf46df80d4aedc730453cadd6687553dd3477907 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Dec 2024 18:04:05 +0100 Subject: [PATCH 27/77] fix phpstan --- htdocs/product/class/product.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index c5ab3793d34..f555e133299 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -646,6 +646,10 @@ class Product extends CommonObject * @var array{}|array{customers_toconsume:int,nb_toconsume:int,qty_toconsume:float,customers_consumed:int,nb_consumed:int,qty_consumed:float,customers_toproduce:int,nb_toproduce:int,qty_toproduce:float,customers_produced:int,nb_produced:int,qty_produced:float} stats by role toconsume, consumed, toproduce, produced */ public $stats_mo = array(); + + /** + * @var array{}|array{nb_toproduce:int,nb_toconsume:int,qty_toproduce:float,qty_toconsume:float} + */ public $stats_bom = array(); public $stats_mrptoconsume = array(); public $stats_mrptoproduce = array(); From 45fa431092c6a3728e4fa079a306b7cb2c411709 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Dec 2024 18:07:16 +0100 Subject: [PATCH 28/77] fix phpstan --- htdocs/product/class/product.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index f555e133299..e987b88377e 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -3083,7 +3083,7 @@ class Product extends CommonObject $this->multiprices_min_ttc[$i] = $result ? $result["price_min_ttc"] : null; $this->multiprices_base_type[$i] = $result ? $result["price_base_type"] : null; // Next two fields are used only if PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL is on - $this->multiprices_tva_tx[$i] = $result ? $result["tva_tx"].($result ? ' ('.$result['default_vat_code'].')' : '') : null; + $this->multiprices_tva_tx[$i] = $result ? $result["tva_tx"].(!empty($result['default_vat_code']) ? ' ('.$result['default_vat_code'].')' : '') : null; $this->multiprices_recuperableonly[$i] = $result ? $result["recuperableonly"] : null; // Price by quantity From 3bb34cbf24f548d023a62b28b2b2e515929138fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Dec 2024 18:12:08 +0100 Subject: [PATCH 29/77] fix phpstan --- build/phpstan/phpstan-baseline.neon | 30 -------------------------- htdocs/product/class/product.class.php | 8 +++---- 2 files changed, 4 insertions(+), 34 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index 3c007cca51a..6fd43263efc 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -25410,36 +25410,6 @@ parameters: count: 1 path: ../../htdocs/product/class/product.class.php - - - message: '#^Property Product\:\:\$stats_bom has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../htdocs/product/class/product.class.php - - - - message: '#^Property Product\:\:\$stats_facture_fournisseur has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../htdocs/product/class/product.class.php - - - - message: '#^Property Product\:\:\$stats_facturerec has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../htdocs/product/class/product.class.php - - - - message: '#^Property Product\:\:\$stats_mrptoconsume has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../htdocs/product/class/product.class.php - - - - message: '#^Property Product\:\:\$stats_mrptoproduce has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../htdocs/product/class/product.class.php - - message: '#^Property Product\:\:\$status \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index e987b88377e..3b34af84ed5 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1141,10 +1141,10 @@ class Product extends CommonObject if ($id > 0) { $this->id = $id; - $this->price = $price_ht; - $this->price_ttc = $price_ttc; - $this->price_min = $price_min_ht; - $this->price_min_ttc = $price_min_ttc; + $this->price = $price_ht; + $this->price_ttc = $price_ttc; + $this->price_min = $price_min_ht; + $this->price_min_ttc = $price_min_ttc; $result = $this->_log_price($user); if ($result > 0) { From a97ffa85537e7aeba782440ed006a1cc1fef18d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Dec 2024 18:16:28 +0100 Subject: [PATCH 30/77] fix phpstan --- htdocs/product/class/product.class.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 3b34af84ed5..580983d03c0 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -651,9 +651,25 @@ class Product extends CommonObject * @var array{}|array{nb_toproduce:int,nb_toconsume:int,qty_toproduce:float,qty_toconsume:float} */ public $stats_bom = array(); + + /** + * @var array{} + */ public $stats_mrptoconsume = array(); + + /** + * @var array{} + */ public $stats_mrptoproduce = array(); + + /** + * @var array{} + */ public $stats_facturerec = array(); + + /** + * @var array{} + */ public $stats_facture_fournisseur = array(); /** From 9738afbab532ba04d3932955f7ed9cca4439e3ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Dec 2024 18:29:46 +0100 Subject: [PATCH 31/77] fix phpstan --- htdocs/product/class/product.class.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 580983d03c0..4b9d61e6b44 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -653,12 +653,12 @@ class Product extends CommonObject public $stats_bom = array(); /** - * @var array{} + * @var array{}|array{customers:int,nb:int,rows:int,qty:float} */ public $stats_mrptoconsume = array(); /** - * @var array{} + * @var array{}|array{customers:int,nb:int,rows:int,qty:float} */ public $stats_mrptoproduce = array(); @@ -3940,25 +3940,25 @@ class Product extends CommonObject if ($result) { while ($obj = $this->db->fetch_object($result)) { if ($obj->role == 'toconsume' && empty($warehouseid)) { - $this->stats_mrptoconsume['customers'] += $obj->nb_customers; - $this->stats_mrptoconsume['nb'] += $obj->nb; - $this->stats_mrptoconsume['rows'] += $obj->nb_rows; - $this->stats_mrptoconsume['qty'] += ($obj->qty ? $obj->qty : 0); + $this->stats_mrptoconsume['customers'] += (int) $obj->nb_customers; + $this->stats_mrptoconsume['nb'] += (int) $obj->nb; + $this->stats_mrptoconsume['rows'] += (int) $obj->nb_rows; + $this->stats_mrptoconsume['qty'] += ($obj->qty ? (float) $obj->qty : 0.0); } if ($obj->role == 'consumed' && empty($warehouseid)) { //$this->stats_mrptoconsume['customers'] += $obj->nb_customers; //$this->stats_mrptoconsume['nb'] += $obj->nb; //$this->stats_mrptoconsume['rows'] += $obj->nb_rows; - $this->stats_mrptoconsume['qty'] -= ($obj->qty ? $obj->qty : 0); + $this->stats_mrptoconsume['qty'] -= ($obj->qty ? (float) $obj->qty : 0.0); } if ($obj->role == 'toproduce') { if ($warehouseid) { - $this->stock_warehouse[$warehouseid]->stats_mrptoproduce['qty'] += ($obj->qty ? $obj->qty : 0); + $this->stock_warehouse[$warehouseid]->stats_mrptoproduce['qty'] += ($obj->qty ? (float) $obj->qty : 0.0); } else { - $this->stats_mrptoproduce['customers'] += $obj->nb_customers; - $this->stats_mrptoproduce['nb'] += $obj->nb; - $this->stats_mrptoproduce['rows'] += $obj->nb_rows; - $this->stats_mrptoproduce['qty'] += ($obj->qty ? $obj->qty : 0); + $this->stats_mrptoproduce['customers'] += (int) $obj->nb_customers; + $this->stats_mrptoproduce['nb'] += (int) $obj->nb; + $this->stats_mrptoproduce['rows'] += (int) $obj->nb_rows; + $this->stats_mrptoproduce['qty'] += ($obj->qty ? (float) $obj->qty : 0.0); } } if ($obj->role == 'produced') { From a30e367b9d96e92d88b0ba8990e11e6a726e713d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Dec 2024 18:40:48 +0100 Subject: [PATCH 32/77] fix phpstan --- htdocs/product/class/product.class.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 4b9d61e6b44..66d3bbe97c6 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -663,12 +663,12 @@ class Product extends CommonObject public $stats_mrptoproduce = array(); /** - * @var array{} + * @var array{}|array{customers:int,nb:int,rows:int,qty:float} stats facture rec */ public $stats_facturerec = array(); /** - * @var array{} + * @var array{}|array{suppliers:int,nb:int,rows:int,qty:float} stats supplier invoices */ public $stats_facture_fournisseur = array(); @@ -3929,11 +3929,11 @@ class Product extends CommonObject $this->stats_mrptoconsume['customers'] = 0; $this->stats_mrptoconsume['nb'] = 0; $this->stats_mrptoconsume['rows'] = 0; - $this->stats_mrptoconsume['qty'] = 0; + $this->stats_mrptoconsume['qty'] = 0.0; $this->stats_mrptoproduce['customers'] = 0; $this->stats_mrptoproduce['nb'] = 0; $this->stats_mrptoproduce['rows'] = 0; - $this->stats_mrptoproduce['qty'] = 0; + $this->stats_mrptoproduce['qty'] = 0.0; } $result = $this->db->query($sql); @@ -4184,10 +4184,10 @@ class Product extends CommonObject $result = $this->db->query($sql); if ($result) { $obj = $this->db->fetch_object($result); - $this->stats_facturerec['customers'] = $obj->nb_customers; - $this->stats_facturerec['nb'] = $obj->nb; - $this->stats_facturerec['rows'] = $obj->nb_rows; - $this->stats_facturerec['qty'] = $obj->qty ? $obj->qty : 0; + $this->stats_facturerec['customers'] = (int) $obj->nb_customers; + $this->stats_facturerec['nb'] = (int) $obj->nb; + $this->stats_facturerec['rows'] = (int) $obj->nb_rows; + $this->stats_facturerec['qty'] = $obj->qty ? (float) $obj->qty : 0.0; // if it's a virtual product, maybe it is in invoice by extension if (getDolGlobalString('PRODUCT_STATS_WITH_PARENT_PROD_IF_INCDEC')) { @@ -4258,10 +4258,10 @@ class Product extends CommonObject $result = $this->db->query($sql); if ($result) { $obj = $this->db->fetch_object($result); - $this->stats_facture_fournisseur['suppliers'] = $obj->nb_suppliers; - $this->stats_facture_fournisseur['nb'] = $obj->nb; - $this->stats_facture_fournisseur['rows'] = $obj->nb_rows; - $this->stats_facture_fournisseur['qty'] = $obj->qty ? $obj->qty : 0; + $this->stats_facture_fournisseur['suppliers'] = (int) $obj->nb_suppliers; + $this->stats_facture_fournisseur['nb'] = (int) $obj->nb; + $this->stats_facture_fournisseur['rows'] = (int) $obj->nb_rows; + $this->stats_facture_fournisseur['qty'] = $obj->qty ? (float) $obj->qty : 0.0; $parameters = array('socid' => $socid); $reshook = $hookmanager->executeHooks('loadStatsSupplierInvoice', $parameters, $this, $action); From e5449c7a67c7251f526a7e5a6b361c35a4a6457c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Dec 2024 18:53:16 +0100 Subject: [PATCH 33/77] fix phpstan --- htdocs/core/modules/modStock.class.php | 2 +- htdocs/product/class/product.class.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/modStock.class.php b/htdocs/core/modules/modStock.class.php index 1531a9245ae..bd6f23aeb9d 100644 --- a/htdocs/core/modules/modStock.class.php +++ b/htdocs/core/modules/modStock.class.php @@ -44,7 +44,7 @@ class modStock extends DolibarrModules */ public function __construct($db) { - global $langs; + global $conf, $langs; // do not remove $conf $this->db = $db; $this->numero = 52; diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 66d3bbe97c6..a94aa6d490a 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -653,12 +653,12 @@ class Product extends CommonObject public $stats_bom = array(); /** - * @var array{}|array{customers:int,nb:int,rows:int,qty:float} + * @var array{}|array{customers:int,nb:int,rows:int,qty:float} stats mrp to consume */ public $stats_mrptoconsume = array(); /** - * @var array{}|array{customers:int,nb:int,rows:int,qty:float} + * @var array{}|array{customers:int,nb:int,rows:int,qty:float} stats mrp to produce */ public $stats_mrptoproduce = array(); From e72f23895b5a609f2088fc851120893ee4fa2bc2 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Wed, 11 Dec 2024 19:40:39 +0100 Subject: [PATCH 34/77] Fix regression --- htdocs/core/modules/modStock.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modStock.class.php b/htdocs/core/modules/modStock.class.php index 1531a9245ae..62b15d2116e 100644 --- a/htdocs/core/modules/modStock.class.php +++ b/htdocs/core/modules/modStock.class.php @@ -44,7 +44,7 @@ class modStock extends DolibarrModules */ public function __construct($db) { - global $langs; + global $conf, $langs; // $conf is used by inc.php $this->db = $db; $this->numero = 52; From 9733ac1f591defae61eeefa1b36875573bf90d2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Dec 2024 20:03:59 +0100 Subject: [PATCH 35/77] fix phpstan --- build/phpstan/phpstan-baseline.neon | 36 ----------------------------- htdocs/public/payment/paymentok.php | 26 ++++++++------------- 2 files changed, 10 insertions(+), 52 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index b436d3ce5d3..dd84a15d6e4 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -28482,42 +28482,6 @@ parameters: count: 1 path: ../../htdocs/public/payment/newpayment.php - - - message: '#^Variable \$PAYPAL_API_KO might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/public/payment/newpayment.php - - - - message: '#^Variable \$PAYPAL_API_OK might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/public/payment/newpayment.php - - - - message: '#^Variable \$PAYPAL_API_PASSWORD might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/public/payment/newpayment.php - - - - message: '#^Variable \$PAYPAL_API_SANDBOX might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/public/payment/newpayment.php - - - - message: '#^Variable \$PAYPAL_API_SIGNATURE might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/public/payment/newpayment.php - - - - message: '#^Variable \$PAYPAL_API_USER might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/public/payment/newpayment.php - - message: '#^Variable \$attendee might not be defined\.$#' identifier: variable.undefined diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index 8fa92e88b89..2abb3b01311 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -77,23 +77,17 @@ $hookmanager->initHooks(array('newpayment')); $langs->loadLangs(array("main", "other", "dict", "bills", "companies", "paybox", "paypal", "stripe")); // Clean parameters +$PAYPAL_API_USER = ""; +$PAYPAL_API_PASSWORD = ""; +$PAYPAL_API_SIGNATURE = ""; +$PAYPAL_API_SANDBOX = ""; +$PAYPALTOKEN = ""; +$PAYPALPAYERID = ""; if (isModEnabled('paypal')) { - $PAYPAL_API_USER = ""; - if (getDolGlobalString('PAYPAL_API_USER')) { - $PAYPAL_API_USER = getDolGlobalString('PAYPAL_API_USER'); - } - $PAYPAL_API_PASSWORD = ""; - if (getDolGlobalString('PAYPAL_API_PASSWORD')) { - $PAYPAL_API_PASSWORD = getDolGlobalString('PAYPAL_API_PASSWORD'); - } - $PAYPAL_API_SIGNATURE = ""; - if (getDolGlobalString('PAYPAL_API_SIGNATURE')) { - $PAYPAL_API_SIGNATURE = getDolGlobalString('PAYPAL_API_SIGNATURE'); - } - $PAYPAL_API_SANDBOX = ""; - if (getDolGlobalString('PAYPAL_API_SANDBOX')) { - $PAYPAL_API_SANDBOX = getDolGlobalString('PAYPAL_API_SANDBOX'); - } + $PAYPAL_API_USER = getDolGlobalString('PAYPAL_API_USER'); + $PAYPAL_API_PASSWORD = getDolGlobalString('PAYPAL_API_PASSWORD'); + $PAYPAL_API_SIGNATURE = getDolGlobalString('PAYPAL_API_SIGNATURE'); + $PAYPAL_API_SANDBOX = getDolGlobalString('PAYPAL_API_SANDBOX'); /*$PAYPAL_API_OK = ""; if ($urlok) { $PAYPAL_API_OK = $urlok; From 0f3098689038bed1d79e296ee984b3b3f34a9d91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Dec 2024 20:07:27 +0100 Subject: [PATCH 36/77] fix phpstan --- htdocs/public/payment/paymentko.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/public/payment/paymentko.php b/htdocs/public/payment/paymentko.php index f99deda6845..a8ae18fb64d 100644 --- a/htdocs/public/payment/paymentko.php +++ b/htdocs/public/payment/paymentko.php @@ -71,7 +71,8 @@ if (isModEnabled('paypal')) { */ $langs->loadLangs(array("main", "other", "dict", "bills", "companies", "paybox", "paypal", "stripe")); - +$PAYPALTOKEN = ""; +$PAYPALPAYERID = ""; if (isModEnabled('paypal')) { $PAYPALTOKEN = GETPOST('TOKEN'); if (empty($PAYPALTOKEN)) { From 58e2cd6afdc465ef9c22a6d142bd1273028560a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Dec 2024 20:12:03 +0100 Subject: [PATCH 37/77] fix phpstan --- htdocs/public/payment/newpayment.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 54af1723370..048f523bc08 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -231,6 +231,8 @@ $ref = $REF = GETPOST('ref', 'alpha'); $TAG = GETPOST("tag", 'alpha'); $FULLTAG = GETPOST("fulltag", 'alpha'); // fulltag is tag with more information $SECUREKEY = GETPOST("securekey"); // Secure key +$PAYPAL_API_OK = ""; +$PAYPAL_API_KO = ""; if ($paymentmethod && !preg_match('/'.preg_quote('PM='.$paymentmethod, '/').'/', $FULLTAG)) { $FULLTAG .= ($FULLTAG ? '.' : '').'PM='.$paymentmethod; From 8716550a9a2e878214c5ce7558343148482431c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Dec 2024 20:14:49 +0100 Subject: [PATCH 38/77] fix phpstan --- htdocs/public/payment/newpayment.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 048f523bc08..b7da4eded52 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -233,6 +233,7 @@ $FULLTAG = GETPOST("fulltag", 'alpha'); // fulltag is tag with more information $SECUREKEY = GETPOST("securekey"); // Secure key $PAYPAL_API_OK = ""; $PAYPAL_API_KO = ""; +$PAYPAL_API_SANDBOX = ""; if ($paymentmethod && !preg_match('/'.preg_quote('PM='.$paymentmethod, '/').'/', $FULLTAG)) { $FULLTAG .= ($FULLTAG ? '.' : '').'PM='.$paymentmethod; @@ -286,7 +287,11 @@ $urlko = preg_replace('/&$/', '', $urlko); // Remove last & @phan-var-force string $PAYPAL_API_OK @phan-var-force string $PAYPAL_API_KO '; - +/** +* @var string $PAYPAL_API_SANDBOX +* @var string $PAYPAL_API_OK +* @var string $PAYPAL_API_KO +*/ if ((empty($paymentmethod) || $paymentmethod == 'paypal') && isModEnabled('paypal')) { require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php'; require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypalfunctions.lib.php'; From d2754efbe4d87166d2f928986a9752c2c0e193ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Dec 2024 20:23:04 +0100 Subject: [PATCH 39/77] fix phpstan --- htdocs/public/payment/newpayment.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index b7da4eded52..78a4b96e72e 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -234,6 +234,9 @@ $SECUREKEY = GETPOST("securekey"); // Secure key $PAYPAL_API_OK = ""; $PAYPAL_API_KO = ""; $PAYPAL_API_SANDBOX = ""; +$PAYPAL_API_USER = ""; +$PAYPAL_API_PASSWORD = ""; +$PAYPAL_API_SIGNATURE = ""; if ($paymentmethod && !preg_match('/'.preg_quote('PM='.$paymentmethod, '/').'/', $FULLTAG)) { $FULLTAG .= ($FULLTAG ? '.' : '').'PM='.$paymentmethod; @@ -288,10 +291,12 @@ $urlko = preg_replace('/&$/', '', $urlko); // Remove last & @phan-var-force string $PAYPAL_API_KO '; /** -* @var string $PAYPAL_API_SANDBOX -* @var string $PAYPAL_API_OK -* @var string $PAYPAL_API_KO -*/ + * @var string $PAYPAL_API_SANDBOX + * @var string $PAYPAL_API_OK + * @var string $PAYPAL_API_KO + * @var string $PAYPAL_API_PASSWORD + * @var string $PAYPAL_API_SIGNATURE + */ if ((empty($paymentmethod) || $paymentmethod == 'paypal') && isModEnabled('paypal')) { require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php'; require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypalfunctions.lib.php'; From 69ecc4c74368ea3b8bde08e21f3f9787c17d71c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Dec 2024 20:28:56 +0100 Subject: [PATCH 40/77] fix phpstan --- htdocs/public/payment/newpayment.php | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 78a4b96e72e..7b1f8ab4226 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -290,14 +290,9 @@ $urlko = preg_replace('/&$/', '', $urlko); // Remove last & @phan-var-force string $PAYPAL_API_OK @phan-var-force string $PAYPAL_API_KO '; -/** - * @var string $PAYPAL_API_SANDBOX - * @var string $PAYPAL_API_OK - * @var string $PAYPAL_API_KO - * @var string $PAYPAL_API_PASSWORD - * @var string $PAYPAL_API_SIGNATURE - */ + if ((empty($paymentmethod) || $paymentmethod == 'paypal') && isModEnabled('paypal')) { + global $PAYPAL_API_SANDBOX, $PAYPAL_API_OK, $PAYPAL_API_KO, $PAYPAL_API_PASSWORD, $PAYPAL_API_SIGNATURE; require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php'; require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypalfunctions.lib.php'; From a7614342cd041473db3d5019db3e870f8001b030 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Dec 2024 20:38:48 +0100 Subject: [PATCH 41/77] fix phpstan --- htdocs/paypal/lib/paypalfunctions.lib.php | 27 +++++++---------------- htdocs/public/payment/newpayment.php | 2 +- 2 files changed, 9 insertions(+), 20 deletions(-) diff --git a/htdocs/paypal/lib/paypalfunctions.lib.php b/htdocs/paypal/lib/paypalfunctions.lib.php index b3a714489a2..eba524caab4 100644 --- a/htdocs/paypal/lib/paypalfunctions.lib.php +++ b/htdocs/paypal/lib/paypalfunctions.lib.php @@ -1,7 +1,8 @@ - * Copyright (C) 2011 Regis Houssin - * Copyright (C) 2024 MDW +/* Copyright (C) 2010-2011 Laurent Destailleur + * Copyright (C) 2011 Regis Houssin + * Copyright (C) 2024 MDW + * Copyright (C) 2024 Frédéric France * * 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 @@ -57,22 +58,10 @@ if (getDolGlobalString('PAYPAL_API_SANDBOX') || GETPOST('forcesandbox', 'alpha') } // Clean parameters -$PAYPAL_API_USER = ""; -if (getDolGlobalString('PAYPAL_API_USER')) { - $PAYPAL_API_USER = getDolGlobalString('PAYPAL_API_USER'); -} -$PAYPAL_API_PASSWORD = ""; -if (getDolGlobalString('PAYPAL_API_PASSWORD')) { - $PAYPAL_API_PASSWORD = getDolGlobalString('PAYPAL_API_PASSWORD'); -} -$PAYPAL_API_SIGNATURE = ""; -if (getDolGlobalString('PAYPAL_API_SIGNATURE')) { - $PAYPAL_API_SIGNATURE = getDolGlobalString('PAYPAL_API_SIGNATURE'); -} -$PAYPAL_API_SANDBOX = ""; -if (getDolGlobalString('PAYPAL_API_SANDBOX')) { - $PAYPAL_API_SANDBOX = getDolGlobalString('PAYPAL_API_SANDBOX'); -} +$PAYPAL_API_USER = getDolGlobalString('PAYPAL_API_USER'); +$PAYPAL_API_PASSWORD = getDolGlobalString('PAYPAL_API_PASSWORD'); +$PAYPAL_API_SIGNATURE = getDolGlobalString('PAYPAL_API_SIGNATURE'); +$PAYPAL_API_SANDBOX = getDolGlobalString('PAYPAL_API_SANDBOX'); // Proxy $PROXY_HOST = getDolGlobalString('MAIN_PROXY_HOST'); diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 7b1f8ab4226..3ad6cbb59fa 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -292,7 +292,7 @@ $urlko = preg_replace('/&$/', '', $urlko); // Remove last & '; if ((empty($paymentmethod) || $paymentmethod == 'paypal') && isModEnabled('paypal')) { - global $PAYPAL_API_SANDBOX, $PAYPAL_API_OK, $PAYPAL_API_KO, $PAYPAL_API_PASSWORD, $PAYPAL_API_SIGNATURE; + global $PAYPAL_API_SANDBOX, $PAYPAL_API_OK, $PAYPAL_API_KO, $PAYPAL_API_USER, $PAYPAL_API_PASSWORD, $PAYPAL_API_SIGNATURE; require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php'; require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypalfunctions.lib.php'; From a85bb16de514d6ed8376a1d003dfc782db7c6978 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Dec 2024 20:44:48 +0100 Subject: [PATCH 42/77] fix phpstan --- htdocs/paypal/lib/paypal.lib.php | 31 ++++++++++--------------------- 1 file changed, 10 insertions(+), 21 deletions(-) diff --git a/htdocs/paypal/lib/paypal.lib.php b/htdocs/paypal/lib/paypal.lib.php index 15ed29f8d9f..cd942116585 100644 --- a/htdocs/paypal/lib/paypal.lib.php +++ b/htdocs/paypal/lib/paypal.lib.php @@ -1,7 +1,8 @@ - * Copyright (C) 2011-2012 Regis Houssin - * Copyright (C) 2024 MDW +/* Copyright (C) 2008-2012 Laurent Destailleur + * Copyright (C) 2011-2012 Regis Houssin + * Copyright (C) 2024 MDW + * Copyright (C) 2024 Frédéric France * * 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 @@ -467,22 +468,10 @@ function hash_call($methodName, $nvpStr) } // Clean parameters - $PAYPAL_API_USER = ""; - if (getDolGlobalString('PAYPAL_API_USER')) { - $PAYPAL_API_USER = getDolGlobalString('PAYPAL_API_USER'); - } - $PAYPAL_API_PASSWORD = ""; - if (getDolGlobalString('PAYPAL_API_PASSWORD')) { - $PAYPAL_API_PASSWORD = getDolGlobalString('PAYPAL_API_PASSWORD'); - } - $PAYPAL_API_SIGNATURE = ""; - if (getDolGlobalString('PAYPAL_API_SIGNATURE')) { - $PAYPAL_API_SIGNATURE = getDolGlobalString('PAYPAL_API_SIGNATURE'); - } - $PAYPAL_API_SANDBOX = ""; - if (getDolGlobalString('PAYPAL_API_SANDBOX')) { - $PAYPAL_API_SANDBOX = getDolGlobalString('PAYPAL_API_SANDBOX'); - } + $PAYPAL_API_USER = getDolGlobalString('PAYPAL_API_USER'); + $PAYPAL_API_PASSWORD = getDolGlobalString('PAYPAL_API_PASSWORD'); + $PAYPAL_API_SIGNATURE = getDolGlobalString('PAYPAL_API_SIGNATURE'); + $PAYPAL_API_SANDBOX = getDolGlobalString('PAYPAL_API_SANDBOX'); // TODO END problem with triggers dol_syslog("Paypal API endpoint ".$API_Endpoint); @@ -514,8 +503,8 @@ function hash_call($methodName, $nvpStr) curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, ($ssl_verifypeer ? true : false)); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, ($ssl_verifypeer ? true : false)); - curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, !getDolGlobalString('MAIN_USE_CONNECT_TIMEOUT') ? 5 : $conf->global->MAIN_USE_CONNECT_TIMEOUT); - curl_setopt($ch, CURLOPT_TIMEOUT, !getDolGlobalString('MAIN_USE_RESPONSE_TIMEOUT') ? 30 : $conf->global->MAIN_USE_RESPONSE_TIMEOUT); + curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, getDolGlobalInt('MAIN_USE_CONNECT_TIMEOUT', 5)); + curl_setopt($ch, CURLOPT_TIMEOUT, getDolGlobalInt('MAIN_USE_RESPONSE_TIMEOUT', 30)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); From d01d63da0b99c514323c5d8bfd384bac91100634 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Dec 2024 20:53:45 +0100 Subject: [PATCH 43/77] fix phpstan --- htdocs/paypal/admin/paypal.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/paypal/admin/paypal.php b/htdocs/paypal/admin/paypal.php index 22a53c5d1ef..fab3c789429 100644 --- a/htdocs/paypal/admin/paypal.php +++ b/htdocs/paypal/admin/paypal.php @@ -267,7 +267,7 @@ if (isModEnabled("bank")) { print '
'; print $langs->trans("CSSUrlForPaymentForm").''; print ''; -print '   '.$langs->trans("Example").': http://mysite/mycss.css'; +print '   '.$langs->trans("Example").': https://mysite/mycss.css'; print '
'; + print(!empty($val) ? convertSecondToTime((int) $val, 'allhourmin') : 0); + print ''; + print(!empty($val) ? $val : ''); + print ''; + print price2num(!empty($val) ? $val : 0, 'MS'); + print ''; + print price(!empty($val) ? $val : 0); + print ''; - print(!empty($val) ? convertSecondToTime((int) $val, 'allhourmin') : 0); - print ''; - print(!empty($val) ? $val : ''); - print ''; - print price2num(!empty($val) ? $val : 0, 'MS'); - print ''; - print price(!empty($val) ? $val : 0); - print ''; if (!is_array($typenArray) || count($typenArray) == 0) { $typenArray = $formcompany->typent_array(1); } + print ''; if (!empty($obj->typent_code)) { print $typenArray[$obj->typent_code]; } @@ -2357,10 +2357,10 @@ if ($num > 0) { } // Staff if (!empty($arrayfields['staff.code']['checked'])) { - print ''; if (!is_array($conf->cache['staff']) || count($conf->cache['staff']) == 0) { $conf->cache['staff'] = $formcompany->effectif_array(1); } + print ''; print $conf->cache['staff'][$obj->staff_code]; print ''; - print ''; // $object_link can be a ''; - // Amount print ''.price($block->amounts).''; + //print ''; if (!$checkresult[$block->id] || ($loweridinerror && $block->id >= $loweridinerror)) { // If error if ($checkresult[$block->id]) { print $form->textwithpicto('', $langs->trans('OkCheckFingerprintValidityButChainIsKo')); + } else { + //print $form->textwithpicto('', $langs->trans('KoCheckFingerprintValidity')); } } @@ -681,6 +677,12 @@ if (is_array($blocks)) { } print ''; + print ''; // $object_link can be a ''; + // Action column if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index 00a158952f0..dda8647e791 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -902,12 +902,10 @@ class BlockedLog */ public function create($user, $forcesignature = '') { - global $conf, $langs, $hookmanager; + global $conf, $langs; $langs->load('blockedlog'); - $error = 0; - // Clean data $this->amounts = (float) $this->amounts; @@ -942,9 +940,9 @@ class BlockedLog $this->db->begin(); - $previoushash = $this->getPreviousHash(1, 0); // This get last record and lock database until insert is done + $previoushash = $this->getPreviousHash(1, 0); // This get last record and lock database until insert is done and transaction closed - $keyforsignature = $this->buildKeyForSignature(); + $keyforsignature = $this->buildKeyForSignature(); // All the information for the has (meta data + data saved) include_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php'; diff --git a/htdocs/langs/en_US/blockedlog.lang b/htdocs/langs/en_US/blockedlog.lang index 75ab23f6b73..9b74b8a787c 100644 --- a/htdocs/langs/en_US/blockedlog.lang +++ b/htdocs/langs/en_US/blockedlog.lang @@ -7,7 +7,7 @@ BrowseBlockedLog=Unalterable logs ShowAllFingerPrintsMightBeTooLong=Show all archived logs (might be long) ShowAllFingerPrintsErrorsMightBeTooLong=Show all non-valid archive logs (might be long) DownloadBlockChain=Download fingerprints -KoCheckFingerprintValidity=Archived log entry is not valid. It means someone (a hacker?) has modified some data of this record after it was recorded, or has erased the previous archived record (check that line with previous # exists) or has modified checksum of the previous record. +KoCheckFingerprintValidity=Archived log entry is not valid. It means someone (a hacker?) has modified some data of this record after it was recorded, OR has erased the previous archived record (check that the line with previous # exists) OR has modified the checksum of the previous record. OkCheckFingerprintValidity=Archived log record is valid. The data on this line was not modified and the entry follows the previous one. OkCheckFingerprintValidityButChainIsKo=Archived log seems valid compared to previous one but the chain was corrupted previously. AddedByAuthority=Stored into remote authority From 837fadcc7a23d83c2f1662b4ceb81a4bdfe56cad Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 13 Dec 2024 12:53:55 +0100 Subject: [PATCH 63/77] Fix filter on event type --- htdocs/blockedlog/admin/blockedlog_list.php | 7 +++-- htdocs/blockedlog/class/blockedlog.class.php | 32 ++++++++++++-------- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/htdocs/blockedlog/admin/blockedlog_list.php b/htdocs/blockedlog/admin/blockedlog_list.php index 71178aff819..376120d7981 100644 --- a/htdocs/blockedlog/admin/blockedlog_list.php +++ b/htdocs/blockedlog/admin/blockedlog_list.php @@ -80,7 +80,7 @@ $search_end = -1; if (GETPOST('search_endyear') != '') { $search_end = dol_mktime(23, 59, 59, $search_endmonth, $search_endday, $search_endyear); } -$search_code = GETPOST('search_code', 'alpha'); +$search_code = GETPOST('search_code', 'array:alpha'); $search_ref = GETPOST('search_ref', 'alpha'); $search_amount = GETPOST('search_amount', 'alpha'); @@ -138,7 +138,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_fk_user = ''; $search_start = -1; $search_end = -1; - $search_code = ''; + $search_code = array(); $search_ref = ''; $search_amount = ''; $search_showonlyerrors = 0; @@ -496,7 +496,8 @@ print ''; -print $form->selectarray('search_code', $block_static->trackedevents, $search_code, 1, 0, 0, '', 1, 0, 0, 'ASC', 'maxwidth150', 1); +//print $form->selectarray('search_code', $block_static->trackedevents, $search_code, 1, 0, 0, '', 1, 0, 0, 'ASC', 'maxwidth150', 1); +print $form->multiselectarray('search_code', $block_static->trackedevents, $search_code, 0, 0, 'maxwidth150', 1); print '