From e9eb22f8f0a8667873e13cafca87723002a28d0d Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Fri, 10 Jan 2025 11:17:06 +0100 Subject: [PATCH 01/32] zero could be a value --- htdocs/admin/dict.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 9d265d0240d..3536ec55be5 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -2076,7 +2076,7 @@ if ($id > 0) { //var_dump($fieldlist); $class = ''; $showfield = 1; - $valuetoshow = empty($obj->$value) ? '' : $obj->$value; + $valuetoshow = !isset($obj->$value) ? '' : $obj->$value; $titletoshow = ''; if ($value == 'entity') { From a34d760a88cfd7a96b00864180aed06cde2d4c5c Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Fri, 10 Jan 2025 11:28:46 +0100 Subject: [PATCH 02/32] fix edit : display zero value instead of nothing --- htdocs/admin/dict.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 3536ec55be5..e1a38d4c750 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -2445,7 +2445,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') } if (in_array($value, array('code', 'libelle', 'type')) && $tabname == "c_actioncomm" && isset($obj->$value) && in_array($obj->type, array('system', 'systemauto'))) { - $hidden = (!empty($obj->{$value}) ? $obj->{$value}:''); + $hidden = (isset($obj->{$value}) ? $obj->{$value}:''); print ''; print ''; print $langs->trans($hidden); @@ -2558,7 +2558,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') } elseif ($value == 'price' || preg_match('/^amount/i', $value)) { print ''; } elseif ($value == 'code' && isset($obj->{$value})) { - print ''; + print ''; } elseif ($value == 'unit') { print ''; $units = array( From dd40aea3803251c57f84213eb134ebc68bc5fd49 Mon Sep 17 00:00:00 2001 From: tnegre Date: Tue, 28 Jan 2025 14:18:26 +0100 Subject: [PATCH 03/32] Add hook PrintFieldListFrom on actions list --- htdocs/comm/action/list.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index d3d1ecfb833..18cd89caa2c 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -454,6 +454,12 @@ if ($filtert > 0 || $usergroup > 0) { if ($usergroup > 0) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element"; } + +// Add table from hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by hook +$sql .= $hookmanager->resPrint; + $sql .= " WHERE c.id = a.fk_action"; $sql .= ' AND a.entity IN ('.getEntity('agenda').')'; // Condition on actioncode From d288fe74a2372afe67268473fbc8a6d9610cbb1f Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Fri, 7 Feb 2025 15:05:49 +0100 Subject: [PATCH 04/32] fk_user_author instead of user_author into update --- htdocs/compta/facture/class/facture.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 1c02a897a14..4f95b29cfa8 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2551,7 +2551,7 @@ class Facture extends CommonInvoice $sql .= " total_ttc=".(isset($this->total_ttc) ? $this->total_ttc : "null").","; $sql .= " revenuestamp=".((isset($this->revenuestamp) && $this->revenuestamp != '') ? $this->db->escape($this->revenuestamp) : "null").","; $sql .= " fk_statut=".(isset($this->statut) ? $this->db->escape($this->statut) : "null").","; - $sql .= " fk_user_author=".(isset($this->user_author) ? $this->db->escape($this->user_author) : "null").","; + $sql .= " fk_user_author=".(isset($this->fk_user_author) ? $this->db->escape($this->fk_user_author) : "null").","; $sql .= " fk_user_valid=".(isset($this->fk_user_valid) ? $this->db->escape($this->fk_user_valid) : "null").","; $sql .= " fk_facture_source=".(isset($this->fk_facture_source) ? $this->db->escape($this->fk_facture_source) : "null").","; $sql .= " fk_projet=".(isset($this->fk_project) ? $this->db->escape($this->fk_project) : "null").","; From 03340d601622e791b9b00094ce0980e1d70f82ba Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Fri, 7 Feb 2025 15:13:20 +0100 Subject: [PATCH 05/32] in case of old code in other part makes a direct assignation --- htdocs/compta/facture/class/facture.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 4f95b29cfa8..5011753c47f 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2522,6 +2522,9 @@ class Facture extends CommonInvoice if (isset($this->retained_warranty)) { $this->retained_warranty = floatval($this->retained_warranty); } + if (!isset($this->fk_user_author) && isset($this->user_author) ) { + $this->fk_user_author = $this->user_author; + } // Check parameters From 7eba8832e683f4cb4cecdf928427f8ff40622f9e Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Fri, 7 Feb 2025 15:47:36 +0100 Subject: [PATCH 06/32] FIX bad dispatched quantities for batches on shipment card --- htdocs/expedition/dispatch.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/expedition/dispatch.php b/htdocs/expedition/dispatch.php index fd9f2f7f1b9..53ac2ff3cc6 100644 --- a/htdocs/expedition/dispatch.php +++ b/htdocs/expedition/dispatch.php @@ -765,14 +765,14 @@ if ($object->id > 0 || !empty($object->ref)) { print ''; // Dispatch column print ''; // Warehouse column - /*$sql = "SELECT cfd.rowid, cfd.qty, cfd.fk_entrepot, cfd.batch, cfd.eatby, cfd.sellby, cfd.fk_product"; - $sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as cfd"; - $sql .= " WHERE cfd.fk_commandefourndet = ".(int) $objp->rowid;*/ - - $sql = "SELECT ed.rowid, ed.qty, ed.fk_entrepot, eb.batch, eb.eatby, eb.sellby, cd.fk_product"; - $sql .= " FROM ".MAIN_DB_PREFIX."expeditiondet as ed"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."expeditiondet_batch as eb on ed.rowid = eb.fk_expeditiondet"; - $sql .= " JOIN ".MAIN_DB_PREFIX."commandedet as cd on ed.fk_origin_line = cd.rowid"; + $sql = "SELECT ed.rowid"; + $sql .= ", cd.fk_product"; + $sql .= ", ".$db->ifsql('eb.rowid IS NULL', 'ed.qty', 'eb.qty')." as qty"; + $sql .= ", ed.fk_entrepot"; + $sql .= ", eb.batch, eb.eatby, eb.sellby"; + $sql .= " FROM ".$db->prefix()."expeditiondet as ed"; + $sql .= " LEFT JOIN ".$db->prefix()."expeditiondet_batch as eb on ed.rowid = eb.fk_expeditiondet"; + $sql .= " INNER JOIN ".$db->prefix()."commandedet as cd on ed.fk_origin_line = cd.rowid"; $sql .= " WHERE ed.fk_origin_line =".(int) $objp->rowid; $sql .= " AND ed.fk_expedition =".(int) $object->id; $sql .= " ORDER BY ed.rowid, ed.fk_origin_line"; From 47f10cdc297433548eb34e35039556e5851d13d7 Mon Sep 17 00:00:00 2001 From: ulysse-vldn Date: Mon, 10 Feb 2025 09:55:47 +0100 Subject: [PATCH 07/32] Fix missing unset post fourn_ref --- htdocs/fourn/facture/card-rec.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/fourn/facture/card-rec.php b/htdocs/fourn/facture/card-rec.php index ae26587c6bc..4ef17a83632 100644 --- a/htdocs/fourn/facture/card-rec.php +++ b/htdocs/fourn/facture/card-rec.php @@ -717,6 +717,7 @@ if (empty($reshook)) { unset($_POST['date_end_fill']); unset($_POST['situations']); unset($_POST['progress']); + unset($_POST['fourn_ref']); } else { setEventMessages($object->error, $object->errors, 'errors'); } @@ -859,6 +860,7 @@ if (empty($reshook)) { unset($_POST['date_endyear']); unset($_POST['situations']); unset($_POST['progress']); + unset($_POST['fourn_ref']); } else { setEventMessages($object->error, $object->errors, 'errors'); } From d04ac67ecdc70fa84189ade0490560598840d65a Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Tue, 11 Feb 2025 00:31:59 +0100 Subject: [PATCH 08/32] backport 20.0 solution --- htdocs/admin/dict.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index e1a38d4c750..c9f44885d2c 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -2004,6 +2004,11 @@ if ($id > 0) { $canbemodified = 1; } + if ($tabname[$id] == "c_product_nature" && in_array($obj->code, array(0, 1))) { + $canbedisabled = 0; + $canbemodified = 0; + $iserasable = 0; + } // Build Url. The table is id=, the id of line is rowid= $rowidcol = $tabrowid[$id]; // If rowidcol not defined From 94eaf5d0891320bbf94a975295ff8fc7fe946f23 Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Tue, 11 Feb 2025 00:32:57 +0100 Subject: [PATCH 09/32] cancel first idea --- htdocs/admin/dict.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index c9f44885d2c..859ef271a85 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -2081,7 +2081,7 @@ if ($id > 0) { //var_dump($fieldlist); $class = ''; $showfield = 1; - $valuetoshow = !isset($obj->$value) ? '' : $obj->$value; + $valuetoshow = empty($obj->$value) ? '' : $obj->$value; $titletoshow = ''; if ($value == 'entity') { @@ -2450,7 +2450,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') } if (in_array($value, array('code', 'libelle', 'type')) && $tabname == "c_actioncomm" && isset($obj->$value) && in_array($obj->type, array('system', 'systemauto'))) { - $hidden = (isset($obj->{$value}) ? $obj->{$value}:''); + $hidden = (!empty($obj->{$value}) ? $obj->{$value}:''); print ''; print ''; print $langs->trans($hidden); @@ -2563,7 +2563,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') } elseif ($value == 'price' || preg_match('/^amount/i', $value)) { print ''; } elseif ($value == 'code' && isset($obj->{$value})) { - print ''; + print ''; } elseif ($value == 'unit') { print ''; $units = array( From 33475b8e92efea7112b9ca2cdc86cb2982c11135 Mon Sep 17 00:00:00 2001 From: MarcVJ <38230768+MarcVJ@users.noreply.github.com> Date: Tue, 11 Feb 2025 10:00:06 +0100 Subject: [PATCH 10/32] Added one line to allow use of price_ttc in calculated extra fields price_ttc sometimes needs to be used in extra fields to compute price ttc per kilo or per liter. Currently price_ttc does not compute in the product list, so price per kilo cannot compute either. This allows to add an extra field "Price TTC per kilo" like this : $object->price_ttc / $object->weight. $object->price_ttc will work because the added line puts price_ttc into $products_static, which is put in $object. --- htdocs/product/list.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index aa378d1c85c..d262f757909 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -1628,6 +1628,7 @@ while ($i < $imaxinloop) { } $product_static->price = $obj->price; + $product_static->price_ttc = $obj->price_ttc; // Allows to use price_ttc in calculated extra fields (ex : price per kilo) $object = $product_static; From 4ecf7334e53b66a9fa7c5e29ed36cc40968c9b12 Mon Sep 17 00:00:00 2001 From: Norbert Penel Date: Tue, 11 Feb 2025 14:30:48 +0100 Subject: [PATCH 11/32] Added substitutions in AI response --- htdocs/core/class/html.formmail.class.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index a9b87e75da6..2ad80549cfc 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -1554,6 +1554,16 @@ class FormMail extends Form }), success: function(response) { console.log('Received image URL: '+response); + + // make substitutions + let substit = ". json_encode($this->substit)."; + for (let key in substit) { + if (substit.hasOwnProperty(key)) { + // Replace the placeholder with its corresponding value + response = response.replace(key, substit[key]); + } + } + // Assuming response is the URL of the generated image var imageUrl = response; $('#ai_image_result').html('\"Generated'); From 517959f7cf780e762a136bce1eb988394bf00110 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A9lina=20JOUM?= Date: Tue, 11 Feb 2025 16:59:38 +0100 Subject: [PATCH 12/32] FIX: Time spent for timespent PDF --- htdocs/core/modules/project/doc/pdf_timespent.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/project/doc/pdf_timespent.modules.php b/htdocs/core/modules/project/doc/pdf_timespent.modules.php index 70f83aec0e3..6c91a182b0f 100644 --- a/htdocs/core/modules/project/doc/pdf_timespent.modules.php +++ b/htdocs/core/modules/project/doc/pdf_timespent.modules.php @@ -307,7 +307,7 @@ class pdf_timespent extends ModelePDFProjects //$progress=($object->lines[$i]->progress?$object->lines[$i]->progress.'%':''); $datestart = dol_print_date($object->lines[$i]->date_start, 'day'); $dateend = dol_print_date($object->lines[$i]->date_end, 'day'); - $duration = convertSecondToTime((int) $object->lines[$i]->duration, 'allhourmin'); + $duration = convertSecondToTime((int) $object->lines[$i]->duration_effective, 'allhourmin'); $showpricebeforepagebreak = 1; From edea44bccba3e580950b1f8310891b416bef3c68 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Tue, 11 Feb 2025 17:12:15 +0100 Subject: [PATCH 13/32] FIX display full tree on shipment card when a kit contains a same component in other sub-kit --- htdocs/product/class/product.class.php | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 4860fe9c34a..7f8de67a96a 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -4966,8 +4966,6 @@ class Product extends CommonObject */ public function getChildsArbo($id, $firstlevelonly = 0, $level = 1, $parents = array()) { - global $alreadyfound; - if (empty($id)) { return array(); } @@ -4984,9 +4982,6 @@ class Product extends CommonObject dol_syslog(get_class($this).'::getChildsArbo id='.$id.' level='.$level. ' parents='.(is_array($parents)?implode(',', $parents):$parents), LOG_DEBUG); - if ($level == 1) { - $alreadyfound = array($id=>1); // We init array of found object to start of tree, so if we found it later (should not happened), we stop immediatly - } // Protection against infinite loop if ($level > 30) { return array(); @@ -4995,14 +4990,16 @@ class Product extends CommonObject $res = $this->db->query($sql); if ($res) { $prods = array(); + if ($this->db->num_rows($res) > 0) { + $parents[] = $id; + } + while ($rec = $this->db->fetch_array($res)) { - if (!empty($alreadyfound[$rec['rowid']])) { + if (in_array($rec['id'], $parents)) { dol_syslog(get_class($this).'::getChildsArbo the product id='.$rec['rowid'].' was already found at a higher level in tree. We discard to avoid infinite loop', LOG_WARNING); - if (in_array($rec['id'], $parents)) { - continue; // We discard this child if it is already found at a higher level in tree in the same branch. - } + continue; // We discard this child if it is already found at a higher level in tree in the same branch. } - $alreadyfound[$rec['rowid']] = 1; + $prods[$rec['rowid']] = array( 0=>$rec['rowid'], 1=>$rec['qty'], @@ -5016,7 +5013,6 @@ class Product extends CommonObject //$prods[$this->db->escape($rec['label'])]= array(0=>$rec['id'],1=>$rec['qty'],2=>$rec['fk_product_type']); //$prods[$this->db->escape($rec['label'])]= array(0=>$rec['id'],1=>$rec['qty']); if (empty($firstlevelonly)) { - $parents[] = $rec['rowid']; $listofchilds = $this->getChildsArbo($rec['rowid'], 0, $level + 1, $parents); foreach ($listofchilds as $keyChild => $valueChild) { $prods[$rec['rowid']]['childs'][$keyChild] = $valueChild; From 630caa0562e713e69f9e1768aeebd84c4a7c7e13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Cendrier?= Date: Wed, 12 Feb 2025 10:13:29 +0100 Subject: [PATCH 14/32] FIX: project time spent in ODT template --- .../modules/project/doc/doc_generic_project_odt.modules.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php index 94878e5d2ae..ff383d66c81 100644 --- a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php +++ b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php @@ -195,8 +195,8 @@ class doc_generic_project_odt extends ModelePDFProjects 'task_label' => $task->label, 'task_description' => $task->description, 'task_fk_parent' => $task->fk_task_parent, - 'task_duration' => $task->duration, - 'task_duration_hour' => convertSecondToTime($task->duration, 'all'), + 'task_duration' => $task->duration_effective, + 'task_duration_hour' => convertSecondToTime($task->duration_effective, 'all'), 'task_planned_workload' => $task->planned_workload, 'task_planned_workload_hour' => convertSecondToTime($task->planned_workload, 'all'), 'task_progress' => $task->progress, From f214d76d3510cf29d3d24a9e7ba363a39da94e2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Fali=C3=A8re?= Date: Wed, 12 Feb 2025 10:57:58 +0100 Subject: [PATCH 15/32] ENH: accessibility on commonfields_add tpl --- htdocs/core/tpl/commonfields_add.tpl.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/core/tpl/commonfields_add.tpl.php b/htdocs/core/tpl/commonfields_add.tpl.php index 8e1c87a7a2e..787537d1381 100644 --- a/htdocs/core/tpl/commonfields_add.tpl.php +++ b/htdocs/core/tpl/commonfields_add.tpl.php @@ -1,7 +1,8 @@ - * Copyright (C) 2024 MDW +/* Copyright (C) 2017 Laurent Destailleur + * Copyright (C) 2024 MDW * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 Benjamin Falière * * 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 @@ -69,11 +70,13 @@ foreach ($object->fields as $key => $val) { } print '"'; print '>'; + print ''; print ''; print ''; if (!empty($val['picto'])) { From f00c288e855f6c1c6f57b6f2657e43494e73597d Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Wed, 12 Feb 2025 12:53:15 +0100 Subject: [PATCH 16/32] Debug v21 --- htdocs/public/members/new.php | 2 +- htdocs/public/onlinesign/newonlinesign.php | 63 +++++++++++++++++++++- 2 files changed, 63 insertions(+), 2 deletions(-) diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index df26dbf783a..40c79fc427e 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -978,7 +978,7 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR } } - +//htmlPrintOnlineFooter($mysoc, $langs); llxFooterVierge(); $db->close(); diff --git a/htdocs/public/onlinesign/newonlinesign.php b/htdocs/public/onlinesign/newonlinesign.php index 17506fc264a..641e5413771 100644 --- a/htdocs/public/onlinesign/newonlinesign.php +++ b/htdocs/public/onlinesign/newonlinesign.php @@ -185,6 +185,62 @@ $hookmanager->initHooks(array('onlinesign')); $error = 0; +/** + * Show header for online signature + * + * @param string $title Title + * @param string $head Head array + * @param int $disablejs More content into html header + * @param int $disablehead More content into html header + * @param string[]|string $arrayofjs Array of complementary js files + * @param string[]|string $arrayofcss Array of complementary css files + * @return void + */ +function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) +{ + global $conf, $langs, $mysoc; + + top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers + + print ''; + + // Define urllogo + $urllogo = DOL_URL_ROOT.'/theme/common/login_logo.png'; + + if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) { + $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_small); + } elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) { + $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/'.$mysoc->logo); + } elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.svg')) { + $urllogo = DOL_URL_ROOT.'/theme/dolibarr_logo.svg'; + } + + print '
'; + + // Output html code for logo + if ($urllogo) { + print '
'; + print '
'; + print ''; + print '
'; + if (!getDolGlobalString('MAIN_HIDE_POWERED_BY')) { + print ''; + } + print '
'; + } + + if (getDolGlobalString('MEMBER_IMAGE_PUBLIC_REGISTRATION')) { + print '
'; + print ''; + print '
'; + } + + print '
'; + + print '
'; +} + + /* * Actions @@ -233,6 +289,7 @@ if ($action == 'confirm_refusepropal' && $confirm == 'yes') { // Test on pemriss */ $form = new Form($db); + $head = ''; if (getDolGlobalString('MAIN_SIGN_CSS_URL')) { $head = ''."\n"; @@ -241,8 +298,12 @@ if (getDolGlobalString('MAIN_SIGN_CSS_URL')) { $conf->dol_hide_topmenu = 1; $conf->dol_hide_leftmenu = 1; +$title = $langs->trans("OnlineSignature"); + $replacemainarea = (empty($conf->dol_hide_leftmenu) ? '
' : '').'
'; -llxHeader($head, $langs->trans("OnlineSignature"), '', '', 0, 0, '', '', '', 'onlinepaymentbody', $replacemainarea, 1); +llxHeader($head, $title, '', '', 0, 0, '', '', '', 'onlinepaymentbody', $replacemainarea, 1); + +llxHeaderVierge($title); if ($action == 'refusepropal') { print $form->formconfirm($_SERVER["PHP_SELF"].'?ref='.urlencode($ref).'&securekey='.urlencode($SECUREKEY).(isModEnabled('multicompany') ? '&entity='.$entity : ''), $langs->trans('RefusePropal'), $langs->trans('ConfirmRefusePropal', $object->ref), 'confirm_refusepropal', '', '', 1); From bcca177bdf4e719d209abac6e770fb32919dc544 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Wed, 12 Feb 2025 14:00:50 +0100 Subject: [PATCH 17/32] Debug v21 - fix pb with setup of mandatory vat number --- htdocs/compta/facture/class/facture.class.php | 13 +++-- htdocs/langs/en_US/accountancy.lang | 1 + htdocs/langs/en_US/errors.lang | 1 + htdocs/societe/admin/societe.php | 51 ++++++++++++++----- 4 files changed, 49 insertions(+), 17 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 43859ecab23..d8075c86fb8 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -3325,10 +3325,17 @@ class Facture extends CommonInvoice } } if ($key == 'TVA_INTRA') { - // Check for mandatory - if (getDolGlobalString('SOCIETE_VAT_INTRA_INVOICE_MANDATORY') && ($this->thirdparty->tva_assuj) && empty($this->thirdparty->tva_intra)) { + // Check for mandatory vat number + if (getDolGlobalString('SOCIETE_VAT_INTRA_INVOICE_MANDATORY') == 'eeconly') { + if (($this->thirdparty->tva_assuj) && empty($this->thirdparty->tva_intra) && $this->thirdparty->isInEEC()) { + $langs->load("errors"); + $this->error = $langs->trans('ErrorProdIdIsMandatoryForEuThirdparties', $langs->transnoentitiesnoconv('VATIntra')).' ('.$langs->transnoentitiesnoconv("ForbiddenBySetupRules").') ['.$langs->trans('Company').' : '.$this->thirdparty->name.']'; + dol_syslog(__METHOD__.' '.$this->error, LOG_ERR); + return -1; + } + } elseif (getDolGlobalString('SOCIETE_VAT_INTRA_INVOICE_MANDATORY') && ($this->thirdparty->tva_assuj) && empty($this->thirdparty->tva_intra)) { $langs->load("errors"); - $this->error = $langs->trans('ErrorProdIdIsMandatory', $langs->trans('VATIntra')).' ('.$langs->trans("ForbiddenBySetupRules").') ['.$langs->trans('Company').' : '.$this->thirdparty->name.']'; + $this->error = $langs->trans('ErrorProdIdIsMandatory', $langs->transnoentitiesnoconv('VATIntra')).' ('.$langs->transnoentitiesnoconv("ForbiddenBySetupRules").') ['.$langs->trans('Company').' : '.$this->thirdparty->name.']'; dol_syslog(__METHOD__.' '.$this->error, LOG_ERR); return -1; } diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index d0984b30ca3..78cc4145ab6 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -409,6 +409,7 @@ SaleExport=Export sale SaleEEC=Sale in EEC SaleEECWithVAT=Sale in EEC with a VAT not null, so we suppose this is NOT an intracommunautary sale and the suggested account is the standard product account. SaleEECWithoutVATNumber=Sale in EEC with no VAT but the VAT ID of third party is not defined. We fall back on the account for standard sales. You can fix the VAT ID of the third party, or change the product account suggested for binding if needed. +AnySale=Any sale ForbiddenTransactionAlreadyExported=Forbidden: The transaction has been validated and/or exported. ForbiddenTransactionAlreadyValidated=Forbidden: The transaction has been validated. DataMustHaveBeenTransferredInAccounting=The transfer of data in accounting must have been done diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index fc7a83c44e6..c66ece16b31 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -31,6 +31,7 @@ ErrorFromToAccountsMustDiffers=Source and targets bank accounts must be differen ErrorBadThirdPartyName=Bad value for third-party name ForbiddenBySetupRules=Forbidden by setup rules ErrorProdIdIsMandatory=The %s is mandatory +ErrorProdIdIsMandatoryForEuThirdparties=The %s is mandatory for customers in EEC ErrorAccountancyCodeCustomerIsMandatory=The accountancy code of customer %s is mandatory ErrorAccountancyCodeSupplierIsMandatory=The accountancy code of supplier %s is mandatory ErrorBadCustomerCodeSyntax=Bad syntax for customer code diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php index 29b48fb1e7b..da898296d82 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -43,7 +43,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; * @var User $user */ -$langs->loadLangs(array("admin", "companies", "other")); +$langs->loadLangs(array("admin", "accountancy", "companies", "other")); $action = GETPOST('action', 'aZ09'); $value = GETPOST('value', 'alpha'); @@ -329,9 +329,11 @@ if ($action == 'setprofidmandatory') { } //Activate ProfId invoice mandatory -if ($action == 'setprofidinvoicemandatory') { +if ($action == 'setprofidinvoicemandatory' || $action == 'setprofidinvoicemandatoryeeconly') { $status = GETPOST('status', 'alpha'); - + if ($status == '1' && $action == 'setprofidinvoicemandatoryeeconly') { + $status = 'eeconly'; + } $idprof = "SOCIETE_".$value."_INVOICE_MANDATORY"; $result = dolibarr_set_const($db, $idprof, $status, 'chaine', 0, '', $conf->entity); if ($result <= 0) { @@ -777,31 +779,52 @@ print ''.$langs->trans('VATIntra')."\n"; $key = 'VAT_INTRA'; if (getDolGlobalString('SOCIETE_VAT_INTRA_UNIQUE')) { print ''; - print img_picto($langs->trans("Activated"), 'switch_on'); + print img_picto($langs->trans("Activated"), 'switch_on', 'class="valignmiddle"'); print ''; } else { print ''; - print img_picto($langs->trans("Disabled"), 'switch_off'); + print img_picto($langs->trans("Disabled"), 'switch_off', 'class="valignmiddle"'); print ''; } if (getDolGlobalString('SOCIETE_VAT_INTRA_MANDATORY')) { print ''; - print img_picto($langs->trans("Activated"), 'switch_on'); + print img_picto($langs->trans("Activated"), 'switch_on', 'class="valignmiddle"'); print ''; } else { print ''; - print img_picto($langs->trans("Disabled"), 'switch_off'); + print img_picto($langs->trans("Disabled"), 'switch_off', 'class="valignmiddle"'); print ''; } -if (getDolGlobalString('SOCIETE_VAT_INTRA_INVOICE_MANDATORY')) { - print ''; - print img_picto($langs->trans("Activated"), 'switch_on'); - print ''; +print ''; +if (getDolGlobalString('SOCIETE_VAT_INTRA_INVOICE_MANDATORY') == 'eeconly') { + print ''; + print img_picto($langs->trans("Activated"), 'switch_on', 'class="valignmiddle paddingrightonly"'); + print ''; + print $langs->trans("SaleEEC").'
'; + print ''; + print img_picto($langs->trans("Activated"), 'switch_off', 'class="valignmiddle paddingrightonly"'); + print ''; + print $langs->trans("AnySale"); +} elseif (getDolGlobalString('SOCIETE_VAT_INTRA_INVOICE_MANDATORY')) { + print ''; + print img_picto($langs->trans("Activated"), 'switch_off', 'class="valignmiddle paddingrightonly"'); + print ''; + print $langs->trans("SaleEEC").'
'; + print ''; + print img_picto($langs->trans("Activated"), 'switch_on', 'class="valignmiddle paddingrightonly"'); + print ''; + print $langs->trans("AnySale"); } else { - print ''; - print img_picto($langs->trans("Disabled"), 'switch_off'); - print ''; + print ''; + print img_picto($langs->trans("Disabled"), 'switch_off', 'class="valignmiddle paddingrightonly"'); + print ''; + print $langs->trans("SaleEEC").'
'; + print ''; + print img_picto($langs->trans("Disabled"), 'switch_off', 'class="valignmiddle paddingrightonly"'); + print ''; + print $langs->trans("AnySale"); } +print ''; print "\n"; print "\n"; From 2b5295497b04616e8a7dc4dab3f17db82ece3a82 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Wed, 12 Feb 2025 16:22:06 +0100 Subject: [PATCH 18/32] Debug v21 --- htdocs/ecm/class/ecmfiles.class.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/htdocs/ecm/class/ecmfiles.class.php b/htdocs/ecm/class/ecmfiles.class.php index 142aaf70270..28db17eceb0 100644 --- a/htdocs/ecm/class/ecmfiles.class.php +++ b/htdocs/ecm/class/ecmfiles.class.php @@ -1013,9 +1013,17 @@ class EcmFiles extends CommonObject } elseif ($option == 'commande_fournisseur') { $tmppath = preg_replace('/^fournisseur\/commande\//', '', $this->filepath); } else { - $tmppath = preg_replace('/^[^\/]+\//', '', $this->filepath); + if ((int) $this->entity > 1) { + // Remove the part "entityid/commande/" into "entityid/commande/REFXXX" to get only the ref + $tmppath = preg_replace('/^\d+\/[^\/]+\//', '', $this->filepath); + } else { + // Remove the part "commande/" into "commande/REFXXX" to get only the ref + $tmppath = preg_replace('/^[^\/]+\//', '', $this->filepath); + } } - $url = DOL_URL_ROOT.'/document.php?modulepart='.urlencode($option).'&file='.urlencode($tmppath.'/'.$this->filename).'&entity='.$this->entity; + //var_dump($this->filepath); + + $url = DOL_URL_ROOT.'/document.php?modulepart='.urlencode($option).'&file='.urlencode($tmppath.'/'.$this->filename).'&entity='.((int) $this->entity); } else { $url = DOL_URL_ROOT.'/ecm/file_card.php?id='.$this->id; } From 922e58e1e186643763015f2dafb16264ee562b74 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Wed, 12 Feb 2025 19:10:36 +0100 Subject: [PATCH 19/32] WIP Add option MAIN_MAIL_EMAIL_FROM_PASSWORDRESET --- htdocs/admin/mails.php | 14 ++++--- htdocs/admin/mails_passwordreset.php | 55 ++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 6 deletions(-) diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index afda0e31733..b32c64b8b35 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -382,6 +382,7 @@ if ($action == 'edit') { clearstatcache(); + print '
'; // You can use div-table-responsive-no-min if you don't need reserved height for your table print ''; print ''; @@ -613,11 +614,11 @@ if ($action == 'edit') { print ''; print '
'.$langs->trans("Parameters").'
'; - + print '
'; print '
'; - + print '
'; // You can use div-table-responsive-no-min if you don't need reserved height for your table print ''; print ''; @@ -664,6 +665,7 @@ if ($action == 'edit') { print ''; print '
'.$langs->trans("OtherOptions").'
'; + print '
'; print dol_get_fiche_end(); @@ -868,7 +870,7 @@ if ($action == 'edit') { print ''.$langs->trans("MAIN_MAIL_FORCE_SENDTO").''.getDolGlobalString('MAIN_MAIL_FORCE_SENDTO'); if (getDolGlobalString('MAIN_MAIL_FORCE_SENDTO')) { if (!isValidEmail(getDolGlobalString('MAIN_MAIL_FORCE_SENDTO'))) { - print img_warning($langs->trans("ErrorBadEMail")); + print img_warning($langs->trans("ErrorBadEMail", getDolGlobalString('MAIN_MAIL_FORCE_SENDTO'))); } else { print img_warning($langs->trans("RecipientEmailsWillBeReplacedWithThisValue")); } @@ -892,7 +894,7 @@ if ($action == 'edit') { print ''.$langs->trans("MAIN_MAIL_FORCE_SENDTO").''.getDolGlobalString('MAIN_MAIL_FORCE_SENDTO'); if (getDolGlobalString('MAIN_MAIL_FORCE_SENDTO')) { if (!isValidEmail(getDolGlobalString('MAIN_MAIL_FORCE_SENDTO'))) { - print img_warning($langs->trans("ErrorBadEMail")); + print img_warning($langs->trans("ErrorBadEMail", getDolGlobalString('MAIN_MAIL_FORCE_SENDTO'))); } else { print img_warning($langs->trans("RecipientEmailsWillBeReplacedWithThisValue")); } @@ -910,7 +912,7 @@ if ($action == 'edit') { if (!getDolGlobalString('MAIN_MAIL_EMAIL_FROM')) { print img_warning($langs->trans("Mandatory")); } elseif (!isValidEmail(getDolGlobalString('MAIN_MAIL_EMAIL_FROM'))) { - print img_warning($langs->trans("ErrorBadEMail")); + print img_warning($langs->trans("ErrorBadEMail", getDolGlobalString('MAIN_MAIL_EMAIL_FROM'))); } print ''; @@ -958,7 +960,7 @@ if ($action == 'edit') { print ''.$langs->trans("MAIN_MAIL_ERRORS_TO").''; print ''.(getDolGlobalString('MAIN_MAIL_ERRORS_TO')); if (getDolGlobalString('MAIN_MAIL_ERRORS_TO') && !isValidEmail(getDolGlobalString('MAIN_MAIL_ERRORS_TO'))) { - print img_warning($langs->trans("ErrorBadEMail")); + print img_warning($langs->trans("ErrorBadEMail", getDolGlobalString('MAIN_MAIL_ERRORS_TO'))); } print ''; diff --git a/htdocs/admin/mails_passwordreset.php b/htdocs/admin/mails_passwordreset.php index 5f3b07ce7ee..6433b63486c 100644 --- a/htdocs/admin/mails_passwordreset.php +++ b/htdocs/admin/mails_passwordreset.php @@ -104,6 +104,10 @@ if ($action == 'update' && !$cancel) { dolibarr_set_const($db, "MAIN_MAIL_EMAIL_STARTTLS_PASSWORDRESET", GETPOST("MAIN_MAIL_EMAIL_STARTTLS_PASSWORDRESET"), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_PASSWORDRESET", GETPOST("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_PASSWORDRESET"), 'chaine', 0, '', $conf->entity); + if (GETPOSTISSET("MAIN_MAIL_EMAIL_FROM_PASSWORDRESET")) { + dolibarr_set_const($db, "MAIN_MAIL_EMAIL_FROM_PASSWORDRESET", GETPOST("MAIN_MAIL_EMAIL_FROM_PASSWORDRESET", 'alphanohtml'), 'chaine', 0, '', $conf->entity); + } + header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); exit; } @@ -349,6 +353,7 @@ if ($action == 'edit') { clearstatcache(); + print '
'; // You can use div-table-responsive-no-min if you don't need reserved height for your table print ''; print ''; @@ -553,6 +558,26 @@ if ($action == 'edit') { print ''; print '
'.$langs->trans("Parameters").'
'; + print '
'; + + print '
'; + + + print '
'; // You can use div-table-responsive-no-min if you don't need reserved height for your table + print ''; + print ''; + + // From + $help = $form->textwithpicto('', $langs->trans("EMailHelpMsgSPFDKIM")); + print ''; + print ''; + + print '
'.$langs->trans("OtherOptions").'
'; + print $langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from') ? ini_get('sendmail_from') : $langs->transnoentities("Undefined")); + print ' '.$help; + print '
'; + print '
'; print dol_get_fiche_end(); @@ -685,6 +710,36 @@ if ($action == 'edit') { print ''; print '
'; + + print '
'; + + + print '
'; // You can use div-table-responsive-no-min if you don't need reserved height for your table + print ''; + print ''; + + // From + $help = $form->textwithpicto('', $langs->trans("EMailHelpMsgSPFDKIM")); + print ''; + print ''; + + print '
'.$langs->trans("OtherOptions").'
'; + print $langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from') ? ini_get('sendmail_from') : $langs->transnoentities("Undefined")); + print ' '.$help; + print ''; + if (!getDolGlobalString('MAIN_MAIL_EMAIL_FROM_PASSWORDRESET')) { + print ''.getDolGlobalString('MAIN_MAIL_EMAIL_FROM').''; + } else { + print getDolGlobalString('MAIN_MAIL_EMAIL_FROM_PASSWORDRESET'); + } + if (!getDolGlobalString('MAIN_MAIL_EMAIL_FROM') && !getDolGlobalString('MAIN_MAIL_EMAIL_FROM_PASSWORDRESET')) { + print img_warning($langs->trans("Mandatory")); + } elseif (getDolGlobalString('MAIN_MAIL_EMAIL_FROM_PASSWORDRESET') && !isValidEmail(getDolGlobalString('MAIN_MAIL_EMAIL_FROM_PASSWORDRESET'))) { + print img_warning($langs->trans("ErrorBadEMail", getDolGlobalString('MAIN_MAIL_EMAIL_FROM_PASSWORDRESET'))); + } + print '
'; + print '
'; + print dol_get_fiche_end(); From fe3669621a216aadc15709110f5c3fa483668247 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Wed, 12 Feb 2025 19:10:36 +0100 Subject: [PATCH 20/32] NEW Add option MAIN_MAIL_EMAIL_FROM_PASSWORDRESET --- htdocs/admin/mails.php | 14 ++++--- htdocs/admin/mails_passwordreset.php | 55 ++++++++++++++++++++++++++++ htdocs/user/class/user.class.php | 10 ++--- 3 files changed, 68 insertions(+), 11 deletions(-) diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index afda0e31733..b32c64b8b35 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -382,6 +382,7 @@ if ($action == 'edit') { clearstatcache(); + print '
'; // You can use div-table-responsive-no-min if you don't need reserved height for your table print ''; print ''; @@ -613,11 +614,11 @@ if ($action == 'edit') { print ''; print '
'.$langs->trans("Parameters").'
'; - + print '
'; print '
'; - + print '
'; // You can use div-table-responsive-no-min if you don't need reserved height for your table print ''; print ''; @@ -664,6 +665,7 @@ if ($action == 'edit') { print ''; print '
'.$langs->trans("OtherOptions").'
'; + print '
'; print dol_get_fiche_end(); @@ -868,7 +870,7 @@ if ($action == 'edit') { print ''.$langs->trans("MAIN_MAIL_FORCE_SENDTO").''.getDolGlobalString('MAIN_MAIL_FORCE_SENDTO'); if (getDolGlobalString('MAIN_MAIL_FORCE_SENDTO')) { if (!isValidEmail(getDolGlobalString('MAIN_MAIL_FORCE_SENDTO'))) { - print img_warning($langs->trans("ErrorBadEMail")); + print img_warning($langs->trans("ErrorBadEMail", getDolGlobalString('MAIN_MAIL_FORCE_SENDTO'))); } else { print img_warning($langs->trans("RecipientEmailsWillBeReplacedWithThisValue")); } @@ -892,7 +894,7 @@ if ($action == 'edit') { print ''.$langs->trans("MAIN_MAIL_FORCE_SENDTO").''.getDolGlobalString('MAIN_MAIL_FORCE_SENDTO'); if (getDolGlobalString('MAIN_MAIL_FORCE_SENDTO')) { if (!isValidEmail(getDolGlobalString('MAIN_MAIL_FORCE_SENDTO'))) { - print img_warning($langs->trans("ErrorBadEMail")); + print img_warning($langs->trans("ErrorBadEMail", getDolGlobalString('MAIN_MAIL_FORCE_SENDTO'))); } else { print img_warning($langs->trans("RecipientEmailsWillBeReplacedWithThisValue")); } @@ -910,7 +912,7 @@ if ($action == 'edit') { if (!getDolGlobalString('MAIN_MAIL_EMAIL_FROM')) { print img_warning($langs->trans("Mandatory")); } elseif (!isValidEmail(getDolGlobalString('MAIN_MAIL_EMAIL_FROM'))) { - print img_warning($langs->trans("ErrorBadEMail")); + print img_warning($langs->trans("ErrorBadEMail", getDolGlobalString('MAIN_MAIL_EMAIL_FROM'))); } print ''; @@ -958,7 +960,7 @@ if ($action == 'edit') { print ''.$langs->trans("MAIN_MAIL_ERRORS_TO").''; print ''.(getDolGlobalString('MAIN_MAIL_ERRORS_TO')); if (getDolGlobalString('MAIN_MAIL_ERRORS_TO') && !isValidEmail(getDolGlobalString('MAIN_MAIL_ERRORS_TO'))) { - print img_warning($langs->trans("ErrorBadEMail")); + print img_warning($langs->trans("ErrorBadEMail", getDolGlobalString('MAIN_MAIL_ERRORS_TO'))); } print ''; diff --git a/htdocs/admin/mails_passwordreset.php b/htdocs/admin/mails_passwordreset.php index 5f3b07ce7ee..6433b63486c 100644 --- a/htdocs/admin/mails_passwordreset.php +++ b/htdocs/admin/mails_passwordreset.php @@ -104,6 +104,10 @@ if ($action == 'update' && !$cancel) { dolibarr_set_const($db, "MAIN_MAIL_EMAIL_STARTTLS_PASSWORDRESET", GETPOST("MAIN_MAIL_EMAIL_STARTTLS_PASSWORDRESET"), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_PASSWORDRESET", GETPOST("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_PASSWORDRESET"), 'chaine', 0, '', $conf->entity); + if (GETPOSTISSET("MAIN_MAIL_EMAIL_FROM_PASSWORDRESET")) { + dolibarr_set_const($db, "MAIN_MAIL_EMAIL_FROM_PASSWORDRESET", GETPOST("MAIN_MAIL_EMAIL_FROM_PASSWORDRESET", 'alphanohtml'), 'chaine', 0, '', $conf->entity); + } + header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); exit; } @@ -349,6 +353,7 @@ if ($action == 'edit') { clearstatcache(); + print '
'; // You can use div-table-responsive-no-min if you don't need reserved height for your table print ''; print ''; @@ -553,6 +558,26 @@ if ($action == 'edit') { print ''; print '
'.$langs->trans("Parameters").'
'; + print '
'; + + print '
'; + + + print '
'; // You can use div-table-responsive-no-min if you don't need reserved height for your table + print ''; + print ''; + + // From + $help = $form->textwithpicto('', $langs->trans("EMailHelpMsgSPFDKIM")); + print ''; + print ''; + + print '
'.$langs->trans("OtherOptions").'
'; + print $langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from') ? ini_get('sendmail_from') : $langs->transnoentities("Undefined")); + print ' '.$help; + print '
'; + print '
'; print dol_get_fiche_end(); @@ -685,6 +710,36 @@ if ($action == 'edit') { print ''; print '
'; + + print '
'; + + + print '
'; // You can use div-table-responsive-no-min if you don't need reserved height for your table + print ''; + print ''; + + // From + $help = $form->textwithpicto('', $langs->trans("EMailHelpMsgSPFDKIM")); + print ''; + print ''; + + print '
'.$langs->trans("OtherOptions").'
'; + print $langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from') ? ini_get('sendmail_from') : $langs->transnoentities("Undefined")); + print ' '.$help; + print ''; + if (!getDolGlobalString('MAIN_MAIL_EMAIL_FROM_PASSWORDRESET')) { + print ''.getDolGlobalString('MAIN_MAIL_EMAIL_FROM').''; + } else { + print getDolGlobalString('MAIN_MAIL_EMAIL_FROM_PASSWORDRESET'); + } + if (!getDolGlobalString('MAIN_MAIL_EMAIL_FROM') && !getDolGlobalString('MAIN_MAIL_EMAIL_FROM_PASSWORDRESET')) { + print img_warning($langs->trans("Mandatory")); + } elseif (getDolGlobalString('MAIN_MAIL_EMAIL_FROM_PASSWORDRESET') && !isValidEmail(getDolGlobalString('MAIN_MAIL_EMAIL_FROM_PASSWORDRESET'))) { + print img_warning($langs->trans("ErrorBadEMail", getDolGlobalString('MAIN_MAIL_EMAIL_FROM_PASSWORDRESET'))); + } + print '
'; + print '
'; + print dol_get_fiche_end(); diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 3c46fd80675..bec40c850f7 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -2663,12 +2663,12 @@ class User extends CommonObject $outputlangs = new Translate("", $conf); if (isset($this->conf->MAIN_LANG_DEFAULT) - && $this->conf->MAIN_LANG_DEFAULT != 'auto') { // If user has defined its own language (rare because in most cases, auto is used) - $outputlangs->getDefaultLang($this->conf->MAIN_LANG_DEFAULT); + && getDolGlobalString('MAIN_LANG_DEFAULT') != 'auto') { // If user has defined its own language (rare because in most cases, auto is used) + $outputlangs->getDefaultLang(getDolGlobalString('MAIN_LANG_DEFAULT')); } - if ($this->conf->MAIN_LANG_DEFAULT) { - $outputlangs->setDefaultLang($this->conf->MAIN_LANG_DEFAULT); + if (getDolGlobalString('MAIN_LANG_DEFAULT')) { + $outputlangs->setDefaultLang(getDolGlobalString('MAIN_LANG_DEFAULT')); } else { // If user has not defined its own language, we used current language $outputlangs = $langs; } @@ -2729,7 +2729,7 @@ class User extends CommonObject $mailfile = new CMailFile( $subject, $this->email, - $conf->global->MAIN_MAIL_EMAIL_FROM, + getDolGlobalString("MAIN_MAIL_EMAIL_FROM_PASSWORDRESET", getDolGlobalString("MAIN_MAIL_EMAIL_FROM")), $mesg, array(), array(), From 48354a6d73fec5db5296b4d470195aae922f5e03 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Wed, 12 Feb 2025 19:16:56 +0100 Subject: [PATCH 21/32] Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop --- htdocs/user/class/user.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index bec40c850f7..5e7686e6d52 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -2650,7 +2650,7 @@ class User extends CommonObject public function send_password($user, $password = '', $changelater = 0) { // phpcs:enable - global $conf, $langs, $mysoc; + global $conf, $langs; global $dolibarr_main_url_root; require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; From 073a6eeae32060864b8d23e0d2741e4c6478531b Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Wed, 12 Feb 2025 21:02:50 +0100 Subject: [PATCH 22/32] NEW Add options PDF_XXX_SHOW_PRICE_INCL_TAX into PDF setup --- htdocs/admin/pdf_other.php | 237 +++++++++++------- .../commande/doc/pdf_proforma.modules.php | 2 +- htdocs/langs/en_US/admin.lang | 3 + 3 files changed, 152 insertions(+), 90 deletions(-) diff --git a/htdocs/admin/pdf_other.php b/htdocs/admin/pdf_other.php index 73b4d52596c..80986a883b4 100644 --- a/htdocs/admin/pdf_other.php +++ b/htdocs/admin/pdf_other.php @@ -224,11 +224,33 @@ if (isModEnabled('propal')) { print ajax_constantonoff('MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING'); } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING", $arrval, $conf->global->MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING); + print $form->selectarray("MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING", $arrval, getDolGlobalString('MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING')); } print ''; */ + print ''; + print $form->textwithpicto($langs->trans("PDF_XXX_SHOW_PRICE_INCL_TAX"), $langs->trans("AvailableWithSomePDFTemplatesOnly")); + print ''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('PDF_PROPAL_SHOW_PRICE_INCL_TAX'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("PDF_PROPAL_SHOW_PRICE_INCL_TAX", $arrval, getDolGlobalString('PDF_PROPAL_SHOW_PRICE_INCL_TAX')); + } + print ''; + + print ''; + print $form->textwithpicto($langs->trans("MAIN_GENERATE_DOCUMENTS_WITH_PICTURE"), $langs->trans("RandomlySelectedIfSeveral")); + print ''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('MAIN_GENERATE_PROPOSALS_WITH_PICTURE'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("MAIN_GENERATE_PROPOSALS_WITH_PICTURE", $arrval, getdolGlobalString('MAIN_GENERATE_PROPOSALS_WITH_PICTURE')); + } + print ''; + print ''; print $form->textwithpicto($langs->trans("MAIN_PDF_ADD_TERMSOFSALE_PROPAL"), $langs->trans("PdfAddTermOfSaleHelp")); print ''; @@ -236,18 +258,7 @@ if (isModEnabled('propal')) { print ajax_constantonoff('MAIN_PDF_ADD_TERMSOFSALE_PROPAL'); } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("MAIN_PDF_ADD_TERMSOFSALE_PROPAL", $arrval, $conf->global->MAIN_PDF_ADD_TERMSOFSALE_PROPAL); - } - print ''; - - print ''; - print $form->textwithpicto($langs->trans("MAIN_GENERATE_PROPOSALS_WITH_PICTURE"), $langs->trans("RandomlySelectedIfSeveral")); - print ''; - if ($conf->use_javascript_ajax) { - print ajax_constantonoff('MAIN_GENERATE_PROPOSALS_WITH_PICTURE'); - } else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("MAIN_GENERATE_PROPOSALS_WITH_PICTURE", $arrval, $conf->global->MAIN_GENERATE_PROPOSALS_WITH_PICTURE); + print $form->selectarray("MAIN_PDF_ADD_TERMSOFSALE_PROPAL", $arrval, getDolGlobalString('MAIN_PDF_ADD_TERMSOFSALE_PROPAL')); } print ''; @@ -261,7 +272,31 @@ if (isModEnabled('order')) { print '
'; print ''; + print ''; + + print ''; + + print ''; + print ''; - print ''; @@ -289,74 +324,6 @@ if (isModEnabled('order')) { } -if (isModEnabled('supplier_proposal')) { - $langs->load("supplier_proposal"); - print load_fiche_titre($langs->trans("SupplierProposal"), '', 'supplier_proposal'); - - print '
'; - print '
'.$langs->trans("Parameters").'
'; + print $form->textwithpicto($langs->trans("PDF_XXX_SHOW_PRICE_INCL_TAX"), $langs->trans("AvailableWithSomePDFTemplatesOnly")); + print ''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('PDF_ORDER_SHOW_PRICE_INCL_TAX'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("PDF_ORDER_SHOW_PRICE_INCL_TAX", $arrval, getDolGlobalString('PDF_ORDER_SHOW_PRICE_INCL_TAX')); + } + print '
'; + print $form->textwithpicto($langs->trans("MAIN_GENERATE_DOCUMENTS_WITH_PICTURE"), $langs->trans("RandomlySelectedIfSeveral")); + print ''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('MAIN_GENERATE_ORDERS_WITH_PICTURE'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("MAIN_GENERATE_ORDERS_WITH_PICTURE", $arrval, getdolGlobalString('MAIN_GENERATE_ORDERS_WITH_PICTURE')); + } + print '
'; print $form->textwithpicto($langs->trans("MAIN_PDF_ADD_TERMSOFSALE_ORDER"), $langs->trans("PdfAddTermOfSaleHelp")); print ''; @@ -269,18 +304,18 @@ if (isModEnabled('order')) { print ajax_constantonoff('MAIN_PDF_ADD_TERMSOFSALE_ORDER'); } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("MAIN_PDF_ADD_TERMSOFSALE_ORDER", $arrval, $conf->global->MAIN_PDF_ADD_TERMSOFSALE_ORDER); + print $form->selectarray("MAIN_PDF_ADD_TERMSOFSALE_ORDER", $arrval, getDolGlobalString('MAIN_PDF_ADD_TERMSOFSALE_ORDER')); } print '
'; + print '
'; print $form->textwithpicto($langs->trans("SALES_ORDER_SHOW_SHIPPING_ADDRESS"), $langs->trans("SALES_ORDER_SHOW_SHIPPING_ADDRESSMore")); print ''; if ($conf->use_javascript_ajax) { print ajax_constantonoff('SALES_ORDER_SHOW_SHIPPING_ADDRESS'); } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("SALES_ORDER_SHOW_SHIPPING_ADDRESS", $arrval, $conf->global->SALES_ORDER_SHOW_SHIPPING_ADDRESS); + print $form->selectarray("SALES_ORDER_SHOW_SHIPPING_ADDRESS", $arrval, getDolGlobalString('SALES_ORDER_SHOW_SHIPPING_ADDRESS')); } print '
'; - print ''; - - print ''; - - print ''; - - print '
'.$langs->trans("Parameter").'
'; - print $form->textwithpicto($langs->trans("MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_UNIT_PRICE"), ''); - print ''; - if ($conf->use_javascript_ajax) { - print ajax_constantonoff('MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_UNIT_PRICE'); - } else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_UNIT_PRICE", $arrval, $conf->global->MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_UNIT_PRICE); - } - print '
'; - print $form->textwithpicto($langs->trans("MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_TOTAL_COLUMN"), ''); - print ''; - if ($conf->use_javascript_ajax) { - print ajax_constantonoff('MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_TOTAL_COLUMN'); - } else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_TOTAL_COLUMN", $arrval, $conf->global->MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_TOTAL_COLUMN); - } - print '
'; - print '
'; -} - - -if (isModEnabled('supplier_order')) { - $langs->load("supplier_order"); - print load_fiche_titre($langs->trans("SupplierOrder"), '', 'supplier_proposal'); - - print '
'; - print ''; - print ''; - - print ''; - - print ''; - - print '
'.$langs->trans("Parameter").'
'; - print $form->textwithpicto($langs->trans("MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_UNIT_PRICE"), ''); - print ''; - if ($conf->use_javascript_ajax) { - print ajax_constantonoff('MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_UNIT_PRICE'); - } else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_UNIT_PRICE", $arrval, $conf->global->MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_UNIT_PRICE); - } - print '
'; - print $form->textwithpicto($langs->trans("MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_TOTAL_COLUMN"), ''); - print ''; - if ($conf->use_javascript_ajax) { - print ajax_constantonoff('MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_TOTAL_COLUMN'); - } else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_TOTAL_COLUMN", $arrval, $conf->global->MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_TOTAL_COLUMN); - } - print '
'; - print '
'; -} if (isModEnabled('invoice')) { print load_fiche_titre($langs->trans("Invoices"), '', 'bill'); @@ -365,6 +332,28 @@ if (isModEnabled('invoice')) { print ''; print ''; + print ''; + + print ''; + print ''; + print ''; @@ -466,7 +456,77 @@ if (isModEnabled('invoice')) { print ajax_constantonoff('INVOICE_HIDE_LINKED_OBJECT'); } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("INVOICE_HIDE_LINKED_OBJECT", $arrval, $conf->global->INVOICE_HIDE_LINKED_OBJECT); + print $form->selectarray("INVOICE_HIDE_LINKED_OBJECT", $arrval, getDolGlobalString('INVOICE_HIDE_LINKED_OBJECT')); + } + print ''; + + print '
'.$langs->trans("Parameters").'
'; + print $form->textwithpicto($langs->trans("PDF_XXX_SHOW_PRICE_INCL_TAX"), $langs->trans("AvailableWithSomePDFTemplatesOnly")); + print ''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('PDF_INVOICE_SHOW_PRICE_INCL_TAX'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("PDF_INVOICE_SHOW_PRICE_INCL_TAX", $arrval, getDolGlobalString('PDF_INVOICE_SHOW_PRICE_INCL_TAX')); + } + print '
'; + print $form->textwithpicto($langs->trans("MAIN_GENERATE_DOCUMENTS_WITH_PICTURE"), $langs->trans("RandomlySelectedIfSeveral")); + print ''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('MAIN_GENERATE_INVOICES_WITH_PICTURE'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("MAIN_GENERATE_INVOICES_WITH_PICTURE", $arrval, getdolGlobalString('MAIN_GENERATE_INVOICES_WITH_PICTURE')); + } + print '
'; print $form->textwithpicto($langs->trans("MAIN_PDF_ADD_TERMSOFSALE_INVOICE"), $langs->trans("PdfAddTermOfSaleHelp")); print ''; @@ -372,9 +361,10 @@ if (isModEnabled('invoice')) { print ajax_constantonoff('MAIN_PDF_ADD_TERMSOFSALE_INVOICE'); } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("MAIN_PDF_ADD_TERMSOFSALE_INVOICE", $arrval, $conf->global->MAIN_PDF_ADD_TERMSOFSALE_INVOICE); + print $form->selectarray("MAIN_PDF_ADD_TERMSOFSALE_INVOICE", $arrval, getDolGlobalString('MAIN_PDF_ADD_TERMSOFSALE_INVOICE')); } print '
'; print $form->textwithpicto($langs->trans("INVOICE_ADD_ZATCA_QR_CODE"), $langs->trans("INVOICE_ADD_ZATCA_QR_CODEMore")); print ''; @@ -430,7 +420,7 @@ if (isModEnabled('invoice')) { print ajax_constantonoff('INVOICE_SHOW_SHIPPING_ADDRESS'); } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("INVOICE_SHOW_SHIPPING_ADDRESS", $arrval, $conf->global->INVOICE_SHOW_SHIPPING_ADDRESS); + print $form->selectarray("INVOICE_SHOW_SHIPPING_ADDRESS", $arrval, getDolGlobalString('INVOICE_SHOW_SHIPPING_ADDRESS')); } print '
'; + print '
'; +} + + +if (isModEnabled('supplier_proposal')) { + $langs->load("supplier_proposal"); + print load_fiche_titre($langs->trans("SupplierProposal"), '', 'supplier_proposal'); + + print '
'; + print ''; + print ''; + + print ''; + + print ''; + + print '
'.$langs->trans("Parameter").'
'; + print $form->textwithpicto($langs->trans("MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_UNIT_PRICE"), ''); + print ''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_UNIT_PRICE'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_UNIT_PRICE", $arrval, getDolGlobalString('MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_UNIT_PRICE')); + } + print '
'; + print $form->textwithpicto($langs->trans("MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_TOTAL_COLUMN"), ''); + print ''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_TOTAL_COLUMN'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_TOTAL_COLUMN", $arrval, getDolGlobalString('MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_TOTAL_COLUMN')); + } + print '
'; + print '
'; +} + + +if (isModEnabled('supplier_order')) { + $langs->load("supplier_order"); + print load_fiche_titre($langs->trans("SupplierOrder"), '', 'supplier_proposal'); + + print '
'; + print ''; + print ''; + + print ''; + + print ''; @@ -495,7 +555,6 @@ if (isModEnabled('shipping')) { print ''; } - if (isModEnabled('reception')) { print load_fiche_titre($langs->trans("Receptions"), '', 'reception'); @@ -572,7 +631,7 @@ $maxfilesizearray = getMaxFileSizeArray(); $tooltiptermsofsale .= ($maxfilesizearray['maxmin'] > 0) ? '
'.$langs->trans('MaxSize').' : '.$maxfilesizearray['maxmin'].' '.$langs->trans('Kb') : ''; $documenturl = DOL_URL_ROOT.'/document.php'; if (isset($conf->global->DOL_URL_ROOT_DOCUMENT_PHP)) { - $documenturl = $conf->global->DOL_URL_ROOT_DOCUMENT_PHP; + $documenturl = getDolGlobalString('DOL_URL_ROOT_DOCUMENT_PHP'); } $modulepart = 'mycompany'; diff --git a/htdocs/core/modules/commande/doc/pdf_proforma.modules.php b/htdocs/core/modules/commande/doc/pdf_proforma.modules.php index e4199a5bf8e..0b068fbfa22 100644 --- a/htdocs/core/modules/commande/doc/pdf_proforma.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_proforma.modules.php @@ -47,7 +47,7 @@ class pdf_proforma extends pdf_eratosthene */ public function __construct($db) { - global $conf, $langs, $mysoc; + global $langs; parent::__construct($db); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index df17e0ee429..a8c61ef799f 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2137,6 +2137,7 @@ MAIN_PDF_MARGIN_BOTTOM=Bottom margin on PDF MAIN_DOCUMENTS_LOGO_HEIGHT=Height for logo on PDF DOC_SHOW_FIRST_SALES_REP=Show first sales representative MAIN_GENERATE_PROPOSALS_WITH_PICTURE=Add column for picture on proposal lines +MAIN_GENERATE_DOCUMENTS_WITH_PICTURE=Add column for picture on document lines MAIN_DOCUMENTS_WITH_PICTURE_WIDTH=Width of the column if a picture is added on lines MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_UNIT_PRICE=Hide the unit price column on quotation requests MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_TOTAL_COLUMN=Hide the total price column on quotation requests @@ -2611,3 +2612,5 @@ UploadExtensionRestriction=List of forbidden file extensions to upload UploadExtensionRestrictionExemple=htm, html, shtml, js, php Privileges=Privileges FieldsLinked=Fields Linked +PDF_XXX_SHOW_PRICE_INCL_TAX=Show column Price including tax +AvailableWithSomePDFTemplatesOnly=Feature not supported on old PDF templates From 0ef79d47d89e044a86d6a093ffd4c9edef737c85 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Wed, 12 Feb 2025 22:43:01 +0100 Subject: [PATCH 23/32] Fix warning --- htdocs/core/class/commonobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index e6198c8bb6e..32796db2147 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -701,7 +701,7 @@ abstract class CommonObject public $user_creation; /** - * @var int User id author/creation + * @var int|null User id author/creation */ public $user_creation_id; From a1ce8272acbbbb72f0aee83ddf740a0ca49b9fd7 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Wed, 12 Feb 2025 22:46:09 +0100 Subject: [PATCH 24/32] Fix warning --- htdocs/compta/facture/class/facture.class.php | 14 ++--- htdocs/core/lib/company.lib.php | 47 ++++++++++++++- htdocs/public/onlinesign/newonlinesign.php | 59 +------------------ 3 files changed, 55 insertions(+), 65 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 311c8df539a..53867a36681 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2555,12 +2555,12 @@ class Facture extends CommonInvoice if (isset($this->retained_warranty)) { $this->retained_warranty = (float) $this->retained_warranty; } - if (!isset($this->fk_user_author) && isset($this->user_author) ) { - $this->fk_user_author = $this->user_author; + if (!isset($this->user_creation_id) && isset($this->fk_user_author) ) { + $this->user_creation_id = $this->fk_user_author; + } + if (!isset($this->user_validation_id) && isset($this->fk_user_valid) ) { + $this->user_validation_id = $this->fk_user_valid; } - - // Check parameters - // Put here code to add control on parameters values // Update request $sql = "UPDATE ".MAIN_DB_PREFIX."facture SET"; @@ -2585,8 +2585,8 @@ class Facture extends CommonInvoice $sql .= " total_ttc=".(isset($this->total_ttc) ? (float) $this->total_ttc : "null").","; $sql .= " revenuestamp=".((isset($this->revenuestamp) && $this->revenuestamp != '') ? (float) $this->revenuestamp : "null").","; $sql .= " fk_statut=".(isset($this->status) ? (int) $this->status : "null").","; - $sql .= " fk_user_author=".(isset($this->fk_user_author) ? ((int) $this->fk_user_author) : "null").","; - $sql .= " fk_user_valid=".(isset($this->fk_user_valid) ? (int) $this->fk_user_valid : "null").","; + $sql .= " fk_user_author=".(isset($this->user_creation_id) ? ((int) $this->user_creation_id) : "null").","; + $sql .= " fk_user_valid=".(isset($this->user_validation_id) ? (int) $this->user_validation_id : "null").","; $sql .= " fk_facture_source=".(isset($this->fk_facture_source) ? (int) $this->fk_facture_source : "null").","; $sql .= " fk_projet=".(isset($this->fk_project) ? (int) $this->fk_project : "null").","; $sql .= " fk_cond_reglement=".(isset($this->cond_reglement_id) ? (int) $this->cond_reglement_id : "null").","; diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index ba8b55c69d7..eb1b72a3846 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -2659,9 +2659,54 @@ function addMailingEventTypeSQL($actioncode, $objcon, $filterobj) } +/** + * Show header of company in HTML public pages + * + * @param Societe $mysoc Third party + * @param Translate $langs Output language + * @return void + */ +function htmlPrintOnlineHeader($mysoc, $langs) +{ + global $conf; + + // Define urllogo + $urllogo = DOL_URL_ROOT.'/theme/common/login_logo.png'; + + if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) { + $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_small); + } elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) { + $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/'.$mysoc->logo); + } elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.svg')) { + $urllogo = DOL_URL_ROOT.'/theme/dolibarr_logo.svg'; + } + + print '
'; + + // Output html code for logo + if ($urllogo) { + print '
'; + print '
'; + print ''; + print '
'; + if (!getDolGlobalString('MAIN_HIDE_POWERED_BY')) { + print ''; + } + print '
'; + } + + if (getDolGlobalString('MEMBER_IMAGE_PUBLIC_REGISTRATION')) { + print '
'; + print ''; + print '
'; + } + + print '
'; +} + /** - * Show footer of company in HTML pages + * Show footer of company in HTML public pages * * @param Societe $fromcompany Third party * @param Translate $langs Output language diff --git a/htdocs/public/onlinesign/newonlinesign.php b/htdocs/public/onlinesign/newonlinesign.php index 641e5413771..566b45618cc 100644 --- a/htdocs/public/onlinesign/newonlinesign.php +++ b/htdocs/public/onlinesign/newonlinesign.php @@ -185,62 +185,6 @@ $hookmanager->initHooks(array('onlinesign')); $error = 0; -/** - * Show header for online signature - * - * @param string $title Title - * @param string $head Head array - * @param int $disablejs More content into html header - * @param int $disablehead More content into html header - * @param string[]|string $arrayofjs Array of complementary js files - * @param string[]|string $arrayofcss Array of complementary css files - * @return void - */ -function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) -{ - global $conf, $langs, $mysoc; - - top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers - - print ''; - - // Define urllogo - $urllogo = DOL_URL_ROOT.'/theme/common/login_logo.png'; - - if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) { - $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_small); - } elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) { - $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/'.$mysoc->logo); - } elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.svg')) { - $urllogo = DOL_URL_ROOT.'/theme/dolibarr_logo.svg'; - } - - print '
'; - - // Output html code for logo - if ($urllogo) { - print '
'; - print '
'; - print ''; - print '
'; - if (!getDolGlobalString('MAIN_HIDE_POWERED_BY')) { - print ''; - } - print '
'; - } - - if (getDolGlobalString('MEMBER_IMAGE_PUBLIC_REGISTRATION')) { - print '
'; - print ''; - print '
'; - } - - print '
'; - - print '
'; -} - - /* * Actions @@ -303,7 +247,7 @@ $title = $langs->trans("OnlineSignature"); $replacemainarea = (empty($conf->dol_hide_leftmenu) ? '
' : '').'
'; llxHeader($head, $title, '', '', 0, 0, '', '', '', 'onlinepaymentbody', $replacemainarea, 1); -llxHeaderVierge($title); +htmlPrintOnlineHeader($mysoc, $langs); if ($action == 'refusepropal') { print $form->formconfirm($_SERVER["PHP_SELF"].'?ref='.urlencode($ref).'&securekey='.urlencode($SECUREKEY).(isModEnabled('multicompany') ? '&entity='.$entity : ''), $langs->trans('RefusePropal'), $langs->trans('ConfirmRefusePropal', $object->ref), 'confirm_refusepropal', '', '', 1); @@ -923,6 +867,7 @@ if ($action == "dosign" && empty($cancel)) { } print ''."\n"; print '
'.$langs->trans("Parameter").'
'; + print $form->textwithpicto($langs->trans("MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_UNIT_PRICE"), ''); + print ''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_UNIT_PRICE'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_UNIT_PRICE", $arrval, getDolGlobalString('MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_UNIT_PRICE')); + } + print '
'; + print $form->textwithpicto($langs->trans("MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_TOTAL_COLUMN"), ''); + print ''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_TOTAL_COLUMN'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_TOTAL_COLUMN", $arrval, getDolGlobalString('MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_TOTAL_COLUMN')); } print '
'."\n"; + print ''."\n"; print '
'."\n"; print '
'; From 8c082525fd0c2516b5c440c4e69154015ae1b0d5 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Wed, 12 Feb 2025 22:50:59 +0100 Subject: [PATCH 25/32] Fix warning --- htdocs/admin/pdf_other.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/pdf_other.php b/htdocs/admin/pdf_other.php index 80986a883b4..8e5bbe44ae5 100644 --- a/htdocs/admin/pdf_other.php +++ b/htdocs/admin/pdf_other.php @@ -247,7 +247,7 @@ if (isModEnabled('propal')) { print ajax_constantonoff('MAIN_GENERATE_PROPOSALS_WITH_PICTURE'); } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("MAIN_GENERATE_PROPOSALS_WITH_PICTURE", $arrval, getdolGlobalString('MAIN_GENERATE_PROPOSALS_WITH_PICTURE')); + print $form->selectarray("MAIN_GENERATE_PROPOSALS_WITH_PICTURE", $arrval, getDolGlobalString('MAIN_GENERATE_PROPOSALS_WITH_PICTURE')); } print ''; @@ -293,7 +293,7 @@ if (isModEnabled('order')) { print ajax_constantonoff('MAIN_GENERATE_ORDERS_WITH_PICTURE'); } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("MAIN_GENERATE_ORDERS_WITH_PICTURE", $arrval, getdolGlobalString('MAIN_GENERATE_ORDERS_WITH_PICTURE')); + print $form->selectarray("MAIN_GENERATE_ORDERS_WITH_PICTURE", $arrval, getDolGlobalString('MAIN_GENERATE_ORDERS_WITH_PICTURE')); } print ''; @@ -350,7 +350,7 @@ if (isModEnabled('invoice')) { print ajax_constantonoff('MAIN_GENERATE_INVOICES_WITH_PICTURE'); } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("MAIN_GENERATE_INVOICES_WITH_PICTURE", $arrval, getdolGlobalString('MAIN_GENERATE_INVOICES_WITH_PICTURE')); + print $form->selectarray("MAIN_GENERATE_INVOICES_WITH_PICTURE", $arrval, getDolGlobalString('MAIN_GENERATE_INVOICES_WITH_PICTURE')); } print ''; From 898beaa75021a167aae7162b37647efa610ddc0b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 12 Feb 2025 22:52:42 +0100 Subject: [PATCH 26/32] Update html.formmail.class.php --- htdocs/core/class/html.formmail.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 2ad80549cfc..e5319cbf30e 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -1554,7 +1554,7 @@ class FormMail extends Form }), success: function(response) { console.log('Received image URL: '+response); - + // make substitutions let substit = ". json_encode($this->substit)."; for (let key in substit) { @@ -1563,7 +1563,7 @@ class FormMail extends Form response = response.replace(key, substit[key]); } } - + // Assuming response is the URL of the generated image var imageUrl = response; $('#ai_image_result').html('\"Generated'); From 382394575d1f8818ce9a0ae4a21bec8a9d18e8ff Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Wed, 12 Feb 2025 22:58:51 +0100 Subject: [PATCH 27/32] Fix warning --- htdocs/expedition/shipment.php | 2 +- htdocs/webportal/class/webportalorder.class.php | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index c0d84059027..a964ea621b4 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -94,7 +94,7 @@ $result = restrictedArea($user, 'expedition', 0, ''); // We use 0 for id, becaus $permissiontoread = $user->hasRight('expedition', 'lire'); $permissiontoadd = $user->hasRight('expedition', 'creer'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php -$permissiontodelete = $user->hasRight('expedition', 'supprimer') || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT); +$permissiontodelete = $user->hasRight('expedition', 'supprimer') || ($permissiontoadd && ((int) $object->status == $object::STATUS_DRAFT)); $permissionnote = $user->hasRight('expedition', 'creer'); // Used by the include of actions_setnotes.inc.php $permissiondellink = $user->hasRight('expedition', 'creer'); // Used by the include of actions_dellink.inc.php diff --git a/htdocs/webportal/class/webportalorder.class.php b/htdocs/webportal/class/webportalorder.class.php index 1cbf082dccb..8c11ba5d92f 100644 --- a/htdocs/webportal/class/webportalorder.class.php +++ b/htdocs/webportal/class/webportalorder.class.php @@ -166,7 +166,7 @@ class WebPortalOrder extends Commande */ public function getTooltipContentArray($params) { - global $conf, $langs; + global $langs; $datas = []; @@ -174,9 +174,8 @@ class WebPortalOrder extends Commande return ['optimize' => $langs->trans("WebPortalOrder")]; } $datas['picto'] = img_picto('', $this->picto) . ' ' . $langs->trans("WebPortalOrder") . ''; - if (isset($this->status)) { - $datas['picto'] .= ' ' . $this->getLibStatut(5); - } + $datas['picto'] .= ' ' . $this->getLibStatut(5); + $datas['ref'] .= '
' . $langs->trans('Ref') . ': ' . $this->ref; return $datas; From 6ab6f02241cc728d3074c28244687f2f5a82f398 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 12 Feb 2025 23:02:04 +0100 Subject: [PATCH 28/32] Update html.formmail.class.php --- htdocs/core/class/html.formmail.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index e5319cbf30e..1fdd72ab371 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -1562,7 +1562,7 @@ class FormMail extends Form // Replace the placeholder with its corresponding value response = response.replace(key, substit[key]); } - } + } // Assuming response is the URL of the generated image var imageUrl = response; From d59421ff84bacbe14cae740b83e26033dccaa406 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Wed, 12 Feb 2025 23:11:48 +0100 Subject: [PATCH 29/32] Fix warning --- dev/build/phpstan/phpstan-baseline.neon | 2 +- htdocs/compta/facture/class/facture.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dev/build/phpstan/phpstan-baseline.neon b/dev/build/phpstan/phpstan-baseline.neon index 13c5539c16e..c092f13c4fd 100644 --- a/dev/build/phpstan/phpstan-baseline.neon +++ b/dev/build/phpstan/phpstan-baseline.neon @@ -10749,7 +10749,7 @@ parameters: - message: '#^If condition is always true\.$#' identifier: if.alwaysTrue - count: 1 + count: 2 path: ../../../htdocs/core/lib/company.lib.php - diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index eb5d0c5165d..081725e89e3 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -104,7 +104,7 @@ class Facture extends CommonInvoice protected $table_ref_field = 'ref'; /** - * @var int ID + * @var int|null ID * @deprecated Use $user_creation_id */ public $fk_user_author; From f352a68150a0d66b1128cdc4bcf26c7c33f33835 Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 11 Feb 2025 22:06:34 +0100 Subject: [PATCH 30/32] Qual: Fix phan notices (public-1) --- dev/tools/phan/baseline.txt | 41 +++++++------------ htdocs/public/agenda/agendaexport.php | 25 +++++------ htdocs/public/bookcal/index.php | 10 ++--- htdocs/public/company/new.php | 15 ++++--- htdocs/public/cron/cron_run_jobs_by_url.php | 3 +- htdocs/public/demo/index.php | 10 ++--- htdocs/public/donations/donateurs_code.php | 10 ++--- htdocs/public/emailing/mailing-read.php | 5 ++- .../public/eventorganization/attendee_new.php | 20 ++++----- .../eventorganization/subscriptionok.php | 5 ++- htdocs/public/members/new.php | 16 ++++---- htdocs/public/members/public_card.php | 17 ++++---- htdocs/public/members/public_list.php | 9 ++-- htdocs/public/onlinesign/newonlinesign.php | 8 ++-- htdocs/public/opensurvey/studs.php | 6 ++- htdocs/public/partnership/new.php | 18 ++++---- htdocs/public/payment/newpayment.php | 16 ++++---- htdocs/public/payment/paymentko.php | 7 +++- htdocs/public/payment/paymentok.php | 31 +++++++------- 19 files changed, 136 insertions(+), 136 deletions(-) diff --git a/dev/tools/phan/baseline.txt b/dev/tools/phan/baseline.txt index 202b45b10d6..22c1223b0fd 100644 --- a/dev/tools/phan/baseline.txt +++ b/dev/tools/phan/baseline.txt @@ -9,35 +9,35 @@ */ return [ // # Issue statistics: - // PhanTypeMismatchArgument : 1840+ occurrences - // PhanUndeclaredProperty : 520+ occurrences - // PhanTypeMismatchArgumentNullable : 380+ occurrences + // PhanTypeMismatchArgument : 1810+ occurrences + // PhanUndeclaredProperty : 510+ occurrences + // PhanTypeMismatchArgumentNullable : 360+ occurrences // PhanPluginUnknownArrayMethodReturnType : 170+ occurrences // PhanUndeclaredGlobalVariable : 170+ occurrences // PhanTypeMismatchProperty : 130+ occurrences // PhanPluginUnknownArrayMethodParamType : 110+ occurrences - // PhanPossiblyUndeclaredGlobalVariable : 95+ occurrences - // PhanTypeMismatchArgumentProbablyReal : 90+ occurrences - // PhanRedefineFunction : 40+ occurrences + // PhanPossiblyUndeclaredGlobalVariable : 85+ occurrences + // PhanTypeMismatchArgumentProbablyReal : 85+ occurrences // PhanTypeExpectedObjectPropAccess : 40+ occurrences // PhanTypeInvalidDimOffset : 25+ occurrences + // PhanRedefineFunction : 20+ occurrences // PhanTypeMismatchDimFetch : 20+ occurrences // PhanPluginUndeclaredVariableIsset : 15+ occurrences // PhanUndeclaredConstant : 15+ occurrences // PhanTypeMismatchArgumentNullableInternal : 10+ occurrences // PhanUndeclaredMethod : 10+ occurrences // PhanTypeComparisonFromArray : 8 occurrences - // PhanPluginSuspiciousParamPosition : 7 occurrences // PhanPluginDuplicateExpressionBinaryOp : 6 occurrences // PhanPluginUnknownObjectMethodCall : 6 occurrences // PhanTypeArraySuspiciousNull : 6 occurrences // PhanParamTooMany : 5 occurrences // PhanPluginDuplicateArrayKey : 4 occurrences - // PhanPluginEmptyStatementIf : 4 occurrences + // PhanPluginSuspiciousParamPosition : 4 occurrences // PhanEmptyFQSENInClasslike : 3 occurrences // PhanInvalidFQSENInClasslike : 3 occurrences // PhanPluginBothLiteralsBinaryOp : 3 occurrences // PhanEmptyForeach : 2 occurrences + // PhanPluginEmptyStatementIf : 2 occurrences // PhanTypeMismatchDimAssignment : 2 occurrences // PhanTypeMismatchDimFetchNullable : 2 occurrences // PhanTypeSuspiciousStringExpression : 2 occurrences @@ -241,7 +241,7 @@ return [ 'htdocs/compta/facture/agenda.php' => ['PhanTypeMismatchArgument'], 'htdocs/compta/facture/card-rec.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable'], 'htdocs/compta/facture/card.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], - 'htdocs/compta/facture/class/api_invoices.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeComparisonFromArray', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/compta/facture/class/api_invoices.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeComparisonFromArray', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/compta/facture/class/facture-rec.class.php' => ['PhanTypeMismatchArgument', 'PhanUndeclaredProperty'], 'htdocs/compta/facture/class/facture.class.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable', 'PhanUndeclaredProperty'], 'htdocs/compta/facture/class/factureligne.class.php' => ['PhanTypeMismatchArgument'], @@ -615,24 +615,11 @@ return [ 'htdocs/projet/class/api_tasks.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeMismatchArgument'], 'htdocs/projet/tasks/time.php' => ['PhanTypeInvalidDimOffset', 'PhanTypeMismatchArgument', 'PhanUndeclaredProperty'], 'htdocs/projet/tasks/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'], - 'htdocs/public/agenda/agendaexport.php' => ['PhanRedefineFunction'], - 'htdocs/public/bookcal/index.php' => ['PhanRedefineFunction'], - 'htdocs/public/company/new.php' => ['PhanRedefineFunction', 'PhanTypeMismatchArgument'], - 'htdocs/public/cron/cron_run_jobs_by_url.php' => ['PhanUndeclaredProperty'], - 'htdocs/public/demo/index.php' => ['PhanRedefineFunction'], - 'htdocs/public/donations/donateurs_code.php' => ['PhanRedefineFunction'], - 'htdocs/public/emailing/mailing-read.php' => ['PhanRedefineFunction'], - 'htdocs/public/eventorganization/attendee_new.php' => ['PhanRedefineFunction', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable'], - 'htdocs/public/eventorganization/subscriptionok.php' => ['PhanRedefineFunction', 'PhanUndeclaredGlobalVariable'], - 'htdocs/public/members/new.php' => ['PhanRedefineFunction', 'PhanTypeMismatchArgument', 'PhanUndeclaredGlobalVariable'], - 'htdocs/public/members/public_card.php' => ['PhanRedefineFunction'], - 'htdocs/public/members/public_list.php' => ['PhanRedefineFunction'], - 'htdocs/public/onlinesign/newonlinesign.php' => ['PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchArgumentNullableInternal'], - 'htdocs/public/opensurvey/studs.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgument'], - 'htdocs/public/partnership/new.php' => ['PhanRedefineFunction', 'PhanTypeMismatchArgument'], - 'htdocs/public/payment/newpayment.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable', 'PhanUndeclaredProperty'], - 'htdocs/public/payment/paymentko.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullable'], - 'htdocs/public/payment/paymentok.php' => ['PhanPluginSuspiciousParamPosition', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], + 'htdocs/public/company/new.php' => ['PhanTypeMismatchArgument'], + 'htdocs/public/eventorganization/subscriptionok.php' => ['PhanUndeclaredGlobalVariable'], + 'htdocs/public/members/new.php' => ['PhanUndeclaredGlobalVariable'], + 'htdocs/public/payment/newpayment.php' => ['PhanUndeclaredProperty'], + 'htdocs/public/payment/paymentok.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/public/project/index.php' => ['PhanRedefineFunction', 'PhanUndeclaredGlobalVariable'], 'htdocs/public/project/new.php' => ['PhanRedefineFunction'], 'htdocs/public/project/suggestbooth.php' => ['PhanRedefineFunction', 'PhanTypeMismatchArgument', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], diff --git a/htdocs/public/agenda/agendaexport.php b/htdocs/public/agenda/agendaexport.php index 12046197b2a..c3d75a02842 100644 --- a/htdocs/public/agenda/agendaexport.php +++ b/htdocs/public/agenda/agendaexport.php @@ -1,6 +1,7 @@ * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 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 @@ -66,7 +67,7 @@ if (!defined('NOIPCHECK')) { * @param string[]|string $arrayofcss Array of complementary css files * @return void */ -function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) +function llxHeaderAgendaExport($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) { print 'Export agenda cal'; } @@ -75,7 +76,7 @@ function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $ * * @return void */ -function llxFooterVierge() +function llxFooterAgendaExport() { print ''; } @@ -179,9 +180,9 @@ if (!getDolGlobalString('MAIN_AGENDA_XCAL_EXPORTKEY')) { top_httphead(); - llxHeaderVierge(""); + llxHeaderAgendaExport(""); print '
Module Agenda was not configured properly.
'; - llxFooterVierge(); + llxFooterAgendaExport(); exit; } @@ -192,13 +193,13 @@ $reshook = $hookmanager->executeHooks('doActions', $filters); // Note that $acti if ($reshook < 0) { top_httphead(); - llxHeaderVierge(""); + llxHeaderAgendaExport(""); if (!empty($hookmanager->errors) && is_array($hookmanager->errors)) { print '
'.implode('
', $hookmanager->errors).'
'; } else { print '
'.$hookmanager->error.'
'; } - llxFooterVierge(); + llxFooterAgendaExport(); } elseif (empty($reshook)) { // Check exportkey if (!GETPOST("exportkey") || getDolGlobalString('MAIN_AGENDA_XCAL_EXPORTKEY') != GETPOST("exportkey")) { @@ -206,9 +207,9 @@ if ($reshook < 0) { top_httphead(); - llxHeaderVierge(""); + llxHeaderAgendaExport(""); print '
Bad value for key.
'; - llxFooterVierge(); + llxFooterAgendaExport(); exit; } } @@ -281,9 +282,9 @@ if ($shortfilename == 'dolibarrcalendar') { top_httphead(); - llxHeaderVierge(""); + llxHeaderAgendaExport(""); print '
'.$langs->trans("ErrorWrongValueForParameterX", 'format').'
'; - llxFooterVierge(); + llxFooterAgendaExport(); exit; } @@ -406,6 +407,6 @@ if ($format == 'rss') { top_httphead(); -llxHeaderVierge(""); +llxHeaderAgendaExport(""); print '
'.$agenda->error.'
'; -llxFooterVierge(); +llxFooterAgendaExport(); diff --git a/htdocs/public/bookcal/index.php b/htdocs/public/bookcal/index.php index fc41027d6a8..9f5b7fee892 100644 --- a/htdocs/public/bookcal/index.php +++ b/htdocs/public/bookcal/index.php @@ -3,7 +3,7 @@ * Copyright (C) 2006-2017 Laurent Destailleur * Copyright (C) 2009-2012 Regis Houssin * Copyright (C) 2023 anthony Berton - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -133,7 +133,7 @@ $errmsg = ''; * @param string[]|string $arrayofcss Array of complementary css files * @return void */ -function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) +function llxHeaderBookCal($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) { global $conf, $langs, $mysoc; @@ -190,7 +190,7 @@ function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $ * Actions */ -if ($action == 'add' ) { // Test on permission not required here (anonymous action protected by mitigation of /public/... urls) +if ($action == 'add') { // Test on permission not required here (anonymous action protected by mitigation of /public/... urls) $error = 0; $idcontact = 0; $calendar = $object; @@ -272,7 +272,7 @@ if ($action == 'add' ) { // Test on permission not required here (anonymous acti 'id' => $contact->id, 'mandatory' => 0, 'answer_status' => 0, - 'transparency' =>0, + 'transparency' => 0, ] ]; $actioncomm->ip = getUserRemoteIP(); @@ -304,7 +304,7 @@ if ($action == 'add' ) { // Test on permission not required here (anonymous acti $form = new Form($db); -llxHeaderVierge('BookingCalendar'); +llxHeaderBookCal('BookingCalendar'); print '

'.(!empty($object->label) ? $object->label : $object->ref).'

'; diff --git a/htdocs/public/company/new.php b/htdocs/public/company/new.php index f7942e267c5..f9928fcd274 100644 --- a/htdocs/public/company/new.php +++ b/htdocs/public/company/new.php @@ -8,7 +8,7 @@ * Copyright (C) 2018 Alexandre Spangaro * Copyright (C) 2021 Waël Almoman * Copyright (C) 2022 Udo Tamm - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 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 @@ -28,7 +28,6 @@ * \file htdocs/public/company/new.php * \ingroup prospect * \brief Example of form to add a new prospect - * */ if (!defined('NOLOGIN')) { @@ -118,7 +117,7 @@ $extrafields->fetch_name_optionals_label($objectsoc->table_element); // fetch op * @param string[]|string $arrayofcss Array of complementary css files * @return void */ -function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) +function llxHeaderCompanyNew($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) { global $conf, $langs, $mysoc; @@ -167,7 +166,7 @@ function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $ * * @return void */ -function llxFooterVierge() +function llxFooterCompanyNew() { global $conf, $langs; @@ -289,7 +288,7 @@ if (empty($reshook) && $action == 'add') { // Test on permission not required he // backtopage parameter with an url was set on prospect submit page, we never go here because a redirect was done to this url. if (empty($reshook) && $action == 'added') { // Test on permission not required here - llxHeaderVierge("newSocieteAdded"); + llxHeaderCompanyNew("newSocieteAdded"); // If we have not been redirected print '

'; @@ -297,7 +296,7 @@ if (empty($reshook) && $action == 'added') { // Test on permission not required print $langs->trans("newSocieteAdded"); print ''; - llxFooterVierge(); + llxFooterCompanyNew(); exit; } @@ -313,7 +312,7 @@ $adht = new AdherentType($db); $formadmin = new FormAdmin($db); -llxHeaderVierge($langs->trans("ContactUs")); +llxHeaderCompanyNew($langs->trans("ContactUs")); print '
'; print load_fiche_titre(img_picto('', 'member_nocolor', 'class="pictofixedwidth"') . '   ' . $langs->trans("ContactUs"), '', '', 0, '', 'center'); @@ -490,6 +489,6 @@ print ''; -llxFooterVierge(); +llxFooterCompanyNew(); $db->close(); diff --git a/htdocs/public/cron/cron_run_jobs_by_url.php b/htdocs/public/cron/cron_run_jobs_by_url.php index 2c2bd2e7670..bb27393d688 100644 --- a/htdocs/public/cron/cron_run_jobs_by_url.php +++ b/htdocs/public/cron/cron_run_jobs_by_url.php @@ -3,7 +3,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2013-2015 Laurent Destailleur * Copyright (C) 2017 Regis Houssin - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -161,6 +161,7 @@ if (is_array($object->lines) && (count($object->lines) > 0)) { // Loop over job foreach ($object->lines as $line) { + '@phan-var-force Cronjob $line'; dol_syslog("cron_run_jobs.php cronjobid: ".$line->id." priority=".$line->priority." entity=".$line->entity." label=".$line->label, LOG_DEBUG); echo "cron_run_jobs.php cronjobid: ".$line->id." priority=".$line->priority." entity=".$line->entity." label=".$line->label; diff --git a/htdocs/public/demo/index.php b/htdocs/public/demo/index.php index 2c23ea5420c..700b5e19b24 100644 --- a/htdocs/public/demo/index.php +++ b/htdocs/public/demo/index.php @@ -4,7 +4,7 @@ * Copyright (C) 2010 Regis Houssin * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 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,7 +283,7 @@ jQuery(document).ready(function () { }); '; -llxHeaderVierge($langs->trans("DolibarrDemo"), $head); +llxHeaderDemoIndex($langs->trans("DolibarrDemo"), $head); print "\n"; @@ -468,7 +468,7 @@ if (isModEnabled('google') && getDolGlobalString('MAIN_GOOGLE_AD_CLIENT') && get } } -llxFooterVierge(); +llxFooterDemoIndex(); $db->close(); @@ -484,7 +484,7 @@ $db->close(); * @param string[]|string $arrayofcss Array of complementary css files * @return void */ -function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) +function llxHeaderDemoIndex($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) { top_httphead(); @@ -498,7 +498,7 @@ function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $ * * @return void */ -function llxFooterVierge() +function llxFooterDemoIndex() { printCommonFooter('public'); diff --git a/htdocs/public/donations/donateurs_code.php b/htdocs/public/donations/donateurs_code.php index 8c84311b6c6..34a80c707e7 100644 --- a/htdocs/public/donations/donateurs_code.php +++ b/htdocs/public/donations/donateurs_code.php @@ -1,6 +1,7 @@ * Copyright (C) 2018-2025 Frédéric France + * Copyright (C) 2025 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 @@ -34,7 +35,6 @@ if (!defined('NOIPCHECK')) { // C'est un wrapper, donc header vierge /** - * * @param string $title Title * @param string $head Head array * @param int $disablejs More content into html header @@ -43,7 +43,7 @@ if (!defined('NOIPCHECK')) { * @param string[]|string $arrayofcss Array of complementary css files * @return void */ -function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) +function llxHeaderDonatorCodes($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) { print 'List of donators'; } @@ -52,7 +52,7 @@ function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $ * * @return void */ -function llxFooterVierge() +function llxFooterDonatorCodes() { print ''; } @@ -74,7 +74,7 @@ $langs->load("donations"); * View */ -llxHeaderVierge(""); +llxHeaderDonatorCodes(""); $sql = "SELECT d.datedon as datedon, d.lastname, d.firstname, d.amount, d.public, d.societe"; $sql .= " FROM ".MAIN_DB_PREFIX."don as d"; @@ -116,4 +116,4 @@ if ($resql) { $db->close(); -llxFooterVierge(); +llxFooterDonatorCodes(); diff --git a/htdocs/public/emailing/mailing-read.php b/htdocs/public/emailing/mailing-read.php index 9504034a64a..8530271fcba 100644 --- a/htdocs/public/emailing/mailing-read.php +++ b/htdocs/public/emailing/mailing-read.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2011 Laurent Destailleur * Copyright (C) 2012 Florian Henry * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 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 @@ -71,7 +72,7 @@ if (!defined('NOSESSION')) { * @param int $disablenoindex Disable the "noindex" on meta robot header * @return void */ -function llxHeader($head = '', $title = '', $help_url = '', $target = '', $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '', $morequerystring = '', $morecssonbody = '', $replacemainareaby = '', $disablenofollow = 0, $disablenoindex = 0) +function llxHeaderReadMailing($head = '', $title = '', $help_url = '', $target = '', $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '', $morequerystring = '', $morecssonbody = '', $replacemainareaby = '', $disablenofollow = 0, $disablenoindex = 0) { } @@ -84,7 +85,7 @@ function llxHeader($head = '', $title = '', $help_url = '', $target = '', $disab * @param int $disabledoutputofmessages Clear all messages stored into session without displaying them * @return void */ -function llxFooter($comment = '', $zone = 'private', $disabledoutputofmessages = 0) +function llxFooterReadMailing($comment = '', $zone = 'private', $disabledoutputofmessages = 0) { } diff --git a/htdocs/public/eventorganization/attendee_new.php b/htdocs/public/eventorganization/attendee_new.php index 5359e60e2b0..5199143d38b 100644 --- a/htdocs/public/eventorganization/attendee_new.php +++ b/htdocs/public/eventorganization/attendee_new.php @@ -1,7 +1,7 @@ * Copyright (C) 2023 Laurent Destailleur - * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -179,7 +179,7 @@ $extrafields->fetch_name_optionals_label($object->table_element); // fetch optio * @param string[]|string $arrayofcss Array of complementary css files * @return void */ -function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) +function llxHeaderNewAttendee($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) { global $conf, $langs, $mysoc; @@ -228,7 +228,7 @@ function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $ * * @return void */ -function llxFooterVierge() +function llxFooterNewAttendee() { print ''; @@ -546,7 +546,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen $resultprod = 0; if (getDolGlobalInt('SERVICE_CONFERENCE_ATTENDEE_SUBSCRIPTION') > 0) { - $resultprod = $productforinvoicerow->fetch(getDolGlobalString('SERVICE_CONFERENCE_ATTENDEE_SUBSCRIPTION')); + $resultprod = $productforinvoicerow->fetch(getDolGlobalInt('SERVICE_CONFERENCE_ATTENDEE_SUBSCRIPTION')); } $facture = null; @@ -664,7 +664,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen // Get email content from template $arraydefaultmessage = null; - $labeltouse = getDolGlobalString('EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT'); + $labeltouse = getDolGlobalInt('EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT'); if (!empty($labeltouse)) { $arraydefaultmessage = $formmail->getEMailTemplate($db, 'eventorganization_send', $user, $outputlangs, $labeltouse, 1, ''); } @@ -673,8 +673,8 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen $subject = $arraydefaultmessage->topic; $msg = $arraydefaultmessage->content; } else { - $subject = null; - $msg = null; + $subject = ''; + $msg = ''; } $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $thirdparty); @@ -719,7 +719,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen $form = new Form($db); $formcompany = new FormCompany($db); -llxHeaderVierge($langs->trans("NewRegistration")); +llxHeaderNewAttendee($langs->trans("NewRegistration")); print '
'; @@ -909,7 +909,7 @@ if ((!empty($conference->id) && $conference->status == ConferenceOrBooth::STATUS print '' . $langs->trans('State') . ''; if ($country_code) { print img_picto('', 'state', 'class="pictofixedwidth"'); - print $formcompany->select_state(GETPOST("state_id"), $country_code); + print $formcompany->select_state(GETPOSTINT("state_id"), $country_code); } else { print ''; } @@ -964,6 +964,6 @@ if ((!empty($conference->id) && $conference->status == ConferenceOrBooth::STATUS print '
'; -llxFooterVierge(); +llxFooterNewAttendee(); $db->close(); diff --git a/htdocs/public/eventorganization/subscriptionok.php b/htdocs/public/eventorganization/subscriptionok.php index 5b3be5058eb..d0ac5f4020d 100644 --- a/htdocs/public/eventorganization/subscriptionok.php +++ b/htdocs/public/eventorganization/subscriptionok.php @@ -5,6 +5,7 @@ * Copyright (C) 2021 Waël Almoman * Copyright (C) 2021 Dorian Vabre * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 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 @@ -104,7 +105,7 @@ if (empty($conf->eventorganization->enabled)) { * @param string[]|string $arrayofcss Array of complementary css files * @return void */ -function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) +function llxHeaderSubscriptionOk($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) { global $user, $conf, $langs, $mysoc; @@ -177,7 +178,7 @@ if (getDolGlobalString('ONLINE_PAYMENT_CSS_URL')) { $conf->dol_hide_topmenu = 1; $conf->dol_hide_leftmenu = 1; -llxHeaderVierge($langs->trans("PaymentForm")); +llxHeaderSubscriptionOk($langs->trans("PaymentForm")); // Show message diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 40c79fc427e..6b65f81e284 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -8,7 +8,7 @@ * Copyright (C) 2018 Alexandre Spangaro * Copyright (C) 2021 Waël Almoman * Copyright (C) 2022 Udo Tamm - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 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 @@ -121,7 +121,7 @@ $user->loadDefaultValues(); * @param string[]|string $arrayofcss Array of complementary css files * @return void */ -function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) +function llxHeaderMembersNew($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) { global $conf, $langs, $mysoc; @@ -170,7 +170,7 @@ function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $ * * @return void */ -function llxFooterVierge() +function llxFooterMembersNew() { global $conf, $langs; @@ -500,7 +500,7 @@ if (empty($reshook) && $action == 'add') { // Test on permission not required he // backtopage parameter with an url was set on member submit page, we never go here because a redirect was done to this url. if (empty($reshook) && $action == 'added') { // Test on permission not required here - llxHeaderVierge($langs->trans("NewMemberForm")); + llxHeaderMembersNew($langs->trans("NewMemberForm")); // If we have not been redirected print '

'; @@ -508,7 +508,7 @@ if (empty($reshook) && $action == 'added') { // Test on permission not required print $langs->trans("NewMemberbyWeb"); print ''; - llxFooterVierge(); + llxFooterMembersNew(); exit; } @@ -524,7 +524,7 @@ $adht = new AdherentType($db); $extrafields->fetch_name_optionals_label($object->table_element); // fetch optionals attributes and labels -llxHeaderVierge($langs->trans("NewSubscription")); +llxHeaderMembersNew($langs->trans("NewSubscription")); print '
'; print load_fiche_titre(img_picto('', 'member_nocolor', 'class="pictofixedwidth"').'   '.$langs->trans("NewSubscription"), '', '', 0, '', 'center'); @@ -697,7 +697,7 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR print ''.$langs->trans('State').''; if ($country_code) { print img_picto('', 'state', 'class="pictofixedwidth paddingright"'); - print $formcompany->select_state(GETPOST("state_id"), $country_code); + print $formcompany->select_state(GETPOSTINT("state_id"), $country_code); } print ''; } @@ -979,6 +979,6 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR } //htmlPrintOnlineFooter($mysoc, $langs); -llxFooterVierge(); +llxFooterMembersNew(); $db->close(); diff --git a/htdocs/public/members/public_card.php b/htdocs/public/members/public_card.php index a9adb98c407..cd76656de90 100644 --- a/htdocs/public/members/public_card.php +++ b/htdocs/public/members/public_card.php @@ -5,6 +5,7 @@ * Copyright (C) 2012 Regis Houssin * Copyright (C) 2018 Alexandre Spangaro * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2025 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 @@ -90,7 +91,7 @@ if (getDolGlobalString('MEMBER_PUBLIC_CSS')) { $morehead = ''; } -llxHeaderVierge($langs->trans("MemberCard"), $morehead); +llxHeaderMembersPubCard($langs->trans("MemberCard"), $morehead); // fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); @@ -139,7 +140,7 @@ if ($id > 0) { } -llxFooterVierge(); +llxFooterMembersPubCard(); $db->close(); @@ -156,7 +157,7 @@ $db->close(); * @param string[]|string $arrayofcss Array of complementary css files * @return void */ -function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) +function llxHeaderMembersPubCard($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) { top_htmlhead($head, $title); @@ -164,11 +165,11 @@ function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $ } /** -* Show footer for card member -* -* @return void -*/ -function llxFooterVierge() + * Show footer for card member + * + * @return void + */ +function llxFooterMembersPubCard() { printCommonFooter('public'); diff --git a/htdocs/public/members/public_list.php b/htdocs/public/members/public_list.php index 0df9b10a12b..b655475d954 100644 --- a/htdocs/public/members/public_list.php +++ b/htdocs/public/members/public_list.php @@ -4,6 +4,7 @@ * Copyright (C) 2004-2009 Laurent Destailleur * Copyright (C) 2012 Regis Houssin * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 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 @@ -73,7 +74,7 @@ $langs->loadLangs(array("main", "members", "companies", "other")); * @param string[]|string $arrayofcss Array of complementary css files * @return void */ -function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) +function llxHeaderMembersPubList($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) { top_htmlhead($head, $title); @@ -85,7 +86,7 @@ function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $ * * @return void */ -function llxFooterVierge() +function llxFooterMembersPubList() { printCommonFooter('public'); @@ -133,7 +134,7 @@ if (getDolGlobalString('MEMBER_PUBLIC_CSS')) { $morehead = ''; } -llxHeaderVierge($langs->trans("ListOfValidatedPublicMembers"), $morehead); +llxHeaderMembersPubList($langs->trans("ListOfValidatedPublicMembers"), $morehead); $sql = "SELECT rowid, firstname, lastname, societe, zip, town, email, birth, photo"; @@ -215,6 +216,6 @@ if ($result) { } -llxFooterVierge(); +llxFooterMembersPubList(); $db->close(); diff --git a/htdocs/public/onlinesign/newonlinesign.php b/htdocs/public/onlinesign/newonlinesign.php index 566b45618cc..e9fdba6a042 100644 --- a/htdocs/public/onlinesign/newonlinesign.php +++ b/htdocs/public/onlinesign/newonlinesign.php @@ -4,7 +4,7 @@ * Copyright (C) 2009-2012 Regis Houssin * Copyright (C) 2023 anthony Berton * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 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 @@ -91,13 +91,13 @@ $message = GETPOST('message', 'aZ09'); // currency (iso code) $suffix = GETPOST("suffix", 'aZ09'); -$source = GETPOST("source", 'alpha'); +$source = (string) GETPOST("source", 'alpha'); $ref = $REF = GETPOST("ref", 'alpha'); $urlok = ''; $urlko = ''; -if (empty($source)) { +if ($source == '') { $source = 'proposal'; } if (!empty($refusepropal)) { @@ -254,7 +254,7 @@ if ($action == 'refusepropal') { } // Check link validity for param 'source' to avoid use of the examples as value -if (!empty($source) && in_array($ref, array('member_ref', 'contractline_ref', 'invoice_ref', 'order_ref', 'proposal_ref', ''))) { +if (/* $source !== '' :never empty && */ in_array($ref, array('member_ref', 'contractline_ref', 'invoice_ref', 'order_ref', 'proposal_ref', ''))) { $langs->load("errors"); dol_print_error_email('BADREFINONLINESIGNFORM', $langs->trans("ErrorBadLinkSourceSetButBadValueForRef", $source, $ref)); // End of page diff --git a/htdocs/public/opensurvey/studs.php b/htdocs/public/opensurvey/studs.php index bd8e73efa7f..8f8630126f5 100644 --- a/htdocs/public/opensurvey/studs.php +++ b/htdocs/public/opensurvey/studs.php @@ -1,7 +1,7 @@ * Copyright (C) 2014 Marcos García - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -60,7 +60,7 @@ if (GETPOST('sondage')) { } $object = new Opensurveysondage($db); -$result = $object->fetch(0, $numsondage); +$result = $object->fetch('', $numsondage); $nblines = $object->fetch_lines(); @@ -255,6 +255,7 @@ if (GETPOST("boutonp") || GETPOST("boutonp.x") || GETPOST("boutonp_x")) { // bo $testmodifier = false; $testligneamodifier = false; $ligneamodifier = -1; +$modifier = -1; for ($i = 0; $i < $nblines; $i++) { if (GETPOSTISSET('modifierligne'.$i)) { $ligneamodifier = $i; @@ -726,6 +727,7 @@ if ($ligneamodifier < 0 && (!isset($_SESSION['nom']))) { // Select value of best choice (for checkbox columns only) $nbofcheckbox = 0; +$meilleurecolonne = null; for ($i = 0; $i < $nbcolonnes; $i++) { if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst'))) { $nbofcheckbox++; diff --git a/htdocs/public/partnership/new.php b/htdocs/public/partnership/new.php index 14fdfee4b99..3a7ad036925 100644 --- a/htdocs/public/partnership/new.php +++ b/htdocs/public/partnership/new.php @@ -7,7 +7,7 @@ * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2018 Alexandre Spangaro * Copyright (C) 2021 Waël Almoman - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 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 @@ -108,7 +108,7 @@ $user->loadDefaultValues(); * @param string[] $arrayofcss Array of complementary css files * @return void */ -function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) +function llxHeaderPartnershipNew($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) { global $conf, $langs, $mysoc; @@ -157,7 +157,7 @@ function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $ * * @return void */ -function llxFooterVierge() +function llxFooterPartnershipNew() { global $conf, $langs; @@ -267,7 +267,7 @@ if (empty($reshook) && $action == 'add') { // Test on permission not required he $company = new Societe($db); $result = $company->fetch(0, GETPOST('societe')); if ($result == 0) { // if entry with name not found, we search using the email - $result1 = $company->fetch(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, GETPOST('email')); + $result1 = $company->fetch(0, '', '', '', '', '', '', '', '', '', GETPOST('email')); if ($result1 > 0) { $error++; $errmsg = $langs->trans("EmailAlreadyExistsPleaseRewriteYourCompanyName"); @@ -535,7 +535,7 @@ if (empty($reshook) && $action == 'add') { // Test on permission not required he // If PARTNERSHIP_URL_REDIRECT_SUBSCRIPTION is set to url we never go here because a redirect was done to this url. // backtopage parameter with an url was set on member submit page, we never go here because a redirect was done to this url. if (empty($reshook) && $action == 'added') { // Test on permission not required here - llxHeaderVierge($langs->trans("NewPartnershipForm")); + llxHeaderPartnershipNew($langs->trans("NewPartnershipForm")); // Si on a pas ete redirige print '

'; @@ -543,7 +543,7 @@ if (empty($reshook) && $action == 'added') { // Test on permission not required print $langs->trans("NewPartnershipbyWeb"); print ''; - llxFooterVierge(); + llxFooterPartnershipNew(); exit; } @@ -559,7 +559,7 @@ $formcompany = new FormCompany($db); $extrafields->fetch_name_optionals_label($object->table_element); // fetch optionals attributes and labels -llxHeaderVierge($langs->trans("NewPartnershipRequest")); +llxHeaderPartnershipNew($langs->trans("NewPartnershipRequest")); print '
'; print load_fiche_titre(img_picto('', 'hands-helping', 'class="pictofixedwidth"').'   '.$langs->trans("NewPartnershipRequest"), '', '', 0, '', 'center'); @@ -683,7 +683,7 @@ print ''; if (!getDolGlobalString('SOCIETE_DISABLE_STATE')) { print ''.$langs->trans('State').''; if ($country_code) { - print $formcompany->select_state(GETPOST("state_id"), $country_code); + print $formcompany->select_state(GETPOSTINT("state_id"), $country_code); } print ''; } @@ -717,6 +717,6 @@ print "
"; print ''; -llxFooterVierge(); +llxFooterPartnershipNew(); $db->close(); diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 2eca6baf62a..d1ccd9df208 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -191,7 +191,7 @@ if ($source == 'organizedeventregistration') { // Test on permission not requir } } elseif ($source == 'boothlocation') { // Test on permission not required here (anonymous action protected by mitigation of /public/... urls) // Getting the amount to pay, the invoice, finding the thirdparty - $invoiceid = GETPOST('ref'); + $invoiceid = GETPOSTINT('ref'); $invoice = new Facture($db); $resultinvoice = $invoice->fetch($invoiceid); if ($resultinvoice <= 0) { @@ -478,7 +478,7 @@ if ($action == 'dopayment') { // Test on permission not required here (anonymous dol_syslog("SCRIPT_URI: ".(empty($_SERVER["SCRIPT_URI"]) ? '' : $_SERVER["SCRIPT_URI"]), LOG_DEBUG); // If defined script uri must match domain of PAYPAL_API_OK and PAYPAL_API_KO // A redirect is added if API call successful - $mesg = print_paypal_redirect($PAYPAL_API_PRICE, $PAYPAL_API_DEVISE, $PAYPAL_PAYMENT_TYPE, $PAYPAL_API_OK, $PAYPAL_API_KO, $FULLTAG); + $mesg = print_paypal_redirect((float) $PAYPAL_API_PRICE, $PAYPAL_API_DEVISE, $PAYPAL_PAYMENT_TYPE, $PAYPAL_API_OK, $PAYPAL_API_KO, $FULLTAG); // If we are here, it means the Paypal redirect was not done, so we show error message $action = ''; @@ -990,7 +990,7 @@ if (getDolGlobalString('MAIN_IMAGE_PUBLIC_PAYMENT')) { print ''."\n"; -print ''."\n"; +print ''."\n"; // Additional information for each payment system if (isModEnabled('paypal')) { print ''."\n"; @@ -1022,7 +1022,7 @@ if (getDolGlobalString('PAYMENT_NEWFORM_TEXT')) { } if (empty($text)) { $text .= '
'.$langs->trans("WelcomeOnPaymentPage").''."\n"; - $text .= ''.$langs->trans("ThisScreenAllowsYouToPay", $creditor).'

'."\n"; + $text .= ''.$langs->trans("ThisScreenAllowsYouToPay", (string) $creditor).'

'."\n"; } print $text; @@ -1260,7 +1260,7 @@ if ($source == 'invoice') { print ''; print img_picto('', 'company', 'class="pictofixedwidth"'); print ''.$creditor.''; - print ''; + print ''; print ''."\n"; // Debitor @@ -1810,7 +1810,7 @@ if ($source == 'donation') { $don = new Don($db); // @phan-suppress-next-line PhanPluginSuspiciousParamPosition - $result = $don->fetch($ref); + $result = $don->fetch((int) $ref); if ($result <= 0) { $mesg = $don->error; $error++; @@ -1998,7 +1998,7 @@ if ($source == 'organizedeventregistration' && is_object($thirdparty)) { print ''.$langs->trans("Designation"); print ''.$text.''; print ''; - print ''; + print ''; print ''."\n"; // Amount @@ -2082,7 +2082,7 @@ if ($source == 'boothlocation') { print ''.$langs->trans("Designation"); print ''.$text; print ''; - print ''; + print ''; print ''."\n"; // Amount diff --git a/htdocs/public/payment/paymentko.php b/htdocs/public/payment/paymentko.php index bcb33857397..88de37b4b11 100644 --- a/htdocs/public/payment/paymentko.php +++ b/htdocs/public/payment/paymentko.php @@ -3,7 +3,7 @@ * Copyright (C) 2006-2013 Laurent Destailleur * Copyright (C) 2012 Regis Houssin * Copyright (C) 2024-2025 Frédéric France - * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024-2025 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 @@ -93,10 +93,12 @@ if (isModEnabled('paypal')) { $PAYPALPAYERID = GETPOST('PayerID'); } } +/* if (isModEnabled('paybox')) { } if (isModEnabled('stripe')) { } +*/ $FULLTAG = GETPOST('FULLTAG'); if (empty($FULLTAG)) { @@ -180,6 +182,7 @@ dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_payment'); // Set $appli for emails title $appli = $mysoc->name; $error = 0; +$FinalPaymentAmt = 0; if (!empty($_SESSION['ipaddress'])) { // To avoid to make action twice @@ -214,7 +217,7 @@ if (!empty($_SESSION['ipaddress'])) { // To avoid to make action twice if (empty($myCompanyDefaultLang) || $myCompanyDefaultLang === 'auto') { // We must guess the language from the company country. We must not use the language of the visitor. This is a technical email for supervision // so it must always be into the same language. - $myCompanyDefaultLang = getLanguageCodeFromCountryCode($mysoc->country_code); + $myCompanyDefaultLang = (string) getLanguageCodeFromCountryCode($mysoc->country_code); } $companylangs = new Translate('', $conf); diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index 26b2db6e80b..24757d2b4a9 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -425,6 +425,7 @@ $appli = $mysoc->name; // Make complementary actions (post payment actions if payment is ok) $ispostactionok = 0; +$paymentTypeId = 0; $postactionmessages = array(); if ($ispaymentok) { // Set permission for the anonymous user @@ -466,7 +467,6 @@ if ($ispaymentok) { dol_syslog("We have to process member with id=".$tmptag['MEM']." result1=".$result1." result2=".$result2, LOG_DEBUG, 0, '_payment'); if ($result1 > 0 && $result2 > 0) { - $paymentTypeId = 0; if ($paymentmethod == 'paybox') { $paymentTypeId = getDolGlobalInt('PAYBOX_PAYMENT_MODE_FOR_PAYMENTS'); } @@ -576,7 +576,7 @@ if ($ispaymentok) { $datesubscription = dol_get_first_day((int) dol_print_date($datesubscription, "%Y")); } - $datesubend = null; + $datesubend = 0; if ($datesubscription && $defaultdelay && $defaultdelayunit) { $datesubend = dol_time_plus_duree($datesubscription, $defaultdelay, $defaultdelayunit); // the new end date of subscription must be in futur @@ -643,6 +643,7 @@ if ($ispaymentok) { $option = 'none'; } $sendalsoemail = 1; + $crowid = 0; // Record the subscription then complementary actions $db->begin(); @@ -663,10 +664,12 @@ if ($ispaymentok) { } } + $autocreatethirdparty = 0; + if (!$error) { dol_syslog("Call ->subscriptionComplementaryActions option=".$option, LOG_DEBUG, 0, '_payment'); - $autocreatethirdparty = 1; // will create thirdparty if member not yet linked to a thirdparty + $autocreatethirdparty = 1; // will create third party if member not yet linked to a thirdparty $result = $object->subscriptionComplementaryActions($crowid, $option, $accountid, $datesubscription, $paymentdate, $operation, $label, $amount, $num_chq, $emetteur_nom, $emetteur_banque, $autocreatethirdparty, $TRANSACTIONID, $service); if ($result < 0) { @@ -708,7 +711,7 @@ if ($ispaymentok) { $service = 'StripeLive'; $servicestatus = 1; } - $stripeacc = null; // No Oauth/connect use for public pages + $stripeacc = ''; // No Oauth/connect use for public pages $thirdparty = new Societe($db); $thirdparty->fetch($thirdparty_id); @@ -1298,7 +1301,7 @@ if ($ispaymentok) { require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php'; include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $object = new Facture($db); - $result = $object->fetch($ref); + $result = $object->fetch((int) $ref); // @phan-suppress-curren-line PhanPluginSuspiciousParamPosition if ($result) { $paymentTypeId = 0; if ($paymentmethod == 'paybox') { @@ -1439,7 +1442,7 @@ if ($ispaymentok) { $thirdparty = new Societe($db); $resultthirdparty = $thirdparty->fetch($attendeetovalidate->fk_soc); if ($resultthirdparty < 0) { - setEventMessages($resultthirdparty->error, $resultthirdparty->errors, "errors"); + setEventMessages($thirdparty->error, $thirdparty->errors, "errors"); } else { require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; @@ -1452,7 +1455,7 @@ if ($ispaymentok) { // Get email content from template $arraydefaultmessage = null; - $idoftemplatetouse = getDolGlobalString('EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT'); // Email to send for Event organization registration + $idoftemplatetouse = getDolGlobalInt('EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT'); // Email to send for Event organization registration if (!empty($idoftemplatetouse)) { $arraydefaultmessage = $formmail->getEMailTemplate($db, 'conferenceorbooth', $user, $outputlangs, $idoftemplatetouse, 1, ''); @@ -1529,7 +1532,7 @@ if ($ispaymentok) { require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php'; include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $object = new Facture($db); - $result = $object->fetch($ref); + $result = $object->fetch((int) $ref); // @phan-suppress-current-line PhanPluginSuspiciousParamPosition if ($result) { $FinalPaymentAmt = $_SESSION["FinalPaymentAmt"]; @@ -1655,9 +1658,9 @@ if ($ispaymentok) { $booth->status = ConferenceOrBooth::STATUS_SUGGESTED; $resultboothupdate = $booth->update($user); if ($resultboothupdate < 0) { - // Finding the thirdparty by getting the invoice + // Finding the third party by getting the invoice $invoice = new Facture($db); - $resultinvoice = $invoice->fetch($ref); + $resultinvoice = $invoice->fetch((int) $ref); // @phan-suppress-current-line PhanPluginSuspiciousParamPosition if ($resultinvoice < 0) { $postactionmessages[] = 'Could not find the associated invoice.'; $ispostactionok = -1; @@ -1681,7 +1684,7 @@ if ($ispaymentok) { // Get email content from template $arraydefaultmessage = null; - $idoftemplatetouse = getDolGlobalString('EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_BOOTH'); // Email sent after registration for a Booth + $idoftemplatetouse = getDolGlobalInt('EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_BOOTH'); // Email sent after registration for a Booth if (!empty($idoftemplatetouse)) { $arraydefaultmessage = $formmail->getEMailTemplate($db, 'conferenceorbooth', $user, $outputlangs, $idoftemplatetouse, 1, ''); @@ -1960,11 +1963,11 @@ if ($ispaymentok) { // Send an email to the admins if ($sendemail) { // Get default language to use for the company for supervision emails - $myCompanyDefaultLang = $mysoc->default_lang; + $myCompanyDefaultLang = (string) $mysoc->default_lang; if (empty($myCompanyDefaultLang) || $myCompanyDefaultLang === 'auto') { // We must guess the language from the company country. We must not use the language of the visitor. This is a technical email for supervision // so it must always be into the same language. - $myCompanyDefaultLang = getLanguageCodeFromCountryCode($mysoc->country_code); + $myCompanyDefaultLang = (string) getLanguageCodeFromCountryCode($mysoc->country_code); } $companylangs = new Translate('', $conf); @@ -2125,7 +2128,7 @@ unset($_SESSION["TRANSACTIONID"]); if (empty($doactionsthenredirect)) { print "\n\n"; - print "\n"; + print "\n"; } From 3b1200df77a55ffa49f52933cc16033021ff679d Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 12 Feb 2025 00:52:24 +0100 Subject: [PATCH 31/32] Qual: Fix phan notices (public-2) --- dev/tools/phan/baseline.txt | 31 +++++-------- htdocs/core/class/commonpeople.class.php | 6 +-- htdocs/public/project/index.php | 9 +++- htdocs/public/project/new.php | 10 +++-- htdocs/public/project/suggestbooth.php | 16 ++++--- htdocs/public/project/suggestconference.php | 14 +++--- htdocs/public/project/viewandvote.php | 1 + htdocs/public/recruitment/view.php | 4 +- htdocs/public/stripe/ipn.php | 18 ++++---- htdocs/public/test/test_arrays.php | 5 ++- htdocs/public/ticket/create_ticket.php | 37 +++++++++------- htdocs/public/ticket/list.php | 43 +++++++++---------- htdocs/public/ticket/view.php | 9 ++-- .../public/webportal/webportal.main.inc.php | 12 +++--- htdocs/public/website/index.php | 28 ++++++------ htdocs/public/website/javascript.js.php | 24 ++++++----- htdocs/public/website/styles.css.php | 24 ++++++----- 17 files changed, 158 insertions(+), 133 deletions(-) diff --git a/dev/tools/phan/baseline.txt b/dev/tools/phan/baseline.txt index 22c1223b0fd..ee7622c3050 100644 --- a/dev/tools/phan/baseline.txt +++ b/dev/tools/phan/baseline.txt @@ -9,18 +9,17 @@ */ return [ // # Issue statistics: - // PhanTypeMismatchArgument : 1810+ occurrences + // PhanTypeMismatchArgument : 1790+ occurrences // PhanUndeclaredProperty : 510+ occurrences // PhanTypeMismatchArgumentNullable : 360+ occurrences // PhanPluginUnknownArrayMethodReturnType : 170+ occurrences // PhanUndeclaredGlobalVariable : 170+ occurrences - // PhanTypeMismatchProperty : 130+ occurrences + // PhanTypeMismatchProperty : 120+ occurrences // PhanPluginUnknownArrayMethodParamType : 110+ occurrences - // PhanPossiblyUndeclaredGlobalVariable : 85+ occurrences - // PhanTypeMismatchArgumentProbablyReal : 85+ occurrences + // PhanTypeMismatchArgumentProbablyReal : 80+ occurrences + // PhanPossiblyUndeclaredGlobalVariable : 75+ occurrences // PhanTypeExpectedObjectPropAccess : 40+ occurrences // PhanTypeInvalidDimOffset : 25+ occurrences - // PhanRedefineFunction : 20+ occurrences // PhanTypeMismatchDimFetch : 20+ occurrences // PhanPluginUndeclaredVariableIsset : 15+ occurrences // PhanUndeclaredConstant : 15+ occurrences @@ -29,6 +28,7 @@ return [ // PhanTypeComparisonFromArray : 8 occurrences // PhanPluginDuplicateExpressionBinaryOp : 6 occurrences // PhanPluginUnknownObjectMethodCall : 6 occurrences + // PhanRedefineFunction : 6 occurrences // PhanTypeArraySuspiciousNull : 6 occurrences // PhanParamTooMany : 5 occurrences // PhanPluginDuplicateArrayKey : 4 occurrences @@ -39,7 +39,6 @@ return [ // PhanEmptyForeach : 2 occurrences // PhanPluginEmptyStatementIf : 2 occurrences // PhanTypeMismatchDimAssignment : 2 occurrences - // PhanTypeMismatchDimFetchNullable : 2 occurrences // PhanTypeSuspiciousStringExpression : 2 occurrences // PhanAccessMethodProtected : 1 occurrence // PhanPluginDuplicateExpressionAssignmentOperation : 1 occurrence @@ -620,22 +619,12 @@ return [ 'htdocs/public/members/new.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/public/payment/newpayment.php' => ['PhanUndeclaredProperty'], 'htdocs/public/payment/paymentok.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], - 'htdocs/public/project/index.php' => ['PhanRedefineFunction', 'PhanUndeclaredGlobalVariable'], - 'htdocs/public/project/new.php' => ['PhanRedefineFunction'], - 'htdocs/public/project/suggestbooth.php' => ['PhanRedefineFunction', 'PhanTypeMismatchArgument', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], - 'htdocs/public/project/suggestconference.php' => ['PhanRedefineFunction', 'PhanTypeMismatchArgument', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], - 'htdocs/public/project/viewandvote.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], - 'htdocs/public/recruitment/view.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], - 'htdocs/public/stripe/ipn.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], - 'htdocs/public/test/test_arrays.php' => ['PhanPluginUndeclaredVariableIsset'], - 'htdocs/public/ticket/create_ticket.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgument', 'PhanTypeMismatchDimFetchNullable', 'PhanTypeMismatchProperty'], - 'htdocs/public/ticket/list.php' => ['PhanTypeMismatchArgument'], - 'htdocs/public/ticket/view.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/public/project/index.php' => ['PhanUndeclaredGlobalVariable'], + 'htdocs/public/project/suggestbooth.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], + 'htdocs/public/project/suggestconference.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], + 'htdocs/public/project/viewandvote.php' => ['PhanUndeclaredGlobalVariable'], + 'htdocs/public/recruitment/view.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/public/webportal/tpl/menu.tpl.php' => ['PhanUndeclaredProperty'], - 'htdocs/public/webportal/webportal.main.inc.php' => ['PhanRedefineFunction', 'PhanTypeMismatchArgument'], - 'htdocs/public/website/index.php' => ['PhanRedefineFunction', 'PhanTypeMismatchArgument'], - 'htdocs/public/website/javascript.js.php' => ['PhanRedefineFunction'], - 'htdocs/public/website/styles.css.php' => ['PhanRedefineFunction'], 'htdocs/reception/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/reception/class/api_receptions.class.php' => ['PhanTypeMismatchArgumentNullable'], 'htdocs/reception/class/reception.class.php' => ['PhanUndeclaredProperty'], diff --git a/htdocs/core/class/commonpeople.class.php b/htdocs/core/class/commonpeople.class.php index 9d80dbdd518..a4e9096b067 100644 --- a/htdocs/core/class/commonpeople.class.php +++ b/htdocs/core/class/commonpeople.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 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 @@ -99,8 +99,8 @@ trait CommonPeople * Return full name (civility+' '+name+' '+lastname) * * @param Translate $langs Language object for translation of civility (used only if option is 1) - * @param int $option 0=No option, 1=Add civility - * @param int $nameorder -1=Auto, 0=Lastname+Firstname, 1=Firstname+Lastname, 2=Firstname, 3=Firstname if defined else lastname, 4=Lastname, 5=Lastname if defined else firstname + * @param int<0,1> $option 0=No option, 1=Add civility + * @param int<-1,5> $nameorder -1=Auto, 0=Lastname+Firstname, 1=Firstname+Lastname, 2=Firstname, 3=Firstname if defined else lastname, 4=Lastname, 5=Lastname if defined else firstname * @param int $maxlen Maximum length * @return string String with full name */ diff --git a/htdocs/public/project/index.php b/htdocs/public/project/index.php index 8b399217059..cf1cfb715f2 100644 --- a/htdocs/public/project/index.php +++ b/htdocs/public/project/index.php @@ -1,6 +1,7 @@ * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 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 @@ -111,6 +112,8 @@ if (empty($conf->project->enabled)) { /** * Show header for new member * + * Note: also called by functions.lib:recordNotFound + * * @param string $title Title * @param string $head Head array * @param int $disablejs More content into html header @@ -119,7 +122,7 @@ if (empty($conf->project->enabled)) { * @param string[]|string $arrayofcss Array of complementary css files * @return void */ -function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) +function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) // @phan-suppress-current-line PhanRedefineFunction { global $conf, $langs, $mysoc; @@ -168,9 +171,11 @@ function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $ /** * Show footer for new member * + * Note: also called by functions.lib:recordNotFound + * * @return void */ -function llxFooterVierge() +function llxFooterVierge() // @phan-suppress-current-line PhanRedefineFunction { print ''; diff --git a/htdocs/public/project/new.php b/htdocs/public/project/new.php index a794d2f5735..35dece5c502 100644 --- a/htdocs/public/project/new.php +++ b/htdocs/public/project/new.php @@ -6,7 +6,7 @@ * Copyright (C) 2012 J. Fernando Lagrange * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2018 Alexandre Spangaro - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 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 @@ -98,6 +98,8 @@ if (empty($conf->project->enabled)) { /** * Show header for new member * + * Note: also called by functions.lib:recordNotFound + * * @param string $title Title * @param string $head Head array * @param int $disablejs More content into html header @@ -106,7 +108,7 @@ if (empty($conf->project->enabled)) { * @param string[]|string $arrayofcss Array of complementary css files * @return void */ -function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) +function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) // @phan-suppress-current-line PhanRedefineFunction { global $conf, $langs, $mysoc; @@ -154,9 +156,11 @@ function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $ /** * Show footer for new member * + * Note: also called by functions.lib:recordNotFound + * * @return void */ -function llxFooterVierge() +function llxFooterVierge() // @phan-suppress-current-line PhanRedefineFunction { print ''; diff --git a/htdocs/public/project/suggestbooth.php b/htdocs/public/project/suggestbooth.php index 4136c172d97..6e57db70241 100644 --- a/htdocs/public/project/suggestbooth.php +++ b/htdocs/public/project/suggestbooth.php @@ -125,6 +125,8 @@ if (empty($conf->eventorganization->enabled)) { /** * Show header for new member * + * Note: also called by functions.lib:recordNotFound + * * @param string $title Title * @param string $head Head array * @param int $disablejs More content into html header @@ -133,7 +135,7 @@ if (empty($conf->eventorganization->enabled)) { * @param string[]|string $arrayofcss Array of complementary css files * @return void */ -function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) +function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) // @phan-suppress-current-line PhanRedefineFunction { global $conf, $langs, $mysoc; @@ -181,9 +183,11 @@ function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $ /** * Show footer for new member * + * Note: also called by functions.lib:recordNotFound + * * @return void */ -function llxFooterVierge() +function llxFooterVierge() // @phan-suppress-current-line PhanRedefineFunction { print ''; @@ -331,7 +335,7 @@ if (empty($reshook) && $action == 'add') { // Test on permission not required he // Adding supplier tag and tag from setup to thirdparty $category = new Categorie($db); - $resultcategory = $category->fetch(getDolGlobalString('EVENTORGANIZATION_CATEG_THIRDPARTY_BOOTH')); + $resultcategory = $category->fetch(getDolGlobalInt('EVENTORGANIZATION_CATEG_THIRDPARTY_BOOTH')); if ($resultcategory <= 0) { $error++; @@ -433,7 +437,7 @@ if (empty($reshook) && $action == 'add') { // Test on permission not required he $facture = null; if (!empty((float) $project->price_booth)) { $productforinvoicerow = new Product($db); - $resultprod = $productforinvoicerow->fetch(getDolGlobalString('SERVICE_BOOTH_LOCATION')); + $resultprod = $productforinvoicerow->fetch(getDolGlobalInt('SERVICE_BOOTH_LOCATION')); if ($resultprod < 0) { $error++; $errmsg .= $productforinvoicerow->error; @@ -516,7 +520,7 @@ if (empty($reshook) && $action == 'add') { // Test on permission not required he // Get email content from template $arraydefaultmessage = null; - $labeltouse = getDolGlobalString('EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_BOOTH'); + $labeltouse = getDolGlobalInt('EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_BOOTH'); if (!empty($labeltouse)) { $arraydefaultmessage = $formmail->getEMailTemplate($db, 'conferenceorbooth', $user, $outputlangs, $labeltouse, 1, ''); } @@ -699,7 +703,7 @@ print ''; if (!getDolGlobalString('SOCIETE_DISABLE_STATE')) { print ''.$langs->trans('State').''; if ($country_code) { - print $formcompany->select_state(GETPOST("state_id"), $country_code); + print $formcompany->select_state(GETPOSTINT("state_id"), $country_code); } else { print ''; } diff --git a/htdocs/public/project/suggestconference.php b/htdocs/public/project/suggestconference.php index ed927a0bd8d..26f4be49abd 100644 --- a/htdocs/public/project/suggestconference.php +++ b/htdocs/public/project/suggestconference.php @@ -126,6 +126,8 @@ if (empty($conf->eventorganization->enabled)) { /** * Show header for new member * + * Note: also called by functions.lib:recordNotFound + * * @param string $title Title * @param string $head Head array * @param int $disablejs More content into html header @@ -134,7 +136,7 @@ if (empty($conf->eventorganization->enabled)) { * @param string[]|string $arrayofcss Array of complementary css files * @return void */ -function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) +function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) // @phan-suppress-current-line PhanRedefineFunction { global $conf, $langs, $mysoc; @@ -182,9 +184,11 @@ function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $ /** * Show footer for new member * + * Note: also called by functions.lib:recordNotFound + * * @return void */ -function llxFooterVierge() +function llxFooterVierge() // @phan-suppress-current-line PhanRedefineFunction { print ''; @@ -330,7 +334,7 @@ if (empty($reshook) && $action == 'add') { // Test on permission not required he // Adding supplier tag and tag from setup to thirdparty $category = new Categorie($db); - $resultcategory = $category->fetch(getDolGlobalString('EVENTORGANIZATION_CATEG_THIRDPARTY_CONF')); + $resultcategory = $category->fetch(getDolGlobalInt('EVENTORGANIZATION_CATEG_THIRDPARTY_CONF')); if ($resultcategory <= 0) { $error++; @@ -446,7 +450,7 @@ if (empty($reshook) && $action == 'add') { // Test on permission not required he // Get email content from template $arraydefaultmessage = null; - $labeltouse = getDolGlobalString('EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_CONF'); + $labeltouse = getDolGlobalInt('EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_CONF'); if (!empty($labeltouse)) { $arraydefaultmessage = $formmail->getEMailTemplate($db, 'conferenceorbooth', $user, $outputlangs, $labeltouse, 1, ''); } @@ -635,7 +639,7 @@ print ''; if (!getDolGlobalString('SOCIETE_DISABLE_STATE')) { print ''.$langs->trans('State').''; if ($country_code) { - print $formcompany->select_state(GETPOST("state_id"), $country_code); + print $formcompany->select_state(GETPOSTINT("state_id"), $country_code); } else { print ''; } diff --git a/htdocs/public/project/viewandvote.php b/htdocs/public/project/viewandvote.php index 336c695d0bc..d36defc47b1 100644 --- a/htdocs/public/project/viewandvote.php +++ b/htdocs/public/project/viewandvote.php @@ -178,6 +178,7 @@ $idvote = GETPOSTINT("vote"); $hashedvote = dol_hash(getDolGlobalString('EVENTORGANIZATION_SECUREKEY').'vote'.$idvote); if ($idvote > 0) { + $votestatus = 'err'; if (in_array($hashedvote, $listofvotes)) { // Has already voted $votestatus = 'ko'; diff --git a/htdocs/public/recruitment/view.php b/htdocs/public/recruitment/view.php index 87127f7f906..33869758f48 100644 --- a/htdocs/public/recruitment/view.php +++ b/htdocs/public/recruitment/view.php @@ -1,7 +1,7 @@ * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 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 @@ -363,7 +363,7 @@ if (empty($emailforcontact)) { } } print ''; -print $tmpuser->getFullName(-1); +print $tmpuser->getFullName($langs); print '   '.dol_print_email($emailforcontact, 0, 0, 1, 0, 0, 'envelope'); print ''; print '
'; diff --git a/htdocs/public/stripe/ipn.php b/htdocs/public/stripe/ipn.php index e04053634d7..f47bfb3a322 100644 --- a/htdocs/public/stripe/ipn.php +++ b/htdocs/public/stripe/ipn.php @@ -2,7 +2,7 @@ /* Copyright (C) 2018-2020 Thibault FOUCART * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2023 Laurent Destailleur - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 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 @@ -96,7 +96,7 @@ if (empty($endpoint_secret)) { if (getDolGlobalString('STRIPE_USER_ACCOUNT_FOR_ACTIONS')) { // We set the user to use for all ipn actions in Dolibarr $user = new User($db); - $user->fetch(getDolGlobalString('STRIPE_USER_ACCOUNT_FOR_ACTIONS')); + $user->fetch(getDolGlobalInt('STRIPE_USER_ACCOUNT_FOR_ACTIONS')); $user->loadRights(); } else { httponly_accessforbidden('Error: Setup of module Stripe not complete for mode '.dol_escape_htmltag($service).'. The STRIPE_USER_ACCOUNT_FOR_ACTIONS is not defined.', 400, 1); @@ -252,13 +252,13 @@ if ($event->type == 'payout.created' && getDolGlobalString('STRIPE_AUTO_RECORD_P $db->begin(); if (!$error) { - $bank_line_id_from = $accountfrom->addline($dateo, $typefrom, $label, -1 * (float) price2num($amount), '', '', $user); + $bank_line_id_from = $accountfrom->addline($dateo, $typefrom, $label, -1 * (float) price2num($amount), '', 0, $user); } if (!($bank_line_id_from > 0)) { $error++; } if (!$error) { - $bank_line_id_to = $accountto->addline($dateo, $typeto, $label, price2num($amount), '', '', $user); + $bank_line_id_to = $accountto->addline($dateo, $typeto, $label, (float) price2num($amount), '', 0, $user); } if (!($bank_line_id_to > 0)) { $error++; @@ -367,12 +367,12 @@ if ($event->type == 'payout.created' && getDolGlobalString('STRIPE_AUTO_RECORD_P $obj = $db->fetch_object($result); if ($obj) { if ($obj->type == 'ban') { + $pdid = $obj->rowid; + $directdebitorcreditransfer_id = $obj->fk_prelevement_bons; if ($obj->traite == 1) { // This is a direct-debit with an order (llx_bon_prelevement) ALREADY generated, so // it means we received here the confirmation that payment request is finished. - $pdid = $obj->rowid; $invoice_id = $obj->fk_facture; - $directdebitorcreditransfer_id = $obj->fk_prelevement_bons; $payment_amountInDolibarr = $obj->amount; $paymentTypeCodeInDolibarr = $obj->type; @@ -382,9 +382,9 @@ if ($event->type == 'payout.created' && getDolGlobalString('STRIPE_AUTO_RECORD_P } } if ($obj->type == 'card' || empty($obj->type)) { + $pdid = $obj->rowid; if ($obj->traite == 0) { // This is a card payment not already flagged as sent to Stripe. - $pdid = $obj->rowid; $invoice_id = $obj->fk_facture; $payment_amountInDolibarr = $obj->amount; $paymentTypeCodeInDolibarr = empty($obj->type) ? 'card' : $obj->type; @@ -827,7 +827,7 @@ if ($event->type == 'payout.created' && getDolGlobalString('STRIPE_AUTO_RECORD_P $amountdisputestripe = $object->amoutndispute; // In stripe format $amountdispute = $amountdisputestripe; // In real currency format - $invoice_id = ""; + $invoice_id = 0; $paymentTypeCode = ""; // payment type according to Stripe $paymentTypeCodeInDolibarr = ""; // payment type according to Dolibarr $payment_amount = 0; @@ -861,7 +861,7 @@ if ($event->type == 'payout.created' && getDolGlobalString('STRIPE_AUTO_RECORD_P $payment_amountInDolibarr = $obj->amount; $paymentTypeCodeInDolibarr = empty($obj->type) ? 'card' : $obj->type; - dol_syslog("Found the payment intent for card in database (pdid = ".$pdid." directdebitorcreditransfer_id=".$directdebitorcreditransfer_id.")"); + dol_syslog("Found the payment intent for card in database (pdid = ".$pdid.")"); } } else { dol_syslog("Payment intent ".$TRANSACTIONID." not found into database, so ignored."); diff --git a/htdocs/public/test/test_arrays.php b/htdocs/public/test/test_arrays.php index 2a34c55d129..bbb87be938d 100644 --- a/htdocs/public/test/test_arrays.php +++ b/htdocs/public/test/test_arrays.php @@ -1,5 +1,6 @@ + * Copyright (C) 2025 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 @@ -201,7 +202,7 @@ $sortfield = 'aaa'; $sortorder = 'ASC'; $tasksarray = array(1, 2, 3); // To force having several lines $tagidfortablednd = 'tablelines3'; -if (!isset($moreforfilter)) { +if (!isset($moreforfilter)) { // @phan-suppress-current-line PhanPluginUndeclaredVariableIsset $moreforfilter = ''; } if (!empty($conf->use_javascript_ajax)) { @@ -228,7 +229,7 @@ if ($socid) { if (isset($showbirthday) && $showbirthday) { $nav .= ''; } -if (isset($pid) && $pid) { +if (isset($pid) && $pid) { // @phan-suppress-current-line PhanPluginUndeclaredVariableIsset $nav .= ''; } if ($type) { diff --git a/htdocs/public/ticket/create_ticket.php b/htdocs/public/ticket/create_ticket.php index dd72277cfb2..1f04dca7251 100644 --- a/htdocs/public/ticket/create_ticket.php +++ b/htdocs/public/ticket/create_ticket.php @@ -2,7 +2,7 @@ /* Copyright (C) 2013-2016 Jean-François FERRY * Copyright (C) 2016 Christophe Battarel * Copyright (C) 2023 Laurent Destailleur - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -153,12 +153,13 @@ if (empty($reshook)) { $upload_dir_tmp = $vardir.'/temp/'.session_id(); // TODO Delete only files that was uploaded from form - dol_remove_file_process(GETPOST('removedfile'), 0, 0); + dol_remove_file_process(GETPOSTINT('removedfile'), 0, 0); $action = 'create_ticket'; } if ($action == 'create_ticket' && GETPOST('save', 'alpha')) { // Test on permission not required. This is a public form. Security is managed by mitigation. $error = 0; + $cid = -1; $origin_email = GETPOST('email', 'email'); if (empty($origin_email)) { $error++; @@ -166,16 +167,18 @@ if (empty($reshook)) { $action = ''; } else { // Search company saved with email - $searched_companies = $object->searchSocidByEmail($origin_email, '0'); + $searched_companies = $object->searchSocidByEmail($origin_email, 0); // Chercher un contact existent avec cette address email // Le premier contact trouvé est utilisé pour déterminer le contact suivi $contacts = $object->searchContactByEmail($origin_email); + if (!is_array($contacts)) { + $contacts = array(); + } // Ensure that contact is active and select first active contact - $cid = -1; foreach ($contacts as $key => $contact) { - if ((int) $contact->statut == 1) { + if ((int) $contact->status == 1) { $cid = $key; break; } @@ -195,7 +198,7 @@ if (empty($reshook)) { $contact_phone = ''; if ($with_contact) { // set linked contact to add in form - if (is_array($contacts) && count($contacts) == 1) { + if (/* is_array($contacts) && */ count($contacts) == 1) { $with_contact = current($contacts); } @@ -309,7 +312,7 @@ if (empty($reshook)) { if ($result < 0) { $error++; $errors = ($company->error ? array($company->error) : $company->errors); - array_push($object->errors, $errors); + $object->errors = array_merge($object->errors, $errors); $action = 'create_ticket'; } @@ -324,7 +327,7 @@ if (empty($reshook)) { if ($result < 0) { $error++; $errors = ($with_contact->error ? array($with_contact->error) : $with_contact->errors); - array_push($object->errors, $errors); + $object->errors = array_merge($object->errors, $errors); $action = 'create_ticket'; } else { $contacts = array($with_contact); @@ -336,7 +339,7 @@ if (empty($reshook)) { $object->fk_soc = $searched_companies[0]->id; } - if (is_array($contacts) && count($contacts) > 0 && $cid >= 0) { + if (/* is_array($contacts) && */ count($contacts) > 0 && $cid >= 0) { $object->fk_soc = $contacts[$cid]->socid; $usertoassign = $contacts[$cid]->id; } @@ -363,7 +366,9 @@ if (empty($reshook)) { if ($id <= 0) { $error++; $errors = ($object->error ? array($object->error) : $object->errors); - array_push($object->errors, $object->error ? array($object->error) : $object->errors); + if ($object->error) { + array_push($object->errors, $object->error); + } $action = 'create_ticket'; } } @@ -421,8 +426,8 @@ if (empty($reshook)) { $sendtocc = ''; $deliveryreceipt = 0; - if (getDolGlobalString('TICKET_DISABLE_MAIL_AUTOCOPY_TO') !== '') { - $old_MAIN_MAIL_AUTOCOPY_TO = getDolGlobalString('TICKET_DISABLE_MAIL_AUTOCOPY_TO'); + $old_MAIN_MAIL_AUTOCOPY_TO = getDolGlobalString('TICKET_DISABLE_MAIL_AUTOCOPY_TO'); + if ($old_MAIN_MAIL_AUTOCOPY_TO !== '') { $conf->global->MAIN_MAIL_AUTOCOPY_TO = ''; } include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; @@ -432,7 +437,7 @@ if (empty($reshook)) { } else { $result = $mailfile->sendfile(); } - if (getDolGlobalString('TICKET_DISABLE_MAIL_AUTOCOPY_TO') !== '') { + if ($old_MAIN_MAIL_AUTOCOPY_TO !== '') { $conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO; } @@ -464,8 +469,8 @@ if (empty($reshook)) { $from = getDolGlobalString('MAIN_INFO_SOCIETE_NOM') . ' <' . getDolGlobalString('TICKET_NOTIFICATION_EMAIL_FROM').'>'; $replyto = $from; - if (getDolGlobalString('TICKET_DISABLE_MAIL_AUTOCOPY_TO') !== '') { - $old_MAIN_MAIL_AUTOCOPY_TO = getDolGlobalString('TICKET_DISABLE_MAIL_AUTOCOPY_TO'); + $old_MAIN_MAIL_AUTOCOPY_TO = getDolGlobalString('TICKET_DISABLE_MAIL_AUTOCOPY_TO'); + if ($old_MAIN_MAIL_AUTOCOPY_TO !== '') { $conf->global->MAIN_MAIL_AUTOCOPY_TO = ''; } include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; @@ -475,7 +480,7 @@ if (empty($reshook)) { } else { $result = $mailfile->sendfile(); } - if ((getDolGlobalString('TICKET_DISABLE_MAIL_AUTOCOPY_TO') !== '')) { + if ($old_MAIN_MAIL_AUTOCOPY_TO !== '') { $conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO; } } diff --git a/htdocs/public/ticket/list.php b/htdocs/public/ticket/list.php index d769ac209a0..a4a3b4697a9 100644 --- a/htdocs/public/ticket/list.php +++ b/htdocs/public/ticket/list.php @@ -1,8 +1,7 @@ +/* Copyright (C) 2013-2016 Jean-François FERRY + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France - */ -/* Copyright (C) 2013-2016 Jean-François FERRY * * 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 @@ -253,25 +252,25 @@ if ($action == "view_ticketlist") { // Definition of fields for list $arrayfields = array( - 't.datec' => array('label' => $langs->trans("Date"), 'checked' => 1), - 't.date_read' => array('label' => $langs->trans("TicketReadOn"), 'checked' => 0), - 't.date_close' => array('label' => $langs->trans("TicketCloseOn"), 'checked' => 0), - 't.ref' => array('label' => $langs->trans("Ref"), 'checked' => 1), - //'t.track_id' => array('label' => $langs->trans("IDTracking"), 'checked' => 0), - 't.fk_statut' => array('label' => $langs->trans("Status"), 'checked' => 1), - 't.subject' => array('label' => $langs->trans("Subject"), 'checked' => 1), - 'type.code' => array('label' => $langs->trans("Type"), 'checked' => 1), - 'category.code' => array('label' => $langs->trans("Category"), 'checked' => 1), - 'severity.code' => array('label' => $langs->trans("Severity"), 'checked' => 1), - 't.progress' => array('label' => $langs->trans("Progression"), 'checked' => 0), - //'t.fk_contract' => array('label' => $langs->trans("Contract"), 'checked' => 0), - 't.fk_user_create' => array('label' => $langs->trans("Author"), 'checked' => 1), - 't.fk_user_assign' => array('label' => $langs->trans("AssignedTo"), 'checked' => 0), + 't.datec' => array('label' => $langs->trans("Date"), 'checked' => '1'), + 't.date_read' => array('label' => $langs->trans("TicketReadOn"), 'checked' => '0'), + 't.date_close' => array('label' => $langs->trans("TicketCloseOn"), 'checked' => '0'), + 't.ref' => array('label' => $langs->trans("Ref"), 'checked' => '1'), + //'t.track_id' => array('label' => $langs->trans("IDTracking"), 'checked' => '0'), + 't.fk_statut' => array('label' => $langs->trans("Status"), 'checked' => '1'), + 't.subject' => array('label' => $langs->trans("Subject"), 'checked' => '1'), + 'type.code' => array('label' => $langs->trans("Type"), 'checked' => '1'), + 'category.code' => array('label' => $langs->trans("Category"), 'checked' => '1'), + 'severity.code' => array('label' => $langs->trans("Severity"), 'checked' => '1'), + 't.progress' => array('label' => $langs->trans("Progression"), 'checked' => '0'), + //'t.fk_contract' => array('label' => $langs->trans("Contract"), 'checked' => '0'), + 't.fk_user_create' => array('label' => $langs->trans("Author"), 'checked' => '1'), + 't.fk_user_assign' => array('label' => $langs->trans("AssignedTo"), 'checked' => '0'), - //'t.entity'=>array('label'=>$langs->trans("Entity"), 'checked'=>1, 'enabled'=>(isModEnabled('multicompany') && empty($conf->multicompany->transverse_mode))), - //'t.datec' => array('label' => $langs->trans("DateCreation"), 'checked' => 0, 'position' => 500), - //'t.tms' => array('label' => $langs->trans("DateModificationShort"), 'checked' => 0, 'position' => 2) - //'t.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), + //'t.entity'=>array('label'=>$langs->trans("Entity"), 'checked' => '1', 'enabled'=>(isModEnabled('multicompany') && empty($conf->multicompany->transverse_mode))), + //'t.datec' => array('label' => $langs->trans("DateCreation"), 'checked' => '0', 'position' => 500), + //'t.tms' => array('label' => $langs->trans("DateModificationShort"), 'checked' => '0', 'position' => 2) + //'t.statut'=>array('label'=>$langs->trans("Status"), 'checked' => '1', 'position'=>1000), ); if (!getDolGlobalString('TICKET_SHOW_PROGRESSION')) { @@ -284,7 +283,7 @@ if ($action == "view_ticketlist") { if ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate') { $enabled = abs((int) dol_eval($extrafields->attributes[$object->table_element]['list'][$key], 1, 1, '2')); $enabled = (($enabled == 0 || $enabled == 3) ? 0 : $enabled); - $arrayfields["ef.".$key] = array('label' => $extrafields->attributes[$object->table_element]['label'][$key], 'checked' => ($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1, 'position' => $extrafields->attributes[$object->table_element]['pos'][$key], 'enabled' => $enabled && $extrafields->attributes[$object->table_element]['perms'][$key]); + $arrayfields["ef.".$key] = array('label' => $extrafields->attributes[$object->table_element]['label'][$key], 'checked' => ($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? '0' : '1', 'position' => $extrafields->attributes[$object->table_element]['pos'][$key], 'enabled' => (string) (int) ($enabled && $extrafields->attributes[$object->table_element]['perms'][$key])); } } } diff --git a/htdocs/public/ticket/view.php b/htdocs/public/ticket/view.php index 41a51463b2d..63a4df51b62 100644 --- a/htdocs/public/ticket/view.php +++ b/htdocs/public/ticket/view.php @@ -2,6 +2,7 @@ /* Copyright (C) 2013-2016 Jean-François FERRY * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2023 Benjamin Falière + * Copyright (C) 2025 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 @@ -103,9 +104,9 @@ if ($cancel) { $action = 'view_ticket'; } +$display_ticket = false; if (in_array($action, array("view_ticket", "presend", "close", "confirm_public_close", "add_message", "add_contact"))) { // Test on permission not required here. Done later by using the $track_id + check email in session $error = 0; - $display_ticket = false; if (!strlen($track_id)) { $error++; array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("TicketTrackId"))); @@ -124,7 +125,7 @@ if (in_array($action, array("view_ticket", "presend", "close", "confirm_public_c } if (!$error) { - $ret = $object->fetch('', '', $track_id); + $ret = $object->fetch(0, '', $track_id); if ($ret && $object->dao->id > 0) { // Check if emails provided is the one of author $emailofticket = CMailFile::getValidAddress($object->dao->origin_email, 2); @@ -404,7 +405,7 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a $baseurl = getDolGlobalString('TICKET_URL_PUBLIC_INTERFACE', DOL_URL_ROOT.'/public/ticket/'); $formticket->param = array('track_id' => $object->dao->track_id, 'fk_user_create' => '-1', - 'returnurl' => $baseurl.'view.php'.(!empty($entity) && isModEnabled('multicompany')?'?entity='.$entity:'')); + 'returnurl' => $baseurl.'view.php'.(!empty($entity) && isModEnabled('multicompany') ? '?entity='.$entity : '')); $formticket->withfile = 2; $formticket->withcancel = 1; @@ -415,7 +416,7 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a if ($action != 'presend') { $baseurl = getDolGlobalString('TICKET_URL_PUBLIC_INTERFACE', DOL_URL_ROOT.'/public/ticket/'); - print '
'; + print ''; print ''; print ''; print ''; diff --git a/htdocs/public/webportal/webportal.main.inc.php b/htdocs/public/webportal/webportal.main.inc.php index 7e2373aa07e..f09d3e6cb5e 100644 --- a/htdocs/public/webportal/webportal.main.inc.php +++ b/htdocs/public/webportal/webportal.main.inc.php @@ -2,7 +2,7 @@ /* Copyright (C) 2023-2024 Laurent Destailleur * Copyright (C) 2023-2024 Lionel Vessiller * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 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,7 +57,7 @@ if (!function_exists('dol_getprefix')) { * @param string $mode '' (prefix for session name) or 'email' (prefix for email id) * @return string A calculated prefix */ - function dol_getprefix($mode = '') + function dol_getprefix($mode = '') // @phan-suppress-current-line PhanRedefineFunction { global $dolibarr_main_instance_unique_id, $dolibarr_main_cookie_cryptkey; // This is loaded by filefunc.inc.php @@ -225,7 +225,7 @@ if (!defined('WEBPORTAL_NOLOGIN') && !empty($context->controllerInstance->access $result = $logged_user->fetch($user_id); if ($result <= 0) { $error++; - $error_msg = $langs->transnoentitiesnoconv('WebPortalErrorFetchLoggedUser', $user_id); + $error_msg = $langs->transnoentitiesnoconv('WebPortalErrorFetchLoggedUser', (string) $user_id); dol_syslog($error_msg, LOG_ERR); $context->setEventMessages($error_msg, null, 'errors'); } @@ -237,7 +237,7 @@ if (!defined('WEBPORTAL_NOLOGIN') && !empty($context->controllerInstance->access if (!$logged_thirdparty || !($logged_thirdparty->id > 0)) { $result = $websiteaccount->fetch_thirdparty(); if ($result < 0) { - $error_msg = $langs->transnoentitiesnoconv('WebPortalErrorFetchLoggedThirdParty', $websiteaccount->fk_soc); + $error_msg = $langs->transnoentitiesnoconv('WebPortalErrorFetchLoggedThirdParty', (string) $websiteaccount->fk_soc); //dol_syslog("Can't load third-party (ID: ".$websiteaccount->fk_soc.") even if session logged.", LOG_ERR); dol_syslog($error_msg, LOG_ERR); $context->setEventMessage($error_msg, 'errors'); @@ -253,7 +253,7 @@ if (!defined('WEBPORTAL_NOLOGIN') && !empty($context->controllerInstance->access $result = $logged_member->fetch(0, '', $websiteaccount->thirdparty->id); if ($result < 0) { $error++; - $error_msg = $langs->transnoentitiesnoconv('WebPortalErrorFetchLoggedMember', $websiteaccount->thirdparty->id); + $error_msg = $langs->transnoentitiesnoconv('WebPortalErrorFetchLoggedMember', (string) $websiteaccount->thirdparty->id); dol_syslog($error_msg, LOG_ERR); $context->setEventMessage($error_msg, 'errors'); } @@ -265,7 +265,7 @@ if (!defined('WEBPORTAL_NOLOGIN') && !empty($context->controllerInstance->access $result = $logged_partnership->fetch(0, '', $logged_member->id, $websiteaccount->thirdparty->id); if ($result < 0) { $error++; - $error_msg = $langs->transnoentitiesnoconv('WebPortalErrorFetchLoggedPartnership', $websiteaccount->thirdparty->id, $logged_member->id); + $error_msg = $langs->transnoentitiesnoconv('WebPortalErrorFetchLoggedPartnership', (string) $websiteaccount->thirdparty->id, (string) $logged_member->id); dol_syslog($error_msg, LOG_ERR); $context->setEventMessage($error_msg, 'errors'); } diff --git a/htdocs/public/website/index.php b/htdocs/public/website/index.php index 8e2e029ce67..0b71ed384a4 100644 --- a/htdocs/public/website/index.php +++ b/htdocs/public/website/index.php @@ -1,6 +1,6 @@ - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -60,35 +60,39 @@ if (!defined('NOBROWSERNOTIF')) { /** * Header empty * + * Note: also called by functions.lib:recordNotFound + * * @param string $head Optional head lines * @param string $title HTML title * @param string $help_url Url links to help page * Syntax is: For a wiki page: EN:EnglishPage|FR:FrenchPage|ES:SpanishPage|DE:GermanPage * For other external page: http://server/url * @param string $target Target to use on links - * @param int $disablejs More content into html header - * @param int $disablehead More content into html header + * @param int<0,1> $disablejs More content into html header + * @param int<0,1> $disablehead More content into html header * @param string[]|string $arrayofjs Array of complementary js files * @param string[]|string $arrayofcss Array of complementary css files * @param string $morequerystring Query string to add to the link "print" to get same parameters (use only if autodetect fails) * @param string $morecssonbody More CSS on body tag. For example 'classforhorizontalscrolloftabs'. * @param string $replacemainareaby Replace call to main_area() by a print of this string - * @param int $disablenofollow Disable the "nofollow" on meta robot header - * @param int $disablenoindex Disable the "noindex" on meta robot header + * @param int<0,1> $disablenofollow Disable the "nofollow" on meta robot header + * @param int<0,1> $disablenoindex Disable the "noindex" on meta robot header * @return void */ -function llxHeader($head = '', $title = '', $help_url = '', $target = '', $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '', $morequerystring = '', $morecssonbody = '', $replacemainareaby = '', $disablenofollow = 0, $disablenoindex = 0) +function llxHeader($head = '', $title = '', $help_url = '', $target = '', $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '', $morequerystring = '', $morecssonbody = '', $replacemainareaby = '', $disablenofollow = 0, $disablenoindex = 0) // @phan-suppress-current-line PhanRedefineFunction { } /** * Footer empty * - * @param string $comment A text to add as HTML comment into HTML generated page - * @param string $zone 'private' (for private pages) or 'public' (for public pages) - * @param int $disabledoutputofmessages Clear all messages stored into session without displaying them + * Note: also called by functions.lib:recordNotFound + * + * @param string $comment A text to add as HTML comment into HTML generated page + * @param 'private'|'public' $zone 'private' (for private pages) or 'public' (for public pages) + * @param int<0,1> $disabledoutputofmessages Clear all messages stored into session without displaying them * @return void */ -function llxFooter($comment = '', $zone = 'private', $disabledoutputofmessages = 0) +function llxFooter($comment = '', $zone = 'private', $disabledoutputofmessages = 0) // @phan-suppress-current-line PhanRedefineFunction { } @@ -131,13 +135,13 @@ if (empty($pageid)) { if ($pageref) { // @phan-suppress-next-line PhanPluginSuspiciousParamPosition - $result = $objectpage->fetch(0, $object->id, $pageref); + $result = $objectpage->fetch(0, (string) $object->id, $pageref); if ($result > 0) { $pageid = $objectpage->id; } elseif ($result == 0) { // Page not found from ref=pageurl, we try using alternative alias // @phan-suppress-next-line PhanPluginSuspiciousParamPosition - $result = $objectpage->fetch(0, $object->id, null, $pageref); + $result = $objectpage->fetch(0, (string) $object->id, null, $pageref); if ($result > 0) { $pageid = $objectpage->id; } diff --git a/htdocs/public/website/javascript.js.php b/htdocs/public/website/javascript.js.php index 7cd0a22b073..77494b08a6c 100644 --- a/htdocs/public/website/javascript.js.php +++ b/htdocs/public/website/javascript.js.php @@ -1,6 +1,6 @@ - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -51,35 +51,39 @@ if (!defined('NOBROWSERNOTIF')) { /** * Header empty * + * Note: also called by functions.lib:recordNotFound + * * @param string $head Optional head lines * @param string $title HTML title * @param string $help_url Url links to help page * Syntax is: For a wiki page: EN:EnglishPage|FR:FrenchPage|ES:SpanishPage|DE:GermanPage * For other external page: http://server/url * @param string $target Target to use on links - * @param int $disablejs More content into html header - * @param int $disablehead More content into html header + * @param int<0,1> $disablejs More content into html header + * @param int<0,1> $disablehead More content into html header * @param string[]|string $arrayofjs Array of complementary js files * @param string[]|string $arrayofcss Array of complementary css files * @param string $morequerystring Query string to add to the link "print" to get same parameters (use only if autodetect fails) * @param string $morecssonbody More CSS on body tag. For example 'classforhorizontalscrolloftabs'. * @param string $replacemainareaby Replace call to main_area() by a print of this string - * @param int $disablenofollow Disable the "nofollow" on meta robot header - * @param int $disablenoindex Disable the "noindex" on meta robot header + * @param int<0,1> $disablenofollow Disable the "nofollow" on meta robot header + * @param int<0,1> $disablenoindex Disable the "noindex" on meta robot header * @return void */ -function llxHeader($head = '', $title = '', $help_url = '', $target = '', $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '', $morequerystring = '', $morecssonbody = '', $replacemainareaby = '', $disablenofollow = 0, $disablenoindex = 0) +function llxHeader($head = '', $title = '', $help_url = '', $target = '', $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '', $morequerystring = '', $morecssonbody = '', $replacemainareaby = '', $disablenofollow = 0, $disablenoindex = 0) // @phan-suppress-current-line PhanRedefineFunction { } /** * Footer empty * - * @param string $comment A text to add as HTML comment into HTML generated page - * @param string $zone 'private' (for private pages) or 'public' (for public pages) - * @param int $disabledoutputofmessages Clear all messages stored into session without displaying them + * Note: also called by functions.lib:recordNotFound + * + * @param string $comment A text to add as HTML comment into HTML generated page + * @param 'private'|'public' $zone 'private' (for private pages) or 'public' (for public pages) + * @param int<0,1> $disabledoutputofmessages Clear all messages stored into session without displaying them * @return void */ -function llxFooter($comment = '', $zone = 'private', $disabledoutputofmessages = 0) +function llxFooter($comment = '', $zone = 'private', $disabledoutputofmessages = 0) // @phan-suppress-current-line PhanRedefineFunction { } diff --git a/htdocs/public/website/styles.css.php b/htdocs/public/website/styles.css.php index f26ee0a2683..7d2d0c6d746 100644 --- a/htdocs/public/website/styles.css.php +++ b/htdocs/public/website/styles.css.php @@ -1,6 +1,6 @@ - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -51,35 +51,39 @@ if (!defined('NOBROWSERNOTIF')) { /** * Header empty * + * Note: also called by functions.lib:recordNotFound + * * @param string $head Optional head lines * @param string $title HTML title * @param string $help_url Url links to help page * Syntax is: For a wiki page: EN:EnglishPage|FR:FrenchPage|ES:SpanishPage|DE:GermanPage * For other external page: http://server/url * @param string $target Target to use on links - * @param int $disablejs More content into html header - * @param int $disablehead More content into html header + * @param int<0,1> $disablejs More content into html header + * @param int<0,1> $disablehead More content into html header * @param string[]|string $arrayofjs Array of complementary js files * @param string[]|string $arrayofcss Array of complementary css files * @param string $morequerystring Query string to add to the link "print" to get same parameters (use only if autodetect fails) * @param string $morecssonbody More CSS on body tag. For example 'classforhorizontalscrolloftabs'. * @param string $replacemainareaby Replace call to main_area() by a print of this string - * @param int $disablenofollow Disable the "nofollow" on meta robot header - * @param int $disablenoindex Disable the "noindex" on meta robot header + * @param int<0,1> $disablenofollow Disable the "nofollow" on meta robot header + * @param int<0,1> $disablenoindex Disable the "noindex" on meta robot header * @return void */ -function llxHeader($head = '', $title = '', $help_url = '', $target = '', $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '', $morequerystring = '', $morecssonbody = '', $replacemainareaby = '', $disablenofollow = 0, $disablenoindex = 0) +function llxHeader($head = '', $title = '', $help_url = '', $target = '', $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '', $morequerystring = '', $morecssonbody = '', $replacemainareaby = '', $disablenofollow = 0, $disablenoindex = 0) // @phan-suppress-current-line PhanRedefineFunction { } /** * Footer empty * - * @param string $comment A text to add as HTML comment into HTML generated page - * @param string $zone 'private' (for private pages) or 'public' (for public pages) - * @param int $disabledoutputofmessages Clear all messages stored into session without displaying them + * Note: also called by functions.lib:recordNotFound + * + * @param string $comment A text to add as HTML comment into HTML generated page + * @param 'private'|'public' $zone 'private' (for private pages) or 'public' (for public pages) + * @param int<0,1> $disabledoutputofmessages Clear all messages stored into session without displaying them * @return void */ -function llxFooter($comment = '', $zone = 'private', $disabledoutputofmessages = 0) +function llxFooter($comment = '', $zone = 'private', $disabledoutputofmessages = 0) // @phan-suppress-current-line PhanRedefineFunction { } From 45868680a7ad91ce1051cd1ff9fdd4d07d580a54 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 12 Feb 2025 11:24:02 +0100 Subject: [PATCH 32/32] Qual: Revert renaming of llxHeader/Footer(Vierge) because used in functions.lib:recordNotFound --- dev/tools/phan/baseline.txt | 5 ++-- htdocs/asterisk/wrapper.php | 10 +++++-- htdocs/document.php | 4 +++ htdocs/imports/emptyexample.php | 12 +++++--- htdocs/main.inc.php | 8 ++++-- htdocs/public/agenda/agendaexport.php | 28 +++++++++++-------- htdocs/public/bookcal/index.php | 6 ++-- htdocs/public/company/new.php | 16 +++++++---- htdocs/public/demo/index.php | 12 +++++--- htdocs/public/donations/donateurs_code.php | 16 +++++++---- htdocs/public/emailing/mailing-read.php | 8 ++++-- .../public/eventorganization/attendee_new.php | 12 +++++--- .../eventorganization/subscriptionok.php | 4 ++- htdocs/public/members/new.php | 16 +++++++---- htdocs/public/members/public_card.php | 12 +++++--- htdocs/public/members/public_list.php | 12 +++++--- htdocs/public/partnership/new.php | 16 +++++++---- htdocs/viewimage.php | 10 +++++-- 18 files changed, 136 insertions(+), 71 deletions(-) diff --git a/dev/tools/phan/baseline.txt b/dev/tools/phan/baseline.txt index ee7622c3050..f98253d5219 100644 --- a/dev/tools/phan/baseline.txt +++ b/dev/tools/phan/baseline.txt @@ -28,7 +28,6 @@ return [ // PhanTypeComparisonFromArray : 8 occurrences // PhanPluginDuplicateExpressionBinaryOp : 6 occurrences // PhanPluginUnknownObjectMethodCall : 6 occurrences - // PhanRedefineFunction : 6 occurrences // PhanTypeArraySuspiciousNull : 6 occurrences // PhanParamTooMany : 5 occurrences // PhanPluginDuplicateArrayKey : 4 occurrences @@ -38,6 +37,7 @@ return [ // PhanPluginBothLiteralsBinaryOp : 3 occurrences // PhanEmptyForeach : 2 occurrences // PhanPluginEmptyStatementIf : 2 occurrences + // PhanRedefineFunction : 2 occurrences // PhanTypeMismatchDimAssignment : 2 occurrences // PhanTypeSuspiciousStringExpression : 2 occurrences // PhanAccessMethodProtected : 1 occurrence @@ -142,7 +142,6 @@ return [ 'htdocs/asset/tpl/accountancy_codes_edit.tpl.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/asset/tpl/depreciation_options_edit.tpl.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/asset/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'], - 'htdocs/asterisk/wrapper.php' => ['PhanRedefineFunction'], 'htdocs/barcode/printsheet.php' => ['PhanPluginDuplicateExpressionBinaryOp', 'PhanTypeMismatchArgumentNullable'], 'htdocs/bom/bom_card.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable', 'PhanUndeclaredProperty'], 'htdocs/bom/bom_list.php' => ['PhanTypeMismatchArgument'], @@ -751,7 +750,7 @@ return [ 'htdocs/variants/list.php' => ['PhanTypeMismatchArgument'], 'htdocs/variants/tpl/productattributevalueline_edit.tpl.php' => ['PhanUndeclaredProperty'], 'htdocs/variants/tpl/productattributevalueline_view.tpl.php' => ['PhanUndeclaredProperty'], - 'htdocs/viewimage.php' => ['PhanRedefineFunction', 'PhanUndeclaredMethod'], + 'htdocs/viewimage.php' => ['PhanUndeclaredMethod'], 'htdocs/webhook/class/api_webhook.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], 'htdocs/webhook/class/target.class.php' => ['PhanUndeclaredMethod'], 'htdocs/webhook/target_card.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], diff --git a/htdocs/asterisk/wrapper.php b/htdocs/asterisk/wrapper.php index 952dec310b6..5fa452e781f 100644 --- a/htdocs/asterisk/wrapper.php +++ b/htdocs/asterisk/wrapper.php @@ -1,7 +1,7 @@ * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 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 @@ -51,6 +51,8 @@ if (!defined('NOREQUIREAJAX')) { /** * Empty header * + * Note: also called by functions.lib:recordNotFound + * * @param string $head Optional head lines * @param string $title HTML title * @param string $help_url Url links to help page @@ -68,7 +70,7 @@ if (!defined('NOREQUIREAJAX')) { * @param int $disablenoindex Disable the "noindex" on meta robot header * @return void */ -function llxHeader($head = '', $title = '', $help_url = '', $target = '', $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '', $morequerystring = '', $morecssonbody = '', $replacemainareaby = '', $disablenofollow = 0, $disablenoindex = 0) +function llxHeader($head = '', $title = '', $help_url = '', $target = '', $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '', $morequerystring = '', $morecssonbody = '', $replacemainareaby = '', $disablenofollow = 0, $disablenoindex = 0) // @phan-suppress-current-line PhanRedefineFunction { print ''."\n"; print ''."\n"; @@ -79,12 +81,14 @@ function llxHeader($head = '', $title = '', $help_url = '', $target = '', $disab /** * Empty footer * + * Note: also called by functions.lib:recordNotFound + * * @param string $comment A text to add as HTML comment into HTML generated page * @param string $zone 'private' (for private pages) or 'public' (for public pages) * @param int $disabledoutputofmessages Clear all messages stored into session without displaying them * @return void */ -function llxFooter($comment = '', $zone = 'private', $disabledoutputofmessages = 0) +function llxFooter($comment = '', $zone = 'private', $disabledoutputofmessages = 0) // @phan-suppress-current-line PhanRedefineFunction { print "\n".''."\n"; } diff --git a/htdocs/document.php b/htdocs/document.php index 7f8a17c3d0e..bab5a9b5b5e 100644 --- a/htdocs/document.php +++ b/htdocs/document.php @@ -79,6 +79,8 @@ if ((isset($_GET["modulepart"]) && $_GET["modulepart"] == 'medias')) { /** * Header empty * + * Note: also called by functions.lib:recordNotFound + * * @param string $head Optional head lines * @param string $title HTML title * @param string $help_url Url links to help page @@ -103,6 +105,8 @@ function llxHeader($head = '', $title = '', $help_url = '', $target = '', $disab /** * Footer empty * + * Note: also called by functions.lib:recordNotFound + * * @ignore * @param string $comment A text to add as HTML comment into HTML generated page * @param string $zone 'private' (for private pages) or 'public' (for public pages) diff --git a/htdocs/imports/emptyexample.php b/htdocs/imports/emptyexample.php index cd05fcfe1ac..6673681f83d 100644 --- a/htdocs/imports/emptyexample.php +++ b/htdocs/imports/emptyexample.php @@ -31,6 +31,8 @@ if (!defined('NOTOKENRENEWAL')) { /** * This file is a wrapper, so empty header * + * Note: also called by functions.lib:recordNotFound + * * @param string $head Optional head lines * @param string $title HTML title * @param string $help_url Url links to help page @@ -48,7 +50,7 @@ if (!defined('NOTOKENRENEWAL')) { * @param int $disablenoindex Disable the "noindex" on meta robot header * @return void */ -function llxHeaderEmptyExample($head = '', $title = '', $help_url = '', $target = '', $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '', $morequerystring = '', $morecssonbody = '', $replacemainareaby = '', $disablenofollow = 0, $disablenoindex = 0) +function llxHeader($head = '', $title = '', $help_url = '', $target = '', $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '', $morequerystring = '', $morecssonbody = '', $replacemainareaby = '', $disablenofollow = 0, $disablenoindex = 0) // @phan-suppress-current-line PhanRedefineFunction { print 'Build an import example file'; } @@ -56,12 +58,14 @@ function llxHeaderEmptyExample($head = '', $title = '', $help_url = '', $target /** * This file is a wrapper, so empty footer * + * Note: also called by functions.lib:recordNotFound + * * @param string $comment A text to add as HTML comment into HTML generated page * @param string $zone 'private' (for private pages) or 'public' (for public pages) * @param int $disabledoutputofmessages Clear all messages stored into session without displaying them * @return void */ -function llxFooterEmptyExample($comment = '', $zone = 'private', $disabledoutputofmessages = 0) +function llxFooter($comment = '', $zone = 'private', $disabledoutputofmessages = 0) // @phan-suppress-current-line PhanRedefineFunction { print ''; } @@ -90,9 +94,9 @@ $langs->load("exports"); if (empty($datatoimport)) { $user->loadRights(); - llxHeaderEmptyExample(); + llxHeader(); print '
Bad value for datatoimport.
'; - llxFooterEmptyExample(); + llxFooter(); exit; } diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 0b07dd0b80a..b08badda776 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1633,6 +1633,8 @@ if (!function_exists("llxHeader")) { /** * Show HTML header HTML + BODY + Top menu + left menu + DIV * + * Note: also called by functions.lib:recordNotFound + * * @param string $head Optional head lines * @param string $title HTML title * @param string $help_url Url links to help page @@ -1649,7 +1651,7 @@ if (!function_exists("llxHeader")) { * @param int $disablenofollow Disable the "nofollow" on meta robot header * @param int $disablenoindex Disable the "noindex" on meta robot header * @return void - * @phan-suppress PhanRedefineFunction (Also defined in htdocs/asterisk/wrapper) + * @phan-suppress PhanRedefineFunction */ function llxHeader($head = '', $title = '', $help_url = '', $target = '', $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '', $morequerystring = '', $morecssonbody = '', $replacemainareaby = '', $disablenofollow = 0, $disablenoindex = 0) { @@ -3876,11 +3878,13 @@ if (!function_exists("llxFooter")) { * Close div /DIV class=fiche + /DIV id-right + /DIV id-container + /BODY + /HTML. * If global var $delayedhtmlcontent was filled, we output it just before closing the body. * + * Note: also called by functions.lib:recordNotFound + * * @param string $comment A text to add as HTML comment into HTML generated page * @param string $zone 'private' (for private pages) or 'public' (for public pages) * @param int $disabledoutputofmessages Clear all messages stored into session without displaying them * @return void - * @phan-suppress PhanRedefineFunction // Also defined at asterisk/wrapper.php + * @phan-suppress PhanRedefineFunction */ function llxFooter($comment = '', $zone = 'private', $disabledoutputofmessages = 0) { diff --git a/htdocs/public/agenda/agendaexport.php b/htdocs/public/agenda/agendaexport.php index c3d75a02842..921d652d1a5 100644 --- a/htdocs/public/agenda/agendaexport.php +++ b/htdocs/public/agenda/agendaexport.php @@ -59,6 +59,8 @@ if (!defined('NOIPCHECK')) { /** * Header function * + * Note: also called by functions.lib:recordNotFound + * * @param string $title Title * @param string $head Head array * @param int $disablejs More content into html header @@ -67,16 +69,18 @@ if (!defined('NOIPCHECK')) { * @param string[]|string $arrayofcss Array of complementary css files * @return void */ -function llxHeaderAgendaExport($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) +function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) // @phan-suppress-current-line PhanRedefineFunction { print 'Export agenda cal'; } /** * Footer function * + * Note: also called by functions.lib:recordNotFound + * * @return void */ -function llxFooterAgendaExport() +function llxFooterVierge() // @phan-suppress-current-line PhanRedefineFunction { print ''; } @@ -180,9 +184,9 @@ if (!getDolGlobalString('MAIN_AGENDA_XCAL_EXPORTKEY')) { top_httphead(); - llxHeaderAgendaExport(""); + llxHeaderVierge(""); print '
Module Agenda was not configured properly.
'; - llxFooterAgendaExport(); + llxFooterVierge(); exit; } @@ -193,13 +197,13 @@ $reshook = $hookmanager->executeHooks('doActions', $filters); // Note that $acti if ($reshook < 0) { top_httphead(); - llxHeaderAgendaExport(""); + llxHeaderVierge(""); if (!empty($hookmanager->errors) && is_array($hookmanager->errors)) { print '
'.implode('
', $hookmanager->errors).'
'; } else { print '
'.$hookmanager->error.'
'; } - llxFooterAgendaExport(); + llxFooterVierge(); } elseif (empty($reshook)) { // Check exportkey if (!GETPOST("exportkey") || getDolGlobalString('MAIN_AGENDA_XCAL_EXPORTKEY') != GETPOST("exportkey")) { @@ -207,9 +211,9 @@ if ($reshook < 0) { top_httphead(); - llxHeaderAgendaExport(""); + llxHeaderVierge(""); print '
Bad value for key.
'; - llxFooterAgendaExport(); + llxFooterVierge(); exit; } } @@ -282,9 +286,9 @@ if ($shortfilename == 'dolibarrcalendar') { top_httphead(); - llxHeaderAgendaExport(""); + llxHeaderVierge(""); print '
'.$langs->trans("ErrorWrongValueForParameterX", 'format').'
'; - llxFooterAgendaExport(); + llxFooterVierge(); exit; } @@ -407,6 +411,6 @@ if ($format == 'rss') { top_httphead(); -llxHeaderAgendaExport(""); +llxHeaderVierge(""); print '
'.$agenda->error.'
'; -llxFooterAgendaExport(); +llxFooterVierge(); diff --git a/htdocs/public/bookcal/index.php b/htdocs/public/bookcal/index.php index 9f5b7fee892..41e25d9d24e 100644 --- a/htdocs/public/bookcal/index.php +++ b/htdocs/public/bookcal/index.php @@ -125,6 +125,8 @@ $errmsg = ''; /** * Show header for booking * + * Note: also called by functions.lib:recordNotFound + * * @param string $title Title * @param string $head Head array * @param int $disablejs More content into html header @@ -133,7 +135,7 @@ $errmsg = ''; * @param string[]|string $arrayofcss Array of complementary css files * @return void */ -function llxHeaderBookCal($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) +function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) // @phan-suppress-current-line PhanRedefineFunction { global $conf, $langs, $mysoc; @@ -304,7 +306,7 @@ if ($action == 'add') { // Test on permission not required here (anonymous actio $form = new Form($db); -llxHeaderBookCal('BookingCalendar'); +llxHeaderVierge('BookingCalendar'); print '

'.(!empty($object->label) ? $object->label : $object->ref).'

'; diff --git a/htdocs/public/company/new.php b/htdocs/public/company/new.php index f9928fcd274..e52cc805ecd 100644 --- a/htdocs/public/company/new.php +++ b/htdocs/public/company/new.php @@ -109,6 +109,8 @@ $extrafields->fetch_name_optionals_label($objectsoc->table_element); // fetch op /** * Show header for new prospect * + * Note: also called by functions.lib:recordNotFound + * * @param string $title Title * @param string $head Head array * @param int $disablejs More content into html header @@ -117,7 +119,7 @@ $extrafields->fetch_name_optionals_label($objectsoc->table_element); // fetch op * @param string[]|string $arrayofcss Array of complementary css files * @return void */ -function llxHeaderCompanyNew($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) +function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) // @phan-suppress-current-line PhanRedefineFunction { global $conf, $langs, $mysoc; @@ -164,9 +166,11 @@ function llxHeaderCompanyNew($title, $head = "", $disablejs = 0, $disablehead = /** * Show footer for new societe * + * Note: also called by functions.lib:recordNotFound + * * @return void */ -function llxFooterCompanyNew() +function llxFooterVierge() // @phan-suppress-current-line PhanRedefineFunction { global $conf, $langs; @@ -288,7 +292,7 @@ if (empty($reshook) && $action == 'add') { // Test on permission not required he // backtopage parameter with an url was set on prospect submit page, we never go here because a redirect was done to this url. if (empty($reshook) && $action == 'added') { // Test on permission not required here - llxHeaderCompanyNew("newSocieteAdded"); + llxHeaderVierge("newSocieteAdded"); // If we have not been redirected print '

'; @@ -296,7 +300,7 @@ if (empty($reshook) && $action == 'added') { // Test on permission not required print $langs->trans("newSocieteAdded"); print ''; - llxFooterCompanyNew(); + llxFooterVierge(); exit; } @@ -312,7 +316,7 @@ $adht = new AdherentType($db); $formadmin = new FormAdmin($db); -llxHeaderCompanyNew($langs->trans("ContactUs")); +llxHeaderVierge($langs->trans("ContactUs")); print '
'; print load_fiche_titre(img_picto('', 'member_nocolor', 'class="pictofixedwidth"') . '   ' . $langs->trans("ContactUs"), '', '', 0, '', 'center'); @@ -489,6 +493,6 @@ print ''; -llxFooterCompanyNew(); +llxFooterVierge(); $db->close(); diff --git a/htdocs/public/demo/index.php b/htdocs/public/demo/index.php index 700b5e19b24..386ed8cf212 100644 --- a/htdocs/public/demo/index.php +++ b/htdocs/public/demo/index.php @@ -283,7 +283,7 @@ jQuery(document).ready(function () { }); '; -llxHeaderDemoIndex($langs->trans("DolibarrDemo"), $head); +llxHeaderVierge($langs->trans("DolibarrDemo"), $head); print "\n"; @@ -468,7 +468,7 @@ if (isModEnabled('google') && getDolGlobalString('MAIN_GOOGLE_AD_CLIENT') && get } } -llxFooterDemoIndex(); +llxFooterVierge(); $db->close(); @@ -476,6 +476,8 @@ $db->close(); /** * Show header for demo * + * Note: also called by functions.lib:recordNotFound + * * @param string $title Title * @param string $head Head array * @param int $disablejs More content into html header @@ -484,7 +486,7 @@ $db->close(); * @param string[]|string $arrayofcss Array of complementary css files * @return void */ -function llxHeaderDemoIndex($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) +function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) // @phan-suppress-current-line PhanRedefineFunction { top_httphead(); @@ -496,9 +498,11 @@ function llxHeaderDemoIndex($title, $head = "", $disablejs = 0, $disablehead = 0 /** * Show footer for demo * + * Note: also called by functions.lib:recordNotFound + * * @return void */ -function llxFooterDemoIndex() +function llxFooterVierge() // @phan-suppress-current-line PhanRedefineFunction { printCommonFooter('public'); diff --git a/htdocs/public/donations/donateurs_code.php b/htdocs/public/donations/donateurs_code.php index 34a80c707e7..f9c5e526c62 100644 --- a/htdocs/public/donations/donateurs_code.php +++ b/htdocs/public/donations/donateurs_code.php @@ -35,6 +35,10 @@ if (!defined('NOIPCHECK')) { // C'est un wrapper, donc header vierge /** + * Header function + * + * Note: also called by functions.lib:recordNotFound + * * @param string $title Title * @param string $head Head array * @param int $disablejs More content into html header @@ -43,16 +47,18 @@ if (!defined('NOIPCHECK')) { * @param string[]|string $arrayofcss Array of complementary css files * @return void */ -function llxHeaderDonatorCodes($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) +function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) // @phan-suppress-current-line PhanRedefineFunction { print 'List of donators'; } /** - * Header function + * Footer function + * + * Note: also called by functions.lib:recordNotFound * * @return void */ -function llxFooterDonatorCodes() +function llxFooterVierge() // @phan-suppress-current-line PhanRedefineFunction { print ''; } @@ -74,7 +80,7 @@ $langs->load("donations"); * View */ -llxHeaderDonatorCodes(""); +llxHeaderVierge(""); $sql = "SELECT d.datedon as datedon, d.lastname, d.firstname, d.amount, d.public, d.societe"; $sql .= " FROM ".MAIN_DB_PREFIX."don as d"; @@ -116,4 +122,4 @@ if ($resql) { $db->close(); -llxFooterDonatorCodes(); +llxFooterVierge(); diff --git a/htdocs/public/emailing/mailing-read.php b/htdocs/public/emailing/mailing-read.php index 8530271fcba..20e4fde4f5a 100644 --- a/htdocs/public/emailing/mailing-read.php +++ b/htdocs/public/emailing/mailing-read.php @@ -55,6 +55,8 @@ if (!defined('NOSESSION')) { /** * Header empty * + * Note: also called by functions.lib:recordNotFound + * * @param string $head Optional head lines * @param string $title HTML title * @param string $help_url Url links to help page @@ -72,7 +74,7 @@ if (!defined('NOSESSION')) { * @param int $disablenoindex Disable the "noindex" on meta robot header * @return void */ -function llxHeaderReadMailing($head = '', $title = '', $help_url = '', $target = '', $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '', $morequerystring = '', $morecssonbody = '', $replacemainareaby = '', $disablenofollow = 0, $disablenoindex = 0) +function llxHeader($head = '', $title = '', $help_url = '', $target = '', $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '', $morequerystring = '', $morecssonbody = '', $replacemainareaby = '', $disablenofollow = 0, $disablenoindex = 0) // @phan-suppress-current-line PhanRedefineFunction { } @@ -80,12 +82,14 @@ function llxHeaderReadMailing($head = '', $title = '', $help_url = '', $target = /** * Footer empty * + * Note: also called by functions.lib:recordNotFound + * * @param string $comment A text to add as HTML comment into HTML generated page * @param string $zone 'private' (for private pages) or 'public' (for public pages) * @param int $disabledoutputofmessages Clear all messages stored into session without displaying them * @return void */ -function llxFooterReadMailing($comment = '', $zone = 'private', $disabledoutputofmessages = 0) +function llxFooter($comment = '', $zone = 'private', $disabledoutputofmessages = 0) // @phan-suppress-current-line PhanRedefineFunction { } diff --git a/htdocs/public/eventorganization/attendee_new.php b/htdocs/public/eventorganization/attendee_new.php index 5199143d38b..e477f039a7e 100644 --- a/htdocs/public/eventorganization/attendee_new.php +++ b/htdocs/public/eventorganization/attendee_new.php @@ -171,6 +171,8 @@ $extrafields->fetch_name_optionals_label($object->table_element); // fetch optio /** * Show header for new member * + * Note: also called by functions.lib:recordNotFound + * * @param string $title Title * @param string $head Head array * @param int $disablejs More content into html header @@ -179,7 +181,7 @@ $extrafields->fetch_name_optionals_label($object->table_element); // fetch optio * @param string[]|string $arrayofcss Array of complementary css files * @return void */ -function llxHeaderNewAttendee($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) +function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) // @phan-suppress-current-line PhanRedefineFunction { global $conf, $langs, $mysoc; @@ -226,9 +228,11 @@ function llxHeaderNewAttendee($title, $head = "", $disablejs = 0, $disablehead = /** * Show footer for new member * + * Note: also called by functions.lib:recordNotFound + * * @return void */ -function llxFooterNewAttendee() +function llxFooterVierge() // @phan-suppress-current-line PhanRedefineFunction { print ''; @@ -719,7 +723,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen $form = new Form($db); $formcompany = new FormCompany($db); -llxHeaderNewAttendee($langs->trans("NewRegistration")); +llxHeaderVierge($langs->trans("NewRegistration")); print '
'; @@ -964,6 +968,6 @@ if ((!empty($conference->id) && $conference->status == ConferenceOrBooth::STATUS print '
'; -llxFooterNewAttendee(); +llxFooterVierge(); $db->close(); diff --git a/htdocs/public/eventorganization/subscriptionok.php b/htdocs/public/eventorganization/subscriptionok.php index d0ac5f4020d..daebe11fe54 100644 --- a/htdocs/public/eventorganization/subscriptionok.php +++ b/htdocs/public/eventorganization/subscriptionok.php @@ -97,6 +97,8 @@ if (empty($conf->eventorganization->enabled)) { /** * Show header for new member * + * Note: also called by functions.lib:recordNotFound + * * @param string $title Title * @param string $head Head array * @param int $disablejs More content into html header @@ -105,7 +107,7 @@ if (empty($conf->eventorganization->enabled)) { * @param string[]|string $arrayofcss Array of complementary css files * @return void */ -function llxHeaderSubscriptionOk($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) +function llxHeaderSubscriptionOk($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) // @phan-suppress-current-line PhanRedefineFunction { global $user, $conf, $langs, $mysoc; diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 6b65f81e284..51c4191195d 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -113,6 +113,8 @@ $user->loadDefaultValues(); /** * Show header for new member * + * Note: also called by functions.lib:recordNotFound + * * @param string $title Title * @param string $head Head array * @param int $disablejs More content into html header @@ -121,7 +123,7 @@ $user->loadDefaultValues(); * @param string[]|string $arrayofcss Array of complementary css files * @return void */ -function llxHeaderMembersNew($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) +function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) // @phan-suppress-current-line PhanRedefineFunction { global $conf, $langs, $mysoc; @@ -168,9 +170,11 @@ function llxHeaderMembersNew($title, $head = "", $disablejs = 0, $disablehead = /** * Show footer for new member * + * Note: also called by functions.lib:recordNotFound + * * @return void */ -function llxFooterMembersNew() +function llxFooterVierge() // @phan-suppress-current-line PhanRedefineFunction { global $conf, $langs; @@ -500,7 +504,7 @@ if (empty($reshook) && $action == 'add') { // Test on permission not required he // backtopage parameter with an url was set on member submit page, we never go here because a redirect was done to this url. if (empty($reshook) && $action == 'added') { // Test on permission not required here - llxHeaderMembersNew($langs->trans("NewMemberForm")); + llxHeaderVierge($langs->trans("NewMemberForm")); // If we have not been redirected print '

'; @@ -508,7 +512,7 @@ if (empty($reshook) && $action == 'added') { // Test on permission not required print $langs->trans("NewMemberbyWeb"); print ''; - llxFooterMembersNew(); + llxFooterVierge(); exit; } @@ -524,7 +528,7 @@ $adht = new AdherentType($db); $extrafields->fetch_name_optionals_label($object->table_element); // fetch optionals attributes and labels -llxHeaderMembersNew($langs->trans("NewSubscription")); +llxHeaderVierge($langs->trans("NewSubscription")); print '
'; print load_fiche_titre(img_picto('', 'member_nocolor', 'class="pictofixedwidth"').'   '.$langs->trans("NewSubscription"), '', '', 0, '', 'center'); @@ -979,6 +983,6 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR } //htmlPrintOnlineFooter($mysoc, $langs); -llxFooterMembersNew(); +llxFooterVierge(); $db->close(); diff --git a/htdocs/public/members/public_card.php b/htdocs/public/members/public_card.php index cd76656de90..02a959dcd4b 100644 --- a/htdocs/public/members/public_card.php +++ b/htdocs/public/members/public_card.php @@ -91,7 +91,7 @@ if (getDolGlobalString('MEMBER_PUBLIC_CSS')) { $morehead = ''; } -llxHeaderMembersPubCard($langs->trans("MemberCard"), $morehead); +llxHeaderVierge($langs->trans("MemberCard"), $morehead); // fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); @@ -140,7 +140,7 @@ if ($id > 0) { } -llxFooterMembersPubCard(); +llxFooterVierge(); $db->close(); @@ -149,6 +149,8 @@ $db->close(); /** * Show header for card member * + * Note: also called by functions.lib:recordNotFound + * * @param string $title Title * @param string $head Head array * @param int $disablejs More content into html header @@ -157,7 +159,7 @@ $db->close(); * @param string[]|string $arrayofcss Array of complementary css files * @return void */ -function llxHeaderMembersPubCard($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) +function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) // @phan-suppress-current-line PhanRedefineFunction { top_htmlhead($head, $title); @@ -167,9 +169,11 @@ function llxHeaderMembersPubCard($title, $head = "", $disablejs = 0, $disablehea /** * Show footer for card member * + * Note: also called by functions.lib:recordNotFound + * * @return void */ -function llxFooterMembersPubCard() +function llxFooterVierge() // @phan-suppress-current-line PhanRedefineFunction { printCommonFooter('public'); diff --git a/htdocs/public/members/public_list.php b/htdocs/public/members/public_list.php index b655475d954..545be243193 100644 --- a/htdocs/public/members/public_list.php +++ b/htdocs/public/members/public_list.php @@ -66,6 +66,8 @@ $langs->loadLangs(array("main", "members", "companies", "other")); /** * Show header for member list * + * Note: also called by functions.lib:recordNotFound + * * @param string $title Title * @param string $head Head array * @param int $disablejs More content into html header @@ -74,7 +76,7 @@ $langs->loadLangs(array("main", "members", "companies", "other")); * @param string[]|string $arrayofcss Array of complementary css files * @return void */ -function llxHeaderMembersPubList($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) +function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) // @phan-suppress-current-line PhanRedefineFunction { top_htmlhead($head, $title); @@ -84,9 +86,11 @@ function llxHeaderMembersPubList($title, $head = "", $disablejs = 0, $disablehea /** * Show footer for member list * + * Note: also called by functions.lib:recordNotFound + * * @return void */ -function llxFooterMembersPubList() +function llxFooterVierge() // @phan-suppress-current-line PhanRedefineFunction { printCommonFooter('public'); @@ -134,7 +138,7 @@ if (getDolGlobalString('MEMBER_PUBLIC_CSS')) { $morehead = ''; } -llxHeaderMembersPubList($langs->trans("ListOfValidatedPublicMembers"), $morehead); +llxHeaderVierge($langs->trans("ListOfValidatedPublicMembers"), $morehead); $sql = "SELECT rowid, firstname, lastname, societe, zip, town, email, birth, photo"; @@ -216,6 +220,6 @@ if ($result) { } -llxFooterMembersPubList(); +llxFooterVierge(); $db->close(); diff --git a/htdocs/public/partnership/new.php b/htdocs/public/partnership/new.php index 3a7ad036925..b84fc790aa8 100644 --- a/htdocs/public/partnership/new.php +++ b/htdocs/public/partnership/new.php @@ -100,6 +100,8 @@ $user->loadDefaultValues(); /** * Show header for new partnership * + * Note: also called by functions.lib:recordNotFound + * * @param string $title Title * @param string $head Head array * @param int<0,1> $disablejs More content into html header @@ -108,7 +110,7 @@ $user->loadDefaultValues(); * @param string[] $arrayofcss Array of complementary css files * @return void */ -function llxHeaderPartnershipNew($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) +function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) // @phan-suppress-current-line PhanRedefineFunction { global $conf, $langs, $mysoc; @@ -155,9 +157,11 @@ function llxHeaderPartnershipNew($title, $head = "", $disablejs = 0, $disablehea /** * Show footer for new member * + * Note: also called by functions.lib:recordNotFound + * * @return void */ -function llxFooterPartnershipNew() +function llxFooterVierge() // @phan-suppress-current-line PhanRedefineFunction { global $conf, $langs; @@ -535,7 +539,7 @@ if (empty($reshook) && $action == 'add') { // Test on permission not required he // If PARTNERSHIP_URL_REDIRECT_SUBSCRIPTION is set to url we never go here because a redirect was done to this url. // backtopage parameter with an url was set on member submit page, we never go here because a redirect was done to this url. if (empty($reshook) && $action == 'added') { // Test on permission not required here - llxHeaderPartnershipNew($langs->trans("NewPartnershipForm")); + llxHeaderVierge($langs->trans("NewPartnershipForm")); // Si on a pas ete redirige print '

'; @@ -543,7 +547,7 @@ if (empty($reshook) && $action == 'added') { // Test on permission not required print $langs->trans("NewPartnershipbyWeb"); print ''; - llxFooterPartnershipNew(); + llxFooterVierge(); exit; } @@ -559,7 +563,7 @@ $formcompany = new FormCompany($db); $extrafields->fetch_name_optionals_label($object->table_element); // fetch optionals attributes and labels -llxHeaderPartnershipNew($langs->trans("NewPartnershipRequest")); +llxHeaderVierge($langs->trans("NewPartnershipRequest")); print '
'; print load_fiche_titre(img_picto('', 'hands-helping', 'class="pictofixedwidth"').'   '.$langs->trans("NewPartnershipRequest"), '', '', 0, '', 'center'); @@ -717,6 +721,6 @@ print "
"; print ''; -llxFooterPartnershipNew(); +llxFooterVierge(); $db->close(); diff --git a/htdocs/viewimage.php b/htdocs/viewimage.php index 1bbf7224a02..f2f38ee3c05 100644 --- a/htdocs/viewimage.php +++ b/htdocs/viewimage.php @@ -3,7 +3,7 @@ * Copyright (C) 2005-2016 Laurent Destailleur * Copyright (C) 2005-2016 Regis Houssin * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 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 @@ -114,6 +114,8 @@ if (is_numeric($entity)) { /** * Header empty * + * Note: also called by functions.lib:recordNotFound + * * @param string $head Optional head lines * @param string $title HTML title * @param string $help_url Url links to help page @@ -131,18 +133,20 @@ if (is_numeric($entity)) { * @param int $disablenoindex Disable the "noindex" on meta robot header * @return void */ -function llxHeader($head = '', $title = '', $help_url = '', $target = '', $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '', $morequerystring = '', $morecssonbody = '', $replacemainareaby = '', $disablenofollow = 0, $disablenoindex = 0) +function llxHeader($head = '', $title = '', $help_url = '', $target = '', $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '', $morequerystring = '', $morecssonbody = '', $replacemainareaby = '', $disablenofollow = 0, $disablenoindex = 0) // @phan-suppress-current-line PhanRedefineFunction { } /** * Footer empty * + * Note: also called by functions.lib:recordNotFound + * * @param string $comment A text to add as HTML comment into HTML generated page * @param string $zone 'private' (for private pages) or 'public' (for public pages) * @param int $disabledoutputofmessages Clear all messages stored into session without displaying them * @return void */ -function llxFooter($comment = '', $zone = 'private', $disabledoutputofmessages = 0) +function llxFooter($comment = '', $zone = 'private', $disabledoutputofmessages = 0) // @phan-suppress-current-line PhanRedefineFunction { }