From 973a2ede9769a48d7b8783cf51b62c7f6c96c2f3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 10 Aug 2023 11:35:19 +0200 Subject: [PATCH 001/120] Fix syntax error --- htdocs/core/modules/propale/doc/pdf_azur.modules.php | 9 --------- 1 file changed, 9 deletions(-) diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 878c8d6cef0..e5e2adf4947 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -1478,19 +1478,10 @@ class pdf_azur extends ModelePDFPropales if ($this->emetteur->logo) { $logodir = $conf->mycompany->dir_output; -<<<<<<< HEAD - if (! empty($conf->mycompany->multidir_output[$object->entity])) $logodir = $conf->mycompany->multidir_output[$object->entity]; - if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO)) - { - $logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small; - } - else { -======= if (!empty($conf->mycompany->multidir_output[$object->entity])) $logodir = $conf->mycompany->multidir_output[$object->entity]; if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO)) { $logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small; } else { ->>>>>>> branch '10.0' of git@github.com:Dolibarr/dolibarr.git $logo = $logodir.'/logos/'.$this->emetteur->logo; } if (is_readable($logo)) From 74faf3547e15981a99f5a0a9f257e431410aecb9 Mon Sep 17 00:00:00 2001 From: William Mead Date: Mon, 20 Nov 2023 20:16:08 +0100 Subject: [PATCH 002/120] Fixed total service quantity. Added contributor details. (#26761) Co-authored-by: William Mead --- htdocs/contrat/services_list.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/contrat/services_list.php b/htdocs/contrat/services_list.php index 859bf4b62b0..86b5ec5a3ff 100644 --- a/htdocs/contrat/services_list.php +++ b/htdocs/contrat/services_list.php @@ -6,6 +6,7 @@ * Copyright (C) 2018 Ferran Marcet * Copyright (C) 2018 Frédéric France * Copyright (C) 2019 Juanjo Menent + * Copyright (C) 2023 William Mead * * 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 @@ -815,9 +816,6 @@ while ($i < min($num, $limit)) { if (!$i) { $totalarray['pos'][$totalarray['nbfield']] = 'cd.qty'; } - if (!$i) { - $totalarray['val']['cd.qty'] = $obj->qty; - } $totalarray['val']['cd.qty'] += $obj->qty; } if (!empty($arrayfields['cd.total_ht']['checked'])) { From 7e9947a3e6bcdd0e364bba7d77764224e8dfcc84 Mon Sep 17 00:00:00 2001 From: Saami PERDRIX <142794129+atm-saamiperdrix@users.noreply.github.com> Date: Mon, 20 Nov 2023 20:17:44 +0100 Subject: [PATCH 003/120] FIX php8 fatal on edit supplier order when multicurrency is activated (#26758) --- htdocs/fourn/commande/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 6d28b7bbaed..c9e5e8f4fee 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -787,7 +787,7 @@ if (empty($reshook)) { } $ttc = price2num(GETPOST('price_ttc'), '', 2); - $ht = $ttc / (1 + ($vatratecleaned / 100)); + $ht = (float) $ttc / (1 + ($vatratecleaned / 100)); $price_base_type = 'HT'; } From bca057afe53a343c2039bcea0940bcadde70fd8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 20 Nov 2023 20:18:09 +0100 Subject: [PATCH 004/120] Fix #26740 (#26752) https://github.com/Dolibarr/dolibarr/issues/26740 need $langs --- htdocs/core/ajax/objectonoff.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/htdocs/core/ajax/objectonoff.php b/htdocs/core/ajax/objectonoff.php index 5166ba52b52..0818dc823a4 100644 --- a/htdocs/core/ajax/objectonoff.php +++ b/htdocs/core/ajax/objectonoff.php @@ -36,9 +36,6 @@ if (!defined('NOREQUIREAJAX')) { if (!defined('NOREQUIRESOC')) { define('NOREQUIRESOC', '1'); } -if (!defined('NOREQUIRETRAN')) { - define('NOREQUIRETRAN', '1'); -} // Load Dolibarr environment require '../../main.inc.php'; From 02eadb29fc4e1bc55b9796a3d2f80e9b372cbbe5 Mon Sep 17 00:00:00 2001 From: William Mead Date: Mon, 20 Nov 2023 20:19:43 +0100 Subject: [PATCH 005/120] FIX #25458 intervention localizations (backport v17) (#26757) * Fix reopen button localization. Added contributor details. * Added EN done localization * Added FR done localization --------- Co-authored-by: William Mead --- htdocs/fichinter/card.php | 5 +++-- htdocs/langs/en_US/main.lang | 3 ++- htdocs/langs/fr_FR/main.lang | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 484be30b5ce..349139e69ff 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -9,6 +9,7 @@ * Copyright (C) 2015-2016 Abbes Bahfir * Copyright (C) 2018-2022 Philippe Grand * Copyright (C) 2020 Frédéric France + * Copyright (C) 2023 William Mead * * 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 @@ -1623,9 +1624,9 @@ if ($action == 'create') { // Reopen if ($object->statut >= Fichinter::STATUS_CLOSED) { if ($user->rights->ficheinter->creer) { - print ''; + print ''; } else { - print ''; + print ''; } } diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index fb3aee34fc8..95d77fa471e 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -545,6 +545,7 @@ Reportings=Reporting Draft=Draft Drafts=Drafts StatusInterInvoiced=Invoiced +Done=Done Validated=Validated ValidatedToProduce=Validated (To produce) Opened=Open @@ -1219,4 +1220,4 @@ ExternalUser=External user NoSpecificContactAddress=No specific contact or address NoSpecificContactAddressBis=This tab is dedicated to force specific contacts or addresses for the current object. Use it only if you want to define one or several specific contacts or addresses for the object when the information on the thirdparty is not enough or not accurate. TreeView=Tree view -DateOfPrinting=Date of printing \ No newline at end of file +DateOfPrinting=Date of printing diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index 85768a68a70..2587fb3ffc4 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -543,6 +543,7 @@ Reportings=Rapports Draft=Brouillon Drafts=Brouillons StatusInterInvoiced=Facturé +Done=Réalisé Validated=Validé ValidatedToProduce=Validé (à produire) Opened=Ouvert From 8eb2383003ced1a939c25ffb742a8cae23839fbd Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 20 Nov 2023 20:39:40 +0100 Subject: [PATCH 006/120] NEW Suggest root path configurations in conf.php.example (#26609) * NEW Suggest root path configurations in conf.php.example * Suggest dynamic path configuration in comment, not in actual code --- htdocs/conf/conf.php.example | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/htdocs/conf/conf.php.example b/htdocs/conf/conf.php.example index 5325523f8e5..39c6fa156f8 100644 --- a/htdocs/conf/conf.php.example +++ b/htdocs/conf/conf.php.example @@ -36,6 +36,7 @@ $dolibarr_main_url_root=''; // Examples: // $dolibarr_main_document_root='/var/www/dolibarr/htdocs'; // $dolibarr_main_document_root='C:/My web sites/dolibarr/htdocs'; +// $dolibarr_main_document_root=realpath(__DIR__.'/..'); // $dolibarr_main_document_root=''; @@ -44,7 +45,7 @@ $dolibarr_main_document_root=''; // ========================== // This parameter defines the relative sub URLs to add to $dolibarr_main_url_root to // forge alternative root directories (used by modules developers). -// You can put several values, separated by a coma, but number of entries must match +// You can put several values, separated by a comma, but number of entries must match // number of entries into $dolibarr_main_document_root_alt. // // Examples: @@ -57,7 +58,7 @@ $dolibarr_main_document_root=''; // dolibarr_main_document_root_alt // =============================== // This parameter contains absolute alternative root file system directories (used by modules developers). -// You can put several values, separated by a coma, but number of entries must match +// You can put several values, separated by a comma, but number of entries must match // number of entries into $dolibarr_main_url_root_alt. // // Examples: @@ -75,6 +76,7 @@ $dolibarr_main_document_root=''; // Examples: // $dolibarr_main_data_root='/var/www/dolibarr/documents'; // $dolibarr_main_data_root='E:/My web sites/dolibarr/documents'; +// $dolibarr_main_data_root=realpath(__DIR__.'/../../documents'); // $dolibarr_main_data_root=''; @@ -173,7 +175,7 @@ $dolibarr_main_db_collation='utf8_unicode_ci'; // dolibarr_main_db_readonly // ========================= -// Set this to 1 to have the application working in readonly mode. All SQL commands INSERT/UPDATE/DELETE/CREATE/ALTER/TRUNCATE/DROP will be disabled. +// Set this to 1 to have the application working in readonly mode. All SQL commands INSERT/UPDATE/DELETE/CREATE/ALTER/TRUNCATE/DROP will be disabled. // Default value: 0 // Examples: // $dolibarr_main_db_readonly='0'; @@ -256,8 +258,8 @@ $dolibarr_main_authentication='dolibarr'; // 'https://my.domain.com' = Force redirect to https using this domain name. // Warning: If you enable this parameter, your web server must be configured to respond URL with https protocol. // According to your web server setup, some values may works and other not. Try different values (1,2 or 'https://my.domain.com') if you experience problems. -// Even if a redirect to HTTPS is forced by the webserver, it is recommanded to set this value to another value than 0, so your session cookies will be -// flagged as secured. +// Even if a redirect to HTTPS is forced by the webserver, it is recommended to set this value to another value than 0, so your session cookies will be +// flagged as secured. // Default value: 0 // Possible values: 0, 1, 2 or 'https://my.domain.com' // Examples: @@ -361,7 +363,7 @@ $dolibarr_cron_allow_cli='0'; // ========================= // If this value is set to a value, it forces the creation of a file install.lock once an upgrade process into a new version end. // The value is the octal value of permission to set on created file. -// The file install.lock prevents the use of the migration process another time. You will have to delete it manually for +// The file install.lock prevents the use of the migration process another time. You will have to delete it manually for // next upgrade. // Default value: '0' // Example: '444'; @@ -375,7 +377,7 @@ $dolibarr_cron_allow_cli='0'; // dolibarr_main_db_prefix // ======================= -// This parameter contains prefix of Dolibarr database. +// This parameter contains prefix of Dolibarr database. // Default value: 'llx_' if not defined // Examples: // $dolibarr_main_db_prefix='llx_'; From 88522b070697ab63630260250b51c78773c3603d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 Nov 2023 21:28:43 +0100 Subject: [PATCH 007/120] Fix css --- htdocs/expedition/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 40c8191043a..b73235d9f9f 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -940,8 +940,8 @@ while ($i < min($num, $limit)) { // Ref customer if (!empty($arrayfields['e.ref_customer']['checked'])) { - print ""; - print $obj->ref_customer; + print ''; + print dol_escape_htmltag($obj->ref_customer); print "\n"; if (!$i) { $totalarray['nbfield']++; From 7e20669b8c4a22f1af3bdd6e7f6a2ef7931ea7ec Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 Nov 2023 21:30:28 +0100 Subject: [PATCH 008/120] css --- htdocs/expedition/list.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index b73235d9f9f..640a73330ef 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -918,7 +918,7 @@ while ($i < min($num, $limit)) { // Action column if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { - print ''; + print ''; if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined $selected = 0; if (in_array($obj->rowid, $arrayofselected)) { @@ -969,7 +969,7 @@ while ($i < min($num, $limit)) { // Zip if (!empty($arrayfields['s.zip']['checked'])) { print ''; - print $obj->zip; + print dol_escape_htmltag($obj->zip); print ''; if (!$i) { $totalarray['nbfield']++; @@ -986,7 +986,7 @@ while ($i < min($num, $limit)) { if (!empty($arrayfields['country.code_iso']['checked'])) { print ''; $tmparray = getCountry($obj->fk_pays, 'all'); - print $tmparray['label']; + print dol_escape_htmltag($tmparray['label']); print ''; if (!$i) { $totalarray['nbfield']++; @@ -1111,7 +1111,7 @@ while ($i < min($num, $limit)) { // Action column if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { - print ''; + print ''; if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined $selected = 0; if (in_array($obj->rowid, $arrayofselected)) { From c1aefa75a74344f078c44df90c02e77f030497d1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 Nov 2023 21:47:48 +0100 Subject: [PATCH 009/120] FIX delivery note disappear after generation --- htdocs/core/lib/functions.lib.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 34b84dc24af..a5c96292a5e 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -210,10 +210,11 @@ function isModEnabled($module) // Fix special cases $arrayconv = array( - 'project' => 'projet', - 'contract' => 'contrat', 'bank' => 'banque', - 'category' => 'categorie' + 'category' => 'categorie', + 'contract' => 'contrat', + 'project' => 'projet', + 'delivery_note' => 'expedition' ); if (empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) { $arrayconv['supplier_order'] = 'fournisseur'; From 058f688522e02b6d810cd0cdbf3da8036053a777 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Mon, 20 Nov 2023 23:47:46 +0100 Subject: [PATCH 010/120] FIX: double hook and paging search param in product list (#26767) * fix double hook in product list * Fix search param --- htdocs/product/list.php | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 7191a15b607..c8295800dcc 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -739,10 +739,10 @@ foreach ($searchCategoryProductList as $searchCategoryProduct) { $param .= "&search_category_product_list[]=".urlencode($searchCategoryProduct); } if ($search_ref) { - $param = "&search_ref=".urlencode($search_ref); + $param .= "&search_ref=".urlencode($search_ref); } if ($search_ref_supplier) { - $param = "&search_ref_supplier=".urlencode($search_ref_supplier); + $param .= "&search_ref_supplier=".urlencode($search_ref_supplier); } if ($search_barcode) { $param .= ($search_barcode ? "&search_barcode=".urlencode($search_barcode) : ""); @@ -760,7 +760,7 @@ if ($search_tobuy != '') { $param .= "&search_tobuy=".urlencode($search_tobuy); } if ($search_tobatch) { - $param = "&search_tobatch=".urlencode($search_tobatch); + $param .= "&search_tobatch=".urlencode($search_tobatch); } if ($search_country != '') { $param .= "&search_country=".urlencode($search_country); @@ -769,7 +769,7 @@ if ($search_state != '') { $param .= "&search_state=".urlencode($search_state); } if ($search_vatrate) { - $param = "&search_vatrate=".urlencode($search_vatrate); + $param .= "&search_vatrate=".urlencode($search_vatrate); } if ($fourn_id > 0) { $param .= "&fourn_id=".urlencode($fourn_id); @@ -784,25 +784,25 @@ if ($search_type != '') { $param .= '&search_type='.urlencode($search_type); } if ($search_accountancy_code_sell) { - $param = "&search_accountancy_code_sell=".urlencode($search_accountancy_code_sell); + $param .= "&search_accountancy_code_sell=".urlencode($search_accountancy_code_sell); } if ($search_accountancy_code_sell_intra) { - $param = "&search_accountancy_code_sell_intra=".urlencode($search_accountancy_code_sell_intra); + $param .= "&search_accountancy_code_sell_intra=".urlencode($search_accountancy_code_sell_intra); } if ($search_accountancy_code_sell_export) { - $param = "&search_accountancy_code_sell_export=".urlencode($search_accountancy_code_sell_export); + $param .= "&search_accountancy_code_sell_export=".urlencode($search_accountancy_code_sell_export); } if ($search_accountancy_code_buy) { - $param = "&search_accountancy_code_buy=".urlencode($search_accountancy_code_buy); + $param .= "&search_accountancy_code_buy=".urlencode($search_accountancy_code_buy); } if ($search_accountancy_code_buy_intra) { - $param = "&search_accountancy_code_buy_intra=".urlencode($search_accountancy_code_buy_intra); + $param .= "&search_accountancy_code_buy_intra=".urlencode($search_accountancy_code_buy_intra); } if ($search_accountancy_code_buy_export) { - $param = "&search_accountancy_code_buy_export=".urlencode($search_accountancy_code_buy_export); + $param .= "&search_accountancy_code_buy_export=".urlencode($search_accountancy_code_buy_export); } if ($search_finished) { - $param = "&search_finished=".urlencode($search_finished); + $param .= "&search_finished=".urlencode($search_finished); } // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; @@ -932,9 +932,6 @@ if (empty($reshook)) { if (!empty($moreforfilter)) { print '
'; print $moreforfilter; - $parameters = array(); - $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; print '
'; } From 37a9eed4718b962a8bbfd84f1a71abf56ec54d98 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 Nov 2023 11:19:38 +0100 Subject: [PATCH 011/120] FIX Email reminder template must not be visible when option is off --- htdocs/comm/action/card.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index a6c00785c31..2b3aae73a4d 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1587,17 +1587,23 @@ if ($action == 'create') { $("#selectremindertype").select2(); $("#select_offsetunittype_duration").select2("destroy"); $("#select_offsetunittype_duration").select2(); + selectremindertype(); }); $("#selectremindertype").change(function(){ - console.log("Change on selectremindertype"); + selectremindertype(); + }); + + function selectremindertype() { + console.log("Call selectremindertype"); var selected_option = $("#selectremindertype option:selected").val(); if(selected_option == "email") { $("#select_actioncommsendmodel_mail").closest("tr").show(); } else { $("#select_actioncommsendmodel_mail").closest("tr").hide(); } - }); + } + })'; print ''."\n"; } From 15514b2dccfda3e77888f1f88b7b82f4e9624d52 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 Nov 2023 11:57:55 +0100 Subject: [PATCH 012/120] Missing trans --- htdocs/admin/agenda_reminder.php | 3 +++ htdocs/langs/en_US/cron.lang | 1 + 2 files changed, 4 insertions(+) diff --git a/htdocs/admin/agenda_reminder.php b/htdocs/admin/agenda_reminder.php index 42967b4f275..e147c568671 100644 --- a/htdocs/admin/agenda_reminder.php +++ b/htdocs/admin/agenda_reminder.php @@ -233,6 +233,9 @@ if (!isModEnabled('cron')) { } else { print ''.img_picto($langs->trans('Enabled'), 'switch_on').''; } + } else { + $langs->load("cron"); + print ''.$langs->trans("JobNotFound", $langs->transnoentitiesnoconv("sendEmailsReminder")).''; } } } diff --git a/htdocs/langs/en_US/cron.lang b/htdocs/langs/en_US/cron.lang index ccaa67bddf8..505ce1a6c70 100644 --- a/htdocs/langs/en_US/cron.lang +++ b/htdocs/langs/en_US/cron.lang @@ -91,6 +91,7 @@ WarningCronDelayed=Attention, for performance purpose, whatever is next date of DATAPOLICYJob=Data cleaner and anonymizer JobXMustBeEnabled=Job %s must be enabled EmailIfError=Email for warning on error +JobNotFound=Job %s not found in list of jobs (try to disable/enabled module) ErrorInBatch=Error when running the job %s # Cron Boxes From f755ad51ab681534beffd04de534324a317ce426 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 Nov 2023 12:17:30 +0100 Subject: [PATCH 013/120] Fix log --- htdocs/comm/action/class/actioncomm.class.php | 8 +++++++- htdocs/compta/facture/class/facture.class.php | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index be07e9a45b7..69bc112e081 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -2488,7 +2488,7 @@ class ActionComm extends CommonObject $now = dol_now(); $actionCommReminder = new ActionCommReminder($this->db); - dol_syslog(__METHOD__, LOG_DEBUG); + dol_syslog(__METHOD__." start", LOG_INFO); $this->db->begin(); @@ -2618,10 +2618,16 @@ class ActionComm extends CommonObject if (!$error) { $this->output = 'Nb of emails sent : '.$nbMailSend; $this->db->commit(); + + dol_syslog(__METHOD__." end - ".$this->output, LOG_INFO); + return 0; } else { $this->db->commit(); // We commit also on error, to have the error message recorded. $this->error = 'Nb of emails sent : '.$nbMailSend.', '.(!empty($errorsMsg)) ? join(', ', $errorsMsg) : $error; + + dol_syslog(__METHOD__." end - ".$this->error, LOG_INFO); + return $error; } } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 5a9b711aff7..d9e9bef3f73 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -5695,7 +5695,7 @@ class Facture extends CommonInvoice $tmpinvoice = new Facture($this->db); - dol_syslog(__METHOD__, LOG_DEBUG); + dol_syslog(__METHOD__." start", LOG_INFO); // Select all action comm reminder $sql = "SELECT rowid as id FROM ".MAIN_DB_PREFIX."facture as f"; @@ -5935,9 +5935,15 @@ class Facture extends CommonInvoice if (!$error) { $this->output .= 'Nb of emails sent : '.$nbMailSend; + + dol_syslog(__METHOD__." end - ".$this->output, LOG_INFO); + return 0; } else { $this->error = 'Nb of emails sent : '.$nbMailSend.', '.(!empty($errorsMsg)) ? join(', ', $errorsMsg) : $error; + + dol_syslog(__METHOD__." end - ".$this->error, LOG_INFO); + return $error; } } From 57de87098929dd283621037392074945333c2ba7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 Nov 2023 16:20:21 +0100 Subject: [PATCH 014/120] FIX Test on permission for holiday tooltips --- htdocs/core/lib/security.lib.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 2c6bd359534..2f4d4fe2f83 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -1102,16 +1102,14 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl $useridtocheck = 0; if ($feature == 'holiday') { $useridtocheck = $object->fk_user; - if (!in_array($object->fk_user, $childids) && !in_array($object->fk_validator, $childids)) { + if (!$user->hasRight('holiday', 'readall') && !in_array($useridtocheck, $childids) && !in_array($object->fk_validator, $childids)) { return false; } } if ($feature == 'expensereport') { $useridtocheck = $object->fk_user_author; - if (!$user->rights->expensereport->readall) { - if (!in_array($useridtocheck, $childids)) { - return false; - } + if (!$user->hasRight('expensereport', 'readall') && !in_array($useridtocheck, $childids)) { + return false; } } } From 6eec24a2c40cf631957831cee219fc978403f947 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 Nov 2023 16:33:42 +0100 Subject: [PATCH 015/120] Fix CSS --- htdocs/core/class/html.form.class.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 9e7ab1a9947..de4f667b419 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -9896,6 +9896,13 @@ class Form $disableline = 1; } + $label = $obj->name; + $labelhtml = $obj->name; + if (isModEnabled('multicompany') && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1) { + $label .= " (" . $obj->label . ")"; + $labelhtml .= ' (' . $obj->label . ')'; + } + $out .= ''; $i++; From 4129813564a225e60f6caa6ef20be9e773ed8f89 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 Nov 2023 17:07:10 +0100 Subject: [PATCH 016/120] Fix missing parameter $filter --- htdocs/core/class/html.form.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 1081249bf91..c9c3e09f634 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -7671,10 +7671,11 @@ class Form * @param int $outputmode 0=HTML select string, 1=Array * @param int $disabled 1=Html component is disabled * @param string $sortfield Sort field + * @param string $filter Add more filter * @return string|array Return HTML string * @see selectForForms() */ - public function selectForFormsList($objecttmp, $htmlname, $preselectedvalue, $showempty = '', $searchkey = '', $placeholder = '', $morecss = '', $moreparams = '', $forcecombo = 0, $outputmode = 0, $disabled = 0, $sortfield = '') + public function selectForFormsList($objecttmp, $htmlname, $preselectedvalue, $showempty = '', $searchkey = '', $placeholder = '', $morecss = '', $moreparams = '', $forcecombo = 0, $outputmode = 0, $disabled = 0, $sortfield = '', $filter = '') { global $conf, $langs, $user, $hookmanager; From 315e3b48044072d2050332f59c8d3dd60cf67b69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 21 Nov 2023 23:38:30 +0100 Subject: [PATCH 017/120] fix phpstan (#26783) --- htdocs/webservices/server_productorservice.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/webservices/server_productorservice.php b/htdocs/webservices/server_productorservice.php index fb47113897a..ba8b019d1ab 100644 --- a/htdocs/webservices/server_productorservice.php +++ b/htdocs/webservices/server_productorservice.php @@ -1,7 +1,7 @@ * Copyright (C) 2012 JF FERRY - * Copyright (C) 2020 Frédéric France + * Copyright (C) 2020-2023 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 @@ -362,7 +362,7 @@ $server->register( * @param string $lang Lang to force * @return mixed */ -function getProductOrService($authentication, $id = '', $ref = '', $ref_ext = '', $lang = '') +function getProductOrService($authentication, $id = 0, $ref = '', $ref_ext = '', $lang = '') { global $db, $conf, $langs; @@ -981,7 +981,7 @@ function getListOfProductsOrServices($authentication, $filterproduct) * * @param array $authentication Array of authentication information * @param int $id Category id - * @param Translate $lang Force lang + * @param string $lang Force lang * @return array Array result */ function getProductsForCategory($authentication, $id, $lang = '') From 91a2ae578e25223d55a26945ad93b3f6bd65c444 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 21 Nov 2023 23:39:29 +0100 Subject: [PATCH 018/120] fix phpstan (#26782) --- .../core/modules/member/modules_member.class.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/htdocs/core/modules/member/modules_member.class.php b/htdocs/core/modules/member/modules_member.class.php index 476b9d848aa..5b55c675364 100644 --- a/htdocs/core/modules/member/modules_member.class.php +++ b/htdocs/core/modules/member/modules_member.class.php @@ -71,6 +71,8 @@ abstract class ModeleNumRefMembers extends CommonNumRefGenerator public $code_null; // + public $code_auto; + /** * Return description of module parameters @@ -117,4 +119,16 @@ abstract class ModeleNumRefMembers extends CommonNumRefGenerator return $s; } + + /** + * Return next value + * + * @param Societe $objsoc Object third party + * @param Adherent $object Object we need next value for + * @return string next value + */ + public function getNextValue($objsoc, $object) + { + return ''; + } } From 8a19e2f2512c244a5df193f59a4da784303f9764 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 21 Nov 2023 23:39:52 +0100 Subject: [PATCH 019/120] fix phpstan (#26781) --- htdocs/webservices/server_invoice.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/webservices/server_invoice.php b/htdocs/webservices/server_invoice.php index d9f44781f87..2dbf66edd9c 100644 --- a/htdocs/webservices/server_invoice.php +++ b/htdocs/webservices/server_invoice.php @@ -305,7 +305,7 @@ $server->register( * @param string $ref_ext Ref_ext * @return array Array result */ -function getInvoice($authentication, $id = '', $ref = '', $ref_ext = '') +function getInvoice($authentication, $id = 0, $ref = '', $ref_ext = '') { global $db, $conf; From b8a4181748d8375bcf5d3787c0fa77cb73ca56cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 21 Nov 2023 23:40:43 +0100 Subject: [PATCH 020/120] delete unused code (fix phpstan also) (#26780) --- .../class/actions_datapolicy.class.php | 62 +------------------ 1 file changed, 1 insertion(+), 61 deletions(-) diff --git a/htdocs/datapolicy/class/actions_datapolicy.class.php b/htdocs/datapolicy/class/actions_datapolicy.class.php index b6f1fd76950..e54ec55a94b 100644 --- a/htdocs/datapolicy/class/actions_datapolicy.class.php +++ b/htdocs/datapolicy/class/actions_datapolicy.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2018-2019 Frédéric France + * Copyright (C) 2018-2023 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 @@ -157,66 +157,6 @@ class ActionsDatapolicy extends CommonHookActions } } - /** - * Overloading the doMassActions function : replacing the parent's function with the one below - * - * @param array $parameters Hook metadatas (context, etc...) - * @param CommonObject $object The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...) - * @param string $action Current action (if set). Generally create or edit or null - * @param HookManager $hookmanager Hook manager propagated to allow calling another hook - * @return int < 0 on error, 0 on success, 1 to replace standard code - */ - public function doMassActions($parameters, &$object, &$action, $hookmanager) - { - $error = 0; // Error counter - - /* print_r($parameters); print_r($object); echo "action: " . $action; */ - //if (in_array($parameters['currentcontext'], array('somecontext1', 'somecontext2'))) { - // // do something only for the context 'somecontext1' or 'somecontext2' - // foreach ($parameters['toselect'] as $objectid) { - // // Do action on each object id - // } - //} - - if (!$error) { - $this->results = array('myreturn' => 999); - $this->resprints = 'A text to show'; - return 0; // or return 1 to replace standard code - } else { - $this->errors[] = 'Error message'; - return -1; - } - } - - /** - * Overloading the addMoreMassActions function : replacing the parent's function with the one below - * - * @param array $parameters Hook metadatas (context, etc...) - * @param CommonObject $object The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...) - * @param string $action Current action (if set). Generally create or edit or null - * @param HookManager $hookmanager Hook manager propagated to allow calling another hook - * @return int < 0 on error, 0 on success, 1 to replace standard code - */ - public function addMoreMassActions($parameters, &$object, &$action, $hookmanager) - { - global $langs; - - $error = 0; // Error counter - - /* print_r($parameters); print_r($object); echo "action: " . $action; */ - if (in_array($parameters['currentcontext'], array('somecontext1', 'somecontext2'))) { // do something only for the context 'somecontext1' or 'somecontext2' - $this->resprints = ''; - } - - if (!$error) { - return 0; // or return 1 to replace standard code - } else { - $this->errors[] = 'Error message'; - return -1; - } - } - - /** * addMoreActionsButtons * From d6affb437dab5722339c2ccaa8a0878a60f6fa08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 21 Nov 2023 23:42:41 +0100 Subject: [PATCH 021/120] fix phpstan (#26779) --- .../core/modules/supplier_proposal/doc/pdf_zenith.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php index fc6d51ccf84..642db291e04 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php @@ -1252,7 +1252,7 @@ class pdf_zenith extends ModelePDFSupplierProposal $posy += 3; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : ".(empty($object->project->title) ? '' : $object->project->title), '', 'R'); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("Project")." : ".(empty($object->project->title) ? '' : $object->project->title), '', 'R'); } } From c5c793465bbed2a5962dd8c752a2dfc5988fae1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 21 Nov 2023 23:43:05 +0100 Subject: [PATCH 022/120] fix phpstan (#26778) --- htdocs/core/modules/action/rapport.class.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/action/rapport.class.php b/htdocs/core/modules/action/rapport.class.php index d43ebc17d01..b4b843ce4e6 100644 --- a/htdocs/core/modules/action/rapport.class.php +++ b/htdocs/core/modules/action/rapport.class.php @@ -44,7 +44,6 @@ class CommActionRapport public $errors; - /** * @var string description */ @@ -76,6 +75,10 @@ class CommActionRapport public $page_largeur; + /** + * @var array + */ + public $result; /** * Constructor From a5715670ec7b480ead86d68fa46e4b0beadda85f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 21 Nov 2023 23:43:49 +0100 Subject: [PATCH 023/120] fix phpstan (#26777) * fix phpstan * Update main.inc.php --- htdocs/main.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 9a1c6f49d6d..f8dcc372fa7 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1465,8 +1465,8 @@ if (!function_exists("llxHeader")) { 'title' =>& $title, 'help_url' =>& $help_url, 'target' =>& $target, - 'disablej' =>& $disablej, - 'disablehea' =>& $disablehea, + 'disablejs' =>& $disablejs, + 'disablehead' =>& $disablehead, 'arrayofjs' =>& $arrayofjs, 'arrayofcss' =>& $arrayofcss, 'morequerystring' =>& $morequerystring, From f1ad6d7643124a3fa8b7123f288ecafb98164a33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 21 Nov 2023 23:44:26 +0100 Subject: [PATCH 024/120] fix phpstan (#26776) --- htdocs/core/menus/standard/empty.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/htdocs/core/menus/standard/empty.php b/htdocs/core/menus/standard/empty.php index 9af905f9771..db21eed581b 100644 --- a/htdocs/core/menus/standard/empty.php +++ b/htdocs/core/menus/standard/empty.php @@ -39,6 +39,8 @@ class MenuManager public $tabMenu; + public $topmenu; + public $leftmenu; /** * Constructor @@ -218,8 +220,7 @@ class MenuManager $canonrelurl = preg_replace('/\?.*$/', '', $relurl); $canonnexturl = preg_replace('/\?.*$/', '', $nexturl); - //var_dump($canonrelurl); - //var_dump($canonnexturl); + print '
    '."\n"; if (($canonrelurl != $canonnexturl && !in_array($val['mainmenu'], array('tools'))) || (strpos($canonrelurl, '/product/index.php') !== false || strpos($canonrelurl, '/compta/bank/list.php') !== false)) { @@ -305,8 +306,6 @@ class MenuManager $lastlevel2[$val2['level']] = 'greyed'; } } - //var_dump($val2['level']); - //var_dump($lastlevel2); print $val2['titre']; if ($relurl2) { if ($val2['enabled']) { @@ -320,7 +319,6 @@ class MenuManager print ''."\n"; } } - //var_dump($submenu); print '
'; } if ($val['enabled'] == 2) { From e211c0e334901e14d58e557eea08d699b0545286 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 Nov 2023 23:59:58 +0100 Subject: [PATCH 025/120] Clean code --- htdocs/contact/consumption.php | 3 ++- htdocs/core/boxes/box_last_modified_ticket.php | 9 +++++---- htdocs/ticket/index.php | 7 ++++--- htdocs/ticket/list.php | 2 +- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/htdocs/contact/consumption.php b/htdocs/contact/consumption.php index 3b8d0ea0724..290fa171035 100644 --- a/htdocs/contact/consumption.php +++ b/htdocs/contact/consumption.php @@ -451,10 +451,11 @@ if ($sql_select) { $documentstatic->id = $objp->doc_id; $documentstatic->ref = $objp->doc_number; $documentstatic->type = $objp->doc_type; + $documentstatic->fk_statut = $objp->status; - $documentstatic->fk_status = $objp->status; $documentstatic->statut = $objp->status; $documentstatic->status = $objp->status; + $documentstatic->paye = $objp->paid; $documentstatic->paid = $objp->paid; diff --git a/htdocs/core/boxes/box_last_modified_ticket.php b/htdocs/core/boxes/box_last_modified_ticket.php index fb198c17bcd..3898965ae36 100644 --- a/htdocs/core/boxes/box_last_modified_ticket.php +++ b/htdocs/core/boxes/box_last_modified_ticket.php @@ -85,7 +85,7 @@ class box_last_modified_ticket extends ModeleBoxes ); if ($user->hasRight('ticket', 'read')) { - $sql = "SELECT t.rowid as id, t.ref, t.track_id, t.fk_soc, t.fk_user_create, t.fk_user_assign, t.subject, t.message, t.fk_statut, t.type_code, t.category_code, t.severity_code, t.datec, t.tms as datem, t.date_read, t.date_close, t.origin_email "; + $sql = "SELECT t.rowid as id, t.ref, t.track_id, t.fk_soc, t.fk_user_create, t.fk_user_assign, t.subject, t.message, t.fk_statut as status, t.type_code, t.category_code, t.severity_code, t.datec, t.tms as datem, t.date_read, t.date_close, t.origin_email "; $sql .= ", type.label as type_label, category.label as category_label, severity.label as severity_label"; $sql .= ", s.nom as company_name, s.email as socemail, s.client, s.fournisseur"; $sql .= " FROM ".MAIN_DB_PREFIX."ticket as t"; @@ -119,12 +119,13 @@ class box_last_modified_ticket extends ModeleBoxes $ticket->id = $objp->id; $ticket->track_id = $objp->track_id; $ticket->ref = $objp->ref; - $ticket->fk_statut = $objp->fk_statut; $ticket->subject = $objp->subject; $ticket->date_creation = $datec; $ticket->date_modification = $datem; - $ticket->fk_statut = $objp->fk_statut; - $ticket->fk_statut = $objp->fk_statut; + //$ticket->fk_statut = $objp->status; + //$ticket->fk_statut = $objp->status; + $ticket->status = $objp->status; + $ticket->statut = $objp->status; if ($objp->fk_soc > 0) { $thirdparty = new Societe($this->db); $thirdparty->id = $objp->fk_soc; diff --git a/htdocs/ticket/index.php b/htdocs/ticket/index.php index b31596a2259..ddca41d9dfe 100644 --- a/htdocs/ticket/index.php +++ b/htdocs/ticket/index.php @@ -324,7 +324,7 @@ if ($user->hasRight('ticket', 'read')) { $max = 10; - $sql = "SELECT t.rowid, t.ref, t.track_id, t.datec, t.subject, t.type_code, t.category_code, t.severity_code, t.fk_statut, t.progress,"; + $sql = "SELECT t.rowid, t.ref, t.track_id, t.datec, t.subject, t.type_code, t.category_code, t.severity_code, t.fk_statut as status, t.progress,"; $sql .= " type.code as type_code, type.label as type_label,"; $sql .= " category.code as category_code, category.label as category_label,"; $sql .= " severity.code as severity_code, severity.label as severity_label"; @@ -337,7 +337,7 @@ if ($user->hasRight('ticket', 'read')) { } $sql .= ' WHERE t.entity IN ('.getEntity('ticket').')'; - $sql .= " AND t.fk_statut=0"; + $sql .= " AND t.fk_statut = 0"; if (!$user->hasRight('societe', 'client', 'voir') && !$socid) { $sql .= " AND t.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } @@ -374,7 +374,8 @@ if ($user->hasRight('ticket', 'read')) { $object->id = $objp->rowid; $object->ref = $objp->ref; $object->track_id = $objp->track_id; - $object->fk_statut = $objp->fk_statut; + $object->fk_statut = $objp->status; + $object->status = $objp->status; $object->progress = $objp->progress; $object->subject = $objp->subject; diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 0c3da44875e..504b3c9e52d 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -1020,7 +1020,7 @@ while ($i < $imaxinloop) { // Store properties in $object $object->setVarsFromFetchObj($obj); $object->type_code = $obj->type_code; - $object->status = $object->fk_statut; // for backwad compatibility + $object->status = $object->fk_statut; // because field name is fk_statut if ($mode == 'kanban') { if ($i == 0) { From 9ff62f157c9caf9c5c38d426182374b6b5bff1a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 22 Nov 2023 00:00:37 +0100 Subject: [PATCH 026/120] fix phpstan (#26775) * fix phpstan * Update fournisseur.facture.class.php * Update fournisseur.facture.class.php --- htdocs/fourn/class/fournisseur.facture.class.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 17340547190..5927d2a1c67 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -124,7 +124,8 @@ class FactureFournisseur extends CommonInvoice /** * Supplier invoice status * @var int - * @see FactureFournisseur::STATUS_DRAFT, FactureFournisseur::STATUS_VALIDATED, FactureFournisseur::STATUS_PAID, FactureFournisseur::STATUS_ABANDONED + * @deprecated + * @see $status */ public $statut; @@ -135,6 +136,14 @@ class FactureFournisseur extends CommonInvoice */ public $status; + /** + * Supplier invoice status + * @var int + * @deprecated + * @see $status + */ + public $fk_statut; + /** * Set to 1 if the invoice is completely paid, otherwise is 0 * @var int From 0b789d5615e302834c753bd249aa162968a5cba8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 22 Nov 2023 00:12:21 +0100 Subject: [PATCH 027/120] Fix warning --- htdocs/core/class/commonobject.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 530be48b7fe..be467a84ddd 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -9113,8 +9113,8 @@ abstract class CommonObject } if ($showaction) { $return .= '
'; - // On propose la generation de la vignette si elle n'existe pas et si la taille est superieure aux limites - if ($photo_vignette && (image_format_supported($photo) > 0) && ($this->imgWidth > $maxWidth || $this->imgHeight > $maxHeight)) { + // If $photo_vignette set, we add link to generate thumbs if file is an image and ->imgWidth or->imgHeight higher than limits + if ($photo_vignette && (image_format_supported($photo) > 0) && ((isset($this->imgWidth) && $this->imgWidth > $maxWidth) || (isset($this->imgHeight) && $this->imgHeight > $maxHeight))) { $return .= ''.img_picto($langs->trans('GenerateThumb'), 'refresh').'  '; } // Special cas for product From b57b00249473d95bed86ab73b96dd3fc86ba65c0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 22 Nov 2023 00:16:00 +0100 Subject: [PATCH 028/120] Fix warning --- htdocs/fourn/class/fournisseur.commande.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 3a333b79d32..f626d2e9ef4 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -3927,7 +3927,7 @@ class CommandeFournisseurLigne extends CommonOrderLine $sql .= ", ".($this->multicurrency_total_ht ? price2num($this->multicurrency_total_ht) : '0'); $sql .= ", ".($this->multicurrency_total_tva ? price2num($this->multicurrency_total_tva) : '0'); $sql .= ", ".($this->multicurrency_total_ttc ? price2num($this->multicurrency_total_ttc) : '0'); - $sql .= ", ".($this->fk_parent_line > 0 ? $this->fk_parent_line : 'null'); + $sql .= ", ".((!empty($this->fk_parent_line) && $this->fk_parent_line > 0) ? $this->fk_parent_line : 'null'); $sql .= ")"; dol_syslog(get_class($this)."::insert", LOG_DEBUG); From d75615195620b8dc695479bfc09daf0bfc7d2483 Mon Sep 17 00:00:00 2001 From: moreauftheobald Date: Wed, 22 Nov 2023 00:17:15 +0100 Subject: [PATCH 029/120] Fix PHP STAN ERROR ON fournisseur commande class (#26717) * Fix PHP STAN ERROR ON fournisseur commande class * Fix phpstan fournisseur commande class * Fix phpstan fournisseur commande class * Remove Rang property * Remove Rang property * Update fournisseur.commande.class.php --------- Co-authored-by: Laurent Destailleur --- htdocs/fourn/class/fournisseur.commande.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 3a333b79d32..fca8b517d82 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -212,6 +212,9 @@ class CommandeFournisseur extends CommonOrder public $origin_id; public $linked_objects = array(); + public $date_lim_reglement; + public $receptions = array(); + // Multicurrency /** * @var int ID From 88e9e091cfe82ba698ef9b50cc058df35485bfe1 Mon Sep 17 00:00:00 2001 From: Lucas Marcouiller <45882981+Hystepik@users.noreply.github.com> Date: Wed, 22 Nov 2023 00:23:16 +0100 Subject: [PATCH 030/120] fix some php stan errors (#26747) * fis some php stan errors * fix dolchmod * Update stats.class.php --------- Co-authored-by: Hystepik Co-authored-by: Laurent Destailleur --- htdocs/core/class/lessc.class.php | 2 ++ htdocs/core/class/stats.class.php | 3 ++- htdocs/core/modules/dons/html_generic.modules.php | 2 +- htdocs/core/modules/expedition/doc/pdf_espadon.modules.php | 1 + htdocs/main.inc.php | 2 +- 5 files changed, 7 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/lessc.class.php b/htdocs/core/class/lessc.class.php index e34215cc8b4..4f8dbc25804 100644 --- a/htdocs/core/class/lessc.class.php +++ b/htdocs/core/class/lessc.class.php @@ -1353,6 +1353,7 @@ class Lessc } else { $this->throwError("tint expects (color, weight)"); } + return array(); } /** @@ -1376,6 +1377,7 @@ class Lessc } else { $this->throwError("shade expects (color, weight)"); } + return array(); } /** diff --git a/htdocs/core/class/stats.class.php b/htdocs/core/class/stats.class.php index c2222504d6b..41c3e87a52e 100644 --- a/htdocs/core/class/stats.class.php +++ b/htdocs/core/class/stats.class.php @@ -353,8 +353,9 @@ abstract class Stats dol_syslog(get_class($this).'::'.__FUNCTION__." read data from cache file ".$newpathofdestfile." ".$filedate."."); $data = json_decode(file_get_contents($newpathofdestfile), true); } else { + // This method is defined in parent object only, not into abstract, so we disable phpstan warning + /** @phpstan-ignore-next-line */ $data = $this->getAllByProduct($year, $limit); - // $data[$i][]=$datay[$year][$i][1]; // set yval for x=i } // Save cache file diff --git a/htdocs/core/modules/dons/html_generic.modules.php b/htdocs/core/modules/dons/html_generic.modules.php index 526bd5483b3..bfefe38d959 100644 --- a/htdocs/core/modules/dons/html_generic.modules.php +++ b/htdocs/core/modules/dons/html_generic.modules.php @@ -175,7 +175,7 @@ class html_generic extends ModeleDon $handle = fopen($path, "w"); fwrite($handle, $contents); fclose($handle); - dolChmod($file); + dolChmod($path); } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index 6feb6f8adff..48716e5eb82 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -523,6 +523,7 @@ class pdf_espadon extends ModelePdfExpedition $showpricebeforepagebreak = 1; $posYAfterImage = 0; $posYAfterDescription = 0; + $heightforsignature = 0; if ($this->getColumnStatus('photo')) { // We start with Photo of product line diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index f8dcc372fa7..81adb306690 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -2070,7 +2070,7 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr */ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '', $morequerystring = '', $helppagename = '') { - global $user, $conf, $langs, $db; + global $user, $conf, $langs, $db, $form; global $dolibarr_main_authentication, $dolibarr_main_demo; global $hookmanager, $menumanager; From b758bb9ab4e548430ddbd586e5b837ba318c9cd5 Mon Sep 17 00:00:00 2001 From: John BOTELLA Date: Wed, 22 Nov 2023 09:27:12 +0100 Subject: [PATCH 031/120] Offset non-falsy-string on array{} in empty() does not exist. (#26745) --- htdocs/core/class/CMailFile.class.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index d72f0bea0f0..dc6fa98d8a5 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -1090,7 +1090,12 @@ class CMailFile $keyforsupportedoauth2array = preg_replace('/-.*$/', '', $keyforsupportedoauth2array); $keyforsupportedoauth2array = 'OAUTH_'.$keyforsupportedoauth2array.'_NAME'; - $OAUTH_SERVICENAME = (empty($supportedoauth2array[$keyforsupportedoauth2array]['name']) ? 'Unknown' : $supportedoauth2array[$keyforsupportedoauth2array]['name'].($keyforprovider ? '-'.$keyforprovider : '')); + $OAUTH_SERVICENAME = 'Unknown'; + if ( array_key_exists($keyforsupportedoauth2array, $supportedoauth2array) + && array_key_exists('name', $supportedoauth2array[$keyforsupportedoauth2array]) + && !empty($supportedoauth2array[$keyforsupportedoauth2array]['name'])) { + $OAUTH_SERVICENAME = $supportedoauth2array[$keyforsupportedoauth2array]['name'].(!empty($keyforprovider) ? '-'.$keyforprovider : ''); + } require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php'; From 0e4d06c8f4006e1b3a77bb882eca8ebacf11f240 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 22 Nov 2023 09:32:08 +0100 Subject: [PATCH 032/120] NEW add tpl for delivery (#26789) * add tpl for delivery * fix tooltip --- htdocs/core/lib/functions.lib.php | 2 +- htdocs/delivery/class/delivery.class.php | 2 + htdocs/delivery/tpl/linkedobjectblock.tpl.php | 85 +++++++++++++++++++ 3 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 htdocs/delivery/tpl/linkedobjectblock.tpl.php diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 8b0ee3e0748..40accb11cc5 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -11879,7 +11879,7 @@ function getElementProperties($element_type) } elseif ($element_type == 'delivery') { $classpath = 'delivery/class'; $subelement = 'delivery'; - $module = 'delivery_note'; + $module = 'expedition'; } elseif ($element_type == 'contract') { $classpath = 'contrat/class'; $module = 'contrat'; diff --git a/htdocs/delivery/class/delivery.class.php b/htdocs/delivery/class/delivery.class.php index 1823cdb0235..025c61a2ef1 100644 --- a/htdocs/delivery/class/delivery.class.php +++ b/htdocs/delivery/class/delivery.class.php @@ -756,6 +756,8 @@ class Delivery extends CommonObject { global $langs; + $langs->load('deliveries'); + $datas = []; $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("ShowReceiving").':
'; diff --git a/htdocs/delivery/tpl/linkedobjectblock.tpl.php b/htdocs/delivery/tpl/linkedobjectblock.tpl.php new file mode 100644 index 00000000000..fae712658f7 --- /dev/null +++ b/htdocs/delivery/tpl/linkedobjectblock.tpl.php @@ -0,0 +1,85 @@ + + * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2014 Marcos García + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +// Protection to avoid direct call of template +if (empty($conf) || !is_object($conf)) { + print "Error, template page can't be called as URL"; + exit; +} + +print "\n"; + +global $user; +global $noMoreLinkedObjectBlockAfter; + +$langs = $GLOBALS['langs']; +$linkedObjectBlock = $GLOBALS['linkedObjectBlock']; + +// Load translation files required by the page +$langs->load('sendings'); + +$linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'date', 'desc', 0, 0, 1); + +$total = 0; +$ilink = 0; +foreach ($linkedObjectBlock as $key => $objectlink) { + /** @var Delivery $objectlink */ + $ilink++; + + $trclass = 'oddeven'; + if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) { + $trclass .= ' liste_sub_total'; + } + echo ''; + echo ''.$langs->trans("Delivery"); + if (!empty($showImportButton) && !empty($conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES)) { + print ' '; + echo ''.$objectlink->getNomUrl(1).''; + echo ''.$objectlink->ref.''; + echo ''.dol_print_date($objectlink->date_delivery, 'day').''; + echo ''; + if ($user->hasRight('delivery', 'read')) { + $total = $total + $objectlink->total_ht; + echo price($objectlink->total_ht); + } + echo ''; + echo ''.$objectlink->getLibStatut(3).''; + echo ''; + // For now, shipments must stay linked to order, so link is not deletable + if ($object->element != 'shipping') { + echo ''.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').''; + } + echo ''; + echo "\n"; +} +if (count($linkedObjectBlock) > 1) { + echo ''; + echo ''.$langs->trans("Total").''; + echo ''; + echo ''; + echo ''; + echo ''.price($total).''; + echo ''; + echo ''; + echo "\n"; +} + +echo "\n"; From b89ad8e21549b03c12e0f913e48f61a3238553ef Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 22 Nov 2023 11:16:36 +0100 Subject: [PATCH 033/120] Update stripe comments --- htdocs/stripe/class/stripe.class.php | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index 614af91a5ae..33c47ae2ae1 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -465,12 +465,21 @@ class Stripe extends CommonObject $paymentmethodtypes = array("card_present"); } + global $dolibarr_main_url_root; + $dataforintent = array( - "confirm" => $confirmnow, // Do not confirm immediatly during creation of intent + "confirm" => $confirmnow, // try to confirm immediatly after create (if conditions are ok) "confirmation_method" => $mode, "amount" => $stripeamount, "currency" => $currency_code, - "payment_method_types" => $paymentmethodtypes, + "payment_method_types" => $paymentmethodtypes, // When payment_method_types is set, return_url is not required but payment mode can't be managed from dashboard + /* + 'return_url' => $dolibarr_main_url_root.'/public/payment/paymentok.php', + 'automatic_payment_methods' => array( + 'enabled' => true, + 'allow_redirects' => 'never', + ), + */ "description" => $description, //"save_payment_method" => true, "setup_future_usage" => "on_session", @@ -683,9 +692,18 @@ class Stripe extends CommonObject $paymentmethodtypes[] = "sofort"; } + global $dolibarr_main_url_root; + $dataforintent = array( "confirm" => $confirmnow, // Do not confirm immediatly during creation of intent - "payment_method_types" => $paymentmethodtypes, + "payment_method_types" => $paymentmethodtypes, // When payment_method_types is set, return_url is not required but payment mode can't be managed from dashboard + /* + 'return_url' => $dolibarr_main_url_root.'/public/payment/paymentok.php', + 'automatic_payment_methods' => array( + 'enabled' => true, + 'allow_redirects' => 'never', + ), + */ "usage" => "off_session", "metadata" => $metadata ); @@ -710,7 +728,7 @@ class Stripe extends CommonObject dol_syslog("getSetupIntent ".$stripearrayofkeysbyenv[$status]['publishable_key'], LOG_DEBUG); - // Note: If all data for payment intent are same than a previous on, even if we use 'create', Stripe will return ID of the old existing payment intent. + // Note: If all data for payment intent are same than a previous one, even if we use 'create', Stripe will return ID of the old existing payment intent. if (empty($key)) { // If the Stripe connect account not set, we use common API usage //$setupintent = \Stripe\SetupIntent::create($dataforintent, array("idempotency_key" => "$description")); $setupintent = \Stripe\SetupIntent::create($dataforintent, array()); From ed93a4b1cbaf9b1f5d9f038917fd35eb5def4c10 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 22 Nov 2023 12:46:09 +0100 Subject: [PATCH 034/120] Debug v19 --- htdocs/comm/action/class/actioncomm.class.php | 7 +- htdocs/public/stripe/ipn.php | 93 ++++++++++++------- 2 files changed, 63 insertions(+), 37 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index f2eaaa62881..551a498737a 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -291,7 +291,7 @@ class ActionComm extends CommonObject public $fk_element; // Id of record /** - * @var int Id of record alternative for API + * @var int Id of linked object, alternative for API or other */ public $elementid; @@ -435,7 +435,7 @@ class ActionComm extends CommonObject // Check parameters if (!isset($this->userownerid) || (string) $this->userownerid === '') { // $this->userownerid may be 0 (anonymous event) or > 0 - dol_syslog("You tried to create an event but mandatory property ownerid was not defined", LOG_WARNING); + dol_syslog("You tried to create an event but mandatory property userownerid was empty (you can define it to 0 for anonymous event)", LOG_WARNING); $this->errors[] = 'ErrorActionCommPropertyUserowneridNotDefined'; return -1; } @@ -481,6 +481,9 @@ class ActionComm extends CommonObject if ($this->elementtype == 'contrat') { $this->elementtype = 'contract'; } + if (empty($this->fk_element) && !empty($this->elementid)) { + $this->fk_element = $this->elementid; + } if (!is_array($this->userassigned) && !empty($this->userassigned)) { // For backward compatibility when userassigned was an int instead of an array $tmpid = (int) $this->userassigned; diff --git a/htdocs/public/stripe/ipn.php b/htdocs/public/stripe/ipn.php index 60769f22d62..c5ef35c9f08 100644 --- a/htdocs/public/stripe/ipn.php +++ b/htdocs/public/stripe/ipn.php @@ -96,9 +96,10 @@ if (!empty($conf->global->STRIPE_USER_ACCOUNT_FOR_ACTIONS)) { httponly_accessforbidden('Error: Setup of module Stripe not complete for mode '.dol_escape_htmltag($service).'. The STRIPE_USER_ACCOUNT_FOR_ACTIONS is not defined.', 400, 1); } +$now = dol_now(); -// TODO Add a check on a security key - +// Security +// The test on security key is done later into constructEvent() method. /* @@ -581,50 +582,72 @@ if ($event->type == 'payout.created') { } elseif ($event->type == 'payment_intent.payment_failed') { dol_syslog("A try to make a payment has failed"); - $db->begin(); - $object = $event->data->object; $ipaddress = $object->metadata->ipaddress; - $now = dol_now(); $currencyCodeType = strtoupper($object->currency); $paymentmethodstripeid = $object->payment_method; $customer_id = $object->customer; - $chargesdata = $object->charges->data; - $objpayid = $chargesdata->id; - $objpaydesc = $chargesdata->description; - $objinvoiceid = 0; - if ($chargesdata->metadata->dol_type == 'facture') { - $objinvoiceid = $chargesdata->metadata->dol_id; - } - $objerrcode = $chargesdata->outcome->reason; - $objerrmessage = $chargesdata->outcome->seller_message; + $chargesdataarray = $object->charges->data; - $objpaymentmodetype = $chargesdata->payment_method_details->type; - - // If this is a differed payment for SEPA, add a line into agenda events - if ($objpaymentmodetype == 'sepa_debit') { - require_once DOL_DOCUMENT_ROOT.'/comm/class/actioncomm.class.php'; - $actioncomm = new ActionComm($db); - - if ($objinvoiceid > 0) { - require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; - $invoice = new Facture($db); - $invoice->fetch($objinvoiceid); - - $actioncomm->socid = $invoice->fk_soc; - $actioncomm->fk_project = $invoice->fk_project; - $actioncomm->elementid = $invoice->id; - $actioncomm->elementtype = $invoice->type; + foreach ($chargesdataarray as $chargesdata) { + $objpayid = $chargesdata->id; + $objpaydesc = $chargesdata->description; + $objinvoiceid = 0; + if ($chargesdata->metadata->dol_type == 'facture') { + $objinvoiceid = $chargesdata->metadata->dol_id; } + $objerrcode = $chargesdata->outcome->reason; + $objerrmessage = $chargesdata->outcome->seller_message; - $actioncomm->actionmsg = 'Error returned on payment id '.$objpayid.' after request '.$objpaydesc.'
Error code is: '.$objerrcode.'
Error message is: '.$objerrmessage; - $actioncomm->actionmsg2 = 'Payment error returned'; + $objpaymentmodetype = $chargesdata->payment_method_details->type; - $actioncomm->create($user); + // If this is a differed payment for SEPA, add a line into agenda events + if ($objpaymentmodetype == 'sepa_debit') { + $db->begin(); + + require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; + $actioncomm = new ActionComm($db); + + if ($objinvoiceid > 0) { + require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; + $invoice = new Facture($db); + $invoice->fetch($objinvoiceid); + + $actioncomm->userownerid = 0; + $actioncomm->percentage = -1; + + $actioncomm->type_code = 'AC_OTH_AUTO'; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...) + $actioncomm->code = 'AC_IPN'; + + $actioncomm->datep = $now; + $actioncomm->datef = $now; + + $actioncomm->socid = $invoice->socid; + $actioncomm->fk_project = $invoice->fk_project; + $actioncomm->fk_element = $invoice->id; + $actioncomm->elementtype = 'invoice'; + $actioncomm->ip = getUserRemoteIP(); + } + + $actioncomm->note_private = 'Error returned on payment id '.$objpayid.' after SEPA payment request '.$objpaydesc.'
Error code is: '.$objerrcode.'
Error message is: '.$objerrmessage; + $actioncomm->label = 'Payment error (SEPA Stripe)'; + + $result = $actioncomm->create($user); + if ($result <= 0) { + dol_syslog($actioncomm->error, LOG_ERR); + $error++; + } + + if (! $error) { + $db->commit(); + } else { + $db->rollback(); + http_response_code(500); + return -1; + } + } } - - $db->commit(); } elseif ($event->type == 'checkout.session.completed') { // Called when making payment with new Checkout method ($conf->global->STRIPE_USE_NEW_CHECKOUT is on). // TODO: create fees } elseif ($event->type == 'payment_method.attached') { From ac615448bba997a9a0c7987d10f2eb410170e03d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 22 Nov 2023 13:53:47 +0100 Subject: [PATCH 035/120] Debug v19 --- htdocs/comm/action/list.php | 21 ++++++++++--------- htdocs/expensereport/list.php | 30 +++++++++++++-------------- htdocs/fichinter/list.php | 4 ++-- htdocs/holiday/list.php | 7 ++++--- htdocs/projet/class/project.class.php | 15 +++++++------- htdocs/projet/list.php | 4 ---- 6 files changed, 40 insertions(+), 41 deletions(-) diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index dab3a55354e..eb32de5e829 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -802,13 +802,13 @@ if (!empty($arrayfields['a.tms']['checked'])) { print ''; } if (!empty($arrayfields['a.percent']['checked'])) { - print ''; + print ''; $formactions->form_select_status_action('formaction', $search_status, 1, 'search_status', 1, 2, 'search_status width100 onrightofpage'); print ''; } // Action column if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; + print ''; $searchpicto = $form->showFilterButtons(); print $searchpicto; print ''; @@ -823,6 +823,7 @@ $totalarray['nbfield'] = 0; print ''; if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); + $totalarray['nbfield']++; } if (!empty($arrayfields['a.id']['checked'])) { print_liste_field_titre($arrayfields['a.id']['label'], $_SERVER["PHP_SELF"], "a.id", $param, "", "", $sortfield, $sortorder); @@ -846,11 +847,11 @@ if (!empty($arrayfields['a.note']['checked'])) { } //if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) if (!empty($arrayfields['a.datep']['checked'])) { - print_liste_field_titre($arrayfields['a.datep']['label'], $_SERVER["PHP_SELF"], "a.datep,a.id", $param, '', 'align="center"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['a.datep']['label'], $_SERVER["PHP_SELF"], "a.datep,a.id", $param, '', '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; } if (!empty($arrayfields['a.datep2']['checked'])) { - print_liste_field_titre($arrayfields['a.datep2']['label'], $_SERVER["PHP_SELF"], "a.datep2", $param, '', 'align="center"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['a.datep2']['label'], $_SERVER["PHP_SELF"], "a.datep2", $param, '', '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; } if (!empty($arrayfields['s.nom']['checked'])) { @@ -873,22 +874,22 @@ $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // No print $hookmanager->resPrint; if (!empty($arrayfields['a.datec']['checked'])) { - print_liste_field_titre($arrayfields['a.datec']['label'], $_SERVER["PHP_SELF"], "a.datec,a.id", $param, "", 'align="center"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['a.datec']['label'], $_SERVER["PHP_SELF"], "a.datec,a.id", $param, "", '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; } if (!empty($arrayfields['a.tms']['checked'])) { - print_liste_field_titre($arrayfields['a.tms']['label'], $_SERVER["PHP_SELF"], "a.tms,a.id", $param, "", 'align="center"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['a.tms']['label'], $_SERVER["PHP_SELF"], "a.tms,a.id", $param, "", '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; } - +// Status if (!empty($arrayfields['a.percent']['checked'])) { - print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "a.percent", $param, "", 'align="center"', $sortfield, $sortorder); + print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "a.percent", $param, "", '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; } if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch center '); + $totalarray['nbfield']++; } -$totalarray['nbfield']++; print "\n"; $now = dol_now(); diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index 51822922b70..65204fc9695 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -560,7 +560,7 @@ if ($resql) { $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); print '
'; - print ''."\n"; + print '
'."\n"; // Filters print ''; @@ -652,7 +652,7 @@ if ($resql) { } // Status if (!empty($arrayfields['d.fk_statut']['checked'])) { - print ''; } @@ -671,7 +671,7 @@ if ($resql) { print ''; if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch center '); $totalarray['nbfield']++; } if (!empty($arrayfields['d.ref']['checked'])) { @@ -683,31 +683,31 @@ if ($resql) { $totalarray['nbfield']++; } if (!empty($arrayfields['d.date_debut']['checked'])) { - print_liste_field_titre($arrayfields['d.date_debut']['label'], $_SERVER["PHP_SELF"], "d.date_debut", "", $param, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['d.date_debut']['label'], $_SERVER["PHP_SELF"], "d.date_debut", "", $param, '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; } if (!empty($arrayfields['d.date_fin']['checked'])) { - print_liste_field_titre($arrayfields['d.date_fin']['label'], $_SERVER["PHP_SELF"], "d.date_fin", "", $param, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['d.date_fin']['label'], $_SERVER["PHP_SELF"], "d.date_fin", "", $param, '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; } if (!empty($arrayfields['d.date_valid']['checked'])) { - print_liste_field_titre($arrayfields['d.date_valid']['label'], $_SERVER["PHP_SELF"], "d.date_valid", "", $param, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['d.date_valid']['label'], $_SERVER["PHP_SELF"], "d.date_valid", "", $param, '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; } if (!empty($arrayfields['d.date_approve']['checked'])) { - print_liste_field_titre($arrayfields['d.date_approve']['label'], $_SERVER["PHP_SELF"], "d.date_approve", "", $param, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['d.date_approve']['label'], $_SERVER["PHP_SELF"], "d.date_approve", "", $param, '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; } if (!empty($arrayfields['d.total_ht']['checked'])) { - print_liste_field_titre($arrayfields['d.total_ht']['label'], $_SERVER["PHP_SELF"], "d.total_ht", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['d.total_ht']['label'], $_SERVER["PHP_SELF"], "d.total_ht", "", $param, '', $sortfield, $sortorder, 'right '); $totalarray['nbfield']++; } if (!empty($arrayfields['d.total_vat']['checked'])) { - print_liste_field_titre($arrayfields['d.total_vat']['label'], $_SERVER["PHP_SELF"], "d.total_tva", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['d.total_vat']['label'], $_SERVER["PHP_SELF"], "d.total_tva", "", $param, '', $sortfield, $sortorder, 'right '); $totalarray['nbfield']++; } if (!empty($arrayfields['d.total_ttc']['checked'])) { - print_liste_field_titre($arrayfields['d.total_ttc']['label'], $_SERVER["PHP_SELF"], "d.total_ttc", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['d.total_ttc']['label'], $_SERVER["PHP_SELF"], "d.total_ttc", "", $param, '', $sortfield, $sortorder, 'right '); $totalarray['nbfield']++; } // Extra fields @@ -717,19 +717,19 @@ if ($resql) { $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (!empty($arrayfields['d.date_create']['checked'])) { - print_liste_field_titre($arrayfields['d.date_create']['label'], $_SERVER["PHP_SELF"], "d.date_create", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['d.date_create']['label'], $_SERVER["PHP_SELF"], "d.date_create", "", $param, '', $sortfield, $sortorder, 'nowraponall center'); $totalarray['nbfield']++; } if (!empty($arrayfields['d.tms']['checked'])) { - print_liste_field_titre($arrayfields['d.tms']['label'], $_SERVER["PHP_SELF"], "d.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['d.tms']['label'], $_SERVER["PHP_SELF"], "d.tms", "", $param, '', $sortfield, $sortorder, 'nowraponall center'); $totalarray['nbfield']++; } if (!empty($arrayfields['d.fk_statut']['checked'])) { - print_liste_field_titre($arrayfields['d.fk_statut']['label'], $_SERVER["PHP_SELF"], "d.fk_statut", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['d.fk_statut']['label'], $_SERVER["PHP_SELF"], "d.fk_statut", "", $param, '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; } if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch '); $totalarray['nbfield']++; } print "\n"; @@ -941,7 +941,7 @@ if ($resql) { } // Status if (!empty($arrayfields['d.fk_statut']['checked'])) { - print ''; + print ''; if (!$i) { $totalarray['nbfield']++; } diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index cc9dedcfcc2..b267fec9b10 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -674,7 +674,7 @@ if (!empty($arrayfields['f.note_private']['checked'])) { $totalarray['nbfield']++; } if (!empty($arrayfields['f.fk_statut']['checked'])) { - print_liste_field_titre($arrayfields['f.fk_statut']['label'], $_SERVER["PHP_SELF"], "f.fk_statut", "", $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre($arrayfields['f.fk_statut']['label'], $_SERVER["PHP_SELF"], "f.fk_statut", "", $param, '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; } if (!empty($arrayfields['fd.description']['checked'])) { @@ -902,7 +902,7 @@ while ($i < $imaxinloop) { } // Status if (!empty($arrayfields['f.fk_statut']['checked'])) { - print ''; + print ''; if (!$i) { $totalarray['nbfield']++; } diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index a21ce146dd9..ac3340b8861 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -723,7 +723,7 @@ if (!empty($arrayfields['cp.tms']['checked'])) { // Status if (!empty($arrayfields['cp.statut']['checked'])) { - print ''; } @@ -799,7 +799,7 @@ if (!empty($arrayfields['cp.tms']['checked'])) { $totalarray['nbfield']++; } if (!empty($arrayfields['cp.statut']['checked'])) { - print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "cp.statut", "", $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "cp.statut", "", $param, '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; } // Action column @@ -1017,8 +1017,9 @@ if ($id && !$user->hasRight('holiday', 'readall') && !in_array($id, $childids)) $totalarray['nbfield']++; } } + // Status if (!empty($arrayfields['cp.statut']['checked'])) { - print ''; + print ''; if (!$i) { $totalarray['nbfield']++; } diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 38abd37a7ed..4218ef5d402 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -35,7 +35,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; */ class Project extends CommonObject { - /** * @var string ID to identify managed object */ @@ -2505,20 +2504,22 @@ class Project extends CommonObject $return .= '
'.$langs->trans("Author").''; $return .= ' : '.$user->getNomUrl(1).''; }*/ + $return .= '
'; // start div line status if ($this->usage_opportunity && $this->opp_status_code) { //$return .= '
'.$langs->trans("OpportunityStatusShort").''; - $return .= '
'.$langs->trans("OppStatus".$this->opp_status_code).''; - $return .= ' ('.round($this->opp_percent).'%)'; - $return .= '
'.price($this->opp_amount).''; - } else { - $return .= '
'; + //$return .= '
'.dol_trunc($langs->trans("OppStatus".$this->opp_status_code), 5).'
'; + $return .= '
opp_status_code)).'">'.round($this->opp_percent).'%
'; + $return .= '
'.price($this->opp_amount).'
'; } if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(3).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } + $return .= '
'; // end div line status + $return .= ''; $return .= ''; $return .= ''; + return $return; } diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index c915aa02e8f..9e2154f30e1 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -1843,8 +1843,6 @@ while ($i < $imaxinloop) { print ''; if (!$i) { $totalarray['nbfield']++; - } - if (!$i) { $totalarray['pos'][$totalarray['nbfield']] = 'opp_weighted_amount'; } } @@ -1862,8 +1860,6 @@ while ($i < $imaxinloop) { print ''; if (!$i) { $totalarray['nbfield']++; - } - if (!$i) { $totalarray['pos'][$totalarray['nbfield']] = 'p.budget_amount'; } } From 8dce28e29b3dfddfb2612b5949d244db67e5b0e1 Mon Sep 17 00:00:00 2001 From: Lucas Marcouiller <45882981+Hystepik@users.noreply.github.com> Date: Thu, 23 Nov 2023 14:58:00 +0100 Subject: [PATCH 036/120] Fix bookcal public page 2 (#26827) * fix bookcal public page * fx booking link with calendar * booking list on calendar_card * fix display on wrong values --------- Co-authored-by: Hystepik --- htdocs/bookcal/booking_list.php | 247 ++++++++++++++++++++ htdocs/bookcal/lib/bookcal_calendar.lib.php | 8 + htdocs/comm/action/index.php | 12 +- htdocs/langs/en_US/agenda.lang | 1 + htdocs/public/bookcal/bookcalAjax.php | 91 ++++---- htdocs/public/bookcal/index.php | 12 +- 6 files changed, 319 insertions(+), 52 deletions(-) create mode 100644 htdocs/bookcal/booking_list.php diff --git a/htdocs/bookcal/booking_list.php b/htdocs/bookcal/booking_list.php new file mode 100644 index 00000000000..95a0b95d96c --- /dev/null +++ b/htdocs/bookcal/booking_list.php @@ -0,0 +1,247 @@ + + * Copyright (C) 2004 Eric Seigne + * Copyright (C) 2004-2016 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2010-2014 Juanjo Menent + * Copyright (C) 2017 Ferran Marcet + * Copyright (C) 2018 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/compta/facture/prelevement.php + * \ingroup facture + * \brief Management of direct debit order or credit tranfer of invoices + */ + +// Load Dolibarr environment +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; +require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; +require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; +dol_include_once('/bookcal/lib/bookcal_calendar.lib.php'); + +// load module libraries +require_once __DIR__.'/class/calendar.class.php'; + +// Load translation files required by the page +$langs->loadLangs(array("bookcal@bookcal", "other")); + +$id = (GETPOST('id', 'int') ?GETPOST('id', 'int') : GETPOST('facid', 'int')); // For backward compatibility +$ref = GETPOST('ref', 'alpha'); +$socid = GETPOST('socid', 'int'); +$action = GETPOST('action', 'aZ09'); +$type = GETPOST('type', 'aZ09'); + +$fieldid = (!empty($ref) ? 'ref' : 'rowid'); +if ($user->socid) { + $socid = $user->socid; +} + +$moreparam = ''; + +$object = new Calendar($db); + +// Load object +if ($id > 0 || !empty($ref)) { + $ret = $object->fetch($id, $ref); + $isdraft = (($object->status == Calendar::STATUS_DRAFT) ? 1 : 0); + if ($ret > 0) { + $object->fetch_thirdparty(); + } +} + +// There is several ways to check permission. +// Set $enablepermissioncheck to 1 to enable a minimum low level of checks +$enablepermissioncheck = 0; +if ($enablepermissioncheck) { + $permissiontoread = $user->hasRight('bookcal', 'calendar', 'read'); + $permissiontoadd = $user->hasRight('bookcal', 'calendar', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php + $permissiontodelete = $user->hasRight('bookcal', 'calendar', 'delete') || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT); + $permissionnote = $user->hasRight('bookcal', 'calendar', 'write'); // Used by the include of actions_setnotes.inc.php + $permissiondellink = $user->hasRight('bookcal', 'calendar', 'write'); // Used by the include of actions_dellink.inc.php +} else { + $permissiontoread = 1; + $permissiontoadd = 1; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php + $permissiontodelete = 1; + $permissionnote = 1; + $permissiondellink = 1; +} + +if (!isModEnabled("bookcal")) { + accessforbidden(); +} +if (!$permissiontoread) { + accessforbidden(); +} + +/* + * Actions + */ + +$parameters = ''; +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); +} + + +/* + * View + */ + +$form = new Form($db); + +$now = dol_now(); +$title = $langs->trans('Calendar')." - ".$langs->trans('Bookings'); + +llxHeader('', $title, $helpurl); + + +if ($object->id > 0) { + $head = calendarPrepareHead($object); + + print dol_get_fiche_head($head, 'booking', $langs->trans("Calendar"), -1, $object->picto, 0, '', '', 0, '', 1); + + $formconfirm = ''; + + // Call Hook formConfirm + $parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid); + $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if (empty($reshook)) { + $formconfirm .= $hookmanager->resPrint; + } elseif ($reshook > 0) { + $formconfirm = $hookmanager->resPrint; + } + + // Print form confirm + print $formconfirm; + + + // Object card + // ------------------------------------------------------------ + $linkback = ''.$langs->trans("BackToList").''; + + $morehtmlref = '
'; + $morehtmlref .= '
'; + + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + + print '
'; + print '
'; + print '
'; + print '
'; + print ''; $formexpensereport->selectExpensereportStatus($search_status, 'search_status', 1, 1); print '
'.$expensereportstatic->getLibStatut(5).''.$expensereportstatic->getLibStatut(5).''.$objectstatic->getLibStatut(5).''.$objectstatic->getLibStatut(5).''; + print ''; print $object->selectStatutCP($search_status, 'search_status', 'search_status width100 onrightofpage'); print ''.$holidaystatic->getLibStatut(5).''.$holidaystatic->getLibStatut(5).'
'."\n"; + + // Common attributes + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; + + // Other attributes. Fields from hook formObjectOptions and Extrafields. + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; + + // Link to public page + print ''; + print ''; + + print '
LinkPublic page'; + print '
'; + print '
'; + print ''; + + print '
'; + + print dol_get_fiche_end(); + + + /* + * Bookings + */ + + print '
'; + print ''; + + print ''; + + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + + $sql = "SELECT ac.id, ac.ref, ac.datep as date_start, ac.datep2 as date_end, ac.label, acr.fk_element"; + $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as ac"; + $sql .= " JOIN ".MAIN_DB_PREFIX."actioncomm_resources as acr on acr.fk_actioncomm = ac.id"; + $sql .= " WHERE ac.fk_bookcal_calendar = ".((int) $object->id); + $sql .= " AND ac.code = 'AC_RDV'"; + $sql .= " AND acr.element_type = 'socpeople'"; + $resql = $db->query($sql); + + $num = 0; + if ($resql) { + $i = 0; + + $tmpcontact = new Contact($db); + $tmpactioncomm = new Actioncomm($db); + + $num = $db->num_rows($result); + while ($i < $num) { + $obj = $db->fetch_object($resql); + $tmpcontact->fetch($obj->fk_element); + $tmpactioncomm->fetch($obj->id); + + print ''; + + // Ref + print '\n"; + + // Title + print ''; + + // Amount + print ''; + + // Date process + print ''; + + // Link to make payment now + print ''; + + + print "\n"; + $i++; + } + + $db->free($resql); + } else { + dol_print_error($db); + } + + print "
'.$langs->trans("Ref").''.$langs->trans("Title").''.$langs->trans("DateStart").''.$langs->trans("DateEnd").''.$langs->trans("Contact").'
'.$tmpactioncomm->getNomUrl(1, -1)."'; + print $obj->label; + print ''.dol_print_date($db->jdate($obj->date_start), "dayhour").''.dol_print_date($db->jdate($obj->date_end), "dayhour").''; + print $tmpcontact->getNomUrl(1, -1); + print '
"; + print '
'; +} + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/bookcal/lib/bookcal_calendar.lib.php b/htdocs/bookcal/lib/bookcal_calendar.lib.php index 65c8a38a64a..f586c8845df 100644 --- a/htdocs/bookcal/lib/bookcal_calendar.lib.php +++ b/htdocs/bookcal/lib/bookcal_calendar.lib.php @@ -46,6 +46,14 @@ function calendarPrepareHead($object) $head[$h][2] = 'card'; $h++; + if ($object->status == Calendar::STATUS_VALIDATED) { + $head[$h][0] = dol_buildpath("/bookcal/booking_list.php", 1).'?id='.$object->id; + $head[$h][1] = $langs->trans("Bookings"); + $head[$h][2] = 'booking'; + $h++; + } + + if ($showtabofpagecontact) { $head[$h][0] = dol_buildpath("/bookcal/calendar_contact.php", 1).'?id='.$object->id; $head[$h][1] = $langs->trans("Contacts"); diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 99b0b21d20a..9d7e698cc2b 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -716,7 +716,7 @@ $sql .= ' a.datep2,'; $sql .= ' a.percent,'; $sql .= ' a.fk_user_author,a.fk_user_action,'; $sql .= ' a.transparency, a.priority, a.fulldayevent, a.location,'; -$sql .= ' a.fk_soc, a.fk_contact, a.fk_project, a.fk_bookcal_availability,'; +$sql .= ' a.fk_soc, a.fk_contact, a.fk_project, a.fk_bookcal_calendar,'; $sql .= ' a.fk_element, a.elementtype,'; $sql .= ' ca.code as type_code, ca.libelle as type_label, ca.color as type_color, ca.type as type_type, ca.picto as type_picto'; $sql .= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a"; @@ -905,8 +905,8 @@ if ($resql) { $event->socid = $obj->fk_soc; $event->contact_id = $obj->fk_contact; - $event->fk_bookcal_availability = $obj->fk_bookcal_availability; - if (!empty($event->fk_bookcal_availability)) { + $event->fk_bookcal_calendar = $obj->fk_bookcal_calendar; + if (!empty($event->fk_bookcal_calendar)) { $event->type = "bookcal_calendar"; } @@ -1868,7 +1868,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa } elseif ($event->type == 'bookcal_calendar') { $numbirthday++; $colorindex = 3; - $cssclass = 'family_bookcal_calendar_'.(!empty($bookcalcalendarsarray["availabilitieslink"]) ? $bookcalcalendarsarray["availabilitieslink"][$event->fk_bookcal_availability] : ""); + $cssclass = 'family_bookcal_calendar_'.(!empty($bookcalcalendarsarray["availabilitieslink"]) ? $bookcalcalendarsarray["availabilitieslink"][$event->fk_bookcal_calendar] : ""); $color = sprintf("%02x%02x%02x", $theme_datacolor[$colorindex][0], $theme_datacolor[$colorindex][1], $theme_datacolor[$colorindex][2]); } else { $numother++; @@ -1957,7 +1957,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa if ($event->type == 'holiday' && !GETPOST('check_holiday')) { $morecss = 'hidden'; } - if ($event->type == 'bookcal_calendar' && !GETPOST('check_bookcal_calendar_'.$bookcalcalendarsarray["availabilitieslink"][$event->fk_bookcal_availability])) { + if ($event->type == 'bookcal_calendar' && !GETPOST('check_bookcal_calendar_'.$bookcalcalendarsarray["availabilitieslink"][$event->fk_bookcal_calendar])) { $morecss = 'hidden'; } if ($morecss != 'hidden') { @@ -1968,7 +1968,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa } //var_dump($event->type.' - '.$morecss.' - '.$cssclass.' - '.$i.' - '.$ireallyshown.' - '.$itoshow); if (isModEnabled("bookcal") && $event->type == 'bookcal_calendar') { - print '
fk_bookcal_availability].' '.$cssclass.($morecss ? ' '.$morecss : '').'"'; + print '
fk_bookcal_calendar].' '.$cssclass.($morecss ? ' '.$morecss : '').'"'; } else { print '
startHour; + $endHourstring = $obj->endHour; + if ($startHourstring <= 0) { + $startHourstring = 0; + } + if ($endHourstring >= 24) { + $endHourstring = 24; + } $offsethour = round($obj->duration / 60); // Creation of array of availabilties range - if ($datetocheckbooking >= $starttime && $datetocheckbooking < $endtime) { - for ($hour=$obj->startHour; $hour < $obj->endHour; $hour+= $offsethour) { + if ($datetocheckbooking >= $starttime && $datetocheckbooking <= $endtime) { + for ($hour=$startHourstring; $hour < $endHourstring; $hour+= $offsethour) { for ($min=0; $min < 60; $min += $offsetmin) { $hourstring = $hour; $minstring = $min; @@ -123,50 +131,47 @@ if ($action == 'verifyavailability') { } $i++; } - $response["code"] = "SUCCESS"; - } - - // TODO Select also all not available ranges - // Build the list of hours available (key = hour, value = duration) - } - - // Now get ranges already reserved - // TODO Remove this - /*if (!$error) { - $datetocheckbooking_end = dol_time_plus_duree($datetocheckbooking, 1, 'd'); - - $sql = "SELECT b.datep, b.id"; - $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as b"; - $sql .= " WHERE b.datep >= '".$db->idate($datetocheckbooking)."'"; - $sql .= " AND b.datep < '".$db->idate($datetocheckbooking_end)."'"; - $sql .= " AND fk_bookcal_availability IN (SELECT rowid FROM ".MAIN_DB_PREFIX."bookcal_availabilities WHERE fk_bookcal_calendar = ".((int) $id).")"; - //$sql .= " AND b.transparency" - $resql = $db->query($sql); - if ($resql) { - $num = $db->num_rows($resql); - $i = 0; - $response = array(); - $response["content"] = array(); - while ($i < $num) { - $obj = $db->fetch_object($resql); - $dateobject = $obj->datep; - $dateobject = explode(" ", $dateobject)[1]; - $dateobject = explode(":", $dateobject); - - $dateobjectstring = $dateobject[0].$dateobject[1]; - - $response["content"][] = $dateobjectstring; - $i++; - } - if ($i == 0) { - $response["code"] = "NO_DATA_FOUND"; - } else { + if ($i == $num) { $response["code"] = "SUCCESS"; + } else { + $response["code"] = "ERROR"; + $error ++; } - } else { - dol_print_error($db); } - }*/ + + // Select also all not available ranges + if (!$error) { + $datetocheckbooking_end = dol_time_plus_duree($datetocheckbooking, 1, 'd'); + + $sql = "SELECT b.datep, b.id"; + $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as b"; + $sql .= " WHERE b.datep >= '".$db->idate($datetocheckbooking)."'"; + $sql .= " AND b.datep < '".$db->idate($datetocheckbooking_end)."'"; + $sql .= " AND b.code = 'AC_RDV'"; + $sql .= " AND b.status = 0"; + $sql .= " AND b.fk_bookcal_calendar = ".((int) $id); + $resql = $db->query($sql); + if ($resql) { + $num = $db->num_rows($resql); + $i = 0; + while ($i < $num) { + $obj = $db->fetch_object($resql); + $datebooking = $db->jdate($obj->datep); + $datebookingarray = dol_getdate($datebooking); + $hourstring = $datebookingarray["hours"]; + $minstring = $datebookingarray["minutes"]; + if ($hourstring < 10) { + $hourstring = "0".$hourstring; + } + if ($minstring < 10) { + $minstring = "0".$minstring; + } + $response["availability"][$hourstring.":".$minstring] *= -1; + $i++; + } + } + } + } $result = $response; } diff --git a/htdocs/public/bookcal/index.php b/htdocs/public/bookcal/index.php index 0aba257d73d..f6fec0ceb2e 100644 --- a/htdocs/public/bookcal/index.php +++ b/htdocs/public/bookcal/index.php @@ -233,14 +233,14 @@ if ($action == 'add') { if (!$error) { $dateend = dol_time_plus_duree(GETPOST("datetimebooking", 'int'), GETPOST("durationbooking"), 'i'); - $actioncomm->label = "test"; + $actioncomm->label = $langs->trans("BookcalBookingTitle"); $actioncomm->type = 'AC_RDV'; $actioncomm->type_id = 5; $actioncomm->datep = GETPOST("datetimebooking", 'int'); $actioncomm->datef = $dateend; $actioncomm->note_private = GETPOST("description"); $actioncomm->percentage = -1; - $actioncomm->fk_bookcal_availability = GETPOST("id_availability", 'int'); + $actioncomm->fk_bookcal_calendar = $id; $actioncomm->userownerid = $calendar->visibility; $actioncomm->contact_id = $contact->id; $actioncomm->socpeopleassigned = $contact->id; @@ -521,13 +521,18 @@ if ($action == 'afteradd') { for(index in timearray){ let hour = new Date("2000-01-01T" + index + ":00"); duration = timearray[index]; + isalreadybooked = false; + if (duration < 0) { + duration *= -1; + isalreadybooked = true; + } hour.setMinutes(hour.getMinutes() + duration); let hours = hour.getHours().toString().padStart(2, "0"); // Formater pour obtenir deux chiffres let mins = hour.getMinutes().toString().padStart(2, "0"); // Formater pour obtenir deux chiffres timerange = index + " - " + `${hours}:${mins}`; - str += "
"; + str += "
"; } $("#buttonlistbooking").html(str); $(".btnsubmitbooking").on("click", function(){ @@ -558,6 +563,7 @@ if ($action == 'afteradd') { timearray = data["availability"]; console.log(timearray); generateBookingButtons(timearray, datestring); + $(".btnbookcalbooked").prop("disabled", true); } else { if(data["code"] == "NO_DATA_FOUND"){ console.log("No booking to hide"); From 628786df6aa0f24dcdb92385a2c41e24a476bd79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 23 Nov 2023 14:59:21 +0100 Subject: [PATCH 037/120] Update fournisseur.facture.class.php (#26822) --- htdocs/fourn/class/fournisseur.facture.class.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 5927d2a1c67..cd76ac027a7 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -421,8 +421,7 @@ class FactureFournisseur extends CommonInvoice $this->entity = $_facrec->entity; // Invoice created in same entity than template // Fields coming from GUI (priority on template). TODO Value of template should be used as default value on GUI so we can use here always value from GUI - $this->fk_project = GETPOST('projectid', 'int') > 0 ? ((int) GETPOST('projectid', 'int')) : $_facrec->fk_projet; - $this->fk_projet = $this->fk_project; + $this->fk_project = GETPOST('projectid', 'int') > 0 ? ((int) GETPOST('projectid', 'int')) : $_facrec->fk_project; $this->note_public = GETPOST('note_public', 'restricthtml') ? GETPOST('note_public', 'restricthtml') : $_facrec->note_public; $this->note_private = GETPOST('note_private', 'restricthtml') ? GETPOST('note_private', 'restricthtml') : $_facrec->note_private; $this->model_pdf = GETPOST('model', 'alpha') ? GETPOST('model', 'alpha') : $_facrec->model_pdf; From 6e059d446112beee6308df5582105596bb67c613 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 23 Nov 2023 15:05:52 +0100 Subject: [PATCH 038/120] fix product service tooltip (#26820) --- htdocs/product/class/product.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 2c42c742c8b..3ba34b96728 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -5189,7 +5189,7 @@ class Product extends CommonObject } $params = [ 'id' => $this->id, - 'objecttype' => $this->element, + 'objecttype' => (isset($this->type) ? ($this->type == 1 ? 'service' : 'product') : $this->element), 'option' => $option, 'nofetch' => 1, ]; From b3345e1796154f8b48b91b086f58e570ffa8fee1 Mon Sep 17 00:00:00 2001 From: boudet jean pascal <68547382+atm-jpb@users.noreply.github.com> Date: Thu, 23 Nov 2023 15:10:56 +0100 Subject: [PATCH 039/120] FIX : special_code update line keep old value. (#26819) * FIX : special code update line keep old value. * Update fournisseur.commande.class.php --------- Co-authored-by: jpb Co-authored-by: Laurent Destailleur --- htdocs/fourn/class/fournisseur.commande.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 8b69f763a83..30b0643a512 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -2854,7 +2854,7 @@ class CommandeFournisseur extends CommonOrder $this->line->localtax2_type = empty($localtaxes_type[2]) ? '' : $localtaxes_type[2]; $this->line->remise_percent = $remise_percent; $this->line->subprice = $pu_ht; - $this->line->rang = $this->rang; + $this->line->rang = $oldline->rang; $this->line->info_bits = $info_bits; $this->line->total_ht = $total_ht; $this->line->total_tva = $total_tva; @@ -2862,7 +2862,7 @@ class CommandeFournisseur extends CommonOrder $this->line->total_localtax2 = $total_localtax2; $this->line->total_ttc = $total_ttc; $this->line->product_type = $type; - $this->line->special_code = $this->special_code; + $this->line->special_code = $oldline->special_code; $this->line->origin = $this->origin; $this->line->fk_unit = $fk_unit; From e229d63bfd962532d3dd1d6776039dd7fc7735b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 23 Nov 2023 15:11:18 +0100 Subject: [PATCH 040/120] fix phpstan (#26816) --- htdocs/emailcollector/class/emailcollector.class.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index a34f94a4a9c..42db7d5c838 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -1144,7 +1144,12 @@ class EmailCollector extends CommonObject $keyforsupportedoauth2array = preg_replace('/-.*$/', '', $keyforsupportedoauth2array); $keyforsupportedoauth2array = 'OAUTH_'.$keyforsupportedoauth2array.'_NAME'; - $OAUTH_SERVICENAME = (empty($supportedoauth2array[$keyforsupportedoauth2array]['name']) ? 'Unknown' : $supportedoauth2array[$keyforsupportedoauth2array]['name'].($keyforprovider ? '-'.$keyforprovider : '')); + $OAUTH_SERVICENAME = 'Unknown'; + if ( array_key_exists($keyforsupportedoauth2array, $supportedoauth2array) + && array_key_exists('name', $supportedoauth2array[$keyforsupportedoauth2array]) + && !empty($supportedoauth2array[$keyforsupportedoauth2array]['name'])) { + $OAUTH_SERVICENAME = $supportedoauth2array[$keyforsupportedoauth2array]['name'].(!empty($keyforprovider) ? '-'.$keyforprovider : ''); + } require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php'; //$debugtext = "Host: ".$this->host."
Port: ".$this->port."
Login: ".$this->login."
Password: ".$this->password."
access type: ".$this->acces_type."
oauth service: ".$this->oauth_service."
Max email per collect: ".$this->maxemailpercollect; From dfd25926f11d71fcd1dfe32704aacabdd30ee59d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 23 Nov 2023 15:11:32 +0100 Subject: [PATCH 041/120] fix phpstan (#26815) --- htdocs/core/class/commonstickergenerator.class.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/commonstickergenerator.class.php b/htdocs/core/class/commonstickergenerator.class.php index b908a7f4cb8..46121cfe466 100644 --- a/htdocs/core/class/commonstickergenerator.class.php +++ b/htdocs/core/class/commonstickergenerator.class.php @@ -104,8 +104,12 @@ abstract class CommonStickerGenerator extends CommonDocGenerator protected $_First = 1; public $Tformat; - + /** + * @var array + */ + public $_Avery_Labels; // phpcs:enable + /** * Constructor * From de1b8da5eda7a8f1cb006e4e2d13d5c6235dedee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 23 Nov 2023 15:12:13 +0100 Subject: [PATCH 042/120] fix phpstan (#26814) --- htdocs/core/modules/dons/html_generic.modules.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/modules/dons/html_generic.modules.php b/htdocs/core/modules/dons/html_generic.modules.php index bfefe38d959..399429504c1 100644 --- a/htdocs/core/modules/dons/html_generic.modules.php +++ b/htdocs/core/modules/dons/html_generic.modules.php @@ -72,6 +72,7 @@ class html_generic extends ModeleDon private function loadTranslationFiles($outputlangs) { if (!is_object($outputlangs)) { + global $langs; $outputlangs = $langs; } From 5b50135a53f3ec6237e2aad2e93f1293b0077eb7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Nov 2023 15:14:19 +0100 Subject: [PATCH 043/120] FIX #26813 --- htdocs/core/modules/contract/doc/pdf_strato.modules.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php index df664626f2b..f2e16ec4bd1 100644 --- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php +++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php @@ -89,7 +89,7 @@ class pdf_strato extends ModelePDFContract */ public function __construct($db) { - global $conf, $langs, $mysoc; + global $langs, $mysoc; $this->db = $db; $this->name = 'strato'; @@ -513,8 +513,7 @@ class pdf_strato extends ModelePDFContract $hidetop = -1; } - $currency = !empty($currency) ? $currency : $conf->currency; - $default_font_size = pdf_getPDFFontSize($outputlangs); + //$default_font_size = pdf_getPDFFontSize($outputlangs); /* $pdf->SetXY($this->marge_gauche, $tab_top); From 184d93d25275c1688138741b8c1493f061535e0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 23 Nov 2023 17:06:33 +0100 Subject: [PATCH 044/120] fix phpstan (#26813) * fix phpstan * Update pdf_strato.modules.php --------- Co-authored-by: Laurent Destailleur --- htdocs/core/modules/contract/doc/pdf_strato.modules.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php index df664626f2b..c9fda913d4d 100644 --- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php +++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php @@ -513,7 +513,6 @@ class pdf_strato extends ModelePDFContract $hidetop = -1; } - $currency = !empty($currency) ? $currency : $conf->currency; $default_font_size = pdf_getPDFFontSize($outputlangs); /* From 25435eeb1a7e952dfaff3dc70a27656f9f2031bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 23 Nov 2023 17:07:32 +0100 Subject: [PATCH 045/120] fix phpdoc (#26829) * fix phpdoc * Update pdf.lib.php --- htdocs/core/lib/pdf.lib.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index ba4961cc5f6..4d547fb2b83 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -2440,9 +2440,9 @@ function pdf_getlinetotalwithtax($object, $i, $outputlangs, $hidedetails = 0) * Return linked objects to use for document generation. * Warning: To save space, this function returns only one link per link type (all links are concated on same record string). This function is used by pdf_writeLinkedObjects * - * @param object $object Object - * @param Translate $outputlangs Object lang for output - * @return array Linked objects + * @param CommonObject $object Object + * @param Translate $outputlangs Object lang for output + * @return array Linked objects */ function pdf_getLinkedObjects(&$object, $outputlangs) { @@ -2610,11 +2610,11 @@ function pdf_getSizeForImage($realpath) /** * Return line total amount discount * - * @param Object $object Object - * @param int $i Current line number - * @param Translate $outputlangs Object langs for output - * @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines) - * @return float Return total of line excl tax + * @param CommonObject $object Object + * @param int $i Current line number + * @param Translate $outputlangs Object langs for output + * @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines) + * @return float|string Return total of line excl tax */ function pdfGetLineTotalDiscountAmount($object, $i, $outputlangs, $hidedetails = 0) { From 253ebd0a8bbfeb2a98e5914d6d89d491e5062df9 Mon Sep 17 00:00:00 2001 From: atm-jonathan <146709163+atm-jonathan@users.noreply.github.com> Date: Thu, 23 Nov 2023 17:08:07 +0100 Subject: [PATCH 046/120] FIX warning php8.2 undefined_array_key (#26830) --- htdocs/core/lib/pdf.lib.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 3ac72e0d2c2..f20ef0a000a 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1789,7 +1789,7 @@ function pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails = 0) $reshook = 0; //if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) ) if (is_object($hookmanager)) { // Old code is commented on preceding line. Reproduce this test in the pdf_xxx function if you don't want your hook to run - $special_code = $object->lines[$i]->special_code; + $special_code = !empty($object->lines[$i]) ? $object->lines[$i]->special_code:''; if (!empty($object->lines[$i]->fk_parent_line)) { $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); } @@ -1856,7 +1856,7 @@ function pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails = 0) $reshook = 0; //if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) ) if (is_object($hookmanager)) { // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run - $special_code = $object->lines[$i]->special_code; + $special_code = !empty($object->lines[$i]) ? $object->lines[$i]->special_code:''; if (!empty($object->lines[$i]->fk_parent_line)) { $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); } @@ -1936,7 +1936,7 @@ function pdf_getlineqty($object, $i, $outputlangs, $hidedetails = 0) $reshook = 0; //if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) ) if (is_object($hookmanager)) { // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run - $special_code = $object->lines[$i]->special_code; + $special_code = !empty($object->lines[$i]) ? $object->lines[$i]->special_code:''; if (!empty($object->lines[$i]->fk_parent_line)) { $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); } @@ -2239,7 +2239,7 @@ function pdf_getlinetotalexcltax($object, $i, $outputlangs, $hidedetails = 0) $result = ''; //if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) ) if (is_object($hookmanager)) { // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run - $special_code = $object->lines[$i]->special_code; + $special_code = !empty($object->lines[$i]) ? $object->lines[$i]->special_code:''; if (!empty($object->lines[$i]->fk_parent_line)) { $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); } @@ -2252,7 +2252,7 @@ function pdf_getlinetotalexcltax($object, $i, $outputlangs, $hidedetails = 0) } } if (empty($reshook)) { - if ($object->lines[$i]->special_code == 3) { + if (!empty($object->lines[$i]) && $object->lines[$i]->special_code == 3) { $result .= $outputlangs->transnoentities("Option"); } elseif (empty($hidedetails) || $hidedetails > 1) { $total_ht = (!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1 ? $object->lines[$i]->multicurrency_total_ht : $object->lines[$i]->total_ht); From 010c2dd4beb32c7675a88da82999a039da790a04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 23 Nov 2023 17:09:36 +0100 Subject: [PATCH 047/120] fix phpstan (#26812) * fix phpstan * Update pdf_storm.modules.php --------- Co-authored-by: Laurent Destailleur --- htdocs/core/modules/delivery/doc/pdf_storm.modules.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/core/modules/delivery/doc/pdf_storm.modules.php b/htdocs/core/modules/delivery/doc/pdf_storm.modules.php index 91c00a56735..16bf8548c36 100644 --- a/htdocs/core/modules/delivery/doc/pdf_storm.modules.php +++ b/htdocs/core/modules/delivery/doc/pdf_storm.modules.php @@ -650,7 +650,6 @@ class pdf_storm extends ModelePDFDeliveryOrder $hidetop = -1; } - $currency = !empty($currency) ? $currency : $conf->currency; $default_font_size = pdf_getPDFFontSize($outputlangs); // Amount in (at tab_top - 1) From 47de053b0679d8e4427f33d86cf4395eec5cf2c2 Mon Sep 17 00:00:00 2001 From: IC-Nicolas Date: Thu, 23 Nov 2023 17:09:52 +0100 Subject: [PATCH 048/120] NEW &arrayfields into doAction (#26832) --- htdocs/fourn/commande/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index fa41acf343a..0d1ce8d1bad 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -241,7 +241,7 @@ if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massa $massaction = ''; } -$parameters = array('socid'=>$socid); +$parameters = array('socid'=>$socid, 'arrayfields'=>&$arrayfields); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); From 48ba0ec2d0712aa4471c47364e243adfc138b2d3 Mon Sep 17 00:00:00 2001 From: atm-jonathan <146709163+atm-jonathan@users.noreply.github.com> Date: Thu, 23 Nov 2023 17:12:57 +0100 Subject: [PATCH 049/120] FIX warning param $lineID getSpecialCode is negatif (#26826) * FIX warning param $lineID getSpecialCode is negatif * retour de PR --------- Co-authored-by: Laurent Destailleur --- htdocs/core/lib/pdf.lib.php | 40 ++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index f20ef0a000a..a1f7516bba9 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1351,7 +1351,7 @@ function pdf_writelinedesc(&$pdf, $object, $i, $outputlangs, $w, $h, $posx, $pos //if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) ) if (is_object($hookmanager)) { // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run $special_code = empty($object->lines[$i]->special_code) ? '' : $object->lines[$i]->special_code; - if (!empty($object->lines[$i]->fk_parent_line)) { + if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) { $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); } $parameters = array('pdf'=>$pdf, 'i'=>$i, 'outputlangs'=>$outputlangs, 'w'=>$w, 'h'=>$h, 'posx'=>$posx, 'posy'=>$posy, 'hideref'=>$hideref, 'hidedesc'=>$hidedesc, 'issupplierline'=>$issupplierline, 'special_code'=>$special_code); @@ -1693,7 +1693,7 @@ function pdf_getlinenum($object, $i, $outputlangs, $hidedetails = 0) //if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) ) if (is_object($hookmanager)) { // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run $special_code = $object->lines[$i]->special_code; - if (!empty($object->lines[$i]->fk_parent_line)) { + if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) { $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); } $parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code); @@ -1726,7 +1726,7 @@ function pdf_getlineref($object, $i, $outputlangs, $hidedetails = 0) //if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) ) if (is_object($hookmanager)) { // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run $special_code = $object->lines[$i]->special_code; - if (!empty($object->lines[$i]->fk_parent_line)) { + if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) { $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); } $parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code); @@ -1758,7 +1758,7 @@ function pdf_getlineref_supplier($object, $i, $outputlangs, $hidedetails = 0) //if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) ) if (is_object($hookmanager)) { // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run $special_code = $object->lines[$i]->special_code; - if (!empty($object->lines[$i]->fk_parent_line)) { + if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) { $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); } $parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code); @@ -1789,8 +1789,8 @@ function pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails = 0) $reshook = 0; //if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) ) if (is_object($hookmanager)) { // Old code is commented on preceding line. Reproduce this test in the pdf_xxx function if you don't want your hook to run - $special_code = !empty($object->lines[$i]) ? $object->lines[$i]->special_code:''; - if (!empty($object->lines[$i]->fk_parent_line)) { + $special_code = empty($object->lines[$i]) ? '' : $object->lines[$i]->special_code; + if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) { $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); } $parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code); @@ -1856,8 +1856,8 @@ function pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails = 0) $reshook = 0; //if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) ) if (is_object($hookmanager)) { // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run - $special_code = !empty($object->lines[$i]) ? $object->lines[$i]->special_code:''; - if (!empty($object->lines[$i]->fk_parent_line)) { + $special_code = empty($object->lines[$i]) ? '' : $object->lines[$i]->special_code; + if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) { $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); } $parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code); @@ -1900,7 +1900,7 @@ function pdf_getlineupwithtax($object, $i, $outputlangs, $hidedetails = 0) //if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) ) if (is_object($hookmanager)) { // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run $special_code = $object->lines[$i]->special_code; - if (!empty($object->lines[$i]->fk_parent_line)) { + if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) { $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); } $parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code); @@ -1936,8 +1936,8 @@ function pdf_getlineqty($object, $i, $outputlangs, $hidedetails = 0) $reshook = 0; //if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) ) if (is_object($hookmanager)) { // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run - $special_code = !empty($object->lines[$i]) ? $object->lines[$i]->special_code:''; - if (!empty($object->lines[$i]->fk_parent_line)) { + $special_code = empty($object->lines[$i]) ? '' : $object->lines[$i]->special_code; + if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) { $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); } $parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code); @@ -1977,7 +1977,7 @@ function pdf_getlineqty_asked($object, $i, $outputlangs, $hidedetails = 0) //if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) ) if (is_object($hookmanager)) { // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run $special_code = $object->lines[$i]->special_code; - if (!empty($object->lines[$i]->fk_parent_line)) { + if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) { $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); } $parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code); @@ -2017,7 +2017,7 @@ function pdf_getlineqty_shipped($object, $i, $outputlangs, $hidedetails = 0) //if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) ) if (is_object($hookmanager)) { // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run $special_code = $object->lines[$i]->special_code; - if (!empty($object->lines[$i]->fk_parent_line)) { + if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) { $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); } $parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code); @@ -2057,7 +2057,7 @@ function pdf_getlineqty_keeptoship($object, $i, $outputlangs, $hidedetails = 0) //if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) ) if (is_object($hookmanager)) { // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run $special_code = $object->lines[$i]->special_code; - if (!empty($object->lines[$i]->fk_parent_line)) { + if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) { $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); } $parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code); @@ -2098,7 +2098,7 @@ function pdf_getlineunit($object, $i, $outputlangs, $hidedetails = 0, $hookmanag //if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) ) if (is_object($hookmanager)) { // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run $special_code = $object->lines[$i]->special_code; - if (!empty($object->lines[$i]->fk_parent_line)) { + if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) { $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); } $parameters = array( @@ -2143,7 +2143,7 @@ function pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails = 0) //if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) ) if (is_object($hookmanager)) { // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run $special_code = $object->lines[$i]->special_code; - if (!empty($object->lines[$i]->fk_parent_line)) { + if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) { $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); } $parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code); @@ -2187,7 +2187,7 @@ function pdf_getlineprogress($object, $i, $outputlangs, $hidedetails = 0, $hookm //if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) ) if (is_object($hookmanager)) { // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run $special_code = $object->lines[$i]->special_code; - if (!empty($object->lines[$i]->fk_parent_line)) { + if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) { $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); } $parameters = array('i' => $i, 'outputlangs' => $outputlangs, 'hidedetails' => $hidedetails, 'special_code' => $special_code); @@ -2239,8 +2239,8 @@ function pdf_getlinetotalexcltax($object, $i, $outputlangs, $hidedetails = 0) $result = ''; //if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) ) if (is_object($hookmanager)) { // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run - $special_code = !empty($object->lines[$i]) ? $object->lines[$i]->special_code:''; - if (!empty($object->lines[$i]->fk_parent_line)) { + $special_code = empty($object->lines[$i]) ? '' : $object->lines[$i]->special_code; + if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) { $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); } $parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code, 'sign'=>$sign); @@ -2296,7 +2296,7 @@ function pdf_getlinetotalwithtax($object, $i, $outputlangs, $hidedetails = 0) //if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) ) if (is_object($hookmanager)) { // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run $special_code = $object->lines[$i]->special_code; - if (!empty($object->lines[$i]->fk_parent_line)) { + if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) { $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); } $parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code); From a58f84f1d55e007bea9d8f83905f7850a52e9579 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 23 Nov 2023 17:13:20 +0100 Subject: [PATCH 050/120] fix phpstan (#26811) --- htdocs/core/class/dolgeoip.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/core/class/dolgeoip.class.php b/htdocs/core/class/dolgeoip.class.php index 171aeddaf9b..ae186881cb2 100644 --- a/htdocs/core/class/dolgeoip.class.php +++ b/htdocs/core/class/dolgeoip.class.php @@ -33,6 +33,9 @@ */ class DolGeoIP { + /** + * @var GeoIp2\Database\Reader + */ public $gi; public $error; @@ -89,6 +92,7 @@ class DolGeoIP if ($geoipversion == '2') { try { + // @phpstan-ignore-next-line $this->gi = new GeoIp2\Database\Reader($datfile); // '/usr/local/share/GeoIP/GeoIP2-City.mmdb' } catch (Exception $e) { $this->error = $e->getMessage(); From 1c7239e6ff0670fadf31110aaf8db466222a98dd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Nov 2023 17:19:10 +0100 Subject: [PATCH 051/120] Fix type --- htdocs/core/lib/pdf.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index b71a0fa17c0..6ad73ed7092 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -2556,7 +2556,7 @@ function pdf_getSizeForImage($realpath) * @param int $i Current line number * @param Translate $outputlangs Object langs for output * @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines) - * @return float Return total of line excl tax + * @return float|string Return total of line excl tax */ function pdfGetLineTotalDiscountAmount($object, $i, $outputlangs, $hidedetails = 0) { From cc85a1acbfdaa53e8e52f0ffe8f3d716472424c7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Nov 2023 17:21:28 +0100 Subject: [PATCH 052/120] Close #26821 --- htdocs/core/modules/facture/doc/pdf_sponge.modules.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index bb01f8bfd0b..57596f3edca 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -1640,7 +1640,8 @@ class pdf_sponge extends ModelePDFFactures // Total remise $total_line_remise = 0; foreach ($object->lines as $i => $line) { - $total_line_remise += pdfGetLineTotalDiscountAmount($object, $i, $outputlangs, 2); // TODO: add this method to core/lib/pdf.lib + $resdiscount = pdfGetLineTotalDiscountAmount($object, $i, $outputlangs, 2); + $total_line_remise += (is_numeric($resdiscount) ? $resdiscount : 0); // Gestion remise sous forme de ligne négative if ($line->total_ht < 0) { $total_line_remise += -$line->total_ht; From 85d5e7caecc2e74eab191e588cafbd9812d61556 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 23 Nov 2023 17:24:35 +0100 Subject: [PATCH 053/120] Debug v19 (#26810) * Fix Warning: Invalid argument supplied for foreach() * Fix Warning: Invalid argument supplied for foreach() * Fix Undefined variable - Remove useless parameter * Fix Undefined variable $helpurl * Fix Undefined property $import_key * Fix Undefined variable $totalpaid * Fix undefined variable $nb * Update payments.php --------- Co-authored-by: Laurent Destailleur --- htdocs/compta/tva/card.php | 10 ++++----- htdocs/compta/tva/class/tva.class.php | 1 - htdocs/compta/tva/document.php | 2 -- htdocs/compta/tva/info.php | 4 ++-- htdocs/compta/tva/payments.php | 29 +++++++++++++-------------- 5 files changed, 21 insertions(+), 25 deletions(-) diff --git a/htdocs/compta/tva/card.php b/htdocs/compta/tva/card.php index c986355e3a1..cb149d1be10 100644 --- a/htdocs/compta/tva/card.php +++ b/htdocs/compta/tva/card.php @@ -1,8 +1,8 @@ - * Copyright (C) 2004-2016 Laurent Destailleur - * Copyright (C) 2005-2013 Regis Houssin - * Copyright (C) 2015-2017 Alexandre Spangaro +/* Copyright (C) 2003 Rodolphe Quiedeville + * Copyright (C) 2004-2016 Laurent Destailleur + * Copyright (C) 2005-2013 Regis Houssin + * Copyright (C) 2015-2023 Alexandre Spangaro * Copyright (C) 2018 Frédéric France * Copyright (C) 2021 Gauthier VERDOL * @@ -561,7 +561,7 @@ if ($id > 0) { print ''; } // Call Hook formConfirm - $parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid); + $parameters = array('formConfirm' => $formconfirm); $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if (empty($reshook)) { $formconfirm .= $hookmanager->resPrint; diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php index 3ff2b6178e7..43e092ea5ce 100644 --- a/htdocs/compta/tva/class/tva.class.php +++ b/htdocs/compta/tva/class/tva.class.php @@ -846,7 +846,6 @@ class Tva extends CommonObject $this->user_modification_id = $obj->fk_user_modif; $this->date_creation = $this->db->jdate($obj->datec); $this->date_modification = $this->db->jdate($obj->tms); - $this->import_key = $obj->import_key; } $this->db->free($result); diff --git a/htdocs/compta/tva/document.php b/htdocs/compta/tva/document.php index ef0416b91fd..9992a1ebce9 100644 --- a/htdocs/compta/tva/document.php +++ b/htdocs/compta/tva/document.php @@ -126,8 +126,6 @@ if ($object->id) { $linkback = ''.$langs->trans("BackToList").''; - $object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status - $morehtmlright = ''; dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); diff --git a/htdocs/compta/tva/info.php b/htdocs/compta/tva/info.php index c850d05e036..a54be0cdf28 100644 --- a/htdocs/compta/tva/info.php +++ b/htdocs/compta/tva/info.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2016-2023 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -62,7 +62,7 @@ if ($action == 'setlib' && $user->hasRight('tax', 'charges', 'creer')) { $title = $langs->trans("VAT")." - ".$langs->trans("Info"); $help_url = ''; -llxHeader("", $title, $helpurl); +llxHeader("", $title, $help_url); $object = new Tva($db); $object->fetch($id); diff --git a/htdocs/compta/tva/payments.php b/htdocs/compta/tva/payments.php index 2b3b5354cea..88785734147 100644 --- a/htdocs/compta/tva/payments.php +++ b/htdocs/compta/tva/payments.php @@ -1,11 +1,11 @@ - * Copyright (C) 2004-2014 Laurent Destailleur - * Copyright (C) 2005-2010 Regis Houssin - * Copyright (C) 2011-2016 Alexandre Spangaro - * Copyright (C) 2011-2014 Juanjo Menent - * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2021 Gauthier VERDOL +/* Copyright (C) 2001-2003 Rodolphe Quiedeville + * Copyright (C) 2004-2014 Laurent Destailleur + * Copyright (C) 2005-2010 Regis Houssin + * Copyright (C) 2011-2023 Alexandre Spangaro + * Copyright (C) 2011-2014 Juanjo Menent + * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2021 Gauthier VERDOL * * 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 @@ -24,7 +24,7 @@ /** * \file htdocs/compta/tva/payments.php * \ingroup compta - * \brief Page to list payments of special expenses + * \brief Page to list payments of special expenses */ // Load Dolibarr environment @@ -285,7 +285,6 @@ if (isModEnabled('tax') && $user->hasRight('tax', 'charges', 'lire')) { print ''; $total = $total + $obj->total; - $totalnb = $totalnb + $obj->nb; $totalpaid = $totalpaid + $obj->totalpaid; $i++; } @@ -293,14 +292,14 @@ if (isModEnabled('tax') && $user->hasRight('tax', 'charges', 'lire')) { // Total print '' . $langs->trans("Total") . ''; print ''; // A total here has no sense - print ' '; - print ' '; + print ' '; + print ' '; if (isModEnabled("banque")) { - print ' '; - print ' '; + print ' '; + print ' '; } - print ' '; - print ' '; + print ' '; + print ' '; print '' . price($totalpaid) . ""; print ""; } From 81c22d00f1f24557c70acf67f393704edeb4b797 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 23 Nov 2023 17:24:55 +0100 Subject: [PATCH 054/120] fix phpstan (#26809) --- htdocs/expedition/class/api_shipments.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/expedition/class/api_shipments.class.php b/htdocs/expedition/class/api_shipments.class.php index ca8ec43ca84..b7510c7d805 100644 --- a/htdocs/expedition/class/api_shipments.class.php +++ b/htdocs/expedition/class/api_shipments.class.php @@ -643,7 +643,7 @@ class Shipments extends DolibarrApi throw new RestException(404, 'Shipment not found'); } - if (!DolibarrApi::_checkAccessToResource('expedition', $this->commande->id)) { + if (!DolibarrApi::_checkAccessToResource('expedition', $this->shipment->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } @@ -652,7 +652,7 @@ class Shipments extends DolibarrApi throw new RestException(304, 'Error nothing done. May be object is already closed'); } if ($result < 0) { - throw new RestException(500, 'Error when closing Order: '.$this->commande->error); + throw new RestException(500, 'Error when closing Order: '.$this->shipment->error); } // Reload shipment From 7f0a0b63562409460b402641145a5f935b077151 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 23 Nov 2023 17:25:26 +0100 Subject: [PATCH 055/120] fix phpstan (#26807) --- .../modules_knowledgerecord.php | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/htdocs/knowledgemanagement/core/modules/knowledgemanagement/modules_knowledgerecord.php b/htdocs/knowledgemanagement/core/modules/knowledgemanagement/modules_knowledgerecord.php index 8e19931fbdb..85bc2e22062 100644 --- a/htdocs/knowledgemanagement/core/modules/knowledgemanagement/modules_knowledgerecord.php +++ b/htdocs/knowledgemanagement/core/modules/knowledgemanagement/modules_knowledgerecord.php @@ -138,21 +138,6 @@ abstract class ModeleNumRefKnowledgeRecord */ public function getVersion() { - global $langs; - $langs->load("admin"); - - if ($this->version == 'development') { - return $langs->trans("VersionDevelopment"); - } - if ($this->version == 'experimental') { - return $langs->trans("VersionExperimental"); - } - if ($this->version == 'dolibarr') { - return DOL_VERSION; - } - if ($this->version) { - return $this->version; - } - return $langs->trans("NotAvailable"); + return DOL_VERSION; } } From 146e780ddd68f73dfc1afcab3723120560aa1811 Mon Sep 17 00:00:00 2001 From: MDW Date: Thu, 23 Nov 2023 17:25:44 +0100 Subject: [PATCH 056/120] QUAL Fix typing hint for date (which is int|string) (#26808) --- htdocs/salaries/class/paymentsalary.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/salaries/class/paymentsalary.class.php b/htdocs/salaries/class/paymentsalary.class.php index fa6e1d120b5..8a284e6f99e 100644 --- a/htdocs/salaries/class/paymentsalary.class.php +++ b/htdocs/salaries/class/paymentsalary.class.php @@ -57,14 +57,14 @@ class PaymentSalary extends CommonObject public $tms = ''; /** - * @var date date of payment + * @var int|string date of payment * @deprecated * @see datep */ public $datepaye = ''; /** - * @var date date of payment + * @var int|string date of payment */ public $datep = ''; From a8b2c631ab274ef04f16366dcf18a0de3c11d818 Mon Sep 17 00:00:00 2001 From: sonikf <93765174+sonikf@users.noreply.github.com> Date: Thu, 23 Nov 2023 18:28:32 +0200 Subject: [PATCH 057/120] fix #25348 (#26806) * fix #25348 * fix #25348 --- htdocs/compta/facture/card.php | 2 +- htdocs/langs/en_US/bills.lang | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index a9f862d5180..21ab2f0cb47 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3710,7 +3710,7 @@ if ($action == 'create') { } $text = $tmp.' '; //$text .= '('.$langs->trans("YouMustCreateInvoiceFromThird").') '; - $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc").'

'.$langs->trans("YouMustCreateInvoiceFromThird"), 1, 'help', '', 0, 3, 'creditnoteonsmartphone'); + $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc").'

'.$langs->trans("CreateCreditNoteWhenClientInvoiceExists"), 1, 'help', '', 0, 3, 'creditnoteonsmartphone'); print $desc; print '
'."\n"; } diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index c0d9a1dd9d0..baba0dd75e2 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -645,3 +645,4 @@ Salaries=Salaries InvoiceSubtype=Invoice Subtype SalaryInvoice=Salary BillsAndSalaries=Bills & Salaries +CreateCreditNoteWhenClientInvoiceExists=This option is enabled only when validated invoice(s) exist for a customer or when constant INVOICE_CREDIT_NOTE_STANDALONE is used(useful for some countries) From ff44558e36f61900e352325873fa20186bd0e7cc Mon Sep 17 00:00:00 2001 From: MDW Date: Thu, 23 Nov 2023 17:30:43 +0100 Subject: [PATCH 058/120] FIX Get array value for arrayname in loop. (#26805) Reported by phan: htdocs/mrp/class/api_mos.class.php:369 PhanTypeMismatchForeach 'arraytoconsume'|'arraytoproduce' passed to foreach instead of array --- htdocs/mrp/class/api_mos.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/mrp/class/api_mos.class.php b/htdocs/mrp/class/api_mos.class.php index 1c9d7d612da..686ad65a220 100644 --- a/htdocs/mrp/class/api_mos.class.php +++ b/htdocs/mrp/class/api_mos.class.php @@ -366,7 +366,7 @@ class Mos extends DolibarrApi $pos = 0; $arrayofarrayname = array("arraytoconsume","arraytoproduce"); foreach ($arrayofarrayname as $arrayname) { - foreach ($arrayname as $value) { + foreach (${$arrayname} as $value) { $tmpproduct = new Product($this->db); if (empty($value["objectid"])) { throw new RestException(500, "Field objectid required in ".$arrayname); From 69f66f2a488a4757bc32c7515ebf8a9101e50705 Mon Sep 17 00:00:00 2001 From: atm-jonathan <146709163+atm-jonathan@users.noreply.github.com> Date: Thu, 23 Nov 2023 17:44:32 +0100 Subject: [PATCH 059/120] FIX warning addLine Facture fk_prev_id and situation_percent (#26825) * addLine Facture fk_prev_id and situation_percent * retour PR --- htdocs/compta/facture/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 21ab2f0cb47..0e00d586a2e 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1790,8 +1790,8 @@ if (empty($reshook)) { $lines[$i]->pa_ht, $label, $array_options, - $lines[$i]->situation_percent, - $lines[$i]->fk_prev_id, + $lines[$i]->situation_percent ?? 100, + $lines[$i]->fk_prev_id ?? 0, $lines[$i]->fk_unit, 0, '', From 3a39ec684cefb5ab1071b44d7ee95ab2ff12161a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 23 Nov 2023 17:45:11 +0100 Subject: [PATCH 060/120] fix phpstan (#26804) --- .../interface_50_modTicket_TicketEmail.class.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php index 2de8b272381..300b0af36f6 100644 --- a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php +++ b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php @@ -376,13 +376,15 @@ class InterfaceTicketEmail extends DolibarrTriggers */ private function composeAndSendCustomerMessage($sendto, $base_subject, $body, $see_ticket, Ticket $object, Translate $langs) { - global $conf, $user; + global $conf, $extrafields, $mysoc, $user; // Init to avoid errors $filepath = array(); $filename = array(); $mimetype = array(); + $appli = $mysoc->name; + $subject = '['.$appli.'] '.$langs->transnoentities($base_subject); $message_customer = $langs->transnoentities($body, $object->track_id).'
'; $message_customer .= '
  • '.$langs->trans('Title').' : '.$object->subject.'
  • '; @@ -391,15 +393,15 @@ class InterfaceTicketEmail extends DolibarrTriggers $message_customer .= '
  • '.$langs->trans('Severity').' : '.$langs->getLabelFromKey($this->db, 'TicketSeverityShort'.$object->severity_code, 'c_ticket_severity', 'code', 'label', $object->severity_code).'
  • '; // Extrafields - if (is_array($this->attributes[$object->table_element]['label'])) { - foreach ($this->attributes[$object->table_element]['label'] as $key => $value) { + if (is_array($extrafields->attributes[$object->table_element]['label'])) { + foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $value) { $enabled = 1; - if ($enabled && isset($this->attributes[$object->table_element]['list'][$key])) { - $enabled = dol_eval($this->attributes[$object->table_element]['list'][$key], 1); + if ($enabled && isset($extrafields->attributes[$object->table_element]['list'][$key])) { + $enabled = dol_eval($extrafields->attributes[$object->table_element]['list'][$key], 1); } $perms = 1; - if ($perms && isset($this->attributes[$object->table_element]['perms'][$key])) { - $perms = dol_eval($this->attributes[$object->table_element]['perms'][$key], 1); + if ($perms && isset($extrafields->attributes[$object->table_element]['perms'][$key])) { + $perms = dol_eval($extrafields->attributes[$object->table_element]['perms'][$key], 1); } $qualified = true; From 8d203f4fd4678a6a64e800277cca17b256b5eb85 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 23 Nov 2023 17:45:59 +0100 Subject: [PATCH 061/120] Debug v19 (#26784) * Translate comment * Fix undefined variable * Fix undefined variable * Fix undefined variable - better fix * Add translation of ProfId so that it is not displayed in admin * Remove manual definition and call getDefaultImageSizes() instead --- htdocs/admin/company.php | 8 ++++++ htdocs/core/lib/images.lib.php | 48 +++++++++++++++---------------- htdocs/langs/en_US/companies.lang | 8 ++++++ 3 files changed, 40 insertions(+), 24 deletions(-) diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index 5b4de0c787d..02f426575eb 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -51,6 +51,13 @@ if (!$user->admin) { $error = 0; +$tmparraysize = getDefaultImageSizes(); +$maxwidthsmall = $tmparraysize['maxwidthsmall']; +$maxheightsmall = $tmparraysize['maxheightsmall']; +$maxwidthmini = $tmparraysize['maxwidthmini']; +$maxheightmini = $tmparraysize['maxheightmini']; +$quality = $tmparraysize['quality']; + // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('admincompany', 'globaladmin')); @@ -143,6 +150,7 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha')) // Create thumbs //$object->addThumbs($newfile); // We can't use addThumbs here yet because we need name of generated thumbs to add them into constants. TODO Check if need such constants. We should be able to retrieve value with get... + // Create small thumb, Used on logon for example $imgThumbSmall = vignette($dirforimage.$original_file, $maxwidthsmall, $maxheightsmall, '_small', $quality); if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i', $imgThumbSmall, $reg)) { diff --git a/htdocs/core/lib/images.lib.php b/htdocs/core/lib/images.lib.php index 6acb7bdfdae..a3dc6a6d254 100644 --- a/htdocs/core/lib/images.lib.php +++ b/htdocs/core/lib/images.lib.php @@ -498,9 +498,9 @@ function correctExifImageOrientation($fileSource, $fileDest, $quality = 95) * If file is myfile.jpg, new file may be myfile_small.jpg * * @param string $file Path of source file to resize - * @param int $maxWidth Largeur maximum que dois faire la miniature (-1=unchanged, 160 by default) - * @param int $maxHeight Hauteur maximum que dois faire l'image (-1=unchanged, 120 by default) - * @param string $extName Extension to differenciate thumb file name ('_small', '_mini') + * @param int $maxWidth Maximum width of the thumbnail (-1=unchanged, 160 by default) + * @param int $maxHeight Maximum height of the thumbnail (-1=unchanged, 120 by default) + * @param string $extName Extension to differentiate thumb file name ('_small', '_mini') * @param int $quality Quality of compression (0=worst, 100=best) * @param string $outdir Directory where to store thumb * @param int $targetformat New format of target (IMAGETYPE_GIF, IMAGETYPE_JPG, IMAGETYPE_PNG, IMAGETYPE_BMP, IMAGETYPE_WBMP ... or 0 to keep old format) @@ -519,21 +519,21 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small', // Check parameters if (!$file) { - // Si le fichier n'a pas ete indique + // If the file has not been indicated return 'ErrorBadParameters'; } elseif (!file_exists($file)) { - // Si le fichier passe en parametre n'existe pas + // If the file passed in parameter does not exist dol_syslog($langs->trans("ErrorFileNotFound", $file), LOG_ERR); return $langs->trans("ErrorFileNotFound", $file); } elseif (image_format_supported($file) < 0) { dol_syslog('This file '.$file.' does not seem to be an image format file name.', LOG_WARNING); return 'ErrorBadImageFormat'; } elseif (!is_numeric($maxWidth) || empty($maxWidth) || $maxWidth < -1) { - // Si la largeur max est incorrecte (n'est pas numerique, est vide, ou est inferieure a 0) + // If max width is incorrect (not numeric, empty, or less than 0) dol_syslog('Wrong value for parameter maxWidth', LOG_ERR); return 'Error: Wrong value for parameter maxWidth'; } elseif (!is_numeric($maxHeight) || empty($maxHeight) || $maxHeight < -1) { - // Si la hauteur max est incorrecte (n'est pas numerique, est vide, ou est inferieure a 0) + // If max height is incorrect (not numeric, empty, or less than 0) dol_syslog('Wrong value for parameter maxHeight', LOG_ERR); return 'Error: Wrong value for parameter maxHeight'; } @@ -559,7 +559,7 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small', $maxHeight = $infoImg[1]; // If size is -1, we keep unchanged } - // Si l'image est plus petite que la largeur et la hauteur max, on ne cree pas de vignette + // If the image is smaller than the maximum width and height, no thumbnail is created. if ($infoImg[0] < $maxWidth && $infoImg[1] < $maxHeight) { // On cree toujours les vignettes dol_syslog("File size is smaller than thumb size", LOG_DEBUG); @@ -586,16 +586,16 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small', } if ($imgfonction) { if (!function_exists($imgfonction)) { - // Fonctions de conversion non presente dans ce PHP + // Conversion functions not present in this PHP return 'Error: Creation of thumbs not possible. This PHP does not support GD function '.$imgfonction; } } - // On cree le repertoire contenant les vignettes - $dirthumb = dirname($file).($outdir ? '/'.$outdir : ''); // Chemin du dossier contenant les vignettes + // We create the directory containing the thumbnails + $dirthumb = dirname($file).($outdir ? '/'.$outdir : ''); // Path to thumbnail folder dol_mkdir($dirthumb); - // Initialisation des variables selon l'extension de l'image + // Variable initialization according to image extension $img = null; switch ($infoImg[2]) { case IMAGETYPE_GIF: // 1 @@ -668,7 +668,7 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small', } } - // Initialisation des dimensions de la vignette si elles sont superieures a l'original + // Initialize thumbnail dimensions if larger than original if ($maxWidth > $imgWidth) { $maxWidth = $imgWidth; } @@ -676,16 +676,16 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small', $maxHeight = $imgHeight; } - $whFact = $maxWidth / $maxHeight; // Facteur largeur/hauteur des dimensions max de la vignette - $imgWhFact = $imgWidth / $imgHeight; // Facteur largeur/hauteur de l'original + $whFact = $maxWidth / $maxHeight; // Width/height factor for maximum label dimensions + $imgWhFact = $imgWidth / $imgHeight; // Original width/height factor - // Fixe les dimensions de la vignette + // Set label dimensions if ($whFact < $imgWhFact) { - // Si largeur determinante + // If determining width $thumbWidth = $maxWidth; $thumbHeight = $thumbWidth / $imgWhFact; } else { - // Si hauteur determinante + // If determining height $thumbHeight = $maxHeight; $thumbWidth = $thumbHeight * $imgWhFact; } @@ -715,11 +715,11 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small', imagesavealpha($imgThumb, true); } - // Initialisation des variables selon l'extension de l'image + // Variable initialization according to image extension // $targetformat is 0 by default, in such case, we keep original extension switch ($targetformat) { case IMAGETYPE_GIF: // 1 - $trans_colour = imagecolorallocate($imgThumb, 255, 255, 255); // On procede autrement pour le format GIF + $trans_colour = imagecolorallocate($imgThumb, 255, 255, 255); // The GIF format works differently imagecolortransparent($imgThumb, $trans_colour); $extImgTarget = '.gif'; $newquality = 'NU'; @@ -730,7 +730,7 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small', $newquality = $quality; break; case IMAGETYPE_PNG: // 3 - imagealphablending($imgThumb, false); // Pour compatibilite sur certain systeme + imagealphablending($imgThumb, false); // For compatibility on certain systems $trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 127); // Keep transparent channel $extImgTarget = '.png'; $newquality = $quality - 100; @@ -752,10 +752,10 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small', } dol_syslog("vignette: convert image from ($imgWidth x $imgHeight) to ($thumbWidth x $thumbHeight) as $extImg, newquality=$newquality"); - //imagecopyresized($imgThumb, $img, 0, 0, 0, 0, $thumbWidth, $thumbHeight, $imgWidth, $imgHeight); // Insere l'image de base redimensionnee - imagecopyresampled($imgThumb, $img, 0, 0, 0, 0, $thumbWidth, $thumbHeight, $imgWidth, $imgHeight); // Insere l'image de base redimensionnee + //imagecopyresized($imgThumb, $img, 0, 0, 0, 0, $thumbWidth, $thumbHeight, $imgWidth, $imgHeight); // Insert resized base image + imagecopyresampled($imgThumb, $img, 0, 0, 0, 0, $thumbWidth, $thumbHeight, $imgWidth, $imgHeight); // Insert resized base image - $fileName = preg_replace('/(\.gif|\.jpeg|\.jpg|\.png|\.bmp)$/i', '', $file); // On enleve extension quelquesoit la casse + $fileName = preg_replace('/(\.gif|\.jpeg|\.jpg|\.png|\.bmp)$/i', '', $file); // We remove any extension box $fileName = basename($fileName); //$imgThumbName = $dirthumb.'/'.getImageFileNameForSize(basename($file), $extName, $extImgTarget); // Full path of thumb file $imgThumbName = getImageFileNameForSize($file, $extName, $extImgTarget); // Full path of thumb file diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index 3a6359db9cc..b3486e4d16b 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -211,12 +211,20 @@ ProfId3FR=Prof Id 3 (NAF, old APE) ProfId4FR=Prof Id 4 (RCS/RM) ProfId5FR=Prof Id 5 (numéro EORI) ProfId6FR=- +ProfId7FR=- +ProfId8FR=- +ProfId9FR=- +ProfId10FR=- ProfId1ShortFR=SIREN ProfId2ShortFR=SIRET ProfId3ShortFR=NAF ProfId4ShortFR=RCS ProfId5ShortFR=EORI ProfId6ShortFR=- +ProfId7ShortFR=- +ProfId8ShortFR=- +ProfId9ShortFR=- +ProfId10ShortFR=- ProfId1GB=Registration Number ProfId2GB=- ProfId3GB=SIC From 22e5ef6e183bf4b99aa5dfeecb7c3f6d25b54326 Mon Sep 17 00:00:00 2001 From: sonikf <93765174+sonikf@users.noreply.github.com> Date: Thu, 23 Nov 2023 18:47:17 +0200 Subject: [PATCH 062/120] fix fetch vat details not working for some use cases (#26771) * fix not working for some use cases * fix not working for some use cases * use DOL_URL_ROOT * fix travis * Fix missing address --- htdocs/societe/card.php | 5 +++-- htdocs/societe/checkvat/checkVatGr.php | 10 +++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 0ed106bb742..79b8d8923eb 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -69,7 +69,7 @@ if (isModEnabled('eventorganization')) { if ($mysoc->country_code == 'GR') { $u = getDolGlobalString('AADE_WEBSERVICE_USER'); $p = getDolGlobalString('AADE_WEBSERVICE_KEY'); - $myafm = getDolGlobalString('MAIN_INFO_TVAINTRA'); + $myafm = preg_replace('/\D/', '', getDolGlobalString('MAIN_INFO_TVAINTRA')); } @@ -3225,7 +3225,7 @@ function GRVAT(a, u, p, myafm) { $.ajax({ type: "GET", - url: "/societe/checkvat/checkVatGr.php", + url: '/societe/checkvat/checkVatGr.php', data: { afm }, // Set request parameters success: function(data) { var obj = data; // Parse response data as JSON @@ -3235,6 +3235,7 @@ function GRVAT(a, u, p, myafm) { alert(obj.pErrorRec_out.errorDescr); // Display error message if AFM is null } else { $("#name").val(obj.RgWsPublicBasicRt_out.onomasia); // Set 'name' field value + $("#address").val(obj.RgWsPublicBasicRt_out.postalAddress + " " + obj.RgWsPublicBasicRt_out.postalAddressNo); // Set 'address' field value $("#zipcode").val(obj.RgWsPublicBasicRt_out.postalZipCode); // Set 'zipcode' field value $("#town").val(obj.RgWsPublicBasicRt_out.postalAreaDescription); // Set 'town' field value $("#idprof2").val(obj.RgWsPublicBasicRt_out.doyDescr); // Set 'idprof2' field value diff --git a/htdocs/societe/checkvat/checkVatGr.php b/htdocs/societe/checkvat/checkVatGr.php index bc678db1a1d..ac94cb9dadc 100644 --- a/htdocs/societe/checkvat/checkVatGr.php +++ b/htdocs/societe/checkvat/checkVatGr.php @@ -27,7 +27,7 @@ require "../../main.inc.php"; $username = getDolGlobalString('AADE_WEBSERVICE_USER'); // Get username from request $password = getDolGlobalString('AADE_WEBSERVICE_KEY'); // Get password from request -$myafm = getDolGlobalString('MAIN_INFO_TVAINTRA'); // Get Vat from request +$myafm = preg_replace('/\D/', '', getDolGlobalString('MAIN_INFO_TVAINTRA')); // Get Vat from request after removing non-digit characters $afm = GETPOST('afm'); // Get client Vat from request // Make call to check VAT for Greek client @@ -40,11 +40,11 @@ echo json_encode($result); // Encode the result as JSON and output * Request VAT details * @param string $username Company AADE username * @param string $password Company AADE password -* @param string $AFMcalledfor Company vat number -* @param string $AFMcalledby Client vat number +* @param string $AFMcalledby Company vat number +* @param string $AFMcalledfor Client vat number * @return string */ -function checkVATGR($username, $password, $AFMcalledfor, $AFMcalledby = '') +function checkVATGR($username, $password, $AFMcalledby, $AFMcalledfor) { /* $WS_DOL_URL_WSDL = "https://www1.gsis.gr/webtax2/wsgsis/RgWsPublic/RgWsPublicPort?WSDL"; @@ -76,7 +76,7 @@ function checkVATGR($username, $password, $AFMcalledfor, $AFMcalledby = '') $authHeader->UsernameToken = new stdClass(); $authHeader->UsernameToken->Username = "$username"; $authHeader->UsernameToken->Password = "$password"; - $Headers[] = new SoapHeader('http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd', 'Security', $authHeader, true); + $Headers[] = new SoapHeader('https://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd', 'Security', $authHeader, true); $client->__setSoapHeaders($Headers); $result = $client->rgWsPublicAfmMethod( array( From 7fa5565a3665e96ba228e6bfe608c523b75f0057 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Nov 2023 18:07:05 +0100 Subject: [PATCH 063/120] Doc --- htdocs/core/class/commonobject.class.php | 4 +++- htdocs/core/class/html.formfile.class.php | 8 ++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index be467a84ddd..1ef60a21f49 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1780,7 +1780,9 @@ abstract class CommonObject return 0; } - $sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element." WHERE ".$this->table_ref_field." LIKE '".$this->db->escape($ref)."' LIMIT 1"; + $sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element; + $sql .= " WHERE ".$this->table_ref_field." LIKE '".$this->db->escape($ref)."'"; // no escapeforlike here + $sql .= " LIMIT 1"; $query = $this->db->query($sql); diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 70c9e87ee2b..924dbb16f74 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1877,10 +1877,10 @@ class FormFile } else { if (!($result = $object_instance->fetch('', $ref))) { //fetchOneLike looks for objects with wildcards in its reference. - //It is useful for those masks who get underscores instead of their actual symbols (because the _ had replaced a forbiddn char) - //fetchOneLike requires some info in the object. If it doesn't have it, then 0 is returned - //that's why we look only into fetchOneLike when fetch returns 0 - // TODO Remove this part ? + //It is useful for those masks who get underscores instead of their actual symbols (because the _ had replaced all forbidden chars into filename) + // TODO Example when this is needed ? + // This may find when ref is 'A_B' and date was stored as 'A~B' into database, but in which case do we have this ? + // May be we can add hidden option to enable this. $result = $object_instance->fetchOneLike($ref); } } From ba1f811921eebf6503c6f196c0534da7a87d7bf8 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 23 Nov 2023 18:58:59 +0100 Subject: [PATCH 064/120] Closure period - Add information on index & warning on each journal pages (#26742) Co-authored-by: Laurent Destailleur --- htdocs/accountancy/index.php | 10 +++++++-- htdocs/accountancy/journal/bankjournal.php | 21 +++++++++++++++++-- .../journal/expensereportsjournal.php | 17 +++++++++++++++ .../accountancy/journal/purchasesjournal.php | 19 ++++++++++++++++- htdocs/accountancy/journal/sellsjournal.php | 19 ++++++++++++++++- htdocs/accountancy/journal/variousjournal.php | 19 ++++++++++++++++- htdocs/langs/en_US/accountancy.lang | 2 ++ 7 files changed, 100 insertions(+), 7 deletions(-) diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php index 6b3a833f2d1..f8401072123 100644 --- a/htdocs/accountancy/index.php +++ b/htdocs/accountancy/index.php @@ -1,6 +1,6 @@ - * Copyright (C) 2016-2019 Alexandre Spangaro + * Copyright (C) 2016-2023 Alexandre Spangaro * Copyright (C) 2019-2021 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -92,7 +92,7 @@ if (isModEnabled('accounting')) { $showtutorial = ''; if (!$helpisexpanded) { - $showtutorial = '
    '; + $showtutorial = ''; @@ -146,6 +146,12 @@ if (isModEnabled('accounting')) { print "
    \n"; print "
    \n"; + $step++; + $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescFiscalPeriod", $step, '{s}'); + $s = str_replace('{s}', ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("FiscalPeriod").'', $s); + print $s; + print "
    \n"; + $step++; $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDefault", $step, '{s}'); $s = str_replace('{s}', ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'', $s); diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index eb109210423..536e510195e 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -5,7 +5,7 @@ * Copyright (C) 2012 Regis Houssin * Copyright (C) 2013 Christophe Battarel * Copyright (C) 2013-2022 Open-DSI - * Copyright (C) 2013-2023 Alexandre Spangaro + * Copyright (C) 2013-2023 Alexandre Spangaro * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2013-2014 Olivier Geffroy * Copyright (C) 2017-2023 Frédéric France @@ -1066,13 +1066,30 @@ if (empty($action) || $action == 'view') { $desc = ''; // Test that setup is complete (we are in accounting, so test on entity is always on $conf->entity only, no sharing allowed) + // Fiscal period test + $sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."accounting_fiscalyear WHERE entity = ".((int) $conf->entity); + $resql = $db->query($sql); + if ($resql) { + $obj = $db->fetch_object($resql); + if ($obj->nb == 0) { + print '
    '.img_warning().' '.$langs->trans("TheFiscalPeriodIsNotDefined"); + $desc = ' : '.$langs->trans("AccountancyAreaDescFiscalPeriod", 4, '{link}'); + $desc = str_replace('{link}', ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("FiscalPeriod").'', $desc); + print $desc; + print '
    '; + } + } else { + dol_print_error($db); + } + + // Bank test $sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."bank_account WHERE entity = ".((int) $conf->entity)." AND fk_accountancy_journal IS NULL AND clos=0"; $resql = $db->query($sql); if ($resql) { $obj = $db->fetch_object($resql); if ($obj->nb > 0) { print '
    '.img_warning().' '.$langs->trans("TheJournalCodeIsNotDefinedOnSomeBankAccount"); - $desc = ' : '.$langs->trans("AccountancyAreaDescBank", 9, '{link}'); + $desc = ' : '.$langs->trans("AccountancyAreaDescBank", 6, '{link}'); $desc = str_replace('{link}', ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("BankAccounts").'', $desc); print $desc; print '
    '; diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php index df1c8bb7e90..e624a07108c 100644 --- a/htdocs/accountancy/journal/expensereportsjournal.php +++ b/htdocs/accountancy/journal/expensereportsjournal.php @@ -564,6 +564,23 @@ if (empty($action) || $action == 'view') { journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink); + // Test that setup is complete (we are in accounting, so test on entity is always on $conf->entity only, no sharing allowed) + // Fiscal period test + $sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."accounting_fiscalyear WHERE entity = ".((int) $conf->entity); + $resql = $db->query($sql); + if ($resql) { + $obj = $db->fetch_object($resql); + if ($obj->nb == 0) { + print '
    '.img_warning().' '.$langs->trans("TheFiscalPeriodIsNotDefined"); + $desc = ' : '.$langs->trans("AccountancyAreaDescFiscalPeriod", 4, '{link}'); + $desc = str_replace('{link}', ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("FiscalPeriod").'', $desc); + print $desc; + print '
    '; + } + } else { + dol_print_error($db); + } + // Button to write into Ledger if (!getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT') || getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT') == '-1') { print '
    '.img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone"); diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index 14f3966902b..69db686615f 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -3,7 +3,7 @@ * Copyright (C) 2007-2010 Jean Heimburger * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2012 Regis Houssin - * Copyright (C) 2013-2023 Alexandre Spangaro + * Copyright (C) 2013-2023 Alexandre Spangaro * Copyright (C) 2013-2016 Olivier Geffroy * Copyright (C) 2013-2016 Florian Henry * Copyright (C) 2018 Frédéric France @@ -937,6 +937,23 @@ if (empty($action) || $action == 'view') { journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink); + // Test that setup is complete (we are in accounting, so test on entity is always on $conf->entity only, no sharing allowed) + // Fiscal period test + $sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."accounting_fiscalyear WHERE entity = ".((int) $conf->entity); + $resql = $db->query($sql); + if ($resql) { + $obj = $db->fetch_object($resql); + if ($obj->nb == 0) { + print '
    '.img_warning().' '.$langs->trans("TheFiscalPeriodIsNotDefined"); + $desc = ' : '.$langs->trans("AccountancyAreaDescFiscalPeriod", 4, '{link}'); + $desc = str_replace('{link}', ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("FiscalPeriod").'', $desc); + print $desc; + print '
    '; + } + } else { + dol_print_error($db); + } + // Button to write into Ledger $acctSupplierNotConfigured = in_array(getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER'), ['','-1']); if ($acctSupplierNotConfigured) { diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index f27d5a8c1bc..f2dfb091edb 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -4,7 +4,7 @@ * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2012 Regis Houssin * Copyright (C) 2013 Christophe Battarel - * Copyright (C) 2013-2023 Alexandre Spangaro + * Copyright (C) 2013-2023 Alexandre Spangaro * Copyright (C) 2013-2016 Florian Henry * Copyright (C) 2013-2016 Olivier Geffroy * Copyright (C) 2014 Raphaël Doursenaud @@ -994,6 +994,23 @@ if (empty($action) || $action == 'view') { journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink); + // Test that setup is complete (we are in accounting, so test on entity is always on $conf->entity only, no sharing allowed) + // Fiscal period test + $sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."accounting_fiscalyear WHERE entity = ".((int) $conf->entity); + $resql = $db->query($sql); + if ($resql) { + $obj = $db->fetch_object($resql); + if ($obj->nb == 0) { + print '
    '.img_warning().' '.$langs->trans("TheFiscalPeriodIsNotDefined"); + $desc = ' : '.$langs->trans("AccountancyAreaDescFiscalPeriod", 4, '{link}'); + $desc = str_replace('{link}', ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("FiscalPeriod").'', $desc); + print $desc; + print '
    '; + } + } else { + dol_print_error($db); + } + // Button to write into Ledger $acctCustomerNotConfigured = in_array(getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER'), ['','-1']); if ($acctCustomerNotConfigured) { diff --git a/htdocs/accountancy/journal/variousjournal.php b/htdocs/accountancy/journal/variousjournal.php index da5e096be59..f32bfb73037 100644 --- a/htdocs/accountancy/journal/variousjournal.php +++ b/htdocs/accountancy/journal/variousjournal.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -214,6 +214,23 @@ $varlink = 'id_journal=' . $id_journal; journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink); +// Test that setup is complete (we are in accounting, so test on entity is always on $conf->entity only, no sharing allowed) +// Fiscal period test +$sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."accounting_fiscalyear WHERE entity = ".((int) $conf->entity); +$resql = $db->query($sql); +if ($resql) { + $obj = $db->fetch_object($resql); + if ($obj->nb == 0) { + print '
    '.img_warning().' '.$langs->trans("TheFiscalPeriodIsNotDefined"); + $desc = ' : '.$langs->trans("AccountancyAreaDescFiscalPeriod", 4, '{link}'); + $desc = str_replace('{link}', ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("FiscalPeriod").'', $desc); + print $desc; + print '
    '; + } +} else { + dol_print_error($db); +} + if ($object->nature == 4) { // Bank journal // Test that setup is complete (we are in accounting, so test on entity is always on $conf->entity only, no sharing allowed) $sql = "SELECT COUNT(rowid) as nb"; diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index e5c2ab5b9f7..80a064fc535 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -75,6 +75,7 @@ AccountancyAreaDescJournalSetup=STEP %s: Check content of your journal list from AccountancyAreaDescChartModel=STEP %s: Check that a model of chart of account exists or create one from menu %s AccountancyAreaDescChart=STEP %s: Select and|or complete your chart of account from menu %s +AccountancyAreaDescFiscalPeriod=STEP %s: Define a fiscal year by default on which to integrate your accounting entries. For this, use the menu entry %s. AccountancyAreaDescVat=STEP %s: Define accounting accounts for each VAT Rates. For this, use the menu entry %s. AccountancyAreaDescDefault=STEP %s: Define default accounting accounts. For this, use the menu entry %s. AccountancyAreaDescExpenseReport=STEP %s: Define default accounting accounts for each type of Expense report. For this, use the menu entry %s. @@ -93,6 +94,7 @@ AccountancyAreaDescAnalyze=STEP %s: Add or edit existing transactions and genera AccountancyAreaDescClosePeriod=STEP %s: Close period so we can't make modification in a future. +TheFiscalPeriodIsNotDefined=A mandatory step in setup has not been completed (Fiscal period is not defined) TheJournalCodeIsNotDefinedOnSomeBankAccount=A mandatory step in setup has not been completed (accounting code journal not defined for all bank accounts) Selectchartofaccounts=Select active chart of accounts ChangeAndLoad=Change and load From 6c0c1a988191c7aa090c5eee190098edc4acbfb8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Nov 2023 19:09:34 +0100 Subject: [PATCH 065/120] Add option ACCOUNTANCY_FISCAL_PERIOD_MODE to support 2 mode for fiscal year --- htdocs/accountancy/index.php | 12 ++++---- htdocs/accountancy/journal/bankjournal.php | 30 ++++++++++--------- .../journal/expensereportsjournal.php | 30 ++++++++++--------- .../accountancy/journal/purchasesjournal.php | 30 ++++++++++--------- htdocs/accountancy/journal/sellsjournal.php | 30 ++++++++++--------- htdocs/accountancy/journal/variousjournal.php | 30 ++++++++++--------- 6 files changed, 87 insertions(+), 75 deletions(-) diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php index f8401072123..0c5be4b49c4 100644 --- a/htdocs/accountancy/index.php +++ b/htdocs/accountancy/index.php @@ -146,11 +146,13 @@ if (isModEnabled('accounting')) { print "
    \n"; print "
    \n"; - $step++; - $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescFiscalPeriod", $step, '{s}'); - $s = str_replace('{s}', ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("FiscalPeriod").'', $s); - print $s; - print "
    \n"; + if (getDolGlobalString('ACCOUNTANCY_FISCAL_PERIOD_MODE') != 'blockedonclosed') { + $step++; + $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescFiscalPeriod", $step, '{s}'); + $s = str_replace('{s}', ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("FiscalPeriod").'', $s); + print $s; + print "
    \n"; + } $step++; $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDefault", $step, '{s}'); diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 536e510195e..eeeb28d5179 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -1065,21 +1065,23 @@ if (empty($action) || $action == 'view') { $desc = ''; - // Test that setup is complete (we are in accounting, so test on entity is always on $conf->entity only, no sharing allowed) - // Fiscal period test - $sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."accounting_fiscalyear WHERE entity = ".((int) $conf->entity); - $resql = $db->query($sql); - if ($resql) { - $obj = $db->fetch_object($resql); - if ($obj->nb == 0) { - print '
    '.img_warning().' '.$langs->trans("TheFiscalPeriodIsNotDefined"); - $desc = ' : '.$langs->trans("AccountancyAreaDescFiscalPeriod", 4, '{link}'); - $desc = str_replace('{link}', ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("FiscalPeriod").'', $desc); - print $desc; - print '
    '; + if (getDolGlobalString('ACCOUNTANCY_FISCAL_PERIOD_MODE') != 'blockedonclosed') { + // Test that setup is complete (we are in accounting, so test on entity is always on $conf->entity only, no sharing allowed) + // Fiscal period test + $sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."accounting_fiscalyear WHERE entity = ".((int) $conf->entity); + $resql = $db->query($sql); + if ($resql) { + $obj = $db->fetch_object($resql); + if ($obj->nb == 0) { + print '
    '.img_warning().' '.$langs->trans("TheFiscalPeriodIsNotDefined"); + $desc = ' : '.$langs->trans("AccountancyAreaDescFiscalPeriod", 4, '{link}'); + $desc = str_replace('{link}', ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("FiscalPeriod").'', $desc); + print $desc; + print '
    '; + } + } else { + dol_print_error($db); } - } else { - dol_print_error($db); } // Bank test diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php index e624a07108c..39fa8d8e050 100644 --- a/htdocs/accountancy/journal/expensereportsjournal.php +++ b/htdocs/accountancy/journal/expensereportsjournal.php @@ -564,21 +564,23 @@ if (empty($action) || $action == 'view') { journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink); - // Test that setup is complete (we are in accounting, so test on entity is always on $conf->entity only, no sharing allowed) - // Fiscal period test - $sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."accounting_fiscalyear WHERE entity = ".((int) $conf->entity); - $resql = $db->query($sql); - if ($resql) { - $obj = $db->fetch_object($resql); - if ($obj->nb == 0) { - print '
    '.img_warning().' '.$langs->trans("TheFiscalPeriodIsNotDefined"); - $desc = ' : '.$langs->trans("AccountancyAreaDescFiscalPeriod", 4, '{link}'); - $desc = str_replace('{link}', ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("FiscalPeriod").'', $desc); - print $desc; - print '
    '; + if (getDolGlobalString('ACCOUNTANCY_FISCAL_PERIOD_MODE') != 'blockedonclosed') { + // Test that setup is complete (we are in accounting, so test on entity is always on $conf->entity only, no sharing allowed) + // Fiscal period test + $sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."accounting_fiscalyear WHERE entity = ".((int) $conf->entity); + $resql = $db->query($sql); + if ($resql) { + $obj = $db->fetch_object($resql); + if ($obj->nb == 0) { + print '
    '.img_warning().' '.$langs->trans("TheFiscalPeriodIsNotDefined"); + $desc = ' : '.$langs->trans("AccountancyAreaDescFiscalPeriod", 4, '{link}'); + $desc = str_replace('{link}', ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("FiscalPeriod").'', $desc); + print $desc; + print '
    '; + } + } else { + dol_print_error($db); } - } else { - dol_print_error($db); } // Button to write into Ledger diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index 69db686615f..214b548949b 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -937,21 +937,23 @@ if (empty($action) || $action == 'view') { journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink); - // Test that setup is complete (we are in accounting, so test on entity is always on $conf->entity only, no sharing allowed) - // Fiscal period test - $sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."accounting_fiscalyear WHERE entity = ".((int) $conf->entity); - $resql = $db->query($sql); - if ($resql) { - $obj = $db->fetch_object($resql); - if ($obj->nb == 0) { - print '
    '.img_warning().' '.$langs->trans("TheFiscalPeriodIsNotDefined"); - $desc = ' : '.$langs->trans("AccountancyAreaDescFiscalPeriod", 4, '{link}'); - $desc = str_replace('{link}', ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("FiscalPeriod").'', $desc); - print $desc; - print '
    '; + if (getDolGlobalString('ACCOUNTANCY_FISCAL_PERIOD_MODE') != 'blockedonclosed') { + // Test that setup is complete (we are in accounting, so test on entity is always on $conf->entity only, no sharing allowed) + // Fiscal period test + $sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."accounting_fiscalyear WHERE entity = ".((int) $conf->entity); + $resql = $db->query($sql); + if ($resql) { + $obj = $db->fetch_object($resql); + if ($obj->nb == 0) { + print '
    '.img_warning().' '.$langs->trans("TheFiscalPeriodIsNotDefined"); + $desc = ' : '.$langs->trans("AccountancyAreaDescFiscalPeriod", 4, '{link}'); + $desc = str_replace('{link}', ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("FiscalPeriod").'', $desc); + print $desc; + print '
    '; + } + } else { + dol_print_error($db); } - } else { - dol_print_error($db); } // Button to write into Ledger diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index f2dfb091edb..9a4e5561f46 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -994,21 +994,23 @@ if (empty($action) || $action == 'view') { journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink); - // Test that setup is complete (we are in accounting, so test on entity is always on $conf->entity only, no sharing allowed) - // Fiscal period test - $sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."accounting_fiscalyear WHERE entity = ".((int) $conf->entity); - $resql = $db->query($sql); - if ($resql) { - $obj = $db->fetch_object($resql); - if ($obj->nb == 0) { - print '
    '.img_warning().' '.$langs->trans("TheFiscalPeriodIsNotDefined"); - $desc = ' : '.$langs->trans("AccountancyAreaDescFiscalPeriod", 4, '{link}'); - $desc = str_replace('{link}', ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("FiscalPeriod").'', $desc); - print $desc; - print '
    '; + if (getDolGlobalString('ACCOUNTANCY_FISCAL_PERIOD_MODE') != 'blockedonclosed') { + // Test that setup is complete (we are in accounting, so test on entity is always on $conf->entity only, no sharing allowed) + // Fiscal period test + $sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."accounting_fiscalyear WHERE entity = ".((int) $conf->entity); + $resql = $db->query($sql); + if ($resql) { + $obj = $db->fetch_object($resql); + if ($obj->nb == 0) { + print '
    '.img_warning().' '.$langs->trans("TheFiscalPeriodIsNotDefined"); + $desc = ' : '.$langs->trans("AccountancyAreaDescFiscalPeriod", 4, '{link}'); + $desc = str_replace('{link}', ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("FiscalPeriod").'', $desc); + print $desc; + print '
    '; + } + } else { + dol_print_error($db); } - } else { - dol_print_error($db); } // Button to write into Ledger diff --git a/htdocs/accountancy/journal/variousjournal.php b/htdocs/accountancy/journal/variousjournal.php index f32bfb73037..f7d1831ee87 100644 --- a/htdocs/accountancy/journal/variousjournal.php +++ b/htdocs/accountancy/journal/variousjournal.php @@ -214,21 +214,23 @@ $varlink = 'id_journal=' . $id_journal; journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink); -// Test that setup is complete (we are in accounting, so test on entity is always on $conf->entity only, no sharing allowed) -// Fiscal period test -$sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."accounting_fiscalyear WHERE entity = ".((int) $conf->entity); -$resql = $db->query($sql); -if ($resql) { - $obj = $db->fetch_object($resql); - if ($obj->nb == 0) { - print '
    '.img_warning().' '.$langs->trans("TheFiscalPeriodIsNotDefined"); - $desc = ' : '.$langs->trans("AccountancyAreaDescFiscalPeriod", 4, '{link}'); - $desc = str_replace('{link}', ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("FiscalPeriod").'', $desc); - print $desc; - print '
    '; +if (getDolGlobalString('ACCOUNTANCY_FISCAL_PERIOD_MODE') != 'blockedonclosed') { + // Test that setup is complete (we are in accounting, so test on entity is always on $conf->entity only, no sharing allowed) + // Fiscal period test + $sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."accounting_fiscalyear WHERE entity = ".((int) $conf->entity); + $resql = $db->query($sql); + if ($resql) { + $obj = $db->fetch_object($resql); + if ($obj->nb == 0) { + print '
    '.img_warning().' '.$langs->trans("TheFiscalPeriodIsNotDefined"); + $desc = ' : '.$langs->trans("AccountancyAreaDescFiscalPeriod", 4, '{link}'); + $desc = str_replace('{link}', ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("FiscalPeriod").'', $desc); + print $desc; + print '
    '; + } + } else { + dol_print_error($db); } -} else { - dol_print_error($db); } if ($object->nature == 4) { // Bank journal From 5d3087b089e4152d5783b461d72c344794534468 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 23 Nov 2023 19:40:47 +0100 Subject: [PATCH 066/120] fix phpstan (#26833) --- htdocs/bookcal/booking_list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/bookcal/booking_list.php b/htdocs/bookcal/booking_list.php index 95a0b95d96c..46eec4175f8 100644 --- a/htdocs/bookcal/booking_list.php +++ b/htdocs/bookcal/booking_list.php @@ -5,7 +5,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2017 Ferran Marcet - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2023 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 @@ -199,7 +199,7 @@ if ($object->id > 0) { $i = 0; $tmpcontact = new Contact($db); - $tmpactioncomm = new Actioncomm($db); + $tmpactioncomm = new ActionComm($db); $num = $db->num_rows($result); while ($i < $num) { From 2cacb02cca7c9f8a279b39d1842ad339954dc153 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 24 Nov 2023 09:27:06 +0100 Subject: [PATCH 067/120] remove deprecated from initAsSpecimen (#26834) --- htdocs/fourn/class/fournisseur.commande.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 73618399801..c30845bf889 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -3030,7 +3030,6 @@ class CommandeFournisseur extends CommonOrder $line->desc = $langs->trans("Description")." ".$xnbp; $line->qty = 1; $line->subprice = 100; - $line->price = 100; $line->tva_tx = 19.6; $line->localtax1_tx = 0; $line->localtax2_tx = 0; From 09c28bae05b117156b7d5d75b14371a7911120ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 24 Nov 2023 09:27:22 +0100 Subject: [PATCH 068/120] fix phpstan (#26835) --- htdocs/core/modules/import/import_csv.modules.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index 1beb5560927..a44e3d58f68 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -76,6 +76,8 @@ class ImportCsv extends ModeleImports public $charset = ''; + public $col; + /** * Constructor From 3a182e99aab49edd25384e9cab875c6fa42d7121 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 24 Nov 2023 09:27:42 +0100 Subject: [PATCH 069/120] fix phpstan (#26836) --- .../core/modules/expensereport/doc/pdf_standard.modules.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php index a7066ad41fb..2aa8484e19c 100644 --- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php @@ -81,6 +81,11 @@ class pdf_standard extends ModeleExpenseReport public $posxup; public $posxqty; public $posxtype; + + /** + * @var int posx date + */ + public $posxdate; public $posxprojet; public $postotalht; public $postotalttc; From bb2741ef58d608a52bfb75277f50e5f64b451b7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 24 Nov 2023 09:28:02 +0100 Subject: [PATCH 070/120] fix phpstan (#26837) --- htdocs/core/modules/member/doc/pdf_standard.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/member/doc/pdf_standard.class.php b/htdocs/core/modules/member/doc/pdf_standard.class.php index bac5e4ee5b8..7d58c484b48 100644 --- a/htdocs/core/modules/member/doc/pdf_standard.class.php +++ b/htdocs/core/modules/member/doc/pdf_standard.class.php @@ -291,7 +291,7 @@ class pdf_standard extends CommonStickerGenerator // List of values to scan for a replacement $substitutionarray = array( - '__ID__' => $object->rowid, + '__ID__' => $object->id, '__REF__' => $object->ref, '__LOGIN__' => empty($object->login) ? '' : $object->login, '__FIRSTNAME__' => empty($object->firstname) ? '' : $object->firstname, @@ -331,7 +331,7 @@ class pdf_standard extends CommonStickerGenerator 'textheader'=>$textheader, 'textfooter'=>$textfooter, 'textright'=>$textright, - 'id'=>(isset($object->rowid) ? $object->rowid : ""), + 'id'=>(isset($object->id) ? $object->id : ""), 'photo'=>(isset($object->photo) ? $object->photo : "") ); } From 19c103f2bac15824bb97e72a2c90e1ee979ed607 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 24 Nov 2023 09:28:23 +0100 Subject: [PATCH 071/120] fix phpstan (#26838) --- .../triggers/interface_50_modTicket_TicketEmail.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php index 300b0af36f6..70561e5fbf8 100644 --- a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php +++ b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php @@ -52,7 +52,7 @@ class InterfaceTicketEmail extends DolibarrTriggers * All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers * * @param string $action Event action code - * @param Object $object Object + * @param Ticket $object Object * @param User $user Object user * @param Translate $langs Object langs * @param conf $conf Object conf @@ -304,7 +304,7 @@ class InterfaceTicketEmail extends DolibarrTriggers */ private function composeAndSendAdminMessage($sendto, $base_subject, $body, Ticket $object, Translate $langs) { - global $conf; + global $conf, $mysoc; // Init to avoid errors $filepath = array(); @@ -331,8 +331,8 @@ class InterfaceTicketEmail extends DolibarrTriggers } } if ($object->fk_soc > 0) { - $object->fetch_thirdparty(); - $message_admin .= '
  • '.$langs->trans('Company').' : '.$object->thirdparty->name.'
  • '; + $object->fetch_thirdparty(); + $message_admin .= '
  • '.$langs->trans('Company').' : '.$object->thirdparty->name.'
  • '; } $message_admin .= '
'; From 8e6cdb177db9e0f702517576fe5e7b47eaf3dffc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 24 Nov 2023 09:28:43 +0100 Subject: [PATCH 072/120] fix phpstan (#26839) --- htdocs/ecm/class/ecmfiles.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/ecm/class/ecmfiles.class.php b/htdocs/ecm/class/ecmfiles.class.php index 9f9d7836f7c..636750c8915 100644 --- a/htdocs/ecm/class/ecmfiles.class.php +++ b/htdocs/ecm/class/ecmfiles.class.php @@ -890,7 +890,7 @@ class EcmFiles extends CommonObject $label .= '
'; $label .= ''.$langs->trans('Ref').': '.$this->ref; - $url = DOL_URL_ROOT.'/ecm/'.$this->table_name.'_card.php?id='.$this->id; + $url = DOL_URL_ROOT.'/ecm/file_card.php?id='.$this->id; $linkclose = ''; if (empty($notooltip)) { From 89c2ddc45baab19aa0a273c605a289d0dafe20fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 24 Nov 2023 09:30:31 +0100 Subject: [PATCH 073/120] remove deprecated from initAsSpecimen (#26840) --- htdocs/contrat/class/contrat.class.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index cd44903d886..40ab1befe62 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -2473,14 +2473,14 @@ class Contrat extends CommonObject $this->ref_customer = 'SPECIMENCUST'; $this->ref_supplier = 'SPECIMENSUPP'; $this->socid = 1; - $this->statut = 0; + $this->status = 0; $this->date_creation = (dol_now() - 3600 * 24 * 7); $this->date_contrat = dol_now(); $this->commercial_signature_id = 1; $this->commercial_suivi_id = 1; $this->note_private = 'This is a comment (private)'; $this->note_public = 'This is a comment (public)'; - $this->fk_projet = 0; + $this->fk_project = 0; // Lines $nbp = 5; $xnbp = 0; @@ -2488,7 +2488,6 @@ class Contrat extends CommonObject $line = new ContratLigne($this->db); $line->qty = 1; $line->subprice = 100; - $line->price = 100; $line->tva_tx = 19.6; $line->remise_percent = 10; $line->total_ht = 90; From 938afdb06e058ba7fb78c4e0be266ffb7b9fb6f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 24 Nov 2023 09:30:49 +0100 Subject: [PATCH 074/120] fix phpstan (#26841) --- .../class/expeditionstats.class.php | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/htdocs/expedition/class/expeditionstats.class.php b/htdocs/expedition/class/expeditionstats.class.php index 8d874f40f42..8a0241ac6d6 100644 --- a/htdocs/expedition/class/expeditionstats.class.php +++ b/htdocs/expedition/class/expeditionstats.class.php @@ -39,11 +39,34 @@ class ExpeditionStats extends Stats */ public $table_element; + /** + * @var int ID thirdparty + */ public $socid; + + /** + * @var int ID user + */ public $userid; + /** + * @var string sql part from + */ public $from; + + /** + * @var string sql part join + */ + public $join; + + /** + * @var string sql part fields + */ public $field; + + /** + * @var string sql part where + */ public $where; From e6eb34a8db26d97c94d4808fa8ec4e7be8c46603 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Nov 2023 10:10:24 +0100 Subject: [PATCH 075/120] Fiw warnings: The private array ->status_short, ->statuts and ->status_long are now array ->labelStatusShort and ->labelStatus everywhere. --- ChangeLog | 1 + htdocs/api/class/api.class.php | 5 -- htdocs/comm/mailing/class/mailing.class.php | 16 ++-- .../class/ligneprelevement.class.php | 28 +++--- htdocs/core/class/commoninvoice.class.php | 5 ++ htdocs/core/class/commonobject.class.php | 26 ++---- .../class/html.formexpensereport.class.php | 4 +- htdocs/core/lib/project.lib.php | 2 +- .../doc/pdf_standard.modules.php | 2 +- ...face_95_modZapier_ZapierTriggers.class.php | 6 +- htdocs/delivery/class/delivery.class.php | 10 +-- htdocs/expedition/class/expedition.class.php | 24 ++--- .../class/expensereport.class.php | 18 ++-- htdocs/expensereport/stats/index.php | 2 +- .../class/api_interventions.class.php | 5 +- htdocs/fichinter/class/fichinterrec.class.php | 13 +-- .../class/fournisseur.commande.class.php | 48 +++++----- .../fournisseur.commande.dispatch.class.php | 36 ++++---- htdocs/holiday/class/holiday.class.php | 6 +- htdocs/product/class/product.class.php | 2 +- htdocs/product/stock/card.php | 4 +- htdocs/product/stock/class/entrepot.class.php | 14 +-- htdocs/product/stock/list.php | 2 +- htdocs/projet/card.php | 2 +- htdocs/projet/class/project.class.php | 10 +-- htdocs/projet/class/task.class.php | 88 +++++++++---------- htdocs/projet/tasks/list.php | 2 +- htdocs/ticket/card.php | 2 +- htdocs/ticket/class/actions_ticket.class.php | 6 +- htdocs/ticket/class/api_tickets.class.php | 4 +- htdocs/ticket/class/ticket.class.php | 18 ++-- htdocs/ticket/index.php | 16 ++-- htdocs/ticket/list.php | 2 +- 33 files changed, 206 insertions(+), 223 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4ae175c119f..2a5fdc83f7d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -238,6 +238,7 @@ The following changes may create regressions for some external modules, but were * The property ->user_validation to store ID of user validating has been renamed into ->user_validation_id. * The property ->user_creation to store ID of user of creation has been renamed into ->user_creation_id. * The property ->user_modification to store ID of user of modification has been renamed into ->user_modification_id. +* The private array ->status_short, ->statuts and ->status_long are now array ->labelStatusShort and ->labelStatus everywhere. * The duplicate property ->user_creat, ->date_creat, ->date_valid has been removed (use instead user_creation, date_creation, date_validation). * The method get_substitutionarray_shipment_lines() has been removed. Use the generic get_substitutionarray_lines() instead. * The method ProductcustomerPrice->fetch_all_log() has been renamed into camel case ->fetchAllLog() diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index fbd57d7afc3..868b03304e5 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -179,11 +179,6 @@ class DolibarrApi unset($object->alreadypaid); unset($object->openid); - unset($object->statuts); - unset($object->statuts_short); - unset($object->statuts_logo); - unset($object->statuts_long); - //unset($object->labelStatus); //unset($object->labelStatusShort); diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php index f8d51b74787..bb9c16db08e 100644 --- a/htdocs/comm/mailing/class/mailing.class.php +++ b/htdocs/comm/mailing/class/mailing.class.php @@ -188,9 +188,9 @@ class Mailing extends CommonObject public $statut_dest = array(); /** - * @var array statuts + * @var array labelStatus */ - public $statuts = array(); + public $labelStatus = array(); /** * @var array substitutionarray @@ -220,10 +220,10 @@ class Mailing extends CommonObject $this->db = $db; // List of language codes for status - $this->statuts[0] = 'MailingStatusDraft'; - $this->statuts[1] = 'MailingStatusValidated'; - $this->statuts[2] = 'MailingStatusSentPartialy'; - $this->statuts[3] = 'MailingStatusSentCompletely'; + $this->labelStatus[0] = 'MailingStatusDraft'; + $this->labelStatus[1] = 'MailingStatusValidated'; + $this->labelStatus[2] = 'MailingStatusSentPartialy'; + $this->labelStatus[3] = 'MailingStatusSentCompletely'; $this->statut_dest[0] = 'MailingStatusNotSent'; $this->statut_dest[1] = 'MailingStatusSent'; @@ -893,8 +893,8 @@ class Mailing extends CommonObject global $langs; $langs->load("mailing"); - $labelStatus = $langs->transnoentitiesnoconv($this->statuts[$status]); - $labelStatusShort = $langs->transnoentitiesnoconv($this->statuts[$status]); + $labelStatus = $langs->transnoentitiesnoconv($this->labelStatus[$status]); + $labelStatusShort = $langs->transnoentitiesnoconv($this->labelStatus[$status]); $statusType = 'status'.$status; if ($status == 2) { diff --git a/htdocs/compta/prelevement/class/ligneprelevement.class.php b/htdocs/compta/prelevement/class/ligneprelevement.class.php index 36758d310c2..8b65dd77537 100644 --- a/htdocs/compta/prelevement/class/ligneprelevement.class.php +++ b/htdocs/compta/prelevement/class/ligneprelevement.class.php @@ -66,7 +66,7 @@ class LignePrelevement */ public $db; - public $statuts = array(); + public $labelStatus = array(); const STATUS_DRAFT = 0; const STATUS_NOT_USED = 1; @@ -89,9 +89,9 @@ class LignePrelevement // List of language codes for status $langs->load("withdrawals"); - $this->statuts[0] = $langs->trans("StatusWaiting"); - $this->statuts[2] = $langs->trans("StatusPaid"); - $this->statuts[3] = $langs->trans("StatusRefused"); + $this->labelStatus[0] = $langs->trans("StatusWaiting"); + $this->labelStatus[2] = $langs->trans("StatusPaid"); + $this->labelStatus[3] = $langs->trans("StatusRefused"); } /** @@ -165,30 +165,30 @@ class LignePrelevement global $langs; if ($mode == 0) { - return $langs->trans($this->statuts[$status]); + return $langs->trans($this->labelStatus[$status]); } elseif ($mode == 1) { if ($status == 0) { - return img_picto($langs->trans($this->statuts[$status]), 'statut1', 'class="valignmiddle"').' '.$langs->transnoentitiesnoconv($this->statuts[$status]); // Waiting + return img_picto($langs->trans($this->labelStatus[$status]), 'statut1', 'class="valignmiddle"').' '.$langs->transnoentitiesnoconv($this->labelStatus[$status]); // Waiting } elseif ($status == 2) { - return img_picto($langs->trans($this->statuts[$status]), 'statut6', 'class="valignmiddle"').' '.$langs->transnoentitiesnoconv($this->statuts[$status]); // Credited + return img_picto($langs->trans($this->labelStatus[$status]), 'statut6', 'class="valignmiddle"').' '.$langs->transnoentitiesnoconv($this->labelStatus[$status]); // Credited } elseif ($status == 3) { - return img_picto($langs->trans($this->statuts[$status]), 'statut8', 'class="valignmiddle"').' '.$langs->transnoentitiesnoconv($this->statuts[$status]); // Refused + return img_picto($langs->trans($this->labelStatus[$status]), 'statut8', 'class="valignmiddle"').' '.$langs->transnoentitiesnoconv($this->labelStatus[$status]); // Refused } } elseif ($mode == 2) { if ($status == 0) { - return img_picto($langs->trans($this->statuts[$status]), 'statut1', 'class="valignmiddle"'); + return img_picto($langs->trans($this->labelStatus[$status]), 'statut1', 'class="valignmiddle"'); } elseif ($status == 2) { - return img_picto($langs->trans($this->statuts[$status]), 'statut6', 'class="valignmiddle"'); + return img_picto($langs->trans($this->labelStatus[$status]), 'statut6', 'class="valignmiddle"'); } elseif ($status == 3) { - return img_picto($langs->trans($this->statuts[$status]), 'statut8', 'class="valignmiddle"'); + return img_picto($langs->trans($this->labelStatus[$status]), 'statut8', 'class="valignmiddle"'); } } elseif ($mode == 3) { if ($status == 0) { - return $langs->trans($this->statuts[$status]).' '.img_picto($langs->transnoentitiesnoconv($this->statuts[$status]), 'statut1', 'class="valignmiddle"'); + return $langs->trans($this->labelStatus[$status]).' '.img_picto($langs->transnoentitiesnoconv($this->labelStatus[$status]), 'statut1', 'class="valignmiddle"'); } elseif ($status == 2) { - return $langs->trans($this->statuts[$status]).' '.img_picto($langs->transnoentitiesnoconv($this->statuts[$status]), 'statut6', 'class="valignmiddle"'); + return $langs->trans($this->labelStatus[$status]).' '.img_picto($langs->transnoentitiesnoconv($this->labelStatus[$status]), 'statut6', 'class="valignmiddle"'); } elseif ($status == 3) { - return $langs->trans($this->statuts[$status]).' '.img_picto($langs->transnoentitiesnoconv($this->statuts[$status]), 'statut8', 'class="valignmiddle"'); + return $langs->trans($this->labelStatus[$status]).' '.img_picto($langs->transnoentitiesnoconv($this->labelStatus[$status]), 'statut8', 'class="valignmiddle"'); } } //return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index 8bb1907cd3b..dba7c6a4d2e 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -34,6 +34,11 @@ abstract class CommonInvoice extends CommonObject { use CommonIncoterm; + /** + * @var string Label used as ref for template invoices + */ + public $title; + /** * @var int Type of invoice (See TYPE_XXX constants) */ diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 1ef60a21f49..68344c03756 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -682,25 +682,17 @@ abstract class CommonObject /** * @var array Array with label of status */ - public $labelStatus; - - /** - * @var array array of status string - * @deprecated Use instead labelStatus - */ - public $statuts = array(); + public $labelStatus = array(); /** * @var array Array with short label of status */ - protected $labelStatusShort; + public $labelStatusShort = array(); /** - * @var array array of short status string - * @deprecated Use instead labelStatusShort + * @var array Array to store list of tpl */ - public $statuts_short = array(); - + public $tpl; /** @@ -3837,7 +3829,7 @@ abstract class CommonObject // Situations totals if (!empty($this->situation_cycle_ref) && !empty($this->situation_counter) && $this->situation_counter > 1 && method_exists($this, 'get_prev_sits')) { include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; - if ($this->type != Facture::TYPE_CREDIT_NOTE) { + if ($this->type != Facture::TYPE_CREDIT_NOTE) { // @phpstan-ignore-line $prev_sits = $this->get_prev_sits(); foreach ($prev_sits as $sit) { // $sit is an object Facture loaded with a fetch. @@ -4597,7 +4589,7 @@ abstract class CommonObject if ($fieldstatus == 'tosell') { $this->status = $status; } elseif ($fieldstatus == 'tobuy') { - $this->status_buy = $status; + $this->status_buy = $status; // @phpstan-ignore-line } else { $this->statut = $status; $this->status = $status; @@ -4991,8 +4983,7 @@ abstract class CommonObject */ public function formAddObjectLine($dateSelector, $seller, $buyer, $defaulttpldir = '/core/tpl') { - global $conf, $user, $langs, $object, $hookmanager, $extrafields; - global $form; + global $conf, $user, $langs, $object, $hookmanager, $extrafields, $form; // Line extrafield if (!is_object($extrafields)) { @@ -10295,8 +10286,7 @@ abstract class CommonObject ); foreach ($fields as $key => $value) { if (array_key_exists($key, $this->fields)) { - // @phpstan-ignore-next-line - $this->{$key} = $value; + $this->{$key} = $value; // @phpstan-ignore-line } } diff --git a/htdocs/core/class/html.formexpensereport.class.php b/htdocs/core/class/html.formexpensereport.class.php index c08431b534e..bcb80a780dd 100644 --- a/htdocs/core/class/html.formexpensereport.class.php +++ b/htdocs/core/class/html.formexpensereport.class.php @@ -69,9 +69,9 @@ class FormExpenseReport if ($useempty) { $html.=''; } - $arrayoflabels = $tmpep->statuts; + $arrayoflabels = $tmpep->labelStatus; if ($useshortlabel) { - $arrayoflabels = $tmpep->statuts_short; + $arrayoflabels = $tmpep->labelStatusShort; } foreach ($arrayoflabels as $key => $val) { if ($selected != '' && $selected == $key) { diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 8416df31b72..101d6e97d95 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -2519,7 +2519,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks $title = $langs->trans("Projects"); if (strcmp($status, '') && $status >= 0) { - $title = $langs->trans("Projects").' '.$langs->trans($projectstatic->statuts_long[$status]); + $title = $langs->trans("Projects").' '.$langs->trans($projectstatic->labelStatus[$status]); } print ''; diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php index a7066ad41fb..6194835eed4 100644 --- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php @@ -717,7 +717,7 @@ class pdf_standard extends ModeleExpenseReport $pdf->SetXY($posx, $posy); $pdf->SetFont('', 'B', $default_font_size + 2); $pdf->SetTextColor(111, 81, 124); - $pdf->MultiCell($this->page_largeur - $this->marge_droite - $posx, 3, $outputlangs->transnoentities($object->statuts_short[$object->status]), '', 'R'); + $pdf->MultiCell($this->page_largeur - $this->marge_droite - $posx, 3, $outputlangs->transnoentities($object->labelStatusShort[$object->status]), '', 'R'); if ($showaddress) { // Sender properties diff --git a/htdocs/core/triggers/interface_95_modZapier_ZapierTriggers.class.php b/htdocs/core/triggers/interface_95_modZapier_ZapierTriggers.class.php index 7c16599f039..2b6208c025d 100644 --- a/htdocs/core/triggers/interface_95_modZapier_ZapierTriggers.class.php +++ b/htdocs/core/triggers/interface_95_modZapier_ZapierTriggers.class.php @@ -470,10 +470,8 @@ function cleanObjectDatas($toclean) unset($toclean->timespent_fk_user); unset($toclean->timespent_note); - unset($toclean->statuts); - unset($toclean->statuts_short); - unset($toclean->statuts_logo); - unset($toclean->statuts_long); + unset($toclean->labelStatus); + unset($toclean->labelStatusShort); unset($toclean->element); unset($toclean->fk_element); diff --git a/htdocs/delivery/class/delivery.class.php b/htdocs/delivery/class/delivery.class.php index 025c61a2ef1..b890746e2a4 100644 --- a/htdocs/delivery/class/delivery.class.php +++ b/htdocs/delivery/class/delivery.class.php @@ -110,9 +110,9 @@ class Delivery extends CommonObject public $commande_id; /** - * @var array statuts labels + * @var array Status labels */ - public $statuts; + public $labelStatus; /** * @var DeliveryLine[] lines @@ -135,9 +135,9 @@ class Delivery extends CommonObject $this->db = $db; // List of short language codes for status - $this->statuts[-1] = 'StatusDeliveryCanceled'; - $this->statuts[0] = 'StatusDeliveryDraft'; - $this->statuts[1] = 'StatusDeliveryValidated'; + $this->labelStatus[-1] = 'StatusDeliveryCanceled'; + $this->labelStatus[0] = 'StatusDeliveryDraft'; + $this->labelStatus[1] = 'StatusDeliveryValidated'; } /** diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index d667cd795dd..ca5315994d1 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -267,18 +267,18 @@ class Expedition extends CommonObject $this->db = $db; // List of long language codes for status - $this->statuts = array(); - $this->statuts[-1] = 'StatusSendingCanceled'; - $this->statuts[0] = 'StatusSendingDraft'; - $this->statuts[1] = 'StatusSendingValidated'; - $this->statuts[2] = 'StatusSendingProcessed'; + $this->labelStatus = array(); + $this->labelStatus[-1] = 'StatusSendingCanceled'; + $this->labelStatus[0] = 'StatusSendingDraft'; + $this->labelStatus[1] = 'StatusSendingValidated'; + $this->labelStatus[2] = 'StatusSendingProcessed'; // List of short language codes for status - $this->statuts_short = array(); - $this->statuts_short[-1] = 'StatusSendingCanceledShort'; - $this->statuts_short[0] = 'StatusSendingDraftShort'; - $this->statuts_short[1] = 'StatusSendingValidatedShort'; - $this->statuts_short[2] = 'StatusSendingProcessedShort'; + $this->labelStatusShort = array(); + $this->labelStatusShort[-1] = 'StatusSendingCanceledShort'; + $this->labelStatusShort[0] = 'StatusSendingDraftShort'; + $this->labelStatusShort[1] = 'StatusSendingValidatedShort'; + $this->labelStatusShort[2] = 'StatusSendingProcessedShort'; } /** @@ -1928,8 +1928,8 @@ class Expedition extends CommonObject // phpcs:enable global $langs; - $labelStatus = $langs->transnoentitiesnoconv($this->statuts[$status]); - $labelStatusShort = $langs->transnoentitiesnoconv($this->statuts_short[$status]); + $labelStatus = $langs->transnoentitiesnoconv($this->labelStatus[$status]); + $labelStatusShort = $langs->transnoentitiesnoconv($this->labelStatusShort[$status]); $statusType = 'status'.$status; if ($status == self::STATUS_VALIDATED) { diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 011d1fb2f7f..3a2df95dda6 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -179,9 +179,8 @@ class ExpenseReport extends CommonObject public $localtax1; // for backward compatibility (real field should be total_localtax1 defined into CommonObject) public $localtax2; // for backward compatibility (real field should be total_localtax2 defined into CommonObject) - public $statuts = array(); - public $statuts_short = array(); - public $statuts_logo; + public $labelStatus = array(); + public $labelStatusShort = array(); // Multicurrency /** @@ -293,9 +292,8 @@ class ExpenseReport extends CommonObject $this->modepaymentid = 0; // List of language codes for status - $this->statuts_short = array(0 => 'Draft', 2 => 'Validated', 4 => 'Canceled', 5 => 'Approved', 6 => 'Paid', 99 => 'Refused'); - $this->statuts = array(0 => 'Draft', 2 => 'ValidatedWaitingApproval', 4 => 'Canceled', 5 => 'Approved', 6 => 'Paid', 99 => 'Refused'); - $this->statuts_logo = array(0 => 'status0', 2 => 'status1', 4 => 'status6', 5 => 'status4', 6 => 'status6', 99 => 'status5'); + $this->labelStatusShort = array(0 => 'Draft', 2 => 'Validated', 4 => 'Canceled', 5 => 'Approved', 6 => 'Paid', 99 => 'Refused'); + $this->labelStatus = array(0 => 'Draft', 2 => 'ValidatedWaitingApproval', 4 => 'Canceled', 5 => 'Approved', 6 => 'Paid', 99 => 'Refused'); } /** @@ -811,10 +809,12 @@ class ExpenseReport extends CommonObject // phpcs:enable global $langs; - $labelStatus = $langs->transnoentitiesnoconv($this->statuts[$status]); - $labelStatusShort = $langs->transnoentitiesnoconv($this->statuts_short[$status]); + $labelStatus = $langs->transnoentitiesnoconv($this->labelStatus[$status]); + $labelStatusShort = $langs->transnoentitiesnoconv($this->labelStatusShort[$status]); - $statusType = $this->statuts_logo[$status]; + $statuslogo = array(0 => 'status0', 2 => 'status1', 4 => 'status6', 5 => 'status4', 6 => 'status6', 99 => 'status5'); + + $statusType = $statuslogo[$status]; return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode); } diff --git a/htdocs/expensereport/stats/index.php b/htdocs/expensereport/stats/index.php index 04ce5d5d648..4ad6caa7a69 100644 --- a/htdocs/expensereport/stats/index.php +++ b/htdocs/expensereport/stats/index.php @@ -239,7 +239,7 @@ print $form->select_dolusers($userid, 'userid', 1, '', 0, $include, '', 0, 0, 0, print ''; // Status print ''.$langs->trans("Status").''; -$liststatus = $tmpexpensereport->statuts; +$liststatus = $tmpexpensereport->labelStatus; print $form->selectarray('object_status', $liststatus, GETPOST('object_status', 'intcomma'), -4, 0, 0, '', 1); print ''; // Year diff --git a/htdocs/fichinter/class/api_interventions.class.php b/htdocs/fichinter/class/api_interventions.class.php index e90bb20aae3..8cfc57155d7 100644 --- a/htdocs/fichinter/class/api_interventions.class.php +++ b/htdocs/fichinter/class/api_interventions.class.php @@ -444,9 +444,8 @@ class Interventions extends DolibarrApi // phpcs:enable $object = parent::_cleanObjectDatas($object); - unset($object->statuts_short); - unset($object->statuts_logo); - unset($object->statuts); + unset($object->labelStatus); + unset($object->labelStatusShort); return $object; } diff --git a/htdocs/fichinter/class/fichinterrec.class.php b/htdocs/fichinter/class/fichinterrec.class.php index 95cc4f020e4..39a1b987e2e 100644 --- a/htdocs/fichinter/class/fichinterrec.class.php +++ b/htdocs/fichinter/class/fichinterrec.class.php @@ -80,8 +80,6 @@ class FichinterRec extends Fichinter public $id_origin; - public $statuts_logo; - /** * @var string Unit frequency */ @@ -123,14 +121,11 @@ class FichinterRec extends Fichinter $this->db = $db; //status dans l'ordre de l'intervention - $this->statuts[0] = 'Draft'; - $this->statuts[1] = 'Closed'; + $this->labelStatus[0] = 'Draft'; + $this->labelStatus[1] = 'Closed'; - $this->statuts_short[0] = 'Draft'; - $this->statuts_short[1] = 'Closed'; - - $this->statuts_logo[0] = 'statut0'; - $this->statuts_logo[1] = 'statut1'; + $this->labelStatusShort[0] = 'Draft'; + $this->labelStatusShort[1] = 'Closed'; } /** diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 73618399801..4e93238b6a5 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -124,12 +124,12 @@ class CommandeFournisseur extends CommonOrder /** * @var array List of status */ - public $statuts; + public $labelStatus; /** * @var array List of status short */ - public $statuts_short; + public $labelStatusShort; public $billed; @@ -788,33 +788,33 @@ class CommandeFournisseur extends CommonOrder // phpcs:enable global $conf, $langs, $hookmanager; - if (empty($this->statuts) || empty($this->statuts_short)) { + if (empty($this->labelStatus) || empty($this->labelStatusShort)) { $langs->load('orders'); - $this->statuts[0] = 'StatusSupplierOrderDraft'; - $this->statuts[1] = 'StatusSupplierOrderValidated'; - $this->statuts[2] = 'StatusSupplierOrderApproved'; + $this->labelStatus[0] = 'StatusSupplierOrderDraft'; + $this->labelStatus[1] = 'StatusSupplierOrderValidated'; + $this->labelStatus[2] = 'StatusSupplierOrderApproved'; if (empty($conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS)) { - $this->statuts[3] = 'StatusSupplierOrderOnProcess'; + $this->labelStatus[3] = 'StatusSupplierOrderOnProcess'; } else { - $this->statuts[3] = 'StatusSupplierOrderOnProcessWithValidation'; + $this->labelStatus[3] = 'StatusSupplierOrderOnProcessWithValidation'; } - $this->statuts[4] = 'StatusSupplierOrderReceivedPartially'; - $this->statuts[5] = 'StatusSupplierOrderReceivedAll'; - $this->statuts[6] = 'StatusSupplierOrderCanceled'; // Approved->Canceled - $this->statuts[7] = 'StatusSupplierOrderCanceled'; // Process running->canceled - $this->statuts[9] = 'StatusSupplierOrderRefused'; + $this->labelStatus[4] = 'StatusSupplierOrderReceivedPartially'; + $this->labelStatus[5] = 'StatusSupplierOrderReceivedAll'; + $this->labelStatus[6] = 'StatusSupplierOrderCanceled'; // Approved->Canceled + $this->labelStatus[7] = 'StatusSupplierOrderCanceled'; // Process running->canceled + $this->labelStatus[9] = 'StatusSupplierOrderRefused'; // List of language codes for status - $this->statuts_short[0] = 'StatusSupplierOrderDraftShort'; - $this->statuts_short[1] = 'StatusSupplierOrderValidatedShort'; - $this->statuts_short[2] = 'StatusSupplierOrderApprovedShort'; - $this->statuts_short[3] = 'StatusSupplierOrderOnProcessShort'; - $this->statuts_short[4] = 'StatusSupplierOrderReceivedPartiallyShort'; - $this->statuts_short[5] = 'StatusSupplierOrderReceivedAllShort'; - $this->statuts_short[6] = 'StatusSupplierOrderCanceledShort'; - $this->statuts_short[7] = 'StatusSupplierOrderCanceledShort'; - $this->statuts_short[9] = 'StatusSupplierOrderRefusedShort'; + $this->labelStatusShort[0] = 'StatusSupplierOrderDraftShort'; + $this->labelStatusShort[1] = 'StatusSupplierOrderValidatedShort'; + $this->labelStatusShort[2] = 'StatusSupplierOrderApprovedShort'; + $this->labelStatusShort[3] = 'StatusSupplierOrderOnProcessShort'; + $this->labelStatusShort[4] = 'StatusSupplierOrderReceivedPartiallyShort'; + $this->labelStatusShort[5] = 'StatusSupplierOrderReceivedAllShort'; + $this->labelStatusShort[6] = 'StatusSupplierOrderCanceledShort'; + $this->labelStatusShort[7] = 'StatusSupplierOrderCanceledShort'; + $this->labelStatusShort[9] = 'StatusSupplierOrderRefusedShort'; } $statustrans = array( @@ -842,8 +842,8 @@ class CommandeFournisseur extends CommonOrder $statusClass = 'status6'; } - $statusLong = $langs->transnoentitiesnoconv($this->statuts[$status]).$billedtext; - $statusShort = $langs->transnoentitiesnoconv($this->statuts_short[$status]); + $statusLong = $langs->transnoentitiesnoconv($this->labelStatus[$status]).$billedtext; + $statusShort = $langs->transnoentitiesnoconv($this->labelStatusShort[$status]); $parameters = array('status' => $status, 'mode' => $mode, 'billed' => $billed); $reshook = $hookmanager->executeHooks('LibStatut', $parameters, $this); // Note that $action and $object may have been modified by hook diff --git a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php index 06c49aa519a..c6b715546d8 100644 --- a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php +++ b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php @@ -129,12 +129,12 @@ class CommandeFournisseurDispatch extends CommonObjectLine $this->db = $db; // List of language codes for status - $this->statuts[0] = 'Received'; - $this->statuts[1] = 'Verified'; - $this->statuts[2] = 'Denied'; - $this->statuts_short[0] = 'Received'; - $this->statuts_short[1] = 'Verified'; - $this->statuts_short[2] = 'Denied'; + $this->labelStatus[0] = 'Received'; + $this->labelStatus[1] = 'Verified'; + $this->labelStatus[2] = 'Denied'; + $this->labelStatusShort[0] = 'Received'; + $this->labelStatusShort[1] = 'Verified'; + $this->labelStatusShort[2] = 'Denied'; } @@ -579,34 +579,34 @@ class CommandeFournisseurDispatch extends CommonObjectLine $langs->load('orders'); if ($mode == 0) { - return $langs->trans($this->statuts[$status]); + return $langs->trans($this->labelStatus[$status]); } elseif ($mode == 1) { - return $langs->trans($this->statuts_short[$status]); + return $langs->trans($this->labelStatusShort[$status]); } elseif ($mode == 2) { - return $langs->trans($this->statuts[$status]); + return $langs->trans($this->labelStatus[$status]); } elseif ($mode == 3) { if ($status == 0) { - return img_picto($langs->trans($this->statuts[$status]), 'statut0'); + return img_picto($langs->trans($this->labelStatus[$status]), 'statut0'); } elseif ($status == 1) { - return img_picto($langs->trans($this->statuts[$status]), 'statut4'); + return img_picto($langs->trans($this->labelStatus[$status]), 'statut4'); } elseif ($status == 2) { - return img_picto($langs->trans($this->statuts[$status]), 'statut8'); + return img_picto($langs->trans($this->labelStatus[$status]), 'statut8'); } } elseif ($mode == 4) { if ($status == 0) { - return img_picto($langs->trans($this->statuts[$status]), 'statut0').' '.$langs->trans($this->statuts[$status]); + return img_picto($langs->trans($this->labelStatus[$status]), 'statut0').' '.$langs->trans($this->labelStatus[$status]); } elseif ($status == 1) { - return img_picto($langs->trans($this->statuts[$status]), 'statut4').' '.$langs->trans($this->statuts[$status]); + return img_picto($langs->trans($this->labelStatus[$status]), 'statut4').' '.$langs->trans($this->labelStatus[$status]); } elseif ($status == 2) { - return img_picto($langs->trans($this->statuts[$status]), 'statut8').' '.$langs->trans($this->statuts[$status]); + return img_picto($langs->trans($this->labelStatus[$status]), 'statut8').' '.$langs->trans($this->labelStatus[$status]); } } elseif ($mode == 5) { if ($status == 0) { - return ''.$langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut0'); + return ''.$langs->trans($this->labelStatusShort[$status]).' '.img_picto($langs->trans($this->labelStatus[$status]), 'statut0'); } elseif ($status == 1) { - return ''.$langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut4'); + return ''.$langs->trans($this->labelStatusShort[$status]).' '.img_picto($langs->trans($this->labelStatus[$status]), 'statut4'); } elseif ($status == 2) { - return ''.$langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut8'); + return ''.$langs->trans($this->labelStatusShort[$status]).' '.img_picto($langs->trans($this->labelStatus[$status]), 'statut8'); } } return ""; diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 2694b46cab6..f3ae583694c 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -1496,7 +1496,7 @@ class Holiday extends CommonObject /** - * Affiche un select HTML des statuts de congés payés + * Show select with list of leave status * * @param int $selected Id of preselected status * @param string $htmlname Name of HTML select field @@ -1507,7 +1507,7 @@ class Holiday extends CommonObject { global $langs; - // Liste des statuts + // List of status label $name = array('DraftCP', 'ToReviewCP', 'ApprovedCP', 'CancelCP', 'RefuseCP'); $nb = count($name) + 1; @@ -1515,7 +1515,7 @@ class Holiday extends CommonObject $out = ''; - foreach ($object->statuts as $key => $value) { + foreach ($object->labelStatus as $key => $value) { if ($key == 1) { print ''; } else { @@ -936,7 +936,7 @@ if ($action == 'create') { // Status print ''.$langs->trans("Status").''; print ''; - foreach ($object->statuts_short as $key => $val) { + foreach ($object->labelStatusShort as $key => $val) { print ''; } print ''; diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 4218ef5d402..522efc2c287 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -202,8 +202,8 @@ class Project extends CommonObject */ public $max_attendees; - public $statuts_short; - public $statuts_long; + public $labelStatusShort; + public $labelStatus; public $statut; // 0=draft, 1=opened, 2=closed @@ -363,8 +363,8 @@ class Project extends CommonObject $this->db = $db; - $this->statuts_short = array(0 => 'Draft', 1 => 'Opened', 2 => 'Closed'); - $this->statuts_long = array(0 => 'Draft', 1 => 'Opened', 2 => 'Closed'); + $this->labelStatusShort = array(0 => 'Draft', 1 => 'Opened', 2 => 'Closed'); + $this->labelStatus = array(0 => 'Draft', 1 => 'Opened', 2 => 'Closed'); global $conf; @@ -1309,7 +1309,7 @@ class Project extends CommonObject $statusClass = $statustrans[$status]; } - return dolGetStatus($langs->transnoentitiesnoconv($this->statuts_long[$status]), $langs->transnoentitiesnoconv($this->statuts_short[$status]), '', $statusClass, $mode); + return dolGetStatus($langs->transnoentitiesnoconv($this->labelStatus[$status]), $langs->transnoentitiesnoconv($this->labelStatusShort[$status]), '', $statusClass, $mode); } /** diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index e6d10c194f0..35df1f3e676 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -138,12 +138,12 @@ class Task extends CommonObjectLine /** * @var array */ - public $statuts; + public $labelStatus; /** * @var array */ - public $statuts_short; + public $labelStatusShort; // Properties calculated from sum of llx_element_time linked to task public $tobill; @@ -2133,80 +2133,80 @@ class Task extends CommonObjectLine global $langs; // list of Statut of the task - $this->statuts[0] = 'Draft'; - $this->statuts[1] = 'ToDo'; - $this->statuts[2] = 'Running'; - $this->statuts[3] = 'Finish'; - $this->statuts[4] = 'Transfered'; - $this->statuts_short[0] = 'Draft'; - $this->statuts_short[1] = 'ToDo'; - $this->statuts_short[2] = 'Running'; - $this->statuts_short[3] = 'Completed'; - $this->statuts_short[4] = 'Transfered'; + $this->labelStatus[0] = 'Draft'; + $this->labelStatus[1] = 'ToDo'; + $this->labelStatus[2] = 'Running'; + $this->labelStatus[3] = 'Finish'; + $this->labelStatus[4] = 'Transfered'; + $this->labelStatusShort[0] = 'Draft'; + $this->labelStatusShort[1] = 'ToDo'; + $this->labelStatusShort[2] = 'Running'; + $this->labelStatusShort[3] = 'Completed'; + $this->labelStatusShort[4] = 'Transfered'; if ($mode == 0) { - return $langs->trans($this->statuts[$status]); + return $langs->trans($this->labelStatus[$status]); } elseif ($mode == 1) { - return $langs->trans($this->statuts_short[$status]); + return $langs->trans($this->labelStatusShort[$status]); } elseif ($mode == 2) { if ($status == 0) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut0').' '.$langs->trans($this->statuts_short[$status]); + return img_picto($langs->trans($this->labelStatusShort[$status]), 'statut0').' '.$langs->trans($this->labelStatusShort[$status]); } elseif ($status == 1) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut1').' '.$langs->trans($this->statuts_short[$status]); + return img_picto($langs->trans($this->labelStatusShort[$status]), 'statut1').' '.$langs->trans($this->labelStatusShort[$status]); } elseif ($status == 2) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut3').' '.$langs->trans($this->statuts_short[$status]); + return img_picto($langs->trans($this->labelStatusShort[$status]), 'statut3').' '.$langs->trans($this->labelStatusShort[$status]); } elseif ($status == 3) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut6').' '.$langs->trans($this->statuts_short[$status]); + return img_picto($langs->trans($this->labelStatusShort[$status]), 'statut6').' '.$langs->trans($this->labelStatusShort[$status]); } elseif ($status == 4) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut6').' '.$langs->trans($this->statuts_short[$status]); + return img_picto($langs->trans($this->labelStatusShort[$status]), 'statut6').' '.$langs->trans($this->labelStatusShort[$status]); } elseif ($status == 5) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut5').' '.$langs->trans($this->statuts_short[$status]); + return img_picto($langs->trans($this->labelStatusShort[$status]), 'statut5').' '.$langs->trans($this->labelStatusShort[$status]); } } elseif ($mode == 3) { if ($status == 0) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut0'); + return img_picto($langs->trans($this->labelStatusShort[$status]), 'statut0'); } elseif ($status == 1) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut1'); + return img_picto($langs->trans($this->labelStatusShort[$status]), 'statut1'); } elseif ($status == 2) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut3'); + return img_picto($langs->trans($this->labelStatusShort[$status]), 'statut3'); } elseif ($status == 3) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut6'); + return img_picto($langs->trans($this->labelStatusShort[$status]), 'statut6'); } elseif ($status == 4) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut6'); + return img_picto($langs->trans($this->labelStatusShort[$status]), 'statut6'); } elseif ($status == 5) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut5'); + return img_picto($langs->trans($this->labelStatusShort[$status]), 'statut5'); } } elseif ($mode == 4) { if ($status == 0) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut0').' '.$langs->trans($this->statuts[$status]); + return img_picto($langs->trans($this->labelStatusShort[$status]), 'statut0').' '.$langs->trans($this->labelStatus[$status]); } elseif ($status == 1) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut1').' '.$langs->trans($this->statuts[$status]); + return img_picto($langs->trans($this->labelStatusShort[$status]), 'statut1').' '.$langs->trans($this->labelStatus[$status]); } elseif ($status == 2) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut3').' '.$langs->trans($this->statuts[$status]); + return img_picto($langs->trans($this->labelStatusShort[$status]), 'statut3').' '.$langs->trans($this->labelStatus[$status]); } elseif ($status == 3) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut6').' '.$langs->trans($this->statuts[$status]); + return img_picto($langs->trans($this->labelStatusShort[$status]), 'statut6').' '.$langs->trans($this->labelStatus[$status]); } elseif ($status == 4) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut6').' '.$langs->trans($this->statuts[$status]); + return img_picto($langs->trans($this->labelStatusShort[$status]), 'statut6').' '.$langs->trans($this->labelStatus[$status]); } elseif ($status == 5) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut5').' '.$langs->trans($this->statuts[$status]); + return img_picto($langs->trans($this->labelStatusShort[$status]), 'statut5').' '.$langs->trans($this->labelStatus[$status]); } } elseif ($mode == 5) { - /*if ($status==0) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut0'); - elseif ($status==1) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut1'); - elseif ($status==2) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut3'); - elseif ($status==3) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut6'); - elseif ($status==4) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut6'); - elseif ($status==5) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut5'); + /*if ($status==0) return $langs->trans($this->labelStatusShort[$status]).' '.img_picto($langs->trans($this->labelStatusShort[$status]),'statut0'); + elseif ($status==1) return $langs->trans($this->labelStatusShort[$status]).' '.img_picto($langs->trans($this->labelStatusShort[$status]),'statut1'); + elseif ($status==2) return $langs->trans($this->labelStatusShort[$status]).' '.img_picto($langs->trans($this->labelStatusShort[$status]),'statut3'); + elseif ($status==3) return $langs->trans($this->labelStatusShort[$status]).' '.img_picto($langs->trans($this->labelStatusShort[$status]),'statut6'); + elseif ($status==4) return $langs->trans($this->labelStatusShort[$status]).' '.img_picto($langs->trans($this->labelStatusShort[$status]),'statut6'); + elseif ($status==5) return $langs->trans($this->labelStatusShort[$status]).' '.img_picto($langs->trans($this->labelStatusShort[$status]),'statut5'); */ //else return $this->progress.' %'; return ' '; } elseif ($mode == 6) { - /*if ($status==0) return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut0'); - elseif ($status==1) return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut1'); - elseif ($status==2) return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut3'); - elseif ($status==3) return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut6'); - elseif ($status==4) return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut6'); - elseif ($status==5) return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut5'); + /*if ($status==0) return $langs->trans($this->labelStatus[$status]).' '.img_picto($langs->trans($this->labelStatusShort[$status]),'statut0'); + elseif ($status==1) return $langs->trans($this->labelStatus[$status]).' '.img_picto($langs->trans($this->labelStatusShort[$status]),'statut1'); + elseif ($status==2) return $langs->trans($this->labelStatus[$status]).' '.img_picto($langs->trans($this->labelStatusShort[$status]),'statut3'); + elseif ($status==3) return $langs->trans($this->labelStatus[$status]).' '.img_picto($langs->trans($this->labelStatusShort[$status]),'statut6'); + elseif ($status==4) return $langs->trans($this->labelStatus[$status]).' '.img_picto($langs->trans($this->labelStatusShort[$status]),'statut6'); + elseif ($status==5) return $langs->trans($this->labelStatus[$status]).' '.img_picto($langs->trans($this->labelStatusShort[$status]),'statut5'); */ //else return $this->progress.' %'; return ' '; diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 05223813b11..885199bfa3d 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -914,7 +914,7 @@ if (!empty($arrayfields['s.name_alias']['checked'])) { if (!empty($arrayfields['p.fk_statut']['checked'])) { print ''; $arrayofstatus = array(); - foreach ($projectstatic->statuts_short as $key => $val) { + foreach ($projectstatic->labelStatusShort as $key => $val) { $arrayofstatus[$key] = $langs->trans($val); } $arrayofstatus['99'] = $langs->trans("NotClosed").' ('.$langs->trans('Draft').'+'.$langs->trans('Opened').')'; diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index a266173e9f6..f15d5bb6b06 100755 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -853,7 +853,7 @@ if ($action == 'create' || $action == 'presend') { if ($action == 'set_status') { $new_status = GETPOST('new_status'); //var_dump($url_page_current . "?track_id=" . $object->track_id); - print $form->formconfirm($url_page_current."?track_id=".$object->track_id."&new_status=".GETPOST('new_status'), $langs->trans("TicketChangeStatus"), $langs->trans("TicketConfirmChangeStatus", $langs->transnoentities($object->statuts_short[$new_status])), "confirm_set_status", '', '', 1); + print $form->formconfirm($url_page_current."?track_id=".$object->track_id."&new_status=".GETPOST('new_status'), $langs->trans("TicketChangeStatus"), $langs->trans("TicketConfirmChangeStatus", $langs->transnoentities($object->labelStatusShort[$new_status])), "confirm_set_status", '', '', 1); } // project info diff --git a/htdocs/ticket/class/actions_ticket.class.php b/htdocs/ticket/class/actions_ticket.class.php index 6e13cb9a605..e37fac7df81 100644 --- a/htdocs/ticket/class/actions_ticket.class.php +++ b/htdocs/ticket/class/actions_ticket.class.php @@ -483,7 +483,7 @@ class ActionsTicket extends CommonHookActions // Sort results to be similar to status object list //sort($exclude_status); - foreach ($object->statuts_short as $status => $status_label) { + foreach ($object->labelStatusShort as $status => $status_label) { if (!in_array($status, $exclude_status)) { print ''; } diff --git a/htdocs/ticket/class/api_tickets.class.php b/htdocs/ticket/class/api_tickets.class.php index f4b28992e0a..cc78da32f2b 100644 --- a/htdocs/ticket/class/api_tickets.class.php +++ b/htdocs/ticket/class/api_tickets.class.php @@ -520,8 +520,8 @@ class Tickets extends DolibarrApi "cache_types_tickets", "cache_category_tickets", "regeximgext", - "statuts_short", - "statuts" + "labelStatus", + "labelStatusShort" ); foreach ($attr2clean as $toclean) { unset($object->$toclean); diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index d2e8af40572..d1ec0e9c41c 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -233,14 +233,14 @@ class Ticket extends CommonObject public $cache_msgs_ticket; /** - * @var array statuts labels + * @var array status labels */ - public $statuts; + public $labelStatus; /** - * @var array statuts short labels + * @var array status short labels */ - public $statuts_short; + public $labelStatusShort; /** * @var int Notify thirdparty at create @@ -362,7 +362,7 @@ class Ticket extends CommonObject $this->db = $db; - $this->statuts_short = array( + $this->labelStatusShort = array( self::STATUS_NOT_READ => 'Unread', self::STATUS_READ => 'Read', self::STATUS_ASSIGNED => 'Assigned', @@ -372,7 +372,7 @@ class Ticket extends CommonObject self::STATUS_CLOSED => 'SolvedClosed', self::STATUS_CANCELED => 'Canceled' ); - $this->statuts = array( + $this->labelStatus = array( self::STATUS_NOT_READ => 'Unread', self::STATUS_READ => 'Read', self::STATUS_ASSIGNED => 'Assigned', @@ -1257,7 +1257,7 @@ class Ticket extends CommonObject */ public function printSelectStatus($selected = "") { - print Form::selectarray('search_fk_statut', $this->statuts_short, $selected, $show_empty = 1, $key_in_label = 0, $value_as_key = 0, $option = '', $translate = 1, $maxlen = 0, $disabled = 0, $sort = '', $morecss = ''); + print Form::selectarray('search_fk_statut', $this->labelStatusShort, $selected, $show_empty = 1, $key_in_label = 0, $value_as_key = 0, $option = '', $translate = 1, $maxlen = 0, $disabled = 0, $sort = '', $morecss = ''); } @@ -1424,8 +1424,8 @@ class Ticket extends CommonObject // phpcs:enable global $langs, $hookmanager; - $labelStatus = $this->statuts[$status]; - $labelStatusShort = $this->statuts_short[$status]; + $labelStatus = $this->labelStatus[$status]; + $labelStatusShort = $this->labelStatusShort[$status]; if ($status == self::STATUS_NOT_READ) { $statusType = 'status0'; diff --git a/htdocs/ticket/index.php b/htdocs/ticket/index.php index ddca41d9dfe..5db24bc1e85 100644 --- a/htdocs/ticket/index.php +++ b/htdocs/ticket/index.php @@ -212,21 +212,21 @@ if ($result) { $dataseries = array(); $colorseries = array(); - $dataseries[] = array('label' => $langs->transnoentitiesnoconv($object->statuts_short[Ticket::STATUS_NOT_READ]), 'data' => round($tick['unread'])); + $dataseries[] = array('label' => $langs->transnoentitiesnoconv($object->labelStatusShort[Ticket::STATUS_NOT_READ]), 'data' => round($tick['unread'])); $colorseries[Ticket::STATUS_NOT_READ] = '-'.$badgeStatus0; - $dataseries[] = array('label' => $langs->transnoentitiesnoconv($object->statuts_short[Ticket::STATUS_READ]), 'data' => round($tick['read'])); + $dataseries[] = array('label' => $langs->transnoentitiesnoconv($object->labelStatusShort[Ticket::STATUS_READ]), 'data' => round($tick['read'])); $colorseries[Ticket::STATUS_READ] = $badgeStatus1; - $dataseries[] = array('label' => $langs->transnoentitiesnoconv($object->statuts_short[Ticket::STATUS_ASSIGNED]), 'data' => round($tick['assigned'])); + $dataseries[] = array('label' => $langs->transnoentitiesnoconv($object->labelStatusShort[Ticket::STATUS_ASSIGNED]), 'data' => round($tick['assigned'])); $colorseries[Ticket::STATUS_ASSIGNED] = $badgeStatus3; - $dataseries[] = array('label' => $langs->transnoentitiesnoconv($object->statuts_short[Ticket::STATUS_IN_PROGRESS]), 'data' => round($tick['inprogress'])); + $dataseries[] = array('label' => $langs->transnoentitiesnoconv($object->labelStatusShort[Ticket::STATUS_IN_PROGRESS]), 'data' => round($tick['inprogress'])); $colorseries[Ticket::STATUS_IN_PROGRESS] = $badgeStatus4; - $dataseries[] = array('label' => $langs->transnoentitiesnoconv($object->statuts_short[Ticket::STATUS_WAITING]), 'data' => round($tick['waiting'])); + $dataseries[] = array('label' => $langs->transnoentitiesnoconv($object->labelStatusShort[Ticket::STATUS_WAITING]), 'data' => round($tick['waiting'])); $colorseries[Ticket::STATUS_WAITING] = '-'.$badgeStatus4; - $dataseries[] = array('label' => $langs->transnoentitiesnoconv($object->statuts_short[Ticket::STATUS_NEED_MORE_INFO]), 'data' => round($tick['needmoreinfo'])); + $dataseries[] = array('label' => $langs->transnoentitiesnoconv($object->labelStatusShort[Ticket::STATUS_NEED_MORE_INFO]), 'data' => round($tick['needmoreinfo'])); $colorseries[Ticket::STATUS_NEED_MORE_INFO] = '-'.$badgeStatus3; - $dataseries[] = array('label' => $langs->transnoentitiesnoconv($object->statuts_short[Ticket::STATUS_CANCELED]), 'data' => round($tick['canceled'])); + $dataseries[] = array('label' => $langs->transnoentitiesnoconv($object->labelStatusShort[Ticket::STATUS_CANCELED]), 'data' => round($tick['canceled'])); $colorseries[Ticket::STATUS_CANCELED] = $badgeStatus9; - $dataseries[] = array('label' => $langs->transnoentitiesnoconv($object->statuts_short[Ticket::STATUS_CLOSED]), 'data' => round($tick['closed'])); + $dataseries[] = array('label' => $langs->transnoentitiesnoconv($object->labelStatusShort[Ticket::STATUS_CLOSED]), 'data' => round($tick['closed'])); $colorseries[Ticket::STATUS_CLOSED] = $badgeStatus6; } else { dol_print_error($db); diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 504b3c9e52d..91d9d07cf2c 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -878,7 +878,7 @@ foreach ($object->fields as $key => $val) { } elseif ($key == 'fk_statut') { $arrayofstatus = array(); $arrayofstatus['openall'] = '-- '.$langs->trans('OpenAll').' --'; - foreach ($object->statuts_short as $key2 => $val2) { + foreach ($object->labelStatusShort as $key2 => $val2) { if ($key2 == Ticket::STATUS_CLOSED) { $arrayofstatus['closeall'] = '-- '.$langs->trans('ClosedAll').' --'; } From 5dd41e3dd53e397fcd7e722ef572a0818d45bd21 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Nov 2023 10:20:01 +0100 Subject: [PATCH 076/120] Clean CSS --- htdocs/ticket/card.php | 3 +-- htdocs/ticket/class/actions_ticket.class.php | 4 +--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index f15d5bb6b06..64b18bc17de 100755 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -1189,10 +1189,9 @@ if ($action == 'create' || $action == 'presend') { print ''; print ''; - print '
'; - // Categories if (isModEnabled('categorie')) { + print '
'; print ''; print ''; print '
'; diff --git a/htdocs/ticket/class/actions_ticket.class.php b/htdocs/ticket/class/actions_ticket.class.php index e37fac7df81..14ef8e6a8eb 100644 --- a/htdocs/ticket/class/actions_ticket.class.php +++ b/htdocs/ticket/class/actions_ticket.class.php @@ -191,7 +191,6 @@ class ActionsTicket extends CommonHookActions print ''."\n"; if ($user->hasRight('ticket', 'manage') && $action == 'edit_message_init') { // MESSAGE - print '
'; print ''; print ''; @@ -199,9 +198,8 @@ class ActionsTicket extends CommonHookActions } // Initial message - print '
'; print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table - print ''; + print '
'; print ''; } @@ -1617,23 +1581,23 @@ if ($search_date_signature_endyear) { $totalarray['nbfield']++; } if (!empty($arrayfields['p.total_ht']['checked'])) { - print_liste_field_titre($arrayfields['p.total_ht']['label'], $_SERVER["PHP_SELF"], 'p.total_ht', '', $param, 'class="right"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['p.total_ht']['label'], $_SERVER["PHP_SELF"], 'p.total_ht', '', $param, '', $sortfield, $sortorder, 'right '); $totalarray['nbfield']++; } if (!empty($arrayfields['p.total_tva']['checked'])) { - print_liste_field_titre($arrayfields['p.total_tva']['label'], $_SERVER["PHP_SELF"], 'p.total_tva', '', $param, 'class="right"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['p.total_tva']['label'], $_SERVER["PHP_SELF"], 'p.total_tva', '', $param, '', $sortfield, $sortorder, 'right '); $totalarray['nbfield']++; } if (!empty($arrayfields['p.total_ttc']['checked'])) { - print_liste_field_titre($arrayfields['p.total_ttc']['label'], $_SERVER["PHP_SELF"], 'p.total_ttc', '', $param, 'class="right"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['p.total_ttc']['label'], $_SERVER["PHP_SELF"], 'p.total_ttc', '', $param, '', $sortfield, $sortorder, 'right '); $totalarray['nbfield']++; } if (!empty($arrayfields['p.total_ht_invoiced']['checked'])) { - print_liste_field_titre($arrayfields['p.total_ht_invoiced']['label'], $_SERVER["PHP_SELF"], '', '', $param, 'class="right"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['p.total_ht_invoiced']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right '); $totalarray['nbfield']++; } if (!empty($arrayfields['p.total_invoiced']['checked'])) { - print_liste_field_titre($arrayfields['p.total_invoiced']['label'], $_SERVER["PHP_SELF"], '', '', $param, 'class="right"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['p.total_invoiced']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right '); $totalarray['nbfield']++; } if (!empty($arrayfields['p.multicurrency_code']['checked'])) { @@ -1645,27 +1609,27 @@ if ($search_date_signature_endyear) { $totalarray['nbfield']++; } if (!empty($arrayfields['p.multicurrency_total_ht']['checked'])) { - print_liste_field_titre($arrayfields['p.multicurrency_total_ht']['label'], $_SERVER['PHP_SELF'], 'p.multicurrency_total_ht', '', $param, 'class="right"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['p.multicurrency_total_ht']['label'], $_SERVER['PHP_SELF'], 'p.multicurrency_total_ht', '', $param, '', $sortfield, $sortorder, 'right '); $totalarray['nbfield']++; } if (!empty($arrayfields['p.multicurrency_total_tva']['checked'])) { - print_liste_field_titre($arrayfields['p.multicurrency_total_tva']['label'], $_SERVER['PHP_SELF'], 'p.multicurrency_total_tva', '', $param, 'class="right"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['p.multicurrency_total_tva']['label'], $_SERVER['PHP_SELF'], 'p.multicurrency_total_tva', '', $param, '', $sortfield, $sortorder, 'right '); $totalarray['nbfield']++; } if (!empty($arrayfields['p.multicurrency_total_ttc']['checked'])) { - print_liste_field_titre($arrayfields['p.multicurrency_total_ttc']['label'], $_SERVER['PHP_SELF'], 'p.multicurrency_total_ttc', '', $param, 'class="right"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['p.multicurrency_total_ttc']['label'], $_SERVER['PHP_SELF'], 'p.multicurrency_total_ttc', '', $param, '', $sortfield, $sortorder, 'right '); $totalarray['nbfield']++; } if (!empty($arrayfields['p.multicurrency_total_ht_invoiced']['checked'])) { - print_liste_field_titre($arrayfields['p.multicurrency_total_ht_invoiced']['label'], $_SERVER["PHP_SELF"], '', '', $param, 'class="right"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['p.multicurrency_total_ht_invoiced']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right '); $totalarray['nbfield']++; } if (!empty($arrayfields['p.multicurrency_total_invoiced']['checked'])) { - print_liste_field_titre($arrayfields['p.multicurrency_total_invoiced']['label'], $_SERVER["PHP_SELF"], '', '', $param, 'class="right"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['p.multicurrency_total_invoiced']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right '); $totalarray['nbfield']++; } if (!empty($arrayfields['u.login']['checked'])) { - print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, 'class="center"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; } if (!empty($arrayfields['sale_representative']['checked'])) { @@ -1673,19 +1637,19 @@ if ($search_date_signature_endyear) { $totalarray['nbfield']++; } if (!empty($arrayfields['total_pa']['checked'])) { - print_liste_field_titre($arrayfields['total_pa']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['total_pa']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'right '); $totalarray['nbfield']++; } if (!empty($arrayfields['total_margin']['checked'])) { - print_liste_field_titre($arrayfields['total_margin']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['total_margin']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'right '); $totalarray['nbfield']++; } if (!empty($arrayfields['total_margin_rate']['checked'])) { - print_liste_field_titre($arrayfields['total_margin_rate']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['total_margin_rate']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'right '); $totalarray['nbfield']++; } if (!empty($arrayfields['total_mark_rate']['checked'])) { - print_liste_field_titre($arrayfields['total_mark_rate']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['total_mark_rate']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'right '); $totalarray['nbfield']++; } // Extra fields @@ -1703,11 +1667,11 @@ if ($search_date_signature_endyear) { print $hookmanager->resPrint; if (!empty($arrayfields['p.datec']['checked'])) { - print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, '', $sortfield, $sortorder, 'center nowraponall '); $totalarray['nbfield']++; } if (!empty($arrayfields['p.tms']['checked'])) { - print_liste_field_titre($arrayfields['p.tms']['label'], $_SERVER["PHP_SELF"], "p.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['p.tms']['label'], $_SERVER["PHP_SELF"], "p.tms", "", $param, '', $sortfield, $sortorder, 'center nowraponall '); $totalarray['nbfield']++; } if (!empty($arrayfields['p.date_cloture']['checked'])) { @@ -1723,7 +1687,7 @@ if ($search_date_signature_endyear) { $totalarray['nbfield']++; } if (!empty($arrayfields['p.fk_statut']['checked'])) { - print_liste_field_titre($arrayfields['p.fk_statut']['label'], $_SERVER["PHP_SELF"], "p.fk_statut", "", $param, 'class="right"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['p.fk_statut']['label'], $_SERVER["PHP_SELF"], "p.fk_statut", "", $param, '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; } if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { @@ -2375,7 +2339,7 @@ if ($search_date_signature_endyear) { } // Status if (!empty($arrayfields['p.fk_statut']['checked'])) { - print ''; + print ''; if (!$i) { $totalarray['nbfield']++; } diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index d2076891619..95ec543ba8a 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -217,7 +217,7 @@ $object->fields = dol_sort_array($object->fields, 'position'); //$arrayfields['anotherfield'] = array('type'=>'integer', 'label'=>'AnotherField', 'checked'=>1, 'enabled'=>1, 'position'=>90, 'csslist'=>'right'); $arrayfields = dol_sort_array($arrayfields, 'position'); -if (!$user->hasRight('societe', 'client', 'voir') || $user->socid) { +if (!$user->hasRight('societe', 'client', 'voir')) { $search_sale = $user->id; } @@ -862,12 +862,6 @@ if ($sall) { } $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = c.fk_projet"; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON c.fk_user_author = u.rowid'; - -// We'll need this table joined to the select in order to filter by sale -/* -if ($search_sale > 0 || (!$user->hasRight('societe', 'client', 'voir') && !$socid)) { - $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; -}*/ if ($search_user > 0) { $sql .= ", ".MAIN_DB_PREFIX."element_contact as ec"; $sql .= ", ".MAIN_DB_PREFIX."c_type_contact as tc"; @@ -963,9 +957,6 @@ if (empty($arrayfields['s.name_alias']['checked']) && $search_company) { if ($search_parent_name) { $sql .= natural_search('s2.nom', $search_parent_name); } -/*if ($search_sale > 0) { - $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $search_sale); -}*/ if ($search_user > 0) { $sql .= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".((int) $search_user); } @@ -1072,7 +1063,7 @@ $sql .= $hookmanager->resPrint; $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= empty($hookmanager->resPrint) ? "" : " HAVING 1=1 ".$hookmanager->resPrint; -print $sql; +//print $sql; // Count total nb of records $nbtotalofrecords = ''; @@ -1770,7 +1761,7 @@ if (!empty($arrayfields['c.import_key']['checked'])) { } // Status if (!empty($arrayfields['c.fk_statut']['checked'])) { - print ''; + print ''; if (!$i) { $totalarray['nbfield']++; } diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 35358718b9b..826fb2fad90 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -622,7 +622,6 @@ $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; $sql = preg_replace('/,\s*$/', '', $sql); -//$sql .= ", COUNT(rc.rowid) as anotherfield"; $sqlfields = $sql; // $sql fields to remove for count total @@ -638,26 +637,14 @@ if ($sortfield == "f.datef") { if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (f.rowid = ef.fk_object)"; } - -// We disable this. It create a bug when searching with sall and sorting on status. Also it create performance troubles. -/* -if (!$sall) { - $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON pf.fk_facture = f.rowid'; -} -*/ if ($sall) { - $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'facturedet as pd ON f.rowid=pd.fk_facture'; + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'facturedet as pd ON f.rowid = pd.fk_facture'; } if (!empty($search_fac_rec_source_title)) { - $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'facture_rec as facrec ON f.fk_fac_rec_source=facrec.rowid'; + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'facture_rec as facrec ON f.fk_fac_rec_source = facrec.rowid'; } $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = f.fk_projet"; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user AS u ON f.fk_user_author = u.rowid'; -// We'll need this table joined to the select in order to filter by sale -/* -if ($search_sale > 0 || (!$user->hasRight('societe', 'client', 'voir') && !$socid)) { - $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; -}*/ if ($search_user > 0) { $sql .= ", ".MAIN_DB_PREFIX."element_contact as ec"; $sql .= ", ".MAIN_DB_PREFIX."c_type_contact as tc"; @@ -669,9 +656,6 @@ $sql .= $hookmanager->resPrint; $sql .= ' WHERE f.fk_soc = s.rowid'; $sql .= ' AND f.entity IN ('.getEntity('invoice').')'; -if (!$user->hasRight('societe', 'client', 'voir') && !$socid) { - $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); -} if ($socid > 0) { $sql .= ' AND s.rowid = '.((int) $socid); } @@ -846,7 +830,7 @@ if (!empty($search_fac_rec_source_title)) { // Search on sale representative if ($search_sale && $search_sale != '-1') { if ($search_sale == -2) { - $sql .= " AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc =f.fk_soc)"; + $sql .= " AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = f.fk_soc)"; } elseif ($search_sale > 0) { $sql .= " AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = f.fk_soc AND sc.fk_user = ".((int) $search_sale).")"; } @@ -1704,15 +1688,15 @@ if (!empty($arrayfields['f.subtype']['checked'])) { print_liste_field_titre($arrayfields['f.subtype']['label'], $_SERVER["PHP_SELF"], 'f.subtype', '', $param, '', $sortfield, $sortorder); } if (!empty($arrayfields['f.datef']['checked'])) { - print_liste_field_titre($arrayfields['f.datef']['label'], $_SERVER['PHP_SELF'], 'f.datef', '', $param, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['f.datef']['label'], $_SERVER['PHP_SELF'], 'f.datef', '', $param, '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; } if (!empty($arrayfields['f.date_valid']['checked'])) { - print_liste_field_titre($arrayfields['f.date_valid']['label'], $_SERVER['PHP_SELF'], 'f.date_valid', '', $param, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['f.date_valid']['label'], $_SERVER['PHP_SELF'], 'f.date_valid', '', $param, '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; } if (!empty($arrayfields['f.date_lim_reglement']['checked'])) { - print_liste_field_titre($arrayfields['f.date_lim_reglement']['label'], $_SERVER['PHP_SELF'], "f.date_lim_reglement", '', $param, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['f.date_lim_reglement']['label'], $_SERVER['PHP_SELF'], "f.date_lim_reglement", '', $param, '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; } if (!empty($arrayfields['p.ref']['checked'])) { @@ -1752,11 +1736,11 @@ if (!empty($arrayfields['state.nom']['checked'])) { $totalarray['nbfield']++; } if (!empty($arrayfields['country.code_iso']['checked'])) { - print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; } if (!empty($arrayfields['typent.code']['checked'])) { - print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; } if (!empty($arrayfields['f.fk_mode_reglement']['checked'])) { @@ -1776,27 +1760,27 @@ if (!empty($arrayfields['f.pos_source']['checked'])) { $totalarray['nbfield']++; } if (!empty($arrayfields['f.total_ht']['checked'])) { - print_liste_field_titre($arrayfields['f.total_ht']['label'], $_SERVER['PHP_SELF'], 'f.total_ht', '', $param, 'class="right"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['f.total_ht']['label'], $_SERVER['PHP_SELF'], 'f.total_ht', '', $param, '', $sortfield, $sortorder, 'right '); $totalarray['nbfield']++; } if (!empty($arrayfields['f.total_tva']['checked'])) { - print_liste_field_titre($arrayfields['f.total_tva']['label'], $_SERVER['PHP_SELF'], 'f.total_tva', '', $param, 'class="right"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['f.total_tva']['label'], $_SERVER['PHP_SELF'], 'f.total_tva', '', $param, '', $sortfield, $sortorder, 'right '); $totalarray['nbfield']++; } if (!empty($arrayfields['f.total_localtax1']['checked'])) { - print_liste_field_titre($arrayfields['f.total_localtax1']['label'], $_SERVER['PHP_SELF'], 'f.localtax1', '', $param, 'class="right"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['f.total_localtax1']['label'], $_SERVER['PHP_SELF'], 'f.localtax1', '', $param, '', $sortfield, $sortorder, 'right '); $totalarray['nbfield']++; } if (!empty($arrayfields['f.total_localtax2']['checked'])) { - print_liste_field_titre($arrayfields['f.total_localtax2']['label'], $_SERVER['PHP_SELF'], 'f.localtax2', '', $param, 'class="right"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['f.total_localtax2']['label'], $_SERVER['PHP_SELF'], 'f.localtax2', '', $param, '', $sortfield, $sortorder, 'right '); $totalarray['nbfield']++; } if (!empty($arrayfields['f.total_ttc']['checked'])) { - print_liste_field_titre($arrayfields['f.total_ttc']['label'], $_SERVER['PHP_SELF'], 'f.total_ttc', '', $param, 'class="right"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['f.total_ttc']['label'], $_SERVER['PHP_SELF'], 'f.total_ttc', '', $param, '', $sortfield, $sortorder, 'right '); $totalarray['nbfield']++; } if (!empty($arrayfields['u.login']['checked'])) { - print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; } if (!empty($arrayfields['sale_representative']['checked'])) { @@ -1804,15 +1788,15 @@ if (!empty($arrayfields['sale_representative']['checked'])) { $totalarray['nbfield']++; } if (!empty($arrayfields['f.retained_warranty']['checked'])) { - print_liste_field_titre($arrayfields['f.retained_warranty']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['f.retained_warranty']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'right '); $totalarray['nbfield']++; } if (!empty($arrayfields['dynamount_payed']['checked'])) { - print_liste_field_titre($arrayfields['dynamount_payed']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['dynamount_payed']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'right '); $totalarray['nbfield']++; } if (!empty($arrayfields['rtp']['checked'])) { - print_liste_field_titre($arrayfields['rtp']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['rtp']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'right '); $totalarray['nbfield']++; } if (!empty($arrayfields['f.multicurrency_code']['checked'])) { @@ -1824,39 +1808,39 @@ if (!empty($arrayfields['f.multicurrency_tx']['checked'])) { $totalarray['nbfield']++; } if (!empty($arrayfields['f.multicurrency_total_ht']['checked'])) { - print_liste_field_titre($arrayfields['f.multicurrency_total_ht']['label'], $_SERVER['PHP_SELF'], 'f.multicurrency_total_ht', '', $param, 'class="right"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['f.multicurrency_total_ht']['label'], $_SERVER['PHP_SELF'], 'f.multicurrency_total_ht', '', $param, '', $sortfield, $sortorder, 'right '); $totalarray['nbfield']++; } if (!empty($arrayfields['f.multicurrency_total_vat']['checked'])) { - print_liste_field_titre($arrayfields['f.multicurrency_total_vat']['label'], $_SERVER['PHP_SELF'], 'f.multicurrency_total_tva', '', $param, 'class="right"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['f.multicurrency_total_vat']['label'], $_SERVER['PHP_SELF'], 'f.multicurrency_total_tva', '', $param, '', $sortfield, $sortorder, 'right '); $totalarray['nbfield']++; } if (!empty($arrayfields['f.multicurrency_total_ttc']['checked'])) { - print_liste_field_titre($arrayfields['f.multicurrency_total_ttc']['label'], $_SERVER['PHP_SELF'], 'f.multicurrency_total_ttc', '', $param, 'class="right"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['f.multicurrency_total_ttc']['label'], $_SERVER['PHP_SELF'], 'f.multicurrency_total_ttc', '', $param, '', $sortfield, $sortorder, 'right '); $totalarray['nbfield']++; } if (!empty($arrayfields['multicurrency_dynamount_payed']['checked'])) { - print_liste_field_titre($arrayfields['multicurrency_dynamount_payed']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['multicurrency_dynamount_payed']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'right '); $totalarray['nbfield']++; } if (!empty($arrayfields['multicurrency_rtp']['checked'])) { - print_liste_field_titre($arrayfields['multicurrency_rtp']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['multicurrency_rtp']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'right '); $totalarray['nbfield']++; } if (!empty($arrayfields['total_pa']['checked'])) { - print_liste_field_titre($arrayfields['total_pa']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['total_pa']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'right '); $totalarray['nbfield']++; } if (!empty($arrayfields['total_margin']['checked'])) { - print_liste_field_titre($arrayfields['total_margin']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['total_margin']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'right '); $totalarray['nbfield']++; } if (!empty($arrayfields['total_margin_rate']['checked'])) { - print_liste_field_titre($arrayfields['total_margin_rate']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['total_margin_rate']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'right '); $totalarray['nbfield']++; } if (!empty($arrayfields['total_mark_rate']['checked'])) { - print_liste_field_titre($arrayfields['total_mark_rate']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['total_mark_rate']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'right '); $totalarray['nbfield']++; } // Extra fields @@ -1866,15 +1850,15 @@ $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$ $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (!empty($arrayfields['f.datec']['checked'])) { - print_liste_field_titre($arrayfields['f.datec']['label'], $_SERVER["PHP_SELF"], "f.datec", "", $param, 'class="nowrap center"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['f.datec']['label'], $_SERVER["PHP_SELF"], "f.datec", "", $param, '', $sortfield, $sortorder, 'nowraponall center '); $totalarray['nbfield']++; } if (!empty($arrayfields['f.tms']['checked'])) { - print_liste_field_titre($arrayfields['f.tms']['label'], $_SERVER["PHP_SELF"], "f.tms", "", $param, 'class="nowrap center"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['f.tms']['label'], $_SERVER["PHP_SELF"], "f.tms", "", $param, '', $sortfield, $sortorder, 'nowraponall center '); $totalarray['nbfield']++; } if (!empty($arrayfields['f.date_closing']['checked'])) { - print_liste_field_titre($arrayfields['f.date_closing']['label'], $_SERVER["PHP_SELF"], "f.date_closing", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['f.date_closing']['label'], $_SERVER["PHP_SELF"], "f.date_closing", "", $param, '', $sortfield, $sortorder, 'nowraponall center '); $totalarray['nbfield']++; } if (!empty($arrayfields['f.note_public']['checked'])) { @@ -1890,11 +1874,11 @@ if (!empty($arrayfields['f.fk_fac_rec_source']['checked'])) { $totalarray['nbfield']++; } if (!empty($arrayfields['f.fk_statut']['checked'])) { - print_liste_field_titre($arrayfields['f.fk_statut']['label'], $_SERVER["PHP_SELF"], "f.fk_statut,f.paye,f.type", "", $param, 'class="right"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['f.fk_statut']['label'], $_SERVER["PHP_SELF"], "f.fk_statut,f.paye,f.type", "", $param, '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; } if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch center '); $totalarray['nbfield']++; } @@ -2575,6 +2559,7 @@ if ($num > 0) { $totalarray['nbfield']++; } } + // Dyn amount if (!empty($arrayfields['multicurrency_dynamount_payed']['checked'])) { print ''; // TODO Use a denormalized field if (!$i) { @@ -2709,7 +2694,7 @@ if ($num > 0) { } // Status if (!empty($arrayfields['f.fk_statut']['checked'])) { - print '"; if (!$i) { diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index e2eb8492252..15c8b422233 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -195,6 +195,10 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); +if (!$user->hasRight('societe', 'client', 'voir')) { + $search_sale = $user->id; +} + $permissiontoread = $user->hasRight('contrat', 'lire'); $permissiontoadd = $user->hasRight('contrat', 'creer'); $permissiontodelete = $user->hasRight('contrat', 'supprimer'); @@ -324,9 +328,6 @@ $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)"; -if ($search_sale > 0 || (!$user->hasRight('societe', 'client', 'voir') && !$socid)) { - $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; -} $sql .= ", ".MAIN_DB_PREFIX."contrat as c"; if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (c.rowid = ef.fk_object)"; @@ -341,12 +342,9 @@ $sql .= ' AND c.entity IN ('.getEntity('contract').')'; if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) { $sql .= " AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).')'; } -if ($socid) { +if ($socid > 0) { $sql .= " AND s.rowid = ".((int) $socid); } -if (!$user->hasRight('societe', 'client', 'voir') && !$socid) { - $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); -} if ($search_date_start) { $sql .= " AND c.date_contrat >= '".$db->idate($search_date_start)."'"; } @@ -377,16 +375,23 @@ if ($search_town) { if ($search_country && $search_country != '-1') { $sql .= " AND s.fk_pays IN (".$db->sanitize($search_country).')'; } -if ($search_sale > 0) { +/*if ($search_sale > 0) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $search_sale); -} +}*/ if ($search_all) { $sql .= natural_search(array_keys($fieldstosearchall), $search_all); } if ($search_user > 0) { $sql .= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='contrat' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".((int) $search_user); } - +// Search on sale representative +if ($search_sale && $search_sale != '-1') { + if ($search_sale == -2) { + $sql .= " AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = c.fk_soc)"; + } elseif ($search_sale > 0) { + $sql .= " AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = c.fk_soc AND sc.fk_user = ".((int) $search_sale).")"; + } +} // Search for tag/category ($searchCategoryProductList is an array of ID) $searchCategoryProductOperator = -1; $searchCategoryProductList = array($search_product_category); diff --git a/htdocs/core/class/html.formorder.class.php b/htdocs/core/class/html.formorder.class.php index 2e01fae85cf..5bb31a8806e 100644 --- a/htdocs/core/class/html.formorder.class.php +++ b/htdocs/core/class/html.formorder.class.php @@ -37,9 +37,10 @@ class FormOrder extends Form * @param string $selected Preselected value * @param int $short Use short labels * @param string $hmlname Name of HTML select element + * @param string $morecss More CSS * @return void */ - public function selectSupplierOrderStatus($selected = '', $short = 0, $hmlname = 'order_status') + public function selectSupplierOrderStatus($selected = '', $short = 0, $hmlname = 'order_status', $morecss = '') { $options = array(); @@ -68,7 +69,7 @@ class FormOrder extends Form $selectedarray = explode(',', $selected); } - print Form::multiselectarray($hmlname, $options, $selectedarray, 0); + print Form::multiselectarray($hmlname, $options, $selectedarray, 0, 0, $morecss); } /** diff --git a/htdocs/don/list.php b/htdocs/don/list.php index ac7838e33fe..2fea92a0974 100644 --- a/htdocs/don/list.php +++ b/htdocs/don/list.php @@ -342,7 +342,7 @@ if (isModEnabled('project')) { print ''; } print ''; -print '\n"; } print ''; - print ''; + + // Status + print ''; if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; } diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index b267fec9b10..aa9cb9ec2c5 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -315,6 +315,15 @@ if ($socid) { if ($search_all) { $sql .= natural_search(array_keys($fieldstosearchall), $search_all); } +// Search on sale representative +/* +if ($search_sale && $search_sale != '-1') { + if ($search_sale == -2) { + $sql .= " AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = f.fk_soc)"; + } elseif ($search_sale > 0) { + $sql .= " AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = f.fk_soc AND sc.fk_user = ".((int) $search_sale).")"; + } +}*/ // Add where from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; // Add where from hooks diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 0d1ce8d1bad..256405a12ed 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -134,13 +134,6 @@ if (GETPOSTISARRAY('search_status')) { $search_status = (GETPOST('search_status', 'intcomma') != '' ? GETPOST('search_status', 'intcomma') : GETPOST('statut', 'intcomma')); } -// Security check -$orderid = GETPOST('orderid', 'int'); -if ($user->socid) { - $socid = $user->socid; -} -$result = restrictedArea($user, 'fournisseur', $orderid, '', 'commande'); - $diroutputmassaction = $conf->fournisseur->commande->dir_output.'/temp/massgeneration/'.$user->id; $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; @@ -223,6 +216,17 @@ $arrayfields = dol_sort_array($arrayfields, 'position'); $error = 0; +if (!$user->hasRight('societe', 'client', 'voir')) { + $search_sale = $user->id; +} + +// Security check +$orderid = GETPOST('orderid', 'int'); +if ($user->socid) { + $socid = $user->socid; +} +$result = restrictedArea($user, 'fournisseur', $orderid, '', 'commande'); + $permissiontoread = ($user->hasRight("fournisseur", "commande", "lire") || $user->hasRight("supplier_order", "lire")); $permissiontoadd = ($user->hasRight("fournisseur", "commande", "creer") || $user->hasRight("supplier_order", "creer")); $permissiontodelete = ($user->hasRight("fournisseur", "commande", "supprimer") || $user->hasRight("supplier_order", "supprimer")); @@ -809,10 +813,6 @@ if ($sall) { } $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON cf.fk_user_author = u.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = cf.fk_projet"; -// We'll need this table joined to the select in order to filter by sale -if ($search_sale > 0 || (!$user->hasRight("societe", "client", "voir") && !$socid)) { - $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; -} $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; @@ -821,9 +821,6 @@ $sql .= ' AND cf.entity IN ('.getEntity('supplier_order').')'; if ($socid > 0) { $sql .= " AND s.rowid = ".((int) $socid); } -if (!$user->hasRight("societe", "client", "voir") && !$socid) { - $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); -} if ($search_ref) { $sql .= natural_search('cf.ref', $search_ref); } @@ -895,9 +892,9 @@ if ($search_country) { if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) { $sql .= " AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).')'; } -if ($search_sale > 0) { +/*if ($search_sale > 0) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $search_sale); -} +}*/ if ($search_user > 0) { $sql .= " AND EXISTS ("; $sql .= " SELECT ec.rowid "; @@ -934,6 +931,14 @@ if ($search_multicurrency_montant_ttc != '') { if ($search_project_ref != '') { $sql .= natural_search("p.ref", $search_project_ref); } +// Search on sale representative +if ($search_sale && $search_sale != '-1') { + if ($search_sale == -2) { + $sql .= " AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = cf.fk_soc)"; + } elseif ($search_sale > 0) { + $sql .= " AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = cf.fk_soc AND sc.fk_user = ".((int) $search_sale).")"; + } +} // Search for tag/category ($searchCategoryProductList is an array of ID) $searchCategoryProductOperator = -1; $searchCategoryProductList = array($search_product_category); @@ -1485,18 +1490,18 @@ if ($resql) { print ''; } - // Status - if (!empty($arrayfields['cf.fk_statut']['checked'])) { - print ''; - } - // Status billed + // Billed if (!empty($arrayfields['cf.billed']['checked'])) { print ''; } + // Status + if (!empty($arrayfields['cf.fk_statut']['checked'])) { + print ''; + } // Date valid if (!empty($arrayfields['cf.date_valid']['checked'])) { print ''; @@ -1643,21 +1648,21 @@ if ($resql) { $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (!empty($arrayfields['cf.date_creation']['checked'])) { - print_liste_field_titre($arrayfields['cf.date_creation']['label'], $_SERVER["PHP_SELF"], "cf.date_creation", "", $param, '', $sortfield, $sortorder, 'center nowrap '); + print_liste_field_titre($arrayfields['cf.date_creation']['label'], $_SERVER["PHP_SELF"], "cf.date_creation", "", $param, '', $sortfield, $sortorder, 'center nowraponall '); $totalarray['nbfield']++; } if (!empty($arrayfields['cf.tms']['checked'])) { - print_liste_field_titre($arrayfields['cf.tms']['label'], $_SERVER["PHP_SELF"], "cf.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap '); - $totalarray['nbfield']++; - } - if (!empty($arrayfields['cf.fk_statut']['checked'])) { - print_liste_field_titre($arrayfields['cf.fk_statut']['label'], $_SERVER["PHP_SELF"], "cf.fk_statut", "", $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre($arrayfields['cf.tms']['label'], $_SERVER["PHP_SELF"], "cf.tms", "", $param, '', $sortfield, $sortorder, 'center nowraponall '); $totalarray['nbfield']++; } if (!empty($arrayfields['cf.billed']['checked'])) { print_liste_field_titre($arrayfields['cf.billed']['label'], $_SERVER["PHP_SELF"], 'cf.billed', '', $param, '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; } + if (!empty($arrayfields['cf.fk_statut']['checked'])) { + print_liste_field_titre($arrayfields['cf.fk_statut']['label'], $_SERVER["PHP_SELF"], "cf.fk_statut", "", $param, '', $sortfield, $sortorder, 'center '); + $totalarray['nbfield']++; + } if (!empty($arrayfields['cf.date_valid']['checked'])) { print_liste_field_titre($arrayfields['cf.date_valid']['label'], $_SERVER["PHP_SELF"], "cf.date_valid", "", $param, '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; @@ -1707,7 +1712,6 @@ if ($resql) { $objectstatic->id = $obj->rowid; $objectstatic->ref = $obj->ref; - $objectstatic->socid = $obj->socid; $objectstatic->ref_supplier = $obj->ref_supplier; $objectstatic->socid = $obj->socid; $objectstatic->total_ht = $obj->total_ht; @@ -1731,9 +1735,8 @@ if ($resql) { $thirdpartytmp->name_alias = $obj->alias; $thirdpartytmp->client = $obj->client; $thirdpartytmp->fournisseur = $obj->fournisseur; - $objectstatic->socid = $thirdpartytmp->getNomUrl('supplier', 0, 0, -1); // Output Kanban - print $objectstatic->getKanbanView('', array('selected' => in_array($objectstatic->id, $arrayofselected))); + print $objectstatic->getKanbanView('', array('thirdparty'=>$thirdpartytmp->getNomUrl('supplier', 0, 0, -1), 'selected' => in_array($objectstatic->id, $arrayofselected))); if ($i == ($imaxinloop - 1)) { print ''; print ''; @@ -1988,7 +1991,7 @@ if ($resql) { print $hookmanager->resPrint; // Date creation if (!empty($arrayfields['cf.date_creation']['checked'])) { - print ''; if (!$i) { @@ -1997,20 +2000,13 @@ if ($resql) { } // Date modification if (!empty($arrayfields['cf.tms']['checked'])) { - print ''; if (!$i) { $totalarray['nbfield']++; } } - // Status - if (!empty($arrayfields['cf.fk_statut']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } // Billed if (!empty($arrayfields['cf.billed']['checked'])) { print ''; @@ -2018,6 +2014,13 @@ if ($resql) { $totalarray['nbfield']++; } } + // Status + if (!empty($arrayfields['cf.fk_statut']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } // valid date if (!empty($arrayfields['cf.date_valid']['checked'])) { diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index eee60031d46..af17d0cc4c8 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -221,6 +221,10 @@ if ((!$user->hasRight("fournisseur", "facture", "lire") && empty($conf->global-> accessforbidden(); } +if (!$user->hasRight('societe', 'client', 'voir')) { + $search_sale = $user->id; +} + $permissiontoread = ($user->hasRight("fournisseur", "facture", "lire") || $user->hasRight("supplier_invoice", "lire")); $permissiontoadd = ($user->hasRight("fournisseur", "facture", "creer") || $user->hasRight("supplier_invoice", "creer")); $permissiontodelete = ($user->hasRight("fournisseur", "facture", "supprimer") || $user->hasRight("supplier_invoice", "supprimer")); @@ -459,10 +463,6 @@ if ($search_all) { } $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user AS u ON f.fk_user_author = u.rowid'; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = f.fk_projet"; -// We'll need this table joined to the select in order to filter by sale -if ($search_sale > 0 || (!$user->hasRight("societe", "client", "voir") && !$socid)) { - $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; -} if ($search_user > 0) { $sql .= ", ".MAIN_DB_PREFIX."element_contact as ec"; $sql .= ", ".MAIN_DB_PREFIX."c_type_contact as tc"; @@ -473,9 +473,6 @@ $reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object $sql .= $hookmanager->resPrint; $sql .= ' WHERE f.fk_soc = s.rowid'; $sql .= ' AND f.entity IN ('.getEntity('facture_fourn').')'; -if (!$user->hasRight("societe", "client", "voir") && !$socid) { - $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); -} if ($socid > 0) { $sql .= ' AND s.rowid = '.((int) $socid); } @@ -599,6 +596,14 @@ if ($option == 'late') { if ($search_label) { $sql .= natural_search('f.libelle', $search_label); } +// Search on sale representative +if ($search_sale && $search_sale != '-1') { + if ($search_sale == -2) { + $sql .= " AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = f.fk_soc)"; + } elseif ($search_sale > 0) { + $sql .= " AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = f.fk_soc AND sc.fk_user = ".((int) $search_sale).")"; + } +} $searchCategorySupplierList = $search_categ_sup ? array($search_categ_sup) : array(); $searchCategorySupplierOperator = 0; // Search for tag/category ($searchCategorySupplierList is an array of ID) @@ -666,9 +671,10 @@ if ($filter && $filter != -1) { $sql .= " AND ".$db->escape(trim($filt[0]))." = '".$db->escape(trim($filt[1]))."'"; } } +/* if ($search_sale > 0) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $search_sale); -} +}*/ if ($search_user > 0) { $sql .= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='invoice_supplier' AND tc.source='internal' AND ec.element_id = f.rowid AND ec.fk_socpeople = ".((int) $search_user); } @@ -1260,7 +1266,7 @@ if (!empty($arrayfields['f.tms']['checked'])) { if (!empty($arrayfields['f.fk_statut']['checked'])) { print ''; } // Action column @@ -1380,7 +1386,7 @@ if (!empty($arrayfields['f.nb_docs']['checked'])) { $totalarray['nbfield']++; } if (!empty($arrayfields['u.login']['checked'])) { - print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, '', $sortfield, $sortorder); $totalarray['nbfield']++; } if (!empty($arrayfields['dynamount_payed']['checked'])) { @@ -1388,7 +1394,7 @@ if (!empty($arrayfields['dynamount_payed']['checked'])) { $totalarray['nbfield']++; } if (!empty($arrayfields['rtp']['checked'])) { - print_liste_field_titre($arrayfields['rtp']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre($arrayfields['rtp']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder); $totalarray['nbfield']++; } if (!empty($arrayfields['f.multicurrency_code']['checked'])) { @@ -1400,23 +1406,23 @@ if (!empty($arrayfields['f.multicurrency_tx']['checked'])) { $totalarray['nbfield']++; } if (!empty($arrayfields['f.multicurrency_total_ht']['checked'])) { - print_liste_field_titre($arrayfields['f.multicurrency_total_ht']['label'], $_SERVER['PHP_SELF'], 'f.multicurrency_total_ht', '', $param, 'class="right"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['f.multicurrency_total_ht']['label'], $_SERVER['PHP_SELF'], 'f.multicurrency_total_ht', '', $param, '"', $sortfield, $sortorder, 'right '); $totalarray['nbfield']++; } if (!empty($arrayfields['f.multicurrency_total_vat']['checked'])) { - print_liste_field_titre($arrayfields['f.multicurrency_total_vat']['label'], $_SERVER['PHP_SELF'], 'f.multicurrency_total_tva', '', $param, 'class="right"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['f.multicurrency_total_vat']['label'], $_SERVER['PHP_SELF'], 'f.multicurrency_total_tva', '', $param, '', $sortfield, $sortorder, 'right '); $totalarray['nbfield']++; } if (!empty($arrayfields['f.multicurrency_total_ttc']['checked'])) { - print_liste_field_titre($arrayfields['f.multicurrency_total_ttc']['label'], $_SERVER['PHP_SELF'], 'f.multicurrency_total_ttc', '', $param, 'class="right"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['f.multicurrency_total_ttc']['label'], $_SERVER['PHP_SELF'], 'f.multicurrency_total_ttc', '', $param, '', $sortfield, $sortorder, 'right '); $totalarray['nbfield']++; } if (!empty($arrayfields['multicurrency_dynamount_payed']['checked'])) { - print_liste_field_titre($arrayfields['multicurrency_dynamount_payed']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['multicurrency_dynamount_payed']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'right '); $totalarray['nbfield']++; } if (!empty($arrayfields['multicurrency_rtp']['checked'])) { - print_liste_field_titre($arrayfields['multicurrency_rtp']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['multicurrency_rtp']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'right '); $totalarray['nbfield']++; } // Extra fields @@ -1434,7 +1440,7 @@ if (!empty($arrayfields['f.tms']['checked'])) { $totalarray['nbfield']++; } if (!empty($arrayfields['f.fk_statut']['checked'])) { - print_liste_field_titre($arrayfields['f.fk_statut']['label'], $_SERVER["PHP_SELF"], "fk_statut,paye,type", "", $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre($arrayfields['f.fk_statut']['label'], $_SERVER["PHP_SELF"], "fk_statut,paye,type", "", $param, '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; } // Action column @@ -1946,7 +1952,7 @@ while ($i < $imaxinloop) { // Date creation if (!empty($arrayfields['f.datec']['checked'])) { - print ''; if (!$i) { @@ -1955,7 +1961,7 @@ while ($i < $imaxinloop) { } // Date modification if (!empty($arrayfields['f.tms']['checked'])) { - print ''; if (!$i) { @@ -1964,7 +1970,7 @@ while ($i < $imaxinloop) { } // Status if (!empty($arrayfields['f.fk_statut']['checked'])) { - print '"; if (!$i) { diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index 25e8a90da71..6d699186c0a 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -198,6 +198,10 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); +if (!$user->hasRight('societe', 'client', 'voir')) { + $search_sale = $user->id; +} + $result = restrictedArea($user, $module, $objectid, $dbtable); $permissiontoread = $user->rights->supplier_proposal->lire; @@ -310,9 +314,6 @@ $sql .= ' sp.rowid, sp.note_public, sp.note_private, sp.total_ht, sp.total_tva, $sql .= ' sp.fk_multicurrency, sp.multicurrency_code, sp.multicurrency_tx, sp.multicurrency_total_ht, sp.multicurrency_total_tva as multicurrency_total_vat, sp.multicurrency_total_ttc,'; $sql .= ' sp.datec as date_creation, sp.tms as date_update,'; $sql .= " p.rowid as project_id, p.ref as project_ref,"; -if (!$user->hasRight('societe', 'client', 'voir') && !$socid) { - $sql .= " sc.fk_soc, sc.fk_user,"; -} $sql .= " u.firstname, u.lastname, u.photo, u.login, u.statut as ustatus, u.admin, u.employee, u.email as uemail"; // Add fields from extrafields if (!empty($extrafields->attributes[$object->table_element]['label'])) { @@ -337,19 +338,12 @@ if ($sall) { } $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON sp.fk_user_author = u.rowid'; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = sp.fk_projet"; -// We'll need this table joined to the select in order to filter by sale -if ($search_sale > 0 || (!$user->hasRight('societe', 'client', 'voir') && !$socid)) { - $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; -} if ($search_user > 0) { $sql .= ", ".MAIN_DB_PREFIX."element_contact as c"; $sql .= ", ".MAIN_DB_PREFIX."c_type_contact as tc"; } $sql .= ' WHERE sp.fk_soc = s.rowid'; $sql .= ' AND sp.entity IN ('.getEntity('supplier_proposal').')'; -if (!$user->hasRight('societe', 'client', 'voir') && !$socid) { //restriction - $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); -} if ($search_town) { $sql .= natural_search('s.town', $search_town); } @@ -408,7 +402,7 @@ if ($search_multicurrency_montant_ttc != '') { if ($sall) { $sql .= natural_search(array_keys($fieldstosearchall), $sall); } -if ($socid) { +if ($socid > 0) { $sql .= ' AND s.rowid = '.((int) $socid); } if ($search_status >= 0 && $search_status != '') { @@ -426,12 +420,21 @@ if ($search_date_valid_start) { if ($search_date_valid_end) { $sql .= " AND sp.date_valid <= '".$db->idate($search_date_valid_end)."'"; } +/* if ($search_sale > 0) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $search_sale); -} +}*/ if ($search_user > 0) { $sql .= " AND c.fk_c_type_contact = tc.rowid AND tc.element='supplier_proposal' AND tc.source='internal' AND c.element_id = sp.rowid AND c.fk_socpeople = ".((int) $search_user); } +// Search on sale representative +if ($search_sale && $search_sale != '-1') { + if ($search_sale == -2) { + $sql .= " AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = sp.fk_soc)"; + } elseif ($search_sale > 0) { + $sql .= " AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = sp.fk_soc AND sc.fk_user = ".((int) $search_sale).")"; + } +} // Search for tag/category ($searchCategoryProductList is an array of ID) $searchCategoryProductOperator = -1; $searchCategoryProductList = array($search_product_category); @@ -866,7 +869,7 @@ if ($resql) { } // Status if (!empty($arrayfields['sp.fk_statut']['checked'])) { - print ''; } @@ -980,7 +983,7 @@ if ($resql) { $totalarray['nbfield']++; } if (!empty($arrayfields['sp.fk_statut']['checked'])) { - print_liste_field_titre($arrayfields['sp.fk_statut']['label'], $_SERVER["PHP_SELF"], "sp.fk_statut", "", $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre($arrayfields['sp.fk_statut']['label'], $_SERVER["PHP_SELF"], "sp.fk_statut", "", $param, '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; } // Action @@ -1271,7 +1274,7 @@ if ($resql) { print $hookmanager->resPrint; // Date creation if (!empty($arrayfields['sp.datec']['checked'])) { - print ''; if (!$i) { @@ -1280,7 +1283,7 @@ if ($resql) { } // Date modification if (!empty($arrayfields['sp.tms']['checked'])) { - print ''; if (!$i) { @@ -1289,7 +1292,7 @@ if ($resql) { } // Status if (!empty($arrayfields['sp.fk_statut']['checked'])) { - print '\n"; + print '\n"; if (!$i) { $totalarray['nbfield']++; } From b7ad118507549fecffb9dd75187357bdfe7fdec5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Nov 2023 17:20:38 +0100 Subject: [PATCH 080/120] Doc --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 2a5fdc83f7d..95ca60762e3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,7 @@ For users: ---------- NEW: Compatibility with PHP 8.2 NEW: Module for Advanced stock transfert is now stable (#26594) +NEW: Module Workstation (used to enhance the module BOM and Manufacturing Order) is now stable NEW: Add a confirmation popup when deleting extrafields NEW: Add type 'icon' type for extrafields NEW: Close #20930 Use ajax for state loading after country change From a5b909a6e9e9440cebe7a412aa2bf81b7e15c3e8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 25 Nov 2023 01:41:24 +0100 Subject: [PATCH 081/120] CSS --- htdocs/compta/facture/list.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 826fb2fad90..15a14b757b7 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -2267,16 +2267,16 @@ if ($num > 0) { } // State if (!empty($arrayfields['state.nom']['checked'])) { - print "\n"; + print '\n"; if (!$i) { $totalarray['nbfield']++; } } // Country if (!empty($arrayfields['country.code_iso']['checked'])) { - print ''; if (!$i) { $totalarray['nbfield']++; From 5ca156386d7176b1f285e1c83e91bb53d3313b12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charl=C3=A8ne=20Benke?= <1179011+defrance@users.noreply.github.com> Date: Sun, 26 Nov 2023 15:37:58 +0100 Subject: [PATCH 082/120] php V8 warning (#26853) --- htdocs/projet/tasks/time.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 2bd89809c95..89fdbe29e73 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -2808,9 +2808,9 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser } else { print ''; } - } elseif ($totalarray['totaldurationfield'] == $i) { + } elseif (isset($totalarray['totaldurationfield']) && $totalarray['totaldurationfield'] == $i) { print ''; - } elseif ($totalarray['totalvaluefield'] == $i) { + } elseif (isset($totalarray['totalvaluefield']) && $totalarray['totalvaluefield'] == $i) { print ''; //} elseif ($totalarray['totalvaluebilledfield'] == $i) { print ''; } else { From dc4d5111aa4e9c9fa8f1e8a468af8577c07e11d8 Mon Sep 17 00:00:00 2001 From: Mohamed DAOUD Date: Sun, 26 Nov 2023 15:51:00 +0100 Subject: [PATCH 083/120] New add evaluation report pdf module HRM (#26850) * add rh evaluation report pdf * Update modHRM.class.php * fix phpcs modHRM.class.php --- htdocs/core/class/html.formfile.class.php | 7 + .../modules/hrm/doc/pdf_standard.modules.php | 722 ++++++++++++++++++ htdocs/core/modules/modHRM.class.php | 6 +- htdocs/hrm/class/evaluation.class.php | 5 +- htdocs/hrm/evaluation_card.php | 32 +- .../mysql/tables/llx_hrm_evaluation-hrm.sql | 2 + htdocs/langs/en_US/hrm.lang | 2 + htdocs/langs/fr_FR/hrm.lang | 2 + 8 files changed, 766 insertions(+), 12 deletions(-) create mode 100644 htdocs/core/modules/hrm/doc/pdf_standard.modules.php diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 924dbb16f74..9f2eb3146ab 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -573,6 +573,13 @@ class FormFile include_once DOL_DOCUMENT_ROOT.'/core/modules/stock/modules_stock.php'; $modellist = ModelePDFStock::liste_modeles($this->db); } + } elseif ($modulepart == 'hrm') { + if (is_array($genallowed)) { + $modellist = $genallowed; + } else { + include_once DOL_DOCUMENT_ROOT.'/core/modules/hrm/modules_evaluation.php'; + $modellist = ModelePDFEvaluation::liste_modeles($this->db); + } } elseif ($modulepart == 'movement') { if (is_array($genallowed)) { $modellist = $genallowed; diff --git a/htdocs/core/modules/hrm/doc/pdf_standard.modules.php b/htdocs/core/modules/hrm/doc/pdf_standard.modules.php new file mode 100644 index 00000000000..3d2e447e3f2 --- /dev/null +++ b/htdocs/core/modules/hrm/doc/pdf_standard.modules.php @@ -0,0 +1,722 @@ + + * Copyright (C) 2015 Alexandre Spangaro + * Copyright (C) 2016-2023 Philippe Grand + * Copyright (C) 2018-2020 Frédéric France + * Copyright (C) 2018 Francis Appels + * Copyright (C) 2019 Markus Welters + * Copyright (C) 2019 Rafael Ingenleuf + * Copyright (C) 2020 Marc Guenneugues + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * or see https://www.gnu.org/ + */ + +/** + * \file htdocs/core/modules/hrm/doc/pdf_standard.modules.php + * \ingroup hrm + * \brief File of class to generate evaluation report from standard model + */ + +require_once DOL_DOCUMENT_ROOT.'/core/modules/hrm/modules_evaluation.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; + +/** + * Class to generate Evaluation Pdf based on standard model + */ +class pdf_standard extends ModelePDFEvaluation +{ + /** + * @var DoliDb Database handler + */ + public $db; + + /** + * @var string model name + */ + public $name; + + /** + * @var string model description (short text) + */ + public $description; + + /** + * @var int Save the name of generated file as the main doc when generating a doc with this template + */ + public $update_main_doc_field; + + /** + * @var string document type + */ + public $type; + + /** + * Dolibarr version of the loaded document + * @var string + */ + public $version = 'dolibarr'; + + public $posxpiece; + public $posxskill; + public $posxrankemp; + public $posxrequiredrank; + public $posxresult; + public $postotalht; + public $posxnotes; + + + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + public function __construct($db) + { + global $conf, $langs, $mysoc, $user; + // Translations + $langs->loadLangs(array("main", "hrm")); + + $this->db = $db; + $this->name = "standard"; + $this->description = $langs->trans('PDFStandardHrmEvaluation'); + $this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template + + // Page size for A4 format + $this->type = 'pdf'; + $formatarray = pdf_getFormat(); + $this->page_largeur = $formatarray['width']; + $this->page_hauteur = $formatarray['height']; + $this->format = array($this->page_largeur, $this->page_hauteur); + $this->marge_gauche = getDolGlobalInt('MAIN_PDF_MARGIN_LEFT', 10); + $this->marge_droite = getDolGlobalInt('MAIN_PDF_MARGIN_RIGHT', 10); + $this->marge_haute = getDolGlobalInt('MAIN_PDF_MARGIN_TOP', 10); + $this->marge_basse = getDolGlobalInt('MAIN_PDF_MARGIN_BOTTOM', 10); + + $this->option_logo = 1; // Display logo + $this->option_draft_watermark = 1; // Support add of a watermark on drafts + + // Get source company + $this->emetteur = $mysoc; + + // Define position of columns + $this->posxnotes = $this->marge_gauche + 1; + + $this->posxpiece = $this->marge_gauche + 1; + $this->posxskill = $this->marge_gauche + 8; + $this->posxrankemp = 129; + $this->posxrequiredrank = 157; + $this->posxresult = 185; + + if ($this->page_largeur < 210) { // To work with US executive format + $this->posxrankemp -= 20; + $this->posxrequiredrank -= 20; + $this->posxresult -= 20; + } + } + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Function to build pdf onto disk + * + * @param Evaluation $object Object to generate + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int $hidedetails Do not show line details + * @param int $hidedesc Do not show desc + * @param int $hideref Do not show ref + * @return int 1=OK, 0=KO + */ + public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) + { + // phpcs:enable + global $user, $langs, $conf, $mysoc, $db, $hookmanager, $nblines; + + if (!is_object($outputlangs)) { + $outputlangs = $langs; + } + // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO + if (!empty($conf->global->MAIN_USE_FPDF)) { + $outputlangs->charset_output = 'ISO-8859-1'; + } + + // Load traductions files required by page + $outputlangs->loadLangs(array("main", "hrm")); + + $nblines = count($object->lines); + + if ($conf->hrm->dir_output) { + // Definition of $dir and $file + if ($object->specimen) { + //$dir = $conf->hrm->dir_output; + $dir = $conf->hrm->multidir_output[isset($object->entity) ? $object->entity : 1].'/evaluation'; + $file = $dir."/SPECIMEN.pdf"; + } else { + $objectref = dol_sanitizeFileName($object->ref); + //$dir = $conf->hrm->dir_output."/".$objectref; + $dir = $conf->hrm->multidir_output[isset($object->entity) ? $object->entity : 1].'/evaluation'."/".$objectref; + $file = $dir."/".$objectref.".pdf"; + } + + if (!file_exists($dir)) { + if (dol_mkdir($dir) < 0) { + $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); + return 0; + } + } + + if (file_exists($dir)) { + // Add pdfgeneration hook + if (!is_object($hookmanager)) { + include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; + $hookmanager = new HookManager($this->db); + } + $hookmanager->initHooks(array('pdfgeneration')); + $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); + global $action; + $reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks + // Set nblines with the new command lines content after hook + $nblines = count($object->lines); + + // Create pdf instance + $pdf = pdf_getInstance($this->format); + $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance + $heightforinfotot = 0; // Height reserved to output the info and total part + $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page + $heightforfooter = $this->marge_basse + 12; // Height reserved to output the footer (value include bottom margin) + if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) { + $heightforfooter += 6; + } + + $pdf->SetAutoPageBreak(1, 0); + + if (class_exists('TCPDF')) { + $pdf->setPrintHeader(false); + $pdf->setPrintFooter(false); + } + $pdf->SetFont(pdf_getPDFFont($outputlangs)); + // Set path to the background PDF File + if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) { + $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/' . getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')); + $tplidx = $pdf->importPage(1); + } + + $pdf->Open(); + $pagenb = 0; + $pdf->SetDrawColor(128, 128, 128); + + $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); + $pdf->SetSubject($outputlangs->transnoentities("Evaluation")); + $pdf->SetCreator("Dolibarr ".DOL_VERSION); + $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); + $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Evaluation")); + if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { + $pdf->SetCompression(false); + } + + $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right + + // New page + $pdf->AddPage(); + if (!empty($tplidx)) { + $pdf->useTemplate($tplidx); + } + $pagenb++; + $this->_pagehead($pdf, $object, 1, $outputlangs); + $pdf->SetFont('', '', $default_font_size - 1); + $pdf->MultiCell(0, 3, ''); // Set interline to 3 + $pdf->SetTextColor(0, 0, 0); + + $tab_top = 65; + $tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 35 : 10); + + $tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext; + + // Show notes + if (!empty($object->note_public)) { + $tab_top = 65; + + $pdf->SetFont('', 'B', $default_font_size); + $pdf->MultiCell(190, 4, $outputlangs->transnoentities("Notes") . ":", 0, 'L', 0, '', 12, $tab_top); + $tab_top +=4; + $pdf->SetFont('', '', $default_font_size - 1); + $pdf->writeHTMLCell(190, 3, $this->posxnotes + 1, $tab_top + 1, dol_htmlentitiesbr($object->note_public), 0, 1); + $nexY = $pdf->GetY(); + $height_note = $nexY - $tab_top; + + // Rect takes a length in 3rd parameter + $pdf->SetDrawColor(192, 192, 192); + $pdf->Rect($this->marge_gauche, $tab_top - 1 - 4, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1 + 6); + + $tab_height = $tab_height - $height_note; + $tab_top = $nexY + 6; + } else { + $height_note = 0; + } + + $iniY = $tab_top + 7; + $initialY = $tab_top + 7; + $nexY = $tab_top + 7; + + $pdf->setTopMargin($tab_top_newpage); + // Loop on each lines + $i = 0; + while ($i < $nblines) { + $pdf->SetFont('', '', $default_font_size - 2); // Into loop to work with multipage + $pdf->SetTextColor(0, 0, 0); + + if (empty($showmorebeforepagebreak) && ($i !== ($nblines - 1))) { + $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. + } else { + $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it. + } + + $pdf->setTopMargin($tab_top_newpage); + + $pageposbefore = $pdf->getPage(); + $curY = $nexY; + $pdf->startTransaction(); + + $this->printLine($pdf, $object, $i, $curY, $default_font_size, $outputlangs, $hidedetails); + + + + $pageposafter = $pdf->getPage(); + if ($pageposafter > $pageposbefore) { + // There is a pagebreak + $pdf->rollbackTransaction(true); + + $pageposafter = $pageposbefore; + if (empty($showmorebeforepagebreak)) { + $pdf->AddPage('', '', true); + if (!empty($tplidx)) { + $pdf->useTemplate($tplidx); + } + if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) { + $this->_pagehead($pdf, $object, 0, $outputlangs); + } + $pdf->setPage($pageposafter + 1); + $showmorebeforepagebreak = 1; + $nexY = $tab_top_newpage; + $nexY += ($pdf->getFontSize() * 1.3); // Add space between lines + $pdf->SetFont('', '', $default_font_size - 2); // Into loop to work with multipage + $pdf->SetTextColor(0, 0, 0); + + $pdf->setTopMargin($tab_top_newpage); + continue; + } else { + $pdf->setPageOrientation('', 1, $heightforfooter); + $showmorebeforepagebreak = 0; + } + + $this->printLine($pdf, $object, $i, $curY, $default_font_size, $outputlangs, $hidedetails); + $pageposafter = $pdf->getPage(); + $posyafter = $pdf->GetY(); + if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) { + // There is no space left for total+free text + if ($i == ($nblines - 1)) { + // No more lines, and no space left to show total, so we create a new page + $pdf->AddPage('', '', true); + if (!empty($tplidx)) { + $pdf->useTemplate($tplidx); + } + if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) { + $this->_pagehead($pdf, $object, 0, $outputlangs); + } + $pdf->setPage($pageposafter + 1); + } + } else { + // We found a page break + // Allows data in the first page if description is long enough to break in multiples pages + if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) { + $showmorebeforepagebreak = 1; + } else { + $showmorebeforepagebreak = 0; + } + } + } else // No pagebreak + { + $pdf->commitTransaction(); + } + $i++; + + //nexY + $nexY = $pdf->GetY(); + $pdf->line($this->marge_gauche, $nexY + 2, $this->page_largeur - $this->marge_droite, $nexY + 2); + $pageposafter = $pdf->getPage(); + $pdf->setPage($pageposbefore); + $pdf->setTopMargin($this->marge_haute); + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. + + + $nexY += ($pdf->getFontSize() * 1.3); // Add space between lines + + // Detect if some page were added automatically and output _tableau for past pages + while ($pagenb < $pageposafter) { + $pdf->setPage($pagenb); + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. + if ($pagenb == 1) { + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); + } else { + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); + } + $this->_pagefoot($pdf, $object, $outputlangs, 1); + $pagenb++; + $pdf->setPage($pagenb); + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. + if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) { + $this->_pagehead($pdf, $object, 0, $outputlangs); + } + if (!empty($tplidx)) { + $pdf->useTemplate($tplidx); + } + } + if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) { + if ($pagenb == 1) { + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); + } else { + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); + } + $this->_pagefoot($pdf, $object, $outputlangs, 1); + // New page + $pdf->AddPage(); + if (!empty($tplidx)) { + $pdf->useTemplate($tplidx); + } + $pagenb++; + if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) { + $this->_pagehead($pdf, $object, 0, $outputlangs); + } + } + } + + // Show square + if ($pagenb == 1) { + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); + $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; + } else { + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0); + $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; + } + + $pdf->SetFont('', '', 10); + + + // Page footer + $this->_pagefoot($pdf, $object, $outputlangs); + if (method_exists($pdf, 'AliasNbPages')) { + $pdf->AliasNbPages(); + } + + $pdf->Close(); + + $pdf->Output($file, 'F'); + + // Add pdfgeneration hook + $hookmanager->initHooks(array('pdfgeneration')); + $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); + global $action; + $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook < 0) { + $this->error = $hookmanager->error; + $this->errors = $hookmanager->errors; + } + + dolChmod($file); + + $this->result = array('fullpath'=>$file); + + return 1; // No error + } else { + $this->error = $langs->trans("ErrorCanNotCreateDir", $dir); + return 0; + } + } else { + $this->error = $langs->trans("ErrorConstantNotDefined", "HRM_OUTPUTDIR"); + return 0; + } + } + + /** + * @param TCPDF $pdf Object PDF + * @param Evaluation $object Object to show + * @param int $linenumber line number + * @param int $curY current y position + * @param int $default_font_size default siez of font + * @param Translate $outputlangs Object lang for output + * @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines) + * @return void + */ + protected function printLine(&$pdf, $object, $linenumber, $curY, $default_font_size, $outputlangs, $hidedetails = 0) + { + global $conf; + $objectligne = $object->lines[$linenumber]; + $pdf->SetFont('', '', $default_font_size - 1); + $pdf->SetTextColor(0, 0, 0); + + // Result + $pdf->SetXY($this->posxresult - 1, $curY); + + if ($objectligne->rankorder > $objectligne->required_rank) { + // Teal Green + $pdf->SetFillColor(0, 109, 91); + } elseif ($objectligne->rankorder == $objectligne->required_rank) { + // Seafoam Green + $pdf->SetFillColor(159, 226, 191); + } elseif ($objectligne->rankorder < $objectligne->required_rank) { + // red + $pdf->SetFillColor(205, 92, 92); + } + if ($objectligne->rankorder == 0 || $objectligne->required_rank == 0) { + // No fill color + $pdf->SetFillColor(255, 255, 255); + } + $result = (($objectligne->required_rank != 0 && $objectligne->rankorder != 0) ? $objectligne->rankorder . "/" . $objectligne->required_rank : "-"); + $pdf->MultiCell($this->posxresult - 210 - 0.8 - 4, 4, $result, 0, 'C', 1); + + + // required Rank + $pdf->SetXY($this->posxrequiredrank, $curY); + $pdf->MultiCell($this->posxresult - $this->posxrequiredrank - 0.8, 4, (($objectligne->required_rank != 0 && $objectligne->rankorder != 0) ? $objectligne->required_rank : "-"), 0, 'C'); + + // Rank Employee + $pdf->SetXY($this->posxrankemp, $curY); + $pdf->MultiCell($this->posxrequiredrank - $this->posxrankemp - 0.8, 4, (($objectligne->rankorder != 0) ? $objectligne->rankorder : "-"), 0, 'C'); + + // Skill + $skill = new Skill($this->db); + $skill->fetch($objectligne->fk_skill); + $pdf->SetXY($this->posxskill, $curY); + $comment = $skill->label; + + if (!empty($skill->description)) { + $comment .= '
' . $outputlangs->trans("Description").': '.$skill->description; + } + $pdf->writeHTMLCell($this->posxrankemp - $this->posxskill - 0.8, 4, $this->posxskill - 1, $curY, $comment, 0, 1); + + + + // Line num + $pdf->SetXY($this->posxpiece, $curY); + $pdf->writeHTMLCell($this->posxskill - $this->posxpiece - 0.8, 3, $this->posxpiece - 1, $curY, $linenumber + 1, 0, 1, 0, 0, 'C'); + } + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore + /** + * Show top header of page. + * + * @param TCPDF $pdf Object PDF + * @param Evaluation $object Object to show + * @param int $showaddress 0=no, 1=yes + * @param Translate $outputlangs Object lang for output + * @return void + */ + protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs) + { + // global $conf, $langs, $hookmanager; + global $user, $langs, $conf, $mysoc, $db, $hookmanager; + + // Load traductions files required by page + $outputlangs->loadLangs(array("main", "trips", "companies")); + + $default_font_size = pdf_getPDFFontSize($outputlangs); + + + $pdf->SetTextColor(0, 0, 60); + $pdf->SetFont('', 'B', $default_font_size + 3); + + $posy = $this->marge_haute; + $posx = $this->page_largeur - $this->marge_droite - 100; + + $pdf->SetXY($this->marge_gauche, $posy); + + // Logo + $logo = $conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; + if ($this->emetteur->logo) { + if (is_readable($logo)) { + $height = pdf_getHeightForLogo($logo); + $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) + } else { + $pdf->SetTextColor(200, 0, 0); + $pdf->SetFont('', 'B', $default_font_size - 2); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L'); + } + } else { + $text = $this->emetteur->name; + $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); + } + + $pdf->SetFont('', 'B', $default_font_size + 4); + $pdf->SetXY($posx, $posy); + $pdf->SetTextColor(0, 0, 60); + $pdf->MultiCell($this->page_largeur - $this->marge_droite - $posx, 6, $outputlangs->transnoentities("Eval"), 0, 'R'); + + $pdf->SetFont('', '', $default_font_size - 1); + + // Ref complete + $posy += 8; + $pdf->SetXY($posx, $posy); + $pdf->SetTextColor(0, 0, 60); + $pdf->MultiCell($this->page_largeur - $this->marge_droite - $posx, 3, $outputlangs->transnoentities("Ref")." : ".$object->ref, '', 'R'); + + // Date evaluation + $posy += 5; + $pdf->SetXY($posx, $posy); + $pdf->SetTextColor(0, 0, 60); + $pdf->MultiCell($this->page_largeur - $this->marge_droite - $posx, 3, $outputlangs->transnoentities("DateEval")." : ".dol_print_date($object->date_eval, "day", false, $outputlangs), '', 'R'); + + + if ($showaddress) { + // Sender properties + $carac_emetteur = ''; + + // employee informations + $employee = new User($this->db); + $employee->fetch($object->fk_user); + $carac_emetteur .= ($carac_emetteur ? "\n" : '').$outputlangs->transnoentities('Employee').' : '.$outputlangs->convToOutputCharset(ucfirst($employee->firstname) . ' ' . strtoupper($employee->lastname)); + + // Position + $job = new Job($db); + $job->fetch($object->fk_job); + $carac_emetteur .= ($carac_emetteur ? "\n" : '').$outputlangs->transnoentities('JobProfile').' : '.$outputlangs->convToOutputCharset($job->label); + + /*$carac_emetteur .= "\n"; + if ($object->description) { + $carac_emetteur .= ($carac_emetteur ? "\n" : '').$outputlangs->transnoentities("Phone")." : ".$outputlangs->convToOutputCharset($object->description); + }*/ + + + // Show sender + $posy = 40; + $posx = $this->marge_gauche; + $hautcadre = 20; + if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) { + $posx = 118; + } + + // Show sender frame + /*$pdf->SetTextColor(0, 0, 0); + $pdf->SetFont('', 'B', $default_font_size - 2); + $pdf->SetXY($posx, $posy - 5); + $pdf->MultiCell(190, 5, $outputlangs->transnoentities("Informations"), '', 'L');*/ + $pdf->SetXY($posx, $posy); + $pdf->SetFillColor(224, 224, 224); + $pdf->MultiCell(190, $hautcadre, "", 0, 'R', 1); + $pdf->SetTextColor(0, 0, 60); + + // Show sender information + $pdf->SetXY($posx + 2, $posy + 3); + $pdf->SetFont('', 'B', $default_font_size); + $pdf->MultiCell(190, 4, $outputlangs->convToOutputCharset($object->label), 0, 'L'); + $pdf->SetXY($posx + 2, $posy + 8); + $pdf->SetFont('', '', $default_font_size - 1); + $pdf->MultiCell(190, 4, $carac_emetteur, 0, 'L'); + } + } + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore + /** + * Show table for lines + * + * @param TCPDF $pdf Object PDF + * @param int $tab_top Tab top + * @param int $tab_height Tab height + * @param int $nexY next y + * @param Translate $outputlangs Output langs + * @param int $hidetop 1=Hide top bar of array and title, 0=Hide nothing, -1=Hide only title + * @param int $hidebottom Hide bottom bar of array + * @param string $currency Currency code + * @return void + */ + protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '') + { + global $conf; + + // Force to disable hidetop and hidebottom + $hidebottom = 0; + if ($hidetop) { + $hidetop = -1; + } + + $pdf->SetDrawColor(128, 128, 128); + + // Rect takes a length in 3rd parameter + $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height); + // line prend une position y en 3eme param + if (empty($hidetop)) { + $pdf->line($this->marge_gauche, $tab_top + 5, $this->page_largeur - $this->marge_droite, $tab_top + 5); + } + + $pdf->SetFont('', '', 8); + + // Line no + if (empty($hidetop)) { + $pdf->SetXY($this->posxpiece - 1, $tab_top + 1); + $pdf->MultiCell($this->posxskill - $this->posxpiece - 0.8, 1, '', '', 'C'); + } + + // Skill + $pdf->line($this->posxskill - 1, $tab_top, $this->posxskill - 1, $tab_top + $tab_height); + if (empty($hidetop)) { + $pdf->SetXY($this->posxskill - 1, $tab_top + 1); + $pdf->MultiCell($this->posxrankemp - $this->posxskill - 0.8, 1, $outputlangs->transnoentities("Skill"), '', 'L'); + } + + // Employee Rank + if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) { + $pdf->line($this->posxrankemp - 1, $tab_top, $this->posxrankemp - 1, $tab_top + $tab_height); + if (empty($hidetop)) { + $pdf->SetXY($this->posxrankemp - 0.8, $tab_top + 1); + $pdf->MultiCell($this->posxrequiredrank - $this->posxrankemp - 1, 2, $outputlangs->transnoentities("EmployeeRankShort"), '', 'C'); + } + } + + // Required Rank + $pdf->line($this->posxrequiredrank - 1, $tab_top, $this->posxrequiredrank - 1, $tab_top + $tab_height); + if (empty($hidetop)) { + $pdf->SetXY($this->posxrequiredrank - 0.8, $tab_top + 1); + $pdf->MultiCell($this->posxresult - $this->posxrequiredrank - 1, 2, $outputlangs->transnoentities("RequiredRankShort"), '', 'C'); + } + + // Result + $pdf->line($this->posxresult - 1, $tab_top, $this->posxresult - 1, $tab_top + $tab_height); + if (empty($hidetop)) { + $pdf->SetXY($this->posxresult - 0.8, $tab_top + 1); + $pdf->MultiCell($this->postotalht - $this->posxresult - 1, 2, $outputlangs->transnoentities("Result"), '', 'C'); + } + + $pdf->SetTextColor(0, 0, 0); + } + + + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore + /** + * Show footer of page. Need this->emetteur object + * + * @param TCPDF $pdf PDF + * @param Evaluation $object Object to show + * @param Translate $outputlangs Object lang for output + * @param int $hidefreetext 1=Hide free text + * @return int Return height of bottom margin including footer text + */ + protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) + { + $showdetails = getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', 0); + return pdf_pagefoot($pdf, $outputlangs, '', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); + } +} diff --git a/htdocs/core/modules/modHRM.class.php b/htdocs/core/modules/modHRM.class.php index 6ffa6a29e6e..48491c5fbe5 100644 --- a/htdocs/core/modules/modHRM.class.php +++ b/htdocs/core/modules/modHRM.class.php @@ -286,6 +286,7 @@ class modHRM extends DolibarrModules */ public function init($options = '') { + global $conf; // Permissions $this->remove($options); @@ -294,7 +295,10 @@ class modHRM extends DolibarrModules return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default') } - $sql = array(); + $sql = array( + "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'standard' AND type='evaluation' AND entity = ".((int) $conf->entity), + "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('standard','evaluation',".((int) $conf->entity).")" + ); return $this->_init($sql, $options); } diff --git a/htdocs/hrm/class/evaluation.class.php b/htdocs/hrm/class/evaluation.class.php index 5df9a090133..4cdf777f22d 100644 --- a/htdocs/hrm/class/evaluation.class.php +++ b/htdocs/hrm/class/evaluation.class.php @@ -1004,12 +1004,11 @@ class Evaluation extends CommonObject global $conf, $langs; $result = 0; - $includedocgeneration = 0; $langs->load("hrm"); if (!dol_strlen($modele)) { - $modele = 'standard_evaluation'; + $modele = 'standard'; if (!empty($this->model_pdf)) { $modele = $this->model_pdf; @@ -1020,7 +1019,7 @@ class Evaluation extends CommonObject $modelpath = "core/modules/hrm/doc/"; - if ($includedocgeneration && !empty($modele)) { + if (!empty($modele)) { $result = $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); } diff --git a/htdocs/hrm/evaluation_card.php b/htdocs/hrm/evaluation_card.php index 38725256e65..1f99d9461c5 100644 --- a/htdocs/hrm/evaluation_card.php +++ b/htdocs/hrm/evaluation_card.php @@ -139,8 +139,6 @@ if (empty($reshook)) { // Action to move up and down lines of object //include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; - // Action to build doc - include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; if ($action == 'set_thirdparty' && $permissiontoadd) { $object->setValueFrom('fk_soc', GETPOST('fk_soc', 'int'), '', '', 'date', '', $user, $triggermodname); @@ -216,6 +214,24 @@ if (empty($reshook)) { // no update here we just change the evaluation status $object->setStatut(Evaluation::STATUS_VALIDATED); } + + // Action to build doc + include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; + + // action to remove file + if ($action == 'remove_file_comfirm') { + // Delete file in doc form + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + + $upload_dir = $conf->hrm->dir_output; + $file = $upload_dir.'/'.GETPOST('file'); + $ret = dol_delete_file($file, 0, 0, 0, $object); + if ($ret) { + setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs'); + } else { + setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors'); + } + } } @@ -667,17 +683,17 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print '
'; print ''; // ancre - $includedocgeneration = 0; + $includedocgeneration = 1; // Documents - if ($includedocgeneration) { + if ($user->rights->hrm->evaluation->read) { $objref = dol_sanitizeFileName($object->ref); $relativepath = $objref.'/'.$objref.'.pdf'; $filedir = $conf->hrm->dir_output.'/'.$object->element.'/'.$objref; $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; $genallowed = $user->rights->hrm->evaluation->read; // If you can read, you can build the PDF to read content $delallowed = $user->rights->hrm->evaluation->write; // If you can create/edit, you can remove a file on card - print $formfile->showdocuments('hrm:Evaluation', $object->element.'/'.$objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang); + print $formfile->showdocuments('hrm:Evaluation', $object->element.'/'.$objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang, '', $object, 0, 'remove_file_comfirm'); } // Show links to link elements @@ -700,9 +716,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } //Select mail models is same action as presend - if (GETPOST('modelselected')) { - $action = 'presend'; - } + /*if (GETPOST('modelselected')) { + // $action = 'presend'; + }*/ // To delete. // Presend form $modelmail = 'evaluation'; diff --git a/htdocs/install/mysql/tables/llx_hrm_evaluation-hrm.sql b/htdocs/install/mysql/tables/llx_hrm_evaluation-hrm.sql index 7327d1403dc..7fce5a1bd6b 100644 --- a/htdocs/install/mysql/tables/llx_hrm_evaluation-hrm.sql +++ b/htdocs/install/mysql/tables/llx_hrm_evaluation-hrm.sql @@ -24,6 +24,8 @@ CREATE TABLE llx_hrm_evaluation( description text, note_public text, note_private text, + model_pdf varchar(255), + last_main_doc varchar(255), date_creation datetime NOT NULL, tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user_creat integer NOT NULL, diff --git a/htdocs/langs/en_US/hrm.lang b/htdocs/langs/en_US/hrm.lang index 5cdbf97d868..3dc2c041c06 100644 --- a/htdocs/langs/en_US/hrm.lang +++ b/htdocs/langs/en_US/hrm.lang @@ -48,8 +48,10 @@ ValidateEvaluation=Validate evaluation ConfirmValidateEvaluation=Are you sure you want to validate this evaluation with reference %s? EvaluationCard=Evaluation card RequiredRank=Required rank for the job profile +RequiredRankShort=Required rank PositionsWithThisProfile=Positions with this job profiles EmployeeRank=Employee rank for this skill +EmployeeRankShort=Employee rank EmployeePosition=Employee position EmployeePositions=Employee positions EmployeesInThisPosition=Employees in this position diff --git a/htdocs/langs/fr_FR/hrm.lang b/htdocs/langs/fr_FR/hrm.lang index accfef665e1..25802673610 100644 --- a/htdocs/langs/fr_FR/hrm.lang +++ b/htdocs/langs/fr_FR/hrm.lang @@ -48,8 +48,10 @@ ValidateEvaluation=Valider l'évaluation ConfirmValidateEvaluation=Êtes-vous sûr de vouloir valider cette évaluation sous la référence %s ? EvaluationCard=Fiche évaluation RequiredRank=Rang requis pour le profil de poste +RequiredRankShort=Niveau requis PositionsWithThisProfile=Postes avec ces profils de poste EmployeeRank=Niveau de l'employée pour cette compétence +EmployeeRankShort=Niveau employée EmployeePosition=Poste d'employé EmployeePositions=Postes d'employés EmployeesInThisPosition=Employés occupant ce poste From 748f362c8697e560e4e42b1509d290676078bdcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 26 Nov 2023 15:51:48 +0100 Subject: [PATCH 084/120] clean code (#26848) --- htdocs/core/modules/modTakePos.class.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/core/modules/modTakePos.class.php b/htdocs/core/modules/modTakePos.class.php index 43abea4d860..0db0ab32d77 100644 --- a/htdocs/core/modules/modTakePos.class.php +++ b/htdocs/core/modules/modTakePos.class.php @@ -267,14 +267,14 @@ class modTakePos extends DolibarrModules */ public function init($options = '') { - global $conf, $db, $langs, $user, $mysoc; + global $conf, $langs, $user, $mysoc; $langs->load("cashdesk"); - dolibarr_set_const($db, "TAKEPOS_PRINT_METHOD", "browser", 'chaine', 0, '', $conf->entity); + dolibarr_set_const($this->db, "TAKEPOS_PRINT_METHOD", "browser", 'chaine', 0, '', $conf->entity); // Default customer for Point of sale if (!getDolGlobalInt('CASHDESK_ID_THIRDPARTY1')) { // If a customer has already ben set into the TakePos setup page - $societe = new Societe($db); + $societe = new Societe($this->db); $nametouse = $langs->trans("DefaultPOSThirdLabel"); $searchcompanyid = $societe->fetch(0, $nametouse); @@ -289,7 +289,7 @@ class modTakePos extends DolibarrModules } if ($searchcompanyid > 0) { // We already have or we have create a thirdparty with id = $searchcompanyid, so we link use it into setup - dolibarr_set_const($db, "CASHDESK_ID_THIRDPARTY1", $searchcompanyid, 'chaine', 0, '', $conf->entity); + dolibarr_set_const($this->db, "CASHDESK_ID_THIRDPARTY1", $searchcompanyid, 'chaine', 0, '', $conf->entity); } else { setEventMessages($societe->error, $societe->errors, 'errors'); } @@ -300,7 +300,7 @@ class modTakePos extends DolibarrModules $cate_arbo = $categories->get_full_arbo('product', 0, 1); if (is_array($cate_arbo)) { if (!count($cate_arbo)) { - $category = new Categorie($db); + $category = new Categorie($this->db); $category->label = $langs->trans("DefaultPOSCatLabel"); $category->type = Categorie::TYPE_PRODUCT; @@ -310,7 +310,7 @@ class modTakePos extends DolibarrModules if ($result > 0) { /* TODO Create a generic product only if there is no product yet. If 0 product, we create 1. If there is already product, it is better to show a message to ask to add product in the category */ /* - $product = new Product($db); + $product = new Product($this->db); $product->status = 1; $product->ref = "takepos"; $product->label = $langs->trans("DefaultPOSProductLabel"); @@ -326,7 +326,7 @@ class modTakePos extends DolibarrModules //Create cash account if not exists if (!getDolGlobalInt('CASHDESK_ID_BANKACCOUNT_CASH1')) { require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; - $cashaccount = new Account($db); + $cashaccount = new Account($this->db); $searchaccountid = $cashaccount->fetch(0, "CASH-POS"); if ($searchaccountid == 0) { $cashaccount->ref = "CASH-POS"; @@ -337,7 +337,7 @@ class modTakePos extends DolibarrModules $searchaccountid = $cashaccount->create($user); } if ($searchaccountid > 0) { - dolibarr_set_const($db, "CASHDESK_ID_BANKACCOUNT_CASH1", $searchaccountid, 'chaine', 0, '', $conf->entity); + dolibarr_set_const($this->db, "CASHDESK_ID_BANKACCOUNT_CASH1", $searchaccountid, 'chaine', 0, '', $conf->entity); } else { setEventMessages($cashaccount->error, $cashaccount->errors, 'errors'); } From 93b925a0d2bad28ca053354ceaba81957e112dc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 26 Nov 2023 15:52:05 +0100 Subject: [PATCH 085/120] fix phpstan (#26847) --- htdocs/fichinter/class/api_interventions.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fichinter/class/api_interventions.class.php b/htdocs/fichinter/class/api_interventions.class.php index 8cfc57155d7..c2fca55e16b 100644 --- a/htdocs/fichinter/class/api_interventions.class.php +++ b/htdocs/fichinter/class/api_interventions.class.php @@ -54,7 +54,7 @@ class Interventions extends DolibarrApi ); /** - * @var fichinter $fichinter {@type fichinter} + * @var Fichinter $fichinter {@type fichinter} */ public $fichinter; @@ -366,7 +366,7 @@ class Interventions extends DolibarrApi throw new RestException(304, 'Error nothing done. May be object is already validated'); } if ($result < 0) { - throw new RestException(500, 'Error when validating Intervention: '.$this->commande->error); + throw new RestException(500, 'Error when validating Intervention: '.$this->fichinter->error); } $this->fichinter->fetchObjectLinked(); From 812ab70e0e0c6168099e05b005a99fd915081b34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 26 Nov 2023 15:52:18 +0100 Subject: [PATCH 086/120] fix phpstan (#26846) --- htdocs/webservices/server_supplier_invoice.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/webservices/server_supplier_invoice.php b/htdocs/webservices/server_supplier_invoice.php index 9169e88927d..8f59c0d1be8 100644 --- a/htdocs/webservices/server_supplier_invoice.php +++ b/htdocs/webservices/server_supplier_invoice.php @@ -242,7 +242,7 @@ $server->register( * @param string $ref_ext Ref_ext * @return array Array result */ -function getSupplierInvoice($authentication, $id = '', $ref = '', $ref_ext = '') +function getSupplierInvoice($authentication, $id = 0, $ref = '', $ref_ext = '') { global $db, $conf; From 300f3a8a965243b96635d90de0f30ba46c6d4bd8 Mon Sep 17 00:00:00 2001 From: Lucas Marcouiller <45882981+Hystepik@users.noreply.github.com> Date: Sun, 26 Nov 2023 15:53:10 +0100 Subject: [PATCH 087/120] Fix some phpstan errors (#26845) Co-authored-by: Hystepik --- htdocs/core/modules/bank/doc/pdf_ban.modules.php | 10 ++++++++++ .../interface_50_modAgenda_ActionsAuto.class.php | 6 +++--- htdocs/holiday/class/holiday.class.php | 5 +++++ htdocs/hrm/class/skillrank.class.php | 1 + 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/bank/doc/pdf_ban.modules.php b/htdocs/core/modules/bank/doc/pdf_ban.modules.php index 9e200690dc7..a6948e90fb8 100644 --- a/htdocs/core/modules/bank/doc/pdf_ban.modules.php +++ b/htdocs/core/modules/bank/doc/pdf_ban.modules.php @@ -40,6 +40,16 @@ class pdf_ban extends ModeleBankAccountDoc */ public $version = 'development'; + /** + * @var int posxdatestart + */ + public $posxdatestart; + + /** + * @var int posxdateend + */ + public $posxdateend; + /** * Constructor * diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index 790bd8eaffe..5bf9453324d 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -1038,7 +1038,7 @@ class InterfaceActionsAuto extends DolibarrTriggers // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "members")); - $member = (isset($this->context['member']) ? $this->context['member'] : null); + $member = (isset($object->context['member']) ? $object->context['member'] : null); if (!is_object($member)) { // This should not happen dol_syslog("Execute a trigger MEMBER_SUBSCRIPTION_CREATE with context key 'member' not an object"); include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; @@ -1069,7 +1069,7 @@ class InterfaceActionsAuto extends DolibarrTriggers // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "members")); - $member = $this->context['member']; + $member = $object->context['member']; if (!is_object($member)) { // This should not happen include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; $member = new Adherent($this->db); @@ -1099,7 +1099,7 @@ class InterfaceActionsAuto extends DolibarrTriggers // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "members")); - $member = $this->context['member']; + $member = $object->context['member']; if (!is_object($member)) { // This should not happen but it happen when deleting a subscription from adherents/subscription/card.php dol_syslog("Execute a trigger MEMBER_SUBSCRIPTION_CREATE with context key 'member' not an object"); include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index f3ae583694c..907be851394 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -123,6 +123,11 @@ class Holiday extends CommonObject */ public $fk_user_cancel; + /** + * @var int ID for creation + */ + public $fk_user_create; + public $detail_refuse = ''; diff --git a/htdocs/hrm/class/skillrank.class.php b/htdocs/hrm/class/skillrank.class.php index 3edb8e0eb90..2f4b4fc71ab 100644 --- a/htdocs/hrm/class/skillrank.class.php +++ b/htdocs/hrm/class/skillrank.class.php @@ -125,6 +125,7 @@ class SkillRank extends CommonObject public $fk_user_modif; public $objecttype; // END MODULEBUILDER PROPERTIES + public $rankorder; // If this object has a subtable with lines From ef6b4adaf61e91799f0a55bafe04e70e5592227f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 26 Nov 2023 17:27:14 +0100 Subject: [PATCH 088/120] Fix warning --- htdocs/core/class/commonobject.class.php | 4 +++- htdocs/core/class/discount.class.php | 12 ++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 68344c03756..1d30af00ef5 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -5334,7 +5334,9 @@ abstract class CommonObject if (($line->info_bits & 2) == 2) { // TODO Not sure this is used for source object $discount = new DiscountAbsolute($this->db); - $discount->fk_soc = $this->socid; + if (property_exists($this, 'socid')) { + $discount->fk_soc = $this->socid; + } $this->tpl['label'] .= $discount->getNomUrl(0, 'discount'); } elseif (!empty($line->fk_product)) { $productstatic = new Product($this->db); diff --git a/htdocs/core/class/discount.class.php b/htdocs/core/class/discount.class.php index 9c273d355b0..f50aafdfa51 100644 --- a/htdocs/core/class/discount.class.php +++ b/htdocs/core/class/discount.class.php @@ -44,14 +44,19 @@ class DiscountAbsolute public $errors = array(); /** - * @var int ID discount + * @var int ID discount */ public $id; /** - * @var int Thirdparty ID + * @var int Thirdparty ID + * @deprecated */ public $fk_soc; + /** + * @var int Thirdparty ID + */ + public $socid; public $discount_type; // 0 => customer discount, 1 => supplier discount @@ -750,9 +755,8 @@ class DiscountAbsolute */ public function initAsSpecimen() { - global $user, $langs, $conf; - $this->fk_soc = 1; + $this->socid = 1; $this->amount_ht = 10; $this->amount_tva = 1.96; $this->amount_ttc = 11.96; From 989e76839ef1bdfa426ecad805c31b32441cca54 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 26 Nov 2023 17:39:13 +0100 Subject: [PATCH 089/120] Fix warning --- htdocs/core/class/commonobject.class.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 1d30af00ef5..c065dc00fd5 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -705,6 +705,10 @@ abstract class CommonObject */ public $nb = array(); + /** + * @var int used for the return of show_photos() + */ + public $nbphoto; /** * @var string output @@ -6165,7 +6169,7 @@ abstract class CommonObject $savDisableCompute = $conf->disable_compute; $conf->disable_compute = 1; - $ret = $this->fetch($id); + $ret = $this->fetch($id); /* @phpstan-ignore-line */ $conf->disable_compute = $savDisableCompute; From fb330231cff7a7affd6d66411fa6105beaca573d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 26 Nov 2023 19:19:37 +0100 Subject: [PATCH 090/120] Doc --- build/patch/README | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/build/patch/README b/build/patch/README index 400fbc4f8d1..ec769bd3d71 100644 --- a/build/patch/README +++ b/build/patch/README @@ -3,9 +3,7 @@ README (English) Building a Patch file ################################################## -This directory contains tools to build a patch -after a developer has made changes on files in its -Dolibarr tree. -The output patch file can then be submited on Dolibarr -dev mailing-list, with explanation on its goal, for -inclusion in main branch. +This directory contains tools to build a patch after a developer has made changes on files in its Dolibarr tree. +The output patch file can then be submited on Dolibarr dev mailing-list, with explanation on its goal, for inclusion in main branch. + +Using this tool is now deprecated. You must use git pull requests to submit contributions. From bdcd37e9c990999d4ba022e0e11dc85db0dd789f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 26 Nov 2023 19:21:47 +0100 Subject: [PATCH 091/120] Doc --- dev/initdata/README | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dev/initdata/README b/dev/initdata/README index 97f5f0d3cd7..05a0a164791 100644 --- a/dev/initdata/README +++ b/dev/initdata/README @@ -1,5 +1,7 @@ README ------ -Scripts in this directory can be used to load or purge data of a database instance. +Scripts in this directory can be used to load massive data or purge data of a database instance. WARNING: Some of this script may delete definitely data. + +To init data for a demo, use instead the tool into dev/initdemo From 8561ff789aafb8ce3fa6337fc02dfc61296a1316 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 26 Nov 2023 19:23:07 +0100 Subject: [PATCH 092/120] Doc --- dev/skeletons/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/skeletons/README.md b/dev/skeletons/README.md index f7346350ac0..13e70f5f5da 100644 --- a/dev/skeletons/README.md +++ b/dev/skeletons/README.md @@ -1 +1 @@ -Files and tools were moved into htdocs/modulebuilder/template \ No newline at end of file +Files and tools of a skeleton to build a module were moved into htdocs/modulebuilder/template \ No newline at end of file From 406065f56b42d41c8bd9c1214730e597bc9c7501 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 26 Nov 2023 21:41:17 +0100 Subject: [PATCH 093/120] Debug v19 - Missing title column for description & fix order (#26859) --- htdocs/product/list.php | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index ea7cb04ddd8..66247347f0c 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -10,10 +10,10 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2013 Adolfo segura * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2016 Ferran Marcet - * Copyright (C) 2020-2021 Open-DSI - * Copyright (C) 2022 Charlene Benke - * Copyright (C) 2020-2023 Alexandre Spangaro + * Copyright (C) 2016 Ferran Marcet + * Copyright (C) 2020-2021 Open-DSI + * Copyright (C) 2022 Charlene Benke + * Copyright (C) 2020-2023 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1125,7 +1125,7 @@ if (!empty($arrayfields['p.numbuyprice']['checked'])) { print ' '; print ''; } -// Sell price +// VAT or Sell Tax Rate if (!empty($arrayfields['p.tva_tx']['checked'])) { print '
'; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Barcode if (!empty($arrayfields['p.barcode']['checked'])) { print ''; @@ -1726,17 +1742,6 @@ while ($i < $imaxinloop) { $totalarray['nbfield']++; } } - // Description - if (!empty($arrayfields['p.description']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } // Weight if (!empty($arrayfields['p.weight']['checked'])) { print ''; - if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER) && ($action == 'view' || $action == 'valid' || $action == 'editline' || $action == 'confirm_valid' || $action == 'confirm_cancel')) { + if (getDolGlobalString('MAIN_VIEW_LINE_NUMBER') && ($action == 'view' || $action == 'valid' || $action == 'editline' || $action == 'confirm_valid' || $action == 'confirm_cancel')) { $out .= ''; } $out .= ''; @@ -6499,7 +6499,7 @@ class Form } else { $code_country = "'" . $mysoc->country_code . "'"; // Pour compatibilite ascendente } - if (!empty($conf->global->SERVICE_ARE_ECOMMERCE_200238EC)) { // If option to have vat for end customer for services is on + if (getDolGlobalString('SERVICE_ARE_ECOMMERCE_200238EC')) { // If option to have vat for end customer for services is on require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; if (!isInEEC($societe_vendeuse) && (!is_object($societe_acheteuse) || (isInEEC($societe_acheteuse) && !$societe_acheteuse->isACompany()))) { // We also add the buyer country code @@ -6542,7 +6542,7 @@ class Form // If we fails to find a default vat rate, we take the last one in list // Because they are sorted in ascending order, the last one will be the higher one (we suppose the higher one is the current rate) if ($defaulttx < 0 || dol_strlen($defaulttx) == 0) { - if (empty($conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS)) { + if (!getDolGlobalString('MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS')) { // We take the last one found in list $defaulttx = $this->cache_vatrates[$num - 1]['txtva']; } else { @@ -6564,7 +6564,7 @@ class Form if (is_object($societe_vendeuse) && $societe_vendeuse->id == $mysoc->id && $societe_vendeuse->tva_assuj == "0") { // Override/enable VAT for expense report regardless of global setting - needed if expense report used for business expenses instead // of using supplier invoices (this is a very bad idea !) - if (empty($conf->global->EXPENSEREPORT_OVERRIDE_VAT)) { + if (!getDolGlobalString('EXPENSEREPORT_OVERRIDE_VAT')) { $title = ' title="' . dol_escape_htmltag($langs->trans('VATIsNotUsed')) . '"'; $disabled = true; } @@ -6606,7 +6606,7 @@ class Form $return .= '>'; // Show label of VAT - if ($mysoc->country_code == 'IN' || !empty($conf->global->MAIN_VAT_LABEL_IS_POSITIVE_RATES)) { + if ($mysoc->country_code == 'IN' || getDolGlobalString('MAIN_VAT_LABEL_IS_POSITIVE_RATES')) { // Label with all localtax and code. For example: x.y / a.b / c.d (CODE)' $return .= $rate['labelpositiverates']; } else { @@ -6812,8 +6812,8 @@ class Form // You can set MAIN_POPUP_CALENDAR to 'eldy' or 'jquery' $usecalendar = 'combo'; - if (!empty($conf->use_javascript_ajax) && (empty($conf->global->MAIN_POPUP_CALENDAR) || $conf->global->MAIN_POPUP_CALENDAR != "none")) { - $usecalendar = ((empty($conf->global->MAIN_POPUP_CALENDAR) || getDolGlobalString('MAIN_POPUP_CALENDAR') == 'eldy') ? 'jquery' : $conf->global->MAIN_POPUP_CALENDAR); + if (!empty($conf->use_javascript_ajax) && (!getDolGlobalString('MAIN_POPUP_CALENDAR') || $conf->global->MAIN_POPUP_CALENDAR != "none")) { + $usecalendar = ((!getDolGlobalString('MAIN_POPUP_CALENDAR') || getDolGlobalString('MAIN_POPUP_CALENDAR') == 'eldy') ? 'jquery' : $conf->global->MAIN_POPUP_CALENDAR); } if ($d) { @@ -6872,7 +6872,7 @@ class Form "; } // Note: We don't need monthNames, monthNamesShort, dayNames, dayNamesShort, dayNamesMin, they are set globally on datepicker component in lib_head.js.php - if (empty($conf->global->MAIN_POPUP_CALENDAR_ON_FOCUS)) { + if (!getDolGlobalString('MAIN_POPUP_CALENDAR_ON_FOCUS')) { $retstring .= " showOn: 'button', /* both has problem with autocompletion */ buttonImage: '" . DOL_URL_ROOT . "/theme/" . dol_escape_js($conf->theme) . "/img/object_calendarday.png', @@ -7093,7 +7093,7 @@ class Form } } // If reset_scripts is not empty, print the link with the reset_scripts in the onClick - if ($reset_scripts && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { + if ($reset_scripts && !getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { $retstring .= ' '; @@ -7326,7 +7326,7 @@ class Form // check parameters if (is_null($ajaxoptions)) $ajaxoptions = array(); - if (!empty($conf->use_javascript_ajax) && !empty($conf->global->TICKET_USE_SEARCH_TO_SELECT)) { + if (!empty($conf->use_javascript_ajax) && getDolGlobalString('TICKET_USE_SEARCH_TO_SELECT')) { $placeholder = ''; if ($selected && empty($selected_input_value)) { @@ -7347,7 +7347,7 @@ class Form $out .= img_picto($langs->trans("Search"), 'search'); } } - $out .= 'global->PRODUCT_SEARCH_AUTOFOCUS) ? 'autofocus' : '') . ' />'; + $out .= ''; if ($hidelabel == 3) { $out .= img_picto($langs->trans("Search"), 'search'); } @@ -7397,7 +7397,7 @@ class Form // Add criteria on ref/label if ($filterkey != '') { $sql .= ' AND ('; - $prefix = empty($conf->global->TICKET_DONOTSEARCH_ANYWHERE) ? '%' : ''; // Can use index if PRODUCT_DONOTSEARCH_ANYWHERE is on + $prefix = !getDolGlobalString('TICKET_DONOTSEARCH_ANYWHERE') ? '%' : ''; // Can use index if PRODUCT_DONOTSEARCH_ANYWHERE is on // For natural search $scrit = explode(' ', $filterkey); $i = 0; @@ -7435,7 +7435,7 @@ class Form $textifempty = ''; // Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. //if (!empty($conf->use_javascript_ajax) || $forcecombo) $textifempty=''; - if (!empty($conf->global->TICKET_USE_SEARCH_TO_SELECT)) { + if (getDolGlobalString('TICKET_USE_SEARCH_TO_SELECT')) { if ($showempty && !is_numeric($showempty)) $textifempty = $langs->trans($showempty); else $textifempty .= $langs->trans("All"); } else { @@ -7534,7 +7534,7 @@ class Form // check parameters if (is_null($ajaxoptions)) $ajaxoptions = array(); - if (!empty($conf->use_javascript_ajax) && !empty($conf->global->TICKET_USE_SEARCH_TO_SELECT)) { + if (!empty($conf->use_javascript_ajax) && getDolGlobalString('TICKET_USE_SEARCH_TO_SELECT')) { $placeholder = ''; if ($selected && empty($selected_input_value)) { @@ -7555,7 +7555,7 @@ class Form $out .= img_picto($langs->trans("Search"), 'search'); } } - $out .= 'global->PRODUCT_SEARCH_AUTOFOCUS) ? 'autofocus' : '') . ' />'; + $out .= ''; if ($hidelabel == 3) { $out .= img_picto($langs->trans("Search"), 'search'); } @@ -7604,7 +7604,7 @@ class Form // Add criteria on ref/label if ($filterkey != '') { $sql .= ' AND ('; - $prefix = empty($conf->global->TICKET_DONOTSEARCH_ANYWHERE) ? '%' : ''; // Can use index if PRODUCT_DONOTSEARCH_ANYWHERE is on + $prefix = !getDolGlobalString('TICKET_DONOTSEARCH_ANYWHERE') ? '%' : ''; // Can use index if PRODUCT_DONOTSEARCH_ANYWHERE is on // For natural search $scrit = explode(' ', $filterkey); $i = 0; @@ -7642,7 +7642,7 @@ class Form $textifempty = ''; // Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. //if (!empty($conf->use_javascript_ajax) || $forcecombo) $textifempty=''; - if (!empty($conf->global->PROJECT_USE_SEARCH_TO_SELECT)) { + if (getDolGlobalString('PROJECT_USE_SEARCH_TO_SELECT')) { if ($showempty && !is_numeric($showempty)) $textifempty = $langs->trans($showempty); else $textifempty .= $langs->trans("All"); } else { @@ -7745,7 +7745,7 @@ class Form // check parameters if (is_null($ajaxoptions)) $ajaxoptions = array(); - if (!empty($conf->use_javascript_ajax) && !empty($conf->global->TICKET_USE_SEARCH_TO_SELECT)) { + if (!empty($conf->use_javascript_ajax) && getDolGlobalString('TICKET_USE_SEARCH_TO_SELECT')) { $placeholder = ''; $urloption = ''; @@ -7768,7 +7768,7 @@ class Form $out .= img_picto($langs->trans("Search"), 'search'); } } - $out .= 'global->PRODUCT_SEARCH_AUTOFOCUS) ? 'autofocus' : '') . ' />'; + $out .= ''; if ($hidelabel == 3) { $out .= img_picto($langs->trans("Search"), 'search'); } @@ -7819,7 +7819,7 @@ class Form // Add criteria on ref/label if ($filterkey != '') { $sql .= ' AND ('; - $prefix = empty($conf->global->MEMBER_DONOTSEARCH_ANYWHERE) ? '%' : ''; // Can use index if PRODUCT_DONOTSEARCH_ANYWHERE is on + $prefix = !getDolGlobalString('MEMBER_DONOTSEARCH_ANYWHERE') ? '%' : ''; // Can use index if PRODUCT_DONOTSEARCH_ANYWHERE is on // For natural search $scrit = explode(' ', $filterkey); $i = 0; @@ -7851,7 +7851,7 @@ class Form if (!$forcecombo) { include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; - $out .= ajax_combobox($htmlname, $events, !empty($conf->global->PROJECT_USE_SEARCH_TO_SELECT) ? $conf->global->PROJECT_USE_SEARCH_TO_SELECT : ''); + $out .= ajax_combobox($htmlname, $events, getDolGlobalString('PROJECT_USE_SEARCH_TO_SELECT') ? $conf->global->PROJECT_USE_SEARCH_TO_SELECT : ''); } $out .= '' . "\n"; // Add code for jquery to use multiselect - if (!empty($conf->use_javascript_ajax) && !empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) || defined('REQUIRE_JQUERY_MULTISELECT')) { + if (!empty($conf->use_javascript_ajax) && getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') || defined('REQUIRE_JQUERY_MULTISELECT')) { $out .= "\n" . ''; $out .= "\n" . ''."\n"; -if (!empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY) && !empty($conf->global->BLOCKEDLOG_AUTHORITY_URL)) { +if (getDolGlobalString('BLOCKEDLOG_USE_REMOTE_AUTHORITY') && getDolGlobalString('BLOCKEDLOG_AUTHORITY_URL')) { ?> - load("contracts"); - if (!empty($conf->global->CONTRACT_ADDON)) { + if (getDolGlobalString('CONTRACT_ADDON')) { $mybool = false; $file = getDolGlobalString('CONTRACT_ADDON') . ".php"; @@ -511,7 +511,7 @@ class Contrat extends CommonObject $this->fetch_thirdparty(); // A contract is validated so we can move thirdparty to status customer - if (empty($conf->global->CONTRACT_DISABLE_AUTOSET_AS_CLIENT_ON_CONTRACT_VALIDATION) && $this->thirdparty->fournisseur == 0) { + if (!getDolGlobalString('CONTRACT_DISABLE_AUTOSET_AS_CLIENT_ON_CONTRACT_VALIDATION') && $this->thirdparty->fournisseur == 0) { $result = $this->thirdparty->setAsCustomer(); } @@ -1027,7 +1027,7 @@ class Contrat extends CommonObject $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."contrat"); // Load object modContract - $module = (!empty($conf->global->CONTRACT_ADDON) ? $conf->global->CONTRACT_ADDON : 'mod_contract_serpis'); + $module = (getDolGlobalString('CONTRACT_ADDON') ? $conf->global->CONTRACT_ADDON : 'mod_contract_serpis'); if (substr($module, 0, 13) == 'mod_contract_' && substr($module, -3) == 'php') { $module = substr($module, 0, dol_strlen($module) - 4); } @@ -1097,7 +1097,7 @@ class Contrat extends CommonObject } } - if (!$error && $this->id && !empty($conf->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN) && !empty($this->origin) && !empty($this->origin_id)) { // Get contact from origin object + if (!$error && $this->id && getDolGlobalString('MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN') && !empty($this->origin) && !empty($this->origin_id)) { // Get contact from origin object $originforcontact = $this->origin; $originidforcontact = $this->origin_id; if ($originforcontact == 'shipping') { // shipment and order share the same contacts. If creating from shipment we take data of order @@ -2041,7 +2041,7 @@ class Contrat extends CommonObject $datas = []; $nofetch = !empty($params['nofetch']); - if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { + if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { return ['optimize' => $langs->trans("ShowContract")]; } if ($user->hasRight('contrat', 'lire')) { @@ -2127,7 +2127,7 @@ class Contrat extends CommonObject $linkclose = ''; if (empty($notooltip) && $user->hasRight('contrat', 'lire')) { - if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { + if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { $label = $langs->trans("ShowContract"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } @@ -2552,7 +2552,7 @@ class Contrat extends CommonObject if (!empty($this->model_pdf)) { $modele = $this->model_pdf; - } elseif (!empty($conf->global->CONTRACT_ADDON_PDF)) { + } elseif (getDolGlobalString('CONTRACT_ADDON_PDF')) { $modele = $conf->global->CONTRACT_ADDON_PDF; } } @@ -2645,7 +2645,7 @@ class Contrat extends CommonObject } } - if (empty($conf->global->CONTRACT_ADDON) || !is_readable(DOL_DOCUMENT_ROOT."/core/modules/contract/" . getDolGlobalString('CONTRACT_ADDON').".php")) { + if (!getDolGlobalString('CONTRACT_ADDON') || !is_readable(DOL_DOCUMENT_ROOT."/core/modules/contract/" . getDolGlobalString('CONTRACT_ADDON').".php")) { $this->error = 'ErrorSetupNotComplete'; dol_syslog($this->error); return -1; @@ -3558,7 +3558,7 @@ class ContratLigne extends CommonObjectLine } // If we change a planned date (start or end) of one contract line, sync dates for all other services too - if (!$error && !empty($conf->global->CONTRACT_SYNC_PLANNED_DATE_OF_SERVICES)) { + if (!$error && getDolGlobalString('CONTRACT_SYNC_PLANNED_DATE_OF_SERVICES')) { dol_syslog(get_class($this)."::update CONTRACT_SYNC_PLANNED_DATE_OF_SERVICES is on so we update date for all lines", LOG_DEBUG); if ($this->date_start != $this->oldcopy->date_start) { diff --git a/htdocs/contrat/document.php b/htdocs/contrat/document.php index 94c7b2aae24..6db81b65643 100644 --- a/htdocs/contrat/document.php +++ b/htdocs/contrat/document.php @@ -144,7 +144,7 @@ if ($object->id) { $morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1, 'getFormatedSupplierRef'); // Thirdparty $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); - if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) { + if (!getDolGlobalString('MAIN_DISABLE_OTHER_LINK') && $object->thirdparty->id > 0) { $morehtmlref .= ' ('.$langs->trans("OtherContracts").')'; } // Project diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 15c8b422233..99e6daa9298 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -84,7 +84,7 @@ $search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_en $searchCategoryCustomerOperator = 0; if (GETPOSTISSET('formfilteraction')) { $searchCategoryCustomerOperator = GETPOST('search_category_customer_operator', 'int'); -} elseif (!empty($conf->global->MAIN_SEARCH_CAT_OR_BY_DEFAULT)) { +} elseif (getDolGlobalString('MAIN_SEARCH_CAT_OR_BY_DEFAULT')) { $searchCategoryCustomerOperator = $conf->global->MAIN_SEARCH_CAT_OR_BY_DEFAULT; } $searchCategoryCustomerList = GETPOST('search_category_customer_list', 'array'); @@ -569,7 +569,7 @@ if (!$resql) { $num = $db->num_rows($resql); // Direct jump if only one record found -if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) { +if ($num == 1 && getDolGlobalString('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) { $obj = $db->fetch_object($resql); $id = $obj->rowid; header("Location: ".DOL_URL_ROOT.'/contrat/card.php?id='.$id); @@ -807,7 +807,7 @@ if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire') && ($user- $moreforfilter .= ''; } // Filter on customer categories -if (!empty($conf->global->MAIN_SEARCH_CATEGORY_CUSTOMER_ON_CONTRACT_LIST) && isModEnabled("categorie") && $user->hasRight('categorie', 'lire')) { +if (getDolGlobalString('MAIN_SEARCH_CATEGORY_CUSTOMER_ON_CONTRACT_LIST') && isModEnabled("categorie") && $user->hasRight('categorie', 'lire')) { $moreforfilter .= '
'; $tmptitle = $langs->transnoentities('CustomersProspectsCategoriesShort'); $moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"'); @@ -900,7 +900,7 @@ if (!empty($arrayfields['country.code_iso']['checked'])) { // Company type if (!empty($arrayfields['typent.code']['checked'])) { print '
'; } if (!empty($arrayfields['sale_representative']['checked'])) { diff --git a/htdocs/contrat/services_list.php b/htdocs/contrat/services_list.php index 18d028c4bb8..efad36e60a7 100644 --- a/htdocs/contrat/services_list.php +++ b/htdocs/contrat/services_list.php @@ -855,7 +855,7 @@ while ($i < $imaxinloop) { if ($obj->pid > 0) { print $productstatic->getNomUrl(1, '', 24); print $obj->label ? ' - '.dol_trunc($obj->label, 16) : ''; - if (!empty($obj->description) && !empty($conf->global->PRODUCT_DESC_IN_LIST)) { + if (!empty($obj->description) && getDolGlobalString('PRODUCT_DESC_IN_LIST')) { print '
'.dol_nl2br($obj->description).''; } } else { diff --git a/htdocs/contrat/tpl/linkedobjectblock.tpl.php b/htdocs/contrat/tpl/linkedobjectblock.tpl.php index 431bb965872..e0b491f1262 100644 --- a/htdocs/contrat/tpl/linkedobjectblock.tpl.php +++ b/htdocs/contrat/tpl/linkedobjectblock.tpl.php @@ -53,7 +53,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) { // Price of contract is not shown by default because a contract is a list of service with // start and end date that change with time andd that may be different that the period of reference for price. // So price of a contract does often means nothing. Prices is on the different invoices done on same contract. - if ($user->hasRight('contrat', 'lire') && empty($conf->global->CONTRACT_SHOW_TOTAL_OF_PRODUCT_AS_PRICE)) { + if ($user->hasRight('contrat', 'lire') && !getDolGlobalString('CONTRACT_SHOW_TOTAL_OF_PRODUCT_AS_PRICE')) { $totalcontrat = 0; foreach ($objectlink->lines as $linecontrat) { $totalcontrat = $totalcontrat + $linecontrat->total_ht; diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php index 5d74bbaafbf..ba62254a595 100644 --- a/htdocs/core/actions_addupdatedelete.inc.php +++ b/htdocs/core/actions_addupdatedelete.inc.php @@ -140,7 +140,7 @@ if ($action == 'add' && !empty($permissiontoadd)) { } // Validation of fields values - if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 1 || !empty($conf->global->MAIN_ACTIVATE_VALIDATION_RESULT)) { + if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 1 || getDolGlobalString('MAIN_ACTIVATE_VALIDATION_RESULT')) { if (!$error && !empty($val['validate']) && is_callable(array($object, 'validateField'))) { if (!$object->validateField($object->fields, $key, $value)) { $error++; @@ -280,7 +280,7 @@ if ($action == 'update' && !empty($permissiontoadd)) { } // Validation of fields values - if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 1 || !empty($conf->global->MAIN_ACTIVATE_VALIDATION_RESULT)) { + if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 1 || getDolGlobalString('MAIN_ACTIVATE_VALIDATION_RESULT')) { if (!$error && !empty($val['validate']) && is_callable(array($object, 'validateField'))) { if (!$object->validateField($object->fields, $key, $value)) { $error++; @@ -441,7 +441,7 @@ if ($action == 'confirm_deleteline' && $confirm == 'yes' && !empty($permissionto $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); } - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { + if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) { if (method_exists($object, 'generateDocument')) { $ret = $object->fetch($object->id); // Reload to get new records $object->generateDocument($object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref); @@ -472,7 +472,7 @@ if ($action == 'confirm_validate' && $confirm == 'yes' && $permissiontoadd) { if ($result >= 0) { // Define output language - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { + if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) { if (method_exists($object, 'generateDocument')) { $outputlangs = $langs; $newlang = ''; @@ -509,7 +509,7 @@ if ($action == 'confirm_close' && $confirm == 'yes' && $permissiontoadd) { $result = $object->cancel($user); if ($result >= 0) { // Define output language - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { + if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) { if (method_exists($object, 'generateDocument')) { $outputlangs = $langs; $newlang = ''; @@ -553,7 +553,7 @@ if ($action == 'confirm_reopen' && $confirm == 'yes' && $permissiontoadd) { $result = $object->reopen($user); if ($result >= 0) { // Define output language - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { + if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) { if (method_exists($object, 'generateDocument')) { $outputlangs = $langs; $newlang = ''; diff --git a/htdocs/core/actions_dellink.inc.php b/htdocs/core/actions_dellink.inc.php index 4db2c64206a..9add235168e 100644 --- a/htdocs/core/actions_dellink.inc.php +++ b/htdocs/core/actions_dellink.inc.php @@ -40,7 +40,7 @@ if ($action == 'addlink' && !empty($permissiondellink) && !$cancellink && $id > } // Link by reference -if ($action == 'addlinkbyref' && !empty($permissiondellink) && !$cancellink && $id > 0 && !empty($addlinkref) && !empty($conf->global->MAIN_LINK_BY_REF_IN_LINKTO)) { +if ($action == 'addlinkbyref' && !empty($permissiondellink) && !$cancellink && $id > 0 && !empty($addlinkref) && getDolGlobalString('MAIN_LINK_BY_REF_IN_LINKTO')) { $element_prop = getElementProperties($addlink); if (is_array($element_prop)) { dol_include_once('/' . $element_prop['classpath'] . '/' . $element_prop['classfile'] . '.class.php'); diff --git a/htdocs/core/actions_extrafields.inc.php b/htdocs/core/actions_extrafields.inc.php index ca7eda53ede..3746b84b1c1 100644 --- a/htdocs/core/actions_extrafields.inc.php +++ b/htdocs/core/actions_extrafields.inc.php @@ -317,7 +317,7 @@ if ($action == 'update') { } if (!$error) { - if (strlen(GETPOST('attrname', 'aZ09')) < 3 && empty($conf->global->MAIN_DISABLE_EXTRAFIELDS_CHECK_FOR_UPDATE)) { + if (strlen(GETPOST('attrname', 'aZ09')) < 3 && !getDolGlobalString('MAIN_DISABLE_EXTRAFIELDS_CHECK_FOR_UPDATE')) { $error++; $langs->load("errors"); $mesg[] = $langs->trans("ErrorValueLength", $langs->transnoentitiesnoconv("AttributeCode"), 3); @@ -327,7 +327,7 @@ if ($action == 'update') { // Check reserved keyword with more than 3 characters if (!$error) { - if (in_array(strtoupper(GETPOST('attrname', 'aZ09')), $listofreservedwords) && empty($conf->global->MAIN_DISABLE_EXTRAFIELDS_CHECK_FOR_UPDATE)) { + if (in_array(strtoupper(GETPOST('attrname', 'aZ09')), $listofreservedwords) && !getDolGlobalString('MAIN_DISABLE_EXTRAFIELDS_CHECK_FOR_UPDATE')) { $error++; $langs->load("errors"); $mesg[] = $langs->trans("ErrorReservedKeyword", GETPOST('attrname', 'aZ09')); diff --git a/htdocs/core/actions_lineupdown.inc.php b/htdocs/core/actions_lineupdown.inc.php index e43b0216cbe..5b168d6e780 100644 --- a/htdocs/core/actions_lineupdown.inc.php +++ b/htdocs/core/actions_lineupdown.inc.php @@ -45,7 +45,7 @@ if ($action == 'up' && $permissiontoedit) { $outputlangs->setDefaultLang($newlang); } - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { + if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) { $object->generateDocument($object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref); } @@ -69,7 +69,7 @@ if ($action == 'down' && $permissiontoedit) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); } - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { + if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) { $object->generateDocument($object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref); } diff --git a/htdocs/core/actions_linkedfiles.inc.php b/htdocs/core/actions_linkedfiles.inc.php index 7561d1e795b..8e2e48eef8e 100644 --- a/htdocs/core/actions_linkedfiles.inc.php +++ b/htdocs/core/actions_linkedfiles.inc.php @@ -48,7 +48,7 @@ if ((GETPOST('sendit', 'alpha') // Submit file/link -if (GETPOST('sendit', 'alpha') && !empty($conf->global->MAIN_UPLOAD_DOC) && !empty($permissiontoadd)) { +if (GETPOST('sendit', 'alpha') && getDolGlobalString('MAIN_UPLOAD_DOC') && !empty($permissiontoadd)) { if (!empty($_FILES) && is_array($_FILES['userfile'])) { if (is_array($_FILES['userfile']['tmp_name'])) { $userfiles = $_FILES['userfile']['tmp_name']; @@ -86,7 +86,7 @@ if (GETPOST('sendit', 'alpha') && !empty($conf->global->MAIN_UPLOAD_DOC) && !emp } } } -} elseif (GETPOST('linkit', 'restricthtml') && !empty($conf->global->MAIN_UPLOAD_DOC) && !empty($permissiontoadd)) { +} elseif (GETPOST('linkit', 'restricthtml') && getDolGlobalString('MAIN_UPLOAD_DOC') && !empty($permissiontoadd)) { $link = GETPOST('link', 'alpha'); if ($link) { if (substr($link, 0, 7) != 'http://' && substr($link, 0, 8) != 'https://' && substr($link, 0, 7) != 'file://' && substr($link, 0, 7) != 'davs://') { @@ -239,7 +239,7 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes' && !empty($permissionto // Security: // Disallow file with some extensions. We rename them. // Because if we put the documents directory into a directory inside web root (very bad), this allows to execute on demand arbitrary code. - if (isAFileWithExecutableContent($filenameto) && empty($conf->global->MAIN_DOCUMENT_IS_OUTSIDE_WEBROOT_SO_NOEXE_NOT_REQUIRED)) { + if (isAFileWithExecutableContent($filenameto) && !getDolGlobalString('MAIN_DOCUMENT_IS_OUTSIDE_WEBROOT_SO_NOEXE_NOT_REQUIRED')) { // $upload_dir ends with a slash, so be must be sure the medias dir to compare to ends with slash too. $publicmediasdirwithslash = $conf->medias->multidir_output[$conf->entity]; if (!preg_match('/\/$/', $publicmediasdirwithslash)) { diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index edb9643508d..9ccde508286 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -58,7 +58,7 @@ if (!empty($permtodelete) && empty($permissiontodelete)) { } // Mass actions. Controls on number of lines checked. -$maxformassaction = (empty($conf->global->MAIN_LIMIT_FOR_MASS_ACTIONS) ? 1000 : $conf->global->MAIN_LIMIT_FOR_MASS_ACTIONS); +$maxformassaction = (!getDolGlobalString('MAIN_LIMIT_FOR_MASS_ACTIONS') ? 1000 : $conf->global->MAIN_LIMIT_FOR_MASS_ACTIONS); if ($massaction && is_array($toselect) && count($toselect) < 1) { $error++; setEventMessages($langs->trans("NoRecordSelected"), null, "warnings"); @@ -356,7 +356,7 @@ if (!$error && $massaction == 'confirm_presend') { 'name' => $filename, 'path' => $filepath, ); - if (!empty($conf->global->MAIL_MASS_ACTION_ADD_LAST_IF_MAIN_DOC_NOT_FOUND) && !empty($objectobj->last_main_doc)) { + if (getDolGlobalString('MAIL_MASS_ACTION_ADD_LAST_IF_MAIN_DOC_NOT_FOUND') && !empty($objectobj->last_main_doc)) { $file_check_list[] = array( 'name' => basename($objectobj->last_main_doc), 'path' => DOL_DATA_ROOT . '/' . $objectobj->last_main_doc, @@ -429,25 +429,25 @@ if (!$error && $massaction == 'confirm_presend') { $sendtobcc = GETPOST('sendtoccc'); if ($objectclass == 'Propal') { - $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO) ? '' : (($sendtobcc ? ", " : "") . getDolGlobalString('MAIN_MAIL_AUTOCOPY_PROPOSAL_TO'))); + $sendtobcc .= (!getDolGlobalString('MAIN_MAIL_AUTOCOPY_PROPOSAL_TO') ? '' : (($sendtobcc ? ", " : "") . getDolGlobalString('MAIN_MAIL_AUTOCOPY_PROPOSAL_TO'))); } if ($objectclass == 'Commande') { - $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO) ? '' : (($sendtobcc ? ", " : "") . getDolGlobalString('MAIN_MAIL_AUTOCOPY_ORDER_TO'))); + $sendtobcc .= (!getDolGlobalString('MAIN_MAIL_AUTOCOPY_ORDER_TO') ? '' : (($sendtobcc ? ", " : "") . getDolGlobalString('MAIN_MAIL_AUTOCOPY_ORDER_TO'))); } if ($objectclass == 'Facture') { - $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO) ? '' : (($sendtobcc ? ", " : "") . getDolGlobalString('MAIN_MAIL_AUTOCOPY_INVOICE_TO'))); + $sendtobcc .= (!getDolGlobalString('MAIN_MAIL_AUTOCOPY_INVOICE_TO') ? '' : (($sendtobcc ? ", " : "") . getDolGlobalString('MAIN_MAIL_AUTOCOPY_INVOICE_TO'))); } if ($objectclass == 'SupplierProposal') { - $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO) ? '' : (($sendtobcc ? ", " : "") . getDolGlobalString('MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO'))); + $sendtobcc .= (!getDolGlobalString('MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO') ? '' : (($sendtobcc ? ", " : "") . getDolGlobalString('MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO'))); } if ($objectclass == 'CommandeFournisseur') { - $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO) ? '' : (($sendtobcc ? ", " : "") . getDolGlobalString('MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO'))); + $sendtobcc .= (!getDolGlobalString('MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO') ? '' : (($sendtobcc ? ", " : "") . getDolGlobalString('MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO'))); } if ($objectclass == 'FactureFournisseur') { - $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO) ? '' : (($sendtobcc ? ", " : "") . getDolGlobalString('MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO'))); + $sendtobcc .= (!getDolGlobalString('MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO') ? '' : (($sendtobcc ? ", " : "") . getDolGlobalString('MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO'))); } if ($objectclass == 'Project') { - $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_PROJECT_TO) ? '' : (($sendtobcc ? ", " : "") . getDolGlobalString('MAIN_MAIL_AUTOCOPY_PROJECT_TO'))); + $sendtobcc .= (!getDolGlobalString('MAIN_MAIL_AUTOCOPY_PROJECT_TO') ? '' : (($sendtobcc ? ", " : "") . getDolGlobalString('MAIN_MAIL_AUTOCOPY_PROJECT_TO'))); } // $listofqualifiedobj is array with key = object id and value is instance of qualified objects, for the current thirdparty (but thirdparty property is not loaded yet) @@ -602,7 +602,7 @@ if (!$error && $massaction == 'confirm_presend') { $objectobj2->actionmsg2 = $actionmsg2; // Short text $objectobj2->fk_element = $objid2; $objectobj2->elementtype = $objectobj2->element; - if (!empty($conf->global->MAIN_MAIL_REPLACE_EVENT_TITLE_BY_EMAIL_SUBJECT)) { + if (getDolGlobalString('MAIN_MAIL_REPLACE_EVENT_TITLE_BY_EMAIL_SUBJECT')) { $objectobj2->actionmsg2 = $subjectreplaced; // Short text } @@ -656,7 +656,7 @@ if (!$error && $massaction == 'confirm_presend') { if ($mailfile->error) { $resaction .= $langs->trans('ErrorFailedToSendMail', $from, $sendto); $resaction .= '
'.$mailfile->error.'
'; - } elseif (!empty($conf->global->MAIN_DISABLE_ALL_MAILS)) { + } elseif (getDolGlobalString('MAIN_DISABLE_ALL_MAILS')) { $resaction .= '
No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS
'; } else { $resaction .= $langs->trans('ErrorFailedToSendMail', $from, $sendto) . '
(unhandled error)
'; @@ -792,7 +792,7 @@ if (!$error && $massaction == "builddoc" && $permissiontoread && !GETPOST('butto $outputlangs->setDefaultLang($newlang); } - if (!empty($conf->global->USE_PDFTK_FOR_PDF_CONCAT)) { + if (getDolGlobalString('USE_PDFTK_FOR_PDF_CONCAT')) { // Create output dir if not exists dol_mkdir($diroutputmassaction); @@ -926,18 +926,18 @@ if ($action == 'remove_file') { if (!$error && $massaction == 'validate' && $permissiontoadd) { $objecttmp = new $objectclass($db); - if (($objecttmp->element == 'facture' || $objecttmp->element == 'invoice') && isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_BILL)) { + if (($objecttmp->element == 'facture' || $objecttmp->element == 'invoice') && isModEnabled('stock') && getDolGlobalString('STOCK_CALCULATE_ON_BILL')) { $langs->load("errors"); setEventMessages($langs->trans('ErrorMassValidationNotAllowedWhenStockIncreaseOnAction'), null, 'errors'); $error++; } - if ($objecttmp->element == 'invoice_supplier' && isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL)) { + if ($objecttmp->element == 'invoice_supplier' && isModEnabled('stock') && getDolGlobalString('STOCK_CALCULATE_ON_SUPPLIER_BILL')) { $langs->load("errors"); setEventMessages($langs->trans('ErrorMassValidationNotAllowedWhenStockIncreaseOnAction'), null, 'errors'); $error++; } if ($objecttmp->element == 'facture') { - if (!empty($toselect) && !empty($conf->global->INVOICE_CHECK_POSTERIOR_DATE)) { + if (!empty($toselect) && getDolGlobalString('INVOICE_CHECK_POSTERIOR_DATE')) { // order $toselect by date $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture"; $sql .= " WHERE rowid IN (".$db->sanitize(implode(",", $toselect)).")"; @@ -983,7 +983,7 @@ if (!$error && $massaction == 'validate' && $permissiontoadd) { } else { // validate() rename pdf but do not regenerate // Define output language - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { + if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) { $outputlangs = $langs; $newlang = ''; if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && GETPOST('lang_id', 'aZ09')) { @@ -1005,9 +1005,9 @@ if (!$error && $massaction == 'validate' && $permissiontoadd) { $model = $objecttmp->model_pdf; $ret = $objecttmp->fetch($objecttmp->id); // Reload to get new records // To be sure vars is defined - $hidedetails = !empty($hidedetails) ? $hidedetails : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0); - $hidedesc = !empty($hidedesc) ? $hidedesc : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0); - $hideref = !empty($hideref) ? $hideref : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0); + $hidedetails = !empty($hidedetails) ? $hidedetails : (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS') ? 1 : 0); + $hidedesc = !empty($hidedesc) ? $hidedesc : (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_HIDE_DESC') ? 1 : 0); + $hideref = !empty($hideref) ? $hideref : (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_HIDE_REF') ? 1 : 0); $moreparams = !empty($moreparams) ? $moreparams : null; $result = $objecttmp->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); @@ -1054,7 +1054,7 @@ if (!$error && ($massaction == 'delete' || ($action == 'delete' && $confirm == ' $result = $objecttmp->fetch($toselectid); if ($result > 0) { // Refuse deletion for some objects/status - if ($objectclass == 'Facture' && empty($conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED) && $objecttmp->status != Facture::STATUS_DRAFT) { + if ($objectclass == 'Facture' && !getDolGlobalString('INVOICE_CAN_ALWAYS_BE_REMOVED') && $objecttmp->status != Facture::STATUS_DRAFT) { $langs->load("errors"); $nbignored++; $TMsg[] = '
'.$langs->trans('ErrorOnlyDraftStatusCanBeDeletedInMassAction', $objecttmp->ref).'

'; @@ -1165,13 +1165,13 @@ if (!$error && $massaction == 'generate_doc' && $permissiontoread) { // To be sure vars is defined if (empty($hidedetails)) { - $hidedetails = (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0); + $hidedetails = (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS') ? 1 : 0); } if (empty($hidedesc)) { - $hidedesc = (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0); + $hidedesc = (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_HIDE_DESC') ? 1 : 0); } if (empty($hideref)) { - $hideref = (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0); + $hideref = (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_HIDE_REF') ? 1 : 0); } if (empty($moreparams)) { $moreparams = null; @@ -1623,7 +1623,7 @@ if (!$error && ($massaction == 'approveleave' || ($action == 'approveleave' && $ // Subject $societeName = $conf->global->MAIN_INFO_SOCIETE_NOM; - if (!empty($conf->global->MAIN_APPLICATION_TITLE)) { + if (getDolGlobalString('MAIN_APPLICATION_TITLE')) { $societeName = $conf->global->MAIN_APPLICATION_TITLE; } @@ -1741,8 +1741,8 @@ if (!$error && ($massaction == 'clonetasks' || ($action == 'clonetasks' && $conf $origin_task->fetch($task, $ref = '', $loadparentdata = 0); $defaultref = ''; - $obj = empty($conf->global->PROJECT_TASK_ADDON) ? 'mod_task_simple' : $conf->global->PROJECT_TASK_ADDON; - if (!empty($conf->global->PROJECT_TASK_ADDON) && is_readable(DOL_DOCUMENT_ROOT . "/core/modules/project/task/" . getDolGlobalString('PROJECT_TASK_ADDON') . ".php")) { + $obj = !getDolGlobalString('PROJECT_TASK_ADDON') ? 'mod_task_simple' : $conf->global->PROJECT_TASK_ADDON; + if (getDolGlobalString('PROJECT_TASK_ADDON') && is_readable(DOL_DOCUMENT_ROOT . "/core/modules/project/task/" . getDolGlobalString('PROJECT_TASK_ADDON') . ".php")) { require_once DOL_DOCUMENT_ROOT . "/core/modules/project/task/" . getDolGlobalString('PROJECT_TASK_ADDON') . '.php'; $modTask = new $obj; $defaultref = $modTask->getNextValue(0, $clone_task); diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php index 4b2de3b6262..b05e13d76eb 100644 --- a/htdocs/core/actions_sendmails.inc.php +++ b/htdocs/core/actions_sendmails.inc.php @@ -210,7 +210,7 @@ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPO } } - if (!empty($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT)) { + if (getDolGlobalString('MAIN_MAIL_ENABLED_USER_DEST_SELECT')) { $receiveruser = GETPOST('receiveruser', 'alphawithlgt'); if (is_array($receiveruser) && count($receiveruser) > 0) { $fuserdest = new User($db); @@ -251,7 +251,7 @@ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPO } } } - if (!empty($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT)) { + if (getDolGlobalString('MAIN_MAIL_ENABLED_USER_DEST_SELECT')) { $receiverccuser = GETPOST('receiverccuser', 'alphawithlgt'); if (is_array($receiverccuser) && count($receiverccuser) > 0) { @@ -390,7 +390,7 @@ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPO $object->actiontypecode = $actiontypecode; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...) $object->actionmsg = $message; // Long text $object->actionmsg2 = $actionmsg2; // Short text ($langs->transnoentities('MailSentBy')...); - if (!empty($conf->global->MAIN_MAIL_REPLACE_EVENT_TITLE_BY_EMAIL_SUBJECT)) { + if (getDolGlobalString('MAIN_MAIL_REPLACE_EVENT_TITLE_BY_EMAIL_SUBJECT')) { $object->actionmsg2 = $subject; // Short text } @@ -400,7 +400,7 @@ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPO if (is_array($attachedfiles) && count($attachedfiles) > 0) { $object->attachedfiles = $attachedfiles; } - if (is_array($sendtouserid) && count($sendtouserid) > 0 && !empty($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT)) { + if (is_array($sendtouserid) && count($sendtouserid) > 0 && getDolGlobalString('MAIN_MAIL_ENABLED_USER_DEST_SELECT')) { $object->sendtouserid = $sendtouserid; } @@ -452,7 +452,7 @@ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPO } } else { $mesg .= $langs->transnoentities('ErrorFailedToSendMail', dol_escape_htmltag($from), dol_escape_htmltag($sendto)); - if (!empty($conf->global->MAIN_DISABLE_ALL_MAILS)) { + if (getDolGlobalString('MAIN_DISABLE_ALL_MAILS')) { $mesg .= '
Feature is disabled by option MAIN_DISABLE_ALL_MAILS'; } else { $mesg .= '
Unkown Error, please refers to your administrator'; diff --git a/htdocs/core/actions_setnotes.inc.php b/htdocs/core/actions_setnotes.inc.php index 6ce9d3b08b3..b247c1c2cc5 100644 --- a/htdocs/core/actions_setnotes.inc.php +++ b/htdocs/core/actions_setnotes.inc.php @@ -42,7 +42,7 @@ if ($action == 'setnote_public' && !empty($permissionnote) && !GETPOST('cancel', setEventMessages($object->error, $object->errors, 'errors'); } elseif (in_array($object->table_element, array('supplier_proposal', 'propal', 'commande_fournisseur', 'commande', 'facture_fourn', 'facture'))) { // Define output language - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { + if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) { $outputlangs = $langs; $newlang = ''; if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && GETPOST('lang_id', 'aZ09')) { @@ -56,9 +56,9 @@ if ($action == 'setnote_public' && !empty($permissionnote) && !GETPOST('cancel', $outputlangs->setDefaultLang($newlang); } $model = $object->model_pdf; - $hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0)); - $hidedesc = (GETPOST('hidedesc', 'int') ? GETPOST('hidedesc', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0)); - $hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0)); + $hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS') ? 1 : 0)); + $hidedesc = (GETPOST('hidedesc', 'int') ? GETPOST('hidedesc', 'int') : (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_HIDE_DESC') ? 1 : 0)); + $hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_HIDE_REF') ? 1 : 0)); //see #21072: Update a public note with a "document model not found" is not really a problem : the PDF is not created/updated //but the note is saved, so just add a notification will be enought diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php index b5f772212b9..9344ed8ba15 100644 --- a/htdocs/core/ajax/ajaxdirpreview.php +++ b/htdocs/core/ajax/ajaxdirpreview.php @@ -402,7 +402,7 @@ if (!empty($conf->dol_use_jmobile)) { if (empty($conf->use_javascript_ajax)) { $useajax = 0; } -if (!empty($conf->global->MAIN_ECM_DISABLE_JS)) { +if (getDolGlobalString('MAIN_ECM_DISABLE_JS')) { $useajax = 0; } diff --git a/htdocs/core/ajax/ajaxdirtree.php b/htdocs/core/ajax/ajaxdirtree.php index 5c281eff5ca..7e0126014b6 100644 --- a/htdocs/core/ajax/ajaxdirtree.php +++ b/htdocs/core/ajax/ajaxdirtree.php @@ -148,7 +148,7 @@ foreach ($sqltree as $keycursor => $val) { } } -if (!empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) { +if (!empty($conf->use_javascript_ajax) && !getDolGlobalString('MAIN_ECM_DISABLE_JS')) { treeOutputForAbsoluteDir($sqltree, $selecteddir, $fullpathselecteddir, $modulepart, $websitekey, $pageid, $preopened, $fullpathpreopened); // TODO Find a solution to not output this code for each leaf we open @@ -175,7 +175,7 @@ if (!empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_ } -if (empty($conf->use_javascript_ajax) || !empty($conf->global->MAIN_ECM_DISABLE_JS)) { +if (empty($conf->use_javascript_ajax) || getDolGlobalString('MAIN_ECM_DISABLE_JS')) { print '
    '; // Load full manual tree from database. We will use it to define nbofsubdir and nboffilesinsubdir diff --git a/htdocs/core/ajax/locationincoterms.php b/htdocs/core/ajax/locationincoterms.php index f3e621abc85..fde07a627cf 100644 --- a/htdocs/core/ajax/locationincoterms.php +++ b/htdocs/core/ajax/locationincoterms.php @@ -63,7 +63,7 @@ top_httphead(); //print ''."\n"; -dol_syslog('location_incoterms call with MAIN_USE_LOCATION_INCOTERMS_DICTIONNARY='.(empty($conf->global->MAIN_USE_LOCATION_INCOTERMS_DICTIONNARY) ? '' : $conf->global->MAIN_USE_LOCATION_INCOTERMS_DICTIONNARY)); +dol_syslog('location_incoterms call with MAIN_USE_LOCATION_INCOTERMS_DICTIONNARY='.(!getDolGlobalString('MAIN_USE_LOCATION_INCOTERMS_DICTIONNARY') ? '' : $conf->global->MAIN_USE_LOCATION_INCOTERMS_DICTIONNARY)); //var_dump($_GET); // Generation of list of zip-town @@ -73,7 +73,7 @@ if (GETPOST('location_incoterms')) { // Define filter on text typed $location_incoterms = GETPOST('location_incoterms'); - if (!empty($conf->global->MAIN_USE_LOCATION_INCOTERMS_DICTIONNARY)) { // Use location_incoterms + if (getDolGlobalString('MAIN_USE_LOCATION_INCOTERMS_DICTIONNARY')) { // Use location_incoterms $sql = "SELECT z.location as location_incoterms, z.label as label"; $sql .= " FROM ".MAIN_DB_PREFIX."c_location_incoterms as z"; $sql .= " WHERE z.active = 1 AND z.location LIKE '%".$db->escape($db->escapeforlike($location_incoterms))."%'"; diff --git a/htdocs/core/ajax/selectsearchbox.php b/htdocs/core/ajax/selectsearchbox.php index ecc9ed4908e..6e7bba1e5de 100644 --- a/htdocs/core/ajax/selectsearchbox.php +++ b/htdocs/core/ajax/selectsearchbox.php @@ -69,19 +69,19 @@ $arrayresult = array(); // Define $searchform -if (isModEnabled('adherent') && empty($conf->global->MAIN_SEARCHFORM_ADHERENT_DISABLED) && $user->hasRight('adherent', 'lire')) { +if (isModEnabled('adherent') && !getDolGlobalString('MAIN_SEARCHFORM_ADHERENT_DISABLED') && $user->hasRight('adherent', 'lire')) { $arrayresult['searchintomember'] = array('position'=>8, 'shortcut'=>'M', 'img'=>'object_member', 'label'=>$langs->trans("SearchIntoMembers", $search_boxvalue), 'text'=>img_picto('', 'object_member', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoMembers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/adherents/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); } -if (((isModEnabled('societe') && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || isModEnabled('supplier_order') || isModEnabled('supplier_invoice') || isModEnabled('supplier_proposal')) && empty($conf->global->MAIN_SEARCHFORM_SOCIETE_DISABLED) && $user->hasRight('societe', 'lire')) { +if (((isModEnabled('societe') && (!getDolGlobalString('SOCIETE_DISABLE_PROSPECTS') || !getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS'))) || isModEnabled('supplier_order') || isModEnabled('supplier_invoice') || isModEnabled('supplier_proposal')) && !getDolGlobalString('MAIN_SEARCHFORM_SOCIETE_DISABLED') && $user->hasRight('societe', 'lire')) { $arrayresult['searchintothirdparty'] = array('position'=>10, 'shortcut'=>'T', 'img'=>'object_company', 'label'=>$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'text'=>img_picto('', 'object_company', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/societe/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); } -if (isModEnabled('societe') && empty($conf->global->MAIN_SEARCHFORM_CONTACT_DISABLED) && $user->hasRight('societe', 'lire')) { +if (isModEnabled('societe') && !getDolGlobalString('MAIN_SEARCHFORM_CONTACT_DISABLED') && $user->hasRight('societe', 'lire')) { $arrayresult['searchintocontact'] = array('position'=>15, 'shortcut'=>'A', 'img'=>'object_contact', 'label'=>$langs->trans("SearchIntoContacts", $search_boxvalue), 'text'=>img_picto('', 'object_contact', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoContacts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contact/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); } -if (((isModEnabled('product') && $user->hasRight('product', 'read')) || (isModEnabled('service') && $user->hasRight('service', 'read'))) && empty($conf->global->MAIN_SEARCHFORM_PRODUITSERVICE_DISABLED)) { +if (((isModEnabled('product') && $user->hasRight('product', 'read')) || (isModEnabled('service') && $user->hasRight('service', 'read'))) && !getDolGlobalString('MAIN_SEARCHFORM_PRODUITSERVICE_DISABLED')) { $arrayresult['searchintoproduct'] = array('position'=>30, 'shortcut'=>'P', 'img'=>'object_product', 'label'=>$langs->trans("SearchIntoProductsOrServices", $search_boxvalue), 'text'=>img_picto('', 'object_product', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoProductsOrServices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/product/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); // search on lot/serial numbers if (isModEnabled('productbatch')) { @@ -89,41 +89,41 @@ if (((isModEnabled('product') && $user->hasRight('product', 'read')) || (isModEn } } -if (isModEnabled('mrp') && $user->hasRight('mrp', 'read') && empty($conf->global->MAIN_SEARCHFORM_MRP_DISABLED)) { +if (isModEnabled('mrp') && $user->hasRight('mrp', 'read') && !getDolGlobalString('MAIN_SEARCHFORM_MRP_DISABLED')) { $arrayresult['searchintomo'] = array('position'=>35, 'shortcut'=>'', 'img'=>'object_mrp', 'label'=>$langs->trans("SearchIntoMO", $search_boxvalue), 'text'=>img_picto('', 'object_mrp', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoMO", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/mrp/mo_list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); } -if (isModEnabled('project') && empty($conf->global->MAIN_SEARCHFORM_PROJECT_DISABLED) && $user->hasRight('projet', 'lire')) { +if (isModEnabled('project') && !getDolGlobalString('MAIN_SEARCHFORM_PROJECT_DISABLED') && $user->hasRight('projet', 'lire')) { $arrayresult['searchintoprojects'] = array('position'=>40, 'shortcut'=>'Q', 'img'=>'object_project', 'label'=>$langs->trans("SearchIntoProjects", $search_boxvalue), 'text'=>img_picto('', 'object_project', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoProjects", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/projet/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); } -if (isModEnabled('project') && empty($conf->global->MAIN_SEARCHFORM_TASK_DISABLED) && $user->hasRight('projet', 'lire')) { +if (isModEnabled('project') && !getDolGlobalString('MAIN_SEARCHFORM_TASK_DISABLED') && $user->hasRight('projet', 'lire')) { $arrayresult['searchintotasks'] = array('position'=>45, 'img'=>'object_projecttask', 'label'=>$langs->trans("SearchIntoTasks", $search_boxvalue), 'text'=>img_picto('', 'object_projecttask', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoTasks", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/projet/tasks/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); } -if (isModEnabled('propal') && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_PROPAL_DISABLED) && $user->hasRight('propal', 'lire')) { +if (isModEnabled('propal') && !getDolGlobalString('MAIN_SEARCHFORM_CUSTOMER_PROPAL_DISABLED') && $user->hasRight('propal', 'lire')) { $arrayresult['searchintopropal'] = array('position'=>60, 'img'=>'object_propal', 'label'=>$langs->trans("SearchIntoCustomerProposals", $search_boxvalue), 'text'=>img_picto('', 'object_propal', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoCustomerProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/comm/propal/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); } -if (isModEnabled('commande') && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_ORDER_DISABLED) && $user->hasRight('commande', 'lire')) { +if (isModEnabled('commande') && !getDolGlobalString('MAIN_SEARCHFORM_CUSTOMER_ORDER_DISABLED') && $user->hasRight('commande', 'lire')) { $arrayresult['searchintoorder'] = array('position'=>70, 'img'=>'object_order', 'label'=>$langs->trans("SearchIntoCustomerOrders", $search_boxvalue), 'text'=>img_picto('', 'object_order', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoCustomerOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/commande/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); } -if (isModEnabled('expedition') && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_SHIPMENT_DISABLED) && $user->hasRight('expedition', 'lire')) { +if (isModEnabled('expedition') && !getDolGlobalString('MAIN_SEARCHFORM_CUSTOMER_SHIPMENT_DISABLED') && $user->hasRight('expedition', 'lire')) { $arrayresult['searchintoshipment'] = array('position'=>80, 'img'=>'object_shipment', 'label'=>$langs->trans("SearchIntoCustomerShipments", $search_boxvalue), 'text'=>img_picto('', 'object_shipment', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoCustomerShipments", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expedition/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); } -if (isModEnabled('facture') && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_INVOICE_DISABLED) && $user->hasRight('facture', 'lire')) { +if (isModEnabled('facture') && !getDolGlobalString('MAIN_SEARCHFORM_CUSTOMER_INVOICE_DISABLED') && $user->hasRight('facture', 'lire')) { $arrayresult['searchintoinvoice'] = array('position'=>90, 'img'=>'object_bill', 'label'=>$langs->trans("SearchIntoCustomerInvoices", $search_boxvalue), 'text'=>img_picto('', 'object_bill', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoCustomerInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/compta/facture/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); } -if (isModEnabled('supplier_proposal') && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_PROPAL_DISABLED) && $user->hasRight('supplier_proposal', 'lire')) { +if (isModEnabled('supplier_proposal') && !getDolGlobalString('MAIN_SEARCHFORM_SUPPLIER_PROPAL_DISABLED') && $user->hasRight('supplier_proposal', 'lire')) { $arrayresult['searchintosupplierpropal'] = array('position'=>100, 'img'=>'object_supplier_proposal', 'label'=>$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'text'=>img_picto('', 'object_supplier_proposal', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/supplier_proposal/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); } -if (((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight('fournisseur', 'commande', 'lire')) || (isModEnabled('supplier_order') && $user->hasRight('supplier_order', 'lire'))) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_ORDER_DISABLED)) { +if (((isModEnabled('fournisseur') && !getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD') && $user->hasRight('fournisseur', 'commande', 'lire')) || (isModEnabled('supplier_order') && $user->hasRight('supplier_order', 'lire'))) && !getDolGlobalString('MAIN_SEARCHFORM_SUPPLIER_ORDER_DISABLED')) { $arrayresult['searchintosupplierorder'] = array('position'=>110, 'img'=>'object_supplier_order', 'label'=>$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'text'=>img_picto('', 'object_supplier_order', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/commande/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); } -if (((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight('fournisseur', 'facture', 'lire')) || (isModEnabled('supplier_invoice') && $user->hasRight('supplier_invoice', 'lire'))) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_INVOICE_DISABLED)) { +if (((isModEnabled('fournisseur') && !getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD') && $user->hasRight('fournisseur', 'facture', 'lire')) || (isModEnabled('supplier_invoice') && $user->hasRight('supplier_invoice', 'lire'))) && !getDolGlobalString('MAIN_SEARCHFORM_SUPPLIER_INVOICE_DISABLED')) { $arrayresult['searchintosupplierinvoice'] = array('position'=>120, 'img'=>'object_supplier_invoice', 'label'=>$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'text'=>img_picto('', 'object_supplier_invoice', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/facture/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); } // Customer payments -if (isModEnabled('facture') && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_INVOICE_DISABLED) && $user->hasRight('facture', 'lire')) { +if (isModEnabled('facture') && !getDolGlobalString('MAIN_SEARCHFORM_CUSTOMER_INVOICE_DISABLED') && $user->hasRight('facture', 'lire')) { $arrayresult['searchintocustomerpayments'] = array( 'position'=>170, 'img'=>'object_payment', @@ -133,7 +133,7 @@ if (isModEnabled('facture') && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_INV } // Vendor payments -if (((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight('fournisseur', 'facture', 'lire')) || (isModEnabled('supplier_invoice') && $user->hasRight('supplier_invoice', 'lire'))) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_INVOICE_DISABLED)) { +if (((isModEnabled('fournisseur') && !getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD') && $user->hasRight('fournisseur', 'facture', 'lire')) || (isModEnabled('supplier_invoice') && $user->hasRight('supplier_invoice', 'lire'))) && !getDolGlobalString('MAIN_SEARCHFORM_SUPPLIER_INVOICE_DISABLED')) { $arrayresult['searchintovendorpayments'] = array( 'position'=>175, 'img'=>'object_payment', @@ -143,7 +143,7 @@ if (((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERM } // Miscellaneous payments -if (isModEnabled('banque') && empty($conf->global->MAIN_SEARCHFORM_MISC_PAYMENTS_DISABLED) && $user->hasRight('banque', 'lire')) { +if (isModEnabled('banque') && !getDolGlobalString('MAIN_SEARCHFORM_MISC_PAYMENTS_DISABLED') && $user->hasRight('banque', 'lire')) { $arrayresult['searchintomiscpayments'] = array( 'position'=>180, 'img'=>'object_payment', @@ -152,27 +152,27 @@ if (isModEnabled('banque') && empty($conf->global->MAIN_SEARCHFORM_MISC_PAYMENTS 'url'=>DOL_URL_ROOT.'/compta/bank/various_payment/list.php?leftmenu=tax_various'.($search_boxvalue ? '&search_all='.urlencode($search_boxvalue) : '')); } -if (isModEnabled('contrat') && empty($conf->global->MAIN_SEARCHFORM_CONTRACT_DISABLED) && $user->hasRight('contrat', 'lire')) { +if (isModEnabled('contrat') && !getDolGlobalString('MAIN_SEARCHFORM_CONTRACT_DISABLED') && $user->hasRight('contrat', 'lire')) { $arrayresult['searchintocontract'] = array('position'=>130, 'img'=>'object_contract', 'label'=>$langs->trans("SearchIntoContracts", $search_boxvalue), 'text'=>img_picto('', 'object_contract', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoContracts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contrat/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); } -if (isModEnabled('ficheinter') && empty($conf->global->MAIN_SEARCHFORM_FICHINTER_DISABLED) && $user->hasRight('ficheinter', 'lire')) { +if (isModEnabled('ficheinter') && !getDolGlobalString('MAIN_SEARCHFORM_FICHINTER_DISABLED') && $user->hasRight('ficheinter', 'lire')) { $arrayresult['searchintointervention'] = array('position'=>140, 'img'=>'object_intervention', 'label'=>$langs->trans("SearchIntoInterventions", $search_boxvalue), 'text'=>img_picto('', 'object_intervention', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoInterventions", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fichinter/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); } -if (isModEnabled('knowledgemanagement') && empty($conf->global->MAIN_SEARCHFORM_KNOWLEDGEMANAGEMENT_DISABLED) && $user->hasRight('knowledgemanagement', 'knowledgerecord', 'read')) { +if (isModEnabled('knowledgemanagement') && !getDolGlobalString('MAIN_SEARCHFORM_KNOWLEDGEMANAGEMENT_DISABLED') && $user->hasRight('knowledgemanagement', 'knowledgerecord', 'read')) { $arrayresult['searchintoknowledgemanagement'] = array('position'=>145, 'img'=>'object_knowledgemanagement', 'label'=>$langs->trans("SearchIntoKM", $search_boxvalue), 'text'=>img_picto('', 'object_knowledgemanagement', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoKM", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/knowledgemanagement/knowledgerecord_list.php?mainmenu=ticket'.($search_boxvalue ? '&search_all='.urlencode($search_boxvalue) : '')); } -if (isModEnabled('ticket') && empty($conf->global->MAIN_SEARCHFORM_TICKET_DISABLED) && $user->hasRight('ticket', 'read')) { +if (isModEnabled('ticket') && !getDolGlobalString('MAIN_SEARCHFORM_TICKET_DISABLED') && $user->hasRight('ticket', 'read')) { $arrayresult['searchintotickets'] = array('position'=>146, 'img'=>'object_ticket', 'label'=>$langs->trans("SearchIntoTickets", $search_boxvalue), 'text'=>img_picto('', 'object_ticket', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoTickets", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/ticket/list.php?mainmenu=ticket'.($search_boxvalue ? '&search_all='.urlencode($search_boxvalue) : '')); } // HR -if (isModEnabled('user') && empty($conf->global->MAIN_SEARCHFORM_USER_DISABLED) && $user->hasRight('user', 'user', 'lire')) { +if (isModEnabled('user') && !getDolGlobalString('MAIN_SEARCHFORM_USER_DISABLED') && $user->hasRight('user', 'user', 'lire')) { $arrayresult['searchintouser'] = array('position'=>200, 'shortcut'=>'U', 'img'=>'object_user', 'label'=>$langs->trans("SearchIntoUsers", $search_boxvalue), 'text'=>img_picto('', 'object_user', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoUsers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/user/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); } -if (isModEnabled('expensereport') && empty($conf->global->MAIN_SEARCHFORM_EXPENSEREPORT_DISABLED) && $user->hasRight('expensereport', 'lire')) { +if (isModEnabled('expensereport') && !getDolGlobalString('MAIN_SEARCHFORM_EXPENSEREPORT_DISABLED') && $user->hasRight('expensereport', 'lire')) { $arrayresult['searchintoexpensereport'] = array('position'=>210, 'img'=>'object_trip', 'label'=>$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'text'=>img_picto('', 'object_trip', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm'.($search_boxvalue ? '&search_all='.urlencode($search_boxvalue) : '')); } -if (isModEnabled('holiday') && empty($conf->global->MAIN_SEARCHFORM_HOLIDAY_DISABLED) && $user->hasRight('holiday', 'read')) { +if (isModEnabled('holiday') && !getDolGlobalString('MAIN_SEARCHFORM_HOLIDAY_DISABLED') && $user->hasRight('holiday', 'read')) { $arrayresult['searchintoleaves'] = array('position'=>220, 'img'=>'object_holiday', 'label'=>$langs->trans("SearchIntoLeaves", $search_boxvalue), 'text'=>img_picto('', 'object_holiday', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoLeaves", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/holiday/list.php?mainmenu=hrm'.($search_boxvalue ? '&search_all='.urlencode($search_boxvalue) : '')); } @@ -186,7 +186,7 @@ if (empty($reshook)) { } // This pushes a search entry to the top -if (!empty($conf->global->DEFAULT_SEARCH_INTO_MODULE)) { +if (getDolGlobalString('DEFAULT_SEARCH_INTO_MODULE')) { $key = 'searchinto' . getDolGlobalString('DEFAULT_SEARCH_INTO_MODULE'); if (array_key_exists($key, $arrayresult)) { $arrayresult[$key]['position'] = -1000; diff --git a/htdocs/core/bookmarks_page.php b/htdocs/core/bookmarks_page.php index 8b5db78cdd8..e7ced61cff3 100644 --- a/htdocs/core/bookmarks_page.php +++ b/htdocs/core/bookmarks_page.php @@ -102,7 +102,7 @@ if (empty($conf->bookmark->enabled)) { if ($resql = $db->query($sql)) { $bookmarkList = '\n"; $out .= "\n\n"; - if (!empty($conf->global->MAIN_ACTIVATE_FILECACHE)) { + if (getDolGlobalString('MAIN_ACTIVATE_FILECACHE')) { dol_filecache($cachedir, $filename, $out); } } else { diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index 4e2201cf638..c74f030556e 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -323,7 +323,7 @@ class DoliDBPgsql extends DoliDB // To have postgresql case sensitive $count_like = 0; $line = str_replace(' LIKE \'', ' ILIKE \'', $line, $count_like); - if (!empty($conf->global->PSQL_USE_UNACCENT) && $count_like > 0) { + if (getDolGlobalString('PSQL_USE_UNACCENT') && $count_like > 0) { // @see https://docs.postgresql.fr/11/unaccent.html : 'unaccent()' function must be installed before $line = preg_replace('/\s+(\(+\s*)([a-zA-Z0-9\-\_\.]+) ILIKE /', ' \1unaccent(\2) ILIKE ', $line); } @@ -521,7 +521,7 @@ class DoliDBPgsql extends DoliDB $query = $this->convertSQLFromMysql($query, $type, ($this->unescapeslashquot && $this->standard_conforming_strings)); //print "After convertSQLFromMysql:\n".$query."
    \n"; - if (!empty($conf->global->MAIN_DB_AUTOFIX_BAD_SQL_REQUEST)) { + if (getDolGlobalString('MAIN_DB_AUTOFIX_BAD_SQL_REQUEST')) { // Fix bad formed requests. If request contains a date without quotes, we fix this but this should not occurs. $loop = true; while ($loop) { diff --git a/htdocs/core/extrafieldsinexport.inc.php b/htdocs/core/extrafieldsinexport.inc.php index b31b02c3460..c454c743626 100644 --- a/htdocs/core/extrafieldsinexport.inc.php +++ b/htdocs/core/extrafieldsinexport.inc.php @@ -38,7 +38,7 @@ if ($resql) { // This can fail when class is used on old database (during mig break; case 'checkbox': case 'select': - if (!empty($conf->global->EXPORT_LABEL_FOR_SELECT)) { + if (getDolGlobalString('EXPORT_LABEL_FOR_SELECT')) { $tmpparam = jsonOrUnserialize($obj->param); // $tmpparam may be array with 'options' = array(key1=>val1, key2=>val2 ...) if ($tmpparam['options'] && is_array($tmpparam['options'])) { $typeFilter = "Select:".$obj->param; diff --git a/htdocs/core/extrafieldsinimport.inc.php b/htdocs/core/extrafieldsinimport.inc.php index 395b67520d1..224a3c893b9 100644 --- a/htdocs/core/extrafieldsinimport.inc.php +++ b/htdocs/core/extrafieldsinimport.inc.php @@ -38,7 +38,7 @@ if ($resql) { // This can fail when class is used on old database (during mig break; case 'checkbox': case 'select': - if (!empty($conf->global->EXPORT_LABEL_FOR_SELECT)) { + if (getDolGlobalString('EXPORT_LABEL_FOR_SELECT')) { $tmpparam = jsonOrUnserialize($obj->param); // $tmpparam may be array with 'options' = array(key1=>val1, key2=>val2 ...) if ($tmpparam['options'] && is_array($tmpparam['options'])) { $typeFilter = "Select:".$obj->param; diff --git a/htdocs/core/filemanagerdol/connectors/php/config.inc.php b/htdocs/core/filemanagerdol/connectors/php/config.inc.php index 7407ab706a7..2701bcd0fb4 100644 --- a/htdocs/core/filemanagerdol/connectors/php/config.inc.php +++ b/htdocs/core/filemanagerdol/connectors/php/config.inc.php @@ -83,7 +83,7 @@ $Config['HtmlExtensions'] = array("html", "htm", "xml", "xsd", "txt", "js"); // Set to 0 to disable this feature. // Note: not needed on Windows-based servers. $newmask = '0644'; -if (!empty($conf->global->MAIN_UMASK)) { +if (getDolGlobalString('MAIN_UMASK')) { $newmask = $conf->global->MAIN_UMASK; } $Config['ChmodOnUpload'] = $newmask; @@ -92,7 +92,7 @@ $Config['ChmodOnUpload'] = $newmask; // Used when creating folders that does not exist. $newmask = '0755'; $dirmaskdec = octdec($newmask); -if (!empty($conf->global->MAIN_UMASK)) { +if (getDolGlobalString('MAIN_UMASK')) { $dirmaskdec = octdec($conf->global->MAIN_UMASK); } $dirmaskdec |= octdec('0200'); // Set w bit required to be able to create content for recursive subdirs files diff --git a/htdocs/core/get_info.php b/htdocs/core/get_info.php index 92cb2b8735e..b43cabd2f10 100644 --- a/htdocs/core/get_info.php +++ b/htdocs/core/get_info.php @@ -70,7 +70,7 @@ print '
    '; // Define link to login card $appli = constant('DOL_APPLICATION_TITLE'); -if (!empty($conf->global->MAIN_APPLICATION_TITLE)) { +if (getDolGlobalString('MAIN_APPLICATION_TITLE')) { $appli = $conf->global->MAIN_APPLICATION_TITLE; if (preg_match('/\d\.\d/', $appli)) { if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) { @@ -88,7 +88,7 @@ if (getDolGlobalInt('MAIN_FEATURES_LEVEL')) { } $logouttext = ''; -if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { +if (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { //$logouthtmltext=$appli.'
    '; if ($_SESSION["dol_authmode"] != 'forceuser' && $_SESSION["dol_authmode"] != 'http') { $logouthtmltext .= $langs->trans("Logout").'
    '; diff --git a/htdocs/core/get_menudiv.php b/htdocs/core/get_menudiv.php index 0b8a72afece..ba9496cc803 100644 --- a/htdocs/core/get_menudiv.php +++ b/htdocs/core/get_menudiv.php @@ -237,10 +237,10 @@ $(document).ready(function(){ if (empty($user->socid)) { // If internal user or not defined - $conf->standard_menu = (empty($conf->global->MAIN_MENU_STANDARD_FORCED) ? (empty($conf->global->MAIN_MENU_STANDARD) ? 'eldy_menu.php' : $conf->global->MAIN_MENU_STANDARD) : $conf->global->MAIN_MENU_STANDARD_FORCED); + $conf->standard_menu = (!getDolGlobalString('MAIN_MENU_STANDARD_FORCED') ? (!getDolGlobalString('MAIN_MENU_STANDARD') ? 'eldy_menu.php' : $conf->global->MAIN_MENU_STANDARD) : $conf->global->MAIN_MENU_STANDARD_FORCED); } else // If external user { - $conf->standard_menu = (empty($conf->global->MAIN_MENUFRONT_STANDARD_FORCED) ? (empty($conf->global->MAIN_MENUFRONT_STANDARD) ? 'eldy_menu.php' : $conf->global->MAIN_MENUFRONT_STANDARD) : $conf->global->MAIN_MENUFRONT_STANDARD_FORCED); + $conf->standard_menu = (!getDolGlobalString('MAIN_MENUFRONT_STANDARD_FORCED') ? (!getDolGlobalString('MAIN_MENUFRONT_STANDARD') ? 'eldy_menu.php' : $conf->global->MAIN_MENUFRONT_STANDARD) : $conf->global->MAIN_MENUFRONT_STANDARD_FORCED); } // Load the menu manager (only if not already done) diff --git a/htdocs/core/js/lib_head.js.php b/htdocs/core/js/lib_head.js.php index 9e7e8841bb5..e9356596653 100644 --- a/htdocs/core/js/lib_head.js.php +++ b/htdocs/core/js/lib_head.js.php @@ -1277,7 +1277,7 @@ function price2numjs(amount) { global->MAIN_DISABLE_JQUERY_JNOTIFY) && !defined('DISABLE_JQUERY_JNOTIFY')) { +if (!getDolGlobalString('MAIN_DISABLE_JQUERY_JNOTIFY') && !defined('DISABLE_JQUERY_JNOTIFY')) { ?> // Defined properties for JNotify $(document).ready(function() { @@ -1326,7 +1326,7 @@ jQuery(document).ready(function() { */ global->MAIN_DISABLE_SELECT2_FOCUS_PROTECTION) && !defined('DISABLE_SELECT2_FOCUS_PROTECTION')) { +if (!getDolGlobalString('MAIN_DISABLE_SELECT2_FOCUS_PROTECTION') && !defined('DISABLE_SELECT2_FOCUS_PROTECTION')) { ?> $(document).on('select2:open', (e) => { console.log("Execute the focus (click on combo or use space when on component"); diff --git a/htdocs/core/js/lib_notification.js.php b/htdocs/core/js/lib_notification.js.php index 168bd23eb7b..d3403298691 100644 --- a/htdocs/core/js/lib_notification.js.php +++ b/htdocs/core/js/lib_notification.js.php @@ -89,7 +89,7 @@ if ("Notification" in window) { // We set a delay before launching first test so next check will arrive after the time_auto_update compared to previous one. //var time_first_execution = (time_auto_update + (time_js_next_test - nowtime)) * 1000; //need milliseconds - var time_first_execution = global->MAIN_BROWSER_NOTIFICATION_CHECK_FIRST_EXECUTION) ? 0 : $conf->global->MAIN_BROWSER_NOTIFICATION_CHECK_FIRST_EXECUTION); ?>; + var time_first_execution = global->MAIN_BROWSER_NOTIFICATION_CHECK_FIRST_EXECUTION); ?>; setTimeout(first_execution, time_first_execution * 1000); // Launch a first execution after a time_first_execution delay time_js_next_test = nowtime + time_first_execution; @@ -138,7 +138,7 @@ function check_events() { console.log("Retrieved "+arrayofpastreminders.length+" reminders to do."); var audio = null; global->AGENDA_REMINDER_BROWSER_SOUND)) { + if (getDolGlobalString('AGENDA_REMINDER_BROWSER_SOUND')) { print 'audio = new Audio(\''.DOL_URL_ROOT.'/theme/common/sound/notification_agenda.wav\');'; } ?> diff --git a/htdocs/core/lib/accounting.lib.php b/htdocs/core/lib/accounting.lib.php index 08ec7f062e3..b8d700ffb93 100644 --- a/htdocs/core/lib/accounting.lib.php +++ b/htdocs/core/lib/accounting.lib.php @@ -99,7 +99,7 @@ function length_accountg($account) return ''; } - if (!empty($conf->global->ACCOUNTING_MANAGE_ZERO)) { + if (getDolGlobalString('ACCOUNTING_MANAGE_ZERO')) { return $account; } @@ -138,7 +138,7 @@ function length_accounta($accounta) return ''; } - if (!empty($conf->global->ACCOUNTING_MANAGE_ZERO)) { + if (getDolGlobalString('ACCOUNTING_MANAGE_ZERO')) { return $accounta; } diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index f9de3625647..a25e0d4b26e 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -843,7 +843,7 @@ function security_prepare_head() $sql .= " WHERE r.libelle NOT LIKE 'tou%'"; // On ignore droits "tous" $sql .= " AND entity = ".((int) $conf->entity); $sql .= " AND bydefault = 1"; - if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { + if (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) { $sql .= " AND r.perms NOT LIKE '%_advance'"; // Hide advanced perms if option is not enabled } $resql = $db->query($sql); @@ -859,7 +859,7 @@ function security_prepare_head() $head[$h][0] = DOL_URL_ROOT."/admin/perms.php"; $head[$h][1] = $langs->trans("DefaultRights"); if ($nbPerms > 0) { - $head[$h][1] .= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? ''.$nbPerms.'' : ''); + $head[$h][1] .= (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER') ? ''.$nbPerms.'' : ''); } $head[$h][2] = 'default'; $h++; diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php index 1a49715dac3..17b639f0c2d 100644 --- a/htdocs/core/lib/agenda.lib.php +++ b/htdocs/core/lib/agenda.lib.php @@ -73,11 +73,11 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh print '
    '; // Type $multiselect = 0; - if (!empty($conf->global->MAIN_ENABLE_MULTISELECT_TYPE)) { // We use an option here because it adds bugs when used on agenda page "peruser" and "list" - $multiselect = (!empty($conf->global->AGENDA_USE_EVENT_TYPE)); + if (getDolGlobalString('MAIN_ENABLE_MULTISELECT_TYPE')) { // We use an option here because it adds bugs when used on agenda page "peruser" and "list" + $multiselect = (getDolGlobalString('AGENDA_USE_EVENT_TYPE')); } print img_picto($langs->trans("ActionType"), 'square', 'class="pictofixedwidth inline-block" style="color: #ddd;"'); - print $formactions->select_type_actions($actioncode, "search_actioncode", $excludetype, (empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : -1), 0, $multiselect, 0, 'maxwidth500 widthcentpercentminusx'); + print $formactions->select_type_actions($actioncode, "search_actioncode", $excludetype, (!getDolGlobalString('AGENDA_USE_EVENT_TYPE') ? 1 : -1), 0, $multiselect, 0, 'maxwidth500 widthcentpercentminusx'); print '
    '; if ($canedit) { @@ -441,7 +441,7 @@ function actions_prepare_head($object) $nbResources = (is_array($listofresourcelinked) ?count($listofresourcelinked) : 0); $head[$h][1] = $langs->trans("Resources"); if ($nbResources > 0) { - $head[$h][1] .= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? ''.($nbResources).'' : ''); + $head[$h][1] .= (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER') ? ''.($nbResources).'' : ''); } $head[$h][2] = 'resources'; $h++; @@ -456,7 +456,7 @@ function actions_prepare_head($object) $head[$h][0] = DOL_URL_ROOT.'/comm/action/document.php?id='.$object->id; $head[$h][1] = $langs->trans("Documents"); if (($nbFiles + $nbLinks) > 0) { - $head[$h][1] .= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? ''.($nbFiles + $nbLinks).'' : ''); + $head[$h][1] .= (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER') ? ''.($nbFiles + $nbLinks).'' : ''); } $head[$h][2] = 'documents'; $h++; @@ -508,7 +508,7 @@ function calendars_prepare_head($param) $h++; //if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) - if (!empty($conf->global->AGENDA_SHOW_PERTYPE)) { + if (getDolGlobalString('AGENDA_SHOW_PERTYPE')) { $head[$h][0] = DOL_URL_ROOT.'/comm/action/pertype.php'.($param ? '?'.$param : ''); $head[$h][1] = $langs->trans("ViewPerType"); $head[$h][2] = 'cardpertype'; diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index e5f16cbbaf4..3f152cf404e 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -194,7 +194,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen $("#'.$htmlnamejquery.'").attr("data-tvatx", ui.item.tva_tx); $("#'.$htmlnamejquery.'").attr("data-default-vat-code", ui.item.default_vat_code); '; - if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) { + if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { $script .= ' // For customer price when PRODUIT_CUSTOMER_PRICES_BY_QTY is on console.log("PRODUIT_CUSTOMER_PRICES_BY_QTY is on, propagate also prices by quantity into data-pbqxxx properties"); @@ -451,20 +451,20 @@ function ajax_combobox($htmlname, $events = array(), $minLengthToAutocomplete = global $conf; // select2 can be disabled for smartphones - if (!empty($conf->browser->layout) && $conf->browser->layout == 'phone' && !empty($conf->global->MAIN_DISALLOW_SELECT2_WITH_SMARTPHONE)) { + if (!empty($conf->browser->layout) && $conf->browser->layout == 'phone' && getDolGlobalString('MAIN_DISALLOW_SELECT2_WITH_SMARTPHONE')) { return ''; } - if (!empty($conf->global->MAIN_DISABLE_AJAX_COMBOX)) { + if (getDolGlobalString('MAIN_DISABLE_AJAX_COMBOX')) { return ''; } if (empty($conf->use_javascript_ajax)) { return ''; } - if (empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) && !defined('REQUIRE_JQUERY_MULTISELECT')) { + if (!getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') && !defined('REQUIRE_JQUERY_MULTISELECT')) { return ''; } - if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { + if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { return ''; } diff --git a/htdocs/core/lib/asset.lib.php b/htdocs/core/lib/asset.lib.php index bfa95ce9c0a..455230cdb65 100644 --- a/htdocs/core/lib/asset.lib.php +++ b/htdocs/core/lib/asset.lib.php @@ -135,7 +135,7 @@ function assetPrepareHead(Asset $object) $head[$h][0] = DOL_URL_ROOT . '/asset/note.php?id=' . $object->id; $head[$h][1] = $langs->trans('Notes'); if ($nbNote > 0) { - $head[$h][1] .= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' . $nbNote . '' : ''); + $head[$h][1] .= (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER') ? '' . $nbNote . '' : ''); } $head[$h][2] = 'note'; $h++; @@ -215,7 +215,7 @@ function assetModelPrepareHead($object) $head[$h][0] = DOL_URL_ROOT . '/asset/model/note.php?id=' . $object->id; $head[$h][1] = $langs->trans('Notes'); if ($nbNote > 0) { - $head[$h][1] .= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' . $nbNote . '' : ''); + $head[$h][1] .= (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER') ? '' . $nbNote . '' : ''); } $head[$h][2] = 'note'; $h++; diff --git a/htdocs/core/lib/bank.lib.php b/htdocs/core/lib/bank.lib.php index f568ecb603f..9dc327edf8f 100644 --- a/htdocs/core/lib/bank.lib.php +++ b/htdocs/core/lib/bank.lib.php @@ -68,7 +68,7 @@ function bank_prepare_head(Account $object) $head[$h][2] = 'graph'; $h++; - if ($object->courant != Account::TYPE_CASH || !empty($conf->global->BANK_CAN_RECONCILIATE_CASHACCOUNT)) { + if ($object->courant != Account::TYPE_CASH || getDolGlobalString('BANK_CAN_RECONCILIATE_CASHACCOUNT')) { $nbReceipts = 0; // List of all standing receipts diff --git a/htdocs/core/lib/barcode.lib.php b/htdocs/core/lib/barcode.lib.php index 01358e0753d..5ccf8c70af3 100644 --- a/htdocs/core/lib/barcode.lib.php +++ b/htdocs/core/lib/barcode.lib.php @@ -60,7 +60,7 @@ if (defined('PHP-BARCODE_PATH_COMMAND')) { $genbarcode_loc = constant('PHP-BARCODE_PATH_COMMAND'); } else { $genbarcode_loc = ''; - if (!empty($conf->global->GENBARCODE_LOCATION)) { + if (getDolGlobalString('GENBARCODE_LOCATION')) { $genbarcode_loc = $conf->global->GENBARCODE_LOCATION; } } diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 604f16c41f3..a07af1797f0 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -52,8 +52,8 @@ function societe_prepare_head(Societe $object) $head[$h][2] = 'card'; $h++; - if (empty($conf->global->MAIN_SUPPORT_SHARED_CONTACT_BETWEEN_THIRDPARTIES)) { - if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->hasRight('societe', 'contact', 'lire')) { + if (!getDolGlobalString('MAIN_SUPPORT_SHARED_CONTACT_BETWEEN_THIRDPARTIES')) { + if (!getDolGlobalString('MAIN_DISABLE_CONTACTS_TAB') && $user->hasRight('societe', 'contact', 'lire')) { //$nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external')); $nbContact = 0; // Enable caching of thirdrparty count Contacts @@ -106,19 +106,19 @@ function societe_prepare_head(Societe $object) if ($object->client == 1 || $object->client == 2 || $object->client == 3) { $head[$h][0] = DOL_URL_ROOT.'/comm/card.php?socid='.$object->id; $head[$h][1] = ''; - if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && ($object->client == 2 || $object->client == 3)) { + if (!getDolGlobalString('SOCIETE_DISABLE_PROSPECTS') && ($object->client == 2 || $object->client == 3)) { $head[$h][1] .= $langs->trans("Prospect"); } - if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && $object->client == 3) { + if (!getDolGlobalString('SOCIETE_DISABLE_PROSPECTS') && !getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS') && $object->client == 3) { $head[$h][1] .= ' | '; } - if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && ($object->client == 1 || $object->client == 3)) { + if (!getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS') && ($object->client == 1 || $object->client == 3)) { $head[$h][1] .= $langs->trans("Customer"); } $head[$h][2] = 'customer'; $h++; - if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { + if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES')) { $langs->load("products"); // price $head[$h][0] = DOL_URL_ROOT.'/societe/price.php?socid='.$object->id; @@ -171,7 +171,7 @@ function societe_prepare_head(Societe $object) } // Tab to link resources - if (isModEnabled('resource') && !empty($conf->global->RESOURCE_ON_THIRDPARTIES)) { + if (isModEnabled('resource') && getDolGlobalString('RESOURCE_ON_THIRDPARTIES')) { $head[$h][0] = DOL_URL_ROOT.'/resource/element_resource.php?element=societe&element_id='.$object->id; $head[$h][1] = $langs->trans("Resources"); $head[$h][2] = 'resources'; @@ -180,7 +180,7 @@ function societe_prepare_head(Societe $object) // Related items if ((isModEnabled('commande') || isModEnabled('propal') || isModEnabled('facture') || isModEnabled('ficheinter') || isModEnabled("supplier_proposal") || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) - && empty($conf->global->THIRDPARTIES_DISABLE_RELATED_OBJECT_TAB)) { + && !getDolGlobalString('THIRDPARTIES_DISABLE_RELATED_OBJECT_TAB')) { $head[$h][0] = DOL_URL_ROOT.'/societe/consumption.php?socid='.$object->id; $head[$h][1] = $langs->trans("Referers"); $head[$h][2] = 'consumption'; @@ -200,7 +200,7 @@ function societe_prepare_head(Societe $object) //$title = $langs->trans("BankAccountsAndGateways"); $servicestatus = 0; - if (!empty($conf->global->STRIPE_LIVE) && !GETPOST('forcesandbox', 'alpha')) { + if (getDolGlobalString('STRIPE_LIVE') && !GETPOST('forcesandbox', 'alpha')) { $servicestatus = 1; } @@ -243,7 +243,7 @@ function societe_prepare_head(Societe $object) } if ( - ((isModEnabled('website') && !empty($conf->global->WEBSITE_USE_WEBSITE_ACCOUNTS)) || isModEnabled('webportal')) + ((isModEnabled('website') && getDolGlobalString('WEBSITE_USE_WEBSITE_ACCOUNTS')) || isModEnabled('webportal')) && $user->hasRight('societe', 'lire') ) { $site_filter_list = array(); @@ -1063,7 +1063,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl $extrafields->fetch_name_optionals_label($contactstatic->table_element); $contactstatic->fields = array( - 'rowid' =>array('type'=>'integer', 'label'=>"TechnicalID", 'enabled'=>(!empty($conf->global->MAIN_SHOW_TECHNICAL_ID) ? 1 : 0), 'visible'=>(!empty($conf->global->MAIN_SHOW_TECHNICAL_ID) ? 1 : 0), 'position'=>1), + 'rowid' =>array('type'=>'integer', 'label'=>"TechnicalID", 'enabled'=>(getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') ? 1 : 0), 'visible'=>(getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') ? 1 : 0), 'position'=>1), 'name' =>array('type'=>'varchar(128)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1), 'poste' =>array('type'=>'varchar(128)', 'label'=>'PostOrFunction', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>2, 'index'=>1, 'position'=>20), 'address' =>array('type'=>'varchar(128)', 'label'=>'Address', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>3, 'index'=>1, 'position'=>30), @@ -1075,7 +1075,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl // Definition of fields for list $arrayfields = array( - 't.rowid'=>array('label'=>"TechnicalID", 'checked'=>(!empty($conf->global->MAIN_SHOW_TECHNICAL_ID) ? 1 : 0), 'enabled'=>(!empty($conf->global->MAIN_SHOW_TECHNICAL_ID) ? 1 : 0), 'position'=>1), + 't.rowid'=>array('label'=>"TechnicalID", 'checked'=>(getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') ? 1 : 0), 'enabled'=>(getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') ? 1 : 0), 'position'=>1), 't.name'=>array('label'=>"Name", 'checked'=>1, 'position'=>10), 't.poste'=>array('label'=>"PostOrFunction", 'checked'=>1, 'position'=>20), 't.address'=>array('label'=>(empty($conf->dol_optimize_smallscreen) ? $langs->trans("Address").' / '.$langs->trans("Phone").' / '.$langs->trans("Email") : $langs->trans("Address")), 'checked'=>1, 'position'=>30), @@ -1132,13 +1132,13 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl $newcardbutton = ''; if ($user->hasRight('societe', 'contact', 'creer')) { - $addcontact = (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("AddContact") : $langs->trans("AddContactAddress")); + $addcontact = (getDolGlobalString('SOCIETE_ADDRESSES_MANAGEMENT') ? $langs->trans("AddContact") : $langs->trans("AddContactAddress")); $newcardbutton .= dolGetButtonTitle($addcontact, '', 'fa fa-plus-circle', DOL_URL_ROOT.'/contact/card.php?socid='.$object->id.'&action=create&backtopage='.urlencode($backtopage)); } print "\n"; - $title = (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("ContactsForCompany") : $langs->trans("ContactsAddressesForCompany")); + $title = (getDolGlobalString('SOCIETE_ADDRESSES_MANAGEMENT') ? $langs->trans("ContactsForCompany") : $langs->trans("ContactsAddressesForCompany")); print load_fiche_titre($title, $newcardbutton, ''); print ''; @@ -1983,7 +1983,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin $out .= '
'; $out .= ''; $out .= ''; $out .= ''; $out .= '
'; print $langs->trans("InitialMessage"); print ''; From 00320ea801bf1cad36aba5d8e811f75463f22246 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Nov 2023 10:23:21 +0100 Subject: [PATCH 077/120] Fix warnings --- htdocs/core/class/doleditor.class.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php index aa466fa71d8..3b0cba5482c 100644 --- a/htdocs/core/class/doleditor.class.php +++ b/htdocs/core/class/doleditor.class.php @@ -57,9 +57,7 @@ class DolEditor * @param int $width Width in pixel of edit area (auto by default) * @param int $height Height in pixel of edit area (200px by default) * @param string $toolbarname Name of bar set to use ('Full', 'dolibarr_notes[_encoded]', 'dolibarr_details[_encoded]'=the less featured, 'dolibarr_mailings[_encoded]', 'dolibarr_readonly'). - * @param string $toolbarlocation Where bar is stored : - * 'In' = each window has its own toolbar - * 'Out:name' = share toolbar into the div called 'name' + * @param string $toolbarlocation Deprecated. Not used * @param boolean $toolbarstartexpanded Bar is visible or not at start * @param boolean|int $uselocalbrowser Enabled to add links to local object with local browser. If false, only external images can be added in content. * @param boolean|string $okforextendededitor True=Allow usage of extended editor tool if qualified (like ckeditor). If 'textarea', force use of simple textarea. If 'ace', force use of Ace. @@ -71,7 +69,7 @@ class DolEditor */ public function __construct($htmlname, $content, $width = '', $height = 200, $toolbarname = 'Basic', $toolbarlocation = 'In', $toolbarstartexpanded = false, $uselocalbrowser = 1, $okforextendededitor = true, $rows = 0, $cols = 0, $readonly = 0, $poscursor = array()) { - global $conf, $langs; + global $conf; dol_syslog(get_class($this)."::DolEditor htmlname=".$htmlname." width=".$width." height=".$height." toolbarname=".$toolbarname); From 25a25dfcd7363119f6c82c79f929b88cd79ba7fe Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Nov 2023 15:36:05 +0100 Subject: [PATCH 078/120] Debug v19 --- htdocs/comm/propal/list.php | 6 +++++- htdocs/commande/list.php | 21 +++++++++++++++++---- htdocs/compta/facture/list.php | 33 +++++++++++++++++++++++---------- 3 files changed, 45 insertions(+), 15 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 181ce1853b3..5be19c7c6d1 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -281,6 +281,10 @@ foreach ($object->fields as $key => $val) { } }*/ +if (!$user->hasRight('societe', 'client', 'voir') || $user->socid) { + $search_sale = $user->id; +} + // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; @@ -774,7 +778,7 @@ if ($search_date_signature_end) { if ($search_sale && $search_sale != '-1') { if ($search_sale == -2) { $sql .= " AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc)"; - } elseif ($search_sale > 0 && !$user->hasRight('societe', 'client', 'voir')) { + } elseif ($search_sale > 0) { $sql .= " AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc AND sc.fk_user = ".((int) $search_sale).")"; } } diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 8c10c3ce7ab..d2076891619 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -91,7 +91,6 @@ $sall = trim((GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all' $socid = GETPOST('socid', 'int'); $search_user = GETPOST('search_user', 'int'); $search_sale = GETPOST('search_sale', 'int'); - $search_total_ht = GETPOST('search_total_ht', 'alpha'); $search_total_vat = GETPOST('search_total_vat', 'alpha'); $search_total_ttc = GETPOST('search_total_ttc', 'alpha'); @@ -218,6 +217,10 @@ $object->fields = dol_sort_array($object->fields, 'position'); //$arrayfields['anotherfield'] = array('type'=>'integer', 'label'=>'AnotherField', 'checked'=>1, 'enabled'=>1, 'position'=>90, 'csslist'=>'right'); $arrayfields = dol_sort_array($arrayfields, 'position'); +if (!$user->hasRight('societe', 'client', 'voir') || $user->socid) { + $search_sale = $user->id; +} + // Security check $id = (GETPOST('orderid') ?GETPOST('orderid', 'int') : GETPOST('id', 'int')); if ($user->socid) { @@ -861,9 +864,10 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = c.fk_projet"; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON c.fk_user_author = u.rowid'; // We'll need this table joined to the select in order to filter by sale +/* if ($search_sale > 0 || (!$user->hasRight('societe', 'client', 'voir') && !$socid)) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; -} +}*/ if ($search_user > 0) { $sql .= ", ".MAIN_DB_PREFIX."element_contact as ec"; $sql .= ", ".MAIN_DB_PREFIX."c_type_contact as tc"; @@ -959,9 +963,9 @@ if (empty($arrayfields['s.name_alias']['checked']) && $search_company) { if ($search_parent_name) { $sql .= natural_search('s2.nom', $search_parent_name); } -if ($search_sale > 0) { +/*if ($search_sale > 0) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $search_sale); -} +}*/ if ($search_user > 0) { $sql .= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".((int) $search_user); } @@ -1019,6 +1023,14 @@ if ($search_fk_mode_reglement > 0) { if ($search_fk_input_reason > 0) { $sql .= " AND c.fk_input_reason = ".((int) $search_fk_input_reason); } +// Search on sale representative +if ($search_sale && $search_sale != '-1') { + if ($search_sale == -2) { + $sql .= " AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc =c.fk_soc)"; + } elseif ($search_sale > 0) { + $sql .= " AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = c.fk_soc AND sc.fk_user = ".((int) $search_sale).")"; + } +} // Search for tag/category ($searchCategoryProductList is an array of ID) $searchCategoryProductOperator = -1; $searchCategoryProductList = array($search_product_category); @@ -1060,6 +1072,7 @@ $sql .= $hookmanager->resPrint; $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= empty($hookmanager->resPrint) ? "" : " HAVING 1=1 ".$hookmanager->resPrint; +print $sql; // Count total nb of records $nbtotalofrecords = ''; diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 9f684ef0595..35358718b9b 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -173,13 +173,6 @@ if (!$sortfield) { $pageprev = $page - 1; $pagenext = $page + 1; -// Security check -$fieldid = (!empty($ref) ? 'ref' : 'rowid'); -if (!empty($user->socid)) { - $socid = $user->socid; -} -$result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid); - $diroutputmassaction = $conf->facture->dir_output.'/temp/massgeneration/'.$user->id; $now = dol_now(); @@ -296,6 +289,17 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); +if (!$user->hasRight('societe', 'client', 'voir') || $user->socid) { + $search_sale = $user->id; +} + +// Security check +$fieldid = (!empty($ref) ? 'ref' : 'rowid'); +if (!empty($user->socid)) { + $socid = $user->socid; +} +$result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid); + /* * Actions @@ -650,9 +654,10 @@ if (!empty($search_fac_rec_source_title)) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = f.fk_projet"; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user AS u ON f.fk_user_author = u.rowid'; // We'll need this table joined to the select in order to filter by sale +/* if ($search_sale > 0 || (!$user->hasRight('societe', 'client', 'voir') && !$socid)) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; -} +}*/ if ($search_user > 0) { $sql .= ", ".MAIN_DB_PREFIX."element_contact as ec"; $sql .= ", ".MAIN_DB_PREFIX."c_type_contact as tc"; @@ -829,15 +834,23 @@ if ($search_datelimit_end) { if ($search_late == 'late') { $sql .= " AND f.date_lim_reglement < '".$db->idate(dol_now() - $conf->facture->client->warning_delay)."'"; } -if ($search_sale > 0) { +/*if ($search_sale > 0) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $search_sale); -} +}*/ if ($search_user > 0) { $sql .= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='facture' AND tc.source='internal' AND ec.element_id = f.rowid AND ec.fk_socpeople = ".((int) $search_user); } if (!empty($search_fac_rec_source_title)) { $sql .= natural_search('facrec.titre', $search_fac_rec_source_title); } +// Search on sale representative +if ($search_sale && $search_sale != '-1') { + if ($search_sale == -2) { + $sql .= " AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc =f.fk_soc)"; + } elseif ($search_sale > 0) { + $sql .= " AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = f.fk_soc AND sc.fk_user = ".((int) $search_sale).")"; + } +} // Search for tag/category ($searchCategoryProductList is an array of ID) $searchCategoryProductList = $search_product_category ? array($search_product_category) : array(); $searchCategoryProductOperator = 0; From 1ac9bcab5967ad924dd70488c6af131b7cef296b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Nov 2023 16:30:31 +0100 Subject: [PATCH 079/120] Debug v19 --- htdocs/comm/propal/list.php | 80 ++++++-------------- htdocs/commande/list.php | 19 ++--- htdocs/compta/facture/list.php | 81 ++++++++------------ htdocs/contrat/list.php | 25 ++++--- htdocs/core/class/html.formorder.class.php | 5 +- htdocs/don/list.php | 8 +- htdocs/fichinter/list.php | 9 +++ htdocs/fourn/commande/list.php | 87 +++++++++++----------- htdocs/fourn/facture/list.php | 46 +++++++----- htdocs/supplier_proposal/list.php | 37 ++++----- 10 files changed, 183 insertions(+), 214 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 5be19c7c6d1..7ae7f168a10 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -281,7 +281,7 @@ foreach ($object->fields as $key => $val) { } }*/ -if (!$user->hasRight('societe', 'client', 'voir') || $user->socid) { +if (!$user->hasRight('societe', 'client', 'voir')) { $search_sale = $user->id; } @@ -579,12 +579,6 @@ $sql .= ' p.note_public, p.note_private,'; $sql .= ' p.fk_cond_reglement,p.deposit_percent,p.fk_mode_reglement,p.fk_shipping_method,p.fk_input_reason,'; $sql .= " pr.rowid as project_id, pr.ref as project_ref, pr.title as project_label,"; $sql .= ' u.login, u.lastname, u.firstname, u.email as user_email, u.statut as user_statut, u.entity as user_entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender'; -/*if (!$user->hasRight('societe', 'client', 'voir') && !$socid) { - $sql .= ", sc.fk_soc, sc.fk_user"; -}*/ -/*if (!empty($search_categ_cus) && $search_categ_cus != '-1') { - $sql .= ", cc.fk_categorie, cc.fk_soc"; -}*/ // Add fields from extrafields if (!empty($extrafields->attributes[$object->table_element]['label'])) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { @@ -603,9 +597,7 @@ $sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s'; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)"; -/*if (!empty($search_categ_cus) && $search_categ_cus != '-1') { - $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ -}*/ + $sql .= ', '.MAIN_DB_PREFIX.'propal as p'; if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (p.rowid = ef.fk_object)"; @@ -616,14 +608,6 @@ if ($sall) { $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON p.fk_user_author = u.rowid'; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as pr ON pr.rowid = p.fk_projet"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_availability as ava on (ava.rowid = p.fk_availability)"; -// We'll need this table joined to the select in order to filter by sale -/* -if ($search_sale == -2) { - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON (sc.fk_soc = p.fk_soc)"; -} elseif ($search_sale > 0 || (!$user->hasRight('societe', 'client', 'voir') && !$socid)) { - $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; -} -*/ if ($search_user > 0) { $sql .= ", ".MAIN_DB_PREFIX."element_contact as c"; $sql .= ", ".MAIN_DB_PREFIX."c_type_contact as tc"; @@ -636,11 +620,6 @@ $sql .= $hookmanager->resPrint; $sql .= ' WHERE p.fk_soc = s.rowid'; $sql .= ' AND p.entity IN ('.getEntity('propal').')'; -/* -if (!$user->hasRight('societe', 'client', 'voir') && !$socid) { //restriction - $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); -} -*/ if ($search_town) { $sql .= natural_search('s.town', $search_town); } @@ -714,14 +693,6 @@ if ($search_multicurrency_montant_ttc != '') { if ($sall) { $sql .= natural_search(array_keys($fieldstosearchall), $sall); } -/* -if ($search_categ_cus > 0) { - $sql .= " AND cc.fk_categorie = ".((int) $search_categ_cus); -} -if ($search_categ_cus == -2) { - $sql .= " AND cc.fk_categorie IS NULL"; -} -*/ if ($search_fk_cond_reglement > 0) { $sql .= " AND p.fk_cond_reglement = ".((int) $search_fk_cond_reglement); } @@ -758,13 +729,6 @@ if ($search_date_delivery_start) { if ($search_date_delivery_end) { $sql .= " AND p.date_livraison <= '".$db->idate($search_date_delivery_end)."'"; } -/* -if ($search_sale == -2) { - $sql .= " AND sc.fk_user IS NULL"; -} elseif ($search_sale > 0) { - $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $search_sale); -} -*/ if ($search_user > 0) { $sql .= " AND c.fk_c_type_contact = tc.rowid AND tc.element='propal' AND tc.source='internal' AND c.element_id = p.rowid AND c.fk_socpeople = ".((int) $search_user); } @@ -1508,7 +1472,7 @@ if ($search_date_signature_endyear) { } // Status if (!empty($arrayfields['p.fk_statut']['checked'])) { - print ''; + print ''; $formpropal->selectProposalStatus($search_status, 1, 0, 1, 'customer', 'search_statut', 'search_status width100 onrightofpage'); print ''.$objectstatic->getLibStatut(5).''.$objectstatic->getLibStatut(5).''; + print ''; $liststatus = array( Commande::STATUS_DRAFT => $langs->trans("StatusOrderDraftShort"), Commande::STATUS_VALIDATED => $langs->trans("StatusOrderValidated"), @@ -1981,7 +1972,7 @@ if (!empty($arrayfields['c.import_key']['checked'])) { $totalarray['nbfield']++; } if (!empty($arrayfields['c.fk_statut']['checked'])) { - print_liste_field_titre($arrayfields['c.fk_statut']['label'], $_SERVER["PHP_SELF"], "c.fk_statut", "", $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre($arrayfields['c.fk_statut']['label'], $_SERVER["PHP_SELF"], "c.fk_statut", "", $param, '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; } // Action column @@ -2729,7 +2720,7 @@ while ($i < $imaxinloop) { // Status if (!empty($arrayfields['c.fk_statut']['checked'])) { - print ''.$generic_commande->LibStatut($obj->fk_statut, $obj->billed, 5, 1).''.$generic_commande->LibStatut($obj->fk_statut, $obj->billed, 5, 1).''.(!empty($multicurrency_totalpay) ? price($multicurrency_totalpay, 0, $langs) : ' ').''; + print ''; print $facturestatic->getLibStatut(5, $paiement); print "'; +print ''; $liststatus = array( Don::STATUS_DRAFT=>$langs->trans("DonationStatusPromiseNotValidated"), Don::STATUS_VALIDATED=>$langs->trans("DonationStatusPromiseValidated"), @@ -390,7 +390,7 @@ if (isModEnabled('project')) { } print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "d.amount", "", $param, '', $sortfield, $sortorder, 'right '); $totalarray['nbfield']++; -print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "d.fk_statut", "", $param, '', $sortfield, $sortorder, 'right '); +print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "d.fk_statut", "", $param, '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print_liste_field_titre(''); @@ -479,7 +479,9 @@ while ($i < $imaxinloop) { print "'.price($obj->amount).''.$donationstatic->LibStatut($obj->status, 5).''.$donationstatic->LibStatut($obj->status, 5).''; print ''; - $formorder->selectSupplierOrderStatus($search_status, 1, 'search_status'); - print ''; print $form->selectyesno('search_billed', $search_billed, 1, false, 1, 1, 'search_status width100 onrightofpage'); print ''; + $formorder->selectSupplierOrderStatus($search_status, 1, 'search_status', 'search_status width100 onrightofpage'); + print ''; @@ -1531,7 +1536,7 @@ if ($resql) { } // Action column if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; + print ''; $searchpicto = $form->showFilterButtons(); print $searchpicto; print '
'; + print ''; print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); print ''; + print ''; print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); print ''.$objectstatic->LibStatut($obj->fk_statut, 5, $obj->billed).''.yn($obj->billed).''.$objectstatic->LibStatut($obj->fk_statut, 5, $obj->billed).''; $liststatus = array('0'=>$langs->trans("Draft"), '1'=>$langs->trans("Unpaid"), '2'=>$langs->trans("Paid")); - print $form->selectarray('search_status', $liststatus, $search_status, 1, 0, 0, '', 0, 0, 0, '', 'search_status width100 onrightofpage', 1); + print $form->selectarray('search_status', $liststatus, $search_status, 1, 0, 0, '', 0, 0, 0, '', 'center search_status width100 onrightofpage', 1); print ''; + print ''; print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); print ''; + print ''; print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); print ''; + print ''; print $facturestatic->getLibStatut(5, $paiement); print "'; + print ''; $formpropal->selectProposalStatus($search_status, 1, 0, 1, 'supplier', 'search_status', 'search_status width100 onrightofpage'); print ''; + print ''; print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); print ''; + print ''; print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); print ''.$objectstatic->getLibStatut(5)."'.$objectstatic->getLibStatut(5)."".dol_escape_htmltag($obj->state_name)."'.dol_escape_htmltag($obj->state_name)."'; $tmparray = getCountry($obj->fk_pays, 'all'); - print $tmparray['label']; + print ''; + print dol_escape_htmltag($tmparray['label']); print ''.$form->textwithpicto($langs->trans("Total"), $langs->trans("Totalforthispage")).'' . convertSecondToTime($totalarray['totalduration'], 'allhourmin') . '' . price($totalarray['totalvalue']) . ''.price($totalarray['totalvaluebilled']).''; print ''; @@ -1277,6 +1277,10 @@ if (!empty($arrayfields['p.fk_product_type']['checked'])) { print_liste_field_titre($arrayfields['p.fk_product_type']['label'], $_SERVER["PHP_SELF"], "p.fk_product_type", "", $param, "", $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; } +if (!empty($arrayfields['p.description']['checked'])) { + print_liste_field_titre($arrayfields['p.description']['label'], $_SERVER["PHP_SELF"], "p.description", "", $param, "", $sortfield, $sortorder); + $totalarray['nbfield']++; +} if (!empty($arrayfields['p.barcode']['checked'])) { print_liste_field_titre($arrayfields['p.barcode']['label'], $_SERVER["PHP_SELF"], "p.barcode", "", $param, "", $sortfield, $sortorder); $totalarray['nbfield']++; @@ -1667,6 +1671,18 @@ while ($i < $imaxinloop) { } } + // Description + if (!empty($arrayfields['p.description']['checked'])) { + print ''; + // Since description can be very large (several pages of HTML- + // code) we limit to the first two rows + print dolGetFirstLineofText($product_static->description, 2); + print ''.$product_static->barcode.''; - // Since description can be very large (several pages of HTML- - // code) we limit to the first two rows - print dolGetFirstLineofText($product_static->description, 2); - print ''; @@ -1901,7 +1906,6 @@ while ($i < $imaxinloop) { } } - // Multiprices if (!empty($conf->global->PRODUIT_MULTIPRICES)) { if (! isset($productpricescache)) { From de96af8543710d3d8f28e8f8b236c24e09f58292 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 27 Nov 2023 11:24:19 +0100 Subject: [PATCH 094/120] Fix warning php8.2 --- dev/tools/rector/README.md | 9 +- dev/tools/rector/rector.php | 9 + htdocs/core/class/CMailFile.class.php | 70 +++--- htdocs/core/class/CSMSFile.class.php | 6 +- htdocs/core/class/commoninvoice.class.php | 12 +- htdocs/core/class/commonobject.class.php | 32 +-- htdocs/core/class/commonpeople.class.php | 14 +- .../core/class/commonsocialnetworks.class.php | 2 + htdocs/core/class/defaultvalues.class.php | 2 +- htdocs/core/class/doleditor.class.php | 14 +- htdocs/core/class/dolgeoip.class.php | 8 +- htdocs/core/class/dolgraph.class.php | 2 +- htdocs/core/class/dolreceiptprinter.class.php | 2 +- .../core/class/emailsenderprofile.class.php | 2 +- htdocs/core/class/extrafields.class.php | 10 +- htdocs/core/class/extralanguages.class.php | 2 +- htdocs/core/class/fiscalyear.class.php | 2 +- htdocs/core/class/html.form.class.php | 232 +++++++++--------- htdocs/core/class/html.formactions.class.php | 6 +- htdocs/core/class/html.formadmin.class.php | 2 +- htdocs/core/class/html.formcompany.class.php | 30 +-- htdocs/core/class/html.formcontract.class.php | 6 +- htdocs/core/class/html.formfile.class.php | 26 +- htdocs/core/class/html.formmail.class.php | 48 ++-- htdocs/core/class/html.formmargin.class.php | 18 +- htdocs/core/class/html.formother.class.php | 10 +- htdocs/core/class/html.formprojet.class.php | 10 +- htdocs/core/class/html.formticket.class.php | 10 +- htdocs/core/class/ldap.class.php | 6 +- htdocs/core/class/notify.class.php | 8 +- htdocs/core/class/rssparser.class.php | 14 +- htdocs/core/class/smtps.class.php | 18 +- htdocs/core/class/timespent.class.php | 12 +- htdocs/core/class/translate.class.php | 14 +- htdocs/core/class/utils.class.php | 14 +- 35 files changed, 349 insertions(+), 333 deletions(-) diff --git a/dev/tools/rector/README.md b/dev/tools/rector/README.md index 2ffa502f383..859f4bf03c0 100644 --- a/dev/tools/rector/README.md +++ b/dev/tools/rector/README.md @@ -3,12 +3,17 @@ #### Installation -run in this folder +Run in this folder +```shell +cd dev/tools/rector +``` +Install rector with composer ```shell composer install ``` - #### Usage + +#### Usage ##### To make changes (Add --dry-run for test mode only) ```shell diff --git a/dev/tools/rector/rector.php b/dev/tools/rector/rector.php index 1597b9bb27f..42dc4dcfc63 100644 --- a/dev/tools/rector/rector.php +++ b/dev/tools/rector/rector.php @@ -9,6 +9,15 @@ use Rector\Set\ValueObject\LevelSetList; return static function (RectorConfig $rectorConfig): void { $rectorConfig->phpVersion(PhpVersion::PHP_71); //$rectorConfig->indent(' ', 4); + + // Traits seems not supported correctly by rector without declaring them as bootstrapFiles + $arrayoftraitfiles = array( + __DIR__ . '/../../../htdocs/core/class/commonincoterm.class.php', + __DIR__ . '/../../../htdocs/core/class/commonpeople.class.php', + __DIR__ . '/../../../htdocs/core/class/commonsocialnetworks.class.php' + ); + $rectorConfig->bootstrapFiles($arrayoftraitfiles); + $rectorConfig->paths([ __DIR__ . '/../../../htdocs/', __DIR__ . '/../../../scripts/', diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index dc6fa98d8a5..e20820d798d 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -197,14 +197,14 @@ class CMailFile } } if (empty($this->sendmode)) { - $this->sendmode = (!empty($conf->global->MAIN_MAIL_SENDMODE) ? $conf->global->MAIN_MAIL_SENDMODE : 'mail'); + $this->sendmode = (getDolGlobalString('MAIN_MAIL_SENDMODE') ? $conf->global->MAIN_MAIL_SENDMODE : 'mail'); } // We define end of line (RFC 821). $this->eol = "\r\n"; // We define end of line for header fields (RFC 822bis section 2.3 says header must contains \r\n). $this->eol2 = "\r\n"; - if (!empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA)) { + if (getDolGlobalString('MAIN_FIX_FOR_BUGGED_MTA')) { $this->eol = "\n"; $this->eol2 = "\n"; $moreinheader = str_replace("\r\n", "\n", $moreinheader); @@ -249,7 +249,7 @@ class CMailFile // Replace relative /viewimage to absolute path $msg = preg_replace('/src="'.preg_quote(DOL_URL_ROOT, '/').'\/viewimage\.php/ims', 'src="'.$urlwithroot.'/viewimage.php', $msg, -1); - if (!empty($conf->global->MAIN_MAIL_FORCE_CONTENT_TYPE_TO_HTML)) { + if (getDolGlobalString('MAIN_MAIL_FORCE_CONTENT_TYPE_TO_HTML')) { $this->msgishtml = 1; // To force to send everything with content type html. } @@ -258,7 +258,7 @@ class CMailFile $this->html = $msg; $findimg = 0; - if (!empty($conf->global->MAIN_MAIL_ADD_INLINE_IMAGES_IF_IN_MEDIAS)) { // Off by default + if (getDolGlobalString('MAIN_MAIL_ADD_INLINE_IMAGES_IF_IN_MEDIAS')) { // Off by default // Search into the body for error .= '
'.$langs->trans("MailSendSetupIs2", $linktoadminemailbefore, $linktoadminemailend, $langs->transnoentitiesnoconv("MAIN_MAIL_SENDMODE"), $listofmethods['smtps']); $this->errors[] = $langs->trans("MailSendSetupIs2", $linktoadminemailbefore, $linktoadminemailend, $langs->transnoentitiesnoconv("MAIN_MAIL_SENDMODE"), $listofmethods['smtps']); - if (!empty($conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS)) { + if (getDolGlobalString('MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS')) { $this->error .= '
'.$langs->trans("MailSendSetupIs3", $conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS); $this->errors[] = $langs->trans("MailSendSetupIs3", $conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS); } @@ -702,7 +702,7 @@ class CMailFile } // Check number of recipient is lower or equal than MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL - if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_TO_IN_SAME_EMAIL)) { + if (!getDolGlobalString('MAIL_MAX_NB_OF_RECIPIENTS_TO_IN_SAME_EMAIL')) { $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_TO_IN_SAME_EMAIL = 10; } $tmparray1 = explode(',', $this->addr_to); @@ -711,7 +711,7 @@ class CMailFile dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_WARNING); return false; } - if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_CC_IN_SAME_EMAIL)) { + if (!getDolGlobalString('MAIL_MAX_NB_OF_RECIPIENTS_CC_IN_SAME_EMAIL')) { $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_CC_IN_SAME_EMAIL = 10; } $tmparray2 = explode(',', $this->addr_cc); @@ -720,7 +720,7 @@ class CMailFile dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_WARNING); return false; } - if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_BCC_IN_SAME_EMAIL)) { + if (!getDolGlobalString('MAIL_MAX_NB_OF_RECIPIENTS_BCC_IN_SAME_EMAIL')) { $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_BCC_IN_SAME_EMAIL = 10; } $tmparray3 = explode(',', $this->addr_bcc); @@ -729,7 +729,7 @@ class CMailFile dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_WARNING); return false; } - if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL)) { + if (!getDolGlobalString('MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL')) { $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL = 10; } if ((count($tmparray1) + count($tmparray2) + count($tmparray3)) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL) { @@ -803,18 +803,18 @@ class CMailFile if ($res) { $additionnalparam = ''; // By default - if (!empty($conf->global->MAIN_MAIL_ALLOW_SENDMAIL_F)) { + if (getDolGlobalString('MAIN_MAIL_ALLOW_SENDMAIL_F')) { // le "Return-Path" (retour des messages bounced) dans les header ne fonctionne pas avec tous les MTA // Le forcage de la valeur grace à l'option -f de sendmail est donc possible si la constante MAIN_MAIL_ALLOW_SENDMAIL_F est definie. // Having this variable defined may create problems with some sendmail (option -f refused) // Having this variable not defined may create problems with some other sendmail (option -f required) - $additionnalparam .= ($additionnalparam ? ' ' : '').(!empty($conf->global->MAIN_MAIL_ERRORS_TO) ? '-f'.$this->getValidAddress($conf->global->MAIN_MAIL_ERRORS_TO, 2) : ($this->addr_from != '' ? '-f'.$this->getValidAddress($this->addr_from, 2) : '')); + $additionnalparam .= ($additionnalparam ? ' ' : '').(getDolGlobalString('MAIN_MAIL_ERRORS_TO') ? '-f'.$this->getValidAddress($conf->global->MAIN_MAIL_ERRORS_TO, 2) : ($this->addr_from != '' ? '-f'.$this->getValidAddress($this->addr_from, 2) : '')); } - if (!empty($conf->global->MAIN_MAIL_SENDMAIL_FORCE_BA)) { // To force usage of -ba option. This option tells sendmail to read From: or Sender: to setup sender + if (getDolGlobalString('MAIN_MAIL_SENDMAIL_FORCE_BA')) { // To force usage of -ba option. This option tells sendmail to read From: or Sender: to setup sender $additionnalparam .= ($additionnalparam ? ' ' : '').'-ba'; } - if (!empty($conf->global->MAIN_MAIL_SENDMAIL_FORCE_ADDPARAM)) { + if (getDolGlobalString('MAIN_MAIL_SENDMAIL_FORCE_ADDPARAM')) { $additionnalparam .= ($additionnalparam ? ' ' : '').'-U '.$additionnalparam; // Use -U to add additionnal params } @@ -830,7 +830,7 @@ class CMailFile $this->message = stripslashes($this->message); - if (!empty($conf->global->MAIN_MAIL_DEBUG)) { + if (getDolGlobalString('MAIN_MAIL_DEBUG')) { $this->dump_mail(); } @@ -856,7 +856,7 @@ class CMailFile $this->error .= $langs->trans("ErrorPhpMailDelivery"); dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR); - if (!empty($conf->global->MAIN_MAIL_DEBUG)) { + if (getDolGlobalString('MAIN_MAIL_DEBUG')) { $this->save_dump_mail_in_err('Mail with topic '.$this->subject); } } else { @@ -999,13 +999,13 @@ class CMailFile if ($res) { dol_syslog("CMailFile::sendfile: sendMsg, HOST=".$server.", PORT=" . getDolGlobalString($keyforsmtpport), LOG_DEBUG); - if (!empty($conf->global->MAIN_MAIL_DEBUG)) { + if (getDolGlobalString('MAIN_MAIL_DEBUG')) { $this->smtps->setDebug(true); } $result = $this->smtps->sendMsg(); - if (!empty($conf->global->MAIN_MAIL_DEBUG)) { + if (getDolGlobalString('MAIN_MAIL_DEBUG')) { $this->dump_mail(); } @@ -1040,7 +1040,7 @@ class CMailFile dol_syslog("CMailFile::sendfile: mail end error with smtps lib to HOST=".$server.", PORT=" . getDolGlobalString($keyforsmtpport)." - ".$this->error, LOG_ERR); $res = false; - if (!empty($conf->global->MAIN_MAIL_DEBUG)) { + if (getDolGlobalString('MAIN_MAIL_DEBUG')) { $this->save_dump_mail_in_err('Mail smtp error '.$smtperrorcode.' with topic '.$this->subject); } } @@ -1158,7 +1158,7 @@ class CMailFile $this->message->attachSigner($signer->ignoreHeader('Return-Path')); } - if (!empty($conf->global->MAIN_MAIL_DEBUG)) { + if (getDolGlobalString('MAIN_MAIL_DEBUG')) { // To use the ArrayLogger $this->logger = new Swift_Plugins_Loggers_ArrayLogger(); // Or to use the Echo Logger @@ -1175,7 +1175,7 @@ class CMailFile } catch (Exception $e) { $this->errors[] = $e->getMessage(); } - if (!empty($conf->global->MAIN_MAIL_DEBUG)) { + if (getDolGlobalString('MAIN_MAIL_DEBUG')) { $this->dump_mail(); } @@ -1187,7 +1187,7 @@ class CMailFile dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR); $res = false; - if (!empty($conf->global->MAIN_MAIL_DEBUG)) { + if (getDolGlobalString('MAIN_MAIL_DEBUG')) { $this->save_dump_mail_in_err('Mail with topic '.$this->subject); } } else { @@ -1415,7 +1415,7 @@ class CMailFile // Sender //$out.= "Sender: ".getValidAddress($this->addr_from,2)).$this->eol2; $out .= "From: ".$this->getValidAddress($this->addr_from, 3, 1).$this->eol2; - if (!empty($conf->global->MAIN_MAIL_SENDMAIL_FORCE_BA)) { + if (getDolGlobalString('MAIN_MAIL_SENDMAIL_FORCE_BA')) { $out .= "To: ".$this->getValidAddress($this->addr_to, 0, 1).$this->eol2; } // Return-Path is important because it is used by SPF. Some MTA does not read Return-Path from header but from command line. See option MAIN_MAIL_ALLOW_SENDMAIL_F for that. @@ -1526,7 +1526,7 @@ class CMailFile // Make RFC821 Compliant, replace bare linefeeds $strContent = preg_replace("/(?global->MAIN_FIX_FOR_BUGGED_MTA)) { + if (getDolGlobalString('MAIN_FIX_FOR_BUGGED_MTA')) { $strContent = preg_replace("/\r\n/si", "\n", $strContent); // PCRE modifier /s means new lines are common chars } @@ -1536,7 +1536,7 @@ class CMailFile $strContentAltText = preg_replace("/]*>/", " ", $strContent); // TODO We could replace with [Filename.ext] like Gmail do. $strContentAltText = html_entity_decode(strip_tags($strContentAltText)); // Remove any HTML tags - $strContentAltText = trim(wordwrap($strContentAltText, 75, empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA) ? "\r\n" : "\n")); + $strContentAltText = trim(wordwrap($strContentAltText, 75, !getDolGlobalString('MAIN_FIX_FOR_BUGGED_MTA') ? "\r\n" : "\n")); // Check if html header already in message, if not complete the message $strContent = $this->checkIfHTML($strContent); @@ -1545,7 +1545,7 @@ class CMailFile // Make RFC2045 Compliant, split lines //$strContent = rtrim(chunk_split($strContent)); // Function chunck_split seems ko if not used on a base64 content // TODO Encode main content into base64 and use the chunk_split, or quoted-printable - $strContent = rtrim(wordwrap($strContent, 75, empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA) ? "\r\n" : "\n")); // TODO Using this method creates unexpected line break on text/plain content. + $strContent = rtrim(wordwrap($strContent, 75, !getDolGlobalString('MAIN_FIX_FOR_BUGGED_MTA') ? "\r\n" : "\n")); // TODO Using this method creates unexpected line break on text/plain content. if ($this->msgishtml) { if ($this->atleastoneimage) { @@ -1558,7 +1558,7 @@ class CMailFile $out .= "--".$this->related_boundary.$this->eol; } - if (!$this->atleastoneimage && $strContentAltText && !empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) { // Add plain text message part before html part + if (!$this->atleastoneimage && $strContentAltText && getDolGlobalString('MAIN_MAIL_USE_MULTI_PART')) { // Add plain text message part before html part $out .= "Content-Type: multipart/alternative;".$this->eol." boundary=\"".$this->alternative_boundary."\"".$this->eol; $out .= $this->eol; $out .= "--".$this->alternative_boundary.$this->eol; @@ -1572,7 +1572,7 @@ class CMailFile //$out.= "Content-Transfer-Encoding: 7bit".$this->eol; // TODO Use base64 $out .= $this->eol.$strContent.$this->eol; - if (!$this->atleastoneimage && $strContentAltText && !empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) { // Add plain text message part after html part + if (!$this->atleastoneimage && $strContentAltText && getDolGlobalString('MAIN_MAIL_USE_MULTI_PART')) { // Add plain text message part after html part $out .= "--".$this->alternative_boundary."--".$this->eol; } } else { @@ -2010,7 +2010,7 @@ class CMailFile $newemail = '<'.$email.'>'; } if ($format == 0 || $format == 3) { - if (!empty($conf->global->MAIN_MAIL_NO_FULL_EMAIL)) { + if (getDolGlobalString('MAIN_MAIL_NO_FULL_EMAIL')) { $newemail = '<'.$email.'>'; } elseif (!$name) { $newemail = '<'.$email.'>'; @@ -2059,7 +2059,7 @@ class CMailFile $email = trim($val); } - $ret[$email] = empty($conf->global->MAIN_MAIL_NO_FULL_EMAIL) ? $name : null; + $ret[$email] = !getDolGlobalString('MAIN_MAIL_NO_FULL_EMAIL') ? $name : null; } return $ret; diff --git a/htdocs/core/class/CSMSFile.class.php b/htdocs/core/class/CSMSFile.class.php index a282e94640a..a60d5db9f52 100644 --- a/htdocs/core/class/CSMSFile.class.php +++ b/htdocs/core/class/CSMSFile.class.php @@ -136,11 +136,11 @@ class CSMSFile $this->message = stripslashes($this->message); - if (!empty($conf->global->MAIN_SMS_DEBUG)) { + if (getDolGlobalString('MAIN_SMS_DEBUG')) { $this->dump_sms(); } - if (empty($conf->global->MAIN_DISABLE_ALL_SMS)) { + if (!getDolGlobalString('MAIN_DISABLE_ALL_SMS')) { // Action according to the choosed sending method if (getDolGlobalString('MAIN_SMS_SENDMODE')) { $sendmode = getDolGlobalString('MAIN_SMS_SENDMODE'); // $conf->global->MAIN_SMS_SENDMODE looks like a value 'module' @@ -180,7 +180,7 @@ class CSMSFile } else { dol_syslog("CSMSFile::sendfile: sms send success with id=".$res, LOG_DEBUG); //var_dump($res); // 1973128 - if (!empty($conf->global->MAIN_SMS_DEBUG)) { + if (getDolGlobalString('MAIN_SMS_DEBUG')) { $this->dump_sms_result($res); } } diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index dba7c6a4d2e..21ecf232548 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -548,7 +548,7 @@ abstract class CommonInvoice extends CommonObject return 1; } - if (!empty($conf->global->INVOICE_CAN_NEVER_BE_REMOVED)) { + if (getDolGlobalString('INVOICE_CAN_NEVER_BE_REMOVED')) { return 0; } @@ -568,7 +568,7 @@ abstract class CommonInvoice extends CommonObject // If there is no invoice into the reset range and not already dispatched, we can delete // If invoice to delete is last one and not already dispatched, we can delete - if (empty($conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED) && $maxref != '' && $maxref != $this->ref) { + if (!getDolGlobalString('INVOICE_CAN_ALWAYS_BE_REMOVED') && $maxref != '' && $maxref != $this->ref) { return -2; } @@ -585,7 +585,7 @@ abstract class CommonInvoice extends CommonObject } // Test if there is at least one payment. If yes, refuse to delete. - if (empty($conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED) && $this->getSommePaiement() > 0) { + if (!getDolGlobalString('INVOICE_CAN_ALWAYS_BE_REMOVED') && $this->getSommePaiement() > 0) { return -4; } @@ -1099,16 +1099,16 @@ abstract class CommonInvoice extends CommonObject { global $conf, $user, $langs; - if ($type != 'bank-transfer' && $type != 'credit-transfer' && empty($conf->global->STRIPE_SEPA_DIRECT_DEBIT)) { + if ($type != 'bank-transfer' && $type != 'credit-transfer' && !getDolGlobalString('STRIPE_SEPA_DIRECT_DEBIT')) { return 0; } - if ($type != 'direct-debit' && empty($conf->global->STRIPE_SEPA_CREDIT_TRANSFER)) { + if ($type != 'direct-debit' && !getDolGlobalString('STRIPE_SEPA_CREDIT_TRANSFER')) { return 0; } // Set a default value for service if not provided if (empty($service)) { $service = 'StripeTest'; - if (!empty($conf->global->STRIPE_LIVE) && !GETPOST('forcesandbox', 'alpha')) { + if (getDolGlobalString('STRIPE_LIVE') && !GETPOST('forcesandbox', 'alpha')) { $service = 'StripeLive'; } } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index c065dc00fd5..df6b81f814e 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1752,7 +1752,7 @@ abstract class CommonObject $this->thirdparty = $thirdparty; // Use first price level if level not defined for third party - if (!empty($conf->global->PRODUIT_MULTIPRICES) && empty($this->thirdparty->price_level)) { + if (getDolGlobalString('PRODUIT_MULTIPRICES') && empty($this->thirdparty->price_level)) { $this->thirdparty->price_level = 1; } @@ -1815,7 +1815,7 @@ abstract class CommonObject $idtype = $this->barcode_type; if (empty($idtype) && $idtype != '0') { // If type of barcode no set, we try to guess. If set to '0' it means we forced to have type remain not defined - if ($this->element == 'product' && !empty($conf->global->PRODUIT_DEFAULT_BARCODE_TYPE)) { + if ($this->element == 'product' && getDolGlobalString('PRODUIT_DEFAULT_BARCODE_TYPE')) { $idtype = $conf->global->PRODUIT_DEFAULT_BARCODE_TYPE; } elseif ($this->element == 'societe') { $idtype = $conf->global->GENBARCODE_BARCODETYPE_THIRDPARTY; @@ -4628,7 +4628,7 @@ abstract class CommonObject if (empty($id) && empty($ref)) { return 0; } - if (!empty($conf->global->MAIN_DISABLE_CANVAS)) { + if (getDolGlobalString('MAIN_DISABLE_CANVAS')) { return 0; // To increase speed. Not enabled by default. } @@ -5167,7 +5167,7 @@ abstract class CommonObject if (empty($newlang) && GETPOST('lang_id', 'aZ09')) { $newlang = GETPOST('lang_id', 'aZ09'); } - if (!empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE) && empty($newlang) && is_object($this->thirdparty)) { + if (getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE') && empty($newlang) && is_object($this->thirdparty)) { $newlang = $this->thirdparty->default_lang; // To use language of customer } if (!empty($newlang)) { @@ -6306,7 +6306,7 @@ abstract class CommonObject { global $conf; - if (!empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) { + if (getDolGlobalString('MAIN_EXTRAFIELDS_DISABLED')) { return 0; } @@ -6346,7 +6346,7 @@ abstract class CommonObject { global $conf, $langs, $user; - if (!empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) { + if (getDolGlobalString('MAIN_EXTRAFIELDS_DISABLED')) { return 0; } @@ -6403,7 +6403,7 @@ abstract class CommonObject //dol_syslog("attributeType=".$attributeType, LOG_DEBUG); if (!empty($attrfieldcomputed)) { - if (!empty($conf->global->MAIN_STORE_COMPUTED_EXTRAFIELDS)) { + if (getDolGlobalString('MAIN_STORE_COMPUTED_EXTRAFIELDS')) { $value = dol_eval($attrfieldcomputed, 1, 0, '2'); dol_syslog($langs->trans("Extrafieldcomputed")." on ".$attributeLabel."(".$value.")", LOG_DEBUG); $new_array_options[$key] = $value; @@ -6650,7 +6650,7 @@ abstract class CommonObject $error = 0; - if (!empty($conf->global->MAIN_EXTRALANGUAGES_DISABLED)) { + if (getDolGlobalString('MAIN_EXTRALANGUAGES_DISABLED')) { return 0; // For avoid conflicts if trigger used } @@ -6762,7 +6762,7 @@ abstract class CommonObject { global $conf, $langs, $user; - if (!empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) { + if (getDolGlobalString('MAIN_EXTRAFIELDS_DISABLED')) { return 0; } @@ -6809,7 +6809,7 @@ abstract class CommonObject //dol_syslog("attributeLabel=".$attributeLabel, LOG_DEBUG); //dol_syslog("attributeType=".$attributeType, LOG_DEBUG); if (!empty($attrfieldcomputed)) { - if (!empty($conf->global->MAIN_STORE_COMPUTED_EXTRAFIELDS)) { + if (getDolGlobalString('MAIN_STORE_COMPUTED_EXTRAFIELDS')) { $value = dol_eval($attrfieldcomputed, 1, 0, '2'); dol_syslog($langs->trans("Extrafieldcomputed")." sur ".$attributeLabel."(".$value.")", LOG_DEBUG); $this->array_options["options_".$key] = $value; @@ -7045,7 +7045,7 @@ abstract class CommonObject $error = 0; - if (!empty($conf->global->MAIN_EXTRALANGUAGES_DISABLED)) { + if (getDolGlobalString('MAIN_EXTRALANGUAGES_DISABLED')) { return 0; // For avoid conflicts if trigger used } @@ -7260,7 +7260,7 @@ abstract class CommonObject $out = ' '; } elseif ($type == 'select') { // combo list $out = ''; - if (!empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_EXTRAFIELDS_DISABLE_SELECT2)) { + if (!empty($conf->use_javascript_ajax) && !getDolGlobalString('MAIN_EXTRAFIELDS_DISABLE_SELECT2')) { include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; $out .= ajax_combobox($keyprefix.$key.$keysuffix, array(), 0); } @@ -7284,7 +7284,7 @@ abstract class CommonObject $out .= ''; } elseif ($type == 'sellist') { $out = ''; - if (!empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_EXTRAFIELDS_DISABLE_SELECT2)) { + if (!empty($conf->use_javascript_ajax) && !getDolGlobalString('MAIN_EXTRAFIELDS_DISABLE_SELECT2')) { include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; $out .= ajax_combobox($keyprefix.$key.$keysuffix, array(), 0); } @@ -8586,7 +8586,7 @@ abstract class CommonObject $html_id = (empty($this->id) ? '' : 'extrarow-'.$this->element.'_'.$key.'_'.$this->id); if ($display_type=='card') { - if (!empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && ($e % 2) == 0) { + if (getDolGlobalString('MAIN_EXTRAFIELDS_USE_TWO_COLUMS') && ($e % 2) == 0) { $colspan = 0; } @@ -8639,7 +8639,7 @@ abstract class CommonObject if ($display_type == 'card') { $out .= '
'; - print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT), '', 1); + print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0, '', 0, 0, 0, (!getDolGlobalString('SOCIETE_SORT_ON_TYPEENT') ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT), '', 1); print ''; - $out .= $formactions->select_type_actions($actioncode, "actioncode", '', empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : -1, 0, (empty($conf->global->AGENDA_USE_MULTISELECT_TYPE) ? 0 : 1), 1, 'minwidth100 maxwidth150'); + $out .= $formactions->select_type_actions($actioncode, "actioncode", '', !getDolGlobalString('AGENDA_USE_EVENT_TYPE') ? 1 : -1, 0, (!getDolGlobalString('AGENDA_USE_MULTISELECT_TYPE') ? 0 : 1), 1, 'minwidth100 maxwidth150'); $out .= ''; @@ -2036,7 +2036,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin require_once DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php'; $caction = new CActionComm($db); - $arraylist = $caction->liste_array(1, 'code', '', (empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : 0), '', 1); + $arraylist = $caction->liste_array(1, 'code', '', (!getDolGlobalString('AGENDA_USE_EVENT_TYPE') ? 1 : 0), '', 1); foreach ($histo as $key => $value) { $actionstatic->fetch($histo[$key]['id']); // TODO Do we need this, we already have a lot of data of line into $histo @@ -2084,7 +2084,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin // Type $labeltype = $actionstatic->type_code; - if (empty($conf->global->AGENDA_USE_EVENT_TYPE) && empty($arraylist[$labeltype])) { + if (!getDolGlobalString('AGENDA_USE_EVENT_TYPE') && empty($arraylist[$labeltype])) { $labeltype = 'AC_OTH'; } if (!empty($actionstatic->code) && preg_match('/^TICKET_MSG/', $actionstatic->code)) { @@ -2326,7 +2326,7 @@ function addEventTypeSQL(&$sql, $actioncode, $sqlANDOR = "AND") global $conf, $db; // Condition on actioncode - if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) { + if (!getDolGlobalString('AGENDA_USE_EVENT_TYPE')) { if ($actioncode == 'AC_NON_AUTO') { $sql .= " $sqlANDOR c.type != 'systemauto'"; } elseif ($actioncode == 'AC_ALL_AUTO') { diff --git a/htdocs/core/lib/contact.lib.php b/htdocs/core/lib/contact.lib.php index 4e4b74abe6e..d8d74f4056e 100644 --- a/htdocs/core/lib/contact.lib.php +++ b/htdocs/core/lib/contact.lib.php @@ -42,8 +42,8 @@ function contact_prepare_head(Contact $object) $head[$tab][2] = 'card'; $tab++; - if ((!empty($conf->ldap->enabled) && !empty($conf->global->LDAP_CONTACT_ACTIVE)) - && (empty($conf->global->MAIN_DISABLE_LDAP_TAB) || !empty($user->admin))) { + if ((!empty($conf->ldap->enabled) && getDolGlobalString('LDAP_CONTACT_ACTIVE')) + && (!getDolGlobalString('MAIN_DISABLE_LDAP_TAB') || !empty($user->admin))) { $langs->load("ldap"); $head[$tab][0] = DOL_URL_ROOT.'/contact/ldap.php?id='.$object->id; @@ -107,7 +107,7 @@ function contact_prepare_head(Contact $object) complete_head_from_modules($conf, $langs, $object, $head, $tab, 'contact', 'add', 'core'); // Notes - if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) { + if (!getDolGlobalString('MAIN_DISABLE_NOTES_TAB')) { $nbNote = (empty($object->note_private) ? 0 : 1) + (empty($object->note_public) ? 0 : 1); $head[$tab][0] = DOL_URL_ROOT.'/contact/note.php?id='.$object->id; $head[$tab][1] = $langs->trans("Note"); diff --git a/htdocs/core/lib/contract.lib.php b/htdocs/core/lib/contract.lib.php index f5bc76625cb..edc4c0fa8a4 100644 --- a/htdocs/core/lib/contract.lib.php +++ b/htdocs/core/lib/contract.lib.php @@ -41,7 +41,7 @@ function contract_prepare_head(Contrat $object) $head[$h][2] = 'card'; $h++; - if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) { + if (!getDolGlobalString('MAIN_DISABLE_CONTACTS_TAB')) { $nbContact = count($object->liste_contact(-1, 'internal')) + count($object->liste_contact(-1, 'external')); $head[$h][0] = DOL_URL_ROOT.'/contrat/contact.php?id='.$object->id; $head[$h][1] = $langs->trans("ContactsAddresses"); @@ -66,7 +66,7 @@ function contract_prepare_head(Contrat $object) // $this->tabs = array('entity:-tabname); to remove a tab complete_head_from_modules($conf, $langs, $object, $head, $h, 'contract', 'add', 'core'); - if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) { + if (!getDolGlobalString('MAIN_DISABLE_NOTES_TAB')) { $nbNote = 0; if (!empty($object->note_private)) { $nbNote++; diff --git a/htdocs/core/lib/cron.lib.php b/htdocs/core/lib/cron.lib.php index ff8003d4c4c..0232d0b87f4 100644 --- a/htdocs/core/lib/cron.lib.php +++ b/htdocs/core/lib/cron.lib.php @@ -99,13 +99,13 @@ function dol_print_cron_urls() // Cron launch print '
'; print $langs->trans("URLToLaunchCronJobs").':
'; - $url = $urlwithroot.'/public/cron/cron_run_jobs_by_url.php?'.(empty($conf->global->CRON_KEY) ? '' : 'securitykey=' . getDolGlobalString('CRON_KEY').'&').'userlogin='.$user->login; + $url = $urlwithroot.'/public/cron/cron_run_jobs_by_url.php?'.(!getDolGlobalString('CRON_KEY') ? '' : 'securitykey=' . getDolGlobalString('CRON_KEY').'&').'userlogin='.$user->login; print ''; print '
'.$langs->trans("OrToLaunchASpecificJob").'
'; - $url = $urlwithroot.'/public/cron/cron_run_jobs_by_url.php?'.(empty($conf->global->CRON_KEY) ? '' : 'securitykey=' . getDolGlobalString('CRON_KEY').'&').'userlogin='.$user->login.'&id=cronjobid'; + $url = $urlwithroot.'/public/cron/cron_run_jobs_by_url.php?'.(!getDolGlobalString('CRON_KEY') ? '' : 'securitykey=' . getDolGlobalString('CRON_KEY').'&').'userlogin='.$user->login.'&id=cronjobid'; print '