From ef159f919eb8733cebf7a49bcc9a5490fd71dcef Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Wed, 19 Mar 2025 16:10:25 +0100 Subject: [PATCH 001/124] Backport fix in v20 #33536 --- htdocs/core/db/pgsql.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index e672cc833a3..e32e7efdd9b 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -718,7 +718,7 @@ class DoliDBPgsql extends DoliDB */ public function escape($stringtoencode) { - return pg_escape_string($stringtoencode); + return pg_escape_string($this->db, $stringtoencode); } /** From 363b05d314b5d61eceb29455adc864958543dbf4 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Wed, 2 Apr 2025 12:30:53 +0200 Subject: [PATCH 002/124] FIX: warehouse list: broken status filter (#33667) --- htdocs/product/stock/list.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php index 8c32ae17694..1a717b3d8af 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -246,17 +246,17 @@ if ($separatedPMP) { } $sql .= " WHERE t.entity IN (".getEntity('stock').")"; foreach ($search as $key => $val) { - if (array_key_exists($key, $object->fields)) { - $class_key = $key; - if ($class_key == 'status') { - $class_key = 'statut'; // remove this after refactoring entrepot.class property statut to status - } + $class_key = $key; + if ($class_key == 'status') { + $class_key = 'statut'; // remove this after refactoring entrepot.class property statut to status + } + if (array_key_exists($class_key, $object->fields)) { if (($key == 'status' && $search[$key] == -1) || $key == 'entity') { continue; } - $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0); - if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0) || !empty($object->fields[$key]['arrayofkeyval'])) { - if ($search[$key] == '-1' || ($search[$key] === '0' && (empty($object->fields[$key]['arrayofkeyval']) || !array_key_exists('0', $object->fields[$key]['arrayofkeyval'])))) { + $mode_search = (($object->isInt($object->fields[$class_key]) || $object->isFloat($object->fields[$class_key])) ? 1 : 0); + if ((strpos($object->fields[$class_key]['type'], 'integer:') === 0) || (strpos($object->fields[$class_key]['type'], 'sellist:') === 0) || !empty($object->fields[$class_key]['arrayofkeyval'])) { + if ($search[$key] == '-1' || ($search[$key] === '0' && (empty($object->fields[$class_key]['arrayofkeyval']) || !array_key_exists('0', $object->fields[$class_key]['arrayofkeyval'])))) { $search[$key] = ''; } $mode_search = 2; From 5494affea948a3cfd721f89218cffae96fea390c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 4 Apr 2025 15:29:41 +0200 Subject: [PATCH 003/124] Update card.php (#33725) --- htdocs/compta/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 8e85c0d0142..927045d36fb 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2912,7 +2912,7 @@ if (empty($reshook)) { setEventMessages($object->error, $object->errors, 'errors'); } } - } elseif ($action == 'updatealllines' && $usercancreate && GETPOST('all_percent') == $langs->trans('Modifier')) { // Update all lines of situation invoice + } elseif ($action == 'updatealllines' && $usercancreate && GETPOST('all_percent') == $langs->trans('Modify')) { // Update all lines of situation invoice if (!$object->fetch($id) > 0) { dol_print_error($db); } From a51e430e58c7340022a3445de8d224bb091b4dc2 Mon Sep 17 00:00:00 2001 From: atm-irvine <165771178+atm-irvine@users.noreply.github.com> Date: Fri, 4 Apr 2025 15:30:07 +0200 Subject: [PATCH 004/124] fix(evaluation): on list, removed getNomUrl for label column (#33711) --- htdocs/hrm/evaluation_list.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/hrm/evaluation_list.php b/htdocs/hrm/evaluation_list.php index 38ea2077848..07263c13e8a 100644 --- a/htdocs/hrm/evaluation_list.php +++ b/htdocs/hrm/evaluation_list.php @@ -704,8 +704,6 @@ while ($i < $imaxinloop) { print $object->getLibStatut(5); } elseif ($key == 'rowid') { print $object->showOutputField($val, $key, $object->id, ''); - } elseif ($key == 'label') { - print $object->getNomUrl(1); } else { print $object->showOutputField($val, $key, $object->$key, ''); } From 43716e856eb860f259a5a2e3463eda1cb685cba3 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Sat, 5 Apr 2025 19:09:40 +0200 Subject: [PATCH 005/124] Bad order of code --- htdocs/core/class/CMailFile.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index f9c20e48d1d..77c4a5e3beb 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -379,10 +379,12 @@ class CMailFile // Verify if $to, $addr_cc and addr_bcc have unwanted addresses if (getDolGlobalString('MAIN_MAIL_FORCE_NOT_SENDING_TO')) { + // Parse to, cc and bcc to remove MAIN_MAIL_FORCE_NOT_SENDING_TO + $listofemailstonotsendto = explode(',', getDolGlobalString('MAIN_MAIL_FORCE_NOT_SENDING_TO')); + //Verify for $to $replaceto = false; $tabto = explode(",", $to); - $listofemailstonotsendto = explode(',', getDolGlobalString('MAIN_MAIL_FORCE_NOT_SENDING_TO')); foreach ($tabto as $key => $addrto) { $addrto = array_keys($this->getArrayAddress($addrto)); if (in_array($addrto[0], $listofemailstonotsendto)) { From 75a33ef276ae1bdd11a6bb173f175fbb8fdcb683 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 7 Apr 2025 05:11:10 +0200 Subject: [PATCH 006/124] FIX Edition of target of menu entries --- htdocs/admin/menus/edit.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/htdocs/admin/menus/edit.php b/htdocs/admin/menus/edit.php index 386620055f4..13c4aa7d59f 100644 --- a/htdocs/admin/menus/edit.php +++ b/htdocs/admin/menus/edit.php @@ -398,10 +398,8 @@ if ($action == 'create') { // Target print ''.$langs->trans('Target').''; print ajax_combobox("target"); print ''.$langs->trans('DetailTarget').''; From 33f1a644d51d75e4c56c06f7296710b37feb68b0 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Mon, 7 Apr 2025 11:51:42 +0200 Subject: [PATCH 007/124] Fix CI --- htdocs/core/modules/accountancy/mod_bookkeeping_argon.php | 2 +- htdocs/core/modules/accountancy/mod_bookkeeping_helium.php | 2 +- htdocs/install/upgrade2.php | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/accountancy/mod_bookkeeping_argon.php b/htdocs/core/modules/accountancy/mod_bookkeeping_argon.php index 806ae698ef3..167c99d8549 100644 --- a/htdocs/core/modules/accountancy/mod_bookkeeping_argon.php +++ b/htdocs/core/modules/accountancy/mod_bookkeeping_argon.php @@ -125,7 +125,7 @@ class mod_bookkeeping_argon extends ModeleNumRefBookkeeping // Get entities //$entity = getEntity('invoicenumber', 1, $object); $entity = $conf->entity; // In accountancy, we never share entities - $numFinal = get_next_value($db, $mask, 'facture', 'ref', $where, null, (empty($object) ? dol_now() : $object->date), $mode, false, null, $entity, $object); + $numFinal = get_next_value($db, $mask, 'accounting_bookkeeping', 'ref', $where, null, (empty($object) ? dol_now() : $object->doc_date), $mode, false, null, (string) $entity, $object); if (!preg_match('/([0-9])+/', $numFinal)) { $this->error = $numFinal; } diff --git a/htdocs/core/modules/accountancy/mod_bookkeeping_helium.php b/htdocs/core/modules/accountancy/mod_bookkeeping_helium.php index 5612a2369dc..56832730b2d 100644 --- a/htdocs/core/modules/accountancy/mod_bookkeeping_helium.php +++ b/htdocs/core/modules/accountancy/mod_bookkeeping_helium.php @@ -142,7 +142,7 @@ class mod_bookkeeping_helium extends ModeleNumRefBookkeeping //$entity = getEntity('accountingbookkeeping', 1, $object); $entity = $conf->entity; // In accountancy, we can't share entities - $numFinal = get_next_value($db, $mask, 'accounting_bookkeeping', 'ref', '', '', $object->doc_date, 'next', false, null, $entity, $object); + $numFinal = get_next_value($db, $mask, 'accounting_bookkeeping', 'ref', '', '', $object->doc_date, 'next', false, null, (string) $entity, $object); return $numFinal; } diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index efced43e276..adb54eb4edd 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -5227,6 +5227,7 @@ function migrate_accountingbookkeeping(int $entity) $error = 0; $resultstring = ''; + $bookKeepingAddon = ''; // For the moment we set the numbering rule to neon (the rule argon has a lot of critical bugs to fix first). if (getDolGlobalString('BOOKKEEPING_ADDON') == '') { @@ -5241,7 +5242,7 @@ function migrate_accountingbookkeeping(int $entity) if ($bookKeepingAddon === 'mod_bookkeeping_argon') { $db->begin(); - $sql = "SELECT DISTINCT YEAR(doc_date) as doc_year, MONTH(doc_date) as doc_month, code_journal, piece_num FROM {$db->prefix()}accounting_bookkeeping"; + $sql = "SELECT DISTINCT YEAR(doc_date) as doc_year, MONTH(doc_date) as doc_month, code_journal, piece_num FROM ".$db->prefix()."accounting_bookkeeping"; $sql .= " WHERE ref IS NULL AND entity = ".((int) $entity); $sql .= " ORDER BY doc_year, doc_month, code_journal, piece_num"; From fee67ce8c77c15fa66563babaca16aeaa553ae85 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Mon, 7 Apr 2025 12:12:40 +0200 Subject: [PATCH 008/124] Fix CI --- htdocs/admin/menus/edit.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/menus/edit.php b/htdocs/admin/menus/edit.php index e9b69e1947f..360a4e96eb3 100644 --- a/htdocs/admin/menus/edit.php +++ b/htdocs/admin/menus/edit.php @@ -383,7 +383,7 @@ if ($action == 'create') { // Show URL into a frame if (getDolGlobalString("MAIN_SHOW_TOP_MENU_URL_IN_FRAME")) { print ''.$langs->trans('ShowTopMenuURLIntoAFrame').''; - print ''; + print ''; } // Picto @@ -514,7 +514,7 @@ if ($action == 'create') { // Show URL into a frame if (getDolGlobalString("MAIN_SHOW_TOP_MENU_URL_IN_FRAME")) { print ''.$langs->trans('ShowTopMenuURLIntoAFrame').''; - print ''; + print 'showtopmenuinframe ? ' checked="checked"' : '').'">'; } // Picto From 30da60c955c6415ab7bbf18f5697359a9d45869b Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Mon, 7 Apr 2025 12:23:17 +0200 Subject: [PATCH 009/124] Fix CI --- htdocs/core/lib/functions2.lib.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 24864cfc0f8..362c54baa3b 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1154,7 +1154,7 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $ // Define $yearcomp and $monthcomp (that will be use in the select where to search max number) $monthcomp = $maskraz; - $yearcomp = 0; + $yearcomp = ''; if (!empty($yearoffsettype) && !is_numeric($yearoffsettype) && $yearoffsettype != '=') { // $yearoffsettype is - or + $currentyear = (int) date("Y", $date); @@ -1183,7 +1183,7 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $ } elseif ($yearlen == 2) { $yearcomp = sprintf("%02d", idate("y", $date) + $yearoffset); } elseif ($yearlen == 1) { - $yearcomp = (int) substr(date('y', $date), 1, 1) + $yearoffset; + $yearcomp = (string) ((int) substr(date('y', $date), 1, 1) + $yearoffset); } if ($monthcomp > 1 && empty($resetEveryMonth)) { // Test with month is useless if monthcomp = 1 (0 is same as 1) if ($yearlen == 4) { @@ -1227,7 +1227,7 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $ $maskLike = str_replace("%", "_", $maskLike); // Replace protected special codes with matching number of _ as wild card character - if ($resetEveryMonth) { // Perf optimization, when a reset is requested at each month, we can include the year and month inside the filter + if ($resetEveryMonth ) { // Perf optimization, when a reset is requested at each month, we can include the year and month inside the filter $maskLike = preg_replace('/\{yyyy\}/i', $yearcomp, $maskLike); $maskLike = preg_replace('/\{yy\}/i', $yearcomp, $maskLike); $maskLike = preg_replace('/\{y\}/i', $yearcomp, $maskLike); From 7df240c25b294065fa9a5ff72b5d4b0fcac295e9 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Mon, 7 Apr 2025 12:28:05 +0200 Subject: [PATCH 010/124] Fix CI --- htdocs/admin/menus/edit.php | 9 ++++----- htdocs/compta/facture/card-rec.php | 1 + 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/admin/menus/edit.php b/htdocs/admin/menus/edit.php index 360a4e96eb3..81bcaf26a9a 100644 --- a/htdocs/admin/menus/edit.php +++ b/htdocs/admin/menus/edit.php @@ -59,7 +59,8 @@ foreach ($dirmenus as $dirmenu) { $action = GETPOST('action', 'aZ09'); -$menu = null; +$menu = new Menubase($db); + $menu_handler_top = getDolGlobalString('MAIN_MENU_STANDARD'); $menu_handler_smartphone = getDolGlobalString('MAIN_MENU_SMARTPHONE'); $menu_handler_top = preg_replace('/_backoffice.php/i', '', $menu_handler_top); @@ -137,7 +138,6 @@ if ($action == 'add') { } if (!$error) { - $menu = new Menubase($db); $menu->menu_handler = preg_replace('/_menu$/', '', GETPOST('menu_handler', 'aZ09')); $menu->type = (string) GETPOST('type', 'alphanohtml'); $menu->title = (string) GETPOST('titre', 'alphanohtml'); @@ -197,7 +197,6 @@ if ($action == 'update') { } if (!$error) { - $menu = new Menubase($db); $result = $menu->fetch(GETPOSTINT('menuId')); if ($result > 0) { $menu->title = (string) GETPOST('titre', 'alphanohtml'); @@ -404,8 +403,8 @@ if ($action == 'create') { // Target print ''.$langs->trans('Target').''; print ajax_combobox("target"); print ''.$langs->trans('DetailTarget').''; diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php index 3062d8fe31e..a030a92bd99 100644 --- a/htdocs/compta/facture/card-rec.php +++ b/htdocs/compta/facture/card-rec.php @@ -71,6 +71,7 @@ $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); // if not set, $ $id = (GETPOSTINT('facid') ? GETPOSTINT('facid') : GETPOSTINT('id')); $lineid = GETPOSTINT('lineid'); $ref = GETPOST('ref', 'alpha'); +$socid = 0; if ($user->socid) { $socid = $user->socid; } From 7e1ef5ee45b9fb49a084f504e090ae1b9b669a2b Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Mon, 7 Apr 2025 12:41:13 +0200 Subject: [PATCH 011/124] Fix warning --- htdocs/core/lib/functions2.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 362c54baa3b..19ff4b52e60 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1227,12 +1227,12 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $ $maskLike = str_replace("%", "_", $maskLike); // Replace protected special codes with matching number of _ as wild card character - if ($resetEveryMonth ) { // Perf optimization, when a reset is requested at each month, we can include the year and month inside the filter + if ($resetEveryMonth && $yearcomp && $monthcomp) { // Perf optimization, when a reset is requested at each month, we can include the year and month inside the filter $maskLike = preg_replace('/\{yyyy\}/i', $yearcomp, $maskLike); $maskLike = preg_replace('/\{yy\}/i', $yearcomp, $maskLike); $maskLike = preg_replace('/\{y\}/i', $yearcomp, $maskLike); $maskLike = preg_replace('/\{mm\}/i', sprintf("%02d", $monthcomp), $maskLike); - } elseif ($maskraz == 1) { // Perf optimization, when a reset is requested at first month, we can include the year inside the filter, but not the month + } elseif ($maskraz == 1 && $yearcomp) { // Perf optimization, when a reset is requested at first month, we can include the year inside the filter, but not the month $maskLike = preg_replace('/\{yyyy\}/i', $yearcomp, $maskLike); $maskLike = preg_replace('/\{yy\}/i', $yearcomp, $maskLike); $maskLike = preg_replace('/\{y\}/i', $yearcomp, $maskLike); From 8ad1bf580f84f7234df87941d208341ec3a807e3 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Mon, 7 Apr 2025 12:48:17 +0200 Subject: [PATCH 012/124] CSS --- htdocs/theme/eldy/global.inc.php | 2 +- htdocs/theme/md/style.css.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index ab9c9545026..49f0b55f9d6 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -3423,7 +3423,7 @@ if (getDolGlobalString('MAIN_LOGIN_BACKGROUND')) { } .login_table #tdpasswordlogin #togglepassword { position: absolute; - top: 1em; + top: 0.7em; right: 5px; background: none; border: none; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 56d4fc83513..4c1e97d46b3 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -3489,7 +3489,7 @@ form#login { } .login_table #tdpasswordlogin #togglepassword { position: absolute; - top: 1em; + top: 0.7em; right: 5px; background: none; border: none; From d77898ff3dba5e7f968e7a097ded4b0d7c7cc343 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Mon, 7 Apr 2025 12:53:19 +0200 Subject: [PATCH 013/124] FIX #33742 --- htdocs/core/class/html.formticket.class.php | 3 ++- htdocs/core/lib/ticket.lib.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 5ba1465f7b4..7bda0d4aa11 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -307,6 +307,7 @@ class FormTicket } print '
param["returnurl"] : $_SERVER['PHP_SELF']).'">'; + print ''; print ''; if (!empty($object->id)) { @@ -837,7 +838,7 @@ class FormTicket print dol_get_fiche_end(); } - print '
'; + print '

'; if ($mode == 'create') { print $form->buttonsSaveCancel(((isset($this->withreadid) && $this->withreadid > 0) ? "SendResponse" : "CreateTicket"), ($this->withcancel ? "Cancel" : "")); diff --git a/htdocs/core/lib/ticket.lib.php b/htdocs/core/lib/ticket.lib.php index 2ed7811961e..ca0a33cb117 100644 --- a/htdocs/core/lib/ticket.lib.php +++ b/htdocs/core/lib/ticket.lib.php @@ -234,7 +234,7 @@ function llxHeaderTicket($title, $head = "", $disablejs = 0, $disablehead = 0, $ top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss, 0, 1); // Show html headers print ''; - print '
'; + print '
'; print '
'; From 2f4f82b0133e7e0feae3e6b9341e9c6fc9ef6f74 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Mon, 7 Apr 2025 13:10:32 +0200 Subject: [PATCH 014/124] Fix CI --- htdocs/core/lib/functions2.lib.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 19ff4b52e60..7423f8d0a56 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1102,6 +1102,9 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $ } //print "maskraz=".$maskraz; // -1=no reset + $monthcomp = 0; + $yearcomp = ''; + if ($maskraz > 0) { // A reset is required if ($maskraz == 99) { $maskraz = (int) date('m', $date); From 9ac7be87a24cabe99b8dea44418648632c348230 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Mon, 7 Apr 2025 13:14:18 +0200 Subject: [PATCH 015/124] Fix CI --- htdocs/waf.inc.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/waf.inc.php b/htdocs/waf.inc.php index 1af4e6ebd29..2d8bd3bd437 100644 --- a/htdocs/waf.inc.php +++ b/htdocs/waf.inc.php @@ -235,7 +235,7 @@ function testSqlAndScriptInject($val, $type) * Return true if security check on parameters are OK, false otherwise. * * @param string|array $var Variable name - * @param int<0,2> $type 1=GET, 0=POST, 2=PHP_SELF + * @param int<0,3> $type 0=POST, 1=GET, 2=PHP_SELF, 3=GET without sql reserved keywords (the less tolerant test) * @param int<0,1> $stopcode 0=No stop code, 1=Stop code (default) if injection found * @return boolean True if there is no injection. */ @@ -248,8 +248,8 @@ function analyseVarsForSqlAndScriptsInjection(&$var, $type, $stopcode = 1) continue; } - // Test on both the key (we force type to the less tolerant = 3) and the value - if (analyseVarsForSqlAndScriptsInjection($key, 3, $stopcode) && analyseVarsForSqlAndScriptsInjection($value, $type, $stopcode)) { + // Test on both the key (we force type to 1 for test on key, we must accept key like "delete=1" blocked with type 3) and the value + if (analyseVarsForSqlAndScriptsInjection($key, 1, $stopcode) && analyseVarsForSqlAndScriptsInjection($value, $type, $stopcode)) { //$var[$key] = $value; // This is useless } else { http_response_code(403); From 782f28cac6da39fed24395b1111e211cba0ea460 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Mon, 7 Apr 2025 13:30:25 +0200 Subject: [PATCH 016/124] Clean code --- .../class/fournisseur.facture-rec.class.php | 7 ++-- htdocs/fourn/facture/card-rec.php | 35 ++++++++++--------- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.facture-rec.class.php b/htdocs/fourn/class/fournisseur.facture-rec.class.php index 5f84d1dfd1d..b333db53cb2 100644 --- a/htdocs/fourn/class/fournisseur.facture-rec.class.php +++ b/htdocs/fourn/class/fournisseur.facture-rec.class.php @@ -75,18 +75,17 @@ class FactureFournisseurRec extends CommonInvoice protected $table_ref_field = 'titre'; /** - * @var string The label of recurring invoice + * @var string The ref of the recurring invoice * @deprecated Use $title */ public $titre; /** - * @var string The label of recurring invoice + * @var string The ref of the recurring invoice */ public $title; /** * @var string - * @deprecated */ public $ref_supplier; /** @@ -351,7 +350,9 @@ class FactureFournisseurRec extends CommonInvoice $this->title = empty($this->title) ? '' : $this->title; $keyforref = $this->table_ref_field; $this->ref = $this->$keyforref; + $this->ref_supplier = empty($this->ref_supplier) ? '' : $this->ref_supplier; + $this->usenewprice = empty($this->usenewprice) ? 0 : $this->usenewprice; $this->suspended = empty($this->suspended) ? 0 : $this->suspended; // No frequency defined then no next date to execution diff --git a/htdocs/fourn/facture/card-rec.php b/htdocs/fourn/facture/card-rec.php index 61f87d1a5bb..c1f94a820f3 100644 --- a/htdocs/fourn/facture/card-rec.php +++ b/htdocs/fourn/facture/card-rec.php @@ -71,9 +71,9 @@ $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); // if not set, $ $id = (GETPOSTINT('facid') ? GETPOSTINT('facid') : GETPOSTINT('id')); $lineid = GETPOSTINT('lineid'); -$title = GETPOST('title', 'alpha'); -$libelle = GETPOST('libelle', 'alpha'); -$ref_supplier = GETPOST('ref_supplier', 'alpha'); +$ref = GETPOST('title', 'alphanohtml') ? GETPOST('title', 'alphanohtml') : GETPOST('ref', 'alphanohtml'); +$label = GETPOST('label', 'alphanohtml'); +$ref_supplier = GETPOST('ref_supplier', 'alphanohtml'); $projectid = GETPOSTINT('projectid'); $year_date_when = GETPOST('year_date_when'); $month_date_when = GETPOST('month_date_when'); @@ -218,8 +218,8 @@ if (empty($reshook)) { if (! $error) { $object->subtype = GETPOSTINT('subtype'); $object->title = GETPOST('title', 'alphanohtml'); - $object->libelle = GETPOST('libelle', 'alpha'); // deprecated - $object->label = GETPOST('libelle', 'alpha'); + $object->ref = GETPOST('title', 'alphanohtml'); + $object->label = GETPOST('label', 'alpha'); $object->ref_supplier = GETPOST('ref_supplier', 'alphanohtml'); $object->note_private = GETPOST('note_private', 'restricthtml'); @@ -280,7 +280,6 @@ if (empty($reshook)) { } // Delete - //TODO : Droits if ($action == 'confirm_deleteinvoice' && $confirm == 'yes' && $permissiontodelete) { $object->delete($user); @@ -311,21 +310,23 @@ if (empty($reshook)) { } } } elseif ($action == 'settitle' && $permissiontoadd) { - $result = $object->setValueFrom('titre', $title, '', null, 'text', '', $user); + $result = $object->setValueFrom('titre', $ref, '', null, 'text', '', $user); if ($result > 0) { - $object->titre = $title; // deprecated - $object->title = $title; - $object->ref = $object->title; + $object->title = $ref; + $object->ref = $ref; } else { $error++; if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); - setEventMessages($langs->trans('ErrorTitreAlreadyExists', $title), null, 'errors'); + setEventMessages($langs->trans('ErrorTitreAlreadyExists', $ref), null, 'errors'); } else { setEventMessages($object->error, $object->errors, 'errors'); } } + } elseif ($action == 'setlabel' && $permissiontoadd) { + // Set bank account + $result = $object->setValueFrom('libelle', $label, '', null, 'text', '', $user); } elseif ($action == 'setbankaccount' && $permissiontoadd) { // Set bank account $result = $object->setBankAccount(GETPOSTINT('fk_account')); @@ -392,11 +393,11 @@ if (empty($reshook)) { } elseif ($action == 'setmulticurrencyrate' && $permissiontoadd) { // Multicurrency rate $result = $object->setMulticurrencyRate((float) price2num(GETPOST('multicurrency_tx')), GETPOSTINT('calculation_mode')); - } elseif ($action == 'setlibelle' && $permissiontoadd) { + } elseif ($action == 'setlabel' && $permissiontoadd) { // Set label $object->fetch($id); - $object->label = GETPOST('libelle'); - $object->libelle = $object->label; + $object->label = GETPOST('label'); + $object->label = $object->label; $result = $object->update($user); if ($result < 0) { @@ -998,7 +999,7 @@ if ($action == 'create') { // Label print '' . $langs->trans("Label") . ''; - print ''; + print ''; print ''; // Author @@ -1256,8 +1257,8 @@ if ($action == 'create') { // Label print ''; - print '' . $form->editfieldkey("Label", 'libelle', $object->libelle, $object, (int) $usercancreate) . ''; - print '' . $form->editfieldval("Label", 'libelle', $object->libelle, $object, $usercancreate) . ''; + print '' . $form->editfieldkey("Label", 'label', $object->label, $object, (int) $usercancreate) . ''; + print '' . $form->editfieldval("Label", 'label', $object->label, $object, $usercancreate) . ''; print ''; // Payment term From 53b2e257fc7cdc90de5a67c8eedc0973d815fdd4 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Mon, 7 Apr 2025 13:59:36 +0200 Subject: [PATCH 017/124] Remove one choice --- htdocs/ai/lib/ai.lib.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/ai/lib/ai.lib.php b/htdocs/ai/lib/ai.lib.php index dc6804b7820..c22f9225de2 100644 --- a/htdocs/ai/lib/ai.lib.php +++ b/htdocs/ai/lib/ai.lib.php @@ -76,10 +76,8 @@ function getListOfAIServices() */ function getListForAISummarize() { - global $langs; - $arrayforaisummarize = array( - '20_w' => 'SummarizeTwentyWords', + //'20_w' => 'SummarizeTwentyWords', '50_w' => 'SummarizeFiftyWords', '100_w' => 'SummarizeHundredWords', '200_w' => 'SummarizeTwoHundredWords', From 534aec349c49defe7247dbbcc31c8203cfa84329 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Mon, 7 Apr 2025 14:01:39 +0200 Subject: [PATCH 018/124] Fix CI --- htdocs/fourn/facture/card-rec.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/facture/card-rec.php b/htdocs/fourn/facture/card-rec.php index c1f94a820f3..04e7a427052 100644 --- a/htdocs/fourn/facture/card-rec.php +++ b/htdocs/fourn/facture/card-rec.php @@ -105,8 +105,8 @@ $pageprev = $page - 1; $pagenext = $page + 1; $object = new FactureFournisseurRec($db); -if (($id > 0 || $title) && $action != 'create' && $action != 'add') { - $ret = $object->fetch($id, $title); +if (($id > 0 || $ref) && $action != 'create' && $action != 'add') { + $ret = $object->fetch($id, $ref); if (! $ret) { setEventMessages($langs->trans("ErrorRecordNotFound"), null, 'errors'); } From a8d3fd8db2dee3efaef6c3ebd5d58ac21c7bfea4 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Mon, 7 Apr 2025 14:05:02 +0200 Subject: [PATCH 019/124] Fix CI --- htdocs/fourn/facture/card-rec.php | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/htdocs/fourn/facture/card-rec.php b/htdocs/fourn/facture/card-rec.php index 04e7a427052..b85de2b3891 100644 --- a/htdocs/fourn/facture/card-rec.php +++ b/htdocs/fourn/facture/card-rec.php @@ -324,9 +324,6 @@ if (empty($reshook)) { setEventMessages($object->error, $object->errors, 'errors'); } } - } elseif ($action == 'setlabel' && $permissiontoadd) { - // Set bank account - $result = $object->setValueFrom('libelle', $label, '', null, 'text', '', $user); } elseif ($action == 'setbankaccount' && $permissiontoadd) { // Set bank account $result = $object->setBankAccount(GETPOSTINT('fk_account')); @@ -394,15 +391,8 @@ if (empty($reshook)) { // Multicurrency rate $result = $object->setMulticurrencyRate((float) price2num(GETPOST('multicurrency_tx')), GETPOSTINT('calculation_mode')); } elseif ($action == 'setlabel' && $permissiontoadd) { - // Set label - $object->fetch($id); - $object->label = GETPOST('label'); - $object->label = $object->label; - $result = $object->update($user); - - if ($result < 0) { - dol_print_error($db); - } + // Set bank account + $result = $object->setValueFrom('libelle', $label, '', null, 'text', '', $user); } // Delete line From 61982bf42bbb646a29288bca0932452776b4daba Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Mon, 7 Apr 2025 14:11:37 +0200 Subject: [PATCH 020/124] Fix CI --- htdocs/core/modules/accountancy/mod_bookkeeping_argon.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/accountancy/mod_bookkeeping_argon.php b/htdocs/core/modules/accountancy/mod_bookkeeping_argon.php index 167c99d8549..07d30a90afc 100644 --- a/htdocs/core/modules/accountancy/mod_bookkeeping_argon.php +++ b/htdocs/core/modules/accountancy/mod_bookkeeping_argon.php @@ -125,7 +125,7 @@ class mod_bookkeeping_argon extends ModeleNumRefBookkeeping // Get entities //$entity = getEntity('invoicenumber', 1, $object); $entity = $conf->entity; // In accountancy, we never share entities - $numFinal = get_next_value($db, $mask, 'accounting_bookkeeping', 'ref', $where, null, (empty($object) ? dol_now() : $object->doc_date), $mode, false, null, (string) $entity, $object); + $numFinal = get_next_value($db, $mask, 'accounting_bookkeeping', 'ref', $where, null, $object->doc_date, $mode, false, null, (string) $entity, $object); if (!preg_match('/([0-9])+/', $numFinal)) { $this->error = $numFinal; } From 8f348cbd6b221fa98d38267ce0bcec19b4c20ff2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 7 Apr 2025 14:11:53 +0200 Subject: [PATCH 021/124] fix CI (#33744) --- htdocs/admin/payment.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/admin/payment.php b/htdocs/admin/payment.php index cb63f3ef55e..25cf0be1287 100644 --- a/htdocs/admin/payment.php +++ b/htdocs/admin/payment.php @@ -170,6 +170,7 @@ foreach ($dirmodels as $reldir) { require_once $dir.$filebis; $module = new $classname($db); + /** @var ModeleNumRefPayments $module */ '@phan-var-force ModeleNumRefPayments $module'; $arrayofmodules[] = $module; From 36aa025f3ed77656b71b1f29b29ef81508189dea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 7 Apr 2025 14:55:17 +0200 Subject: [PATCH 022/124] fix CI (#33743) Co-authored-by: Laurent Destailleur --- htdocs/admin/invoice.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/admin/invoice.php b/htdocs/admin/invoice.php index 0de34fac5df..995959c6a66 100644 --- a/htdocs/admin/invoice.php +++ b/htdocs/admin/invoice.php @@ -126,6 +126,7 @@ if ($action == 'updateMask') { require_once $file; $module = new $classname($db); + /** @var ModelePDFFactures $module */ '@phan-var-force ModelePDFFactures $module'; if ($module->write_file($facture, $langs) > 0) { @@ -344,6 +345,7 @@ foreach ($dirmodels as $reldir) { require_once $dir.$filebis; $module = new $classname($db); + /** @var ModeleNumRefFactures $module */ '@phan-var-force ModeleNumRefFactures $module'; $arrayofmodules[] = $module; From fa5c98824fbfdfcc3b08445a54b839528bef0676 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Mon, 7 Apr 2025 15:10:51 +0200 Subject: [PATCH 023/124] Fix related to #33449 --- htdocs/comm/propal/card.php | 2 +- htdocs/comm/propal/class/propal.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index d8e7decab23..2a8cdaef2a1 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1485,7 +1485,7 @@ if (empty($reshook)) { if (!$error) { // Insert line - $result = $object->addline($desc, $pu_ht, (float) $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $pu_ttc, $info_bits, $type, min($rank, count($object->lines) + 1), 0, GETPOSTINT('fk_parent_line'), (int) $fournprice, (int) $buyingprice, $label, $date_start, $date_end, $array_options, $fk_unit, '', 0, $pu_ht_devise); + $result = $object->addline($desc, $pu_ht, (float) $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $pu_ttc, $info_bits, $type, min($rank, count($object->lines) + 1), 0, GETPOSTINT('fk_parent_line'), (int) $fournprice, (float) $buyingprice, $label, $date_start, $date_end, $array_options, $fk_unit, '', 0, $pu_ht_devise); if ($result > 0) { $db->commit(); diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 7f3e30d1b31..d0fdd446324 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -618,7 +618,7 @@ class Propal extends CommonObject * @param int $special_code Special code (also used by externals modules!) * @param int $fk_parent_line Id of parent line * @param int $fk_fournprice Id supplier price - * @param int $pa_ht Buying price without tax + * @param float $pa_ht Buying price without tax * @param string $label ??? * @param int|string $date_start Start date of the line * @param int|string $date_end End date of the line From 6af829873657de48c6f44535c69b830db5607f9c Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Mon, 7 Apr 2025 15:46:10 +0200 Subject: [PATCH 024/124] Fix related to #33449 --- htdocs/comm/propal/card.php | 12 ++++----- htdocs/comm/propal/class/propal.class.php | 10 +++---- htdocs/commande/card.php | 8 +++--- htdocs/commande/class/commande.class.php | 4 +-- htdocs/compta/bank/class/account.class.php | 26 +++++++++---------- htdocs/compta/facture/card-rec.php | 6 ++--- htdocs/compta/facture/card.php | 6 ++--- .../facture/class/facture-rec.class.php | 6 ++--- htdocs/compta/facture/class/facture.class.php | 6 ++--- htdocs/contrat/class/contrat.class.php | 4 +-- .../fourn/class/fournisseur.facture.class.php | 2 +- htdocs/fourn/facture/card-rec.php | 2 +- htdocs/reception/class/reception.class.php | 18 ++++++------- htdocs/supplier_proposal/card.php | 10 +++---- .../class/supplier_proposal.class.php | 6 ++--- 15 files changed, 63 insertions(+), 63 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 2a8cdaef2a1..188bba430bf 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1436,8 +1436,8 @@ if (empty($reshook)) { $localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty, $mysoc, $tva_npr); // Margin - $fournprice = price2num(GETPOST('fournprice'.$predef) ? GETPOST('fournprice'.$predef) : ''); - $buyingprice = price2num(GETPOST('buying_price'.$predef) != '' ? GETPOST('buying_price'.$predef) : ''); // If buying_price is '0', we must keep this value + $fournprice = (int) (GETPOST('fournprice'.$predef) ? GETPOST('fournprice'.$predef) : ''); // This can be id of supplier price, or 'pmpprice' or 'costprice', or 'inputprice', we force to keep ID only + $buyingprice = price2num((GETPOST('buying_price'.$predef) != '' ? GETPOST('buying_price'.$predef) : ''), '', 2); // If buying_price is '0', we must keep this value $date_start = dol_mktime(GETPOSTINT('date_start'.$predef.'hour'), GETPOSTINT('date_start'.$predef.'min'), GETPOSTINT('date_start'.$predef.'sec'), GETPOSTINT('date_start'.$predef.'month'), GETPOSTINT('date_start'.$predef.'day'), GETPOSTINT('date_start'.$predef.'year')); $date_end = dol_mktime(GETPOSTINT('date_end'.$predef.'hour'), GETPOSTINT('date_end'.$predef.'min'), GETPOSTINT('date_end'.$predef.'sec'), GETPOSTINT('date_end'.$predef.'month'), GETPOSTINT('date_end'.$predef.'day'), GETPOSTINT('date_end'.$predef.'year')); @@ -1485,7 +1485,7 @@ if (empty($reshook)) { if (!$error) { // Insert line - $result = $object->addline($desc, $pu_ht, (float) $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $pu_ttc, $info_bits, $type, min($rank, count($object->lines) + 1), 0, GETPOSTINT('fk_parent_line'), (int) $fournprice, (float) $buyingprice, $label, $date_start, $date_end, $array_options, $fk_unit, '', 0, $pu_ht_devise); + $result = $object->addline($desc, $pu_ht, (float) $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $pu_ttc, $info_bits, $type, min($rank, count($object->lines) + 1), 0, GETPOSTINT('fk_parent_line'), (int) $fournprice, $buyingprice, $label, $date_start, $date_end, $array_options, $fk_unit, '', 0, $pu_ht_devise); if ($result > 0) { $db->commit(); @@ -1621,8 +1621,8 @@ if (empty($reshook)) { $pu_ttc = price2num(GETPOST('price_ttc'), '', 2); // Add buying price - $fournprice = price2num(GETPOST('fournprice') ? GETPOST('fournprice') : ''); - $buyingprice = price2num(GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we must keep this value + $fournprice = (int) (GETPOST('fournprice') ? GETPOST('fournprice') : ''); // This can be id of supplier price, or 'pmpprice' or 'costprice', or 'inputprice', we force to keep ID only + $buyingprice = price2num((GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''), '', 2); // If buying_price is '0', we must keep this value $pu_ht_devise = price2num(GETPOST('multicurrency_subprice'), '', 2); $pu_ttc_devise = price2num(GETPOST('multicurrency_subprice_ttc'), '', 2); @@ -1746,7 +1746,7 @@ if (empty($reshook)) { $price_base_type = 'TTC'; } - $result = $object->updateline(GETPOSTINT('lineid'), (float) $pu, (float) $qty, $remise_percent, $vat_rate, $localtax1_rate, $localtax2_rate, $description, $price_base_type, $info_bits, $special_code, GETPOSTINT('fk_parent_line'), 0, (int) $fournprice, (int) $buyingprice, $label, $type, $date_start, $date_end, $array_options, GETPOSTINT("units"), (float) $pu_ht_devise); + $result = $object->updateline(GETPOSTINT('lineid'), (float) $pu, (float) $qty, $remise_percent, $vat_rate, $localtax1_rate, $localtax2_rate, $description, $price_base_type, $info_bits, $special_code, GETPOSTINT('fk_parent_line'), 0, (int) $fournprice, $buyingprice, $label, $type, $date_start, $date_end, $array_options, GETPOSTINT("units"), (float) $pu_ht_devise); if ($result >= 0) { $db->commit(); diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index d0fdd446324..c4b41528d98 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -618,7 +618,7 @@ class Propal extends CommonObject * @param int $special_code Special code (also used by externals modules!) * @param int $fk_parent_line Id of parent line * @param int $fk_fournprice Id supplier price - * @param float $pa_ht Buying price without tax + * @param float[string $pa_ht Buying price without tax ('' to keep PMP unchanged or a float) * @param string $label ??? * @param int|string $date_start Start date of the line * @param int|string $date_end End date of the line @@ -668,7 +668,7 @@ class Propal extends CommonObject } $txlocaltax1 = price2num($txlocaltax1); $txlocaltax2 = price2num($txlocaltax2); - $pa_ht = price2num($pa_ht); // do not convert to float here, it breaks the functioning of $pa_ht_isemptystring + $pa_ht = price2num($pa_ht); // do not convert to float here, it breaks the functioning of $pa_ht is empty string if ($price_base_type == 'HT') { $pu = $pu_ht; } else { @@ -886,7 +886,7 @@ class Propal extends CommonObject * @param int $fk_parent_line Id of parent line (0 in most cases, used by modules adding sublevels into lines). * @param int $skip_update_total Keep fields total_xxx to 0 (used for special lines by some modules) * @param int $fk_fournprice Id of origin supplier price - * @param float $pa_ht Price (without tax) of product when it was bought + * @param float|string $pa_ht Price (without tax) of product when it was bought (Can be '' to keep AWP unchanged or a float value) * @param string $label ??? * @param int $type 0/1=Product/service * @param int|string $date_start Start date of the line @@ -894,8 +894,8 @@ class Propal extends CommonObject * @param array $array_options extrafields array * @param int|null $fk_unit Code of the unit to use. Null to use the default one * @param float $pu_ht_devise Unit price in currency - * @param int $notrigger disable line update trigger - * @param int $rang line rank + * @param int $notrigger Disable line update trigger + * @param int $rang Line rank * @return int 0 if OK, <0 if KO */ public function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $desc = '', $price_base_type = 'HT', $info_bits = 0, $special_code = 0, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = 0, $pa_ht = 0, $label = '', $type = 0, $date_start = '', $date_end = '', $array_options = array(), $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0, $rang = 0) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 0d12f65a90e..03daf9a2e9b 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1192,7 +1192,7 @@ if (empty($reshook)) { $localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty); // Margin - $fournprice = price2num(GETPOST('fournprice'.$predef) ? GETPOSTINT('fournprice'.$predef) : 0); + $fournprice = (int) (GETPOST('fournprice'.$predef) ? GETPOSTINT('fournprice'.$predef) : 0); // This can be id of supplier price, or 'pmpprice' or 'costprice', or 'inputprice', we force to keep ID only $buyingprice = price2num(GETPOST('buying_price'.$predef) != '' ? GETPOST('buying_price'.$predef) : ''); // If buying_price is '0', we must keep this value // Prepare a price equivalent for minimum price check @@ -1238,7 +1238,7 @@ if (empty($reshook)) { if (!$error) { // Insert line - $result = $object->addline($desc, $pu_ht, (float) $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $info_bits, 0, $price_base_type, $pu_ttc, $date_start, $date_end, $type, min($rank, count($object->lines) + 1), 0, GETPOSTINT('fk_parent_line'), $fournprice, (float) $buyingprice, $label, $array_options, $fk_unit, '', 0, (float) $pu_ht_devise); + $result = $object->addline($desc, $pu_ht, (float) $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $info_bits, 0, $price_base_type, $pu_ttc, $date_start, $date_end, $type, min($rank, count($object->lines) + 1), 0, GETPOSTINT('fk_parent_line'), (int) $fournprice, $buyingprice, $label, $array_options, $fk_unit, '', 0, (float) $pu_ht_devise); if ($result > 0) { $ret = $object->fetch($object->id); // Reload to get new records @@ -1352,7 +1352,7 @@ if (empty($reshook)) { */ // Add buying price - $fournprice = price2num(GETPOST('fournprice') ? GETPOST('fournprice') : ''); + $fournprice = (int) (GETPOST('fournprice') ? GETPOST('fournprice') : ''); // This can be id of supplier price, or 'pmpprice' or 'costprice', or 'inputprice', we force to keep ID only $buyingprice = price2num(GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we must keep this value // Extrafields Lines @@ -1451,7 +1451,7 @@ if (empty($reshook)) { $price_base_type = 'TTC'; } - $result = $object->updateline(GETPOSTINT('lineid'), $description, (float) $pu, (float) $qty, $remise_percent, (float) $vat_rate, $localtax1_rate, $localtax2_rate, $price_base_type, $info_bits, $date_start, $date_end, $type, GETPOSTINT('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $special_code, $array_options, GETPOSTINT('units'), (float) $pu_ht_devise); + $result = $object->updateline(GETPOSTINT('lineid'), $description, (float) $pu, (float) $qty, $remise_percent, (float) $vat_rate, $localtax1_rate, $localtax2_rate, $price_base_type, $info_bits, $date_start, $date_end, $type, GETPOSTINT('fk_parent_line'), 0, (int) $fournprice, $buyingprice, $label, $special_code, $array_options, GETPOSTINT('units'), (float) $pu_ht_devise); if ($result >= 0) { if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) { diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index dac286a0158..bb324da3ff4 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1541,7 +1541,7 @@ class Commande extends CommonOrder * @param int $special_code Special code (also used by externals modules!) * @param int $fk_parent_line Parent line * @param int $fk_fournprice Id supplier price - * @param float $pa_ht Buying price (without tax) + * @param float|string $pa_ht Buying price without tax (Can be '' to keep AWP unchanged or a float value) * @param string $label Label * @param array $array_options Extrafields array. Example array('options_codeforfield1'=>'valueforfield1', 'options_codeforfield2'=>'valueforfield2', ...) * @param ?int $fk_unit Code of the unit to use. Null to use the default one @@ -3064,7 +3064,7 @@ class Commande extends CommonOrder * @param int $fk_parent_line Id of parent line (0 in most cases, used by modules adding sublevels into lines). * @param int $skip_update_total Keep fields total_xxx to 0 (used for special lines by some modules) * @param int $fk_fournprice Id of origin supplier price - * @param float $pa_ht Price (without tax) of product when it was bought + * @param float|string $pa_ht Price (without tax) of product when it was bought (Can be '' to keep AWP unchanged or a float value) * @param string $label Label * @param int $special_code Special code (also used by externals modules!) * @param array $array_options extrafields array diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 017b527f105..e32b4f833fb 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -587,20 +587,20 @@ class Account extends CommonObject /** * Add an entry into table ".MAIN_DB_PREFIX."bank * - * @param int $date Date operation - * @param string $oper 'VIR','PRE','LIQ','VAD','CB','CHQ'... - * @param string $label Description - * @param float $amount Amount - * @param string $num_chq Numero cheque or transfer - * @param int $categorie Category id (optional) - * @param User $user User that create - * @param string $emetteur Name of cheque writer - * @param string $banque Bank of cheque writer - * @param string $accountancycode When we record a free bank entry, we must provide accounting account if accountancy module is on. - * @param int $datev Date value - * @param string $num_releve Label of bank receipt for reconciliation + * @param int $date Date operation + * @param string $oper 'VIR','PRE','LIQ','VAD','CB','CHQ'... + * @param string $label Description + * @param float $amount Amount + * @param string $num_chq Numero cheque or transfer + * @param int $categorie Category id (optional) + * @param User $user User that create + * @param string $emetteur Name of cheque writer + * @param string $banque Bank of cheque writer + * @param string $accountancycode When we record a free bank entry, we must provide accounting account if accountancy module is on. + * @param int $datev Date value + * @param string $num_releve Label of bank receipt for reconciliation * @param float $amount_main_currency Amount - * @return int Rowid of added entry, <0 if KO + * @return int Rowid of added entry, <0 if KO */ public function addline($date, $oper, $label, $amount, $num_chq, $categorie, User $user, $emetteur = '', $banque = '', $accountancycode = '', $datev = null, $num_releve = '', $amount_main_currency = null) { diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php index a030a92bd99..c55e9f69359 100644 --- a/htdocs/compta/facture/card-rec.php +++ b/htdocs/compta/facture/card-rec.php @@ -715,7 +715,7 @@ if (empty($reshook)) { $date_end_fill = GETPOSTINT('date_end_fill'); // Margin - $fournprice = price2num(GETPOST('fournprice'.$predef) ? GETPOST('fournprice'.$predef) : ''); + $fournprice = (in)(GETPOST('fournprice'.$predef) ? GETPOST('fournprice'.$predef) : ''); // This can be id of supplier price, or 'pmpprice' or 'costprice', or 'inputprice', we force to keep ID only $buyingprice = price2num(GETPOST('buying_price'.$predef) != '' ? GETPOST('buying_price'.$predef) : ''); // If buying_price is '0', we must keep this value // Local Taxes @@ -734,7 +734,7 @@ if (empty($reshook)) { setEventMessages($mesg, null, 'errors'); } else { // Insert line - $result = $object->addline($desc, $pu_ht, (float) $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $info_bits, 0, $pu_ttc, $type, -1, $special_code, $label, (int) $fk_unit, 0, $date_start_fill, $date_end_fill, (int) $fournprice, (int) $buyingprice, $fk_parent_line); + $result = $object->addline($desc, $pu_ht, (float) $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $info_bits, 0, $pu_ttc, $type, -1, $special_code, $label, (int) $fk_unit, 0, $date_start_fill, $date_end_fill, (int) $fournprice, $buyingprice, $fk_parent_line); if ($result > 0) { // Define output language and generate document @@ -833,7 +833,7 @@ if (empty($reshook)) { $localtax2_rate = get_localtax($vat_rate, 2, $object->thirdparty); // Add buying price - $fournprice = price2num(GETPOST('fournprice') ? GETPOST('fournprice') : ''); + $fournprice = (int) (GETPOST('fournprice') ? GETPOST('fournprice') : ''); $buyingprice = price2num(GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we must keep this value // Extrafields diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index f3347952d47..ca9a0d086bd 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2508,7 +2508,7 @@ if (empty($reshook)) { */ // Margin - $fournprice = price2num(GETPOST('fournprice'.$predef) ? GETPOST('fournprice'.$predef) : ''); + $fournprice = (int) (GETPOST('fournprice'.$predef) ? GETPOST('fournprice'.$predef) : ''); // This can be id of supplier price, or 'pmpprice' or 'costprice', or 'inputprice', we force to keep ID only $buyingprice = price2num(GETPOST('buying_price'.$predef) != '' ? GETPOST('buying_price'.$predef) : ''); // If buying_price is '0', we must keep this value @@ -2707,7 +2707,7 @@ if (empty($reshook)) { $localtax2_rate = get_localtax($vat_rate, 2, $object->thirdparty); // Add buying price - $fournprice = price2num(GETPOST('fournprice') ? GETPOST('fournprice') : ''); + $fournprice = (int) (GETPOST('fournprice') ? GETPOST('fournprice') : ''); // This can be id of supplier price, or 'pmpprice' or 'costprice', or 'inputprice', we force to keep ID only $buyingprice = price2num(GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we must keep this value // Prepare a price equivalent for minimum price check @@ -2898,7 +2898,7 @@ if (empty($reshook)) { $type, GETPOSTINT('fk_parent_line'), 0, - $fournprice, + (int) $fournprice, $buyingprice, $label, $special_code, diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 7d00cc09c96..d01da9ea80c 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -956,8 +956,8 @@ class FactureRec extends CommonInvoice * @param float $pu_ht_devise Unit price in currency * @param int $date_start_fill 1=Flag to fill start date when generating invoice * @param int $date_end_fill 1=Flag to fill end date when generating invoice - * @param ?int $fk_fournprice Supplier price id (to calculate margin) or '' - * @param float $pa_ht Buying price of line (to calculate margin) or '' + * @param ?int|string $fk_fournprice Supplier price id (to calculate margin) or string + * @param float $pa_ht Buying price of line (to calculate margin) (Can be '' to keep AWP unchanged or a float value) * @param int $fk_parent_line Id of parent line * @return int Return integer <0 if KO, Id of line if OK */ @@ -1164,7 +1164,7 @@ class FactureRec extends CommonInvoice * @param int $date_start_fill 1=Flag to fill start date when generating invoice * @param int $date_end_fill 1=Flag to fill end date when generating invoice * @param ?int $fk_fournprice Id of origin supplier price - * @param float $pa_ht Price (without tax) of product for margin calculation + * @param float|string $pa_ht Price (without tax) of product for margin calculation (Can be '' to keep AWP unchanged or a float value) * @param int $fk_parent_line Id of parent line * @return int Return integer <0 if KO, Id of line if OK */ diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 3139eb4ab11..f2c4e678dd2 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -3873,8 +3873,8 @@ class Facture extends CommonInvoice * @param string $origin Depend on global conf MAIN_CREATEFROM_KEEP_LINE_ORIGIN_INFORMATION can be 'orderdet', 'propaldet'..., else 'order','propal,'.... * @param int $origin_id Depend on global conf MAIN_CREATEFROM_KEEP_LINE_ORIGIN_INFORMATION can be Id of origin object (aka line id), else object id * @param int $fk_parent_line Id of parent line - * @param int $fk_fournprice Supplier price id (to calculate margin) or '' - * @param float|'' $pa_ht Buying price of line (to calculate margin) or '' + * @param int|string $fk_fournprice Supplier price id (to calculate margin) or a string + * @param float|'' $pa_ht Buying price of line (to calculate margin) (Can be '' to keep AWP unchanged or a float value) * @param string $label Label of the line (deprecated, do not use) * @param array $array_options extrafields array * @param float $situation_percent Situation advance percentage @@ -4196,7 +4196,7 @@ class Facture extends CommonInvoice * @param int $fk_parent_line Id of parent line (0 in most cases, used by modules adding sublevels into lines). * @param int $skip_update_total Keep fields total_xxx to 0 (used for special lines by some modules) * @param int $fk_fournprice Id of origin supplier price - * @param float $pa_ht Price (without tax) of product when it was bought + * @param float|string $pa_ht Price (without tax) of product when it was bought (Can be '' to keep AWP unchanged or a float value) * @param string $label Label of the line (deprecated, do not use) * @param int $special_code Special code (also used by externals modules!) * @param array $array_options extrafields array diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 65fc36646a7..94871e481ee 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -1466,7 +1466,7 @@ class Contrat extends CommonObject * @param float $pu_ttc Prix unitaire TTC * @param int $info_bits Bits of type of lines * @param int $fk_fournprice Fourn price id - * @param float $pa_ht Buying price HT + * @param float|string $pa_ht Buying price HT (Can be '' to keep AWP unchanged or a float value) * @param array $array_options extrafields array * @param ?int $fk_unit Code of the unit to use. Null to use the default one * @param int $rang Position @@ -1691,7 +1691,7 @@ class Contrat extends CommonObject * @param string $price_base_type HT or TTC * @param int $info_bits Bits of type of lines * @param int $fk_fournprice Fourn price id - * @param float $pa_ht Buying price HT + * @param float|string $pa_ht Buying price HT (Can be '' to keep AWP unchanged or a float value) * @param array $array_options extrafields array * @param string $fk_unit Code of the unit to use. Null to use the default one * @param int $rang Position diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index b2b320653f6..335549585c6 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -2103,7 +2103,7 @@ class FactureFournisseur extends CommonInvoice * @param array $array_options extrafields array * @param int|null $fk_unit Code of the unit to use. Null to use the default one * @param int $origin_id id origin document - * @param float $pu_devise Amount in currency + * @param float $pu_devise Amount in currency * @param string $ref_supplier Supplier ref * @param int $special_code Special code * @param int $fk_parent_line Parent line id diff --git a/htdocs/fourn/facture/card-rec.php b/htdocs/fourn/facture/card-rec.php index b85de2b3891..4bc80b3d839 100644 --- a/htdocs/fourn/facture/card-rec.php +++ b/htdocs/fourn/facture/card-rec.php @@ -676,7 +676,7 @@ if (empty($reshook)) { $date_end_fill = GETPOSTINT('date_end_fill'); // Margin - $fournprice = price2num(GETPOST('fournprice' . $predef) ? GETPOST('fournprice' . $predef) : ''); + $fournprice = (in)(GETPOST('fournprice' . $predef) ? GETPOST('fournprice' . $predef) : ''); // This can be id of supplier price, or 'pmpprice' or 'costprice', or 'inputprice', we force to keep ID only $buyingprice = price2num(GETPOST('buying_price' . $predef) != '' ? GETPOST('buying_price' . $predef) : ''); // If buying_price is '0', we must keep this value // Local Taxes diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 7c0960fd68e..04f42adee4c 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -872,16 +872,16 @@ class Reception extends CommonObject * If STOCK_WAREHOUSE_NOT_REQUIRED_FOR_RECEPTIONS is set, you can add a reception line, with no stock source defined * If STOCK_MUST_BE_ENOUGH_FOR_RECEPTION is not set, you can add a reception line, even if not enough into stock * - * @param int $entrepot_id Id of warehouse - * @param int $id Id of source line (supplier order line) - * @param float $qty Quantity + * @param int $entrepot_id Id of warehouse + * @param int $id Id of source line (supplier order line) + * @param float $qty Quantity * @param array $array_options extrafields array - * @param string $comment Comment for stock movement - * @param int $eatby eat-by date - * @param int $sellby sell-by date - * @param string $batch Lot number - * @param float $cost_price Line cost - * @return int Return integer <0 if KO, index of line if OK + * @param string $comment Comment for stock movement + * @param int $eatby eat-by date + * @param int $sellby sell-by date + * @param string $batch Lot number + * @param float|string $cost_price Line cost (Can be '' to keep AWP unchanged or a float value) + * @return int Return integer <0 if KO, index of line if OK */ public function addline($entrepot_id, $id, $qty, $array_options = [], $comment = '', $eatby = null, $sellby = null, $batch = '', $cost_price = 0) { diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index dd935b533bf..59fe7245a93 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -799,7 +799,7 @@ if (empty($reshook)) { min($rank, count($object->lines) + 1), 0, GETPOSTINT('fk_parent_line'), - $fournprice, + (int) $fournprice, $buyingprice, $label, $array_options, @@ -878,7 +878,7 @@ if (empty($reshook)) { -1, // rang 0, // special_code GETPOSTINT('fk_parent_line'), - $fournprice, + (int) $fournprice, $buyingprice, $label, $array_options, @@ -1004,8 +1004,8 @@ if (empty($reshook)) { $pu_ht_devise = price2num(GETPOST('multicurrency_subprice'), 'CU', 2); // Add buying price - $fournprice = (GETPOST('fournprice') ? GETPOSTINT('fournprice') : ''); // foreigh key - $buyingprice = (GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we must keep this value + $fournprice = (int) (GETPOST('fournprice') ? GETPOSTINT('fournprice') : ''); // This can be id of supplier price, or 'pmpprice' or 'costprice', or 'inputprice', we force to keep ID only + $buyingprice = price2num((GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''), '', 2); // If buying_price is '0', we must keep this value // Extrafields Lines $extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line); @@ -1076,7 +1076,7 @@ if (empty($reshook)) { GETPOSTINT('fk_parent_line'), 0, (int) $fournprice, - (float) $buyingprice, + $buyingprice, $label, $type, $array_options, diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 5aa88886622..feadcecac41 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -431,8 +431,8 @@ class SupplierProposal extends CommonObject * @param int $rang Position of line * @param int $special_code Special code (also used by externals modules!) * @param int $fk_parent_line Id of parent line - * @param int $fk_fournprice Id supplier price. If 0, we will take best price. If -1 we keep it empty. - * @param int $pa_ht Buying price without tax + * @param int|string $fk_fournprice Id supplier price or string. If 0, we will take best price. If -1 we keep it empty. + * @param float|string $pa_ht Buying price without tax (Can be '' to keep AWP unchanged or a float value) * @param string $label ??? * @param array $array_options extrafields array * @param string $ref_supplier Supplier price reference @@ -717,7 +717,7 @@ class SupplierProposal extends CommonObject * @param int $fk_parent_line Id of parent line (0 in most cases, used by modules adding sublevels into lines). * @param int $skip_update_total Keep fields total_xxx to 0 (used for special lines by some modules) * @param int $fk_fournprice Id of origin supplier price - * @param float $pa_ht Price (without tax) of product when it was bought + * @param float|string $pa_ht Price (without tax) of product when it was bought (Can be '' to keep AWP unchanged or a float value) * @param string $label ??? * @param int<0,1> $type 0/1=Product/service * @param array $array_options extrafields array From a427277958e42dd921b2b0850995f7cb9753936d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 7 Apr 2025 15:48:16 +0200 Subject: [PATCH 025/124] fix phpstan (#33709) * fix phpstan * remove debug * fix phpstan * fix phpstan * fix phpstan * fix phpstan * fix phpstan * fix * fix * fix * fix --------- Co-authored-by: Laurent Destailleur --- dev/build/phpstan/phpstan-baseline.neon | 13 +------------ htdocs/accountancy/bookkeeping/export.php | 16 ++++++---------- htdocs/accountancy/bookkeeping/list.php | 14 +++++--------- htdocs/admin/invoice.php | 2 +- htdocs/admin/payment.php | 2 +- htdocs/comm/action/card.php | 2 +- 6 files changed, 15 insertions(+), 34 deletions(-) diff --git a/dev/build/phpstan/phpstan-baseline.neon b/dev/build/phpstan/phpstan-baseline.neon index 8b1d5a1852d..1eeb4cece72 100644 --- a/dev/build/phpstan/phpstan-baseline.neon +++ b/dev/build/phpstan/phpstan-baseline.neon @@ -163,6 +163,7 @@ parameters: path: ../../../htdocs/accountancy/bookkeeping/balance.php - + message: '#^If condition is always true\.$#' identifier: if.alwaysTrue count: 1 @@ -180,12 +181,6 @@ parameters: count: 1 path: ../../../htdocs/accountancy/bookkeeping/export.php - - - message: '#^Variable \$filter might not be defined\.$#' - identifier: variable.undefined - count: 4 - path: ../../../htdocs/accountancy/bookkeeping/export.php - - message: '#^Variable \$contextpage in empty\(\) always exists and is not falsy\.$#' identifier: empty.variable @@ -198,12 +193,6 @@ parameters: count: 1 path: ../../../htdocs/accountancy/bookkeeping/list.php - - - message: '#^Variable \$filter might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../../htdocs/accountancy/bookkeeping/list.php - - message: '#^Variable \$contextpage in empty\(\) always exists and is not falsy\.$#' identifier: empty.variable diff --git a/htdocs/accountancy/bookkeeping/export.php b/htdocs/accountancy/bookkeeping/export.php index 366ef96857b..9ae36868f99 100644 --- a/htdocs/accountancy/bookkeeping/export.php +++ b/htdocs/accountancy/bookkeeping/export.php @@ -4,7 +4,7 @@ * Copyright (C) 2013-2025 Alexandre Spangaro * Copyright (C) 2022 Lionel Vessiller * Copyright (C) 2016-2017 Laurent Destailleur - * Copyright (C) 2018-2024 Frédéric France + * Copyright (C) 2018-2025 Frédéric France * Copyright (C) 2022 Progiseize * Copyright (C) 2024-2025 MDW * @@ -250,6 +250,7 @@ if (!$user->hasRight('accounting', 'mouvements', 'lire')) { */ $param = ''; +$filter = array(); if (GETPOST('cancel', 'alpha')) { $action = 'list'; @@ -332,7 +333,6 @@ if (empty($reshook)) { } // Must be after the remove filter action, before the export. - $filter = array(); if (!empty($search_date_start)) { $filter['t.doc_date>='] = $search_date_start; $tmp = dol_getdate($search_date_start); @@ -548,10 +548,6 @@ if (count($filter) > 0) { $sqlwhere[] = "t.doc_date >= '".$db->idate($value)."'"; } elseif ($key == 't.doc_date<=') { $sqlwhere[] = "t.doc_date <= '".$db->idate($value)."'"; - } elseif ($key == 't.doc_date>') { - $sqlwhere[] = "t.doc_date > '".$db->idate($value)."'"; - } elseif ($key == 't.doc_date<') { - $sqlwhere[] = "t.doc_date < '".$db->idate($value)."'"; } elseif ($key == 't.numero_compte>=') { $sqlwhere[] = "t.numero_compte >= '".$db->escape($value)."'"; } elseif ($key == 't.numero_compte<=') { @@ -560,12 +556,12 @@ if (count($filter) > 0) { $sqlwhere[] = "t.subledger_account >= '".$db->escape($value)."'"; } elseif ($key == 't.subledger_account<=') { $sqlwhere[] = "t.subledger_account <= '".$db->escape($value)."'"; - } elseif ($key == 't.fk_doc' || $key == 't.fk_docdet' || $key == 't.piece_num') { - $sqlwhere[] = $db->sanitize($key).'='.((int) $value); + // } elseif ($key == 't.fk_doc' || $key == 't.fk_docdet' || $key == 't.piece_num') { // these fields doesn't exists + // $sqlwhere[] = $db->sanitize($key).'='.((int) $value); } elseif ($key == 't.subledger_account' || $key == 't.numero_compte') { $sqlwhere[] = $db->sanitize($key)." LIKE '".$db->escape($db->escapeforlike($value))."%'"; - } elseif ($key == 't.subledger_account') { - $sqlwhere[] = natural_search($key, $value, 0, 1); + // } elseif ($key == 't.subledger_account') { // this code is unreachable, test is always false + // $sqlwhere[] = natural_search($key, $value, 0, 1); } elseif ($key == 't.tms>=') { $sqlwhere[] = "t.tms >= '".$db->idate($value)."'"; } elseif ($key == 't.tms<=') { diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 4fed43d5c75..9d099ed6805 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -232,6 +232,7 @@ $permissiontoadd = $user->hasRight('accounting', 'mouvements', 'creer'); */ $param = ''; +$filter = array(); if (GETPOST('cancel', 'alpha')) { $action = 'list'; @@ -300,7 +301,6 @@ if (empty($reshook)) { } // Must be after the remove filter action, before the export. - $filter = array(); if (!empty($search_date_start)) { $filter['t.doc_date>='] = $search_date_start; $tmp = dol_getdate($search_date_start); @@ -635,10 +635,6 @@ if (count($filter) > 0) { $sqlwhere[] = "t.doc_date >= '".$db->idate($value)."'"; } elseif ($key == 't.doc_date<=') { $sqlwhere[] = "t.doc_date <= '".$db->idate($value)."'"; - } elseif ($key == 't.doc_date>') { - $sqlwhere[] = "t.doc_date > '".$db->idate($value)."'"; - } elseif ($key == 't.doc_date<') { - $sqlwhere[] = "t.doc_date < '".$db->idate($value)."'"; } elseif ($key == 't.numero_compte>=') { $sqlwhere[] = "t.numero_compte >= '".$db->escape($value)."'"; } elseif ($key == 't.numero_compte<=') { @@ -647,12 +643,12 @@ if (count($filter) > 0) { $sqlwhere[] = "t.subledger_account >= '".$db->escape($value)."'"; } elseif ($key == 't.subledger_account<=') { $sqlwhere[] = "t.subledger_account <= '".$db->escape($value)."'"; - } elseif ($key == 't.fk_doc' || $key == 't.fk_docdet' || $key == 't.piece_num') { - $sqlwhere[] = $db->sanitize($key).' = '.((int) $value); + /* } elseif ($key == 't.fk_doc' || $key == 't.fk_docdet' || $key == 't.piece_num') { // these fields doesn't exists + $sqlwhere[] = $db->sanitize($key).' = '.((int) $value); */ } elseif ($key == 't.subledger_account' || $key == 't.numero_compte') { $sqlwhere[] = $db->sanitize($key)." LIKE '".$db->escape($db->escapeforlike($value))."%'"; - } elseif ($key == 't.subledger_account') { - $sqlwhere[] = natural_search($key, $value, 0, 1); + /* } elseif ($key == 't.subledger_account') { // test is always false + $sqlwhere[] = natural_search($key, $value, 0, 1); */ } elseif ($key == 't.tms>=') { $sqlwhere[] = "t.tms >= '".$db->idate($value)."'"; } elseif ($key == 't.tms<=') { diff --git a/htdocs/admin/invoice.php b/htdocs/admin/invoice.php index 995959c6a66..9056073c371 100644 --- a/htdocs/admin/invoice.php +++ b/htdocs/admin/invoice.php @@ -8,7 +8,7 @@ * Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com> * Copyright (C) 2022 Anthony Berton * Copyright (C) 2024-2025 MDW - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * Copyright (C) 2024 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify diff --git a/htdocs/admin/payment.php b/htdocs/admin/payment.php index 25cf0be1287..5869ec45e20 100644 --- a/htdocs/admin/payment.php +++ b/htdocs/admin/payment.php @@ -2,7 +2,7 @@ /* Copyright (C) 2015 Juanjo Menent * Copyright (C) 2020 Maxime DEMAREST * Copyright (C) 2024-2025 MDW - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index ae530b3b3a3..56f5187a5be 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -7,7 +7,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2014 Cedric GROSS * Copyright (C) 2015 Alexandre Spangaro - * Copyright (C) 2018-2024 Frédéric France + * Copyright (C) 2018-2025 Frédéric France * Copyright (C) 2019 Ferran Marcet * Copyright (C) 2024-2025 MDW * From 75d0f2ea6c897d3faa6ec837bcc8e090323a9212 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Mon, 7 Apr 2025 15:58:06 +0200 Subject: [PATCH 026/124] FIX #33547 --- htdocs/core/lib/ajax.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 72a944be7c9..e02b87a418c 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -529,7 +529,7 @@ function ajax_combobox($htmlname, $events = array(), $minLengthToAutocomplete = /* Code to add class of origin OPTION propagated to the new select2
  • tag */ if (data.element) { $(container).addClass($(data.element).attr("class")); } //console.log("data html is "+$(data.element).attr("data-html")); - if (data.id == '.((int) $idforemptyvalue).' && $(data.element).attr("data-html") == undefined) { + if (data.id == \''.(dol_escape_js($idforemptyvalue)).'\' && $(data.element).attr("data-html") == undefined) { return \' \'; } if ($(data.element).attr("data-html") != undefined) { @@ -542,7 +542,7 @@ function ajax_combobox($htmlname, $events = array(), $minLengthToAutocomplete = return data.text; }, templateSelection: function (selection) { /* Format visible output of selected value */ - if (selection.id == '.((int) $idforemptyvalue).') return \'\'+selection.text+\'\'; + if (selection.id == \''.(dol_escape_js($idforemptyvalue)).'\') return \'\'+selection.text+\'\'; return selection.text; }, escapeMarkup: function(markup) { From 3a05efdb5bdd74423dba45de08c38e7afe33ac11 Mon Sep 17 00:00:00 2001 From: Mohamed DAOUD Date: Mon, 7 Apr 2025 16:34:51 +0200 Subject: [PATCH 027/124] Add try catch (#33755) --- htdocs/core/lib/website2.lib.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php index e73c35b740b..3fbea888455 100644 --- a/htdocs/core/lib/website2.lib.php +++ b/htdocs/core/lib/website2.lib.php @@ -190,6 +190,7 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage, $tplcontent .= 'dol_syslog("--- Prepare content of page '.((int) $objectpage->id).' - '.$objectpage->pageurl.'");'."\n"; } $tplcontent .= "ob_start();\n"; + $tplcontent .= "try {\n"; $tplcontent .= "// END PHP ?>\n"; if (getDolGlobalString('WEBSITE_FORCE_DOCTYPE_HTML5')) { $tplcontent .= "\n"; @@ -328,6 +329,7 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage, $tplcontent .= ''."\n"; $tplcontent .= 'getMessage(); }'."\n"; $tplcontent .= '$tmp = ob_get_contents(); ob_end_clean();'."\n"; // replace with ob_get_clean ? $tplcontent .= "// Now fix the content for SEO or multilanguage\n"; From 8de3b9435614dfe008e1f326c4a52ae89393b0fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 7 Apr 2025 16:35:29 +0200 Subject: [PATCH 028/124] fix syntax (#33756) --- htdocs/fourn/facture/card-rec.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/facture/card-rec.php b/htdocs/fourn/facture/card-rec.php index 4bc80b3d839..f72c9c54e13 100644 --- a/htdocs/fourn/facture/card-rec.php +++ b/htdocs/fourn/facture/card-rec.php @@ -676,7 +676,7 @@ if (empty($reshook)) { $date_end_fill = GETPOSTINT('date_end_fill'); // Margin - $fournprice = (in)(GETPOST('fournprice' . $predef) ? GETPOST('fournprice' . $predef) : ''); // This can be id of supplier price, or 'pmpprice' or 'costprice', or 'inputprice', we force to keep ID only + $fournprice = (int) (GETPOST('fournprice' . $predef) ? GETPOST('fournprice' . $predef) : ''); // This can be id of supplier price, or 'pmpprice' or 'costprice', or 'inputprice', we force to keep ID only $buyingprice = price2num(GETPOST('buying_price' . $predef) != '' ? GETPOST('buying_price' . $predef) : ''); // If buying_price is '0', we must keep this value // Local Taxes From ac3364138d911d81dac8f6e7bb315dee45c08d7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 7 Apr 2025 16:37:08 +0200 Subject: [PATCH 029/124] fix sql (#33754) if ref or ref_ext doen't exists in object (by example ref with llx_societe) sql will fails Co-authored-by: Laurent Destailleur --- 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 36c894acdd3..c3c3dcfa97f 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -905,7 +905,7 @@ abstract class CommonObject { global $db, $conf; - $sql = "SELECT rowid, ref, ref_ext"; + $sql = "SELECT rowid"; $sql .= " FROM ".$db->prefix().$element; $sql .= " WHERE entity IN (".getEntity($element).")"; From 91e0b5263010b6881cd546c84c5d358d9cae9e8c Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Mon, 7 Apr 2025 16:38:37 +0200 Subject: [PATCH 030/124] Fix CI --- htdocs/compta/facture/card-rec.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php index c55e9f69359..69f01c02ea5 100644 --- a/htdocs/compta/facture/card-rec.php +++ b/htdocs/compta/facture/card-rec.php @@ -715,7 +715,7 @@ if (empty($reshook)) { $date_end_fill = GETPOSTINT('date_end_fill'); // Margin - $fournprice = (in)(GETPOST('fournprice'.$predef) ? GETPOST('fournprice'.$predef) : ''); // This can be id of supplier price, or 'pmpprice' or 'costprice', or 'inputprice', we force to keep ID only + $fournprice = (int) (GETPOST('fournprice'.$predef) ? GETPOST('fournprice'.$predef) : ''); // This can be id of supplier price, or 'pmpprice' or 'costprice', or 'inputprice', we force to keep ID only $buyingprice = price2num(GETPOST('buying_price'.$predef) != '' ? GETPOST('buying_price'.$predef) : ''); // If buying_price is '0', we must keep this value // Local Taxes From 16e05c08a755c7c8c3be62f360a85ff4515c842f Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Mon, 7 Apr 2025 16:40:15 +0200 Subject: [PATCH 031/124] Fix CI --- htdocs/comm/propal/class/propal.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index c4b41528d98..4c8e6ea2566 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -618,7 +618,7 @@ class Propal extends CommonObject * @param int $special_code Special code (also used by externals modules!) * @param int $fk_parent_line Id of parent line * @param int $fk_fournprice Id supplier price - * @param float[string $pa_ht Buying price without tax ('' to keep PMP unchanged or a float) + * @param float|string $pa_ht Buying price without tax ('' to keep PMP unchanged or a float) * @param string $label ??? * @param int|string $date_start Start date of the line * @param int|string $date_end End date of the line From a16df33bf33d9eda7b4f85528c663d90e86b64f1 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Mon, 7 Apr 2025 16:45:44 +0200 Subject: [PATCH 032/124] Fix CI --- htdocs/admin/menus/edit.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/menus/edit.php b/htdocs/admin/menus/edit.php index 13c4aa7d59f..846d3c25699 100644 --- a/htdocs/admin/menus/edit.php +++ b/htdocs/admin/menus/edit.php @@ -398,8 +398,8 @@ if ($action == 'create') { // Target print ''.$langs->trans('Target').''; print ajax_combobox("target"); print ''.$langs->trans('DetailTarget').''; From be21aa7c6da14a8e3bc6d44c64cc372a671cfb7d Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Mon, 7 Apr 2025 17:00:18 +0200 Subject: [PATCH 033/124] FIX CI --- htdocs/compta/facture/class/facture-rec.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index d01da9ea80c..4f7f4863e84 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -956,7 +956,7 @@ class FactureRec extends CommonInvoice * @param float $pu_ht_devise Unit price in currency * @param int $date_start_fill 1=Flag to fill start date when generating invoice * @param int $date_end_fill 1=Flag to fill end date when generating invoice - * @param ?int|string $fk_fournprice Supplier price id (to calculate margin) or string + * @param int|string|null $fk_fournprice Supplier price id (to calculate margin) or string * @param float $pa_ht Buying price of line (to calculate margin) (Can be '' to keep AWP unchanged or a float value) * @param int $fk_parent_line Id of parent line * @return int Return integer <0 if KO, Id of line if OK From 59bc259804f8a7486dd98c590ffad17e0a584cbf Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 7 Apr 2025 17:01:03 +0200 Subject: [PATCH 034/124] FIX a comment without after a comma create a sql error (#33752) Co-authored-by: Laurent Destailleur --- .../install/mysql/tables/llx_societe_perentity-multicompany.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/tables/llx_societe_perentity-multicompany.sql b/htdocs/install/mysql/tables/llx_societe_perentity-multicompany.sql index a8d28fb6b22..64308faacac 100644 --- a/htdocs/install/mysql/tables/llx_societe_perentity-multicompany.sql +++ b/htdocs/install/mysql/tables/llx_societe_perentity-multicompany.sql @@ -28,5 +28,5 @@ create table llx_societe_perentity accountancy_code_supplier varchar(32), -- supplier accountancy auxiliary account accountancy_code_sell varchar(32), -- Selling accountancy code accountancy_code_buy varchar(32), -- Buying accountancy code - vat_reverse_charge tinyint DEFAULT 0 -- VAT reverse charge + vat_reverse_charge tinyint DEFAULT 0 )ENGINE=innodb; From 664ea5f8c1c6b0cea2222307087cf91ef155023f Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+BB2A-Anthony@users.noreply.github.com> Date: Mon, 7 Apr 2025 18:29:42 +0200 Subject: [PATCH 035/124] FIX - const for affect warehouse (#33751) Co-authored-by: Anthony Berton Co-authored-by: Laurent Destailleur --- htdocs/comm/propal/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 188bba430bf..266c117b90c 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -2066,7 +2066,7 @@ if ($action == 'create') { if ($soc->fk_warehouse > 0) { $warehouse_id = $soc->fk_warehouse; } - if (isModEnabled('stock') && empty($warehouse_id) && getDolGlobalString('WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER')) { + if (isModEnabled('stock') && empty($warehouse_id) && getDolGlobalString('WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL')) { if (empty($object->warehouse_id) && getDolGlobalString('MAIN_DEFAULT_WAREHOUSE')) { $warehouse_id = getDolGlobalString('MAIN_DEFAULT_WAREHOUSE'); } From 936e35a76729efc2d65c4bafa4678ec799ca0610 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Mon, 7 Apr 2025 20:29:38 +0200 Subject: [PATCH 036/124] Enhance AI setup. --- htdocs/ai/admin/custom_prompt.php | 2 +- htdocs/ai/admin/setup.php | 29 +++++-- htdocs/ai/ajax/generate_content.php | 10 +-- htdocs/ai/class/ai.class.php | 116 ++++++++++------------------ htdocs/ai/lib/ai.lib.php | 48 ++++++++++-- 5 files changed, 113 insertions(+), 92 deletions(-) diff --git a/htdocs/ai/admin/custom_prompt.php b/htdocs/ai/admin/custom_prompt.php index 6efe6229d78..092612da89f 100644 --- a/htdocs/ai/admin/custom_prompt.php +++ b/htdocs/ai/admin/custom_prompt.php @@ -412,7 +412,7 @@ if ($action == 'edit' || $action == 'create' || $action == 'deleteproperty') { if ($action == 'edit' || $action == 'create' || $action == 'deleteproperty') { - print load_fiche_titre($langs->trans("AIModelForFeature", $arrayofai[$aiservice]), $newbutton, ''); + print load_fiche_titre($langs->trans("AIModelForFeature", $arrayofai[$aiservice]['label']), $newbutton, ''); print $formSetup->generateOutput(true); } diff --git a/htdocs/ai/admin/setup.php b/htdocs/ai/admin/setup.php index 62924e5127a..479bd2774f7 100644 --- a/htdocs/ai/admin/setup.php +++ b/htdocs/ai/admin/setup.php @@ -76,7 +76,8 @@ $item = $formSetup->newItem('AI_API_SERVICE'); // Name of constant must end with $item->setAsSelect($arrayofai); $item->cssClass = 'minwidth150'; -foreach ($arrayofai as $ia => $ialabel) { +foreach ($arrayofai as $ia => $iarecord) { + $ialabel = $iarecord['label']; // Setup conf AI_PUBLIC_INTERFACE_TOPIC /*$item = $formSetup->newItem('AI_API_'.strtoupper($ia).'_ENDPOINT'); // Name of constant must end with _KEY so it is encrypted when saved into database. $item->defaultFieldValue = ''; @@ -92,7 +93,7 @@ foreach ($arrayofai as $ia => $ialabel) { $item = $formSetup->newItem('AI_API_'.strtoupper($ia).'_URL'); // Name of constant must end with _KEY so it is encrypted when saved into database. $item->nameText = $langs->trans("AI_API_URL").' ('.$ialabel.')'; $item->defaultFieldValue = ''; - $item->fieldParams['trClass'] = 'iaservice '.$ia; + $item->fieldParams['trClass'] = 'iaservice iaurl '.$ia; $item->cssClass = 'minwidth500 input'.$ia; } @@ -123,8 +124,6 @@ $action = 'edit'; * View */ -$form = new Form($db); - $help_url = ''; $title = "AiSetup"; @@ -160,11 +159,29 @@ if (empty($setupnotempty)) { print ' '; } + if ($showlinktolayout) { if (!empty($formwebsite) && is_object($formwebsite)) { $out .= $formwebsite->getContentPageTemplate($htmlname); @@ -126,13 +127,18 @@ if ($showlinktolayout) { } else { $out .= ''; } + if ($showlinktoai) { if (empty($formai) || $formai instanceof FormAI) { include_once DOL_DOCUMENT_ROOT.'/core/class/html.formai.class.php'; $formai = new FormAI($db); } $out .= $formai->getAjaxAICallFunction(); - $out .= $formai->getSectionForAIEnhancement($showlinktoai, $formmail->withaiprompt, $htmlname); + + if (empty($onlyenhancements)) { + $onlyenhancements = ''; + } + $out .= $formai->getSectionForAIEnhancement($showlinktoai, $formmail->withaiprompt, $htmlname, $onlyenhancements); } else { $out .= ''; } diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 98051d3cad5..632ea3c70fc 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2546,7 +2546,9 @@ TextTranslation=Text translation ImageGeneration=Image generation VideoGeneration=Video generation AudioGeneration=Audio generation -AIPromptForFeatures=AI custom prompts or models for features +AIPromptForFeatures=AI custom prompts for features (AI service %s) +AIModelForFeature=AI model for features (AI service %s) +NewCustomPrompt=New custom prompt AudioTranscription=Audio transcription AudioTranslation=Audio translation EnterAnIP=Enter an IP address @@ -2643,7 +2645,6 @@ PDF_XXX_SHOW_PRICE_INCL_TAX=Show column Price including tax AvailableWithSomePDFTemplatesOnly=Feature not supported on old PDF templates SelectAService=Select the kind of service to use SelectFeatureToTest=Select the feature to test -AIModelForFeature=AI model for features (AI service %s) communityRepo=Community repository online=Online NotConnected=Not connected From 6a6d7e5b5ac5c5c12682ccc30dc963d4683c1d34 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Tue, 8 Apr 2025 12:02:07 +0200 Subject: [PATCH 041/124] Debug v22 --- htdocs/core/lib/company.lib.php | 36 ++++++++++++++------ htdocs/public/onlinesign/newonlinesign.php | 39 ++-------------------- 2 files changed, 29 insertions(+), 46 deletions(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 2998e5f3396..e6cb3629b78 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -2737,25 +2737,41 @@ function addMailingEventTypeSQL($actioncode, $objcon, $filterobj) /** - * Show header of company in HTML public pages + * Show the header of a company in HTML public pages * * @param Societe $mysoc Third party * @param Translate $langs Output language + * @param int $publicpage 1=If header is for a public page + * @param string $altlogo1 To use an alternative logo defined into setup (instead of company logo) + * @param string $altlogo2 To use an alternative logo defined into setup (instead of company logo) * @return void */ -function htmlPrintOnlineHeader($mysoc, $langs) +function htmlPrintOnlineHeader($mysoc, $langs, $publicpage = 1, $altlogo1 = '', $altlogo2 = '') { - global $conf; + global $conf, $dolibarr_main_url_root; - // Define urllogo - $urllogo = DOL_URL_ROOT.'/theme/common/login_logo.png'; + // Set logo of company by default + $logosmall = $mysoc->logo_small; + $logo = $mysoc->logo; - 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); + if ($altlogo1 && getDolGlobalString($altlogo1)) { + $logosmall = getDolGlobalString($altlogo1); + } elseif ($altlogo2 && getDolGlobalString($altlogo2)) { + $logosmall = getDolGlobalString($altlogo2); + } + + // Define $urllogo and $urllogofull + $urllogo = ''; + $urllogofull = ''; + if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) { + $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$logosmall); + $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); + } elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) { + $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/'.$logo); + $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); } elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.svg')) { $urllogo = DOL_URL_ROOT.'/theme/dolibarr_logo.svg'; + $urllogofull = $dolibarr_main_url_root.'/theme/dolibarr_logo.svg'; } print '
    '; @@ -2763,7 +2779,7 @@ function htmlPrintOnlineHeader($mysoc, $langs) // Output html code for logo print '
    '; print '
    '; - print ''; + print ''; print '
    '; if (!getDolGlobalString('MAIN_HIDE_POWERED_BY')) { print ''; diff --git a/htdocs/public/onlinesign/newonlinesign.php b/htdocs/public/onlinesign/newonlinesign.php index 2a7c46dee7e..9a66a2fb826 100644 --- a/htdocs/public/onlinesign/newonlinesign.php +++ b/htdocs/public/onlinesign/newonlinesign.php @@ -249,7 +249,7 @@ $title = $langs->trans("OnlineSignature"); $replacemainarea = (empty($conf->dol_hide_leftmenu) ? '
    ' : '').'
    '; llxHeader($head, $title, '', '', 0, 0, '', '', '', 'onlinepaymentbody', $replacemainarea, 1); -htmlPrintOnlineHeader($mysoc, $langs); +htmlPrintOnlineHeader($mysoc, $langs, 1, 'ONLINE_SIGN_LOGO_'.$suffix, 'ONLINE_SIGN_LOGO'); 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); @@ -280,47 +280,14 @@ print ''; print "\n"; print ''."\n"; -print ''."\n"; - -// Show logo (search order: logo defined by ONLINE_SIGN_LOGO_suffix, then ONLINE_SIGN_LOGO_, then small company logo, large company logo, theme logo, common logo) -// Define logo and logosmall -$logosmall = $mysoc->logo_small; -$logo = $mysoc->logo; -$paramlogo = 'ONLINE_SIGN_LOGO_'.$suffix; -if (getDolGlobalString($paramlogo)) { - $logosmall = getDolGlobalString($paramlogo); -} elseif (getDolGlobalString('ONLINE_SIGN_LOGO')) { - $logosmall = getDolGlobalString('ONLINE_SIGN_LOGO'); -} -//print ''."\n"; -// Define urllogo -$urllogo = ''; -$urllogofull = ''; -if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) { - $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); - $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); -} elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) { - $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); - $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); -} -// Output html code for logo -if ($urllogo) { - print '
    '; - print '
    '; - print ''; - print '
    '; - if (!getDolGlobalString('MAIN_HIDE_POWERED_BY')) { - print ''; - } - print '
    '; -} if ($source == 'proposal' && getDolGlobalString('PROPOSAL_IMAGE_PUBLIC_SIGN')) { print '
    '; print ''; print '
    '; } +print '
    '."\n"; + // Output introduction text $text = ''; if (getDolGlobalString('ONLINE_SIGN_NEWFORM_TEXT')) { From 0e7e59a17a29aa879aeaf4261e6406992323f8e9 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Tue, 8 Apr 2025 12:49:19 +0200 Subject: [PATCH 042/124] Clean code. Public pages must use the common header --- htdocs/bookcal/admin/setup.php | 1 + htdocs/core/lib/company.lib.php | 62 ++++++++++++++-------- htdocs/core/lib/ticket.lib.php | 51 +----------------- htdocs/langs/en_US/agenda.lang | 1 + htdocs/opensurvey/lib/opensurvey.lib.php | 42 ++------------- htdocs/public/bookcal/index.php | 41 +------------- htdocs/public/onlinesign/newonlinesign.php | 2 +- 7 files changed, 53 insertions(+), 147 deletions(-) diff --git a/htdocs/bookcal/admin/setup.php b/htdocs/bookcal/admin/setup.php index 8d3eab1bf67..c8f87937120 100644 --- a/htdocs/bookcal/admin/setup.php +++ b/htdocs/bookcal/admin/setup.php @@ -77,6 +77,7 @@ $formSetup = new FormSetup($db); // Setup conf BOOKCAL_PUBLIC_INTERFACE_TOPIC $item = $formSetup->newItem('BOOKCAL_PUBLIC_INTERFACE_TOPIC'); $item->defaultFieldValue = 'MyBigCompany public interface for Bookcal'; +$item->cssClass = 'minwidth300'; $setupnotempty = + count($formSetup->items); diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index e6cb3629b78..c5e6bac48e0 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -2741,18 +2741,21 @@ function addMailingEventTypeSQL($actioncode, $objcon, $filterobj) * * @param Societe $mysoc Third party * @param Translate $langs Output language - * @param int $publicpage 1=If header is for a public page + * @param string $showlogo '1'=Show logo or 'url' for click on logo + * @param string $alttext Text to show in header + * @param string $subimageconst Constant to check if we must add image under the main header * @param string $altlogo1 To use an alternative logo defined into setup (instead of company logo) * @param string $altlogo2 To use an alternative logo defined into setup (instead of company logo) * @return void */ -function htmlPrintOnlineHeader($mysoc, $langs, $publicpage = 1, $altlogo1 = '', $altlogo2 = '') +function htmlPrintOnlineHeader($mysoc, $langs, $showlogo = '1', $alttext = '', $subimageconst = '', $altlogo1 = '', $altlogo2 = '') { global $conf, $dolibarr_main_url_root; // Set logo of company by default $logosmall = $mysoc->logo_small; $logo = $mysoc->logo; + $publicpage = 1; // For the moment, we always use the public link if ($altlogo1 && getDolGlobalString($altlogo1)) { $logosmall = getDolGlobalString($altlogo1); @@ -2763,32 +2766,49 @@ function htmlPrintOnlineHeader($mysoc, $langs, $publicpage = 1, $altlogo1 = '', // Define $urllogo and $urllogofull $urllogo = ''; $urllogofull = ''; - if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) { - $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$logosmall); - $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); - } elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) { - $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/'.$logo); - $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); - } elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.svg')) { - $urllogo = DOL_URL_ROOT.'/theme/dolibarr_logo.svg'; - $urllogofull = $dolibarr_main_url_root.'/theme/dolibarr_logo.svg'; + if ($showlogo) { + if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) { + $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$logosmall); + $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); + } elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) { + $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/'.$logo); + $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); + } elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.svg')) { + $urllogo = DOL_URL_ROOT.'/theme/dolibarr_logo.svg'; + $urllogofull = $dolibarr_main_url_root.'/theme/dolibarr_logo.svg'; + } } print '
    '; // Output html code for logo - print '
    '; - print '
    '; - print ''; - print '
    '; - if (!getDolGlobalString('MAIN_HIDE_POWERED_BY')) { - print ''; + if ($urllogo || $alttext) { + print '
    '; + print '
    '; + if ($urllogo) { + if (!is_numeric($showlogo)) { + print ''; + } + print ''; + if (!is_numeric($showlogo)) { + print ''; + } + } + if ($alttext) { + print '
    '.$alttext.''; + } + print '
    '; + if (!getDolGlobalString('MAIN_HIDE_POWERED_BY')) { + print ''; + } + print '
    '; } - print '
    '; - if (getDolGlobalString('MEMBER_IMAGE_PUBLIC_REGISTRATION')) { - print '
    '; - print ''; + // MEMBER_IMAGE_PUBLIC_REGISTRATION + // OPENSURVEY_IMAGE_PUBLIC_INTERFACE + if (getDolGlobalString($subimageconst)) { + print '
    '; + print ''; print '
    '; } diff --git a/htdocs/core/lib/ticket.lib.php b/htdocs/core/lib/ticket.lib.php index ca0a33cb117..381cbbc4705 100644 --- a/htdocs/core/lib/ticket.lib.php +++ b/htdocs/core/lib/ticket.lib.php @@ -228,59 +228,12 @@ function generate_random_id($car = 16) */ function llxHeaderTicket($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) { - global $user, $conf, $langs, $mysoc; + global $conf, $langs, $mysoc; - $urllogo = ""; top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss, 0, 1); // Show html headers print ''; print '
    '; - print '
    '; - - // Define urllogo - if (getDolGlobalInt('TICKET_SHOW_COMPANY_LOGO') || getDolGlobalString('TICKET_PUBLIC_INTERFACE_TOPIC')) { - // Print logo - if (getDolGlobalInt('TICKET_SHOW_COMPANY_LOGO')) { - $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?modulepart=mycompany&entity='.$conf->entity.'&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?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$mysoc->logo); - } elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.svg')) { - $urllogo = DOL_URL_ROOT.'/theme/dolibarr_logo.svg'; - } - } - } - - // Output html code for logo - if ($urllogo || getDolGlobalString('TICKET_PUBLIC_INTERFACE_TOPIC')) { - print '
    '; - print '
    '; - if ($urllogo) { - print ''; - print ''; - print ''; - } - if (getDolGlobalString('TICKET_PUBLIC_INTERFACE_TOPIC')) { - print '
    '.(getDolGlobalString('TICKET_PUBLIC_INTERFACE_TOPIC') ? getDolGlobalString('TICKET_PUBLIC_INTERFACE_TOPIC') : $langs->trans("TicketSystem")).''; - } - print '
    '; - if (!getDolGlobalInt('MAIN_HIDE_POWERED_BY')) { - print ''; - } - print '
    '; - } - - if (getDolGlobalInt('TICKET_IMAGE_PUBLIC_INTERFACE')) { - print '
    '; - print ''; - print '
    '; - } - - print '
    '; - - //print '
    '; + htmlPrintOnlineHeader($mysoc, $langs, (getDolGlobalInt('TICKET_SHOW_COMPANY_LOGO') ? getDolGlobalString('TICKET_URL_PUBLIC_INTERFACE', dol_buildpath('/public/ticket/index.php?entity='.$conf->entity, 1)) : '0'), getDolGlobalString('TICKET_PUBLIC_INTERFACE_TOPIC', $langs->trans("TicketSystem")), 'TICKET_IMAGE_PUBLIC_INTERFACE'); } diff --git a/htdocs/langs/en_US/agenda.lang b/htdocs/langs/en_US/agenda.lang index 2a5f7247934..3da93f477e7 100644 --- a/htdocs/langs/en_US/agenda.lang +++ b/htdocs/langs/en_US/agenda.lang @@ -209,3 +209,4 @@ ReadMore = Read more ReadLess = Read less RecurringEvent=Recurring event EventPartOfARecurringSerie=Event is part of a recurring serie with ID %s +BookCalSystem=Online booking diff --git a/htdocs/opensurvey/lib/opensurvey.lib.php b/htdocs/opensurvey/lib/opensurvey.lib.php index ef82c0e0970..ef3d867ddca 100644 --- a/htdocs/opensurvey/lib/opensurvey.lib.php +++ b/htdocs/opensurvey/lib/opensurvey.lib.php @@ -77,8 +77,7 @@ function opensurvey_prepare_head(Opensurveysondage $object) */ function llxHeaderSurvey($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = [], $numsondage = '') { - global $conf, $langs, $mysoc; - global $dolibarr_main_url_root; + global $langs, $mysoc; // $replacemainarea = (empty($conf->dol_hide_leftmenu) ? '
    ' : '').'
    '; @@ -86,48 +85,17 @@ function llxHeaderSurvey($title, $head = "", $disablejs = 0, $disablehead = 0, $ print ''; + include_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; + htmlPrintOnlineHeader($mysoc, $langs, 'OPENSURVEY_IMAGE_PUBLIC_INTERFACE'); + print ''."\n"; print '
    '."\n"; + print ''."\n"; print ''; print ''."\n"; print "\n"; - // Show logo (search order: logo defined by PAYMENT_LOGO_suffix, then PAYMENT_LOGO, then small company logo, large company logo, theme logo, common logo) - // Define logo and logosmall - $logosmall = $mysoc->logo_small; - $logo = $mysoc->logo; - // print ''."\n"; - // Define urllogo - $urllogo = ''; - $urllogofull = ''; - if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) { - $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); - $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); - } elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) { - $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); - $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); - } - - // Output html code for logo - if ($urllogo) { - print '
    '; - print '
    '; - print ''; - print '
    '; - if (!getDolGlobalString('MAIN_HIDE_POWERED_BY')) { - print ''; - } - print '
    '; - } - - if (getDolGlobalString('OPENSURVEY_IMAGE_PUBLIC_INTERFACE')) { - print '
    '; - print ''; - print '
    '; - } - print '


    '; } diff --git a/htdocs/public/bookcal/index.php b/htdocs/public/bookcal/index.php index a32ebb84521..58138425570 100644 --- a/htdocs/public/bookcal/index.php +++ b/htdocs/public/bookcal/index.php @@ -147,46 +147,9 @@ function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $ print ''; - $urllogo = ''; - // Define urllogo - if (getDolGlobalInt('BOOKCAL_SHOW_COMPANY_LOGO') || getDolGlobalString('BOOPKCAL_PUBLIC_INTERFACE_TOPIC')) { - // Print logo - if (getDolGlobalInt('BOOKCAL_SHOW_COMPANY_LOGO')) { - $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?modulepart=mycompany&entity='.$conf->entity.'&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?modulepart=mycompany&entity='.$conf->entity.'&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 - print '
    '; - print '
    '; - if ($urllogo) { - print ''; - print ''; - print ''; - } - if (getDolGlobalString('BOOKCAL_PUBLIC_INTERFACE_TOPIC')) { - print '
    '.(getDolGlobalString('BOOKCAL_PUBLIC_INTERFACE_TOPIC') ? getDolGlobalString('BOOKCAL_PUBLIC_INTERFACE_TOPIC') : $langs->trans("BookCalSystem")).''; - } - if (empty($urllogo) && ! getDolGlobalString('BOOKCAL_PUBLIC_INTERFACE_TOPIC')) { - print $mysoc->name; - } - print '
    '; - if (!getDolGlobalInt('MAIN_HIDE_POWERED_BY')) { - print ''; - } - print '
    '; - - print '
    '; + include_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; + htmlPrintOnlineHeader($mysoc, $langs, 1, getDolGlobalString('BOOKCAL_PUBLIC_INTERFACE_TOPIC', $langs->trans("BookCalSystem")), 'BOOKCAL_PUBLIC_INTERFACE_IMAGE'); print '
    '; } diff --git a/htdocs/public/onlinesign/newonlinesign.php b/htdocs/public/onlinesign/newonlinesign.php index 9a66a2fb826..fb78d229e3a 100644 --- a/htdocs/public/onlinesign/newonlinesign.php +++ b/htdocs/public/onlinesign/newonlinesign.php @@ -249,7 +249,7 @@ $title = $langs->trans("OnlineSignature"); $replacemainarea = (empty($conf->dol_hide_leftmenu) ? '
    ' : '').'
    '; llxHeader($head, $title, '', '', 0, 0, '', '', '', 'onlinepaymentbody', $replacemainarea, 1); -htmlPrintOnlineHeader($mysoc, $langs, 1, 'ONLINE_SIGN_LOGO_'.$suffix, 'ONLINE_SIGN_LOGO'); +htmlPrintOnlineHeader($mysoc, $langs, 1, '', 'ONLINE_SIGN_IMAGE_PUBLIC_INTERFACE', 'ONLINE_SIGN_LOGO_'.$suffix, 'ONLINE_SIGN_LOGO'); 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 54eb9f21e8272f87ce5725c8670943028bf210c9 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Tue, 8 Apr 2025 12:49:19 +0200 Subject: [PATCH 043/124] Clean code. Public pages must use the common header --- htdocs/bookcal/admin/setup.php | 1 + htdocs/core/lib/company.lib.php | 62 ++++++++++++------- htdocs/core/lib/ticket.lib.php | 51 +-------------- htdocs/langs/en_US/agenda.lang | 1 + .../class/opensurveysondage.class.php | 2 +- htdocs/opensurvey/lib/opensurvey.lib.php | 42 ++----------- htdocs/public/bookcal/index.php | 42 +------------ htdocs/public/company/new.php | 36 +---------- htdocs/public/members/new.php | 34 +--------- htdocs/public/onlinesign/newonlinesign.php | 2 +- htdocs/public/opensurvey/index.php | 50 +++------------ htdocs/public/partnership/new.php | 34 +--------- htdocs/public/project/new.php | 36 +---------- htdocs/public/users/view.php | 7 +-- 14 files changed, 73 insertions(+), 327 deletions(-) diff --git a/htdocs/bookcal/admin/setup.php b/htdocs/bookcal/admin/setup.php index 8d3eab1bf67..c8f87937120 100644 --- a/htdocs/bookcal/admin/setup.php +++ b/htdocs/bookcal/admin/setup.php @@ -77,6 +77,7 @@ $formSetup = new FormSetup($db); // Setup conf BOOKCAL_PUBLIC_INTERFACE_TOPIC $item = $formSetup->newItem('BOOKCAL_PUBLIC_INTERFACE_TOPIC'); $item->defaultFieldValue = 'MyBigCompany public interface for Bookcal'; +$item->cssClass = 'minwidth300'; $setupnotempty = + count($formSetup->items); diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index e6cb3629b78..c5e6bac48e0 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -2741,18 +2741,21 @@ function addMailingEventTypeSQL($actioncode, $objcon, $filterobj) * * @param Societe $mysoc Third party * @param Translate $langs Output language - * @param int $publicpage 1=If header is for a public page + * @param string $showlogo '1'=Show logo or 'url' for click on logo + * @param string $alttext Text to show in header + * @param string $subimageconst Constant to check if we must add image under the main header * @param string $altlogo1 To use an alternative logo defined into setup (instead of company logo) * @param string $altlogo2 To use an alternative logo defined into setup (instead of company logo) * @return void */ -function htmlPrintOnlineHeader($mysoc, $langs, $publicpage = 1, $altlogo1 = '', $altlogo2 = '') +function htmlPrintOnlineHeader($mysoc, $langs, $showlogo = '1', $alttext = '', $subimageconst = '', $altlogo1 = '', $altlogo2 = '') { global $conf, $dolibarr_main_url_root; // Set logo of company by default $logosmall = $mysoc->logo_small; $logo = $mysoc->logo; + $publicpage = 1; // For the moment, we always use the public link if ($altlogo1 && getDolGlobalString($altlogo1)) { $logosmall = getDolGlobalString($altlogo1); @@ -2763,32 +2766,49 @@ function htmlPrintOnlineHeader($mysoc, $langs, $publicpage = 1, $altlogo1 = '', // Define $urllogo and $urllogofull $urllogo = ''; $urllogofull = ''; - if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) { - $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$logosmall); - $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); - } elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) { - $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/'.$logo); - $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); - } elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.svg')) { - $urllogo = DOL_URL_ROOT.'/theme/dolibarr_logo.svg'; - $urllogofull = $dolibarr_main_url_root.'/theme/dolibarr_logo.svg'; + if ($showlogo) { + if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) { + $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$logosmall); + $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); + } elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) { + $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/'.$logo); + $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); + } elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.svg')) { + $urllogo = DOL_URL_ROOT.'/theme/dolibarr_logo.svg'; + $urllogofull = $dolibarr_main_url_root.'/theme/dolibarr_logo.svg'; + } } print '
    '; // Output html code for logo - print '
    '; - print '
    '; - print ''; - print '
    '; - if (!getDolGlobalString('MAIN_HIDE_POWERED_BY')) { - print ''; + if ($urllogo || $alttext) { + print '
    '; + print '
    '; + if ($urllogo) { + if (!is_numeric($showlogo)) { + print ''; + } + print ''; + if (!is_numeric($showlogo)) { + print ''; + } + } + if ($alttext) { + print '
    '.$alttext.''; + } + print '
    '; + if (!getDolGlobalString('MAIN_HIDE_POWERED_BY')) { + print ''; + } + print '
    '; } - print '
    '; - if (getDolGlobalString('MEMBER_IMAGE_PUBLIC_REGISTRATION')) { - print '
    '; - print ''; + // MEMBER_IMAGE_PUBLIC_REGISTRATION + // OPENSURVEY_IMAGE_PUBLIC_INTERFACE + if (getDolGlobalString($subimageconst)) { + print '
    '; + print ''; print '
    '; } diff --git a/htdocs/core/lib/ticket.lib.php b/htdocs/core/lib/ticket.lib.php index ca0a33cb117..381cbbc4705 100644 --- a/htdocs/core/lib/ticket.lib.php +++ b/htdocs/core/lib/ticket.lib.php @@ -228,59 +228,12 @@ function generate_random_id($car = 16) */ function llxHeaderTicket($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) { - global $user, $conf, $langs, $mysoc; + global $conf, $langs, $mysoc; - $urllogo = ""; top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss, 0, 1); // Show html headers print ''; print '
    '; - print '
    '; - - // Define urllogo - if (getDolGlobalInt('TICKET_SHOW_COMPANY_LOGO') || getDolGlobalString('TICKET_PUBLIC_INTERFACE_TOPIC')) { - // Print logo - if (getDolGlobalInt('TICKET_SHOW_COMPANY_LOGO')) { - $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?modulepart=mycompany&entity='.$conf->entity.'&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?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$mysoc->logo); - } elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.svg')) { - $urllogo = DOL_URL_ROOT.'/theme/dolibarr_logo.svg'; - } - } - } - - // Output html code for logo - if ($urllogo || getDolGlobalString('TICKET_PUBLIC_INTERFACE_TOPIC')) { - print '
    '; - print '
    '; - if ($urllogo) { - print ''; - print ''; - print ''; - } - if (getDolGlobalString('TICKET_PUBLIC_INTERFACE_TOPIC')) { - print '
    '.(getDolGlobalString('TICKET_PUBLIC_INTERFACE_TOPIC') ? getDolGlobalString('TICKET_PUBLIC_INTERFACE_TOPIC') : $langs->trans("TicketSystem")).''; - } - print '
    '; - if (!getDolGlobalInt('MAIN_HIDE_POWERED_BY')) { - print ''; - } - print '
    '; - } - - if (getDolGlobalInt('TICKET_IMAGE_PUBLIC_INTERFACE')) { - print '
    '; - print ''; - print '
    '; - } - - print '
    '; - - //print '
    '; + htmlPrintOnlineHeader($mysoc, $langs, (getDolGlobalInt('TICKET_SHOW_COMPANY_LOGO') ? getDolGlobalString('TICKET_URL_PUBLIC_INTERFACE', dol_buildpath('/public/ticket/index.php?entity='.$conf->entity, 1)) : '0'), getDolGlobalString('TICKET_PUBLIC_INTERFACE_TOPIC', $langs->trans("TicketSystem")), 'TICKET_IMAGE_PUBLIC_INTERFACE'); } diff --git a/htdocs/langs/en_US/agenda.lang b/htdocs/langs/en_US/agenda.lang index 2a5f7247934..3da93f477e7 100644 --- a/htdocs/langs/en_US/agenda.lang +++ b/htdocs/langs/en_US/agenda.lang @@ -209,3 +209,4 @@ ReadMore = Read more ReadLess = Read less RecurringEvent=Recurring event EventPartOfARecurringSerie=Event is part of a recurring serie with ID %s +BookCalSystem=Online booking diff --git a/htdocs/opensurvey/class/opensurveysondage.class.php b/htdocs/opensurvey/class/opensurveysondage.class.php index ca28657af40..4abd7535b6f 100644 --- a/htdocs/opensurvey/class/opensurveysondage.class.php +++ b/htdocs/opensurvey/class/opensurveysondage.class.php @@ -126,7 +126,7 @@ class Opensurveysondage extends CommonObject 'allow_comments' => array('type' => 'integer', 'label' => 'Allowcomments', 'enabled' => '1', 'position' => 70, 'notnull' => 1, 'visible' => -1,), 'allow_spy' => array('type' => 'integer', 'label' => 'Allowspy', 'enabled' => '1', 'position' => 75, 'notnull' => 1, 'visible' => -1,), 'sujet' => array('type' => 'mediumtext', 'label' => 'Sujet', 'enabled' => '1', 'position' => 80, 'notnull' => 0, 'visible' => -1,), - 'id_sondage_admin' => array('type' => 'char(24)', 'label' => 'Idsondageadmin', 'enabled' => '1', 'position' => 85, 'notnull' => 0, 'visible' => -1,), + //'id_sondage_admin' => array('type' => 'char(24)', 'label' => 'Idsondageadmin', 'enabled' => '1', 'position' => 85, 'notnull' => 0, 'visible' => -1,), ); /** diff --git a/htdocs/opensurvey/lib/opensurvey.lib.php b/htdocs/opensurvey/lib/opensurvey.lib.php index ef82c0e0970..ef3d867ddca 100644 --- a/htdocs/opensurvey/lib/opensurvey.lib.php +++ b/htdocs/opensurvey/lib/opensurvey.lib.php @@ -77,8 +77,7 @@ function opensurvey_prepare_head(Opensurveysondage $object) */ function llxHeaderSurvey($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = [], $numsondage = '') { - global $conf, $langs, $mysoc; - global $dolibarr_main_url_root; + global $langs, $mysoc; // $replacemainarea = (empty($conf->dol_hide_leftmenu) ? '
    ' : '').'
    '; @@ -86,48 +85,17 @@ function llxHeaderSurvey($title, $head = "", $disablejs = 0, $disablehead = 0, $ print ''; + include_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; + htmlPrintOnlineHeader($mysoc, $langs, 'OPENSURVEY_IMAGE_PUBLIC_INTERFACE'); + print ''."\n"; print '
    '."\n"; + print ''."\n"; print ''; print ''."\n"; print "\n"; - // Show logo (search order: logo defined by PAYMENT_LOGO_suffix, then PAYMENT_LOGO, then small company logo, large company logo, theme logo, common logo) - // Define logo and logosmall - $logosmall = $mysoc->logo_small; - $logo = $mysoc->logo; - // print ''."\n"; - // Define urllogo - $urllogo = ''; - $urllogofull = ''; - if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) { - $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); - $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); - } elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) { - $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); - $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); - } - - // Output html code for logo - if ($urllogo) { - print '
    '; - print '
    '; - print ''; - print '
    '; - if (!getDolGlobalString('MAIN_HIDE_POWERED_BY')) { - print ''; - } - print '
    '; - } - - if (getDolGlobalString('OPENSURVEY_IMAGE_PUBLIC_INTERFACE')) { - print '
    '; - print ''; - print '
    '; - } - print '


    '; } diff --git a/htdocs/public/bookcal/index.php b/htdocs/public/bookcal/index.php index a32ebb84521..b5b32eba91a 100644 --- a/htdocs/public/bookcal/index.php +++ b/htdocs/public/bookcal/index.php @@ -147,46 +147,8 @@ function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $ print ''; - $urllogo = ''; - - // Define urllogo - if (getDolGlobalInt('BOOKCAL_SHOW_COMPANY_LOGO') || getDolGlobalString('BOOPKCAL_PUBLIC_INTERFACE_TOPIC')) { - // Print logo - if (getDolGlobalInt('BOOKCAL_SHOW_COMPANY_LOGO')) { - $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?modulepart=mycompany&entity='.$conf->entity.'&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?modulepart=mycompany&entity='.$conf->entity.'&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 - print '
    '; - print '
    '; - if ($urllogo) { - print ''; - print ''; - print ''; - } - if (getDolGlobalString('BOOKCAL_PUBLIC_INTERFACE_TOPIC')) { - print '
    '.(getDolGlobalString('BOOKCAL_PUBLIC_INTERFACE_TOPIC') ? getDolGlobalString('BOOKCAL_PUBLIC_INTERFACE_TOPIC') : $langs->trans("BookCalSystem")).''; - } - if (empty($urllogo) && ! getDolGlobalString('BOOKCAL_PUBLIC_INTERFACE_TOPIC')) { - print $mysoc->name; - } - print '
    '; - if (!getDolGlobalInt('MAIN_HIDE_POWERED_BY')) { - print ''; - } - print '
    '; - - print '
    '; + include_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; + htmlPrintOnlineHeader($mysoc, $langs, 1, getDolGlobalString('BOOKCAL_PUBLIC_INTERFACE_TOPIC', $langs->trans("BookCalSystem")), 'BOOKCAL_PUBLIC_INTERFACE_IMAGE'); print '
    '; } diff --git a/htdocs/public/company/new.php b/htdocs/public/company/new.php index 282f79b52c0..0fea42142e9 100644 --- a/htdocs/public/company/new.php +++ b/htdocs/public/company/new.php @@ -87,7 +87,7 @@ if (!isModEnabled('societe')) { } if (!getDolGlobalString('SOCIETE_ENABLE_PUBLIC')) { - httponly_accessforbidden("Online form for contact for public visitors has not been enabled"); + httponly_accessforbidden("Online form for contact for public visitors has not been enabled (option SOCIETE_ENABLE_PUBLIC)"); } @@ -127,38 +127,8 @@ function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $ 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) { // test always true - print '
    '; - print '
    '; - print ''; - print '
    '; - if (!getDolGlobalString('MAIN_HIDE_POWERED_BY')) { - print ''; - } - print '
    '; - // } - - if (getDolGlobalString('MEMBER_IMAGE_PUBLIC_REGISTRATION')) { - print '
    '; - print ''; - print '
    '; - } - - print '
    '; + include_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; + htmlPrintOnlineHeader($mysoc, $langs, 1, getDolGlobalString('THIRDPARTY_PUBLIC_INTERFACE_TOPIC'), 'THIRDPARTY_PUBLIC_INTERFACE_IMAGE'); print '
    '; } diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 96b2f9eced8..649c34bac72 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -131,38 +131,8 @@ function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $ 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 '
    '; + include_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; + htmlPrintOnlineHeader($mysoc, $langs, 1, getDolGlobalString('MEMBER_PUBLIC_INTERFACE'), 'MEMBER_IMAGE_PUBLIC_REGISTRATION'); print '
    '; } diff --git a/htdocs/public/onlinesign/newonlinesign.php b/htdocs/public/onlinesign/newonlinesign.php index 9a66a2fb826..fb78d229e3a 100644 --- a/htdocs/public/onlinesign/newonlinesign.php +++ b/htdocs/public/onlinesign/newonlinesign.php @@ -249,7 +249,7 @@ $title = $langs->trans("OnlineSignature"); $replacemainarea = (empty($conf->dol_hide_leftmenu) ? '
    ' : '').'
    '; llxHeader($head, $title, '', '', 0, 0, '', '', '', 'onlinepaymentbody', $replacemainarea, 1); -htmlPrintOnlineHeader($mysoc, $langs, 1, 'ONLINE_SIGN_LOGO_'.$suffix, 'ONLINE_SIGN_LOGO'); +htmlPrintOnlineHeader($mysoc, $langs, 1, '', 'ONLINE_SIGN_IMAGE_PUBLIC_INTERFACE', 'ONLINE_SIGN_LOGO_'.$suffix, 'ONLINE_SIGN_LOGO'); 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); diff --git a/htdocs/public/opensurvey/index.php b/htdocs/public/opensurvey/index.php index 58df00bdfec..ec1ee30db9d 100644 --- a/htdocs/public/opensurvey/index.php +++ b/htdocs/public/opensurvey/index.php @@ -113,6 +113,8 @@ if (getDolGlobalString('MAIN_OPENSURVEY_CSS_URL')) { $conf->dol_hide_topmenu = 1; $conf->dol_hide_leftmenu = 1; +$conf->global->OPENSURVEY_ENABLE_PUBLIC_INTERFACE = 1; + if (!getDolGlobalString('OPENSURVEY_ENABLE_PUBLIC_INTERFACE')) { $langs->load("errors"); print '
    '.$langs->trans('ErrorPublicInterfaceNotEnabled').'
    '; @@ -127,6 +129,10 @@ $replacemainarea = (empty($conf->dol_hide_leftmenu) ? '
    ' : '').'
    '; llxHeader($head, $langs->trans("Surveys"), '', '', 0, 0, '', '', '', 'onlinepaymentbody', $replacemainarea, 1, 1); +include_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; +htmlPrintOnlineHeader($mysoc, $langs, 1, getDolGlobalString('OPENSURVEY_PUBLIC_INTERFACE_TOPIC'), 'OPENSURVEY_IMAGE_PUBLIC_INTERFACE', 'ONLINE_OPENSURVEY_LOGO_'.$suffix, 'ONLINE_OPENSURVEY_LOGO'); + + print ''."\n"; print '
    '."\n"; print ''."\n"; @@ -137,47 +143,7 @@ print ''."\n"; print ''; print "\n"; -print ''."\n"; - -// Show logo (search order: logo defined by ONLINE_SIGN_LOGO_suffix, then ONLINE_SIGN_LOGO_, then small company logo, large company logo, theme logo, common logo) -// Define logo and logosmall -$logosmall = $mysoc->logo_small; -$logo = $mysoc->logo; -$paramlogo = 'ONLINE_OPENSURVEY_LOGO_'.$suffix; -if (getDolGlobalString($paramlogo)) { - $logosmall = getDolGlobalString($paramlogo); -} elseif (getDolGlobalString('ONLINE_OPENSURVEY_LOGO')) { - $logosmall = getDolGlobalString('ONLINE_OPENSURVEY_LOGO_'); -} -//print ''."\n"; -// Define urllogo -$urllogo = ''; -$urllogofull = ''; -if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) { - $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); - $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); -} elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) { - $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); - $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); -} -// Output html code for logo -if ($urllogo) { - print '
    '; - print '
    '; - print ''; - print '
    '; - if (!getDolGlobalString('MAIN_HIDE_POWERED_BY')) { - print ''; - } - print '
    '; -} - -if (getDolGlobalString('OPENSURVEY_IMAGE_PUBLIC_INTERFACE')) { - print '
    '; - print ''; - print '
    '; -} - +print ''."\n"; $results = $object->fetchAll($sortorder, $sortfield, 0, 0, '(status:=:1)'); $now = dol_now(); @@ -207,7 +173,7 @@ if (is_array($results)) { // Label print $langs->trans("Label").' : '; - print ''.dol_escape_htmltag($object->title).'
    '; + print ''.dol_escape_htmltag(empty($object->titre) ? $object->title : $object->titre).'
    '; // Date print $langs->trans("DateExpected").' : '; diff --git a/htdocs/public/partnership/new.php b/htdocs/public/partnership/new.php index 65dfd5a8c07..2dc3c80a62f 100644 --- a/htdocs/public/partnership/new.php +++ b/htdocs/public/partnership/new.php @@ -118,38 +118,8 @@ function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $ 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('PARTNERSHIP_IMAGE_PUBLIC_REGISTRATION')) { - print '
    '; - print ''; - print '
    '; - } - - print '
    '; + include_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; + htmlPrintOnlineHeader($mysoc, $langs, 1, getDolGlobalString('PARTNERSHIP_PUBLIC_INTERFACE_TOPIC'), 'PARTNERSHIP_IMAGE_PUBLIC_REGISTRATION'); print '
    '; } diff --git a/htdocs/public/project/new.php b/htdocs/public/project/new.php index 35dece5c502..dff11fef317 100644 --- a/htdocs/public/project/new.php +++ b/htdocs/public/project/new.php @@ -116,39 +116,8 @@ function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $ 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('PROJECT_IMAGE_PUBLIC_NEWLEAD')) { - print '
    '; - print ''; - print '
    '; - } - - print '
    '; + include_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; + htmlPrintOnlineHeader($mysoc, $langs, 1, getDolGlobalString('PROJECT_PUBLIC_INTERFACE_TOPIC'), 'PROJECT_IMAGE_PUBLIC_NEWLEAD'); print '
    '; } @@ -470,6 +439,7 @@ $extrafields->fetch_name_optionals_label($object->table_element); // fetch optio llxHeaderVierge($langs->trans("NewContact")); +print '
    '; print load_fiche_titre($langs->trans("NewContact"), '', '', 0, '', 'center'); diff --git a/htdocs/public/users/view.php b/htdocs/public/users/view.php index c8a79649e0a..20fee171c2f 100644 --- a/htdocs/public/users/view.php +++ b/htdocs/public/users/view.php @@ -274,6 +274,7 @@ print ''."\n"; print ''; print "\n"; + // Output html code for logo print '
    '; print '
    '; @@ -292,15 +293,9 @@ if (!getDolUserInt('USER_PUBLIC_HIDE_COMPANY', 0, $object)) { print '
    '; } - - print '
    '; -/*if (empty($conf->global->MAIN_HIDE_POWERED_BY)) { - print ''; -}*/ print '
    '; - if (getDolGlobalString('USER_IMAGE_PUBLIC_INTERFACE')) { print '
    '; print ''; From b936fa979c5344e572a1c55fff7851bb41660c92 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Tue, 8 Apr 2025 13:28:59 +0200 Subject: [PATCH 044/124] Add constant MAIN_PDF_SHOW_SOURCE_PHONE_MOBILE --- htdocs/core/lib/pdf.lib.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index bfb61c2178f..cecbf8f5e01 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -477,6 +477,10 @@ function pdf_build_address($outputlangs, $sourcecompany, $targetcompany = '', $t if ($sourcecompany->phone) { $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("PhoneShort").": ".$outputlangs->convToOutputCharset($sourcecompany->phone); } + // Phone mobile + if ($sourcecompany->phone_mobile && getDolGlobalString('MAIN_PDF_SHOW_SOURCE_PHONE_MOBILE')) { + $stringaddress .= ($stringaddress ? ($sourcecompany->phone ? " - " : "\n") : '').$outputlangs->transnoentities("PhoneShort").": ".$outputlangs->convToOutputCharset($sourcecompany->phone_mobile); + } // Fax if ($sourcecompany->fax) { $stringaddress .= ($stringaddress ? ($sourcecompany->phone ? " - " : "\n") : '').$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($sourcecompany->fax); From 24ab1f9d6b9590f8b55b8a2ba97c92dfa6c0fd4f Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Tue, 8 Apr 2025 13:47:44 +0200 Subject: [PATCH 045/124] Trans --- htdocs/langs/en_US/banks.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/banks.lang b/htdocs/langs/en_US/banks.lang index d437ca16b6c..b89ae8375e7 100644 --- a/htdocs/langs/en_US/banks.lang +++ b/htdocs/langs/en_US/banks.lang @@ -31,6 +31,7 @@ Reconciliation=Reconciliation RIB=Bank Account Number IBAN=IBAN number BIC=BIC/SWIFT code +CCI=Interbank code SwiftValid=BIC/SWIFT valid SwiftNotValid=BIC/SWIFT not valid IbanValid=BAN valid From 5cc439da790dd8d541a437b4c58ff5245f9caf8d Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Tue, 8 Apr 2025 13:51:35 +0200 Subject: [PATCH 046/124] Fix CI --- htdocs/core/lib/company.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index c5e6bac48e0..69d111fc900 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -2741,14 +2741,14 @@ function addMailingEventTypeSQL($actioncode, $objcon, $filterobj) * * @param Societe $mysoc Third party * @param Translate $langs Output language - * @param string $showlogo '1'=Show logo or 'url' for click on logo + * @param int|string $showlogo '1'=Show logo or 'url' for click on logo * @param string $alttext Text to show in header * @param string $subimageconst Constant to check if we must add image under the main header * @param string $altlogo1 To use an alternative logo defined into setup (instead of company logo) * @param string $altlogo2 To use an alternative logo defined into setup (instead of company logo) * @return void */ -function htmlPrintOnlineHeader($mysoc, $langs, $showlogo = '1', $alttext = '', $subimageconst = '', $altlogo1 = '', $altlogo2 = '') +function htmlPrintOnlineHeader($mysoc, $langs, $showlogo = 1, $alttext = '', $subimageconst = '', $altlogo1 = '', $altlogo2 = '') { global $conf, $dolibarr_main_url_root; From ce25da2337dd2c3abaf94462105321828aecec46 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Tue, 8 Apr 2025 13:53:10 +0200 Subject: [PATCH 047/124] Fix CI --- htdocs/opensurvey/class/opensurveysondage.class.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/opensurvey/class/opensurveysondage.class.php b/htdocs/opensurvey/class/opensurveysondage.class.php index 4abd7535b6f..7b3c98b22c8 100644 --- a/htdocs/opensurvey/class/opensurveysondage.class.php +++ b/htdocs/opensurvey/class/opensurveysondage.class.php @@ -155,6 +155,12 @@ class Opensurveysondage extends CommonObject */ public $fk_user_creat; + /** + * @var string title of survey + * @deprecated Rename the field titre into title into the table to allow to change this in fields and remove this declaration. + */ + public $titre; + /** * @var string title of survey */ From 58b081fc9d59823a29b12a3043f8f94886b98e14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Fali=C3=A8re?= <121813548+BenjaminFlr@users.noreply.github.com> Date: Tue, 8 Apr 2025 14:00:25 +0200 Subject: [PATCH 048/124] FIX: select supplier when creating object from project (#33766) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Related to #33765 Co-authored-by: Benjamin Falière --- htdocs/projet/card.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 485d1c74b0a..6d010e2090a 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -7,6 +7,7 @@ * Copyright (C) 2024 MDW * Copyright (C) 2024 Frédéric France * Copyright (C) 2024 Alexandre Spangaro + * 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 @@ -1717,9 +1718,9 @@ if ($action == 'create' && $user->hasRight('projet', 'creer')) { 10 => array('lang' => 'propal', 'enabled' => isModEnabled("propal"), 'perm' => $user->hasRight('propal', 'creer') ? true : false, 'label' => 'AddProp', 'url' => '/comm/propal/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), 20 => array('lang' => 'orders', 'enabled' => isModEnabled("order"), 'perm' => $user->hasRight('commande', 'creer') ? true : false, 'label' => 'CreateOrder', 'url' => '/commande/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), 30 => array('lang' => 'bills', 'enabled' => isModEnabled("invoice"), 'perm' => $user->hasRight('facture', 'creer') ? true : false, 'label' => 'CreateBill', 'url' => '/compta/facture/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), - 40 => array('lang' => 'supplier_proposal', 'enabled' => isModEnabled("supplier_proposal"), 'perm' => $user->hasRight('supplier_proposal', 'creer') ? true : false, 'label' => 'AddSupplierProposal', 'url' => '/supplier_proposal/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), - 50 => array('lang' => 'suppliers', 'enabled' => isModEnabled("supplier_order"), 'perm' => $user->hasRight('fournisseur', 'commande', 'creer') ? true : false, 'label' => 'AddSupplierOrder', 'url' => '/fourn/commande/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), - 60 => array('lang' => 'suppliers', 'enabled' => isModEnabled("supplier_invoice"), 'perm' => $user->hasRight('fournisseur', 'facture', 'creer') ? true : false, 'label' => 'AddSupplierInvoice', 'url' => '/fourn/facture/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), + 40 => array('lang' => 'supplier_proposal', 'enabled' => isModEnabled("supplier_proposal"), 'perm' => $user->hasRight('supplier_proposal', 'creer') ? true : false, 'label' => 'AddSupplierProposal', 'url' => '/supplier_proposal/card.php?action=create&projectid='.$object->id), + 50 => array('lang' => 'suppliers', 'enabled' => isModEnabled("supplier_order"), 'perm' => $user->hasRight('fournisseur', 'commande', 'creer') ? true : false, 'label' => 'AddSupplierOrder', 'url' => '/fourn/commande/card.php?action=create&projectid='.$object->id), + 60 => array('lang' => 'suppliers', 'enabled' => isModEnabled("supplier_invoice"), 'perm' => $user->hasRight('fournisseur', 'facture', 'creer') ? true : false, 'label' => 'AddSupplierInvoice', 'url' => '/fourn/facture/card.php?action=create&projectid='.$object->id), 70 => array('lang' => 'interventions', 'enabled' => isModEnabled("intervention"), 'perm' => $user->hasRight('fichinter', 'creer') ? true : false, 'label' => 'AddIntervention', 'url' => '/fichinter/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), 80 => array('lang' => 'contracts', 'enabled' => isModEnabled("contract"), 'perm' => $user->hasRight('contrat', 'creer') ? true : false, 'label' => 'AddContract', 'url' => '/contrat/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), 90 => array('lang' => 'trips', 'enabled' => isModEnabled("expensereport"), 'perm' => $user->hasRight('expensereport', 'creer') ? true : false, 'label' => 'AddTrip', 'url' => '/expensereport/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), From 79e761559267544a9771cc20a6bca23bbea22668 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Tue, 8 Apr 2025 14:08:58 +0200 Subject: [PATCH 049/124] Fix CI --- htdocs/ai/admin/custom_prompt.php | 5 +++-- htdocs/core/lib/pdf.lib.php | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/htdocs/ai/admin/custom_prompt.php b/htdocs/ai/admin/custom_prompt.php index 8149ec58b09..763a99d8653 100644 --- a/htdocs/ai/admin/custom_prompt.php +++ b/htdocs/ai/admin/custom_prompt.php @@ -250,8 +250,9 @@ if ($action == 'deleteproperty') { } if ($action == 'create') { - $out .= '
    '; + print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { @@ -1877,7 +1875,7 @@ while ($i < $imaxinloop) { print '
    '; // Picto + Ref print ''; // Warning $warnornote = ''; @@ -1894,7 +1892,7 @@ while ($i < $imaxinloop) { $filename = dol_sanitizeFileName($obj->ref); $filedir = $conf->propal->multidir_output[$obj->propal_entity].'/'.dol_sanitizeFileName($obj->ref); $urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->rowid; - print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); + print $formfile->getDocumentsLink($object->element, $filename, $filedir); print '
    '; - print $objectstatic->getNomUrl(1, '', '', 0, 1, (isset($conf->global->PROPAL_LIST_SHOW_NOTES) ? $conf->global->PROPAL_LIST_SHOW_NOTES : 1)); + print $object->getNomUrl(1, '', '', 0, 1, (isset($conf->global->PROPAL_LIST_SHOW_NOTES) ? $conf->global->PROPAL_LIST_SHOW_NOTES : 1)); print '
    '; print "\n"; @@ -2410,7 +2408,7 @@ while ($i < $imaxinloop) { // Status if (!empty($arrayfields['p.fk_statut']['checked'])) { - print ''.$objectstatic->getLibStatut(5).''; + print ''.$object->getLibStatut(5).''; if (!$i) { $totalarray['nbfield']++; } diff --git a/htdocs/core/tpl/extrafields_list_print_fields.tpl.php b/htdocs/core/tpl/extrafields_list_print_fields.tpl.php index 0d679c78fc4..c521292945a 100644 --- a/htdocs/core/tpl/extrafields_list_print_fields.tpl.php +++ b/htdocs/core/tpl/extrafields_list_print_fields.tpl.php @@ -69,7 +69,7 @@ if (!empty($extrafieldsobjectkey) && !empty($extrafields->attributes[$extrafield } // If field is a computed field, we make computation to get value if ($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key]) { - $objectoffield = $object; // For compatibility with the computed formula + $objectoffield = $object; // For compatibility with the computed formula. $objectoffield is exported by dol_eval(). $value = dol_eval((string) $extrafields->attributes[$extrafieldsobjectkey]['computed'][$key], 1, 1, '2'); if (is_numeric(price2num($value)) && $extrafields->attributes[$extrafieldsobjectkey]['totalizable'][$key]) { $obj->$tmpkey = price2num($value); From 7d8607cce5c178558e3d54ce9fd830ad4184042a Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Tue, 8 Apr 2025 18:18:05 +0200 Subject: [PATCH 055/124] NEW Module external website is deprecated. Replaced with menu editor. --- htdocs/admin/menus/edit.php | 117 +++++++------- htdocs/core/class/html.formadmin.class.php | 2 +- htdocs/core/class/menubase.class.php | 52 ++++--- htdocs/core/frames.php | 147 ++++++++++++++++++ htdocs/core/js/lib_head.js.php | 2 +- htdocs/core/menus/standard/eldy.lib.php | 11 +- htdocs/core/modules/modExternalSite.class.php | 2 +- htdocs/langs/en_US/admin.lang | 6 +- 8 files changed, 252 insertions(+), 87 deletions(-) create mode 100644 htdocs/core/frames.php diff --git a/htdocs/admin/menus/edit.php b/htdocs/admin/menus/edit.php index 81bcaf26a9a..5176b4a81ac 100644 --- a/htdocs/admin/menus/edit.php +++ b/htdocs/admin/menus/edit.php @@ -148,6 +148,7 @@ if ($action == 'add') { $menu->enabled = (string) GETPOST('enabled', 'alphanohtml'); $menu->perms = (string) GETPOST('perms', 'alphanohtml'); $menu->target = (string) GETPOST('target', 'alphanohtml'); + $menu->showtopmenuinframe = GETPOSTINT('showtopmenuinframe'); $menu->user = GETPOSTINT('user'); $menu->mainmenu = (string) GETPOST('propertymainmenu', 'alphanohtml'); if (is_numeric(GETPOST('menuIdParent', 'alphanohtml'))) { @@ -210,6 +211,8 @@ if ($action == 'update') { $menu->target = (string) GETPOST('target', 'alphanohtml'); $menu->user = GETPOSTINT('user'); $menu->mainmenu = (string) GETPOST('propertymainmenu', 'alphanohtml'); + $menu->showtopmenuinframe = GETPOSTINT('showtopmenuinframe'); + if (is_numeric(GETPOST('menuIdParent', 'alphanohtml'))) { $menu->fk_menu = (int) GETPOST('menuIdParent', 'alphanohtml'); } else { @@ -317,22 +320,22 @@ if ($action == 'create') { } // Handler - print ''.$langs->trans('MenuHandler').''; + print ''.$form->textwithpicto($langs->trans('MenuHandler'), $langs->trans('DetailMenuHandler')).''; print ''; $formadmin->select_menu_families($menu_handler.(preg_match('/_menu/', $menu_handler) ? '' : '_menu'), 'menu_handler', array_merge($dirstandard, $dirsmartphone)); print ''; - print ''.$langs->trans('DetailMenuHandler').''; + print ''; // User - print ''.$langs->trans('MenuForUsers').''; - print ''; print ''; print ''; print ''; print ''; print ajax_combobox('menuuser'); print ''; - print ''.$langs->trans('DetailUser').''; + print ''; // Type print ''.$langs->trans('Position').''; @@ -340,7 +343,7 @@ if ($action == 'create') { print $langs->trans('Left'); print ''; } else { - print ''; print ''; print ''; print ''; @@ -375,23 +378,31 @@ if ($action == 'create') { print ''.$langs->trans('LangFile').''; print ''.$langs->trans('DetailLangs').''; - // URL - print ''.$langs->trans('URL').''; - print ''.$langs->trans('DetailUrl').''; - - // Show URL into a frame - if (getDolGlobalString("MAIN_SHOW_TOP_MENU_URL_IN_FRAME")) { - print ''.$langs->trans('ShowTopMenuURLIntoAFrame').''; - print ''; - } - // Picto print ''.$langs->trans('Image').''; print ''.$langs->trans('Example').': fa-global'; + // URL + print ''.$langs->trans('URL').''; + print ''.$langs->trans('DetailUrl').''; + + // Target + print ''.$langs->trans('OpenLinkInto').''; + print ajax_combobox("target"); + print ''; + + // Show URL into a frame + if (getDolGlobalString("MAIN_FEATURE_TO_SHOW_TOP_MENU_URL_IN_FRAME")) { + print ''.$langs->trans('ShowTopMenuURLIntoAFrame').''; + print ''; + } + // Position print ''.$langs->trans('Position').''; - print ''.$langs->trans('DetailPosition').''; + print ''.$langs->trans('DetailPosition').''; // Enabled print ''.$langs->trans('Enabled').''; @@ -401,14 +412,6 @@ if ($action == 'create') { print ''.$langs->trans('Rights').''; print ''.$langs->trans('DetailRight').''; - // Target - print ''.$langs->trans('Target').''; - print ajax_combobox("target"); - print ''.$langs->trans('DetailTarget').''; - print ''; print '
    '; @@ -437,10 +440,10 @@ if ($action == 'create') { //var_dump($menu); // Id - print ''.$langs->trans('Id').''.$menu->id.''.$langs->trans('DetailId').''; + print ''.$form->textwithpicto($langs->trans('MenuID'), $langs->trans('DetailId')).''.$menu->id.''; // Module - print ''.$langs->trans('MenuModule').''.(empty($menu->module) ? 'Core' : $menu->module).''.$langs->trans('DetailMenuModule').''; + print ''.$form->textwithpicto($langs->trans('MenuModule'), $langs->trans('DetailMenuModule')).''.(empty($menu->module) ? 'Core' : $menu->module).''; // Handler if ($menu->menu_handler == 'all') { @@ -448,7 +451,8 @@ if ($action == 'create') { } else { $handler = $menu->menu_handler; } - print ''.$langs->trans('MenuHandler').''.$handler.''.$langs->trans('DetailMenuHandler').''; + print ''.$form->textwithpicto($langs->trans('MenuHandler'), $langs->transnoentitiesnoconv("DetailMenuHandler")).''.$handler.''; + print ''; // User print ''.$langs->trans('MenuForUsers').''; @@ -462,26 +466,23 @@ if ($action == 'create') { // Type print ''.$langs->trans('Position').''; - print ''.$langs->trans(ucfirst($menu->type)).''.$langs->trans('DetailType').''; + print ''.$langs->trans(ucfirst($menu->type)); + print ''; + print ''; + print $langs->transnoentitiesnoconv("DetailType"); + print ''; // Mainmenu code if ($menu->type == 'top') { print ''.$langs->trans('MainMenuCode').''; - /*if ($parent_rowid) - { - print ''.$parent_rowid.''; - } - else - {*/ print 'mainmenu).'">'; - //} print ''; print $langs->trans("Example").': mytopmenukey'; print ''; } // MenuId Parent - print ''.$langs->trans('MenuIdParent'); + print ''.$langs->trans('MenuIdParent'); print ''; $valtouse = $menu->fk_menu; if ($menu->fk_mainmenu) { @@ -506,18 +507,8 @@ if ($action == 'create') { print ''.$langs->trans('LangFile').''; print ''.$langs->trans('DetailLangs').''; - // URL - print ''.$langs->trans('URL').''; - print ''.$langs->trans('DetailUrl').''; - - // Show URL into a frame - if (getDolGlobalString("MAIN_SHOW_TOP_MENU_URL_IN_FRAME")) { - print ''.$langs->trans('ShowTopMenuURLIntoAFrame').''; - print 'showtopmenuinframe ? ' checked="checked"' : '').'">'; - } - // Picto - print ''.$langs->trans('Image').''; + print ''.$langs->trans('Image').''; print ''.$langs->trans('Example').': fa-global-america'; print ''; print '     '; @@ -525,9 +516,28 @@ if ($action == 'create') { print ''; print ''; + // URL + print ''.$langs->trans('URL').''; + print ''.$langs->trans('DetailUrl').''; + + // Target + print ''.$langs->trans('OpenLinkInto').''; + print ''; + print ajax_combobox("target"); + print ''; + + // Show URL into a frame + if (getDolGlobalString("MAIN_FEATURE_TO_SHOW_TOP_MENU_URL_IN_FRAME") && $menu->type == 'top') { + print ''.$langs->trans('ShowTopMenuURLIntoAFrame').''; + print 'showtopmenuinframe ? ' checked="checked"' : '').'">'; + } + // Position print ''.$langs->trans('Position').''; - print ''.$langs->trans('DetailPosition').''; + print ''.$langs->trans('DetailPosition').''; // Enabled print ''.$langs->trans('Enabled').''; @@ -545,15 +555,6 @@ if ($action == 'create') { } print ''; - // Target - print ''.$langs->trans('Target').''; - print ''; - print ajax_combobox("target"); - print ''.$langs->trans('DetailTarget').''; - print ''; print '
    '; diff --git a/htdocs/core/class/html.formadmin.class.php b/htdocs/core/class/html.formadmin.class.php index 082cbe5dcb4..0b7c7f0ecd4 100644 --- a/htdocs/core/class/html.formadmin.class.php +++ b/htdocs/core/class/html.formadmin.class.php @@ -356,7 +356,7 @@ class FormAdmin ksort($menuarray); // Show combo list of menu handlers - print ''; foreach ($menuarray as $key => $val) { $tab = explode('_', $key); print '