From be87065259a5207e1eef5a974ba74d03e34abac1 Mon Sep 17 00:00:00 2001 From: Zephyriony <142790847+zephyriony@users.noreply.github.com> Date: Wed, 3 Jul 2024 02:59:41 +0200 Subject: [PATCH 01/17] Fix filter bug, overdue invoices from home page (#30214) Co-authored-by: Laurent Destailleur --- htdocs/compta/facture/list.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 87826db56ccd8..22ccb88cdfd57 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -147,8 +147,8 @@ $search_product_category = GETPOST('search_product_category', 'intcomma'); $search_fac_rec_source_title = GETPOST("search_fac_rec_source_title", 'alpha'); -$search_late = GETPOST('search_late'); -if ($search_late == 'late') { +$search_option = GETPOST('search_option'); +if ($search_option == 'late') { $search_status = '1'; } @@ -398,7 +398,7 @@ $toselect = array(); $search_array_options = array(); $search_categ_cus = 0; - $search_late = ''; + $search_option = ''; $socid = 0; } @@ -859,7 +859,7 @@ if ($search_datelimit_end) { $sql .= " AND f.date_lim_reglement <= '".$db->idate($search_datelimit_end)."'"; } -if ($search_late == 'late') { +if ($search_option == 'late') { $sql .= " AND f.date_lim_reglement < '".$db->idate(dol_now() - $conf->facture->client->warning_delay)."'"; } /*if ($search_sale > 0) { @@ -1181,8 +1181,8 @@ if ($show_files) { $param .= '&show_files='.urlencode((string) ($show_files)); } -if ($search_late) { - $param .= "&search_late=".urlencode($search_late); +if ($search_option) { + $param .= "&search_option=".urlencode($search_option); } if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); @@ -1322,7 +1322,7 @@ } // alert on due date $moreforfilter .= '
'; -$moreforfilter .= ''; +$moreforfilter .= ''; $moreforfilter .= '
'; $parameters = array(); From 3ddd6cceba09907aa69ed6b44a538c6ca7dde397 Mon Sep 17 00:00:00 2001 From: atm-jonathan <146709163+atm-jonathan@users.noreply.github.com> Date: Wed, 3 Jul 2024 03:22:42 +0200 Subject: [PATCH 02/17] New box comm card (#30220) * hook retour completeListOfReferent * box comm card.php * commit --- htdocs/comm/card.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 162425c8037bf..fc5a015e8201a 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -1210,7 +1210,9 @@ // print $formfile->getDocumentsLink($contrat->element, $filename, $filedir); print $late; print "\n"; - print ''.dol_trunc($objp->refsup, 12)."\n"; + print ''; + print dol_trunc(strtolower(get_class($object)) == strtolower(Client::class) ? $objp->refcus : $objp->refsup, 12); + print "\n"; //print ''.dol_print_date($db->jdate($objp->dc), 'day')."\n"; print ''.dol_print_date($db->jdate($objp->dcon), 'day')."\n"; print ' '; @@ -1422,7 +1424,7 @@ * Latest invoices */ if (isModEnabled('invoice') && $user->hasRight('facture', 'lire')) { - $sql = 'SELECT f.rowid as facid, f.ref, f.type'; + $sql = 'SELECT f.rowid as facid, f.ref, f.type, f.ref_client'; $sql .= ', f.total_ht'; $sql .= ', f.total_tva'; $sql .= ', f.total_ttc'; @@ -1452,6 +1454,9 @@ if (getDolGlobalString('MAIN_SHOW_PRICE_WITH_TAX_IN_SUMMARIES')) { $colspan++; } + if (getDolGlobalString('MAIN_SHOW_REF_CUSTOMER_INVOICES')) { + $colspan++; + } print ''; print ''; print ''; @@ -1466,6 +1471,7 @@ $facturestatic->id = $objp->facid; $facturestatic->ref = $objp->ref; + $facturestatic->ref_client = $objp->ref_client; $facturestatic->type = $objp->type; $facturestatic->total_ht = $objp->total_ht; $facturestatic->total_tva = $objp->total_tva; @@ -1511,6 +1517,11 @@ // $urlsource = '/compta/facture/card.php?id='.$objp->cid; //print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir); print ''; + if (getDolGlobalString('MAIN_SHOW_REF_CUSTOMER_INVOICES')) { + print ''; + } if ($objp->df > 0) { print ''; } else { @@ -1521,6 +1532,7 @@ } else { print ''; } + print ''; From b0cd32bf68451064c3d17cec05e7fd49aa2c5517 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vincent=20de=20Grandpr=C3=A9?= Date: Tue, 2 Jul 2024 21:29:05 -0400 Subject: [PATCH 03/17] NEW Implementing Billable tasks on projects using new attribute "billable" (#30092) * Implementing Billable task function on projects using new attribute in #30014 * added billable to Task->initAsSpecimen() * default billable to 1 in initAsSpecimen * set billable to 1 in ProjectTest::testTaskCreate * Moving attribut usage in usage_bill_time condition of project * PPDoc * fusion * pre-commit + typo --------- Co-authored-by: Laurent Destailleur --- htdocs/core/lib/project.lib.php | 15 +++++++++++++- htdocs/core/modules/modProjet.class.php | 2 +- htdocs/langs/de_DE/projects.lang | 1 + htdocs/langs/en_US/projects.lang | 1 + htdocs/langs/es_ES/projects.lang | 1 + htdocs/langs/fr_FR/projects.lang | 1 + htdocs/langs/it_IT/projects.lang | 1 + htdocs/projet/class/task.class.php | 25 +++++++++++++++++++----- htdocs/projet/tasks.php | 26 +++++++++++++++++++++++++ htdocs/projet/tasks/task.php | 14 ++++++++++++- htdocs/projet/tasks/time.php | 26 +++++++++++++++++++++---- test/phpunit/ProjectTest.php | 1 + 12 files changed, 102 insertions(+), 12 deletions(-) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 4776907192f0c..2999eb74ac2e3 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -5,7 +5,8 @@ * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2022 Charlene Benke * Copyright (C) 2023 Gauthier VERDOL - * Copyright (C) 2024 MDW + * Copyright (C) 2024 MDW + * Copyright (C) 2024 Vincent de Grandpré * * 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 @@ -691,6 +692,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t $taskstatic->planned_workload = $lines[$i]->planned_workload; $taskstatic->duration_effective = $lines[$i]->duration_effective; $taskstatic->budget_amount = $lines[$i]->budget_amount; + $taskstatic->billable = $lines[$i]->billable; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { @@ -932,6 +934,17 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t print ''; } + // Billable + if (count($arrayfields) > 0 && !empty($arrayfields['t.billable']['checked'])) { + print ''; + } + // Extra fields $extrafieldsobjectkey = $taskstatic->table_element; $extrafieldsobjectprefix = 'efpt.'; diff --git a/htdocs/core/modules/modProjet.class.php b/htdocs/core/modules/modProjet.class.php index d58edcf7de269..a34ea519d2ab0 100644 --- a/htdocs/core/modules/modProjet.class.php +++ b/htdocs/core/modules/modProjet.class.php @@ -266,7 +266,7 @@ public function __construct($db) $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; // Add fields for tasks - $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('pt.rowid'=>'TaskId', 'pt.ref'=>'RefTask', 'pt.label'=>'LabelTask', 'pt.dateo'=>"TaskDateStart", 'pt.datee'=>"TaskDateEnd", 'pt.duration_effective'=>"DurationEffective", 'pt.planned_workload'=>"PlannedWorkload", 'pt.progress'=>"Progress", 'pt.description'=>"TaskDescription")); + $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('pt.rowid'=>'TaskId', 'pt.ref'=>'RefTask', 'pt.label'=>'LabelTask', 'pt.dateo'=>"TaskDateStart", 'pt.datee'=>"TaskDateEnd", 'pt.duration_effective'=>"DurationEffective", 'pt.planned_workload'=>"PlannedWorkload", 'pt.progress'=>"Progress", 'pt.description'=>"TaskDescription", 'pt.billable'=>"Billable")); $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('pt.rowid'=>'projecttask', 'pt.ref'=>'projecttask', 'pt.label'=>'projecttask', 'pt.dateo'=>"projecttask", 'pt.datee'=>"projecttask", 'pt.duration_effective'=>"projecttask", 'pt.planned_workload'=>"projecttask", 'pt.progress'=>"projecttask", 'pt.description'=>"projecttask")); // Add extra fields for task $keyforselect = 'projet_task'; diff --git a/htdocs/langs/de_DE/projects.lang b/htdocs/langs/de_DE/projects.lang index a1cf6c11a82f1..a2fe1e07f22c1 100644 --- a/htdocs/langs/de_DE/projects.lang +++ b/htdocs/langs/de_DE/projects.lang @@ -302,3 +302,4 @@ NewLeadbyWeb=Ihre Nachricht bzw. Anfrage wurde erfasst. Wir werden uns so bald w NewLeadForm=Neues Kontaktformular LeadFromPublicForm=Online-Interessent per öffentlichem Formular ExportAccountingReportButtonLabel=Bericht erhalten +Billable = Verrechenbar diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index 5c0c2bde5fa01..c93a3744b4cf0 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -310,3 +310,4 @@ MergeTasks=Merge tasks TaskMergeSuccess=Tasks have been merged ErrorTaskIdIsMandatory=Error: Task id is mandatory ErrorsTaskMerge=An error occurred while merging tasks +Billable = Billable diff --git a/htdocs/langs/es_ES/projects.lang b/htdocs/langs/es_ES/projects.lang index 6a3714c1d9df4..89012d12a75c9 100644 --- a/htdocs/langs/es_ES/projects.lang +++ b/htdocs/langs/es_ES/projects.lang @@ -302,3 +302,4 @@ NewLeadbyWeb=Su mensaje o solicitud ha sido grabada. Le responderemos o contacta NewLeadForm=Nuevo formulario de contacto LeadFromPublicForm=Cliente potencial en línea desde un formulario público ExportAccountingReportButtonLabel=Obtener informe +Billable = Billable diff --git a/htdocs/langs/fr_FR/projects.lang b/htdocs/langs/fr_FR/projects.lang index 40df6cbc7b91e..295af5d64b743 100644 --- a/htdocs/langs/fr_FR/projects.lang +++ b/htdocs/langs/fr_FR/projects.lang @@ -310,3 +310,4 @@ MergeTasks=Fusionner tâches TaskMergeSuccess=Les tâches ont été fusionnées ErrorTaskIdIsMandatory=Erreur : l'ID de tâche est obligatoire ErrorsTaskMerge=Une erreur s'est produite lors de la fusion des tâches +Billable = Facturable diff --git a/htdocs/langs/it_IT/projects.lang b/htdocs/langs/it_IT/projects.lang index 7458811858d9a..80cb0a69404f9 100644 --- a/htdocs/langs/it_IT/projects.lang +++ b/htdocs/langs/it_IT/projects.lang @@ -302,3 +302,4 @@ NewLeadbyWeb=Il tuo messaggio o richiesta è stato registrato. Ti risponderemo o NewLeadForm=Nuovo modulo di contatto LeadFromPublicForm=Lead online da modulo pubblico ExportAccountingReportButtonLabel=Get report +Billable = Fatturabile diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index df77bf2268e2b..40bb5c1bee614 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -6,7 +6,8 @@ * Copyright (C) 2020 Juanjo Menent * Copyright (C) 2022 Charlene Benke * Copyright (C) 2023 Gauthier VERDOL - * Copyright (C) 2024 MDW + * Copyright (C) 2024 MDW + * Copyright (C) 2024 Vincent de Grandpré * * 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 @@ -270,6 +271,12 @@ class Task extends CommonObjectLine */ public $task_parent_position; + /** + * Status indicate whether the task is billable (time is meant to be added to invoice) '1' or not '0' + * @var int billable + */ + public $billable = 1; + /** * @var float budget_amount */ @@ -362,6 +369,7 @@ public function create($user, $notrigger = 0) $sql .= ", progress"; $sql .= ", budget_amount"; $sql .= ", priority"; + $sql .= ", billable"; $sql .= ") VALUES ("; $sql .= (!empty($this->entity) ? (int) $this->entity : (int) $conf->entity); $sql .= ", ".((int) $this->fk_project); @@ -379,6 +387,7 @@ public function create($user, $notrigger = 0) $sql .= ", ".(($this->progress != '' && $this->progress >= 0) ? ((int) $this->progress) : 'null'); $sql .= ", ".(($this->budget_amount != '' && $this->budget_amount >= 0) ? ((int) $this->budget_amount) : 'null'); $sql .= ", ".(($this->priority != '' && $this->priority >= 0) ? (int) $this->priority : 'null'); + $sql .= ", ".((int) $this->billable); $sql .= ")"; $this->db->begin(); @@ -456,7 +465,8 @@ public function fetch($id, $ref = '', $loadparentdata = 0) $sql .= " t.priority,"; $sql .= " t.note_private,"; $sql .= " t.note_public,"; - $sql .= " t.rang"; + $sql .= " t.rang,"; + $sql .= " t.billable"; if (!empty($loadparentdata)) { $sql .= ", t2.ref as task_parent_ref"; $sql .= ", t2.rang as task_parent_position"; @@ -508,6 +518,7 @@ public function fetch($id, $ref = '', $loadparentdata = 0) $this->task_parent_ref = $obj->task_parent_ref; $this->task_parent_position = $obj->task_parent_position; } + $this->billable = $obj->billable; // Retrieve all extrafield $this->fetch_optionals(); @@ -595,7 +606,8 @@ public function update($user = null, $notrigger = 0) $sql .= " progress=".(($this->progress != '' && $this->progress >= 0) ? $this->progress : 'null').","; $sql .= " budget_amount=".(($this->budget_amount != '' && $this->budget_amount >= 0) ? $this->budget_amount : 'null').","; $sql .= " rang=".((!empty($this->rang)) ? ((int) $this->rang) : "0").","; - $sql .= " priority=".((!empty($this->priority)) ? ((int) $this->priority) : "0"); + $sql .= " priority=".((!empty($this->priority)) ? ((int) $this->priority) : "0").","; + $sql .= " billable=".((int) $this->billable); $sql .= " WHERE rowid=".((int) $this->id); $this->db->begin(); @@ -1020,6 +1032,7 @@ public function initAsSpecimen() $this->priority = 0; $this->note_private = 'This is a specimen private note'; $this->note_public = 'This is a specimen public note'; + $this->billable = 1; return 1; } @@ -1063,7 +1076,7 @@ public function getTasksArray($usert = null, $userp = null, $projectid = 0, $soc $sql .= " p.rowid as projectid, p.ref, p.title as plabel, p.public, p.fk_statut as projectstatus, p.usage_bill_time,"; $sql .= " t.rowid as taskid, t.ref as taskref, t.label, t.description, t.fk_task_parent, t.duration_effective, t.progress, t.fk_statut as status,"; $sql .= " t.dateo as date_start, t.datee as date_end, t.planned_workload, t.rang, t.priority,"; - $sql .= " t.budget_amount,"; + $sql .= " t.budget_amount, t.billable,"; $sql .= " t.note_public, t.note_private,"; $sql .= " s.rowid as thirdparty_id, s.nom as thirdparty_name, s.email as thirdparty_email,"; $sql .= " p.fk_opp_status, p.opp_amount, p.opp_percent, p.budget_amount as project_budget_amount"; @@ -1178,7 +1191,7 @@ public function getTasksArray($usert = null, $userp = null, $projectid = 0, $soc $sql .= " t.datec, t.dateo, t.datee, t.tms,"; $sql .= " t.rowid, t.ref, t.label, t.description, t.fk_task_parent, t.duration_effective, t.progress, t.fk_statut,"; $sql .= " t.dateo, t.datee, t.planned_workload, t.rang, t.priority,"; - $sql .= " t.budget_amount,"; + $sql .= " t.budget_amount, t.billable,"; $sql .= " t.note_public, t.note_private,"; $sql .= " s.rowid, s.nom, s.email,"; $sql .= " p.fk_opp_status, p.opp_amount, p.opp_percent, p.budget_amount"; @@ -1273,6 +1286,8 @@ public function getTasksArray($usert = null, $userp = null, $projectid = 0, $soc $tasks[$i]->thirdparty_name = $obj->thirdparty_name; $tasks[$i]->thirdparty_email = $obj->thirdparty_email; + $tasks[$i]->billable = $obj->billable; + if ($loadextras) { if (!empty($extrafields->attributes['projet']['label'])) { foreach ($extrafields->attributes['projet']['label'] as $key => $val) { diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index ef97960d1262b..f1502d8ee9be0 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -89,6 +89,7 @@ $search_progresscalc = GETPOST('search_progresscalc'); $search_progressdeclare = GETPOST('search_progressdeclare'); $search_task_budget_amount = GETPOST('search_task_budget_amount'); +$search_task_billable = GETPOST('search_task_billable'); $search_date_start_startmonth = GETPOSTINT('search_date_start_startmonth'); $search_date_start_startyear = GETPOSTINT('search_date_start_startyear'); @@ -148,6 +149,7 @@ $progress = GETPOSTINT('progress'); $budget_amount = GETPOSTFLOAT('budget_amount'); +$billable = (GETPOST('billable', 'aZ') == 'yes'? 1 : 0); $label = GETPOST('label', 'alpha'); $description = GETPOST('description', 'restricthtml'); $planned_workloadhour = (GETPOSTISSET('planned_workloadhour') ? GETPOSTINT('planned_workloadhour') : ''); @@ -176,6 +178,7 @@ if ($object->usage_bill_time) { $arrayfields['t.tobill'] = array('label' => $langs->trans("TimeToBill"), 'checked' => 0, 'position' => 11); $arrayfields['t.billed'] = array('label' => $langs->trans("TimeBilled"), 'checked' => 0, 'position' => 12); + $arrayfields['t.billable'] = array('label' => $langs->trans("Billable"), 'checked' => 1, 'position' => 13); } // Extra fields @@ -234,6 +237,7 @@ $search_progresscalc = ''; $search_progressdeclare = ''; $search_task_budget_amount = ''; + $search_task_billable = ''; $toselect = array(); $search_array_options = array(); $search_date_start_startmonth = ""; @@ -315,6 +319,9 @@ if ($search_task_budget_amount) { $morewherefilterarray[] = natural_search('t.budget_amount', $search_task_budget_amount, 1, 1); } +if ($search_task_billable) { + $morewherefilterarray[] = " t.billable = ".($search_task_billable == "yes" ? 1 : 0); +} //var_dump($morewherefilterarray); $morewherefilter = ''; @@ -364,6 +371,7 @@ $task->date_end = $date_end; $task->progress = $progress; $task->budget_amount = $budget_amount; + $task->billable = $billable; // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost(null, $task); @@ -557,6 +565,9 @@ if ($search_task_budget_amount) { $param .= '&search_task_budget_amount='.urlencode($search_task_budget_amount); } + if ($search_task_billable) { + $param .= '&search_task_billable='.urlencode($search_task_billable); + } if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); } @@ -796,6 +807,11 @@ } print ''; + // Billable + print ''; + // Date start task print ''; } + if (!empty($arrayfields['t.billable']['checked'])) { + print ''; + } + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; print ''; @@ -1126,6 +1148,10 @@ if (!empty($arrayfields['c.assigned']['checked'])) { print_liste_field_titre($arrayfields['c.assigned']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'center ', ''); } + + if (!empty($arrayfields['t.billable']['checked'])) { + print_liste_field_titre($arrayfields['t.billable']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'center ', ''); + } // Extra fields $disablesortlink = 1; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index fd8585c588dd2..42baa45edc03f 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -3,7 +3,8 @@ * Copyright (C) 2006-2017 Laurent Destailleur * Copyright (C) 2010-2012 Regis Houssin * Copyright (C) 2018 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024 MDW + * Copyright (C) 2024 Vincent de Grandpré * * 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 @@ -119,6 +120,7 @@ $object->date_end = dol_mktime(GETPOSTINT('date_endhour'), GETPOSTINT('date_endmin'), 0, GETPOSTINT('date_endmonth'), GETPOSTINT('date_endday'), GETPOSTINT('date_endyear')); $object->progress = price2num(GETPOST('progress', 'alphanohtml')); $object->budget_amount = GETPOSTFLOAT('budget_amount'); + $object->billable = (GETPOST('billable', 'aZ') == 'yes' ? 1 : 0); // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET'); @@ -509,6 +511,11 @@ print $formother->select_percent($object->progress, 'progress', 0, 5, 0, 100, 1); print ''; + // Billable + print ''; + // Description print ''; @@ -682,6 +689,11 @@ } print ''; + // Billable + print ''; + // Other attributes $cols = 3; $parameters = array('socid' => $socid); diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 4d020e03ac08d..b65dce3385e5c 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -7,7 +7,8 @@ * Copyright (C) 2018 Frédéric France * Copyright (C) 2019-2021 Christophe Battarel * Copyright (C) 2023 Gauthier VERDOL - * Copyright (C) 2024 MDW + * Copyright (C) 2024 MDW + * Copyright (C) 2024 Vincent de Grandpré * * 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 @@ -1573,7 +1574,8 @@ function setDetailVisibility() { $sql .= " u.lastname, u.firstname, u.login, u.photo, u.gender, u.statut as user_status,"; $sql .= " il.fk_facture as invoice_id, inv.fk_statut,"; $sql .= " p.fk_soc,s.name_alias,"; - $sql .= " t.invoice_line_id"; + $sql .= " t.invoice_line_id,"; + $sql .= " pt.billable"; // Add fields from hooks $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook @@ -2411,6 +2413,7 @@ function setDetailVisibility() { } // Invoiced + $invoiced = false; if (!empty($arrayfields['valuebilled']['checked'])) { print ''; } elseif ($value == 'code' && isset($obj->{$value})) { - print ''; + print ''; } elseif ($value == 'unit') { print ''; } elseif ($value == 'code' && isset($obj->{$value})) { print ''; $colspan++; @@ -1855,6 +1855,7 @@ print ''; + // Title of lines print ''."\n"; print ''; @@ -2115,12 +2116,12 @@ } // Favorite & EEC - Only activated on country dictionary if ($id == DICT_COUNTRY) { - print getTitleFieldOfList($langs->trans("InEEC"), 0, $_SERVER["PHP_SELF"], "eec", ($page ? 'page='.$page.'&' : ''), $param, 'align="center"', $sortfield, $sortorder, '', 0, $langs->trans("CountryIsInEEC")); - print getTitleFieldOfList($langs->trans("Favorite"), 0, $_SERVER["PHP_SELF"], "favorite", ($page ? 'page='.$page.'&' : ''), $param, 'align="center"', $sortfield, $sortorder); + print getTitleFieldOfList($langs->trans("InEEC"), 0, $_SERVER["PHP_SELF"], "eec", ($page ? 'page='.$page.'&' : ''), $param, '', $sortfield, $sortorder, 'center ', 0, $langs->trans("CountryIsInEEC")); + print getTitleFieldOfList($langs->trans("Favorite"), 0, $_SERVER["PHP_SELF"], "favorite", ($page ? 'page='.$page.'&' : ''), $param, '', $sortfield, $sortorder, 'center '); } // Status - print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page ? 'page='.$page.'&' : ''), $param, 'align="center"', $sortfield, $sortorder); + print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page ? 'page='.$page.'&' : ''), $param, '', $sortfield, $sortorder, 'center '); // Action button if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { @@ -2128,8 +2129,10 @@ } print ''; + + // Lines with values if ($num) { - // Lines with values + print ''."\n"; while ($i < $num) { $obj = $db->fetch_object($resql); @@ -2147,7 +2150,7 @@ $iserasable = 1; $canbedisabled = 1; $canbemodified = 1; - if (isset($obj->code) && $id != 10 && $id != 42) { + if (isset($obj->code) && $id != DICT_TVA && $id != DICT_PRODUCT_NATURE) { if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i', $obj->code))) { $iserasable = 0; $canbedisabled = 0; @@ -2193,14 +2196,15 @@ if (empty($rowidcol) || in_array($id, array(DICT_ACTIONCOMM, DICT_CHARGESOCIALES, DICT_TYPENT, DICT_PAIEMENT, DICT_TYPE_FEES, DICT_EFFECTIF, DICT_STCOMM, DICT_HRM_PUBLIC_HOLIDAY))) { $rowidcol = 'rowid'; } - $url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder; - $url .= '&rowid='.(isset($obj->$rowidcol) ? $obj->$rowidcol : (!empty($obj->code) ? urlencode($obj->code) : '')); + $url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.urlencode($sortfield).'&sortorder='.urlencode($sortorder); + $url .= '&rowid='.(isset($obj->$rowidcol) ? ((int) $obj->$rowidcol) : (!empty($obj->code) ? urlencode($obj->code) : '')); $url .= '&code='.(!empty($obj->code) ? urlencode($obj->code) : ''); if (!empty($param)) { $url .= '&'.$param; } + // If dictionary is different for each entity if (!is_null($withentity)) { - $url .= '&entity='.$withentity; + $url .= '&entity='.((int) $withentity); } $url .= '&'; @@ -2254,6 +2258,8 @@ $error = $hookmanager->error; $errors = $hookmanager->errors; + $langs->loadLangs(array("bills", "agenda", "propal")); + if (empty($reshook)) { $withentity = null; @@ -2300,7 +2306,6 @@ if ($value == 'private') { $valuetoshow = yn($valuetoshow); } elseif ($value == 'libelle_facture') { - $langs->load("bills"); $key = $langs->trans("PaymentCondition".strtoupper($obj->code)); $valuetoshow = ($obj->code && $key != "PaymentCondition".strtoupper($obj->code) ? $key : $obj->$value); $valuetoshow = nl2br($valuetoshow); @@ -2308,7 +2313,6 @@ $key = $langs->trans("Country".strtoupper($obj->code)); $valuetoshow = ($obj->code && $key != "Country".strtoupper($obj->code) ? $key : $obj->$value); } elseif ($value == 'label' && $tabname[$id] == 'c_availability') { - $langs->load("propal"); $key = $langs->trans("AvailabilityType".strtoupper($obj->code)); $valuetoshow = ($obj->code && $key != "AvailabilityType".strtoupper($obj->code) ? $key : $obj->$value); } elseif ($value == 'libelle' && $tabname[$id] == 'c_actioncomm') { @@ -2327,17 +2331,22 @@ $key = $langs->trans("Civility".strtoupper($obj->code)); $valuetoshow = ($obj->code && $key != "Civility".strtoupper($obj->code) ? $key : $obj->$value); } elseif ($value == 'libelle' && $tabname[$id] == 'c_type_contact') { - $langs->load('agenda'); $key = $langs->trans("TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code)); $valuetoshow = ($obj->code && $key != "TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code) ? $key : $obj->$value); } elseif ($value == 'libelle' && $tabname[$id] == 'c_payment_term') { - $langs->load("bills"); $key = $langs->trans("PaymentConditionShort".strtoupper($obj->code)); $valuetoshow = ($obj->code && $key != "PaymentConditionShort".strtoupper($obj->code) ? $key : $obj->$value); } elseif ($value == 'libelle' && $tabname[$id] == 'c_paiement') { - $langs->load("bills"); + $transavailableforcode = $langs->tab_translate["PaymentType".strtoupper($obj->code)]; $key = $langs->trans("PaymentType".strtoupper($obj->code)); - $valuetoshow = ($obj->code && $key != "PaymentType".strtoupper($obj->code) ? $key : $obj->$value); + $valuetoshow = $obj->$value; + if ($obj->code && $transavailableforcode) { + $htmltext = $form->textwithpicto($langs->trans("TranslationFound").': '.$key, $langs->trans("TheTranslationIsSearchedFromKey", "PaymentType".strtoupper($obj->code))); + } else { + $htmltext = $form->textwithpicto($langs->trans("TranslationFound").': '.$langs->trans("No"), $langs->trans("TheTranslationIsSearchedFromKey", "PaymentType".strtoupper($obj->code))); + } + //$valuetoshow = $form->textwithpicto($valuetoshow, $htmltext); + $valuetoshow .= '
'.$htmltext.''; } elseif ($value == 'type' && $tabname[$id] == 'c_paiement') { $payment_type_list = array(0 => $langs->trans('PaymentTypeCustomer'), 1 => $langs->trans('PaymentTypeSupplier'), 2 => $langs->trans('PaymentTypeBoth')); $valuetoshow = $payment_type_list[$valuetoshow]; @@ -2442,6 +2451,9 @@ } } $class .= ($class ? ' ' : '').'tddict'; + if ($value == 'name') { + $class .= ' tdoverflowmax200'; + } if ($value == 'note' && $id == DICT_TVA) { $class .= ' tdoverflowmax200'; } @@ -2462,7 +2474,7 @@ } // Show value for field if ($showfield) { - print ''; + print ''; } } @@ -2623,7 +2635,7 @@ */ function fieldList($fieldlist, $obj = null, $tabname = '', $context = '') { - global $conf, $langs, $db, $mysoc; + global $langs, $db, $mysoc; global $form; global $region_id; global $elementList, $sourceList, $localtax_typeList, $type_vatList; @@ -2641,6 +2653,7 @@ function fieldList($fieldlist, $obj = null, $tabname = '', $context = '') } if (in_array($value, array('code', 'libelle', 'type')) && $tabname == "c_actioncomm" && isset($obj->$value) && in_array($obj->type, array('system', 'systemauto'))) { + // Special case for c_actioncomm (field that should not be modified) $hidden = (!empty($obj->{$value}) ? $obj->{$value} : ''); print '
'.$langs->trans("LastCustomersBills", ($num <= $MAXLIST ? "" : $MAXLIST)).''.$langs->trans("AllBills").''.$num.''.img_picto($langs->trans("Statistics"), 'stats').''; + print $objp->ref_client; + print ''.dol_print_date($db->jdate($objp->df), 'day').'!!!'; print price($objp->total_ht); print ''; + if ($lines[$i]->billable) { + print ''.$langs->trans('Yes').''; + } else { + print ''.$langs->trans('No').''; + } + print '
'.$langs->trans("Billable").''; + print $form->selectyesno('billable'); + print '
'.$langs->trans("DateStart").''; print img_picto('', 'action', 'class="pictofixedwidth"'); @@ -1054,6 +1070,12 @@ print ''; + print $form->selectyesno('search_task_billable', $search_task_billable, 0, false, 1); + print ' 
'.$langs->trans("Billable").''; + print $form->selectyesno('billable', $object->billable); + print '
'.$langs->trans("Description").'
'.$langs->trans("Billable").''; + print ''.($object->billable ? $langs->trans('Yes') : $langs->trans('No')).''; + print '
'; // invoice_id and invoice_line_id if (!getDolGlobalString('PROJECT_HIDE_TASKS') && getDolGlobalString('PROJECT_BILL_TIME_SPENT')) { @@ -2432,8 +2435,13 @@ function setDetailVisibility() { } } } + $invoiced = true; } else { - print $langs->trans("No"); + if ( intval($task_time->billable) == 1) { + print $langs->trans("No"); + } else { + print $langs->trans("Disabled"); + } } } else { print '' . $langs->trans("NA") . ''; @@ -2485,7 +2493,17 @@ function setDetailVisibility() { $selected = 1; } print ' '; - print ''; + // Disable select if task not billable or already invoiced + $disabled = (intval($task_time->billable) !=1 || $invoiced); + $ctrl = ''; + if ($disabled) { + // If disabled, a dbl-click very close outside the control + // will re-enable it, so that user is not blocked if needed. + print ''.$ctrl.''; + print ''; + } else { + print $ctrl; + } } } } diff --git a/test/phpunit/ProjectTest.php b/test/phpunit/ProjectTest.php index 89ab46c146146..152bc0361db38 100644 --- a/test/phpunit/ProjectTest.php +++ b/test/phpunit/ProjectTest.php @@ -165,6 +165,7 @@ public function testTaskCreate($idproject) $localobject = new Task($db); $localobject->initAsSpecimen(); $localobject->fk_project = $idproject; + $localobject->billable = 1; $result = $localobject->create($user); $this->assertLessThan($result, 0); From 21e4c0e73cacb037b92000ce86f63fcd777d54d5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 3 Jul 2024 18:35:19 +0200 Subject: [PATCH 04/17] Clean code --- htdocs/core/class/html.formcompany.class.php | 2 +- htdocs/resource/class/html.formresource.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index 3295f966b6b13..b6a506e4e8082 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -331,7 +331,7 @@ public function select_state($selected = 0, $country_codeid = 0, $htmlname = 'st // Si traduction existe, on l'utilise, sinon on prend le libelle par default if ( getDolGlobalString('MAIN_SHOW_STATE_CODE') && - (getDolGlobalInt('MAIN_SHOW_STATE_CODE') == 1 || getDolGlobalInt('MAIN_SHOW_STATE_CODE') == 2 || $conf->global->MAIN_SHOW_STATE_CODE === 'all') + (getDolGlobalInt('MAIN_SHOW_STATE_CODE') == 1 || getDolGlobalInt('MAIN_SHOW_STATE_CODE') == 2 || getDolGlobalString('MAIN_SHOW_STATE_CODE') === 'all') ) { if (getDolGlobalInt('MAIN_SHOW_REGION_IN_STATE_SELECT') == 1) { $out .= $obj->region_name . ' - ' . $obj->code . ' - ' . ($langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : ($obj->name != '-' ? $obj->name : '')); diff --git a/htdocs/resource/class/html.formresource.class.php b/htdocs/resource/class/html.formresource.class.php index 5471287c9f79f..4251565256433 100644 --- a/htdocs/resource/class/html.formresource.class.php +++ b/htdocs/resource/class/html.formresource.class.php @@ -348,7 +348,7 @@ public function select_state($selected = 0, $country_codeid = 0, $htmlname = 'st // If translation exists use it, otherwise use default name if ( getDolGlobalString('MAIN_SHOW_STATE_CODE') && - (getDolGlobalInt('MAIN_SHOW_STATE_CODE') == 1 || getDolGlobalInt('MAIN_SHOW_STATE_CODE') == 2 || $conf->global->MAIN_SHOW_STATE_CODE === 'all') + (getDolGlobalInt('MAIN_SHOW_STATE_CODE') == 1 || getDolGlobalInt('MAIN_SHOW_STATE_CODE') == 2 || getDolGlobalString('MAIN_SHOW_STATE_CODE') === 'all') ) { if (getDolGlobalInt('MAIN_SHOW_REGION_IN_STATE_SELECT') == 1) { $out .= $obj->region_name . ' - ' . $obj->code . ' - ' . ($langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : ($obj->name != '-' ? $obj->name : '')); From fa4247a8125d3cd528dfdcbed767619e553632c4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 3 Jul 2024 19:35:06 +0200 Subject: [PATCH 05/17] More valid rector rules to change conf->global->xxx --- dev/tools/rector/rector.php | 13 ++++-- .../rector/src/Renaming/GlobalToFunction.php | 41 +++++++++++-------- 2 files changed, 33 insertions(+), 21 deletions(-) diff --git a/dev/tools/rector/rector.php b/dev/tools/rector/rector.php index 0d527997b8334..154a01f3cec27 100644 --- a/dev/tools/rector/rector.php +++ b/dev/tools/rector/rector.php @@ -48,6 +48,7 @@ __DIR__ . '/../../../scripts/', __DIR__ . '/../../../test/phpunit/', ]); + $rectorConfig->skip([ '**/includes/**', '**/custom/**', @@ -55,6 +56,7 @@ '**/rector/**', // Disable this line to test the "test.php" file. __DIR__ . '/../../../htdocs/custom/', __DIR__ . '/../../../htdocs/install/doctemplates/*' + //'test.php', ]); $rectorConfig->parallel(240); @@ -70,9 +72,9 @@ //$rectorConfig->rule(ReplaceEachAssignmentWithKeyCurrentRector::class); + $rectorConfig->rule(Rector\CodeQuality\Rector\FuncCall\FloatvalToTypeCastRector::class); $rectorConfig->rule(Rector\CodeQuality\Rector\FuncCall\BoolvalToTypeCastRector::class); - $rectorConfig->rule(Rector\CodeQuality\Rector\NotEqual\CommonNotEqualRector::class); //Not yet ready: $rectorconfig->rule(Rector\CodeQuality\Rector\If_\CompleteMissingIfElseBracketRector::class); $rectorConfig->rule(Rector\CodeQuality\Rector\For_\ForRepeatedCountToOwnVariableRector::class); @@ -82,11 +84,16 @@ $rectorConfig->rule(Dolibarr\Rector\Renaming\UserRightsToFunction::class); //$rectorConfig->rule(Dolibarr\Rector\Renaming\UsePositiveExit::class); + + // This fix <> into != but it breaks other rules, so added at end. + $rectorConfig->rule(Rector\CodeQuality\Rector\NotEqual\CommonNotEqualRector::class); + + // Add all predefined rules to migrate to up to php 71. // Warning this break tab spacing of arrays on several lines /*$rectorConfig->sets([ - LevelSetList::UP_TO_PHP_70 - ]);*/ + LevelSetList::UP_TO_PHP_70 + ]);*/ // Add predefined rules for a given version only //$rectorConfig->import(SetList::PHP_70); //$rectorConfig->import(SetList::PHP_71); diff --git a/dev/tools/rector/src/Renaming/GlobalToFunction.php b/dev/tools/rector/src/Renaming/GlobalToFunction.php index 302a2ff4a2a4a..1c98c9671f654 100644 --- a/dev/tools/rector/src/Renaming/GlobalToFunction.php +++ b/dev/tools/rector/src/Renaming/GlobalToFunction.php @@ -64,8 +64,8 @@ public function getRuleDefinition(): RuleDefinition [new CodeSample( '$conf->global->CONSTANT', 'getDolGlobalInt(\'CONSTANT\')' - )] - ); + )] + ); } /** @@ -133,7 +133,7 @@ public function refactor(Node $node) $node->dim = new FuncCall( new Name('getDolGlobalString'), [new Arg($constName)] - ); + ); } return $node; } @@ -208,7 +208,7 @@ public function refactor(Node $node) $leftConcat = new FuncCall( new Name('getDolGlobalString'), [new Arg($constName)] - ); + ); $rightConcat = $node->right; } if ($this->isGlobalVar($node->right)) { @@ -219,7 +219,7 @@ public function refactor(Node $node) $rightConcat = new FuncCall( new Name('getDolGlobalString'), [new Arg($constName)] - ); + ); $leftConcat = $node->left; } if (!isset($leftConcat, $rightConcat)) { @@ -238,6 +238,7 @@ public function refactor(Node $node) $node = $nodes->getFirstExpr(); } + // Now process all comparison like: // $conf->global->... Operator Value @@ -264,11 +265,14 @@ public function refactor(Node $node) $typeofcomparison = 'NotIdentical'; //var_dump($node->left); } + if (empty($typeofcomparison)) { return; } - if (!$this->isGlobalVar($node->left)) { + $isconfglobal = $this->isGlobalVar($node->left); + if (!$isconfglobal) { + // The left side is not conf->global->xxx, so we leave return; } @@ -282,7 +286,8 @@ public function refactor(Node $node) $funcName = 'getDolGlobalString'; break; default: - return; + $funcName = 'getDolGlobalString'; + break; } $constName = $this->getConstName($node->left); @@ -295,9 +300,9 @@ public function refactor(Node $node) new FuncCall( new Name($funcName), [new Arg($constName)] - ), + ), $node->right - ); + ); } if ($typeofcomparison == 'NotEqual') { return new NotEqual( @@ -313,36 +318,36 @@ public function refactor(Node $node) new FuncCall( new Name($funcName), [new Arg($constName)] - ), + ), $node->right - ); + ); } if ($typeofcomparison == 'GreaterOrEqual') { return new GreaterOrEqual( new FuncCall( new Name($funcName), [new Arg($constName)] - ), + ), $node->right - ); + ); } if ($typeofcomparison == 'Smaller') { return new Smaller( new FuncCall( new Name($funcName), [new Arg($constName)] - ), + ), $node->right - ); + ); } if ($typeofcomparison == 'SmallerOrEqual') { return new SmallerOrEqual( new FuncCall( new Name($funcName), [new Arg($constName)] - ), + ), $node->right - ); + ); } if ($typeofcomparison == 'NotIdentical') { return new NotIdentical( @@ -382,7 +387,7 @@ function (Node $node): bool { } return \true; } - ); + ); } /** From 9af159cdd815f89571a52320201cfdbaa881e60a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 3 Jul 2024 20:05:29 +0200 Subject: [PATCH 06/17] Replace "! empty($conf->global->$" with "getDolGlobalString($" --- htdocs/compta/facture/class/facture.class.php | 2 +- htdocs/core/class/CMailFile.class.php | 18 +++++++++--------- htdocs/core/class/translate.class.php | 6 +++--- htdocs/core/lib/ajax.lib.php | 4 ++-- htdocs/core/lib/pdf.lib.php | 4 ++-- htdocs/core/menus/standard/auguria.lib.php | 2 +- htdocs/core/menus/standard/eldy.lib.php | 2 +- .../doc/doc_generic_asset_odt.modules.php | 2 +- .../bom/doc/doc_generic_bom_odt.modules.php | 2 +- .../modules/cheque/doc/pdf_blochet.class.php | 2 +- .../doc/doc_generic_order_odt.modules.php | 2 +- .../doc/doc_generic_contract_odt.modules.php | 2 +- .../doc/doc_generic_shipment_odt.modules.php | 2 +- .../doc/doc_generic_invoice_odt.modules.php | 2 +- .../mrp/doc/doc_generic_mo_odt.modules.php | 2 +- .../doc/doc_generic_product_odt.modules.php | 2 +- .../doc/doc_generic_proposal_odt.modules.php | 2 +- .../doc/doc_generic_reception_odt.modules.php | 2 +- .../doc/doc_generic_stock_odt.modules.php | 2 +- ...oc_generic_supplier_invoice_odt.modules.php | 2 +- .../doc_generic_supplier_order_odt.modules.php | 2 +- ...c_generic_supplier_proposal_odt.modules.php | 2 +- .../doc/doc_generic_usergroup_odt.modules.php | 2 +- htdocs/product/admin/product.php | 4 ++-- .../eventorganization/subscriptionok.php | 2 +- htdocs/public/onlinesign/newonlinesign.php | 2 +- htdocs/public/opensurvey/index.php | 2 +- htdocs/public/payment/newpayment.php | 6 +++--- htdocs/public/payment/paymentko.php | 4 ++-- htdocs/public/payment/paymentok.php | 2 +- htdocs/public/project/viewandvote.php | 2 +- htdocs/public/recruitment/index.php | 2 +- htdocs/public/recruitment/view.php | 2 +- .../class/html.formwebportal.class.php | 2 +- 34 files changed, 50 insertions(+), 50 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 79dc23859830d..88c88da59010c 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -3224,7 +3224,7 @@ public function validate($user, $force_number = '', $idwarehouse = 0, $notrigger // Check for mandatory prof id (but only if country is other than ours) if ($mysoc->country_id > 0 && $this->thirdparty->country_id == $mysoc->country_id) { $idprof_mandatory = 'SOCIETE_'.$key.'_INVOICE_MANDATORY'; - if (!$vallabel && !empty($conf->global->$idprof_mandatory)) { + if (!$vallabel && getDolGlobalString($idprof_mandatory)) { $langs->load("errors"); $this->error = $langs->trans('ErrorProdIdIsMandatory', $langs->transcountry('ProfId'.$i, $this->thirdparty->country_code)).' ('.$langs->trans("ForbiddenBySetupRules").') ['.$langs->trans('Company').' : '.$this->thirdparty->name.']'; dol_syslog(__METHOD__.' '.$this->error, LOG_ERR); diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index a4bd1e2426cdb..28ebd8c0dfcb9 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -1035,10 +1035,10 @@ public function sendfile() // If we use SSL/TLS $server = getDolGlobalString($keyforsmtpserver); $secure = ''; - if (!empty($conf->global->$keyfortls) && function_exists('openssl_open')) { + if (getDolGlobalString($keyfortls) && function_exists('openssl_open')) { $secure = 'ssl'; } - if (!empty($conf->global->$keyforstarttls) && function_exists('openssl_open')) { + if (getDolGlobalString($keyforstarttls) && function_exists('openssl_open')) { $secure = 'tls'; } $server = ($secure ? $secure.'://' : '').$server; @@ -1050,11 +1050,11 @@ public function sendfile() $loginid = ''; $loginpass = ''; - if (!empty($conf->global->$keyforsmtpid)) { + if (getDolGlobalString($keyforsmtpid)) { $loginid = getDolGlobalString($keyforsmtpid); $this->smtps->setID($loginid); } - if (!empty($conf->global->$keyforsmtppw)) { + if (getDolGlobalString($keyforsmtppw)) { $loginpass = getDolGlobalString($keyforsmtppw); $this->smtps->setPW($loginpass); } @@ -1199,19 +1199,19 @@ public function sendfile() // If we use SSL/TLS $server = getDolGlobalString($keyforsmtpserver); $secure = ''; - if (!empty($conf->global->$keyfortls) && function_exists('openssl_open')) { + if (getDolGlobalString($keyfortls) && function_exists('openssl_open')) { $secure = 'ssl'; } - if (!empty($conf->global->$keyforstarttls) && function_exists('openssl_open')) { + if (getDolGlobalString($keyforstarttls) && function_exists('openssl_open')) { $secure = 'tls'; } $this->transport = new Swift_SmtpTransport($server, getDolGlobalString($keyforsmtpport), $secure); - if (!empty($conf->global->$keyforsmtpid)) { + if (getDolGlobalString($keyforsmtpid)) { $this->transport->setUsername($conf->global->$keyforsmtpid); } - if (!empty($conf->global->$keyforsmtppw) && getDolGlobalString($keyforsmtpauthtype) != "XOAUTH2") { + if (getDolGlobalString($keyforsmtppw) && getDolGlobalString($keyforsmtpauthtype) != "XOAUTH2") { $this->transport->setPassword($conf->global->$keyforsmtppw); } if (getDolGlobalString($keyforsmtpauthtype) === "XOAUTH2") { @@ -1864,7 +1864,7 @@ public function check_server_port($host, $port) } // If we use SSL/TLS - if (!empty($conf->global->$keyfortls) && function_exists('openssl_open')) { + if (getDolGlobalString($keyfortls) && function_exists('openssl_open')) { $host = 'ssl://'.$host; } // tls smtp start with no encryption diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index 92b32d2f25720..f0b5ded8db641 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -437,7 +437,7 @@ public function load($domain, $alt = 0, $stopafterdirection = 0, $forcelangdir = // Kept for backward compatibility. if (empty($loadfromfileonly)) { $overwritekey = 'MAIN_OVERWRITE_TRANS_' . $this->defaultlang; - if (!empty($conf->global->$overwritekey)) { // Overwrite translation with key1:newstring1,key2:newstring2 + if (getDolGlobalString($overwritekey)) { // Overwrite translation with key1:newstring1,key2:newstring2 // Overwrite translation with param MAIN_OVERWRITE_TRANS_xx_XX $tmparray = explode(',', getDolGlobalString($overwritekey)); foreach ($tmparray as $tmp) { @@ -683,7 +683,7 @@ public function trans($key, $param1 = '', $param2 = '', $param3 = '', $param4 = // Make some string replacement after translation $replacekey = 'MAIN_REPLACE_TRANS_' . $this->defaultlang; - if (!empty($conf->global->$replacekey)) { // Replacement translation variable with string1:newstring1;string2:newstring2 + if (getDolGlobalString($replacekey)) { // Replacement translation variable with string1:newstring1;string2:newstring2 $tmparray = explode(';', getDolGlobalString($replacekey)); foreach ($tmparray as $tmp) { $tmparray2 = explode(':', $tmp); @@ -777,7 +777,7 @@ public function transnoentitiesnoconv($key, $param1 = '', $param2 = '', $param3 // Make some string replacement after translation $replacekey = 'MAIN_REPLACE_TRANS_' . $this->defaultlang; - if (!empty($conf->global->$replacekey)) { // Replacement translation variable with string1:newstring1;string2:newstring2 + if (getDolGlobalString($replacekey)) { // Replacement translation variable with string1:newstring1;string2:newstring2 $tmparray = explode(';', getDolGlobalString($replacekey)); foreach ($tmparray as $tmp) { $tmparray2 = explode(':', $tmp); diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index f21101cd1aef2..06c89bef1bbe9 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -697,8 +697,8 @@ function ajax_constantonoff($code, $input = array(), $entity = null, $revertonof '."\n"; $out .= ''; - $out .= ''.($revertonoff ? img_picto($langs->trans("Enabled"), 'switch_on', '', false, 0, 0, '', '', $marginleftonlyshort) : img_picto($langs->trans("Disabled"), 'switch_off', '', false, 0, 0, '', '', $marginleftonlyshort)).''; - $out .= ''.($revertonoff ? img_picto($langs->trans("Disabled"), 'switch_off'.$suffix, '', false, 0, 0, '', '', $marginleftonlyshort) : img_picto($langs->trans("Enabled"), 'switch_on'.$suffix, '', false, 0, 0, '', '', $marginleftonlyshort)).''; + $out .= ''.($revertonoff ? img_picto($langs->trans("Enabled"), 'switch_on', '', false, 0, 0, '', '', $marginleftonlyshort) : img_picto($langs->trans("Disabled"), 'switch_off', '', false, 0, 0, '', '', $marginleftonlyshort)).''; + $out .= ''.($revertonoff ? img_picto($langs->trans("Disabled"), 'switch_off'.$suffix, '', false, 0, 0, '', '', $marginleftonlyshort) : img_picto($langs->trans("Enabled"), 'switch_on'.$suffix, '', false, 0, 0, '', '', $marginleftonlyshort)).''; $out .= "\n"; } diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index ca1d72e1cd36e..8bab1e1bd0e71 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1029,7 +1029,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ $dims = $pdf->getPageDimensions(); // Line of free text - if (empty($hidefreetext) && !empty($conf->global->$paramfreetext)) { + if (empty($hidefreetext) && getDolGlobalString($paramfreetext)) { $substitutionarray = pdf_getSubstitutionArray($outputlangs, null, $object); // More substitution keys $substitutionarray['__FROM_NAME__'] = $fromcompany->name; @@ -1633,7 +1633,7 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, // Check if description must be output if (!empty($object->element)) { $tmpkey = 'MAIN_DOCUMENTS_HIDE_DESCRIPTION_FOR_'.strtoupper($object->element); - if (!empty($conf->global->$tmpkey)) { + if (getDolGlobalString($tmpkey)) { $hidedesc = 1; } } diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php index 0d91d521370a4..a3fda66b87ab3 100644 --- a/htdocs/core/menus/standard/auguria.lib.php +++ b/htdocs/core/menus/standard/auguria.lib.php @@ -467,7 +467,7 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t while ($i <= $MAXFTP) { $paramkey = 'FTP_NAME_'.$i; //print $paramkey; - if (!empty($conf->global->$paramkey)) { + if (getDolGlobalString($paramkey)) { $link = "/ftp/index.php?idmenu=".$_SESSION["idmenu"]."&numero_ftp=".$i; $newmenu->add($link, dol_trunc($conf->global->$paramkey, 24)); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 65ad8a26263d7..b2f3e48a76e5b 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -873,7 +873,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM while ($i <= $MAXFTP) { $paramkey = 'FTP_NAME_'.$i; //print $paramkey; - if (!empty($conf->global->$paramkey)) { + if (getDolGlobalString($paramkey)) { $link = "/ftp/index.php?idmenu=".$_SESSION["idmenu"]."&numero_ftp=".$i; $newmenu->add($link, dol_trunc($conf->global->$paramkey, 24)); } diff --git a/htdocs/core/modules/asset/doc/doc_generic_asset_odt.modules.php b/htdocs/core/modules/asset/doc/doc_generic_asset_odt.modules.php index 3d767b59571a4..a04f323bcb306 100644 --- a/htdocs/core/modules/asset/doc/doc_generic_asset_odt.modules.php +++ b/htdocs/core/modules/asset/doc/doc_generic_asset_odt.modules.php @@ -322,7 +322,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails // Line of free text $newfreetext = ''; $paramfreetext = 'ORDER_FREE_TEXT'; - if (!empty($conf->global->$paramfreetext)) { + if (getDolGlobalString($paramfreetext)) { $newfreetext = make_substitutions(getDolGlobalString($paramfreetext), $substitutionarray); } diff --git a/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php b/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php index 9233a93f151b1..89347b5b0c1b5 100644 --- a/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php +++ b/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php @@ -323,7 +323,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails // Line of free text $newfreetext = ''; $paramfreetext = 'BOM_FREE_TEXT'; - if (!empty($conf->global->$paramfreetext)) { + if (getDolGlobalString($paramfreetext)) { $newfreetext = make_substitutions(getDolGlobalString($paramfreetext), $substitutionarray); } diff --git a/htdocs/core/modules/cheque/doc/pdf_blochet.class.php b/htdocs/core/modules/cheque/doc/pdf_blochet.class.php index 5cecdaa413dcc..babd72f3d68fd 100644 --- a/htdocs/core/modules/cheque/doc/pdf_blochet.class.php +++ b/htdocs/core/modules/cheque/doc/pdf_blochet.class.php @@ -445,7 +445,7 @@ protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) complete_substitutions_array($substitutionarray, $outputlangs, $object); $newfreetext = ''; $paramfreetext = 'BANK_CHEQUERECEIPT_FREE_TEXT'; - if (!empty($conf->global->$paramfreetext)) { + if (getDolGlobalString($paramfreetext)) { $newfreetext = make_substitutions(getDolGlobalString($paramfreetext), $substitutionarray); } diff --git a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php index 529ca3a85398a..0dd24592bb414 100644 --- a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php +++ b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php @@ -333,7 +333,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails // Line of free text $newfreetext = ''; $paramfreetext = 'ORDER_FREE_TEXT'; - if (!empty($conf->global->$paramfreetext)) { + if (getDolGlobalString($paramfreetext)) { $newfreetext = make_substitutions(getDolGlobalString($paramfreetext), $substitutionarray); } diff --git a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php index c5b938fe8f16a..0112484d973b9 100644 --- a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php +++ b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php @@ -344,7 +344,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails // Line of free text $newfreetext = ''; $paramfreetext = 'CONTRACT_FREE_TEXT'; - if (!empty($conf->global->$paramfreetext)) { + if (getDolGlobalString($paramfreetext)) { $newfreetext = make_substitutions(getDolGlobalString($paramfreetext), $tmparray); } diff --git a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php index 50d33d378d306..f2a1d1ee530a6 100644 --- a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php +++ b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php @@ -331,7 +331,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails // Line of free text $newfreetext = ''; $paramfreetext = 'EXPEDITION_FREE_TEXT'; - if (!empty($conf->global->$paramfreetext)) { + if (getDolGlobalString($paramfreetext)) { $newfreetext = make_substitutions(getDolGlobalString($paramfreetext), $substitutionarray); } diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php index d279edc8b01fe..e03194f9f415d 100644 --- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php +++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php @@ -373,7 +373,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails // Line of free text $newfreetext = ''; $paramfreetext = 'INVOICE_FREE_TEXT'; - if (!empty($conf->global->$paramfreetext)) { + if (getDolGlobalString($paramfreetext)) { $newfreetext = make_substitutions(getDolGlobalString($paramfreetext), $substitutionarray); } diff --git a/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php b/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php index 1a784af2dcbf0..f19deec6f4c67 100644 --- a/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php +++ b/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php @@ -316,7 +316,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails // Line of free text $newfreetext = ''; $paramfreetext = 'MRP_MO_FREE_TEXT'; - if (!empty($conf->global->$paramfreetext)) { + if (getDolGlobalString($paramfreetext)) { $newfreetext = make_substitutions(getDolGlobalString($paramfreetext), $substitutionarray); } diff --git a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php index 85450edf7f07d..13d913dc4605e 100644 --- a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php +++ b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php @@ -328,7 +328,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails // Line of free text $newfreetext = ''; $paramfreetext = 'PRODUCT_FREE_TEXT'; - if (!empty($conf->global->$paramfreetext)) { + if (getDolGlobalString($paramfreetext)) { $newfreetext = make_substitutions(getDolGlobalString($paramfreetext), $substitutionarray); } diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php index e5fddcddd5fda..9f60a58023493 100644 --- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php +++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php @@ -365,7 +365,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails // Line of free text $newfreetext = ''; $paramfreetext = 'PROPOSAL_FREE_TEXT'; - if (!empty($conf->global->$paramfreetext)) { + if (getDolGlobalString($paramfreetext)) { $newfreetext = make_substitutions(getDolGlobalString($paramfreetext), $substitutionarray); } diff --git a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php index c51179964e279..6d8c91419f932 100644 --- a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php +++ b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php @@ -326,7 +326,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails // Line of free text $newfreetext = ''; $paramfreetext = 'RECEPTION_FREE_TEXT'; - if (!empty($conf->global->$paramfreetext)) { + if (getDolGlobalString($paramfreetext)) { $newfreetext = make_substitutions(getDolGlobalString($paramfreetext), $substitutionarray); } diff --git a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php index 4db3e9f93d291..d4d838f3475ab 100644 --- a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php +++ b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php @@ -327,7 +327,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails // Line of free text $newfreetext = ''; $paramfreetext = 'stock_FREE_TEXT'; - if (!empty($conf->global->$paramfreetext)) { + if (getDolGlobalString($paramfreetext)) { $newfreetext = make_substitutions(getDolGlobalString($paramfreetext), $substitutionarray); } diff --git a/htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php b/htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php index 8246efc372d6f..c84c52cb7291f 100644 --- a/htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php +++ b/htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php @@ -329,7 +329,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails // Line of free text $newfreetext = ''; $paramfreetext = 'INVOICE_FREE_TEXT'; - if (!empty($conf->global->$paramfreetext)) { + if (getDolGlobalString($paramfreetext)) { $newfreetext = make_substitutions(getDolGlobalString($paramfreetext), $substitutionarray); } diff --git a/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php b/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php index a6750022925f9..a7d4da8c27864 100644 --- a/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php +++ b/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php @@ -324,7 +324,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails // Line of free text $newfreetext = ''; $paramfreetext = 'ORDER_FREE_TEXT'; - if (!empty($conf->global->$paramfreetext)) { + if (getDolGlobalString($paramfreetext)) { $newfreetext = make_substitutions(getDolGlobalString($paramfreetext), $substitutionarray); } diff --git a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php index 17e7fb8ae2c9a..db87bed9cce49 100644 --- a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php @@ -353,7 +353,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails // Line of free text $newfreetext = ''; $paramfreetext = 'SUPPLIER_PROPOSAL_FREE_TEXT'; - if (!empty($conf->global->$paramfreetext)) { + if (getDolGlobalString($paramfreetext)) { $newfreetext = make_substitutions(getDolGlobalString($paramfreetext), $substitutionarray); } diff --git a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php index cabdf9611aa44..475a1f555fe12 100644 --- a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php +++ b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php @@ -352,7 +352,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails // Line of free text $newfreetext = ''; $paramfreetext = 'user_FREE_TEXT'; - if (!empty($conf->global->$paramfreetext)) { + if (getDolGlobalString($paramfreetext)) { $newfreetext = make_substitutions(getDolGlobalString($paramfreetext), $substitutionarray); } diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index 82759e7a8d55f..67380570aad8f 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -61,11 +61,11 @@ 'PRODUIT_CUSTOMER_PRICES' => $langs->trans('PriceByCustomer'), // Different price for each customer ); $keyforparam = 'PRODUIT_CUSTOMER_PRICES_BY_QTY'; -if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 1 || !empty($conf->global->$keyforparam)) { +if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 1 || getDolGlobalString($keyforparam)) { $select_pricing_rules['PRODUIT_CUSTOMER_PRICES_BY_QTY'] = $langs->trans('PriceByQuantity').' ('.$langs->trans("VersionExperimental").')'; // TODO If this is enabled, price must be hidden when price by qty is enabled, also price for quantity must be used when adding product into order/propal/invoice } $keyforparam = 'PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES'; -if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2 || !empty($conf->global->$keyforparam)) { +if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2 || getDolGlobalString($keyforparam)) { $select_pricing_rules['PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES'] = $langs->trans('MultiPricesAbility').'+'.$langs->trans('PriceByQuantity').' ('.$langs->trans("VersionExperimental").')'; } diff --git a/htdocs/public/eventorganization/subscriptionok.php b/htdocs/public/eventorganization/subscriptionok.php index fab5a6e70bfc4..a4416a3e849db 100644 --- a/htdocs/public/eventorganization/subscriptionok.php +++ b/htdocs/public/eventorganization/subscriptionok.php @@ -178,7 +178,7 @@ function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $ $logosmall = $mysoc->logo_small; $logo = $mysoc->logo; $paramlogo = 'ONLINE_PAYMENT_LOGO_'.$suffix; -if (!empty($conf->global->$paramlogo)) { +if (getDolGlobalString($paramlogo)) { $logosmall = getDolGlobalString($paramlogo); } elseif (getDolGlobalString('ONLINE_PAYMENT_LOGO')) { $logosmall = getDolGlobalString('ONLINE_PAYMENT_LOGO'); diff --git a/htdocs/public/onlinesign/newonlinesign.php b/htdocs/public/onlinesign/newonlinesign.php index b38b114089626..fb3890a478bf4 100644 --- a/htdocs/public/onlinesign/newonlinesign.php +++ b/htdocs/public/onlinesign/newonlinesign.php @@ -268,7 +268,7 @@ $logosmall = $mysoc->logo_small; $logo = $mysoc->logo; $paramlogo = 'ONLINE_SIGN_LOGO_'.$suffix; -if (!empty($conf->global->$paramlogo)) { +if (getDolGlobalString($paramlogo)) { $logosmall = getDolGlobalString($paramlogo); } elseif (getDolGlobalString('ONLINE_SIGN_LOGO')) { $logosmall = getDolGlobalString('ONLINE_SIGN_LOGO'); diff --git a/htdocs/public/opensurvey/index.php b/htdocs/public/opensurvey/index.php index b07b047d58640..54d98ebccf5e6 100644 --- a/htdocs/public/opensurvey/index.php +++ b/htdocs/public/opensurvey/index.php @@ -135,7 +135,7 @@ $logosmall = $mysoc->logo_small; $logo = $mysoc->logo; $paramlogo = 'ONLINE_OPENSURVEY_LOGO_'.$suffix; -if (!empty($conf->global->$paramlogo)) { +if (getDolGlobalString($paramlogo)) { $logosmall = getDolGlobalString($paramlogo); } elseif (getDolGlobalString('ONLINE_OPENSURVEY_LOGO')) { $logosmall = getDolGlobalString('ONLINE_OPENSURVEY_LOGO_'); diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index d6d7edd6e967e..177c4ae64c0bf 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -345,9 +345,9 @@ $creditor = $mysoc->name; $paramcreditor = 'ONLINE_PAYMENT_CREDITOR'; $paramcreditorlong = 'ONLINE_PAYMENT_CREDITOR_'.$suffix; -if (!empty($conf->global->$paramcreditorlong)) { +if (getDolGlobalString($paramcreditorlong)) { $creditor = getDolGlobalString($paramcreditorlong); // use label long of the seller to show -} elseif (!empty($conf->global->$paramcreditor)) { +} elseif (getDolGlobalString($paramcreditor)) { $creditor = getDolGlobalString($paramcreditor); // use label short of the seller to show } @@ -897,7 +897,7 @@ $logosmall = $mysoc->logo_small; $logo = $mysoc->logo; $paramlogo = 'ONLINE_PAYMENT_LOGO_'.$suffix; -if (!empty($conf->global->$paramlogo)) { +if (getDolGlobalString($paramlogo)) { $logosmall = getDolGlobalString($paramlogo); } elseif (getDolGlobalString('ONLINE_PAYMENT_LOGO')) { $logosmall = getDolGlobalString('ONLINE_PAYMENT_LOGO'); diff --git a/htdocs/public/payment/paymentko.php b/htdocs/public/payment/paymentko.php index 4cd8a67fdf6b7..fc550a763b725 100644 --- a/htdocs/public/payment/paymentko.php +++ b/htdocs/public/payment/paymentko.php @@ -233,7 +233,7 @@ $logosmall = $mysoc->logo_small; $logo = $mysoc->logo; $paramlogo = 'ONLINE_PAYMENT_LOGO_'.$suffix; - if (!empty($conf->global->$paramlogo)) { + if (getDolGlobalString($paramlogo)) { $logosmall = getDolGlobalString($paramlogo); } elseif (getDolGlobalString('ONLINE_PAYMENT_LOGO')) { $logosmall = getDolGlobalString('ONLINE_PAYMENT_LOGO'); @@ -275,7 +275,7 @@ print $langs->trans("YourPaymentHasNotBeenRecorded")."

"; $key = 'ONLINE_PAYMENT_MESSAGE_KO'; - if (!empty($conf->global->$key)) { + if (getDolGlobalString($key)) { print $conf->global->$key; } diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index 082ac3c4d1d7a..2fac1e73f716a 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -220,7 +220,7 @@ $logosmall = $mysoc->logo_small; $logo = $mysoc->logo; $paramlogo = 'ONLINE_PAYMENT_LOGO_'.$suffix; - if (!empty($conf->global->$paramlogo)) { + if (getDolGlobalString($paramlogo)) { $logosmall = getDolGlobalString($paramlogo); } elseif (getDolGlobalString('ONLINE_PAYMENT_LOGO')) { $logosmall = getDolGlobalString('ONLINE_PAYMENT_LOGO'); diff --git a/htdocs/public/project/viewandvote.php b/htdocs/public/project/viewandvote.php index 7c088fa724933..3b30add23087c 100644 --- a/htdocs/public/project/viewandvote.php +++ b/htdocs/public/project/viewandvote.php @@ -236,7 +236,7 @@ $logosmall = $mysoc->logo_small; $logo = $mysoc->logo; $paramlogo = 'ONLINE_PAYMENT_LOGO_'.$suffix; -if (!empty($conf->global->$paramlogo)) { +if (getDolGlobalString($paramlogo)) { $logosmall = getDolGlobalString($paramlogo); } elseif (getDolGlobalString('ONLINE_PAYMENT_LOGO')) { $logosmall = getDolGlobalString('ONLINE_PAYMENT_LOGO'); diff --git a/htdocs/public/recruitment/index.php b/htdocs/public/recruitment/index.php index 5615e8133e20f..586d3d8f87254 100644 --- a/htdocs/public/recruitment/index.php +++ b/htdocs/public/recruitment/index.php @@ -136,7 +136,7 @@ $logosmall = $mysoc->logo_small; $logo = $mysoc->logo; $paramlogo = 'ONLINE_RECRUITMENT_LOGO_'.$suffix; -if (!empty($conf->global->$paramlogo)) { +if (getDolGlobalString($paramlogo)) { $logosmall = getDolGlobalString($paramlogo); } elseif (getDolGlobalString('ONLINE_RECRUITMENT_LOGO')) { $logosmall = getDolGlobalString('ONLINE_RECRUITMENT_LOGO_'); diff --git a/htdocs/public/recruitment/view.php b/htdocs/public/recruitment/view.php index 60b5191d468fd..228f29633f684 100644 --- a/htdocs/public/recruitment/view.php +++ b/htdocs/public/recruitment/view.php @@ -198,7 +198,7 @@ $logosmall = $mysoc->logo_small; $logo = $mysoc->logo; $paramlogo = 'ONLINE_RECRUITMENT_LOGO_'.$suffix; -if (!empty($conf->global->$paramlogo)) { +if (getDolGlobalString($paramlogo)) { $logosmall = getDolGlobalString($paramlogo); } elseif (getDolGlobalString('ONLINE_RECRUITMENT_LOGO')) { $logosmall = getDolGlobalString('ONLINE_RECRUITMENT_LOGO'); diff --git a/htdocs/webportal/class/html.formwebportal.class.php b/htdocs/webportal/class/html.formwebportal.class.php index 662f8f9835a22..232dc10e8ffaa 100644 --- a/htdocs/webportal/class/html.formwebportal.class.php +++ b/htdocs/webportal/class/html.formwebportal.class.php @@ -556,7 +556,7 @@ public function selectForFormsList($objecttmp, $htmlname, $preselectedvalue, $sh $textifempty = ' '; //if (!empty($conf->use_javascript_ajax) || $forcecombo) $textifempty=''; - if (!empty($conf->global->$confkeyforautocompletemode)) { + if (getDolGlobalString($confkeyforautocompletemode)) { if ($showempty && !is_numeric($showempty)) { $textifempty = $langs->trans($showempty); } else { From 1d35417963673df95de575e5fb06ae626f0e0291 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 3 Jul 2024 22:00:16 +0200 Subject: [PATCH 07/17] FIX Can't modifiy the payment code that is reserved --- htdocs/admin/dict.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 00bdb4e644662..b9625cd952142 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -2756,7 +2756,15 @@ function fieldList($fieldlist, $obj = null, $tabname = '', $context = '') } elseif ($value == 'price' || preg_match('/^amount/i', $value)) { print '
'; + if ($tabname == 'c_paiement' && in_array($obj->{$value}, array('LIQ', 'CB', 'VIR'))) { + // Case of code that should not be modified + print ''; + print $obj->{$value}; + } else { + print ''; + } + print ''; $units = array( From 24feabc2e2e0f79c1f900c5f6fd75e37c4684fd5 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 4 Jul 2024 09:06:10 +0200 Subject: [PATCH 08/17] NEW Thirdparty - Can upload a file with drag and drop (#30263) --- htdocs/societe/card.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 95b620c091d01..16772f72f194f 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -6,17 +6,17 @@ * Copyright (C) 2005-2017 Regis Houssin * Copyright (C) 2008 Patrick Raguin * Copyright (C) 2010-2020 Juanjo Menent - * Copyright (C) 2011-2023 Alexandre Spangaro + * Copyright (C) 2011-2024 Alexandre Spangaro * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2015 Marcos García * Copyright (C) 2015 Raphaël Doursenaud - * Copyright (C) 2018 Nicolas ZABOURI - * Copyright (C) 2018 Ferran Marcet + * Copyright (C) 2018 Nicolas ZABOURI + * Copyright (C) 2018 Ferran Marcet * Copyright (C) 2018-2022 Frédéric France - * Copyright (C) 2022-2023 George Gkantinas + * Copyright (C) 2022-2023 George Gkantinas * Copyright (C) 2023 Nick Fragoulis * Copyright (C) 2023 Alexandre Janniaux - * Copyright (C) 2024 MDW + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -2674,7 +2674,7 @@ function init_check_no_email(input) { $head = societe_prepare_head($object); - print dol_get_fiche_head($head, 'card', $langs->trans("ThirdParty"), -1, 'company'); + print dol_get_fiche_head($head, 'card', $langs->trans("ThirdParty"), -1, 'company', 0, '', '', 0, '', 1); $formconfirm = ''; From 9e194a8d5d564671c393722e844d113e8ab123f2 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 4 Jul 2024 09:08:05 +0200 Subject: [PATCH 09/17] NEW Member - Can upload a file with drag and drop (#30265) --- htdocs/adherents/card.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index bed2df3a64c06..99eb76ee0bf7f 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -5,10 +5,10 @@ * Copyright (C) 2005-2018 Regis Houssin * Copyright (C) 2012 Marcos García * Copyright (C) 2012-2020 Philippe Grand - * Copyright (C) 2015-2018 Alexandre Spangaro + * Copyright (C) 2015-2024 Alexandre Spangaro * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2021 Waël Almoman - * Copyright (C) 2024 MDW + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -36,6 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; @@ -1453,7 +1454,7 @@ function initfieldrequired() { */ $head = member_prepare_head($object); - print dol_get_fiche_head($head, 'general', $langs->trans("Member"), -1, 'user'); + print dol_get_fiche_head($head, 'general', $langs->trans("Member"), -1, 'user', 0, '', '', 0, '', 1); // Confirm create user if ($action == 'create_user') { From 3e6d7e229c97a0d0e87974fdb55306f02f495f27 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 4 Jul 2024 09:36:46 +0200 Subject: [PATCH 10/17] CHQ is also a reserved code. --- htdocs/admin/dict.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index b9625cd952142..fff485006a831 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -2757,7 +2757,7 @@ function fieldList($fieldlist, $obj = null, $tabname = '', $context = '') print ''; - if ($tabname == 'c_paiement' && in_array($obj->{$value}, array('LIQ', 'CB', 'VIR'))) { + if ($tabname == 'c_paiement' && in_array($obj->{$value}, array('LIQ', 'CB', 'CHQ', 'VIR'))) { // Case of code that should not be modified print ''; print $obj->{$value}; From c7cd4999ffe49b9f5d10455fdd60b79efa3e6037 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 4 Jul 2024 11:09:33 +0200 Subject: [PATCH 11/17] Look and feel v21 --- htdocs/admin/dict.php | 49 +++++++++++++++++---------- htdocs/core/class/html.form.class.php | 4 +-- htdocs/core/class/translate.class.php | 2 -- htdocs/langs/en_US/admin.lang | 2 ++ 4 files changed, 35 insertions(+), 22 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index fff485006a831..0d62fc9808264 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1837,8 +1837,8 @@ } // Active - print ''; - print $form->selectyesno('search_active', $search_active, 0, false, 1); + print ''; + print $form->selectyesno('search_active', $search_active, 0, false, 1, 1, 'maxwidth100 onrightofpage', 'Activated', 'Disabled'); print '
'.$valuetoshow.''.$valuetoshow.''; print ''; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index ec51a50d8a523..0d831e9c6c52f 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -9713,7 +9713,7 @@ public function showLinkToObjectBlock($object, $restrictlinksto = array(), $excl * @param string $labelno Label for No * @return string See option */ - public function selectyesno($htmlname, $value = '', $option = 0, $disabled = false, $useempty = 0, $addjscombo = 0, $morecss = '', $labelyes = 'Yes', $labelno = 'No') + public function selectyesno($htmlname, $value = '', $option = 0, $disabled = false, $useempty = 0, $addjscombo = 0, $morecss = 'width75', $labelyes = 'Yes', $labelno = 'No') { global $langs; @@ -9726,7 +9726,7 @@ public function selectyesno($htmlname, $value = '', $option = 0, $disabled = fal $disabled = ($disabled ? ' disabled' : ''); - $resultyesno = '' . "\n"; if ($useempty) { $resultyesno .= '' . "\n"; } diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index f0b5ded8db641..534aa18773e65 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -676,8 +676,6 @@ private function getTradFromKey($key) */ public function trans($key, $param1 = '', $param2 = '', $param3 = '', $param4 = '', $maxsize = 0) { - global $conf; - if (!empty($this->tab_translate[$key])) { // Translation is available $str = $this->tab_translate[$key]; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index c855e128a5743..75ae2c85f882f 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1169,6 +1169,8 @@ NoLocalTaxXForThisCountry=According to the setup of taxes (See %s - %s - %s), yo LabelUsedByDefault=Label used by default if no translation can be found for code LabelOnDocuments=Label on documents LabelOrTranslationKey=Label or translation key +TranslationFound=Translation found +TheTranslationIsSearchedFromKey=The translation is searched from the translation key: %s TranslationKey=Translation key ValueOfConstantKey=Value of a configuration constant ConstantIsOn=Option %s is on From b04577d69bb3fa726fc2bd1466b18bcfab387f71 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 4 Jul 2024 13:44:15 +0200 Subject: [PATCH 12/17] css --- htdocs/theme/eldy/global.inc.php | 2 +- htdocs/theme/md/style.css.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 97920df5a305f..4e563a97b0a5b 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -6426,7 +6426,7 @@ vertical-align: top; } div#ecm-layout-center { - width: calc(100% - 390px); + width: calc(100% - 405px); vertical-align: top; float: right; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 004a79f2582de..d4e4e492595d5 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -6406,7 +6406,7 @@ vertical-align: top; } div#ecm-layout-center { - width: calc(100% - 390px); + width: calc(100% - 405px); vertical-align: top; float: right; } From 1c5558e2fc03d2fb90c4cea1c949d9ee16133dd9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 4 Jul 2024 14:13:17 +0200 Subject: [PATCH 13/17] Look and feel calendar --- htdocs/theme/eldy/global.inc.php | 18 +++++++++++++++++- htdocs/theme/md/style.css.php | 18 +++++++++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 4e563a97b0a5b..18c6d3c3e6e3b 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -5458,7 +5458,7 @@ /* ============================================================================== */ -/* Calendar picker */ +/* Calendar date picker */ /* ============================================================================== */ .ui-datepicker-calendar .ui-state-default, .ui-datepicker-calendar .ui-widget-content .ui-state-default, @@ -5468,6 +5468,22 @@ border: unset; } +div#ui-datepicker-div { + width: 300px; + box-shadow: 2px 5px 15px #aaa; + border: unset; + padding-left: 5px; + padding-right: 5px; + padding-top: 5px; +} +.ui-datepicker .ui-datepicker table { + font-size: unset; +} +.ui-datepicker .ui-widget-header { + border: unset; + background: unset; +} + img.datecallink { padding-left: 2px !important; padding-right: 2px !important; } select.ui-datepicker-year { diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index d4e4e492595d5..912a0688734cc 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -5450,7 +5450,7 @@ /* ============================================================================== */ -/* Calendar picker */ +/* Calendar date picker */ /* ============================================================================== */ .ui-datepicker-calendar .ui-state-default, .ui-datepicker-calendar .ui-widget-content .ui-state-default, @@ -5460,6 +5460,22 @@ border: unset; } +div#ui-datepicker-div { + width: 300px; + box-shadow: 2px 5px 15px #aaa; + border: unset; + padding-left: 5px; + padding-right: 5px; + padding-top: 5px; +} +.ui-datepicker .ui-datepicker table { + font-size: unset; +} +.ui-datepicker .ui-widget-header { + border: unset; + background: unset; +} + img.datecallink { padding-left: 2px !important; padding-right: 2px !important; } select.ui-datepicker-year { From c82abb2f28f4d54a9a54150b5cd28717cdf7cb53 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 4 Jul 2024 17:16:11 +0200 Subject: [PATCH 14/17] NEW Product/Service - Can upload a file with drag and drop (#30250) --- htdocs/product/card.php | 46 ++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index c734af74e7cd8..871bac2e52a73 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1,26 +1,26 @@ - * Copyright (C) 2004-2016 Laurent Destailleur - * Copyright (C) 2005 Eric Seigne - * Copyright (C) 2005-2015 Regis Houssin - * Copyright (C) 2006 Andre Cianfarani - * Copyright (C) 2006 Auguria SARL - * Copyright (C) 2010-2015 Juanjo Menent - * Copyright (C) 2013-2016 Marcos García - * Copyright (C) 2012-2013 Cédric Salvador - * Copyright (C) 2011-2023 Alexandre Spangaro - * Copyright (C) 2014 Cédric Gross - * Copyright (C) 2014-2015 Ferran Marcet - * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2015 Raphaël Doursenaud - * Copyright (C) 2016-2022 Charlene Benke - * Copyright (C) 2016 Meziane Sof - * Copyright (C) 2017 Josep Lluís Amador - * Copyright (C) 2019-2024 Frédéric France - * Copyright (C) 2019-2020 Thibault FOUCART - * Copyright (C) 2020 Pierre Ardoin - * Copyright (C) 2022 Vincent de Grandpré - * Copyright (C) 2024 MDW +/* Copyright (C) 2001-2007 Rodolphe Quiedeville + * Copyright (C) 2004-2016 Laurent Destailleur + * Copyright (C) 2005 Eric Seigne + * Copyright (C) 2005-2015 Regis Houssin + * Copyright (C) 2006 Andre Cianfarani + * Copyright (C) 2006 Auguria SARL + * Copyright (C) 2010-2015 Juanjo Menent + * Copyright (C) 2013-2016 Marcos García + * Copyright (C) 2012-2013 Cédric Salvador + * Copyright (C) 2011-2023 Alexandre Spangaro + * Copyright (C) 2014 Cédric Gross + * Copyright (C) 2014-2015 Ferran Marcet + * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2015 Raphaël Doursenaud + * Copyright (C) 2016-2022 Charlene Benke + * Copyright (C) 2016 Meziane Sof + * Copyright (C) 2017 Josep Lluís Amador + * Copyright (C) 2019-2024 Frédéric France + * Copyright (C) 2019-2020 Thibault FOUCART + * Copyright (C) 2020 Pierre Ardoin + * Copyright (C) 2022 Vincent de Grandpré + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1955,7 +1955,7 @@ $head = product_prepare_head($object); $titre = $langs->trans("CardProduct".$object->type); $picto = ($object->type == Product::TYPE_SERVICE ? 'service' : 'product'); - print dol_get_fiche_head($head, 'card', $titre, 0, $picto); + print dol_get_fiche_head($head, 'card', $titre, 0, $picto, 0, '', '', 0, '', 1); // Call Hook tabContentEditProduct $parameters = array(); From 29f223fd3c0c5414ac5820770a2563c1ec219c1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 4 Jul 2024 17:47:31 +0200 Subject: [PATCH 15/17] fix checkFunctionArgumentTypes (#30249) * fix checkFunctionArgumentTypes * fix checkFunctionArgumentTypes * fix checkFunctionArgumentTypes * fix checkFunctionArgumentTypes * fix checkFunctionArgumentTypes * fix checkFunctionArgumentTypes * fix checkFunctionArgumentTypes * fix checkFunctionArgumentTypes * fix checkFunctionArgumentTypes --- htdocs/contrat/class/contrat.class.php | 4 +-- htdocs/core/lib/functions2.lib.php | 2 +- .../core/modules/asset/mod_asset_advanced.php | 6 ++-- htdocs/core/modules/bom/mod_bom_advanced.php | 2 +- .../cheque/mod_chequereceipt_thyme.php | 16 ++++++---- .../modules/contract/mod_contract_magre.php | 16 ++++++---- .../holiday/mod_holiday_immaculate.php | 12 +++++--- .../modules/product_batch/mod_sn_advanced.php | 19 ++++++------ .../modules/product_batch/mod_sn_free.php | 9 +++++- .../stock/doc/pdf_standard.modules.php | 2 +- htdocs/ecm/class/ecmfiles.class.php | 4 +-- .../class/emailcollector.class.php | 2 +- htdocs/expedition/card.php | 6 ++-- .../mod_knowledgerecord_advanced.php | 4 +-- .../mymodule/mod_myobject_advanced.php | 4 +-- .../partnership/mod_partnership_advanced.php | 4 +-- htdocs/reception/card.php | 5 ++-- .../mod_recruitmentcandidature_advanced.php | 2 +- .../mod_recruitmentjobposition_advanced.php | 2 +- ...recruitment_recruitmentcandidature.lib.php | 2 +- htdocs/user/group/list.php | 4 +-- phpstan.neon.dist | 29 +++++++++---------- 22 files changed, 89 insertions(+), 67 deletions(-) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 985587f09dfd3..dac55d099e327 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -2796,9 +2796,9 @@ public function doAutoRenewContracts($thirdparty_id = 0, $delayindaysshort = 0) if ($expirationdate && $expirationdate < $enddatetoscan) { dol_syslog("Define the newdate of end of services from expirationdate=".$expirationdate); $newdate = $expirationdate; - $protecti = 0; //$protecti is to avoid infinite loop + $protecti = 0; // $protecti is to avoid infinite loop while ($newdate < $enddatetoscan && $protecti < 1000) { - $newdate = dol_time_plus_duree($newdate, $duration_value, $duration_unit); + $newdate = dol_time_plus_duree($newdate, (int) $duration_value, $duration_unit); $protecti++; } diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 00deffe10ad7d..3277bb7ab3c9f 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -893,7 +893,7 @@ function array2table($data, $tableMarkup = 1, $tableoptions = '', $troptions = ' * @param string $table Table containing field with counter * @param string $field Field containing already used values of counter * @param string $where To add a filter on selection (for example to filter on invoice types) - * @param Societe|string $objsoc The company that own the object we need a counter for + * @param Societe|'' $objsoc The company that own the object we need a counter for * @param string $date Date to use for the {y},{m},{d} tags. * @param string $mode 'next' for next value or 'last' for last value * @param bool $bentityon Activate the entity filter. Default is true (for modules not compatible with multicompany) diff --git a/htdocs/core/modules/asset/mod_asset_advanced.php b/htdocs/core/modules/asset/mod_asset_advanced.php index a1f800d309dce..a0aa657d536a6 100644 --- a/htdocs/core/modules/asset/mod_asset_advanced.php +++ b/htdocs/core/modules/asset/mod_asset_advanced.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2007 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) - * Copyright (C) 2019-2022 Frédéric France + * Copyright (C) 2019-2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -98,7 +98,7 @@ public function info($langs) */ public function getExample() { - global $conf, $db, $langs, $mysoc; + global $db, $langs; $object = new Asset($db); $object->initAsSpecimen(); @@ -133,7 +133,7 @@ public function getNextValue($object) $date = $object->date; - $numFinal = get_next_value($db, $mask, 'asset', 'ref', '', null, $date); + $numFinal = get_next_value($db, $mask, 'asset', 'ref', '', '', $date); return $numFinal; } diff --git a/htdocs/core/modules/bom/mod_bom_advanced.php b/htdocs/core/modules/bom/mod_bom_advanced.php index 2428e79595d36..b1160222cba7c 100644 --- a/htdocs/core/modules/bom/mod_bom_advanced.php +++ b/htdocs/core/modules/bom/mod_bom_advanced.php @@ -138,7 +138,7 @@ public function getNextValue($objprod, $object) $date = ($object->date_bom ? $object->date_bom : $object->date); - $numFinal = get_next_value($db, $mask, 'bom_bom', 'ref', '', null, $date); + $numFinal = get_next_value($db, $mask, 'bom_bom', 'ref', '', '', $date); return $numFinal; } diff --git a/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php b/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php index 44eff63035d10..71cf8effc9224 100644 --- a/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php +++ b/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php @@ -93,16 +93,22 @@ public function info($langs) */ public function getExample() { - global $conf, $langs, $mysoc; + global $db, $langs; - $old_code_client = $mysoc->code_client; - $mysoc->code_client = 'CCCCCCCCCC'; - $numExample = $this->getNextValue($mysoc, ''); - $mysoc->code_client = $old_code_client; + require_once DOL_DOCUMENT_ROOT . '/compta/paiement/cheque/class/remisecheque.class.php'; + require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; + + $remise = new RemiseCheque($db); + $remise->initAsSpecimen(); + $thirdparty = new Societe($db); + $thirdparty->initAsSpecimen(); + + $numExample = $this->getNextValue($thirdparty, $remise); if (!$numExample) { $numExample = $langs->trans('NotConfigured'); } + return $numExample; } diff --git a/htdocs/core/modules/contract/mod_contract_magre.php b/htdocs/core/modules/contract/mod_contract_magre.php index ebd7957780fe9..02345cda0f4d7 100644 --- a/htdocs/core/modules/contract/mod_contract_magre.php +++ b/htdocs/core/modules/contract/mod_contract_magre.php @@ -88,12 +88,18 @@ public function info($langs) */ public function getExample() { - global $langs, $mysoc; + global $db, $langs; + + require_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php'; + require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; + + $contract = new Contrat($db); + $contract->initAsSpecimen(); + $thirdparty = new Societe($db); + $thirdparty->initAsSpecimen(); + + $numExample = $this->getNextValue($thirdparty, $contract); - $old_code_client = $mysoc->code_client; - $mysoc->code_client = 'CCCCCCCCCC'; - $numExample = $this->getNextValue($mysoc, ''); - $mysoc->code_client = $old_code_client; if (!$numExample) { $numExample = $langs->trans('NotConfigured'); diff --git a/htdocs/core/modules/holiday/mod_holiday_immaculate.php b/htdocs/core/modules/holiday/mod_holiday_immaculate.php index 434b9614985f9..672a37885fa0e 100644 --- a/htdocs/core/modules/holiday/mod_holiday_immaculate.php +++ b/htdocs/core/modules/holiday/mod_holiday_immaculate.php @@ -1,6 +1,6 @@ - * Copyright (C) 2018 Charlene Benke +/* Copyright (C) 2011-2019 Juanjo Menent + * Copyright (C) 2018 Charlene Benke * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -88,11 +88,15 @@ public function info($langs) */ public function getExample() { - global $conf, $langs, $user; + global $db, $langs, $user; + require_once DOL_DOCUMENT_ROOT . '/holiday/class/holiday.class.php'; + + $holiday = new Holiday($db); + $holiday->initAsSpecimen(); $old_login = $user->login; $user->login = 'UUUUUUU'; - $numExample = $this->getNextValue($user, ''); + $numExample = $this->getNextValue($user, $holiday); $user->login = $old_login; if (!$numExample) { diff --git a/htdocs/core/modules/product_batch/mod_sn_advanced.php b/htdocs/core/modules/product_batch/mod_sn_advanced.php index 20fcb64d38218..6284ed2f7f3ad 100644 --- a/htdocs/core/modules/product_batch/mod_sn_advanced.php +++ b/htdocs/core/modules/product_batch/mod_sn_advanced.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2007 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) - * Copyright (C) 2019 Frédéric France + * Copyright (C) 2019-2024 Frédéric France * Copyright (C) 2021 Christophe Battarel * Copyright (C) 2024 MDW * @@ -114,15 +114,14 @@ public function info($langs) */ public function getExample() { - global $conf, $langs, $mysoc; - - $old_code_client = $mysoc->code_client; - $old_code_type = $mysoc->typent_code; - $mysoc->code_client = 'CCCCCCCCCC'; - $mysoc->typent_code = 'TTTTTTTTTT'; - $numExample = $this->getNextValue($mysoc, ''); - $mysoc->code_client = $old_code_client; - $mysoc->typent_code = $old_code_type; + global $db, $langs; + + require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; + + $thirdparty = new Societe($db); + $thirdparty->initAsSpecimen(); + + $numExample = $this->getNextValue($thirdparty, ''); if (!$numExample) { $numExample = $langs->trans('NotConfigured'); diff --git a/htdocs/core/modules/product_batch/mod_sn_free.php b/htdocs/core/modules/product_batch/mod_sn_free.php index bd795c726a1b4..87d3e5e62cdde 100644 --- a/htdocs/core/modules/product_batch/mod_sn_free.php +++ b/htdocs/core/modules/product_batch/mod_sn_free.php @@ -75,7 +75,14 @@ public function info($langs) */ public function getExample() { - return $this->getNextValue(null, null); + global $db; + + require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; + + $thirdparty = new Societe($db); + $thirdparty->initAsSpecimen(); + + return $this->getNextValue($thirdparty, null); } /** diff --git a/htdocs/core/modules/stock/doc/pdf_standard.modules.php b/htdocs/core/modules/stock/doc/pdf_standard.modules.php index 21e3e2ffdf24d..7fac3e5ea6f69 100644 --- a/htdocs/core/modules/stock/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/stock/doc/pdf_standard.modules.php @@ -838,7 +838,7 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlek * Show footer of page. Need this->emetteur object * * @param TCPDF $pdf PDF - * @param Object $object Object to show + * @param Entrepot $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 diff --git a/htdocs/ecm/class/ecmfiles.class.php b/htdocs/ecm/class/ecmfiles.class.php index 7cac5150b4815..f4ef399072643 100644 --- a/htdocs/ecm/class/ecmfiles.class.php +++ b/htdocs/ecm/class/ecmfiles.class.php @@ -117,12 +117,12 @@ class EcmFiles extends CommonObject public $extraparams; /** - * @var int|string date create + * @var int|'' date create */ public $date_c = ''; /** - * @var int|string date modify + * @var int|'' date modify */ public $date_m = ''; diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 4139a23a52ef4..a5231a73b6e91 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -2665,7 +2665,7 @@ public function doCollectOneCollector($mode = 0) // Search country by name or code if (!empty($contactstatic->country)) { require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; - $result = getCountry('', 3, $this->db, '', 1, $contactstatic->country); + $result = getCountry('', 3, $this->db, null, 1, $contactstatic->country); if ($result == 'NotDefined') { $errorforactions++; $this->error = "Error country not found by this name '" . $contactstatic->country . "'"; diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index d7ed5a2c5e74f..9ec4182d0f9b8 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -11,10 +11,10 @@ * Copyright (C) 2015 Claudio Aschieri * Copyright (C) 2016-2018 Ferran Marcet * Copyright (C) 2016 Yasser Carreón - * Copyright (C) 2018-2022 Frédéric France + * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2020 Lenin Rivas * Copyright (C) 2022 Josep Lluís Amador - * Copyright (C) 2024 MDW + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -2082,7 +2082,7 @@ if ($volumeUnit < 50) { print showDimensionInBestUnit($calculatedVolume, $volumeUnit, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND) ? $conf->global->MAIN_VOLUME_DEFAULT_ROUND : -1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT) ? $conf->global->MAIN_VOLUME_DEFAULT_UNIT : 'no'); } else { - print $calculatedVolume.' '.measuringUnitString(0, "volume", $volumeUnit); + print $calculatedVolume.' '.measuringUnitString(0, "volume", (string) $volumeUnit); } } if ($totalVolume > 0) { diff --git a/htdocs/knowledgemanagement/core/modules/knowledgemanagement/mod_knowledgerecord_advanced.php b/htdocs/knowledgemanagement/core/modules/knowledgemanagement/mod_knowledgerecord_advanced.php index 0c1b043f00637..6e8903119d9ee 100644 --- a/htdocs/knowledgemanagement/core/modules/knowledgemanagement/mod_knowledgerecord_advanced.php +++ b/htdocs/knowledgemanagement/core/modules/knowledgemanagement/mod_knowledgerecord_advanced.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2007 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) - * Copyright (C) 2019-2021 Frédéric France + * Copyright (C) 2019-2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -141,7 +141,7 @@ public function getNextValue($object) $date = $object->date; - $numFinal = get_next_value($db, $mask, 'knowledgemanagement_knowledgerecord', 'ref', '', null, $date); + $numFinal = get_next_value($db, $mask, 'knowledgemanagement_knowledgerecord', 'ref', '', '', $date); return $numFinal; } diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_advanced.php b/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_advanced.php index 208b4c4a054e3..25bb76993e73f 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_advanced.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_advanced.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2007 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) - * Copyright (C) 2019 Frédéric France + * Copyright (C) 2019-2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -140,7 +140,7 @@ public function getNextValue($object) $date = $object->date; - $numFinal = get_next_value($db, $mask, 'mymodule_myobject', 'ref', '', null, $date); + $numFinal = get_next_value($db, $mask, 'mymodule_myobject', 'ref', '', '', $date); return $numFinal; } diff --git a/htdocs/partnership/core/modules/partnership/mod_partnership_advanced.php b/htdocs/partnership/core/modules/partnership/mod_partnership_advanced.php index 75596eba9eae4..3db7ae28a6d52 100644 --- a/htdocs/partnership/core/modules/partnership/mod_partnership_advanced.php +++ b/htdocs/partnership/core/modules/partnership/mod_partnership_advanced.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2007 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) - * Copyright (C) 2019-2023 Frédéric France + * Copyright (C) 2019-2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -142,7 +142,7 @@ public function getNextValue($object) $date = $object->date; - $numFinal = get_next_value($db, $mask, 'partnership', 'ref', '', null, $date); + $numFinal = get_next_value($db, $mask, 'partnership', 'ref', '', '', $date); return $numFinal; } diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 4c06be7396b7d..457b21e046cbf 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -12,7 +12,8 @@ * Copyright (C) 2016 Ferran Marcet * Copyright (C) 2016 Yasser Carreón * Copyright (C) 2018 Quentin Vial-Gouteyron - * Copyright (C) 2024 MDW + * Copyright (C) 2024 MDW + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1613,7 +1614,7 @@ if ($volumeUnit < 50) { print showDimensionInBestUnit($calculatedVolume, $volumeUnit, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND) ? $conf->global->MAIN_VOLUME_DEFAULT_ROUND : -1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT) ? $conf->global->MAIN_VOLUME_DEFAULT_UNIT : 'no'); } else { - print $calculatedVolume.' '.measuringUnitString(0, "volume", $volumeUnit); + print $calculatedVolume.' '.measuringUnitString(0, "volume", (string) $volumeUnit); } } if ($totalVolume > 0) { diff --git a/htdocs/recruitment/core/modules/recruitment/mod_recruitmentcandidature_advanced.php b/htdocs/recruitment/core/modules/recruitment/mod_recruitmentcandidature_advanced.php index c1258703e6cbc..8453dceacd48d 100644 --- a/htdocs/recruitment/core/modules/recruitment/mod_recruitmentcandidature_advanced.php +++ b/htdocs/recruitment/core/modules/recruitment/mod_recruitmentcandidature_advanced.php @@ -137,7 +137,7 @@ public function getNextValue($object) $date = $object->date ?? ''; - $numFinal = get_next_value($db, $mask, 'recruitment_recruitmentcandidature', 'ref', '', null, $date); + $numFinal = get_next_value($db, $mask, 'recruitment_recruitmentcandidature', 'ref', '', '', $date); return $numFinal; } diff --git a/htdocs/recruitment/core/modules/recruitment/mod_recruitmentjobposition_advanced.php b/htdocs/recruitment/core/modules/recruitment/mod_recruitmentjobposition_advanced.php index 868b4b284e089..56efbf0239c20 100644 --- a/htdocs/recruitment/core/modules/recruitment/mod_recruitmentjobposition_advanced.php +++ b/htdocs/recruitment/core/modules/recruitment/mod_recruitmentjobposition_advanced.php @@ -137,7 +137,7 @@ public function getNextValue($object) $date = $object->date ?? ''; - $numFinal = get_next_value($db, $mask, 'recruitment_recruitmentjobposition', 'ref', '', null, $date); + $numFinal = get_next_value($db, $mask, 'recruitment_recruitmentjobposition', 'ref', '', '', $date); return $numFinal; } diff --git a/htdocs/recruitment/lib/recruitment_recruitmentcandidature.lib.php b/htdocs/recruitment/lib/recruitment_recruitmentcandidature.lib.php index d6a0de449dcd4..b6e8ae365d60d 100644 --- a/htdocs/recruitment/lib/recruitment_recruitmentcandidature.lib.php +++ b/htdocs/recruitment/lib/recruitment_recruitmentcandidature.lib.php @@ -25,7 +25,7 @@ /** * Prepare array of tabs for RecruitmentCandidature * - * @param RecruitmentJobPosition $object RecruitmentCandidature + * @param RecruitmentCandidature $object RecruitmentCandidature * @return array Array of tabs */ function recruitmentCandidaturePrepareHead($object) diff --git a/htdocs/user/group/list.php b/htdocs/user/group/list.php index 98e79785fce15..54c09924e2ae5 100644 --- a/htdocs/user/group/list.php +++ b/htdocs/user/group/list.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2018 Laurent Destailleur * Copyright (C) 2005-2024 Regis Houssin * Copyright (C) 2011 Herve Prot - * Copyright (C) 2019-2021 Frédéric France + * Copyright (C) 2019-2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -300,7 +300,7 @@ if ($caneditperms) { $newcardbutton .= dolGetButtonTitleSeparator(); - $newcardbutton .= dolGetButtonTitle($langs->trans('NewGroup'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/user/group/card.php?action=create&leftmenu=', '', $caneditperms); + $newcardbutton .= dolGetButtonTitle($langs->trans('NewGroup'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/user/group/card.php?action=create&leftmenu=', '', $caneditperms ? 1 : 0); } print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1); diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 3e2c708b9783e..8b2ec7364b7ad 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -65,11 +65,13 @@ parameters: - '#expects bool#' - '#expects bool, int given.#' - '#expects bool, string given.#' - - '#expects int#' + - '#expects int\|#' + - '#expects int\|#' - '#expects int<-2, 2>, bool given.#' - - '#expects int<0, 1>, false given.#' - - '#expects int, string given.#' - - '#expects int, float given.#' + - '#expects int<0, 1>#' + - '#expects int, string#' + - '#expects int, float#' + - '#expects int, null#' - '#expects int, bool given.#' - '#expects int, false given.#' - '#expects int, true given.#' @@ -78,15 +80,18 @@ parameters: - '#expects float\|string#' - '#expects float\|null#' - '#expects float, string given.#' - - '#expects string#' - - '#expects string, int given.#' + - '#expects string\|null,#' + - '#expects string, int#' - '#expects string, \(float\|int\) given.#' - - '#expects string, array given.#' - - '#expects string, float given.#' + - '#expects string, array#' + - '#expects string, float#' + - '#expects string, bool given.#' - '#expects string, true given.#' + - '#expects string, false given.#' - '#expects string, null given.#' - '#expects string, int<0, 10> given.#' - '#expects string, DateTime given.#' + - '#expects string, bool\|mysqli_result\|resource given.#' - '#expects array#' - '#expects array, string given.#' - '#expects array, null given.#' @@ -97,9 +102,7 @@ parameters: - '#expects object#' - '#expects Adherent#' - '#expects BOM#' - - '#expects Contrat#' - '#expects FTP\\Connection#' - - '#expects Holiday#' - '#expects LDAP\\Connection#' - '#expects MultiCurrency#' - '#expects Productlot#' @@ -107,17 +110,13 @@ parameters: - '#expects FactureFournisseur#' - '#expects Paiement#' - '#expects PgSql\\Result#' - - '#expects RecruitmentJobPosition#' - - '#expects RemiseCheque#' - '#expects Societe#' + - '#expects ''''\|Societe#' - '#expects SupplierProposal#' - - '#expects Translate#' - '#expects User#' - '#expects CommonObjectLine#' - - '#dol_eval expects#' - '#check_authentication expects#' - '#colorHexToHsl expects#' - - '#dolGetButtonTitle expects#' internalErrorsCountLimit: 50 cache: nodesByFileCountMax: 512 From d78c045c954c221625b308d4214db56b14211cdf Mon Sep 17 00:00:00 2001 From: Philippe Grand Date: Thu, 4 Jul 2024 20:47:25 +0200 Subject: [PATCH 16/17] New branch 03 07 2024 (#30253) * fix : Warning: Undefined variable in /home/httpd/vhosts/aflac.fr/domains/dol190.aflac.fr/httpdocs/compta/bank/various_payment/list.php on line 370 * backward * update * fix : Fatal error: Uncaught Error: Class 'DiscountAbsolute' not found in /home/httpd/vhosts/vialab.fr/domains/dolibarr.vialab.fr/httpdocs/fourn/commande/list.php on line 461 --- htdocs/fourn/commande/list.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 4a1e019334cce..14c017d65213b 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -39,6 +39,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formorder.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php'; From e7f694cddf09f2a1f09e9dcdc29f312ef240303b Mon Sep 17 00:00:00 2001 From: Zephyriony <142790847+zephyriony@users.noreply.github.com> Date: Thu, 4 Jul 2024 21:47:21 +0200 Subject: [PATCH 17/17] NEW #30044 (#30071) * FIX #30044 * Update list.php * Update list.php * Update pdf.lib.php * Update list.php * Update list.php * Update list.php * Update list.php * Update list.php * Update list.php * Update list.php * Update list.php * Update list.php * Update list.php --------- Co-authored-by: Laurent Destailleur --- htdocs/commande/list.php | 11 +++++++++++ htdocs/core/lib/pdf.lib.php | 8 +------- htdocs/fourn/commande/list.php | 12 +++++++++++- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index f40da96678630..e280fcb49e026 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -363,6 +363,7 @@ $nbOrders = is_array($orders) ? count($orders) : 1; + $currentIndex = 0; foreach ($orders as $id_order) { $cmd = new Commande($db); if ($cmd->fetch($id_order) <= 0) { @@ -373,6 +374,7 @@ $objecttmp = new Facture($db); if (!empty($createbills_onebythird) && !empty($TFactThird[$cmd->socid])) { // If option "one bill per third" is set, and an invoice for this thirdparty was already created, we reuse it. + $currentIndex++; $objecttmp = $TFactThird[$cmd->socid]; } else { // If we want one invoice per order or if there is no first invoice yet for this thirdparty. @@ -389,6 +391,10 @@ $objecttmp->ref_client = $cmd->ref_client; } + if (empty($objecttmp->note_public)) { + $objecttmp->note_public = $langs->transnoentities("Orders"); + } + $datefacture = dol_mktime(12, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear')); if (empty($datefacture)) { $datefacture = dol_now(); @@ -553,6 +559,11 @@ } } + if ($currentIndex <= (getDolGlobalInt("MAXREFONDOC") ? getDolGlobalInt("MAXREFONDOC") : 10)) { + $objecttmp->note_public = dol_concatdesc($objecttmp->note_public, $langs->transnoentities($cmd->ref).(empty($cmd->ref_client) ? '' : ' ('.$cmd->ref_client.')')); + $objecttmp->update($user); + } + //$cmd->classifyBilled($user); // Disabled. This behavior must be set or not using the workflow module. if (!empty($createbills_onebythird) && empty($TFactThird[$cmd->socid])) { diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 8bab1e1bd0e71..4096253a94dc1 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -2500,13 +2500,7 @@ function pdf_getLinkedObjects(&$object, $outputlangs) } elseif ($objecttype == 'commande' || $objecttype == 'supplier_order') { $outputlangs->load('orders'); - if (count($objects) > 1 && count($objects) <= (getDolGlobalInt("MAXREFONDOC") ? getDolGlobalInt("MAXREFONDOC") : 10)) { - $object->note_public = dol_concatdesc($object->note_public, $outputlangs->transnoentities("RefOrder").' :'); - foreach ($objects as $elementobject) { - $object->note_public = dol_concatdesc($object->note_public, $outputlangs->transnoentities($elementobject->ref).(empty($elementobject->ref_client) ? '' : ' ('.$elementobject->ref_client.')').(empty($elementobject->ref_supplier) ? '' : ' ('.$elementobject->ref_supplier.')').' '); - $object->note_public = dol_concatdesc($object->note_public, $outputlangs->transnoentities("OrderDate").' : '.dol_print_date($elementobject->date, 'day', '', $outputlangs)); - } - } elseif (count($objects) == 1) { + if (count($objects) == 1) { $elementobject = array_shift($objects); $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefOrder"); $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($elementobject->ref).(!empty($elementobject->ref_client) ? ' ('.$elementobject->ref_client.')' : '').(!empty($elementobject->ref_supplier) ? ' ('.$elementobject->ref_supplier.')' : ''); diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 14c017d65213b..75f01e33eb704 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -384,7 +384,7 @@ $db->begin(); $default_ref_supplier = dol_print_date(dol_now(), '%Y%m%d%H%M%S'); - + $currentIndex = 0; foreach ($orders as $id_order) { $cmd = new CommandeFournisseur($db); if ($cmd->fetch($id_order) <= 0) { @@ -393,6 +393,7 @@ $objecttmp = new FactureFournisseur($db); if (!empty($createbills_onebythird) && !empty($TFactThird[$cmd->socid])) { + $currentIndex++; $objecttmp = $TFactThird[$cmd->socid]; // If option "one bill per third" is set, we use already created supplier invoice. } else { // Search if the VAT reverse-charge is activated by default in supplier card to resume the information @@ -429,6 +430,10 @@ } if ($objecttmp->id > 0) { + if (empty($objecttmp->note_public)) { + $objecttmp->note_public = $langs->transnoentities("Orders"); + } + $sql = "INSERT INTO ".MAIN_DB_PREFIX."element_element ("; $sql .= "fk_source"; $sql .= ", sourcetype"; @@ -549,6 +554,11 @@ } } + if ($currentIndex <= (getDolGlobalInt("MAXREFONDOC") ? getDolGlobalInt("MAXREFONDOC") : 10)) { + $objecttmp->note_public = dol_concatdesc($objecttmp->note_public, $langs->transnoentities($cmd->ref).(empty($cmd->ref_supplier) ? '' : ' ('.$cmd->ref_supplier.')')); + $objecttmp->update($user); + } + $cmd->classifyBilled($user); // TODO Move this in workflow like done for sales orders if (!empty($createbills_onebythird) && empty($TFactThird[$cmd->socid])) {