From b0677c9597d9f382529ffe6081feac650ac633e1 Mon Sep 17 00:00:00 2001 From: Jon Bendtsen Date: Mon, 11 May 2026 20:36:37 +0200 Subject: [PATCH 1/6] NEW show last 10 events on conference attendee card (#38170) Co-authored-by: Jon Bendtsen --- .../conferenceorboothattendee_card.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/htdocs/eventorganization/conferenceorboothattendee_card.php b/htdocs/eventorganization/conferenceorboothattendee_card.php index 9f2436fac5f..32c524b3530 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_card.php +++ b/htdocs/eventorganization/conferenceorboothattendee_card.php @@ -716,6 +716,18 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print '
'; + $MAXEVENT = 10; + + $morehtmlcenter = '
'; + $morehtmlcenter .= dolGetButtonTitle($langs->trans('FullConversation'), '', 'fa fa-comments imgforviewmode', DOL_URL_ROOT.'/societe/messaging.php?socid='.$object->id); + $morehtmlcenter .= dolGetButtonTitle($langs->trans('FullList'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/societe/agenda.php?socid='.$object->id); + $morehtmlcenter .= '
'; + + // List of actions on element + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; + $formactions = new FormActions($db); + $somethingshown = $formactions->showactions($object, 'conferenceorboothattendee', 0, 1, '', $MAXEVENT, '', $morehtmlcenter); // Show all action for attendee + print '
'; } From 63833674bb69e7196ea8af42cc213244e50b1c9b Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 May 2026 20:39:31 +0200 Subject: [PATCH 2/6] Qual: Fix PHPStan notices (#38039) * Qual: Fix PHPStan notices # Qual: Fix PHPStan notices Fix multiple PHPStan notices, mostly possibly undefined variable * Qual: Fix Phan notices * Qual: Fix Phan notice, $id declared before include * Fix array initialisations * Qual: Update phpstan baseline * Qual: Fix Phan notices * Qual: Update phan baseline --- dev/build/phpstan/phpstan-baseline.neon | 564 ------------------ dev/tools/phan/baseline.txt | 4 +- .../accountancy/class/bookkeeping.class.php | 6 +- .../accountancy/journal/purchasesjournal.php | 63 +- htdocs/compta/index.php | 3 +- htdocs/compta/journal/purchasesjournal.php | 87 ++- htdocs/compta/journal/sellsjournal.php | 12 +- htdocs/compta/paiement/card.php | 5 +- htdocs/compta/resultat/clientfourn.php | 6 +- htdocs/compta/resultat/index.php | 4 +- htdocs/compta/resultat/result.php | 29 +- htdocs/compta/stats/cabyuser.php | 3 +- htdocs/compta/stats/casoc.php | 3 +- htdocs/compta/stats/index.php | 21 +- htdocs/compta/stats/supplier_turnover.php | 4 +- .../stats/supplier_turnover_by_thirdparty.php | 1 + htdocs/compta/tva/index.php | 16 +- htdocs/compta/tva/payments.php | 1 + htdocs/contact/ajax/contact.php | 4 +- htdocs/core/actions_comments.inc.php | 8 +- htdocs/core/actions_dellink.inc.php | 10 +- htdocs/core/actions_printing.inc.php | 11 +- htdocs/core/class/fileupload.class.php | 3 +- htdocs/core/class/html.formbarcode.class.php | 1 + htdocs/core/class/html.formcompany.class.php | 29 +- htdocs/core/class/html.formprojet.class.php | 3 + htdocs/core/class/utils.class.php | 5 +- htdocs/core/customreports.php | 26 +- htdocs/core/lib/admin.lib.php | 3 +- htdocs/core/lib/files.lib.php | 32 +- htdocs/core/lib/functions.lib.php | 14 +- htdocs/core/lib/pdf.lib.php | 2 +- 32 files changed, 262 insertions(+), 721 deletions(-) diff --git a/dev/build/phpstan/phpstan-baseline.neon b/dev/build/phpstan/phpstan-baseline.neon index cf1c36f7c31..d467bb26174 100644 --- a/dev/build/phpstan/phpstan-baseline.neon +++ b/dev/build/phpstan/phpstan-baseline.neon @@ -2040,90 +2040,6 @@ parameters: count: 1 path: ../../../htdocs/compta/index.php - - - message: '#^Variable \$total_ht might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/compta/index.php - - - - message: '#^Variable \$total_ttc might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/compta/index.php - - - - message: '#^Variable \$tabcompany might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../../htdocs/compta/journal/purchasesjournal.php - - - - message: '#^Variable \$tabht might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/compta/journal/purchasesjournal.php - - - - message: '#^Variable \$tablocaltax1 might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/compta/journal/purchasesjournal.php - - - - message: '#^Variable \$tablocaltax2 might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/compta/journal/purchasesjournal.php - - - - message: '#^Variable \$tabttc might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/compta/journal/purchasesjournal.php - - - - message: '#^Variable \$tabtva might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/compta/journal/purchasesjournal.php - - - - message: '#^Variable \$tabcompany might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../../htdocs/compta/journal/sellsjournal.php - - - - message: '#^Variable \$tabht might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/compta/journal/sellsjournal.php - - - - message: '#^Variable \$tablocaltax1 might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/compta/journal/sellsjournal.php - - - - message: '#^Variable \$tablocaltax2 might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/compta/journal/sellsjournal.php - - - - message: '#^Variable \$tabttc might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/compta/journal/sellsjournal.php - - - - message: '#^Variable \$tabtva might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/compta/journal/sellsjournal.php - - message: '#^Variable \$morehtmlref might not be defined\.$#' identifier: variable.undefined @@ -2196,12 +2112,6 @@ parameters: count: 2 path: ../../../htdocs/compta/paiement.php - - - message: '#^Variable \$marginInfo might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/compta/paiement/card.php - - message: '#^Ternary operator condition is always false\.$#' identifier: ternary.alwaysFalse @@ -2346,54 +2256,18 @@ parameters: count: 1 path: ../../../htdocs/compta/resultat/clientfourn.php - - - message: '#^Variable \$description might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/compta/resultat/clientfourn.php - - - - message: '#^Variable \$sql might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/compta/resultat/clientfourn.php - - message: '#^Variable \$annee might not be defined\.$#' identifier: variable.undefined count: 1 path: ../../../htdocs/compta/resultat/index.php - - - message: '#^Variable \$description might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/compta/resultat/index.php - - - - message: '#^Call to function is_array\(\) with non\-empty\-array\\}\> will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../../htdocs/compta/resultat/result.php - - message: '#^Ternary operator condition is always false\.$#' identifier: ternary.alwaysFalse count: 1 path: ../../../htdocs/compta/resultat/result.php - - - message: '#^Variable \$code might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../../htdocs/compta/resultat/result.php - - - - message: '#^Variable \$description might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/compta/resultat/result.php - - message: '#^If condition is always true\.$#' identifier: if.alwaysTrue @@ -2466,36 +2340,18 @@ parameters: count: 1 path: ../../../htdocs/compta/stats/cabyuser.php - - - message: '#^Variable \$sql might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/compta/stats/cabyuser.php - - message: '#^Ternary operator condition is always false\.$#' identifier: ternary.alwaysFalse count: 1 path: ../../../htdocs/compta/stats/casoc.php - - - message: '#^Variable \$sql might not be defined\.$#' - identifier: variable.undefined - count: 5 - path: ../../../htdocs/compta/stats/casoc.php - - message: '#^Ternary operator condition is always false\.$#' identifier: ternary.alwaysFalse count: 1 path: ../../../htdocs/compta/stats/index.php - - - message: '#^Variable \$sql might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/compta/stats/index.php - - message: '#^Loose comparison using \=\= between ''BOOKKEEPINGCOLLECTED''\|''RECETTES\-DEPENSES'' and ''RECETTES\-DEPENSES'' will always evaluate to true\.$#' identifier: equal.alwaysTrue @@ -2514,12 +2370,6 @@ parameters: count: 1 path: ../../../htdocs/compta/stats/supplier_turnover.php - - - message: '#^Variable \$sql might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/compta/stats/supplier_turnover.php - - message: '#^Ternary operator condition is always false\.$#' identifier: ternary.alwaysFalse @@ -2532,12 +2382,6 @@ parameters: count: 1 path: ../../../htdocs/compta/stats/supplier_turnover_by_thirdparty.php - - - message: '#^Variable \$sql might not be defined\.$#' - identifier: variable.undefined - count: 5 - path: ../../../htdocs/compta/stats/supplier_turnover_by_thirdparty.php - - message: '#^If condition is always true\.$#' identifier: if.alwaysTrue @@ -2604,30 +2448,12 @@ parameters: count: 1 path: ../../../htdocs/compta/tva/index.php - - - message: '#^Variable \$date_end might not be defined\.$#' - identifier: variable.undefined - count: 4 - path: ../../../htdocs/compta/tva/index.php - - - - message: '#^Variable \$date_start might not be defined\.$#' - identifier: variable.undefined - count: 4 - path: ../../../htdocs/compta/tva/index.php - - message: '#^If condition is always true\.$#' identifier: if.alwaysTrue count: 2 path: ../../../htdocs/compta/tva/payments.php - - - message: '#^Variable \$num might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../../htdocs/compta/tva/payments.php - - message: '#^Call to function is_array\(\) with list\ will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -2640,12 +2466,6 @@ parameters: count: 1 path: ../../../htdocs/contact/ajax/contact.php - - - message: '#^Variable \$action might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/contact/ajax/contact.php - - message: '#^If condition is always true\.$#' identifier: if.alwaysTrue @@ -2766,36 +2586,6 @@ parameters: count: 1 path: ../../../htdocs/core/actions_builddoc.inc.php - - - message: '#^Variable \$action might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../../htdocs/core/actions_comments.inc.php - - - - message: '#^Variable \$id might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../../htdocs/core/actions_comments.inc.php - - - - message: '#^Variable \$idcomment might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../../htdocs/core/actions_comments.inc.php - - - - message: '#^Variable \$withproject might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../../htdocs/core/actions_comments.inc.php - - - - message: '#^Variable \$id might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../../htdocs/core/actions_dellink.inc.php - - message: '#^Call to function is_object\(\) with object will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -2844,12 +2634,6 @@ parameters: count: 1 path: ../../../htdocs/core/actions_massactions.inc.php - - - message: '#^Variable \$classfile might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/core/actions_printing.inc.php - - message: '#^Call to function is_array\(\) with list\ will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -3318,12 +3102,6 @@ parameters: count: 1 path: ../../../htdocs/core/class/fileupload.class.php - - - message: '#^Variable \$object might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/core/class/fileupload.class.php - - message: '#^Call to function is_array\(\) with non\-empty\-array will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -3390,12 +3168,6 @@ parameters: count: 8 path: ../../../htdocs/core/class/html.form.class.php - - - message: '#^Variable \$select_encoder might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/core/class/html.formbarcode.class.php - - message: '#^Call to function is_array\(\) with non\-empty\-array will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -3414,12 +3186,6 @@ parameters: count: 1 path: ../../../htdocs/core/class/html.formcompany.class.php - - - message: '#^Variable \$idprof might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/core/class/html.formcompany.class.php - - message: '#^Call to function is_array\(\) with array\ will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -3486,12 +3252,6 @@ parameters: count: 1 path: ../../../htdocs/core/class/html.formother.class.php - - - message: '#^Variable \$labeltoshow might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/core/class/html.formprojet.class.php - - message: '#^Negated boolean expression is always false\.$#' identifier: booleanNot.alwaysFalse @@ -3804,12 +3564,6 @@ parameters: count: 3 path: ../../../htdocs/core/class/utils.class.php - - - message: '#^Variable \$moduleobj might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/core/class/utils.class.php - - message: '#^Parameter \#1 \$table of static method Diff\:\:generatePartialDiff\(\) expects array\\}\>, array\\> given\.$#' identifier: argument.type @@ -3840,24 +3594,6 @@ parameters: count: 2 path: ../../../htdocs/core/customreports.php - - - message: '#^Variable \$page might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/core/customreports.php - - - - message: '#^Variable \$sortfield might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/core/customreports.php - - - - message: '#^Variable \$sortorder might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/core/customreports.php - - message: '#^Property DoliDBMysqli\:\:\$db \(mysqli\) in empty\(\) is not falsy\.$#' identifier: empty.property @@ -3954,12 +3690,6 @@ parameters: count: 1 path: ../../../htdocs/core/lib/admin.lib.php - - - message: '#^Variable \$resarray might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../../htdocs/core/lib/admin.lib.php - - message: '#^Negated boolean expression is always false\.$#' identifier: booleanNot.alwaysFalse @@ -5328,12 +5058,6 @@ parameters: count: 1 path: ../../../htdocs/expedition/shipment.php - - - message: '#^Variable \$socid might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/expedition/stats/month.php - - message: '#^If condition is always false\.$#' identifier: if.alwaysFalse @@ -5496,12 +5220,6 @@ parameters: count: 10 path: ../../../htdocs/fourn/card.php - - - message: '#^Variable \$contact might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/fourn/class/api_supplier_orders.class.php - - message: '#^Call to function method_exists\(\) with \$this\(CommandeFournisseur\) and ''getLibStatut'' will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -6060,12 +5778,6 @@ parameters: count: 1 path: ../../../htdocs/hrm/lib/hrm_evaluation.lib.php - - - message: '#^Variable \$job might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/hrm/position.php - - message: '#^If condition is always true\.$#' identifier: if.alwaysTrue @@ -6090,24 +5802,12 @@ parameters: count: 2 path: ../../../htdocs/hrm/skill_card.php - - - message: '#^Variable \$result might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/hrm/skill_card.php - - message: '#^Call to function is_array\(\) with list will always evaluate to true\.$#' identifier: function.alreadyNarrowedType count: 2 path: ../../../htdocs/hrm/skill_tab.php - - - message: '#^Variable \$object might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/hrm/skill_tab.php - - message: '#^Ternary operator condition is always true\.$#' identifier: ternary.alwaysTrue @@ -6324,12 +6024,6 @@ parameters: count: 1 path: ../../../htdocs/index.php - - - message: '#^Variable \$boxwork might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/index.php - - message: '#^Negated boolean expression is always true\.$#' identifier: booleanNot.alwaysTrue @@ -6486,12 +6180,6 @@ parameters: count: 1 path: ../../../htdocs/loan/payment/payment.php - - - message: '#^Variable \$result might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../../htdocs/loan/schedule.php - - message: '#^Call to function is_array\(\) with array\ will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -6606,30 +6294,6 @@ parameters: count: 3 path: ../../../htdocs/modulebuilder/index.php - - - message: '#^Variable \$class might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/modulebuilder/index.php - - - - message: '#^Variable \$moduleobj might not be defined\.$#' - identifier: variable.undefined - count: 4 - path: ../../../htdocs/modulebuilder/index.php - - - - message: '#^Variable \$object might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../../htdocs/modulebuilder/index.php - - - - message: '#^Variable \$outputfilezip might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/modulebuilder/index.php - - message: '#^Variable \$proparrayofkeyval in isset\(\) always exists and is not nullable\.$#' identifier: isset.variable @@ -7266,12 +6930,6 @@ parameters: count: 6 path: ../../../htdocs/printing/admin/printing.php - - - message: '#^Variable \$classfile might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../../htdocs/printing/admin/printing.php - - message: '#^Result of \|\| is always true\.$#' identifier: booleanOr.alwaysTrue @@ -7638,12 +7296,6 @@ parameters: count: 1 path: ../../../htdocs/product/stock/massstockmove.php - - - message: '#^Variable \$producttmp might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/product/stock/massstockmove.php - - message: '#^Loose comparison using \=\= between 1 and 2 will always evaluate to false\.$#' identifier: equal.alwaysFalse @@ -7704,12 +7356,6 @@ parameters: count: 1 path: ../../../htdocs/product/stock/replenish.php - - - message: '#^Variable \$id might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/product/stock/replenish.php - - message: '#^Call to function property_exists\(\) with \$this\(StockTransfer\) and ''socid'' will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -7806,12 +7452,6 @@ parameters: count: 4 path: ../../../htdocs/projet/activity/perweek.php - - - message: '#^Variable \$res might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/projet/admin/project.php - - message: '#^Call to function method_exists\(\) with Project and ''fetchComments'' will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -7962,48 +7602,12 @@ parameters: count: 1 path: ../../../htdocs/projet/element.php - - - message: '#^Variable \$dateformat might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/projet/ganttchart.inc.php - - - - message: '#^Variable \$dateformatinput might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/projet/ganttchart.inc.php - - - - message: '#^Variable \$datehourformat might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/projet/ganttchart.inc.php - - - - message: '#^Variable \$task_dependencies might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../../htdocs/projet/ganttchart.inc.php - - - - message: '#^Variable \$tasks might not be defined\.$#' - identifier: variable.undefined - count: 5 - path: ../../../htdocs/projet/ganttchart.inc.php - - message: '#^Call to function method_exists\(\) with Project and ''fetchComments'' will always evaluate to true\.$#' identifier: function.alreadyNarrowedType count: 1 path: ../../../htdocs/projet/ganttview.php - - - message: '#^Variable \$param might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/projet/ganttview.php - - message: '#^Comparison operation "\>" between 0 and 0 is always false\.$#' identifier: greater.alwaysFalse @@ -8058,18 +7662,6 @@ parameters: count: 3 path: ../../../htdocs/projet/list.php - - - message: '#^Variable \$permissiontoadd might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/projet/list.php - - - - message: '#^Variable \$permissiontoread might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/projet/list.php - - message: '#^Call to function method_exists\(\) with Project and ''fetchComments'' will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -8100,18 +7692,6 @@ parameters: count: 1 path: ../../../htdocs/projet/tasks.php - - - message: '#^Variable \$massactionbutton might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../../htdocs/projet/tasks.php - - - - message: '#^Variable \$permissiontodelete might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/projet/tasks.php - - message: '#^Call to function method_exists\(\) with Project and ''fetchComments'' will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -8988,30 +8568,6 @@ parameters: count: 1 path: ../../../htdocs/reception/class/reception.class.php - - - message: '#^Variable \$mesgs might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/reception/contact.php - - - - message: '#^Variable \$objectsrc might not be defined\.$#' - identifier: variable.undefined - count: 6 - path: ../../../htdocs/reception/contact.php - - - - message: '#^Variable \$result might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../../htdocs/reception/contact.php - - - - message: '#^Variable \$origin might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/reception/document.php - - message: '#^Call to function method_exists\(\) with Reception and ''fetch_lines'' will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -9030,12 +8586,6 @@ parameters: count: 2 path: ../../../htdocs/recruitment/admin/setup.php - - - message: '#^Variable \$res might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/recruitment/admin/setup.php - - message: '#^If condition is always false\.$#' identifier: if.alwaysFalse @@ -9048,12 +8598,6 @@ parameters: count: 1 path: ../../../htdocs/recruitment/admin/setup_candidatures.php - - - message: '#^Variable \$res might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/recruitment/admin/setup_candidatures.php - - message: '#^Left side of && is always false\.$#' identifier: booleanAnd.leftAlwaysFalse @@ -9174,24 +8718,12 @@ parameters: count: 2 path: ../../../htdocs/recruitment/recruitmentcandidature_card.php - - - message: '#^Variable \$text might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/recruitment/recruitmentcandidature_card.php - - message: '#^Variable \$maxlength might not be defined\.$#' identifier: variable.undefined count: 1 path: ../../../htdocs/recruitment/recruitmentcandidature_list.php - - - message: '#^Variable \$lineid might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../../htdocs/recruitment/recruitmentjobposition_applications.php - - message: '#^Variable \$maxlength might not be defined\.$#' identifier: variable.undefined @@ -9294,12 +8826,6 @@ parameters: count: 1 path: ../../../htdocs/salaries/payments.php - - - message: '#^Variable \$resql might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../../htdocs/salaries/payments.php - - message: '#^Loose comparison using \=\= between ''salaire'' and ''bank\-transfer'' will always evaluate to false\.$#' identifier: equal.alwaysFalse @@ -9432,18 +8958,6 @@ parameters: count: 1 path: ../../../htdocs/societe/consumption.php - - - message: '#^Variable \$sql might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/societe/consumption.php - - - - message: '#^Variable \$where might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/societe/consumption.php - - message: '#^Call to function is_object\(\) with Societe will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -9480,12 +8994,6 @@ parameters: count: 1 path: ../../../htdocs/societe/paymentmodes.php - - - message: '#^Variable \$service might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/societe/paymentmodes.php - - message: '#^Loose comparison using \=\= between ''add_customer_price'' and ''add_customer_price'' will always evaluate to true\.$#' identifier: equal.alwaysTrue @@ -9504,12 +9012,6 @@ parameters: count: 2 path: ../../../htdocs/societe/price.php - - - message: '#^Variable \$massaction might not be defined\.$#' - identifier: variable.undefined - count: 4 - path: ../../../htdocs/societe/website.php - - message: '#^Right side of && is always true\.$#' identifier: booleanAnd.rightAlwaysTrue @@ -9528,12 +9030,6 @@ parameters: count: 1 path: ../../../htdocs/stripe/charge.php - - - message: '#^Variable \$type might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/stripe/charge.php - - message: '#^Loose comparison using \=\= between 7 and 4 will always evaluate to false\.$#' identifier: equal.alwaysFalse @@ -9570,30 +9066,12 @@ parameters: count: 1 path: ../../../htdocs/supplier_proposal/card.php - - - message: '#^Variable \$buyingprice might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/supplier_proposal/card.php - - - - message: '#^Variable \$classname might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/supplier_proposal/card.php - - message: '#^Variable \$fk_account might not be defined\.$#' identifier: variable.undefined count: 1 path: ../../../htdocs/supplier_proposal/card.php - - - message: '#^Variable \$fournprice might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/supplier_proposal/card.php - - message: '#^Call to function method_exists\(\) with \$this\(SupplierProposal\) and ''getLibStatut'' will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -9642,12 +9120,6 @@ parameters: count: 1 path: ../../../htdocs/supplier_proposal/list.php - - - message: '#^Variable \$dolibarr_main_url_root might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../../htdocs/takepos/admin/bar.php - - message: '#^Left side of && is always true\.$#' identifier: booleanAnd.leftAlwaysTrue @@ -9672,18 +9144,6 @@ parameters: count: 3 path: ../../../htdocs/takepos/freezone.php - - - message: '#^Variable \$db might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../../htdocs/takepos/genimg/index.php - - - - message: '#^Variable \$dolibarr_main_url_root might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/takepos/genimg/qr.php - - message: '#^Property CommonObjectLine\:\:\$product \(Product\) in empty\(\) is not falsy\.$#' identifier: empty.property @@ -9732,12 +9192,6 @@ parameters: count: 3 path: ../../../htdocs/takepos/pay.php - - - message: '#^Variable \$user might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/takepos/printbox.php - - message: '#^Loose comparison using \!\= between non\-empty\-string and '''' will always evaluate to true\.$#' identifier: notEqual.alwaysTrue @@ -9780,12 +9234,6 @@ parameters: count: 2 path: ../../../htdocs/theme/md/style.css.php - - - message: '#^Variable \$menumanager might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/theme/md/style.css.php - - message: '#^Loose comparison using \=\= between ''setsubject'' and ''setsubject'' will always evaluate to true\.$#' identifier: equal.alwaysTrue @@ -10014,12 +9462,6 @@ parameters: count: 1 path: ../../../htdocs/user/notify/card.php - - - message: '#^Variable \$dolibarr_main_authentication might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/user/passwordforgotten.php - - message: '#^Call to function is_array\(\) with array will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -10392,12 +9834,6 @@ parameters: count: 1 path: ../../../htdocs/website/index.php - - - message: '#^Variable \$atleastonepage might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/website/index.php - - message: '#^If condition is always false\.$#' identifier: if.alwaysFalse diff --git a/dev/tools/phan/baseline.txt b/dev/tools/phan/baseline.txt index 01f2013ba02..a553370e643 100644 --- a/dev/tools/phan/baseline.txt +++ b/dev/tools/phan/baseline.txt @@ -10,7 +10,7 @@ return [ // # Issue statistics: // PhanUndeclaredProperty : 380+ occurrences - // PhanUndeclaredGlobalVariable : 45+ occurrences + // PhanUndeclaredGlobalVariable : 40+ occurrences // PhanTypeMismatchArgument : 35+ occurrences // PhanTypeMismatchProperty : 20+ occurrences // PhanTypeInvalidDimOffset : 10+ occurrences @@ -94,7 +94,6 @@ return [ 'htdocs/core/modules/member/modules_cards.php' => ['PhanTypeMismatchArgument'], 'htdocs/core/modules/mrp/doc/pdf_vinci.modules.php' => ['PhanUndeclaredProperty'], 'htdocs/core/modules/mrp/mod_mo_advanced.php' => ['PhanUndeclaredProperty'], - 'htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php' => ['PhanUndeclaredProperty'], 'htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php' => ['PhanUndeclaredProperty'], 'htdocs/core/modules/propale/doc/pdf_azur.modules.php' => ['PhanUndeclaredProperty'], 'htdocs/core/modules/propale/doc/pdf_cyan.modules.php' => ['PhanUndeclaredProperty'], @@ -109,7 +108,6 @@ return [ 'htdocs/core/modules/syslog/mod_syslog_file.php' => ['PhanPluginDuplicateArrayKey'], 'htdocs/core/modules/workstation/mod_workstation_advanced.php' => ['PhanUndeclaredProperty'], 'htdocs/core/multicompany_page.php' => ['PhanTypeMismatchArgument'], - 'htdocs/core/tpl/extrafields_view.tpl.php' => ['PhanUndeclaredProperty'], 'htdocs/core/tpl/massactions_pre.tpl.php' => ['PhanTypeMismatchArgumentNullable', 'PhanUndeclaredProperty'], 'htdocs/core/tpl/objectline_view.tpl.php' => ['PhanUndeclaredProperty'], 'htdocs/core/tpl/passwordreset.tpl.php' => ['PhanUndeclaredGlobalVariable'], diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 3c8cb60454b..58eba4a738c 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -2619,9 +2619,9 @@ class BookKeeping extends CommonObject * If ACCOUNTING_LABEL_OPERATION_ON_TRANSFER is 1, we concat thirdparty name, ref. * If ACCOUNTING_LABEL_OPERATION_ON_TRANSFER is 2, we return just thirdparty name * - * @param string $thirdpartyname Thirdparty name - * @param string $reference Reference of the element - * @param string $labelaccount Label of the accounting account + * @param string $thirdpartyname Thirdparty name + * @param ?string $reference Reference of the element + * @param ?string $labelaccount Label of the accounting account * @param int<0,1> $full 0=Default, 1=Keep label intact (no trunc so HTML content is not corrupted) * @return string Label of the operation */ diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index 932bb51fe9b..bfd38bc602c 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -282,17 +282,15 @@ if ($result) { //$line = new SupplierInvoiceLine($db); //$line->fetch($obj->fdid); - $tabfac[$obj->rowid]["date"] = $db->jdate($obj->df); - $tabfac[$obj->rowid]["datereg"] = $db->jdate($obj->dlr); - $tabfac[$obj->rowid]["ref"] = $obj->ref_supplier.' ('.$obj->ref.')'; - $tabfac[$obj->rowid]["refsologest"] = $obj->ref; - $tabfac[$obj->rowid]["refsuppliersologest"] = $obj->ref_supplier; - $tabfac[$obj->rowid]["type"] = $obj->type; - $tabfac[$obj->rowid]["description"] = $obj->description; - $tabfac[$obj->rowid]["close_code"] = $obj->close_code; // close_code = 'replaced' for replacement invoices (not used in most european countries) - //$tabfac[$obj->rowid]["fk_facturefourndet"] = $obj->fdid; - // Avoid warnings + if (!array_key_exists($obj->rowid, $tabfac)) { + $tabfac[$obj->rowid] = array(); + $tabttc[$obj->rowid] = array(); + $tabht[$obj->rowid] = array(); + $tabtva[$obj->rowid] = array(); + $tablocaltax1[$obj->rowid] = array(); + $tablocaltax2[$obj->rowid] = array(); + } if (!isset($tabttc[$obj->rowid][$compta_soc])) { $tabttc[$obj->rowid][$compta_soc] = 0; } @@ -309,6 +307,16 @@ if ($result) { $tablocaltax2[$obj->rowid][$compta_localtax2] = 0; } + $tabfac[$obj->rowid]["date"] = $db->jdate($obj->df); + $tabfac[$obj->rowid]["datereg"] = $db->jdate($obj->dlr); + $tabfac[$obj->rowid]["ref"] = $obj->ref_supplier.' ('.$obj->ref.')'; + $tabfac[$obj->rowid]["refsologest"] = $obj->ref; + $tabfac[$obj->rowid]["refsuppliersologest"] = $obj->ref_supplier; + $tabfac[$obj->rowid]["type"] = $obj->type; + $tabfac[$obj->rowid]["description"] = $obj->description; + $tabfac[$obj->rowid]["close_code"] = $obj->close_code; // close_code = 'replaced' for replacement invoices (not used in most european countries) + //$tabfac[$obj->rowid]["fk_facturefourndet"] = $obj->fdid; + // VAT Reverse charge if (($mysoc->country_code == 'FR' || getDolGlobalString('ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE')) && $obj->vat_reverse_charge == 1 && (in_array($obj->country_code, $country_code_in_EEC) || getDolGlobalString('ACCOUNTING_REVERSE_CHARGE_ALSO_NON_EEC'))) { $rcvatdata = getTaxesFromId($obj->product_buy_vat . ($obj->product_buy_default_vat_code ? ' (' . $obj->product_buy_default_vat_code . ')' : ''), $mysoc, $mysoc, 0); @@ -325,6 +333,11 @@ if ($result) { $def_tva[$obj->rowid][$rcd_compta_tva][$vat_key] = $val_value; } + if (!array_key_exists($obj->rowid, $tabrctva)) { + $tabrctva[$obj->rowid] = array(); + $tabrclocaltax1[$obj->rowid] = array(); + $tabrclocaltax2[$obj->rowid] = array(); + } if (!isset($tabrctva[$obj->rowid][$rcc_compta_tva])) { $tabrctva[$obj->rowid][$rcc_compta_tva] = 0; } @@ -476,10 +489,10 @@ if ($action == 'writebookkeeping' && !$error && $user->hasRight('accounting', 'b $invoicestatic->id = (int) $key; $invoicestatic->ref = (string) $val["refsologest"]; - $invoicestatic->ref_supplier = $val["refsuppliersologest"]; + $invoicestatic->ref_supplier = (string) $val["refsuppliersologest"]; $invoicestatic->type = $val["type"]; - $invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32)); - $invoicestatic->close_code = $val["close_code"]; + $invoicestatic->description = html_entity_decode(dol_trunc((string) $val["description"], 32)); + $invoicestatic->close_code = (string) $val["close_code"]; $date = dol_print_date($val["date"], 'day'); @@ -859,11 +872,11 @@ if ($action == 'exportcsv' && !$error) { // ISO and not UTF8 ! $companystatic->fournisseur = 1; $invoicestatic->id = (int) $key; - $invoicestatic->ref = $val["refsologest"]; - $invoicestatic->ref_supplier = $val["refsuppliersologest"]; + $invoicestatic->ref = (string) $val["refsologest"]; + $invoicestatic->ref_supplier = (string) $val["refsuppliersologest"]; $invoicestatic->type = $val["type"]; - $invoicestatic->description = dol_trunc(html_entity_decode($val["description"]), 32); - $invoicestatic->close_code = $val["close_code"]; + $invoicestatic->description = dol_trunc(html_entity_decode((string) $val["description"]), 32); + $invoicestatic->close_code = (string) $val["close_code"]; $date = dol_print_date($val["date"], 'day'); @@ -887,7 +900,7 @@ if ($action == 'exportcsv' && !$error) { // ISO and not UTF8 ! //if ($mt) { print '"'.$key.'"'.$sep; print '"'.$date.'"'.$sep; - print '"'.$val["refsologest"].'"'.$sep; + print '"'.((string) $val["refsologest"]).'"'.$sep; print '"'.csvClean(dol_trunc($companystatic->name, 32)).'"'.$sep; print '"'.length_accounta(html_entity_decode($k)).'"'.$sep; print '"'.length_accountg($companystatic->accountancy_code_supplier_general).'"'.$sep; @@ -908,7 +921,7 @@ if ($action == 'exportcsv' && !$error) { // ISO and not UTF8 ! //if ($mt) { print '"'.$key.'"'.$sep; print '"'.$date.'"'.$sep; - print '"'.$val["refsologest"].'"'.$sep; + print '"'.((string) $val["refsologest"]).'"'.$sep; print '"'.csvClean(dol_trunc($companystatic->name, 32)).'"'.$sep; print '"'.length_accountg(html_entity_decode($k)).'"'.$sep; print '"'.length_accountg(html_entity_decode($k)).'"'.$sep; @@ -960,7 +973,7 @@ if ($action == 'exportcsv' && !$error) { // ISO and not UTF8 ! if ($mt) { print '"'.$key.'"'.$sep; print '"'.$date.'"'.$sep; - print '"'.$val["refsologest"].'"'.$sep; + print '"'.((string) $val["refsologest"]).'"'.$sep; print '"'.csvClean(dol_trunc($companystatic->name, 32)).'"'.$sep; print '"'.length_accountg(html_entity_decode($k)).'"'.$sep; print '"'.length_accountg(html_entity_decode($k)).'"'.$sep; @@ -980,7 +993,7 @@ if ($action == 'exportcsv' && !$error) { // ISO and not UTF8 ! if ($mt) { print '"'.$key.'"'.$sep; print '"'.$date.'"'.$sep; - print '"'.$val["refsologest"].'"'.$sep; + print '"'.((string) $val["refsologest"]).'"'.$sep; print '"'.csvClean(dol_trunc($companystatic->name, 32)).'"'.$sep; print '"'.length_accountg(html_entity_decode($k)).'"'.$sep; print '"'.length_accountg(html_entity_decode($k)).'"'.$sep; @@ -1114,11 +1127,11 @@ if (empty($action) || $action == 'view') { $companystatic->fournisseur = 1; $invoicestatic->id = (int) $key; - $invoicestatic->ref = $val["refsologest"]; - $invoicestatic->ref_supplier = $val["refsuppliersologest"]; + $invoicestatic->ref = (string) $val["refsologest"]; + $invoicestatic->ref_supplier = (string) $val["refsuppliersologest"]; $invoicestatic->type = $val["type"]; - $invoicestatic->description = dol_trunc(html_entity_decode($val["description"]), 32); - $invoicestatic->close_code = $val["close_code"]; + $invoicestatic->description = dol_trunc(html_entity_decode((string) $val["description"]), 32); + $invoicestatic->close_code = (string) $val["close_code"]; $date = dol_print_date($val["date"], 'day'); diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index d36c42d5c91..59dacdd337b 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -11,7 +11,7 @@ * Copyright (C) 2020 Josep Lluís Amador * Copyright (C) 2021-2026 Frédéric France * Copyright (C) 2024 Rafael San José - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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 @@ -682,6 +682,7 @@ if (isModEnabled('invoice') && isModEnabled('order') && $user->hasRight("command print ''; $tot_ht = $tot_ttc = $tot_tobill = 0; + $total_ht = $total_ttc = 0; $societestatic = new Societe($db); while ($i < $num) { $obj = $db->fetch_object($resql); diff --git a/htdocs/compta/journal/purchasesjournal.php b/htdocs/compta/journal/purchasesjournal.php index e8995f5cb71..616073de7ee 100644 --- a/htdocs/compta/journal/purchasesjournal.php +++ b/htdocs/compta/journal/purchasesjournal.php @@ -148,6 +148,12 @@ if (in_array($db->type, array('mysql', 'mysqli'))) { } $tabfac = array(); +$tabcompany = array(); +$tabht = array(); +$tabtva = array(); +$tabttc = array(); +$tablocaltax1 = array(); +$tablocaltax2 = array(); $result = $db->query($sql); if ($result) { @@ -156,12 +162,6 @@ if ($result) { $cptfour = getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER', $langs->trans("CodeNotDef")); $cpttva = getDolGlobalString('ACCOUNTING_VAT_BUY_ACCOUNT', $langs->trans("CodeNotDef")); - $tabht = array(); - $tabtva = array(); - $tabttc = array(); - $tablocaltax1 = array(); - $tablocaltax2 = array(); - $tabcompany = array(); $i = 0; while ($i < $num) { @@ -185,6 +185,31 @@ if ($result) { $account_localtax2 = getLocalTaxesFromRate($obj->tva_tx, 2, $mysoc, $obj->thirdparty); $compta_localtax2 = (!empty($account_localtax2[2]) ? $account_localtax2[2] : $langs->trans("CodeNotDef")); + // Avoid warnings + if (!array_key_exists($obj->rowid, $tabfac)) { + $tabfac[$obj->rowid] = array(); + $tabttc[$obj->rowid] = array(); + $tabht[$obj->rowid] = array(); + $tabtva[$obj->rowid] = array(); + $tablocaltax1[$obj->rowid] = array(); + $tablocaltax2[$obj->rowid] = array(); + } + if (!isset($tabttc[$obj->rowid][$compta_soc])) { + $tabttc[$obj->rowid][$compta_soc] = 0; + } + if (!isset($tabht[$obj->rowid][$compta_prod])) { + $tabht[$obj->rowid][$compta_prod] = 0; + } + if (!isset($tabtva[$obj->rowid][$compta_tva])) { + $tabtva[$obj->rowid][$compta_tva] = 0; + } + if (!isset($tablocaltax1[$obj->rowid][$compta_localtax1])) { + $tablocaltax1[$obj->rowid][$compta_localtax1] = 0; + } + if (!isset($tablocaltax2[$obj->rowid][$compta_localtax2])) { + $tablocaltax2[$obj->rowid][$compta_localtax2] = 0; + } + $tabfac[$obj->rowid]["date"] = $obj->datef; $tabfac[$obj->rowid]["ref"] = $obj->ref_supplier; $tabfac[$obj->rowid]["type"] = $obj->type; @@ -222,15 +247,16 @@ print "\n"; $invoicestatic = new FactureFournisseur($db); $companystatic = new Fournisseur($db); -foreach ($tabfac as $key => $val) { - $invoicestatic->id = (int) $key; - $invoicestatic->ref = $val["ref"]; - $invoicestatic->type = $val["type"]; +if (count($tabfac) && count($tabht) && count($tabtva) && count($tablocaltax1) && count($tablocaltax2) && count($tabttc)) { // Check for static analysis + foreach ($tabfac as $key => $val) { + $invoicestatic->id = (int) $key; + $invoicestatic->ref = (string) $val["ref"]; + $invoicestatic->type = $val["type"]; - $companystatic->id = $tabcompany[$key]['id']; - $companystatic->name = $tabcompany[$key]['name']; + $companystatic->id = $tabcompany[$key]['id']; + $companystatic->name = $tabcompany[$key]['name']; - $lines = array( + $lines = array( array( 'var' => $tabht[$key], 'label' => $langs->trans('Products'), @@ -253,26 +279,27 @@ foreach ($tabfac as $key => $val) { 'nomtcheck' => true, 'inv' => true ) - ); + ); - foreach ($lines as $line) { - foreach ($line['var'] as $k => $mt) { - if (isset($line['nomtcheck']) || $mt) { - print ''; - print ''.dol_print_date($db->jdate($val["date"]), 'day').""; - print ''.$invoicestatic->getNomUrl(1).""; - print "".$k.""; - print "".$line['label'].""; + foreach ($lines as $line) { + foreach ($line['var'] as $k => $mt) { + if (isset($line['nomtcheck']) || $mt) { + print ''; + print ''.dol_print_date($db->jdate($val["date"]), 'day').""; + print ''.$invoicestatic->getNomUrl(1).""; + print "".$k.""; + print "".$line['label'].""; - if (isset($line['inv'])) { - print ''.($mt < 0 ? price(-$mt) : '').""; - print ''.($mt >= 0 ? price($mt) : '').""; - } else { - print ''.($mt >= 0 ? price($mt) : '').""; - print ''.($mt < 0 ? price(-$mt) : '').""; + if (isset($line['inv'])) { + print ''.($mt < 0 ? price(-$mt) : '').""; + print ''.($mt >= 0 ? price($mt) : '').""; + } else { + print ''.($mt >= 0 ? price($mt) : '').""; + print ''.($mt < 0 ? price(-$mt) : '').""; + } + + print ""; } - - print ""; } } } diff --git a/htdocs/compta/journal/sellsjournal.php b/htdocs/compta/journal/sellsjournal.php index be7bdebccd7..d27cd1d27c3 100644 --- a/htdocs/compta/journal/sellsjournal.php +++ b/htdocs/compta/journal/sellsjournal.php @@ -162,15 +162,15 @@ if (in_array($db->type, array('mysql', 'mysqli'))) { } $tabfac = array(); +$tabht = array(); +$tabtva = array(); +$tablocaltax1 = array(); +$tablocaltax2 = array(); +$tabttc = array(); +$tabcompany = array(); $result = $db->query($sql); if ($result) { - $tabht = array(); - $tabtva = array(); - $tablocaltax1 = array(); - $tablocaltax2 = array(); - $tabttc = array(); - $tabcompany = array(); $account_localtax1 = 0; $account_localtax2 = 0; diff --git a/htdocs/compta/paiement/card.php b/htdocs/compta/paiement/card.php index 1638a1f092d..d72b08f95d2 100644 --- a/htdocs/compta/paiement/card.php +++ b/htdocs/compta/paiement/card.php @@ -5,7 +5,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2013 Marcos García * Copyright (C) 2015 Juanjo Menent - * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024-2026 MDW * Copyright (C) 2024-2026 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -541,6 +541,7 @@ if ($resql) { $invoice = new Facture($db); $invoice->fetch($objp->facid); + $marginInfo = null; // Add Margin if (isModEnabled('margin') && getDolGlobalInt('MARGIN_SHOW_MARGIN_ON_PAYMENT')) { @@ -577,7 +578,7 @@ if ($resql) { } // Add margin - if (isModEnabled('margin') && getDolGlobalInt('MARGIN_SHOW_MARGIN_ON_PAYMENT')) { + if (isModEnabled('margin') && getDolGlobalInt('MARGIN_SHOW_MARGIN_ON_PAYMENT') && $marginInfo !== null) { print ''.price($marginInfo['total_margin']).''; } diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index ff1ea831385..29b2e8916e9 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -10,7 +10,7 @@ * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2020 Maxime DEMAREST * Copyright (C) 2021 Alexandre Spangaro - * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024-2026 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 @@ -189,6 +189,7 @@ $total_ttc = 0; $builddate = ''; $name = ''; $period = ''; +$description = ''; // Affiche en-tete de rapport if ($modecompta == "CREANCES-DETTES") { @@ -449,6 +450,8 @@ if ($modecompta == 'BOOKKEEPING') { if (!empty($date_start) && !empty($date_end)) { $sql .= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'"; } + } else { + $sql = ''; } $sql .= " AND f.entity IN (".getEntity('invoice').")"; if ($socid) { @@ -1541,6 +1544,7 @@ if ($modecompta == 'BOOKKEEPING') { $action = "balanceclient"; $object = array(&$total_ht, &$total_ttc); +$parameters = array(); $parameters["mode"] = $modecompta; $parameters["date_start"] = $date_start; $parameters["date_end"] = $date_end; diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index 448cb719624..cb9d1cd86a2 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -7,7 +7,7 @@ * Copyright (C) 2014 Florian Henry * Copyright (C) 2018-2026 Frédéric France * Copyright (C) 2020 Maxime DEMAREST - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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 @@ -155,6 +155,7 @@ $name = ''; $period = ''; $periodlink = ''; $exportlink = ''; +$description = ''; $encaiss = array(); $encaiss_ttc = array(); @@ -995,6 +996,7 @@ if (isModEnabled('accounting') && ($modecompta == 'BOOKKEEPING')) { $action = "balance"; $object = array(&$encaiss, &$encaiss_ttc, &$decaiss, &$decaiss_ttc); +$parameters = array(); $parameters["mode"] = $modecompta; // Initialize a technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array('externalbalance')); diff --git a/htdocs/compta/resultat/result.php b/htdocs/compta/resultat/result.php index 09328db8ca3..c7263a75ab2 100644 --- a/htdocs/compta/resultat/result.php +++ b/htdocs/compta/resultat/result.php @@ -3,7 +3,7 @@ * Copyright (C) 2016-2022 Alexandre Spangaro * Copyright (C) 2018-2020 Laurent Destailleur * Copyright (C) 2018-2024 Frédéric France - * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024-2026 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 @@ -207,6 +207,7 @@ $builddate = 0; $name = ''; $period = ''; $calcmode = 0; +$description = ''; $form = new Form($db); @@ -373,9 +374,12 @@ if ($modecompta == 'CREANCES-DETTES') { $vars[$un_cat['code']] = 0; } + $code = null; + // Previous Fiscal year (N-1) - foreach ($sommes as $code => $det) { - $vars[$code] = empty($det['NP']) ? 0 : $det['NP']; + foreach ($sommes as $code_idx => $det) { + $code = $code_idx; + $vars[$code_idx] = empty($det['NP']) ? 0 : $det['NP']; } $result = strtr($formula, $vars); @@ -397,7 +401,7 @@ if ($modecompta == 'CREANCES-DETTES') { } } - if (!isset($sommes[$code])) { + if ($code !== null && !isset($sommes[$code])) { $sommes[$code] = array(); } // Year N @@ -409,9 +413,10 @@ if ($modecompta == 'CREANCES-DETTES') { } // Current fiscal year (N) - if (is_array($sommes) && !empty($sommes)) { - foreach ($sommes as $code => $det) { - $vars[$code] = empty($det['N']) ? 0 : $det['N']; + if (!empty($sommes)) { + foreach ($sommes as $code_idx => $det) { + $code = $code_idx; + $vars[$code_idx] = empty($det['N']) ? 0 : $det['N']; } } @@ -435,8 +440,9 @@ if ($modecompta == 'CREANCES-DETTES') { // Detail by month foreach ($months as $k => $v) { if (($k + 1) >= $date_startmonth && (($date_startmonth <= $date_endmonth && ($k + 1) <= $date_endmonth) || ($date_startmonth > $date_endmonth))) { - foreach ($sommes as $code => $det) { - $vars[$code] = empty($det['M'][$k]) ? 0 : $det['M'][$k]; + foreach ($sommes as $code_idx => $det) { + $code = $code_idx; + $vars[$code_idx] = empty($det['M'][$k]) ? 0 : $det['M'][$k]; } $result = strtr($formula, $vars); $result = str_replace('--', '+', $result); @@ -461,8 +467,9 @@ if ($modecompta == 'CREANCES-DETTES') { if ($date_startmonth > $date_endmonth) { foreach ($months as $k => $v) { if (($k + 1) < $date_startmonth && ($k + 1) <= $date_endmonth) { - foreach ($sommes as $code => $det) { - $vars[$code] = empty($det['M'][$k]) ? 0 : $det['M'][$k]; + foreach ($sommes as $code_idx => $det) { + $code = $code_idx; + $vars[$code_idx] = empty($det['M'][$k]) ? 0 : $det['M'][$k]; } $result = strtr($formula, $vars); $result = str_replace('--', '+', $result); diff --git a/htdocs/compta/stats/cabyuser.php b/htdocs/compta/stats/cabyuser.php index c8d0dce7534..0f7f84d1511 100644 --- a/htdocs/compta/stats/cabyuser.php +++ b/htdocs/compta/stats/cabyuser.php @@ -5,7 +5,7 @@ * Copyright (C) 2013 Antoine Iauch * Copyright (C) 2018-2026 Frédéric France * Copyright (C) 2022 Alexandre Spangaro - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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 @@ -262,6 +262,7 @@ foreach ($headerparams as $key => $value) { $catotal = 0; $catotal_ht = 0; +$sql = ''; if ($modecompta == 'CREANCES-DETTES') { $sql = "SELECT u.rowid as rowid, u.lastname as name, u.firstname as firstname, sum(f.total_ht) as amount, sum(f.total_ttc) as amount_ttc"; diff --git a/htdocs/compta/stats/casoc.php b/htdocs/compta/stats/casoc.php index 79a4399a8ae..7d4085cb85b 100644 --- a/htdocs/compta/stats/casoc.php +++ b/htdocs/compta/stats/casoc.php @@ -7,7 +7,7 @@ * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2018-2026 Frédéric France * Copyright (C) 2022 Alexandre Spangaro - * Copyright (C) 2024-2026 MDW + * Copyright (C) 2024-2026 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 @@ -283,6 +283,7 @@ $name = array(); // Show Array $catotal = 0; $catotal_ht = 0; +$sql = ''; if ($modecompta == 'CREANCES-DETTES') { $sql = "SELECT DISTINCT s.rowid as socid, s.nom as name, s.name_alias, s.zip, s.town, s.fk_pays,"; diff --git a/htdocs/compta/stats/index.php b/htdocs/compta/stats/index.php index 64a1c7ec5b7..0305f4aabd5 100644 --- a/htdocs/compta/stats/index.php +++ b/htdocs/compta/stats/index.php @@ -5,7 +5,7 @@ * Copyright (C) 2017 Olivier Geffroy * Copyright (C) 2018-2026 Frédéric France * Copyright (C) 2024 Benjamin B. - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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 @@ -220,6 +220,7 @@ if ($modecompta == "RECETTES-DEPENSES" || $modecompta == "BOOKKEEPINGCOLLECTED") } report_header($name, $namelink, $period, $periodlink, $description, $builddate, $exportlink, $moreparam, $calcmode); +$sql = ''; if (isModEnabled('accounting')) { if ($modecompta != 'BOOKKEEPING') { @@ -499,13 +500,13 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) { //var_dump($annee.' '.$year_end.' '.$mois.' '.$month_end); if ($annee < $year_end || ($annee == $year_end && $mois <= $month_end)) { if ($annee_decalage > $minyear && $case <= $casenow) { - if ($modecompta=='CREANCES-DETTES') { - $cumulative_previous_year = (!empty($cumulative_ht[$caseprev])?$cumulative_ht[$caseprev]:0); - $cumulative_year = (!empty($cumulative_ht[$case])?$cumulative_ht[$case]:0); + if ($modecompta == 'CREANCES-DETTES') { + $cumulative_previous_year = (!empty($cumulative_ht[$caseprev]) ? $cumulative_ht[$caseprev] : 0); + $cumulative_year = (!empty($cumulative_ht[$case]) ? $cumulative_ht[$case] : 0); $isset_cumulative_previous_year = isset($cumulative_ht[$caseprev]); } else { - $cumulative_previous_year = (!empty($cumulative[$caseprev])?$cumulative[$caseprev]:0); - $cumulative_year = (!empty($cumulative[$case])?$cumulative[$case]:0); + $cumulative_previous_year = (!empty($cumulative[$caseprev]) ? $cumulative[$caseprev] : 0); + $cumulative_year = (!empty($cumulative[$case]) ? $cumulative[$case] : 0); $isset_cumulative_previous_year = isset($cumulative_ht[$caseprev]); } if (!empty($cumulative_previous_year) && !empty($cumulative_year)) { @@ -648,11 +649,11 @@ for ($annee = $year_start; $annee <= $year_end; $annee++) { // Percentage total if ($annee > $minyear && $annee <= max($nowyear, $maxyear)) { if ($modecompta == 'CREANCES-DETTES') { - $total_previous_year = (!empty($total_ht[$annee - 1])?$total_ht[$annee - 1]:0); - $total_year = (!empty($total_ht[$annee])?$total_ht[$annee]:0); + $total_previous_year = (!empty($total_ht[$annee - 1]) ? $total_ht[$annee - 1] : 0); + $total_year = (!empty($total_ht[$annee]) ? $total_ht[$annee] : 0); } else { - $total_previous_year = (!empty($total[$annee - 1])?$total[$annee - 1]:0); - $total_year = (!empty($total[$annee])?$total[$annee]:0); + $total_previous_year = (!empty($total[$annee - 1]) ? $total[$annee - 1] : 0); + $total_year = (!empty($total[$annee]) ? $total[$annee] : 0); } if (!empty($total_previous_year) && !empty($total_year)) { $percent = (round(($total_year - $total_previous_year) / $total_previous_year, 4) * 100); diff --git a/htdocs/compta/stats/supplier_turnover.php b/htdocs/compta/stats/supplier_turnover.php index e077d2a67f7..b4b67c2c0bf 100644 --- a/htdocs/compta/stats/supplier_turnover.php +++ b/htdocs/compta/stats/supplier_turnover.php @@ -1,7 +1,7 @@ * Copyright (C) 2024-2026 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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 @@ -246,6 +246,8 @@ if (isModEnabled('accounting')) { } +$sql = ''; + if ($modecompta == 'CREANCES-DETTES') { $sql = "SELECT date_format(f.datef,'%Y-%m') as dm, sum(f.total_ht) as amount, sum(f.total_ttc) as amount_ttc"; $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f"; diff --git a/htdocs/compta/stats/supplier_turnover_by_thirdparty.php b/htdocs/compta/stats/supplier_turnover_by_thirdparty.php index 44b5b2199ad..ebdff9db6f3 100644 --- a/htdocs/compta/stats/supplier_turnover_by_thirdparty.php +++ b/htdocs/compta/stats/supplier_turnover_by_thirdparty.php @@ -309,6 +309,7 @@ $amount_ht = array(); $address_zip = array(); $address_town = array(); $address_pays = array(); +$sql = ''; if ($modecompta == 'CREANCES-DETTES') { $sql = "SELECT DISTINCT s.rowid as socid, s.nom as name, s.zip, s.town, s.fk_pays,"; diff --git a/htdocs/compta/tva/index.php b/htdocs/compta/tva/index.php index 25f687efe22..867c7d0390f 100644 --- a/htdocs/compta/tva/index.php +++ b/htdocs/compta/tva/index.php @@ -7,7 +7,7 @@ * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2021 Gauthier VERDOL * Copyright (C) 2021 Open-Dsi - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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 @@ -57,6 +57,19 @@ $month_start = $month_current; $refresh = true; include DOL_DOCUMENT_ROOT.'/compta/tva/initdatesforvat.inc.php'; +/** + * Variables from include: + * + * @var int $date_start + * @var int $date_end + * @var string $date_start_month + * @var string $date_start_year + * @var string $date_start_day + * @var string $date_end_month + * @var string $date_end_year + * @var string $date_end_day + */ + ' @phan-var-force int $date_start @phan-var-force int $date_end @@ -410,6 +423,7 @@ if ($refresh === true) { $action = "tva"; $object = array(&$x_coll, &$x_paye, &$x_both); + $parameters = array(); $parameters["mode"] = $modetax; $parameters["year"] = $y; $parameters["month"] = $m; diff --git a/htdocs/compta/tva/payments.php b/htdocs/compta/tva/payments.php index ed77045ef8a..a627f5defbe 100644 --- a/htdocs/compta/tva/payments.php +++ b/htdocs/compta/tva/payments.php @@ -150,6 +150,7 @@ if (preg_match('/^cs\./', $sortfield) //print $sql; dol_syslog("compta/tva/payments.php: select payment", LOG_DEBUG); +$num = 0; $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); diff --git a/htdocs/contact/ajax/contact.php b/htdocs/contact/ajax/contact.php index d6138b9940c..9d1b7c19a8d 100644 --- a/htdocs/contact/ajax/contact.php +++ b/htdocs/contact/ajax/contact.php @@ -2,7 +2,7 @@ /* Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2007-2019 Laurent Destailleur - * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024-2026 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -69,7 +69,7 @@ if ($id > 0) { // Security check if ($user->socid > 0) { - unset($action); + $action = null; $socid = $user->socid; $object->id = $socid; } diff --git a/htdocs/core/actions_comments.inc.php b/htdocs/core/actions_comments.inc.php index fbbe2955d5d..2f8d9a7b924 100644 --- a/htdocs/core/actions_comments.inc.php +++ b/htdocs/core/actions_comments.inc.php @@ -1,7 +1,7 @@ * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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 @@ -31,12 +31,18 @@ * @var User $user * * @var string $contextpage + * @var ?string $action + * @var int $withproject + * @var int $idcomment + * @var int $id */ // Next should be define in the including php source file ' +@phan-var-force ?string $action @phan-var-force int $withproject @phan-var-force int $idcomment +@phan-var-force int $id '; require_once DOL_DOCUMENT_ROOT.'/core/class/comment.class.php'; diff --git a/htdocs/core/actions_dellink.inc.php b/htdocs/core/actions_dellink.inc.php index 36959569502..394ca9e60da 100644 --- a/htdocs/core/actions_dellink.inc.php +++ b/htdocs/core/actions_dellink.inc.php @@ -1,6 +1,6 @@ - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -26,6 +26,7 @@ // $action must be defined // $object must be defined +// $id must be defined // $permissiondellink must be defined /** @@ -35,7 +36,14 @@ * * @var string $action * @var int $permissiondellink + * @var int $id */ +' +@phan-var-force CommonObject $object +@phan-var-force string $action +@phan-var-force int $permissiondellink +@phan-var-force int $id +'; $dellinkid = GETPOSTINT('dellinkid'); $addlink = GETPOST('addlink', 'alpha'); diff --git a/htdocs/core/actions_printing.inc.php b/htdocs/core/actions_printing.inc.php index d8d40c95fe2..2e8e17bdaa2 100644 --- a/htdocs/core/actions_printing.inc.php +++ b/htdocs/core/actions_printing.inc.php @@ -1,7 +1,7 @@ * Copyright (C) 2014-2025 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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 @@ -46,12 +46,17 @@ if ($action == 'print_file' && $user->hasRight('printing', 'read')) { if (!empty($list)) { $printerfound = 0; foreach ($list as $driver) { + $classfile = null; foreach ($dirmodels as $dir) { - if (file_exists(dol_buildpath($dir, 0).$driver.'.modules.php')) { - $classfile = dol_buildpath($dir, 0).$driver.'.modules.php'; + $tmpclassfile = dol_buildpath($dir, 0).$driver.'.modules.php'; + if (file_exists($tmpclassfile)) { + $classfile = $tmpclassfile; break; } } + if ($classfile === null) { + continue; + } require_once $classfile; $classname = 'printing_'.$driver; $printer = new $classname($db); diff --git a/htdocs/core/class/fileupload.class.php b/htdocs/core/class/fileupload.class.php index 71de8e6938c..7e2b2f7f387 100644 --- a/htdocs/core/class/fileupload.class.php +++ b/htdocs/core/class/fileupload.class.php @@ -3,7 +3,7 @@ /* Copyright (C) 2011-2022 Regis Houssin * Copyright (C) 2011-2023 Laurent Destailleur * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024-2026 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 @@ -83,6 +83,7 @@ class FileUpload } $object_ref = 'UndefinedReference'; + $object = null; // If pathname and filename are null then we can still upload files if we have specified upload_dir on $options if ($pathname !== null && $filename !== null) { // Get object from its id and type diff --git a/htdocs/core/class/html.formbarcode.class.php b/htdocs/core/class/html.formbarcode.class.php index 193badfde4b..9a6023e6a96 100644 --- a/htdocs/core/class/html.formbarcode.class.php +++ b/htdocs/core/class/html.formbarcode.class.php @@ -86,6 +86,7 @@ class FormBarCode $disable = 'disabled'; } + $select_encoder = ''; if (!empty($conf->use_javascript_ajax)) { $select_encoder = '
'; $select_encoder .= ''; diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index ee12d785a30..9e2c7c2de0f 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -980,35 +980,30 @@ class FormCompany extends Form $formlength = 0; if (!getDolGlobalString('MAIN_DISABLEPROFIDRULES')) { if ($country_code == 'FR') { - if (isset($idprof)) { - if ($idprof == 1) { - $formlength = 9; - } elseif ($idprof == 2) { - $formlength = 14; - } elseif ($idprof == 3) { - $formlength = 5; // 4 digits and 1 letter since january - } elseif ($idprof == 4) { - $formlength = 32; // No maximum as we need to include a town name in this id - } + if ($idprof == 1) { + $formlength = 9; + } elseif ($idprof == 2) { + $formlength = 14; + } elseif ($idprof == 3) { + $formlength = 5; // 4 digits and 1 letter since january + } elseif ($idprof == 4) { + $formlength = 32; // No maximum as we need to include a town name in this id } } elseif ($country_code == 'ES') { if ($idprof == 1) { $formlength = 9; //CIF/NIF/NIE 9 digits - } - if ($idprof == 2) { + } elseif ($idprof == 2) { $formlength = 12; //NASS 12 digits without / - } - if ($idprof == 3) { + } elseif ($idprof == 3) { $formlength = 5; //CNAE 5 digits - } - if ($idprof == 4) { + } elseif ($idprof == 4) { $formlength = 32; //depend of college } } } $selected = $preselected; - if (!$selected && isset($idprof)) { + if (!$selected) { if ($idprof == 1 && !empty($this->idprof1)) { $selected = $this->idprof1; } elseif ($idprof == 2 && !empty($this->idprof2)) { diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php index ab63aa0e482..51fc8e94e69 100644 --- a/htdocs/core/class/html.formprojet.class.php +++ b/htdocs/core/class/html.formprojet.class.php @@ -827,6 +827,8 @@ class FormProjets extends Form require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; $out = ''; + $labeltoshow = ''; + if (empty($lineOnly)) { // Search Invoice $sql = "SELECT f.rowid, f.ref as fref,"; @@ -911,6 +913,7 @@ class FormProjets extends Form $out .= '