From 777d8641515b51aaae34717ef447bed6a020530f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 15 Mar 2024 10:01:05 +0100 Subject: [PATCH 001/178] Clean code --- htdocs/compta/prelevement/class/rejetprelevement.class.php | 3 --- htdocs/compta/tva/card.php | 1 + htdocs/compta/tva/class/paymentvat.class.php | 2 -- htdocs/webservices/server_payment.php | 7 +------ 4 files changed, 2 insertions(+), 11 deletions(-) diff --git a/htdocs/compta/prelevement/class/rejetprelevement.class.php b/htdocs/compta/prelevement/class/rejetprelevement.class.php index c66dda3df0a..453920c5faa 100644 --- a/htdocs/compta/prelevement/class/rejetprelevement.class.php +++ b/htdocs/compta/prelevement/class/rejetprelevement.class.php @@ -178,9 +178,6 @@ class RejetPrelevement // Make a negative payment // Amount must be an array (id of invoice -> amount) $pai->amounts = array(); - - //var_dump($this->type);exit; - $pai->amounts[$facs[$i][0]] = price2num($amountrejected * -1); // The payment must be negative because it is a refund $pai->datepaye = $date_rejet; diff --git a/htdocs/compta/tva/card.php b/htdocs/compta/tva/card.php index d3f0886eae9..696965f0d30 100644 --- a/htdocs/compta/tva/card.php +++ b/htdocs/compta/tva/card.php @@ -227,6 +227,7 @@ if (empty($reshook)) { $paiement->paiementtype = GETPOST("type_payment", 'alphanohtml'); $paiement->num_payment = GETPOST("num_payment", 'alphanohtml'); $paiement->note = GETPOST("note", 'restricthtml'); + $paiement->note_private = GETPOST("note", 'restricthtml'); if (!$error) { $paymentid = $paiement->create($user, (int) GETPOST('closepaidtva')); diff --git a/htdocs/compta/tva/class/paymentvat.class.php b/htdocs/compta/tva/class/paymentvat.class.php index f45cc80e909..dce5f09a3a6 100644 --- a/htdocs/compta/tva/class/paymentvat.class.php +++ b/htdocs/compta/tva/class/paymentvat.class.php @@ -161,8 +161,6 @@ class PaymentVAT extends CommonObject */ public function create($user, $closepaidvat = 0) { - global $conf, $langs; - $error = 0; $now = dol_now(); diff --git a/htdocs/webservices/server_payment.php b/htdocs/webservices/server_payment.php index 1136b457b83..c01e11c79ef 100644 --- a/htdocs/webservices/server_payment.php +++ b/htdocs/webservices/server_payment.php @@ -189,17 +189,12 @@ function createPayment($authentication, $payment) $soc->fetch($payment['thirdparty_id']); $new_payment = new Paiement($db); - $new_payment->amount = (float) $payment['amount']; $new_payment->num_payment = $payment['num_payment']; $new_payment->fk_account = intval($payment['bank_account']); $new_payment->paiementid = !empty($payment['payment_mode_id']) ? intval($payment['payment_mode_id']) : $soc->mode_reglement_id; $new_payment->datepaye = $now; $new_payment->author = $payment['thirdparty_id']; - $new_payment->amounts = array(); - - if (intval($payment['invoice_id']) > 0) { - $new_payment->amounts[$payment['invoice_id']] = $new_payment->amount; - } + $new_payment->amounts = array($payment['invoice_id'] => (float) $payment['amount']); $db->begin(); $result = $new_payment->create($fuser, true); From 5f1c05308a3a7a93164caba8807335cb2532b3b5 Mon Sep 17 00:00:00 2001 From: PsyCrow <93346975+PsyCrow-code@users.noreply.github.com> Date: Thu, 21 Mar 2024 00:54:54 -0600 Subject: [PATCH 002/178] PHP Warning: Undefined array key 1 on line 533 PHP Warning: Undefined array key 1 on line 533 --- htdocs/compta/bank/releve.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php index bf0a08f02db..feeefb00425 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -529,8 +529,12 @@ if (empty($numref)) { print ''; $reg = array(); preg_match('/\((.+)\)/i', $objp->label, $reg); // Si texte entoure de parenthese on tente recherche de traduction - if ($reg[1] && $langs->trans($reg[1]) != $reg[1]) { - print $langs->trans($reg[1]); + if (!empty($reg[1])) { + if ($langs->trans($reg[1]) != $reg[1]) { + print $langs->trans($reg[1]); + } else { + print $objp->label; + } } else { print $objp->label; } From 3b5aa4e03a3d1e0f61f4322b1283a2a906398af7 Mon Sep 17 00:00:00 2001 From: ATM-Lucas Date: Thu, 21 Mar 2024 10:46:45 +0100 Subject: [PATCH 003/178] FIX default workstation on BOM --- htdocs/bom/ajax/ajax.php | 23 ++++++++++++++++++++++- htdocs/bom/class/bom.class.php | 2 +- htdocs/bom/tpl/objectline_create.tpl.php | 17 +++++++++++++++-- 3 files changed, 38 insertions(+), 4 deletions(-) diff --git a/htdocs/bom/ajax/ajax.php b/htdocs/bom/ajax/ajax.php index 9a55c609252..eddb8a40dc5 100644 --- a/htdocs/bom/ajax/ajax.php +++ b/htdocs/bom/ajax/ajax.php @@ -53,7 +53,7 @@ $idproduct = GETPOST('idproduct', 'int'); * View */ -top_httphead(); +top_httphead('application/json'); if ($action == 'getDurationUnitByProduct' && $user->hasRight('product', 'lire')) { $product = new Product($db); @@ -65,3 +65,24 @@ if ($action == 'getDurationUnitByProduct' && $user->hasRight('product', 'lire')) echo json_encode($fk_unit); exit(); } + +if ($action == 'getWorkstationByProduct' && $user->hasRight('product', 'lire')) { + $product = new Product($db); + $res = $product->fetch($idproduct); + + $result = array(); + + if ($res < 0) { + $error = 'SQL ERROR'; + } elseif ($res == 0) { + $error = 'NOT FOUND'; + } else { + $error = null; + $result['defaultWk']=$product->fk_default_workstation; + } + + $result['error']=$error; + + echo json_encode($result); + exit(); +} diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index cfae2ea3e0c..8ea8e3e3edd 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -792,7 +792,7 @@ class BOM extends CommonObject $line->array_options[$key] = $array_options[$key]; } } - if ($fk_default_workstation > 0 && $line->fk_default_workstation != $fk_default_workstation) { + if ($fk_default_workstation >= 0 && $line->fk_default_workstation != $fk_default_workstation) { $line->fk_default_workstation = $fk_default_workstation; } diff --git a/htdocs/bom/tpl/objectline_create.tpl.php b/htdocs/bom/tpl/objectline_create.tpl.php index db3991eac7d..8beefbc8b01 100644 --- a/htdocs/bom/tpl/objectline_create.tpl.php +++ b/htdocs/bom/tpl/objectline_create.tpl.php @@ -185,7 +185,7 @@ if ($filtertype != 1) { $coldisplay++; print ''; - print ' '; + print $formproduct->selectWorkstations('', 'idworkstations', 1); print ''; $coldisplay++; @@ -235,14 +235,27 @@ jQuery(document).ready(function() { ,type: 'POST' ,data: { 'action': 'getDurationUnitByProduct' + ,'token' : "" ,'idproduct' : idproduct } }).done(function(data) { console.log(data); - var data = JSON.parse(data); $("#fk_unit").val(data).change(); }); + + $.ajax({ + url : "" + ,type: 'POST' + ,data: { + 'action': 'getWorkstationByProduct' + ,'token' : "" + ,'idproduct' : idproduct + } + }).done(function(data) { + $('#idworkstations').val(data.defaultWk).select2(); + + }); }); }); From ab10f29db72ea6e984a295137dc5b05587c31534 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Champlon?= Date: Thu, 21 Mar 2024 13:06:09 +0100 Subject: [PATCH 004/178] add invoice id --- htdocs/takepos/index.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 97dae7e1a14..33367b95535 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -504,11 +504,12 @@ function ClickProduct(position, qty = 1) { } else{ console.log($('#prodiv4').data('rowid')); + invoiceid = $("#invoiceid").val(); idproduct=$('#prodiv'+position).data('rowid'); console.log("Click on product at position "+position+" for idproduct "+idproduct+", qty="+qty); if (idproduct=="") return; // Call page invoice.php to generate the section with product lines - $("#poslines").load("invoice.php?action=addline&token=&place="+place+"&idproduct="+idproduct+"&selectedline="+selectedline+"&qty="+qty, function() { + $("#poslines").load("invoice.php?action=addline&token=&place="+place+"&idproduct="+idproduct+"&selectedline="+selectedline+"&qty="+qty+"&invoiceid="+invoiceid, function() { global->TAKEPOS_CUSTOMER_DISPLAY)) echo "CustomerDisplay();";?> }); } @@ -527,7 +528,8 @@ function ChangeThirdparty(idcustomer) { function deleteline() { console.log("Delete line"); - $("#poslines").load("invoice.php?action=deleteline&token=&place="+place+"&idline="+selectedline, function() { + invoiceid = $("#invoiceid").val(); + $("#poslines").load("invoice.php?action=deleteline&token=&place="+place+"&idline="+selectedline+"invoiceid="+invoiceid, function() { //$('#poslines').scrollTop($('#poslines')[0].scrollHeight); }); ClearSearch(); From 5ffdc449524a1d63bda824eadb8556c547af5b86 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 21 Mar 2024 13:35:51 +0100 Subject: [PATCH 005/178] FIX missing entity parameter for ajax_constantonoff --- htdocs/core/class/html.formsetup.class.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/html.formsetup.class.php b/htdocs/core/class/html.formsetup.class.php index ac6bbc42e0d..03b9695b18f 100644 --- a/htdocs/core/class/html.formsetup.class.php +++ b/htdocs/core/class/html.formsetup.class.php @@ -26,6 +26,9 @@ class FormSetup */ public $db; + /** @var int */ + public $entity; + /** @var FormSetupItem[] */ public $items = array(); @@ -86,7 +89,8 @@ class FormSetup */ public function __construct($db, $outputLangs = false) { - global $langs; + global $conf, $langs; + $this->db = $db; $this->form = new Form($this->db); $this->formAttributes['action'] = $_SERVER["PHP_SELF"]; @@ -94,6 +98,7 @@ class FormSetup $this->formHiddenInputs['token'] = newToken(); $this->formHiddenInputs['action'] = 'update'; + $this->entity = (is_null($this->entity) ? $conf->entity : $this->entity); if ($outputLangs) { $this->langs = $outputLangs; @@ -446,6 +451,8 @@ class FormSetup { $item = new FormSetupItem($confKey); + $item->entity = $this->entity; + // set item rank if not defined as last item if (empty($item->rank)) { $item->rank = $this->getCurentItemMaxRank() + 1; @@ -638,7 +645,7 @@ class FormSetupItem /** * Constructor * - * @param string $confKey the conf key used in database + * @param string $confKey the conf key used in database */ public function __construct($confKey) { @@ -652,7 +659,7 @@ class FormSetupItem } $this->langs = $langs; - $this->entity = $conf->entity; + $this->entity = (is_null($this->entity) ? $conf->entity : ((int) $this->entity)); $this->confKey = $confKey; $this->loadValueFromConf(); @@ -1089,7 +1096,7 @@ class FormSetupItem $out.= $this->generateOutputFieldColor(); } elseif ($this->type == 'yesno') { if (!empty($conf->use_javascript_ajax)) { - $out.= ajax_constantonoff($this->confKey); + $out.= ajax_constantonoff($this->confKey, array(), $this->entity); // TODO possibility to add $input parameter } else { if ($this->fieldValue == 1) { $out.= $langs->trans('yes'); From d8b87ff6eb820f32998452e47688574bfd8fddf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Champlon?= Date: Thu, 21 Mar 2024 14:22:12 +0100 Subject: [PATCH 006/178] fix --- htdocs/takepos/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 33367b95535..540fa54f19c 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -529,7 +529,7 @@ function ChangeThirdparty(idcustomer) { function deleteline() { console.log("Delete line"); invoiceid = $("#invoiceid").val(); - $("#poslines").load("invoice.php?action=deleteline&token=&place="+place+"&idline="+selectedline+"invoiceid="+invoiceid, function() { + $("#poslines").load("invoice.php?action=deleteline&token=&place="+place+"&idline="+selectedline+"&invoiceid="+invoiceid, function() { //$('#poslines').scrollTop($('#poslines')[0].scrollHeight); }); ClearSearch(); From ea1762f0fda2d8faeda8c82d028b8cbc9d47cf1c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Mar 2024 14:36:31 +0100 Subject: [PATCH 007/178] Update releve.php --- htdocs/compta/bank/releve.php | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php index feeefb00425..af21117d21c 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -529,14 +529,10 @@ if (empty($numref)) { print ''; $reg = array(); preg_match('/\((.+)\)/i', $objp->label, $reg); // Si texte entoure de parenthese on tente recherche de traduction - if (!empty($reg[1])) { - if ($langs->trans($reg[1]) != $reg[1]) { - print $langs->trans($reg[1]); - } else { - print $objp->label; - } + if (!empty($reg[1]) && $langs->trans($reg[1]) != $reg[1]) { + print $langs->trans($reg[1]); } else { - print $objp->label; + print dol_escape_htmltag($objp->label); } print ''; From 68cd3d657ffedfc96d9835f9c5242368e45ae2fc Mon Sep 17 00:00:00 2001 From: le-reparateur <162715304+le-reparateur@users.noreply.github.com> Date: Thu, 21 Mar 2024 17:08:14 +0100 Subject: [PATCH 008/178] Update filefunc.inc.php Fix #28993 --- htdocs/filefunc.inc.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index 0c6698c736c..b6b2e7565e7 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -143,7 +143,8 @@ $result = @include_once $conffile; // Keep @ because with some error reporting m $listofwrappers = stream_get_wrappers(); // We need '.phar' for geoip2. TODO Replace phar in geoip with exploded files so we can disable phar by default. // phar stream does not auto unserialize content (possible code execution) since PHP 8.1 -$arrayofstreamtodisable = array('compress.zlib', 'compress.bzip2', 'ftp', 'ftps', 'glob', 'data', 'expect', 'ogg', 'rar', 'zip', 'zlib'); +// zip stream is necessary in import module +$arrayofstreamtodisable = array('compress.zlib', 'compress.bzip2', 'ftp', 'ftps', 'glob', 'data', 'expect', 'ogg', 'rar', 'zlib'); if (!empty($dolibarr_main_stream_to_disable) && is_array($dolibarr_main_stream_to_disable)) { $arrayofstreamtodisable = $dolibarr_main_stream_to_disable; } From 55b86350ae474b8c4afbbf7cb60e35361c90389a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Thu, 21 Mar 2024 18:35:12 +0100 Subject: [PATCH 009/178] fix phpstan --- htdocs/core/boxes/box_members_by_tags.php | 7 +++---- htdocs/core/boxes/box_members_by_type.php | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/htdocs/core/boxes/box_members_by_tags.php b/htdocs/core/boxes/box_members_by_tags.php index 99c71e59063..e9f4d1c0c6a 100644 --- a/htdocs/core/boxes/box_members_by_tags.php +++ b/htdocs/core/boxes/box_members_by_tags.php @@ -2,7 +2,7 @@ /* Copyright (C) 2003-2007 Rodolphe Quiedeville * Copyright (C) 2004-2017 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2015-2023 Frédéric France + * Copyright (C) 2015-2024 Frédéric France * Copyright (C) 2021-2023 Waël Almoman * * This program is free software; you can redistribute it and/or modify @@ -140,12 +140,11 @@ class box_members_by_tags extends ModeleBoxes $line++; $AdherentTag = array(); foreach ($sumMembers as $key => $data) { - $adhtag = new Categorie($this->db); - $adhtag->id = $key; - if ($key == 'total') { break; } + $adhtag = new Categorie($this->db); + $adhtag->id = (int) $key; $adhtag->label = $data['label']; $AdherentTag[$key] = $adhtag; diff --git a/htdocs/core/boxes/box_members_by_type.php b/htdocs/core/boxes/box_members_by_type.php index 05f886e2858..d3b065cc7ec 100644 --- a/htdocs/core/boxes/box_members_by_type.php +++ b/htdocs/core/boxes/box_members_by_type.php @@ -2,7 +2,7 @@ /* Copyright (C) 2003-2007 Rodolphe Quiedeville * Copyright (C) 2004-2017 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2015-2023 Frederic France + * Copyright (C) 2015-2024 Frédéric France * Copyright (C) 2021-2023 Waël Almoman * * This program is free software; you can redistribute it and/or modify @@ -140,12 +140,11 @@ class box_members_by_type extends ModeleBoxes $line++; $AdherentType = array(); foreach ($sumMembers as $key => $data) { - $adhtype = new AdherentType($this->db); - $adhtype->id = $key; - if ($key == 'total') { break; } + $adhtype = new AdherentType($this->db); + $adhtype->id = (int) $key; $adhtype->label = $data['label']; $AdherentType[$key] = $adhtype; From 34028bac6efc0042cb89029b7bb37cb224fbe292 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Thu, 21 Mar 2024 18:39:30 +0100 Subject: [PATCH 010/178] fix phpstan --- htdocs/core/boxes/box_members_by_tags.php | 10 +++++----- htdocs/core/boxes/box_members_by_type.php | 10 +++++----- htdocs/core/boxes/box_members_last_modified.php | 4 ++-- htdocs/core/boxes/box_members_last_subscriptions.php | 10 +++++----- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/htdocs/core/boxes/box_members_by_tags.php b/htdocs/core/boxes/box_members_by_tags.php index e9f4d1c0c6a..20ef8187840 100644 --- a/htdocs/core/boxes/box_members_by_tags.php +++ b/htdocs/core/boxes/box_members_by_tags.php @@ -1,9 +1,9 @@ - * Copyright (C) 2004-2017 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2015-2024 Frédéric France - * Copyright (C) 2021-2023 Waël Almoman +/* Copyright (C) 2003-2007 Rodolphe Quiedeville + * Copyright (C) 2004-2017 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2015-2024 Frédéric France + * Copyright (C) 2021-2023 Waël Almoman * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/htdocs/core/boxes/box_members_by_type.php b/htdocs/core/boxes/box_members_by_type.php index d3b065cc7ec..63479a55212 100644 --- a/htdocs/core/boxes/box_members_by_type.php +++ b/htdocs/core/boxes/box_members_by_type.php @@ -1,9 +1,9 @@ - * Copyright (C) 2004-2017 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2015-2024 Frédéric France - * Copyright (C) 2021-2023 Waël Almoman +/* Copyright (C) 2003-2007 Rodolphe Quiedeville + * Copyright (C) 2004-2017 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2015-2024 Frédéric France + * Copyright (C) 2021-2023 Waël Almoman * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/htdocs/core/boxes/box_members_last_modified.php b/htdocs/core/boxes/box_members_last_modified.php index 2ef36c822dd..a33b2b7577c 100644 --- a/htdocs/core/boxes/box_members_last_modified.php +++ b/htdocs/core/boxes/box_members_last_modified.php @@ -2,7 +2,7 @@ /* Copyright (C) 2003-2007 Rodolphe Quiedeville * Copyright (C) 2004-2017 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2015-2020 Frederic France + * Copyright (C) 2015-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 @@ -110,7 +110,7 @@ class box_members_last_modified extends ModeleBoxes $memberstatic->email = $objp->email; $memberstatic->morphy = $objp->morphy; $memberstatic->company = $objp->company; - $memberstatic->statut = $objp->status; + $memberstatic->status = $objp->status; $memberstatic->date_creation = $datec; $memberstatic->date_modification = $datem; $memberstatic->need_subscription = $objp->subscription; diff --git a/htdocs/core/boxes/box_members_last_subscriptions.php b/htdocs/core/boxes/box_members_last_subscriptions.php index 92d0413c5e7..8dbb96df25f 100644 --- a/htdocs/core/boxes/box_members_last_subscriptions.php +++ b/htdocs/core/boxes/box_members_last_subscriptions.php @@ -1,8 +1,8 @@ - * Copyright (C) 2004-2017 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2015-2020 Frederic France +/* Copyright (C) 2003-2007 Rodolphe Quiedeville + * Copyright (C) 2004-2017 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2015-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 @@ -110,7 +110,7 @@ class box_members_last_subscriptions extends ModeleBoxes $staticmember->email = $obj->email; $staticmember->photo = $obj->photo; $staticmember->morphy = $obj->morphy; - $staticmember->statut = $obj->status; + $staticmember->status = $obj->status; $staticmember->need_subscription = $obj->need_subscription; $staticmember->datefin = $this->db->jdate($obj->date_end_subscription); if (!empty($obj->fk_soc)) { From 2c1e8ff7c359236bd219405a09b40fda49cfd0f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Thu, 21 Mar 2024 19:10:42 +0100 Subject: [PATCH 011/178] fix phpstan --- htdocs/core/boxes/box_graph_invoices_permonth.php | 3 ++- htdocs/core/boxes/box_graph_invoices_peryear.php | 3 ++- htdocs/core/boxes/box_graph_invoices_supplier_permonth.php | 3 ++- htdocs/core/boxes/box_graph_orders_permonth.php | 3 ++- htdocs/core/boxes/box_graph_orders_supplier_permonth.php | 3 ++- htdocs/core/boxes/box_graph_propales_permonth.php | 3 ++- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/htdocs/core/boxes/box_graph_invoices_permonth.php b/htdocs/core/boxes/box_graph_invoices_permonth.php index 74b31a3daaf..f38604467e4 100644 --- a/htdocs/core/boxes/box_graph_invoices_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_permonth.php @@ -1,5 +1,6 @@ + * 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 @@ -68,7 +69,7 @@ class box_graph_invoices_permonth extends ModeleBoxes //include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; //$facturestatic=new Facture($this->db); - $startmonth = $conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1; + $startmonth = getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1); if (!getDolGlobalString('GRAPH_USE_FISCAL_YEAR')) { $startmonth = 1; } diff --git a/htdocs/core/boxes/box_graph_invoices_peryear.php b/htdocs/core/boxes/box_graph_invoices_peryear.php index f6decd57660..be20f7ff3c0 100644 --- a/htdocs/core/boxes/box_graph_invoices_peryear.php +++ b/htdocs/core/boxes/box_graph_invoices_peryear.php @@ -1,5 +1,6 @@ + * 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 @@ -65,7 +66,7 @@ class box_graph_invoices_peryear extends ModeleBoxes //include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; //$facturestatic=new Facture($this->db); - $startmonth = $conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1; + $startmonth = getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1); if (!getDolGlobalString('GRAPH_USE_FISCAL_YEAR')) { $startmonth = 1; } diff --git a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php index 818398324c8..30cc4616d59 100644 --- a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php @@ -1,5 +1,6 @@ + * 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 @@ -66,7 +67,7 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; - $startmonth = $conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1; + $startmonth = getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1); if (!getDolGlobalString('GRAPH_USE_FISCAL_YEAR')) { $startmonth = 1; } diff --git a/htdocs/core/boxes/box_graph_orders_permonth.php b/htdocs/core/boxes/box_graph_orders_permonth.php index ce11fe9e93d..182b2f5fb72 100644 --- a/htdocs/core/boxes/box_graph_orders_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_permonth.php @@ -1,5 +1,6 @@ + * 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 @@ -67,7 +68,7 @@ class box_graph_orders_permonth extends ModeleBoxes //include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; //$commandestatic=new Commande($this->db); - $startmonth = $conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1; + $startmonth = getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1); if (!getDolGlobalString('GRAPH_USE_FISCAL_YEAR')) { $startmonth = 1; } diff --git a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php index 9b7e40ab20f..6924bb9d9e8 100644 --- a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php @@ -1,5 +1,6 @@ + * 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 @@ -66,7 +67,7 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; - $startmonth = $conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1; + $startmonth = getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1); if (!getDolGlobalString('GRAPH_USE_FISCAL_YEAR')) { $startmonth = 1; } diff --git a/htdocs/core/boxes/box_graph_propales_permonth.php b/htdocs/core/boxes/box_graph_propales_permonth.php index 0192ecf2b12..5699d71e678 100644 --- a/htdocs/core/boxes/box_graph_propales_permonth.php +++ b/htdocs/core/boxes/box_graph_propales_permonth.php @@ -1,5 +1,6 @@ + * 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 @@ -67,7 +68,7 @@ class box_graph_propales_permonth extends ModeleBoxes //include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; //$propalstatic=new Propal($this->db); - $startmonth = $conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1; + $startmonth = getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1); if (!getDolGlobalString('GRAPH_USE_FISCAL_YEAR')) { $startmonth = 1; } From a2974f7778edf443d1ce67ccdc74649f32a96f4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Thu, 21 Mar 2024 19:13:33 +0100 Subject: [PATCH 012/178] fix phpstan --- htdocs/core/boxes/box_task.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/boxes/box_task.php b/htdocs/core/boxes/box_task.php index 170dd59e4b1..89f09bf5389 100644 --- a/htdocs/core/boxes/box_task.php +++ b/htdocs/core/boxes/box_task.php @@ -1,6 +1,6 @@ - * Copyright (C) 2015-2021 Frederic France + * Copyright (C) 2015-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 @@ -174,7 +174,7 @@ class box_task extends ModeleBoxes $taskstatic->ref = $objp->ref; $taskstatic->label = $objp->label; $taskstatic->progress = $objp->progress; - $taskstatic->fk_statut = $objp->fk_statut; + $taskstatic->status = $objp->fk_statut; $taskstatic->date_end = $this->db->jdate($objp->datee); $taskstatic->planned_workload = $objp->planned_workload; $taskstatic->duration_effective = $objp->duration_effective; From b4f04dbaee5e122281e54f651b03aa2df643e331 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 21 Mar 2024 20:58:59 +0100 Subject: [PATCH 013/178] new: upgrade minimum version of dolibarr for module builder --- .../modulebuilder/template/core/modules/modMyModule.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php index eb3c4d656a0..4e552c0275b 100644 --- a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php +++ b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php @@ -150,7 +150,7 @@ class modMyModule extends DolibarrModules // Prerequisites $this->phpmin = array(7, 1); // Minimum version of PHP required by module - $this->need_dolibarr_version = array(11, -3); // Minimum version of Dolibarr required by module + $this->need_dolibarr_version = array(17, -3); // Minimum version of Dolibarr required by module $this->need_javascript_ajax = 0; // Messages at activation From ce38158c356655af531122636ec21f1bceed86b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Thu, 21 Mar 2024 21:50:42 +0100 Subject: [PATCH 014/178] fix warnings with syslog checkconfiguration --- htdocs/admin/syslog.php | 12 +++++++++--- htdocs/core/modules/syslog/logHandler.php | 7 +++++++ htdocs/core/modules/syslog/mod_syslog_file.php | 11 +++++------ htdocs/core/modules/syslog/mod_syslog_syslog.php | 13 +++++++------ 4 files changed, 28 insertions(+), 15 deletions(-) diff --git a/htdocs/admin/syslog.php b/htdocs/admin/syslog.php index 71dc5df45f6..5475e20d0d1 100644 --- a/htdocs/admin/syslog.php +++ b/htdocs/admin/syslog.php @@ -3,6 +3,7 @@ * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2007 Rodolphe Quiedeville * Copyright (C) 2013 Juanjo Menent + * 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 @@ -112,11 +113,16 @@ if ($action == 'set') { dolibarr_del_const($db, 'SYSLOG_HANDLERS', -1); // To be sure there is not a setup into another entity dolibarr_set_const($db, 'SYSLOG_HANDLERS', json_encode($activeModules), 'chaine', 0, '', 0); - + $error = 0; + $errors = []; // Check configuration foreach ($activeModules as $modulename) { $module = new $modulename(); - $error = $module->checkConfiguration(); + $res = $module->checkConfiguration(); + if (!$res) { + $error++; + $errors = array_merge($errors, $module->errors); + } } @@ -125,7 +131,7 @@ if ($action == 'set') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { $db->rollback(); - setEventMessages($error, $errors, 'errors'); + setEventMessages('', $errors, 'errors'); } } diff --git a/htdocs/core/modules/syslog/logHandler.php b/htdocs/core/modules/syslog/logHandler.php index 0af3f304331..1672a683cb1 100644 --- a/htdocs/core/modules/syslog/logHandler.php +++ b/htdocs/core/modules/syslog/logHandler.php @@ -1,4 +1,6 @@ + */ /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -24,6 +26,11 @@ class LogHandler { protected $ident = 0; + /** + * @var string[] Array of errors messages + */ + public $errors = []; + /** * Content of the info tooltip. diff --git a/htdocs/core/modules/syslog/mod_syslog_file.php b/htdocs/core/modules/syslog/mod_syslog_file.php index 3442877dca3..5468923120e 100644 --- a/htdocs/core/modules/syslog/mod_syslog_file.php +++ b/htdocs/core/modules/syslog/mod_syslog_file.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 Frédéric France */ require_once DOL_DOCUMENT_ROOT.'/core/modules/syslog/logHandler.php'; @@ -78,23 +79,21 @@ class mod_syslog_file extends LogHandler implements LogHandlerInterface /** * Return if configuration is valid * - * @return array Array of errors. Empty array if ok. + * @return bool true if ok */ public function checkConfiguration() { global $langs; - $errors = array(); - $filename = $this->getFilename(); if (file_exists($filename) && is_writable($filename)) { dol_syslog('admin/syslog: file '.$filename); + return true; } else { - $errors[] = $langs->trans("ErrorFailedToOpenFile", $filename); + $this->errors[] = $langs->trans("ErrorFailedToOpenFile", $filename); + return false; } - - return $errors; } /** diff --git a/htdocs/core/modules/syslog/mod_syslog_syslog.php b/htdocs/core/modules/syslog/mod_syslog_syslog.php index d3931cf09eb..b2ccf4f997e 100644 --- a/htdocs/core/modules/syslog/mod_syslog_syslog.php +++ b/htdocs/core/modules/syslog/mod_syslog_syslog.php @@ -1,4 +1,6 @@ + */ require_once DOL_DOCUMENT_ROOT.'/core/modules/syslog/logHandler.php'; @@ -77,15 +79,14 @@ class mod_syslog_syslog extends LogHandler implements LogHandlerInterface /** * Return if configuration is valid * - * @return array Array of errors. Empty array if ok. + * @return bool True if ok. */ public function checkConfiguration() { global $conf, $langs; - $errors = array(); + $facility = constant(getDolGlobalString('SYSLOG_FACILITY')); - $facility = constant($conf->global->SYSLOG_FACILITY); if ($facility) { // Only LOG_USER supported on Windows if (!empty($_SERVER["WINDIR"])) { @@ -93,11 +94,11 @@ class mod_syslog_syslog extends LogHandler implements LogHandlerInterface } dol_syslog("admin/syslog: facility ".$facility); + return true; } else { - $errors[] = $langs->trans("ErrorUnknownSyslogConstant", $facility); + $this->errors[] = $langs->trans("ErrorUnknownSyslogConstant", $facility); + return false; } - - return $errors; } /** From c76ab41c91926ee168fd27a3e33a84e11ef03e41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Thu, 21 Mar 2024 21:52:02 +0100 Subject: [PATCH 015/178] fix warnings with syslog checkconfiguration --- htdocs/core/modules/syslog/logHandler.php | 4 ++-- htdocs/core/modules/syslog/logHandlerInterface.php | 4 +++- htdocs/core/modules/syslog/mod_syslog_syslog.php | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/syslog/logHandler.php b/htdocs/core/modules/syslog/logHandler.php index 1672a683cb1..e7ec4dbc567 100644 --- a/htdocs/core/modules/syslog/logHandler.php +++ b/htdocs/core/modules/syslog/logHandler.php @@ -87,11 +87,11 @@ class LogHandler * It will be called after setting the configuration. * The function returns an array with error messages * - * @return array + * @return bool */ public function checkConfiguration() { - return array(); + return true; } /** diff --git a/htdocs/core/modules/syslog/logHandlerInterface.php b/htdocs/core/modules/syslog/logHandlerInterface.php index 15ab436f4fa..2613d50f755 100644 --- a/htdocs/core/modules/syslog/logHandlerInterface.php +++ b/htdocs/core/modules/syslog/logHandlerInterface.php @@ -1,4 +1,6 @@ + */ /* * 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 @@ -79,7 +81,7 @@ interface LogHandlerInterface /** * Output log content * - * @param string $content Content to log + * @param array $content Content to log * @return void */ public function export($content); diff --git a/htdocs/core/modules/syslog/mod_syslog_syslog.php b/htdocs/core/modules/syslog/mod_syslog_syslog.php index b2ccf4f997e..8d1457fa2ec 100644 --- a/htdocs/core/modules/syslog/mod_syslog_syslog.php +++ b/htdocs/core/modules/syslog/mod_syslog_syslog.php @@ -83,7 +83,7 @@ class mod_syslog_syslog extends LogHandler implements LogHandlerInterface */ public function checkConfiguration() { - global $conf, $langs; + global $langs; $facility = constant(getDolGlobalString('SYSLOG_FACILITY')); From 7b0177a84d63b0a5a382325055472c1eaa60e0c0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 22 Mar 2024 00:37:56 +0100 Subject: [PATCH 016/178] Move to getDolGlobalString --- htdocs/asset/agenda.php | 1 - htdocs/asset/class/asset.class.php | 45 ++----------------- .../class/assetdepreciationoptions.class.php | 2 +- htdocs/asset/class/assetmodel.class.php | 4 +- htdocs/asset/model/agenda.php | 1 - htdocs/bom/bom_agenda.php | 1 - htdocs/bom/class/bom.class.php | 2 +- htdocs/bookcal/availabilities_agenda.php | 1 - htdocs/comm/card.php | 3 +- htdocs/comm/propal/agenda.php | 1 - htdocs/commande/agenda.php | 1 - .../bank/class/paymentvarious.class.php | 2 +- .../cashcontrol/class/cashcontrol.class.php | 2 +- htdocs/compta/facture/agenda.php | 1 - htdocs/compta/recap-compta.php | 2 +- htdocs/contact/agenda.php | 2 +- htdocs/contact/card.php | 2 +- htdocs/contact/document.php | 2 +- htdocs/contact/perso.php | 2 +- htdocs/contact/project.php | 2 +- htdocs/contrat/agenda.php | 2 +- htdocs/contrat/messaging.php | 2 +- htdocs/core/class/conf.class.php | 2 +- htdocs/core/class/defaultvalues.class.php | 2 +- htdocs/core/lib/functions.lib.php | 2 +- .../class/conferenceorbooth.class.php | 2 +- .../conferenceorbooth_list.php | 2 +- htdocs/fourn/card.php | 2 +- htdocs/fourn/commande/info.php | 2 +- htdocs/hrm/establishment/info.php | 1 - htdocs/hrm/evaluation_agenda.php | 1 - htdocs/hrm/job_agenda.php | 1 - htdocs/hrm/position_agenda.php | 1 - htdocs/hrm/skill_agenda.php | 1 - .../class/knowledgerecord.class.php | 2 +- .../knowledgerecord_agenda.php | 1 - htdocs/main.inc.php | 6 +-- htdocs/margin/tabs/thirdpartyMargins.php | 2 +- htdocs/mrp/class/mo.class.php | 2 +- htdocs/mrp/mo_agenda.php | 1 - .../partnership/class/partnership.class.php | 2 +- htdocs/partnership/partnership_agenda.php | 1 - htdocs/product/agenda.php | 2 +- htdocs/product/class/product.class.php | 2 +- .../class/productfournisseurprice.class.php | 2 +- .../inventory/class/inventory.class.php | 2 +- .../product/stock/class/productlot.class.php | 2 +- .../class/stocktransfer.class.php | 2 +- .../class/stocktransferline.class.php | 2 +- .../stocktransfer/stocktransfer_agenda.php | 1 - htdocs/projet/agenda.php | 2 +- htdocs/projet/card.php | 2 +- htdocs/projet/contact.php | 2 +- htdocs/projet/document.php | 2 +- htdocs/projet/element.php | 2 +- htdocs/projet/ganttview.php | 2 +- htdocs/projet/messaging.php | 2 +- htdocs/projet/note.php | 2 +- htdocs/projet/tasks.php | 2 +- .../class/recruitmentcandidature.class.php | 2 +- .../class/recruitmentjobposition.class.php | 2 +- .../recruitmentcandidature_agenda.php | 1 - .../recruitmentjobposition_agenda.php | 1 - htdocs/resource/agenda.php | 2 +- htdocs/societe/agenda.php | 2 +- htdocs/societe/card.php | 2 +- htdocs/societe/class/societe.class.php | 2 +- htdocs/societe/consumption.php | 2 +- htdocs/societe/contact.php | 2 +- htdocs/societe/document.php | 2 +- htdocs/societe/messaging.php | 2 +- htdocs/societe/note.php | 2 +- htdocs/societe/notify/card.php | 2 +- htdocs/societe/paymentmodes.php | 2 +- htdocs/societe/project.php | 2 +- htdocs/user/notify/card.php | 2 +- .../variants/class/ProductAttribute.class.php | 2 +- .../class/ProductAttributeValue.class.php | 2 +- htdocs/website/class/websitepage.class.php | 2 +- .../workstation/class/workstation.class.php | 2 +- htdocs/workstation/workstation_agenda.php | 1 - 81 files changed, 67 insertions(+), 126 deletions(-) diff --git a/htdocs/asset/agenda.php b/htdocs/asset/agenda.php index 56e33e2e317..1669e7b688f 100644 --- a/htdocs/asset/agenda.php +++ b/htdocs/asset/agenda.php @@ -129,7 +129,6 @@ $form = new Form($db); if ($object->id > 0) { $title = $langs->trans("Agenda"); - //if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title; $help_url = 'EN:Module_Agenda_En|DE:Modul_Terminplanung'; llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-asset page-card_agenda'); diff --git a/htdocs/asset/class/asset.class.php b/htdocs/asset/class/asset.class.php index ed7a57e3af5..4c016282171 100644 --- a/htdocs/asset/class/asset.class.php +++ b/htdocs/asset/class/asset.class.php @@ -70,7 +70,7 @@ class Asset extends CommonObject * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" * 'label' the translation key. * 'picto' is code of a picto to show before value in forms - * 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM) + * 'enabled' is a condition when the field must be managed (Example: 1 or 'getDolGlobalString("MY_SETUP_PARAM")' * 'position' is the sort order of field. * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing) @@ -1001,8 +1001,8 @@ class Asset extends CommonObject // futures depreciation lines //----------------------------------------------------- - $nb_days_in_year = getDolGlobalString('ASSET_DEPRECIATION_DURATION_PER_YEAR') ? $conf->global->ASSET_DEPRECIATION_DURATION_PER_YEAR : 365; - $nb_days_in_month = getDolGlobalString('ASSET_DEPRECIATION_DURATION_PER_MONTH') ? $conf->global->ASSET_DEPRECIATION_DURATION_PER_MONTH : 30; + $nb_days_in_year = getDolGlobalInt('ASSET_DEPRECIATION_DURATION_PER_YEAR', 365); + $nb_days_in_month = getDolGlobalInt('ASSET_DEPRECIATION_DURATION_PER_MONTH', 30); $period_amount = (float) price2num($depreciation_period_amount / $fields['duration'], 'MT'); $first_period_found = false; // TODO fix declaration of $begin_period @@ -1576,43 +1576,4 @@ class Asset extends CommonObject return ""; } } - - /** - * Create a document onto disk according to template module. - * - * @param string $modele Force template to use ('' to not force) - * @param Translate $outputlangs object lang a utiliser pour traduction - * @param int $hidedetails Hide details of lines - * @param int $hidedesc Hide description - * @param int $hideref Hide ref - * @param null|array $moreparams Array to provide more information - * @return int 0 if KO, 1 if OK - */ - // public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null) - // { - // global $conf, $langs; - // - // $result = 0; - // $includedocgeneration = 1; - // - // $langs->load("assets"); - // - // if (!dol_strlen($modele)) { - // $modele = 'standard_asset'; - // - // if (!empty($this->model_pdf)) { - // $modele = $this->model_pdf; - // } elseif (!empty($conf->global->ASSET_ADDON_PDF)) { - // $modele = $conf->global->ASSET_ADDON_PDF; - // } - // } - // - // $modelpath = "core/modules/asset/doc/"; - // - // if ($includedocgeneration && !empty($modele)) { - // $result = $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); - // } - // - // return $result; - // } } diff --git a/htdocs/asset/class/assetdepreciationoptions.class.php b/htdocs/asset/class/assetdepreciationoptions.class.php index dac2d1ad194..e11ecfb9321 100644 --- a/htdocs/asset/class/assetdepreciationoptions.class.php +++ b/htdocs/asset/class/assetdepreciationoptions.class.php @@ -39,7 +39,7 @@ class AssetDepreciationOptions extends CommonObject * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" * 'label' the translation key. * 'picto' is code of a picto to show before value in forms - * 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM) + * 'enabled' is a condition when the field must be managed (Example: 1 or 'getDolGlobalString("MY_SETUP_PARAM")' * 'position' is the sort order of field. * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing) diff --git a/htdocs/asset/class/assetmodel.class.php b/htdocs/asset/class/assetmodel.class.php index 51243277071..2ec02762b94 100644 --- a/htdocs/asset/class/assetmodel.class.php +++ b/htdocs/asset/class/assetmodel.class.php @@ -76,7 +76,7 @@ class AssetModel extends CommonObject * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" * 'label' the translation key. * 'picto' is code of a picto to show before value in forms - * 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM) + * 'enabled' is a condition when the field must be managed (Example: 1 or 'getDolGlobalString("MY_SETUP_PARAM")' * 'position' is the sort order of field. * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing) @@ -796,7 +796,7 @@ class AssetModel extends CommonObject */ public function doScheduledJob() { - global $conf, $langs; + //global $conf, $langs; //$conf->global->SYSLOG_FILE = 'DOL_DATA_ROOT/dolibarr_mydedicatedlofile.log'; diff --git a/htdocs/asset/model/agenda.php b/htdocs/asset/model/agenda.php index 1eb0a2e850a..247d52408bf 100644 --- a/htdocs/asset/model/agenda.php +++ b/htdocs/asset/model/agenda.php @@ -135,7 +135,6 @@ $form = new Form($db); if ($object->id > 0) { $title = $langs->trans("Agenda"); - //if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title; $help_url = 'EN:Module_Agenda_En|DE:Modul_Terminplanung'; llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-asset page-model-card_agenda'); diff --git a/htdocs/bom/bom_agenda.php b/htdocs/bom/bom_agenda.php index f6229b309a1..e8029fd4592 100644 --- a/htdocs/bom/bom_agenda.php +++ b/htdocs/bom/bom_agenda.php @@ -131,7 +131,6 @@ $form = new Form($db); if ($object->id > 0) { $title = $langs->trans("Agenda"); - //if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title; $help_url = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda|DE:Modul_Agenda'; llxHeader('', $title, $help_url); diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 6de866029f7..d6d320b36a1 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -88,7 +88,7 @@ class BOM extends CommonObject * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" * 'label' the translation key. * 'picto' is code of a picto to show before value in forms - * 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM) + * 'enabled' is a condition when the field must be managed (Example: 1 or 'getDolGlobalString("MY_SETUP_PARAM")' * 'position' is the sort order of field. * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing) diff --git a/htdocs/bookcal/availabilities_agenda.php b/htdocs/bookcal/availabilities_agenda.php index 5c29e0c45cc..88c0935c86d 100644 --- a/htdocs/bookcal/availabilities_agenda.php +++ b/htdocs/bookcal/availabilities_agenda.php @@ -143,7 +143,6 @@ $form = new Form($db); if ($object->id > 0) { $title = $langs->trans("Agenda"); - //if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title; $help_url = 'EN:Module_Agenda_En|DE:Modul_Terminplanung'; llxHeader('', $title, $help_url); diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 796f17e710c..a952b9565d7 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -313,7 +313,7 @@ $form = new Form($db); $formcompany = new FormCompany($db); $title = $langs->trans("ThirdParty")." - ".$langs->trans('Customer'); -if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { +if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $object->name) { $title = $object->name." - ".$langs->trans('Customer'); } @@ -321,7 +321,6 @@ $help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas|DE:Modul_Gesch llxHeader('', $title, $help_url); - if ($object->id > 0) { $head = societe_prepare_head($object); diff --git a/htdocs/comm/propal/agenda.php b/htdocs/comm/propal/agenda.php index 1fe3cf6d5dd..657f2e639f9 100644 --- a/htdocs/comm/propal/agenda.php +++ b/htdocs/comm/propal/agenda.php @@ -126,7 +126,6 @@ $form = new Form($db); if ($object->id > 0) { $title = $langs->trans("Agenda"); - //if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title; $help_url = 'EN:Module_Agenda_En|DE:Modul_Terminplanung'; llxHeader('', $title, $help_url); diff --git a/htdocs/commande/agenda.php b/htdocs/commande/agenda.php index af2a5da5594..be9a4fcf168 100644 --- a/htdocs/commande/agenda.php +++ b/htdocs/commande/agenda.php @@ -126,7 +126,6 @@ $form = new Form($db); if ($object->id > 0) { $title = $langs->trans("Agenda"); - //if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title; $help_url = 'EN:Module_Agenda_En|DE:Modul_Terminplanung'; llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-order page-card_agenda'); diff --git a/htdocs/compta/bank/class/paymentvarious.class.php b/htdocs/compta/bank/class/paymentvarious.class.php index 7bb567f1536..94ee4f52bc9 100644 --- a/htdocs/compta/bank/class/paymentvarious.class.php +++ b/htdocs/compta/bank/class/paymentvarious.class.php @@ -175,7 +175,7 @@ class PaymentVarious extends CommonObject * 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password') * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" * 'label' the translation key. - * 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM) + * 'enabled' is a condition when the field must be managed (Example: 1 or 'getDolGlobalString("MY_SETUP_PARAM")' * 'position' is the sort order of field. * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing) diff --git a/htdocs/compta/cashcontrol/class/cashcontrol.class.php b/htdocs/compta/cashcontrol/class/cashcontrol.class.php index 15959866819..bcb5426aa4c 100644 --- a/htdocs/compta/cashcontrol/class/cashcontrol.class.php +++ b/htdocs/compta/cashcontrol/class/cashcontrol.class.php @@ -60,7 +60,7 @@ class CashControl extends CommonObject * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" * 'label' the translation key. * 'picto' is code of a picto to show before value in forms - * 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM) + * 'enabled' is a condition when the field must be managed (Example: 1 or 'getDolGlobalString("MY_SETUP_PARAM")' * 'position' is the sort order of field. * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing) diff --git a/htdocs/compta/facture/agenda.php b/htdocs/compta/facture/agenda.php index 2880e158273..382d9eaafa4 100644 --- a/htdocs/compta/facture/agenda.php +++ b/htdocs/compta/facture/agenda.php @@ -126,7 +126,6 @@ $form = new Form($db); if ($object->id > 0) { $title = $langs->trans("Agenda"); - //if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title; $help_url = 'EN:Module_Agenda_En|DE:Modul_Terminplanung'; llxHeader('', $title, $help_url); diff --git a/htdocs/compta/recap-compta.php b/htdocs/compta/recap-compta.php index bff81de3bda..ffd6498dbd7 100644 --- a/htdocs/compta/recap-compta.php +++ b/htdocs/compta/recap-compta.php @@ -98,7 +98,7 @@ $form = new Form($db); $userstatic = new User($db); $title = $langs->trans("ThirdParty").' - '.$langs->trans("Summary"); -if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { +if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $object->name) { $title = $object->name.' - '.$langs->trans("Summary"); } $help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; diff --git a/htdocs/contact/agenda.php b/htdocs/contact/agenda.php index af06f40761f..2c1a0d2ab99 100644 --- a/htdocs/contact/agenda.php +++ b/htdocs/contact/agenda.php @@ -145,7 +145,7 @@ if (empty($reshook)) { $form = new Form($db); $title = (getDolGlobalString('SOCIETE_ADDRESSES_MANAGEMENT') ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses")); -if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/contactnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->lastname) { +if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/contactnameonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $object->lastname) { $title = $object->lastname; } $help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas|DE:Modul_Partner'; diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 28e39259101..16087378bf2 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -570,7 +570,7 @@ if ($socid > 0) { } $title = (getDolGlobalString('SOCIETE_ADDRESSES_MANAGEMENT') ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses")); -if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/contactnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->lastname) { +if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/contactnameonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $object->lastname) { $title = $object->lastname; } $help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; diff --git a/htdocs/contact/document.php b/htdocs/contact/document.php index 1a98fb921fa..c4b216d2679 100644 --- a/htdocs/contact/document.php +++ b/htdocs/contact/document.php @@ -111,7 +111,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; $form = new Form($db); $title = (getDolGlobalString('SOCIETE_ADDRESSES_MANAGEMENT') ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses")); -if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/contactnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->lastname) { +if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/contactnameonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $object->lastname) { $title = $object->lastname; } $help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; diff --git a/htdocs/contact/perso.php b/htdocs/contact/perso.php index 357b6401023..90028857f99 100644 --- a/htdocs/contact/perso.php +++ b/htdocs/contact/perso.php @@ -120,7 +120,7 @@ if ($action == 'update' && !GETPOST("cancel") && $user->hasRight('societe', 'con $now = dol_now(); $title = (getDolGlobalString('SOCIETE_ADDRESSES_MANAGEMENT') ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses")); -if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/contactnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->lastname) { +if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/contactnameonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $object->lastname) { $title = $object->lastname; } $help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; diff --git a/htdocs/contact/project.php b/htdocs/contact/project.php index 389bb693d1d..7fe377f1a96 100644 --- a/htdocs/contact/project.php +++ b/htdocs/contact/project.php @@ -63,7 +63,7 @@ if ($id) { } $socid = !empty($object->thirdparty->id) ? $object->thirdparty->id : null; $title = $langs->trans("Projects"); - if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { + if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $object->name) { $title = $object->name." - ".$title; } llxHeader('', $title); diff --git a/htdocs/contrat/agenda.php b/htdocs/contrat/agenda.php index 848f1a088d7..63eae100841 100644 --- a/htdocs/contrat/agenda.php +++ b/htdocs/contrat/agenda.php @@ -146,7 +146,7 @@ if ($object->id > 0) { $object->fetch_thirdparty(); $title = $langs->trans("Agenda"); - if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/contractrefonly/', $conf->global->MAIN_HTML_TITLE) && $object->ref) { + if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/contractrefonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $object->ref) { $title = $object->ref." - ".$title; } $help_url = 'EN:Module_Contracts|FR:Module_Contrat'; diff --git a/htdocs/contrat/messaging.php b/htdocs/contrat/messaging.php index 8f3e5fac95e..be189fb2b5d 100644 --- a/htdocs/contrat/messaging.php +++ b/htdocs/contrat/messaging.php @@ -145,7 +145,7 @@ require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; $object->fetch_thirdparty(); $title = $langs->trans("Agenda"); -if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/contractrefonly/', $conf->global->MAIN_HTML_TITLE) && $object->ref) { +if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/contractrefonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $object->ref) { $title = $object->ref." - ".$title; } $help_url = 'EN:Module_Contracts|FR:Module_Contrat'; diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index a8148548443..ca1817e27a3 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -754,7 +754,7 @@ class Conf extends stdClass // MAIN_HTML_TITLE if (!isset($this->global->MAIN_HTML_TITLE)) { - $this->global->MAIN_HTML_TITLE = 'noapp,thirdpartynameonly,contactnameonly,projectnameonly'; + $this->global->MAIN_HTML_TITLE = 'thirdpartynameonly,contactnameonly,projectnameonly'; } // conf->liste_limit = constante de taille maximale des listes diff --git a/htdocs/core/class/defaultvalues.class.php b/htdocs/core/class/defaultvalues.class.php index 0b54bd8fb79..c2bf1199322 100644 --- a/htdocs/core/class/defaultvalues.class.php +++ b/htdocs/core/class/defaultvalues.class.php @@ -64,7 +64,7 @@ class DefaultValues extends CommonObject * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" * 'label' the translation key. * 'picto' is code of a picto to show before value in forms - * 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM) + * 'enabled' is a condition when the field must be managed (Example: 1 or 'getDolGlobalString("MY_SETUP_PARAM")' * 'position' is the sort order of field. * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 9ca3eb7abab..d150e866f02 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4001,7 +4001,7 @@ function dol_print_phone($phone, $countrycode = '', $cid = 0, $socid = 0, $addli } } - if (!empty($conf->global->CONTACT_PHONEMOBILE_SHOW_LINK_TO_WHATSAPP) && $withpicto == 'mobile') { + if (getDolGlobalString('CONTACT_PHONEMOBILE_SHOW_LINK_TO_WHATSAPP') && $withpicto == 'mobile') { // Link to Whatsapp $newphone .= ' global->MY_SETUP_PARAM) + * 'enabled' is a condition when the field must be managed (Example: 1 or 'getDolGlobalString("MY_SETUP_PARAM")' * 'position' is the sort order of field. * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing) diff --git a/htdocs/eventorganization/conferenceorbooth_list.php b/htdocs/eventorganization/conferenceorbooth_list.php index b340622595f..18b52f93683 100644 --- a/htdocs/eventorganization/conferenceorbooth_list.php +++ b/htdocs/eventorganization/conferenceorbooth_list.php @@ -296,7 +296,7 @@ if ($projectid > 0 || $projectref) { $help_url = "EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos"; $title = $langs->trans("Project") . ' - ' . $langs->trans("EventOrganizationConfOrBoothes") . ' - ' . $project->ref . ' ' . $project->name; - if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/projectnameonly/', $conf->global->MAIN_HTML_TITLE) && $project->name) { + if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/projectnameonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $project->name) { $title = $project->ref . ' ' . $project->name . ' - ' . $langs->trans("ListOfConferencesOrBooths"); } } diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index 56954e78e16..d09f0b27d16 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -201,7 +201,7 @@ if ($id > 0 && empty($object->id)) { if ($object->id > 0) { $title = $langs->trans("ThirdParty")." - ".$langs->trans('Supplier'); - if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { + if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $object->name) { $title = $object->name." - ".$langs->trans('Supplier'); } $help_url = ''; diff --git a/htdocs/fourn/commande/info.php b/htdocs/fourn/commande/info.php index 2f80fe4ba45..1f56cbd86ff 100644 --- a/htdocs/fourn/commande/info.php +++ b/htdocs/fourn/commande/info.php @@ -121,7 +121,7 @@ if ($id > 0 || !empty($ref)) { } $title = $object->ref.' - '.$langs->trans('Info').' - '.$object->ref.' '.$object->name; -if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/projectnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { +if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/projectnameonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $object->name) { $title = $object->ref.' '.$object->name.' - '.$langs->trans("Info"); } $help_url = 'EN:Module_Suppliers_Orders|FR:CommandeFournisseur|ES:Módulo_Pedidos_a_proveedores'; diff --git a/htdocs/hrm/establishment/info.php b/htdocs/hrm/establishment/info.php index 2d9ebbd1968..95773416675 100644 --- a/htdocs/hrm/establishment/info.php +++ b/htdocs/hrm/establishment/info.php @@ -128,7 +128,6 @@ $form = new Form($db); if ($object->id > 0) { $title = $langs->trans("Agenda"); - //if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title; $help_url = ''; llxHeader('', $title, $help_url); diff --git a/htdocs/hrm/evaluation_agenda.php b/htdocs/hrm/evaluation_agenda.php index 4507ba5764f..93a699e2545 100644 --- a/htdocs/hrm/evaluation_agenda.php +++ b/htdocs/hrm/evaluation_agenda.php @@ -140,7 +140,6 @@ $form = new Form($db); if ($object->id > 0) { $title = $langs->trans("Agenda"); - //if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title; $help_url = 'EN:Module_Agenda_En|DE:Modul_Terminplanung'; llxHeader('', $title, $help_url); diff --git a/htdocs/hrm/job_agenda.php b/htdocs/hrm/job_agenda.php index 6fffa6934e4..ffd2887b667 100644 --- a/htdocs/hrm/job_agenda.php +++ b/htdocs/hrm/job_agenda.php @@ -138,7 +138,6 @@ $form = new Form($db); if ($object->id > 0) { $title = $langs->trans("Agenda"); - //if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title; $help_url = 'EN:Module_Agenda_En|DE:Modul_Terminplanung'; llxHeader('', $title, $help_url); diff --git a/htdocs/hrm/position_agenda.php b/htdocs/hrm/position_agenda.php index 49f269d8efa..57560f901f3 100644 --- a/htdocs/hrm/position_agenda.php +++ b/htdocs/hrm/position_agenda.php @@ -141,7 +141,6 @@ $form = new Form($db); if ($object->id > 0) { $title = $langs->trans("Agenda"); - //if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title; $help_url = 'EN:Module_Agenda_En|DE:Modul_Terminplanung'; llxHeader('', $title, $help_url); diff --git a/htdocs/hrm/skill_agenda.php b/htdocs/hrm/skill_agenda.php index a469ded4cf9..97a7a9ba97f 100644 --- a/htdocs/hrm/skill_agenda.php +++ b/htdocs/hrm/skill_agenda.php @@ -140,7 +140,6 @@ $form = new Form($db); if ($object->id > 0) { $title = $langs->trans("Agenda"); - //if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title; $help_url = 'EN:Module_Agenda_En|DE:Modul_Terminplanung'; llxHeader('', $title, $help_url); diff --git a/htdocs/knowledgemanagement/class/knowledgerecord.class.php b/htdocs/knowledgemanagement/class/knowledgerecord.class.php index 402e41c7d76..ac4e806a8e1 100644 --- a/htdocs/knowledgemanagement/class/knowledgerecord.class.php +++ b/htdocs/knowledgemanagement/class/knowledgerecord.class.php @@ -75,7 +75,7 @@ class KnowledgeRecord extends CommonObject * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" * 'label' the translation key. * 'picto' is code of a picto to show before value in forms - * 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM) + * 'enabled' is a condition when the field must be managed (Example: 1 or 'getDolGlobalString("MY_SETUP_PARAM")' * 'position' is the sort order of field. * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing) diff --git a/htdocs/knowledgemanagement/knowledgerecord_agenda.php b/htdocs/knowledgemanagement/knowledgerecord_agenda.php index 4ed3b95b63b..a3742a80172 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_agenda.php +++ b/htdocs/knowledgemanagement/knowledgerecord_agenda.php @@ -128,7 +128,6 @@ $form = new Form($db); if ($object->id > 0) { $title = $langs->trans("Agenda"); - //if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title; $help_url = ''; llxHeader('', $title, $help_url); diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index cc625787aed..5a1f7684755 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1825,10 +1825,10 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr print ''; $titletoshow = ''; - if ($title && getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/noapp/', $conf->global->MAIN_HTML_TITLE)) { - $titletoshow = dol_htmlentities($title); - } elseif ($title) { + if ($title && preg_match('/showapp/', getDolGlobalString('MAIN_HTML_TITLE'))) { $titletoshow = dol_htmlentities($appli.' - '.$title); + } elseif ($title) { + $titletoshow = dol_htmlentities($title); } else { $titletoshow = dol_htmlentities($appli); } diff --git a/htdocs/margin/tabs/thirdpartyMargins.php b/htdocs/margin/tabs/thirdpartyMargins.php index 83b646baf29..8c7865cbcf2 100644 --- a/htdocs/margin/tabs/thirdpartyMargins.php +++ b/htdocs/margin/tabs/thirdpartyMargins.php @@ -87,7 +87,7 @@ $invoicestatic = new Facture($db); $form = new Form($db); $title = $langs->trans("ThirdParty").' - '.$langs->trans("Margins"); -if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { +if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $object->name) { $title = $object->name.' - '.$langs->trans("Files"); } $help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index c82f54d4568..87f62beae47 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -72,7 +72,7 @@ class Mo extends CommonObject * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" * 'label' the translation key. * 'picto' is code of a picto to show before value in forms - * 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM) + * 'enabled' is a condition when the field must be managed (Example: 1 or 'getDolGlobalString("MY_SETUP_PARAM")' * 'position' is the sort order of field. * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing) diff --git a/htdocs/mrp/mo_agenda.php b/htdocs/mrp/mo_agenda.php index d4c87b7015e..5067cd662f0 100644 --- a/htdocs/mrp/mo_agenda.php +++ b/htdocs/mrp/mo_agenda.php @@ -131,7 +131,6 @@ $formproject = new FormProjets($db); if ($object->id > 0) { $title = $langs->trans("Agenda"); - //if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title; $help_url = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda|DE:|DE:Modul_Terminplanung'; llxHeader('', $title, $help_url); diff --git a/htdocs/partnership/class/partnership.class.php b/htdocs/partnership/class/partnership.class.php index 68ffaeb291c..fc3bd304d3a 100644 --- a/htdocs/partnership/class/partnership.class.php +++ b/htdocs/partnership/class/partnership.class.php @@ -81,7 +81,7 @@ class Partnership extends CommonObject * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" * 'label' the translation key. * 'picto' is code of a picto to show before value in forms - * 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM) + * 'enabled' is a condition when the field must be managed (Example: 1 or 'getDolGlobalString("MY_SETUP_PARAM")' * 'position' is the sort order of field. * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing) diff --git a/htdocs/partnership/partnership_agenda.php b/htdocs/partnership/partnership_agenda.php index 851809edb21..d383136f109 100644 --- a/htdocs/partnership/partnership_agenda.php +++ b/htdocs/partnership/partnership_agenda.php @@ -142,7 +142,6 @@ $form = new Form($db); if ($object->id > 0) { $title = $langs->trans("Agenda"); - //if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title; $help_url = ''; llxHeader('', $title, $help_url); diff --git a/htdocs/product/agenda.php b/htdocs/product/agenda.php index 9a11c59abd1..d5364fb6f67 100644 --- a/htdocs/product/agenda.php +++ b/htdocs/product/agenda.php @@ -141,7 +141,7 @@ if ($id > 0 || $ref) { $help_url = 'EN:Module_Agenda_En|FR:Module_Agenda|DE:Modul_Terminplanung'; - if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/productnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { + if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/productnameonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $object->name) { $title = $object->name." - ".$title; } llxHeader('', $title, $help_url); diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 040f4d77183..6fb66541fa3 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -562,7 +562,7 @@ class Product extends CommonObject * 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password') * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" * 'label' the translation key. - * 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM) + * 'enabled' is a condition when the field must be managed (Example: 1 or 'getDolGlobalString("MY_SETUP_PARAM")' * 'position' is the sort order of field. * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing) diff --git a/htdocs/product/class/productfournisseurprice.class.php b/htdocs/product/class/productfournisseurprice.class.php index 93666b0431b..1e8989c4e15 100644 --- a/htdocs/product/class/productfournisseurprice.class.php +++ b/htdocs/product/class/productfournisseurprice.class.php @@ -69,7 +69,7 @@ class ProductFournisseurPrice extends CommonObject * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" * 'label' the translation key. * 'picto' is code of a picto to show before value in forms - * 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM) + * 'enabled' is a condition when the field must be managed (Example: 1 or 'getDolGlobalString("MY_SETUP_PARAM")' * 'position' is the sort order of field. * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing) diff --git a/htdocs/product/inventory/class/inventory.class.php b/htdocs/product/inventory/class/inventory.class.php index 71de87fbb6a..9272ca6276c 100644 --- a/htdocs/product/inventory/class/inventory.class.php +++ b/htdocs/product/inventory/class/inventory.class.php @@ -73,7 +73,7 @@ class Inventory extends CommonObject * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" * 'label' the translation key. * 'picto' is code of a picto to show before value in forms - * 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM) + * 'enabled' is a condition when the field must be managed (Example: 1 or 'getDolGlobalString("MY_SETUP_PARAM")' * 'position' is the sort order of field. * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing) diff --git a/htdocs/product/stock/class/productlot.class.php b/htdocs/product/stock/class/productlot.class.php index edbf9be17b8..193786cf0b4 100644 --- a/htdocs/product/stock/class/productlot.class.php +++ b/htdocs/product/stock/class/productlot.class.php @@ -77,7 +77,7 @@ class Productlot extends CommonObject * 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password') * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" * 'label' the translation key. - * 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM) + * 'enabled' is a condition when the field must be managed (Example: 1 or 'getDolGlobalString("MY_SETUP_PARAM")' * 'position' is the sort order of field. * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing) diff --git a/htdocs/product/stock/stocktransfer/class/stocktransfer.class.php b/htdocs/product/stock/stocktransfer/class/stocktransfer.class.php index a8e1267175d..363929ec4ac 100644 --- a/htdocs/product/stock/stocktransfer/class/stocktransfer.class.php +++ b/htdocs/product/stock/stocktransfer/class/stocktransfer.class.php @@ -101,7 +101,7 @@ class StockTransfer extends CommonObject * 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password') * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" * 'label' the translation key. - * 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM) + * 'enabled' is a condition when the field must be managed (Example: 1 or 'getDolGlobalString("MY_SETUP_PARAM")' * 'position' is the sort order of field. * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing) diff --git a/htdocs/product/stock/stocktransfer/class/stocktransferline.class.php b/htdocs/product/stock/stocktransfer/class/stocktransferline.class.php index cd77a955806..f8eadb92a74 100644 --- a/htdocs/product/stock/stocktransfer/class/stocktransferline.class.php +++ b/htdocs/product/stock/stocktransfer/class/stocktransferline.class.php @@ -71,7 +71,7 @@ class StockTransferLine extends CommonObjectLine * 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password') * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" * 'label' the translation key. - * 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM) + * 'enabled' is a condition when the field must be managed (Example: 1 or 'getDolGlobalString("MY_SETUP_PARAM")' * 'position' is the sort order of field. * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing) diff --git a/htdocs/product/stock/stocktransfer/stocktransfer_agenda.php b/htdocs/product/stock/stocktransfer/stocktransfer_agenda.php index 9f328000513..d8012519ff9 100644 --- a/htdocs/product/stock/stocktransfer/stocktransfer_agenda.php +++ b/htdocs/product/stock/stocktransfer/stocktransfer_agenda.php @@ -125,7 +125,6 @@ $form = new Form($db); if ($object->id > 0) { $title = $langs->trans("Agenda"); - //if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title; $help_url = ''; llxHeader('', $title, $help_url); diff --git a/htdocs/projet/agenda.php b/htdocs/projet/agenda.php index 966d6f212ff..d33906eae65 100644 --- a/htdocs/projet/agenda.php +++ b/htdocs/projet/agenda.php @@ -115,7 +115,7 @@ if ($id > 0 || !empty($ref)) { } $agenda = (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) ? '/'.$langs->trans("Agenda") : ''; $title = $langs->trans('Events').$agenda.' - '.$object->ref.' '.$object->name; -if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/projectnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { +if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/projectnameonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $object->name) { $title = $object->ref.' '.$object->name.' - '.$langs->trans("Info"); } $help_url = "EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos"; diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 3c7e60e8173..4d3fd801d3e 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -568,7 +568,7 @@ $formproject = new FormProjets($db); $userstatic = new User($db); $title = $langs->trans("Project").' - '.$object->ref.(!empty($object->thirdparty->name) ? ' - '.$object->thirdparty->name : '').(!empty($object->title) ? ' - '.$object->title : ''); -if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/projectnameonly/', $conf->global->MAIN_HTML_TITLE)) { +if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/projectnameonly/', getDolGlobalString('MAIN_HTML_TITLE'))) { $title = $object->ref.(!empty($object->thirdparty->name) ? ' - '.$object->thirdparty->name : '').(!empty($object->title) ? ' - '.$object->title : ''); } diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php index 84695fb78b2..e8edd52584b 100644 --- a/htdocs/projet/contact.php +++ b/htdocs/projet/contact.php @@ -303,7 +303,7 @@ $contactstatic = new Contact($db); $userstatic = new User($db); $title = $langs->trans('ProjectContact').' - '.$object->ref.' '.$object->name; -if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/projectnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { +if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/projectnameonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $object->name) { $title = $object->ref.' '.$object->name.' - '.$langs->trans('ProjectContact'); } diff --git a/htdocs/projet/document.php b/htdocs/projet/document.php index 5797c355ef1..c9190870ff1 100644 --- a/htdocs/projet/document.php +++ b/htdocs/projet/document.php @@ -100,7 +100,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; */ $title = $langs->trans('Documents').' - '.$object->ref.' '.$object->name; -if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/projectnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { +if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/projectnameonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $object->name) { $title = $object->ref.' '.$object->name.' - '.$langs->trans('Document'); } diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index aec00de96af..d34b51beb81 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -197,7 +197,7 @@ $hookmanager->initHooks(array('projectOverview')); */ $title = $langs->trans('ProjectReferers').' - '.$object->ref.' '.$object->name; -if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/projectnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { +if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/projectnameonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $object->name) { $title = $object->ref.' '.$object->name.' - '.$langs->trans('ProjectReferers'); } diff --git a/htdocs/projet/ganttview.php b/htdocs/projet/ganttview.php index 2c68116f73c..1ea9da66f38 100644 --- a/htdocs/projet/ganttview.php +++ b/htdocs/projet/ganttview.php @@ -86,7 +86,7 @@ if (!empty($conf->use_javascript_ajax)) { //$title=$langs->trans("Gantt").($object->ref?' - '.$object->ref.' '.$object->name:''); $title = $langs->trans("Gantt"); -if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/projectnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { +if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/projectnameonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $object->name) { $title = ($object->ref ? $object->ref.' '.$object->name.' - ' : '').$langs->trans("Gantt"); } $help_url = "EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos"; diff --git a/htdocs/projet/messaging.php b/htdocs/projet/messaging.php index d626d94cfc4..5fc11a551e8 100644 --- a/htdocs/projet/messaging.php +++ b/htdocs/projet/messaging.php @@ -115,7 +115,7 @@ if ($id > 0 || !empty($ref)) { } $agenda = (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) ? '/'.$langs->trans("Agenda") : ''; $title = $langs->trans('Events').$agenda.' - '.$object->ref.' '.$object->name; -if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/projectnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { +if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/projectnameonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $object->name) { $title = $object->ref.' '.$object->name.' - '.$langs->trans("Info"); } $help_url = "EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos"; diff --git a/htdocs/projet/note.php b/htdocs/projet/note.php index bd35de47259..c01c81de525 100644 --- a/htdocs/projet/note.php +++ b/htdocs/projet/note.php @@ -73,7 +73,7 @@ if (empty($reshook)) { */ $title = $langs->trans("Notes").' - '.$object->ref.' '.$object->name; -if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/projectnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { +if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/projectnameonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $object->name) { $title = $object->ref.' '.$object->name.' - '.$langs->trans("Note"); } $help_url = "EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos"; diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index a093682ecde..d0e044f03b3 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -407,7 +407,7 @@ $taskstatic = new Task($db); $userstatic = new User($db); $title = $langs->trans("Tasks").' - '.$object->ref.' '.$object->name; -if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/projectnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { +if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/projectnameonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $object->name) { $title = $object->ref.' '.$object->name.' - '.$langs->trans("Tasks"); } if ($action == 'create') { diff --git a/htdocs/recruitment/class/recruitmentcandidature.class.php b/htdocs/recruitment/class/recruitmentcandidature.class.php index 59c152cac47..c05ebf05f39 100644 --- a/htdocs/recruitment/class/recruitmentcandidature.class.php +++ b/htdocs/recruitment/class/recruitmentcandidature.class.php @@ -84,7 +84,7 @@ class RecruitmentCandidature extends CommonObject * 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password') * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" * 'label' the translation key. - * 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM) + * 'enabled' is a condition when the field must be managed (Example: 1 or 'getDolGlobalString("MY_SETUP_PARAM")' * 'position' is the sort order of field. * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing) diff --git a/htdocs/recruitment/class/recruitmentjobposition.class.php b/htdocs/recruitment/class/recruitmentjobposition.class.php index dbc9e11cce1..baee1da7ea4 100644 --- a/htdocs/recruitment/class/recruitmentjobposition.class.php +++ b/htdocs/recruitment/class/recruitmentjobposition.class.php @@ -90,7 +90,7 @@ class RecruitmentJobPosition extends CommonObject * 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password') * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" * 'label' the translation key. - * 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM) + * 'enabled' is a condition when the field must be managed (Example: 1 or 'getDolGlobalString("MY_SETUP_PARAM")' * 'position' is the sort order of field. * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing) diff --git a/htdocs/recruitment/recruitmentcandidature_agenda.php b/htdocs/recruitment/recruitmentcandidature_agenda.php index a8339a0ca7b..8f685bb1b14 100644 --- a/htdocs/recruitment/recruitmentcandidature_agenda.php +++ b/htdocs/recruitment/recruitmentcandidature_agenda.php @@ -128,7 +128,6 @@ $form = new Form($db); if ($object->id > 0) { $title = $object->ref." - ".$langs->trans('Agenda'); - //if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title; $help_url = 'Module_Agenda_En|DE:Modul_Terminplanung'; llxHeader('', $title, $help_url); diff --git a/htdocs/recruitment/recruitmentjobposition_agenda.php b/htdocs/recruitment/recruitmentjobposition_agenda.php index 665f26bc75d..e433b72ba2b 100644 --- a/htdocs/recruitment/recruitmentjobposition_agenda.php +++ b/htdocs/recruitment/recruitmentjobposition_agenda.php @@ -127,7 +127,6 @@ $form = new Form($db); if ($object->id > 0) { $title = $object->ref." - ".$langs->trans('Agenda'); - //if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title; $help_url = ''; llxHeader('', $title, $help_url); diff --git a/htdocs/resource/agenda.php b/htdocs/resource/agenda.php index 61c17c3a66c..a71d381c382 100644 --- a/htdocs/resource/agenda.php +++ b/htdocs/resource/agenda.php @@ -133,7 +133,7 @@ if ($object->id > 0) { $picto = 'resource'; $title = $langs->trans("Agenda"); - if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/productnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { + if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/productnameonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $object->name) { $title = $object->ref." - ".$title; } llxHeader('', $title); diff --git a/htdocs/societe/agenda.php b/htdocs/societe/agenda.php index be5ed78293e..bc37aa42750 100644 --- a/htdocs/societe/agenda.php +++ b/htdocs/societe/agenda.php @@ -123,7 +123,7 @@ if (empty($reshook)) { $form = new Form($db); $title = $langs->trans("Agenda"); -if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { +if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $object->name) { $title = $object->name." - ".$title; } $help_url = ''; diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index fe4ba146981..7db221036f3 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -873,7 +873,7 @@ $title = $langs->trans("ThirdParty"); if ($action == 'create') { $title = $langs->trans("NewThirdParty"); } -if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { +if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $object->name) { $title = $object->name." - ".$langs->trans('Card'); } $help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas|DE:Modul_Geschäftspartner'; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 9b2a46c9da6..d78cf8bdb4e 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -166,7 +166,7 @@ class Societe extends CommonObject * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" * 'label' the translation key. * 'picto' is code of a picto to show before value in forms - * 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM) + * 'enabled' is a condition when the field must be managed (Example: 1 or 'getDolGlobalString("MY_SETUP_PARAM")' * 'position' is the sort order of field. * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing) diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index 5877e3c9d11..f3460c82584 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -116,7 +116,7 @@ $formother = new FormOther($db); $productstatic = new Product($db); $title = $langs->trans("Referers", $object->name); -if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { +if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $object->name) { $title = $object->name." - ".$title; } $help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; diff --git a/htdocs/societe/contact.php b/htdocs/societe/contact.php index 79d0a405d3f..21f2105d94a 100644 --- a/htdocs/societe/contact.php +++ b/htdocs/societe/contact.php @@ -176,7 +176,7 @@ if ($socid > 0 && empty($object->id)) { } $title = $langs->trans("ThirdParty"); -if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { +if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $object->name) { $title = $object->name." - ".$langs->trans('ContactsAddresses'); } $help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; diff --git a/htdocs/societe/document.php b/htdocs/societe/document.php index aab773fa19a..abfa6495892 100644 --- a/htdocs/societe/document.php +++ b/htdocs/societe/document.php @@ -111,7 +111,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; $form = new Form($db); $title = $langs->trans("ThirdParty").' - '.$langs->trans("Files"); -if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { +if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $object->name) { $title = $object->name.' - '.$langs->trans("Files"); } $help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; diff --git a/htdocs/societe/messaging.php b/htdocs/societe/messaging.php index b1275bfcdfe..f67ff9bd96f 100644 --- a/htdocs/societe/messaging.php +++ b/htdocs/societe/messaging.php @@ -123,7 +123,7 @@ if (empty($reshook)) { $form = new Form($db); $title = $langs->trans("Agenda"); -if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { +if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $object->name) { $title = $object->name." - ".$title; } llxHeader('', $title); diff --git a/htdocs/societe/note.php b/htdocs/societe/note.php index 7213426011e..84ed41d2731 100644 --- a/htdocs/societe/note.php +++ b/htdocs/societe/note.php @@ -83,7 +83,7 @@ if (empty($reshook)) { $form = new Form($db); $title = $langs->trans("ThirdParty").' - '.$langs->trans("Notes"); -if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { +if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $object->name) { $title = $object->name.' - '.$langs->trans("Notes"); } $help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; diff --git a/htdocs/societe/notify/card.php b/htdocs/societe/notify/card.php index 4962c150888..4bb53e3ea32 100644 --- a/htdocs/societe/notify/card.php +++ b/htdocs/societe/notify/card.php @@ -144,7 +144,7 @@ $object = new Societe($db); $result = $object->fetch($socid); $title = $langs->trans("ThirdParty").' - '.$langs->trans("Notification"); -if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { +if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $object->name) { $title = $object->name.' - '.$langs->trans("Notification"); } $help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index 24336db3de9..a41ebc88fb4 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -873,7 +873,7 @@ $formother = new FormOther($db); $formfile = new FormFile($db); $title = $langs->trans("ThirdParty"); -if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { +if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $object->name) { $title = $object->name." - ".$langs->trans('PaymentInformation'); } $help_url = ''; diff --git a/htdocs/societe/project.php b/htdocs/societe/project.php index 3ab7e0d712e..bad74c4d944 100644 --- a/htdocs/societe/project.php +++ b/htdocs/societe/project.php @@ -119,7 +119,7 @@ if ($socid) { $result = $object->fetch($socid); $title = $langs->trans("Projects"); - if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { + if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $object->name) { $title = $object->name." - ".$title; } llxHeader('', $title); diff --git a/htdocs/user/notify/card.php b/htdocs/user/notify/card.php index bd0158d91c2..cec29d8c356 100644 --- a/htdocs/user/notify/card.php +++ b/htdocs/user/notify/card.php @@ -143,7 +143,7 @@ $result = $object->fetch($id, '', '', 1); $object->getrights(); $title = $langs->trans("ThirdParty").' - '.$langs->trans("Notification"); -if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { +if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $object->name) { $title = $object->name.' - '.$langs->trans("Notification"); } $help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; diff --git a/htdocs/variants/class/ProductAttribute.class.php b/htdocs/variants/class/ProductAttribute.class.php index 38fa0793305..9c640c9932a 100644 --- a/htdocs/variants/class/ProductAttribute.class.php +++ b/htdocs/variants/class/ProductAttribute.class.php @@ -77,7 +77,7 @@ class ProductAttribute extends CommonObject * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" * 'label' the translation key. * 'picto' is code of a picto to show before value in forms - * 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM) + * 'enabled' is a condition when the field must be managed (Example: 1 or 'getDolGlobalString("MY_SETUP_PARAM")' * 'position' is the sort order of field. * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing) diff --git a/htdocs/variants/class/ProductAttributeValue.class.php b/htdocs/variants/class/ProductAttributeValue.class.php index 1c291476d9e..aac6c880ad5 100644 --- a/htdocs/variants/class/ProductAttributeValue.class.php +++ b/htdocs/variants/class/ProductAttributeValue.class.php @@ -55,7 +55,7 @@ class ProductAttributeValue extends CommonObjectLine * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" * 'label' the translation key. * 'picto' is code of a picto to show before value in forms - * 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM) + * 'enabled' is a condition when the field must be managed (Example: 1 or 'getDolGlobalString("MY_SETUP_PARAM")' * 'position' is the sort order of field. * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing) diff --git a/htdocs/website/class/websitepage.class.php b/htdocs/website/class/websitepage.class.php index 7d9d21357ed..c31844bbd6a 100644 --- a/htdocs/website/class/websitepage.class.php +++ b/htdocs/website/class/websitepage.class.php @@ -141,7 +141,7 @@ class WebsitePage extends CommonObject * 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password') * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" * 'label' the translation key. - * 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM) + * 'enabled' is a condition when the field must be managed (Example: 1 or 'getDolGlobalString("MY_SETUP_PARAM")' * 'position' is the sort order of field. * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing) diff --git a/htdocs/workstation/class/workstation.class.php b/htdocs/workstation/class/workstation.class.php index bed11601dc0..d7d99b8cc0e 100644 --- a/htdocs/workstation/class/workstation.class.php +++ b/htdocs/workstation/class/workstation.class.php @@ -73,7 +73,7 @@ class Workstation extends CommonObject * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" * 'label' the translation key. * 'picto' is code of a picto to show before value in forms - * 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM) + * 'enabled' is a condition when the field must be managed (Example: 1 or 'getDolGlobalString("MY_SETUP_PARAM")' * 'position' is the sort order of field. * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing) diff --git a/htdocs/workstation/workstation_agenda.php b/htdocs/workstation/workstation_agenda.php index 4e6853596bc..d0d792ce208 100644 --- a/htdocs/workstation/workstation_agenda.php +++ b/htdocs/workstation/workstation_agenda.php @@ -130,7 +130,6 @@ $form = new Form($db); if ($object->id > 0) { $title = $langs->trans("Agenda"); - //if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title; $help_url = 'EN:Module_Workstation'; llxHeader('', $title, $help_url); From 51322707e9f2cf24d2a4c86e7068c0e405004d45 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@users.sourceforge.net> Date: Fri, 22 Mar 2024 02:44:55 +0100 Subject: [PATCH 017/178] Try to fix phpunit with pgsql --- htdocs/core/db/pgsql.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index 43facbe2a19..f83bd277c7e 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -1137,7 +1137,7 @@ class DoliDBPgsql extends DoliDB $sql .= ")"; //$sql .= " engine=".$this->sanitize($type); - if (!$this->query($sql)) { + if (!$this->query($sql, 1)) { return -1; } else { return 1; @@ -1158,7 +1158,7 @@ class DoliDBPgsql extends DoliDB $sql = "DROP TABLE ".$this->sanitize($tmptable); - if (!$this->query($sql)) { + if (!$this->query($sql, 1)) { return -1; } else { return 1; From 7997db3eb923be616247db3af9e478914659671a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@users.sourceforge.net> Date: Fri, 22 Mar 2024 02:50:12 +0100 Subject: [PATCH 018/178] Fix bad table --- htdocs/install/mysql/migration/19.0.0-20.0.0.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/19.0.0-20.0.0.sql b/htdocs/install/mysql/migration/19.0.0-20.0.0.sql index f0e6b72901c..bd2693c356b 100644 --- a/htdocs/install/mysql/migration/19.0.0-20.0.0.sql +++ b/htdocs/install/mysql/migration/19.0.0-20.0.0.sql @@ -279,7 +279,7 @@ ALTER TABLE llx_ticket ADD COLUMN fk_barcode_type integer DEFAULT NULL after bar ALTER TABLE llx_ticket ADD UNIQUE INDEX uk_ticket_barcode_barcode_type (barcode, fk_barcode_type, entity); ALTER TABLE llx_ticket ADD CONSTRAINT llx_ticket_fk_product_barcode_type FOREIGN KEY (fk_barcode_type) REFERENCES llx_c_barcode_type (rowid); -ALTER TABLE llx_societe ADD COLUMN fk_parent integer NULL; +ALTER TABLE llx_socpeople ADD COLUMN fk_parent integer NULL; ALTER TABLE llx_expeditiondet ADD COLUMN fk_element integer; ALTER TABLE llx_expeditiondet ADD COLUMN element_type varchar(50) DEFAULT 'order' NOT NULL; From 1fa7013313dcebe6845d1fbe91ad90bf9b5acbb7 Mon Sep 17 00:00:00 2001 From: brad <brad@endurotags.com.au> Date: Fri, 22 Mar 2024 15:11:52 +1100 Subject: [PATCH 019/178] FIX Add state/province filter to email adv select --- htdocs/comm/mailing/advtargetemailing.php | 2 +- htdocs/core/tpl/advtarget.tpl.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/mailing/advtargetemailing.php b/htdocs/comm/mailing/advtargetemailing.php index e0098643747..e135b8ab378 100644 --- a/htdocs/comm/mailing/advtargetemailing.php +++ b/htdocs/comm/mailing/advtargetemailing.php @@ -1,4 +1,4 @@ -<?php + <?php /* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net> * diff --git a/htdocs/core/tpl/advtarget.tpl.php b/htdocs/core/tpl/advtarget.tpl.php index 42aba1b10ba..efd80c5141d 100644 --- a/htdocs/core/tpl/advtarget.tpl.php +++ b/htdocs/core/tpl/advtarget.tpl.php @@ -1,4 +1,4 @@ -<?php + <?php /* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com> * Copyright (C) 2024 Frédéric France <frederic.france@free.fr> */ From d351005cb1a893b102feaa360d7b5ac43d847297 Mon Sep 17 00:00:00 2001 From: brad <brad@endurotags.com.au> Date: Fri, 22 Mar 2024 15:19:18 +1100 Subject: [PATCH 020/178] FIX Add state/province filter to email adv select --- htdocs/comm/mailing/advtargetemailing.php | 2 +- .../mailing/class/advtargetemailing.class.php | 9 +++ .../html.formadvtargetemailing.class.php | 62 +++++++++++++++++++ htdocs/core/tpl/advtarget.tpl.php | 16 ++++- 4 files changed, 85 insertions(+), 4 deletions(-) diff --git a/htdocs/comm/mailing/advtargetemailing.php b/htdocs/comm/mailing/advtargetemailing.php index e0098643747..e135b8ab378 100644 --- a/htdocs/comm/mailing/advtargetemailing.php +++ b/htdocs/comm/mailing/advtargetemailing.php @@ -1,4 +1,4 @@ -<?php + <?php /* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net> * diff --git a/htdocs/comm/mailing/class/advtargetemailing.class.php b/htdocs/comm/mailing/class/advtargetemailing.class.php index e97f3d6df66..28bdb0b02d8 100644 --- a/htdocs/comm/mailing/class/advtargetemailing.class.php +++ b/htdocs/comm/mailing/class/advtargetemailing.class.php @@ -584,6 +584,9 @@ class AdvanceTargetingMailing extends CommonObject if (!empty($arrayquery['cust_saleman']) && count($arrayquery['cust_saleman']) > 0) { $sqlwhere[] = " (saleman.fk_user IN (".$this->db->sanitize(implode(',', $arrayquery['cust_saleman']))."))"; } + if (!empty($arrayquery['cust_state']) && count($arrayquery['cust_state']) > 0) { + $sqlwhere[] = " (t.fk_departement IN (".$this->db->sanitize(implode(',', $arrayquery['cust_state']))."))"; + } if (!empty($arrayquery['cust_country']) && count($arrayquery['cust_country']) > 0) { $sqlwhere[] = " (t.fk_pays IN (".$this->db->sanitize(implode(',', $arrayquery['cust_country']))."))"; } @@ -825,6 +828,12 @@ class AdvanceTargetingMailing extends CommonObject if (!empty($arrayquery['cust_saleman']) && count($arrayquery['cust_saleman']) > 0) { $sqlwhere[] = " (saleman.fk_user IN (".$this->db->sanitize(implode(',', $arrayquery['cust_saleman']))."))"; } + //if (!empty($arrayquery['cust_state'])) { + // $sqlwhere[] = $this->transformToSQL('tsd.nom', $arrayquery['cust_state']); + //} + if (!empty($arrayquery['cust_state']) && count($arrayquery['cust_state']) > 0) { + $sqlwhere[] = " (t.fk_departement IN (".$this->db->sanitize(implode(',', $arrayquery['cust_state']))."))"; + } if (!empty($arrayquery['cust_country']) && count($arrayquery['cust_country']) > 0) { $sqlwhere[] = " (ts.fk_pays IN (".$this->db->sanitize(implode(',', $arrayquery['cust_country']))."))"; } diff --git a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php index 70f7c9ba975..5ec9be92dbc 100644 --- a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php +++ b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php @@ -87,6 +87,68 @@ class FormAdvTargetEmailing extends Form return $this->advMultiselectarray($htmlname, $options_array, $selected_array); } + /** + * Return combo list of activated countries, into language of user + * + * @param string $htmlname of html select object + * @param array $selected_array or Code or Label of preselected country + * @return string HTML string with select + */ + public function multiselectState($htmlname = 'state_id', $selected_array = array()) + { + global $conf, $langs; + + $langs->load("dict"); + $maxlength = 0; + + $out = ''; + $countryArray = array(); + $label = array(); + + $options_array = array(); + + $sql = "SELECT d.rowid as rowid, d.code_departement as code_iso, d.nom as department, r.nom as region"; + $sql .= " FROM ".MAIN_DB_PREFIX."c_departements d"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions r on d.fk_region=r.code_region"; + $sql .= " WHERE d.active = 1 AND d.code_departement<>''"; + //$sql .= " ORDER BY r.nom ASC, d.nom ASC"; + + $resql = $this->db->query($sql); + if ($resql) { + $num = $this->db->num_rows($resql); + $i = 0; + if ($num) { + $foundselected = false; + + while ($i < $num) { + $obj = $this->db->fetch_object($resql); + $stateArray [$i] ['rowid'] = $obj->rowid; + $stateArray [$i] ['code_iso'] = $obj->code_iso; + $stateArray [$i] ['label'] = $obj->region.'/'.$obj->department; + //($obj->code_iso && $langs->transnoentitiesnoconv("Country".$obj->code_iso) != "Country".$obj->code_iso ? $langs->transnoentitiesnoconv("Country".$obj->code_iso) : ($obj->label != '-' ? $obj->label : '')); + $label[$i] = $stateArray[$i]['label']; + $i++; + } + + $array1_sort_order = SORT_ASC; + array_multisort($label, $array1_sort_order, $stateArray); + + foreach ($stateArray as $row) { + $label = dol_trunc($row['label'], $maxlength, 'middle'); + if ($row['code_iso']) { + $label .= ' ('.$row['code_iso'].')'; + } + + $options_array[$row['rowid']] = $label; + } + } + } else { + dol_print_error($this->db); + } + + return $this->advMultiselectarray($htmlname, $options_array, $selected_array); + } + /** * Return combo list of activated countries, into language of user * diff --git a/htdocs/core/tpl/advtarget.tpl.php b/htdocs/core/tpl/advtarget.tpl.php index 42aba1b10ba..0741286c1c8 100644 --- a/htdocs/core/tpl/advtarget.tpl.php +++ b/htdocs/core/tpl/advtarget.tpl.php @@ -1,4 +1,4 @@ -<?php + <?php /* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com> * Copyright (C) 2024 Frédéric France <frederic.france@free.fr> */ @@ -110,9 +110,9 @@ if (!empty($array_query['cust_code'])) { print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); $cust_code_str = (string) $array_query['cust_code']; } else { - $cust_code_str = "null"; + $cust_code_str = null; } -print '</td><td><input type="text" name="cust_code" value="'.$cust_code_str.'"/></td><td>'."\n"; +print '</td><td><input type="text" name="cust_code"'.($cust_code_str!=null?' value="'.$cust_code_str:'').'"/></td><td>'."\n"; print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); print '</td></tr>'."\n"; @@ -143,6 +143,16 @@ print '</td><td><input type="text" name="cust_city" value="'.$array_query['cust_ print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); print '</td></tr>'."\n"; +// State Client +print '<tr><td>'.$langs->trans('State'); +if (!empty($array_query['cust_state'])) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); +} +print '</td><td>'."\n"; +print $formadvtargetemaling->multiselectState('cust_state', $array_query['cust_state']); +print '</td><td>'."\n"; +print '</td></tr>'."\n"; + // Customer Country print '<tr><td>'.$langs->trans("Country"); if (!empty($array_query['cust_country'])) { From ca36c740e519d424354cda614c31afd0b36867ea Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Thu, 21 Mar 2024 17:15:19 +0100 Subject: [PATCH 021/178] "Qual: Add dependencies between workflows # Qual: Add dependencies between workflows Run costly workflows only after a few workflows succeed (pre-commit, phan). --- .github/workflows/README.md | 16 ++++++ .github/workflows/ci.yml | 40 +++++++++++++++ .github/workflows/gh-travis.yml | 49 +++++++++++++++++++ .github/workflows/phan.yml | 21 +++++--- .github/workflows/phpstan.yml | 42 ++++++++++------ .github/workflows/pre-commit.yml | 21 +++++--- .../{windows-ci.yaml => windows-ci.yml} | 15 ++++-- 7 files changed, 172 insertions(+), 32 deletions(-) create mode 100644 .github/workflows/README.md create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/gh-travis.yml rename .github/workflows/{windows-ci.yaml => windows-ci.yml} (94%) diff --git a/.github/workflows/README.md b/.github/workflows/README.md new file mode 100644 index 00000000000..fbe406e6c46 --- /dev/null +++ b/.github/workflows/README.md @@ -0,0 +1,16 @@ +# Workflow run order + +To reduce run minutes, the following order is put in place: + +On PR & Merge, always run: + +- pre-commit; +- phan. + +When both succeed, start: + +- phpstan; +- Windows-ci; +- travis. + +See https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#running-a-workflow-based-on-the-conclusion-of-another-workflow diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000000..39edbc3496b --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,40 @@ +name: "CI" + +on: [push, pull_request] +jobs: + pre-commit: + uses: ./.github/workflows/pre-commit.yml + secrets: inherit + with: + gh_event: ${{ github.event_name }} + phan: + uses: ./.github/workflows/phan.yml + secrets: inherit + with: + gh_event: ${{ github.event_name }} + phpstan: + uses: ./.github/workflows/phpstan.yml + secrets: inherit + needs: [pre-commit, phan] + with: + gh_event: ${{ github.event_name }} + windows-ci: + needs: [pre-commit, phan] + secrets: inherit + uses: ./.github/workflows/windows-ci.yml + with: + gh_event: ${{ github.event_name }} + gh-travis: # Runs travis script on github runner (not on travis) + if: false + # needs: [pre-commit, phan] + # needs: [windows-ci] + secrets: inherit + uses: ./.github/workflows/gh-travis.yml + with: + gh_event: ${{ github.event_name }} + + +# Note (not tested, from https://github.com/orgs/community/discussions/38361) +# To cancel jobs if one failes, the following action may help +# - if: "failure()" +# uses: "andymckay/cancel-action@0.3" diff --git a/.github/workflows/gh-travis.yml b/.github/workflows/gh-travis.yml new file mode 100644 index 00000000000..30c10765f07 --- /dev/null +++ b/.github/workflows/gh-travis.yml @@ -0,0 +1,49 @@ +--- +# This runs a travis script inside a github runner +name: Travis +# Controls when the workflow will run +on: + # push: + # pull_request: + workflow_call: + inputs: + gh_event: + required: true + type: string + workflow_dispatch: + +concurrency: + group: travis-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref + }} + cancel-in-progress: true +env: + gh_event: ${{ inputs.gh_event || github.event_name }} + GITHUB_JSON: ${{ toJSON(github) }} # Helps in debugging Github Action +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job + gh-travis: + # The type of runner that the job will run on + runs-on: ubuntu-latest + strategy: + fail-fast: false + # matrix: + # php-version: + # # PHPStan requires PHP >= 7.2. + # #- "7.2" + # - "8.2" + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + - name: Checkout travis file + uses: actions/checkout@v4 + - name: Run .travis.yml build script + uses: ktomk/run-travis-yml@v1 + with: + # run-job: travis # name of a job in travis file + allow-failure: false + # file: .travis.yml + # steps: | # Default: setup, before_install, install, before_script, script, after_script, before_deploy + # install + # script + # env: + # TRAVIS_PHP_VERSION: ${{ matrix.php-version }} diff --git a/.github/workflows/phan.yml b/.github/workflows/phan.yml index 67bec077a13..f233c24907c 100644 --- a/.github/workflows/phan.yml +++ b/.github/workflows/phan.yml @@ -1,16 +1,22 @@ --- on: - pull_request: - push: - schedule: - # execute once a day, the 1st - - cron: 10 9 * * * + # pull_request: + # push: + # schedule: + # # execute once a day, the 1st + # - cron: 10 9 * * * + workflow_call: + inputs: + gh_event: + required: true + type: string workflow_dispatch: + concurrency: - group: ${{ github.workflow }}-${{ github.ref }} + group: phan-${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true env: - # Do pull analysis on schedule or manual dispatch + gh_event: ${{ inputs.gh_event || github.event_name }} PHAN_CONFIG: > ${{ ( github.event.schedule || github.event_name == 'workflow_dispatch' ) @@ -21,6 +27,7 @@ env: PHAN_MIN_PHP: 7.0 PHAN_QUICK: ${{ github.event.schedule && '' || '--quick' }} GITHUB_JSON: ${{ toJSON(github) }} # Helps in debugging Github Action + name: phan jobs: phan: diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index cbe0f4b2732..c638ee83e50 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -1,16 +1,25 @@ +--- # This is a basic workflow to check code with PHPSTAN tool - -name: "PHPStan" - +name: PHPStan # Controls when the workflow will run -on: [push, pull_request] -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true +on: + # push: + # pull_request: + workflow_call: + inputs: + gh_event: + required: true + type: string + workflow_dispatch: +concurrency: + group: stan-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref + }} + cancel-in-progress: true env: - CACHE_KEY_PART: ${{ github.event_name == 'pull_request' && format('{0}-{1}', github.base_ref, github.head_ref) || github.ref_name }} - GITHUB_JSON: ${{ toJSON(github) }} # Helps in debugging Github Action + gh_event: ${{ inputs.gh_event || github.event_name }} + CACHE_KEY_PART: ${{ ( inputs.gh_event == 'pull_request' || github.event_name == 'pull_request' ) && format('{0}-{1}', github.base_ref, github.head_ref) || github.ref_name }} + GITHUB_JSON: ${{ toJSON(github) }} # Helps in debugging Github Action # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: # This workflow contains a single job @@ -23,7 +32,7 @@ jobs: php-version: # PHPStan requires PHP >= 7.2. #- "7.2" - - "8.2" + - '8.2' # Steps represent a sequence of tasks that will be executed as part of the job steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it @@ -34,9 +43,10 @@ jobs: id: setup-php uses: shivammathur/setup-php@v2 with: - php-version: "${{ matrix.php-version }}" + php-version: ${{ matrix.php-version }} tools: phpstan, cs2pr - extensions: calendar, json, imagick, gd, zip, mbstring, intl, opcache, imap, mysql, pgsql, sqlite3, ldap, xml, mcrypt + extensions: calendar, json, imagick, gd, zip, mbstring, intl, opcache, imap, + mysql, pgsql, sqlite3, ldap, xml, mcrypt # Restore old cache - name: Restore phpstan cache @@ -44,7 +54,8 @@ jobs: uses: actions/cache/restore@v4 with: path: ./.github/tmp - key: phpstan-cache-${{ matrix.php-version }}-${{ env.CACHE_KEY_PART }}-${{ github.run_id }} + key: phpstan-cache-${{ matrix.php-version }}-${{ env.CACHE_KEY_PART }}-${{ + github.run_id }} restore-keys: | phpstan-cache-${{ matrix.php-version }}-${{ env.CACHE_KEY_PART }}- phpstan-cache-${{ matrix.php-version }}-${{ github.head_ref }}- @@ -61,12 +72,13 @@ jobs: # continue-on-error: true # Save cache - - name: "Save phpstan cache" + - name: Save phpstan cache uses: actions/cache/save@v4 if: ${{ success() || ( ! cancelled() && steps.cache.outputs.cache-hit != 'true' ) }} with: path: ./.github/tmp - key: phpstan-cache-${{ matrix.php-version }}-${{ env.CACHE_KEY_PART }}-${{ github.run_id }} + key: phpstan-cache-${{ matrix.php-version }}-${{ env.CACHE_KEY_PART }}-${{ + github.run_id }} - name: Provide phpstan log as artifact uses: actions/upload-artifact@v4 if: ${{ always() }} diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 671a266c767..f113a8a7a36 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -1,8 +1,17 @@ --- name: pre-commit on: - pull_request: - push: + # pull_request: + # push: + workflow_call: + inputs: + gh_event: + required: true + type: string + workflow_dispatch: + +env: + gh_event: ${{ inputs.gh_event || github.event_name }} jobs: pre-commit: runs-on: ubuntu-latest @@ -20,7 +29,7 @@ jobs: - name: Get all changed php files (if PR) id: changed-php uses: tj-actions/changed-files@v43 - if: github.event_name == 'pull_request' + if: env.gh_event == 'pull_request' with: files: | **.php @@ -58,7 +67,7 @@ jobs: # - name: Get all changed php files (if PR) # id: changed-php # uses: tj-actions/changed-files@v43 - # if: github.event_name == 'pull_request' + # if: env.gh_event == 'pull_request' # with: # files: | # **.php @@ -72,7 +81,7 @@ jobs: steps.changed-php.outputs.any_changed == 'true' || ( - github.event_name == 'push' + env.gh_event == 'push' && ( github.event.ref == 'refs/heads/develop' || endsWith(github.event.ref, '.0') @@ -94,7 +103,7 @@ jobs: - name: Run some pre-commit hooks on all files on push to "main" branches if: | - github.event_name == 'push' + env.gh_event == 'push' && ( github.event.ref == 'refs/heads/develop' || endsWith(github.event.ref, '.0') diff --git a/.github/workflows/windows-ci.yaml b/.github/workflows/windows-ci.yml similarity index 94% rename from .github/workflows/windows-ci.yaml rename to .github/workflows/windows-ci.yml index cb467055156..f85ad2535be 100644 --- a/.github/workflows/windows-ci.yaml +++ b/.github/workflows/windows-ci.yml @@ -2,19 +2,26 @@ name: Win CI # yamllint disable-line rule:truthy on: - push: - pull_request: + # push: + # pull_request: + workflow_call: + inputs: + gh_event: + required: true + type: string workflow_dispatch: + concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref + group: win-ci-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true env: + gh_event: ${{ inputs.gh_event || github.event_name }} PHPUNIT_LOG: phpunit_tests.log DOLIBARR_LOG: documents/dolibarr.log PHPSERVER_LOG: phpserver.log PHPSERVER_DOMAIN_PORT: 127.0.0.1:8000 # could be 127.0.0.1:8000 if config modified - CACHE_KEY_PART: ${{ github.event_name == 'pull_request' && format('{0}-{1}', github.base_ref, github.head_ref) || github.ref_name }} + CACHE_KEY_PART: ${{ ( inputs.gh_event == 'pull_request' || github.event_name == 'pull_request' ) && format('{0}-{1}', github.base_ref, github.head_ref) || github.ref_name }} PHP_INI_SCAN_DIR: C:\myphpini CKEY: win-ci-2 GITHUB_JSON: ${{ toJSON(github) }} # Helps in debugging Github Action From b8c16af0a32be542428f8d08f9b306d88d0c27a5 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Thu, 21 Mar 2024 12:29:00 +0100 Subject: [PATCH 022/178] Qual: Enable PhanTypeInvalidLeftOperandOfAdd --- dev/tools/phan/config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tools/phan/config.php b/dev/tools/phan/config.php index 01043b3adc3..8b4a5d5ab45 100644 --- a/dev/tools/phan/config.php +++ b/dev/tools/phan/config.php @@ -463,7 +463,7 @@ return [ // 'PhanTypeMismatchPropertyProbablyReal', // 'PhanPluginNoCommentOnPrivateMethod', 'PhanPluginUnknownArrayFunctionReturnType', - 'PhanTypeInvalidLeftOperandOfAdd', + // 'PhanTypeInvalidLeftOperandOfAdd', // 'PhanPluginNoCommentOnPrivateProperty', // 'PhanPluginNoCommentOnFunction', 'PhanPluginUnknownArrayFunctionParamType', From b267d7fcb88beacadb7c7d62b0d314ad088c8f8f Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Thu, 21 Mar 2024 12:27:37 +0100 Subject: [PATCH 023/178] Fix PhanTypeInvalidLeftOperandOfAdd with casts --- htdocs/admin/boxes.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/boxes.php b/htdocs/admin/boxes.php index 99d56c35658..b8d523666aa 100644 --- a/htdocs/admin/boxes.php +++ b/htdocs/admin/boxes.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2022 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> + * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com> * * 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 @@ -177,7 +178,7 @@ if ($action == 'switch') { $newsecond = $objfrom->box_order; if ($newfirst == $newsecond) { $newsecondchar = preg_replace('/[0-9]+/', '', $newsecond); - $newsecondnum = preg_replace('/[a-zA-Z]+/', '', $newsecond); + $newsecondnum = (int) preg_replace('/[a-zA-Z]+/', '', $newsecond); $newsecond = sprintf("%s%02d", $newsecondchar ? $newsecondchar : 'A', $newsecondnum + 1); } From 5d6ae6e9c06f5e10c449fbc158c2f3c457878032 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Thu, 21 Mar 2024 21:31:57 +0100 Subject: [PATCH 024/178] Fix PhanTypeInvalidLeftOperandOfAdd with casts --- htdocs/admin/security.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/security.php b/htdocs/admin/security.php index ab111f7c67f..dd8278f19bf 100644 --- a/htdocs/admin/security.php +++ b/htdocs/admin/security.php @@ -144,14 +144,14 @@ if ($action == 'activate_MAIN_SECURITY_DISABLEFORGETPASSLINK') { if ($action == 'updatepattern') { $pattern = GETPOST("pattern", "alpha"); - $explodePattern = explode(';', $pattern); + $explodePattern = explode(';', $pattern); // List of ints separated with ';' containing counts $patternInError = false; - if ($explodePattern[0] < 1 || $explodePattern[4] < 0) { + if ((int) $explodePattern[0] < 1 || (int) $explodePattern[4] < 0) { $patternInError = true; } - if ($explodePattern[0] < $explodePattern[1] + $explodePattern[2] + $explodePattern[3]) { + if ((int) $explodePattern[0] < (int) $explodePattern[1] + (int) $explodePattern[2] + (int) $explodePattern[3]) { $patternInError = true; } From a6f69d3304ab10330765930c367da0fc2037d8af Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Thu, 21 Mar 2024 21:32:00 +0100 Subject: [PATCH 025/178] Fix PhanTypeInvalidLeftOperandOfAdd with casts --- htdocs/comm/action/card.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 9b688ac3d3e..833fa00ef57 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -495,10 +495,10 @@ if (empty($reshook) && $action == 'add') { $selectedrecurrulefreq = $reg1[1]; } if ($object->recurrule && preg_match('/FREQ=MONTHLY.*BYMONTHDAY(\d+)/i', $object->recurrule, $reg2)) { - $selectedrecurrulebymonthday = $reg2[1]; + $selectedrecurrulebymonthday = (int) $reg2[1]; } if ($object->recurrule && preg_match('/FREQ=WEEKLY.*BYDAY(\d+)/i', $object->recurrule, $reg3)) { - $selectedrecurrulebyday = $reg3[1]; + $selectedrecurrulebyday = (int) $reg3[1]; } // Is event recurrent ? @@ -1300,10 +1300,10 @@ if ($action == 'create') { $selectedrecurrulefreq = $reg[1]; } if ($object->recurrule && preg_match('/FREQ=MONTHLY.*BYMONTHDAY(\d+)/i', $object->recurrule, $reg)) { - $selectedrecurrulebymonthday = $reg[1]; + $selectedrecurrulebymonthday = (int) $reg[1]; } if ($object->recurrule && preg_match('/FREQ=WEEKLY.*BYDAY(\d+)/i', $object->recurrule, $reg)) { - $selectedrecurrulebyday = $reg[1]; + $selectedrecurrulebyday = (int) $reg[1]; } print $form->selectarray('recurrulefreq', $arrayrecurrulefreq, $selectedrecurrulefreq, 0, 0, 0, '', 0, 0, 0, '', 'marginrightonly'); From b1675d5139eb1c5794061a2c3cbfeb97259345a8 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Thu, 21 Mar 2024 22:00:20 +0100 Subject: [PATCH 026/178] Type return value for getLocalTaxesFromRate --- htdocs/core/lib/functions.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index d150e866f02..e781a8e9d6a 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -6562,7 +6562,7 @@ function showDimensionInBestUnit($dimension, $unit, $type, $outputlangs, $round * @param Societe $thirdparty_buyer Object of buying third party * @param Societe $thirdparty_seller Object of selling third party ($mysoc if not defined) * @param int $vatnpr If vat rate is NPR or not - * @return mixed 0 if not found, localtax rate if found + * @return int<0,0>|string 0 if not found, localtax rate if found * @see get_default_tva() */ function get_localtax($vatrate, $local, $thirdparty_buyer = null, $thirdparty_seller = null, $vatnpr = 0) @@ -6826,7 +6826,7 @@ function getTaxesFromId($vatrate, $buyer = null, $seller = null, $firstparamisid * @param Societe $buyer Company object * @param Societe $seller Company object * @param int $firstparamisid 1 if first param is ID into table instead of Rate+code (use this if you can) - * @return array array(localtax_type1(1-6 or 0 if not found), rate localtax1, localtax_type2, rate localtax2, accountancycodecust, accountancycodesupp) + * @return array{}|array{0:string,1:float,2:string,3:string}|array{0:string,1:float,2:string,3:float,4:string,5:string} array(localtax_type1(1-6 or 0 if not found), rate localtax1, localtax_type2, rate localtax2, accountancycodecust, accountancycodesupp) * @see getTaxesFromId() */ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisid = 0) From 8137af9b9d2c5f364222b9d223f989fab5124e09 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Thu, 21 Mar 2024 22:10:24 +0100 Subject: [PATCH 027/178] Fix typing with casts and a few ignores --- htdocs/core/lib/price.lib.php | 48 +++++++++++++++++------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/htdocs/core/lib/price.lib.php b/htdocs/core/lib/price.lib.php index 9da3eaf69c2..1faf1a0e828 100644 --- a/htdocs/core/lib/price.lib.php +++ b/htdocs/core/lib/price.lib.php @@ -280,33 +280,33 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt $result[6] = price2num($tot_sans_remise, 'MT'); $result[8] = price2num($tot_sans_remise * (1 + ((($info_bits & 1) ? 0 : $txtva) / 100)) + $localtaxes[0], 'MT'); // Selon TVA NPR ou non $result8bis = price2num($tot_sans_remise * (1 + ($txtva / 100)) + $localtaxes[0], 'MT'); // Si TVA consideree normal (non NPR) - $result[7] = price2num($result8bis - ($result[6] + $localtaxes[0]), 'MT'); + $result[7] = price2num($result8bis - ((float) $result[6] + $localtaxes[0]), 'MT'); $result[0] = price2num($tot_avec_remise, 'MT'); $result[2] = price2num($tot_avec_remise * (1 + ((($info_bits & 1) ? 0 : $txtva) / 100)) + $localtaxes[1], 'MT'); // Selon TVA NPR ou non $result2bis = price2num($tot_avec_remise * (1 + ($txtva / 100)) + $localtaxes[1], 'MT'); // Si TVA consideree normal (non NPR) - $result[1] = price2num($result2bis - ($result[0] + $localtaxes[1]), 'MT'); // Total VAT = TTC - (HT + localtax) + $result[1] = price2num($result2bis - ((float) $result[0] + $localtaxes[1]), 'MT'); // Total VAT = TTC - (HT + localtax) $result[3] = price2num($pu, 'MU'); $result[5] = price2num($pu * (1 + ((($info_bits & 1) ? 0 : $txtva) / 100)) + $localtaxes[2], 'MU'); // Selon TVA NPR ou non $result5bis = price2num($pu * (1 + ($txtva / 100)) + $localtaxes[2], 'MU'); // Si TVA consideree normal (non NPR) - $result[4] = price2num($result5bis - ($result[3] + $localtaxes[2]), 'MU'); + $result[4] = price2num($result5bis - ((float) $result[3] + $localtaxes[2]), 'MU'); } else { // We work to define prices using the price with tax $result[8] = price2num($tot_sans_remise + $localtaxes[0], 'MT'); $result[6] = price2num($tot_sans_remise / (1 + ((($info_bits & 1) ? 0 : $txtva) / 100)), 'MT'); // Selon TVA NPR ou non $result6bis = price2num($tot_sans_remise / (1 + ($txtva / 100)), 'MT'); // Si TVA consideree normal (non NPR) - $result[7] = price2num($result[8] - ($result6bis + $localtaxes[0]), 'MT'); + $result[7] = price2num($result[8] - ((float) $result6bis + $localtaxes[0]), 'MT'); - $result[2] = price2num($tot_avec_remise + $localtaxes[1], 'MT'); - $result[0] = price2num($tot_avec_remise / (1 + ((($info_bits & 1) ? 0 : $txtva) / 100)), 'MT'); // Selon TVA NPR ou non - $result0bis = price2num($tot_avec_remise / (1 + ($txtva / 100)), 'MT'); // Si TVA consideree normal (non NPR) - $result[1] = price2num($result[2] - ($result0bis + $localtaxes[1]), 'MT'); // Total VAT = TTC - (HT + localtax) + $result[2] = price2num((float) $tot_avec_remise + (float) $localtaxes[1], 'MT'); + $result[0] = price2num((float) $tot_avec_remise / (1 + ((($info_bits & 1) ? 0 : (float) $txtva) / 100)), 'MT'); // Selon TVA NPR ou non + $result0bis = price2num((float) $tot_avec_remise / (1 + ((float) $txtva / 100)), 'MT'); // Si TVA consideree normal (non NPR) + $result[1] = price2num((float) $result[2] - ((float) $result0bis + (float) $localtaxes[1]), 'MT'); // Total VAT = TTC - (HT + localtax) $result[5] = price2num($pu + $localtaxes[2], 'MU'); $result[3] = price2num($pu / (1 + ((($info_bits & 1) ? 0 : $txtva) / 100)), 'MU'); // Selon TVA NPR ou non $result3bis = price2num($pu / (1 + ($txtva / 100)), 'MU'); // Si TVA consideree normal (non NPR) - $result[4] = price2num($result[5] - ($result3bis + $localtaxes[2]), 'MU'); + $result[4] = price2num((float) $result[5] - ((float) $result3bis + (float) $localtaxes[2]), 'MU'); } // if there's some localtax without vat, we calculate localtaxes (we will add them at end) @@ -375,17 +375,17 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt // If rounding is not using base 10 (rare) if (getDolGlobalString('MAIN_ROUNDING_RULE_TOT')) { if ($price_base_type == 'HT') { - $result[0] = price2num(round($result[0] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT'); - $result[1] = price2num(round($result[1] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT'); - $result[9] = price2num(round($result[9] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT'); - $result[10] = price2num(round($result[10] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT'); - $result[2] = price2num($result[0] + $result[1] + $result[9] + $result[10], 'MT'); + $result[0] = price2num(round((float) $result[0] / (float) $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT'); + $result[1] = price2num(round((float) $result[1] / (float) $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT'); + $result[9] = price2num(round((float) $result[9] / (float) $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT'); + $result[10] = price2num(round((float) $result[10] / (float) $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT'); + $result[2] = price2num((float) $result[0] + (float) $result[1] + (float) $result[9] + (float) $result[10], 'MT'); } else { - $result[1] = price2num(round($result[1] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT'); - $result[2] = price2num(round($result[2] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT'); - $result[9] = price2num(round($result[9] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT'); - $result[10] = price2num(round($result[10] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT'); - $result[0] = price2num($result[2] - $result[1] - $result[9] - $result[10], 'MT'); + $result[1] = price2num(round((float) $result[1] / (float) $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT'); + $result[2] = price2num(round((float) $result[2] / (float) $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT'); + $result[9] = price2num(round((float) $result[9] / (float) $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT'); + $result[10] = price2num(round((float) $result[10] / (float) $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT'); + $result[0] = price2num((float) $result[2] - (float) $result[1] - (float) $result[9] - (float) $result[10], 'MT'); } } @@ -412,9 +412,9 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt if ($multicurrency_code) { // Restore setup of currency accurency - $conf->global->MAIN_MAX_DECIMALS_UNIT = $savMAIN_MAX_DECIMALS_UNIT; - $conf->global->MAIN_MAX_DECIMALS_TOT = $savMAIN_MAX_DECIMALS_TOT; - $conf->global->MAIN_ROUNDING_RULE_TOT = $savMAIN_ROUNDING_RULE_TOT; + $conf->global->MAIN_MAX_DECIMALS_UNIT = $savMAIN_MAX_DECIMALS_UNIT; // @phan-ignore-current-line PhanPossiblyUndeclaredVariable + $conf->global->MAIN_MAX_DECIMALS_TOT = $savMAIN_MAX_DECIMALS_TOT; // @phan-ignore-current-line PhanPossiblyUndeclaredVariable + $conf->global->MAIN_ROUNDING_RULE_TOT = $savMAIN_ROUNDING_RULE_TOT; // @phan-ignore-current-line PhanPossiblyUndeclaredVariable } $result[16] = $newresult[0]; @@ -438,8 +438,8 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt $result[22] = $result[6]; $result[23] = $result[7]; $result[24] = $result[8]; - $result[25] = $result[9]; - $result[26] = $result[10]; + $result[25] = $result[9]; // @phan-ignore-current-line PhanTypePossiblyInvalidDimOffset + $result[26] = $result[10]; // @phan-ignore-current-line PhanTypePossiblyInvalidDimOffset } dol_syslog('Price.lib::calcul_price_total MAIN_ROUNDING_RULE_TOT='.getDolGlobalString('MAIN_ROUNDING_RULE_TOT').' pu='.$pu.' qty='.$qty.' price_base_type='.$price_base_type.' total_ht='.$result[0].'-total_vat='.$result[1].'-total_ttc='.$result[2]); From b2a3985fb35b52874eeda9e1749089b67b6cb671 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Thu, 21 Mar 2024 22:11:09 +0100 Subject: [PATCH 028/178] Fix typing with casts, idate and fix month/year formatting --- htdocs/compta/bank/graph.php | 37 ++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/htdocs/compta/bank/graph.php b/htdocs/compta/bank/graph.php index 8d2b44c40af..97e362145ae 100644 --- a/htdocs/compta/bank/graph.php +++ b/htdocs/compta/bank/graph.php @@ -2,6 +2,7 @@ /* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com> + * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com> * * 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 @@ -125,12 +126,14 @@ if ($result < 0) { // Loading table $amounts $amounts = array(); - $monthnext = $month + 1; - $yearnext = $year; + $monthnext = (int) $month + 1; + $yearnext = (int) $year; if ($monthnext > 12) { $monthnext = 1; $yearnext++; } + $monthnext = sprintf('%02d', $monthnext); + $yearnext = sprintf('%04d', $yearnext); $sql = "SELECT date_format(b.datev,'%Y%m%d')"; $sql .= ", SUM(b.amount)"; @@ -534,12 +537,14 @@ if ($result < 0) { $credits = array(); $debits = array(); - $monthnext = $month + 1; - $yearnext = $year; + $monthnext = (int) $month + 1; + $yearnext = (int) $year; if ($monthnext > 12) { $monthnext = 1; $yearnext++; } + $monthnext = sprintf('%02d', $monthnext); + $yearnext = sprintf('%04d', $yearnext); $sql = "SELECT date_format(b.datev,'%d')"; $sql .= ", SUM(b.amount)"; @@ -569,12 +574,14 @@ if ($result < 0) { dol_print_error($db); } - $monthnext = $month + 1; - $yearnext = $year; + $monthnext = (int) $month + 1; + $yearnext = (int) $year; if ($monthnext > 12) { $monthnext = 1; $yearnext++; } + $monthnext = sprintf('%02d', $monthnext); + $yearnext = sprintf('%04d', $yearnext); $sql = "SELECT date_format(b.datev,'%d')"; $sql .= ", SUM(b.amount)"; @@ -805,10 +812,10 @@ print '</table>'; // Graphs if ($mode == 'standard') { - $prevyear = $year; - $nextyear = $year; - $prevmonth = $month - 1; - $nextmonth = $month + 1; + $prevyear = (int) $year; + $nextyear = (int) $year; + $prevmonth = (int) $month - 1; + $nextmonth = (int) $month + 1; if ($prevmonth < 1) { $prevmonth = 12; $prevyear--; @@ -817,6 +824,10 @@ if ($mode == 'standard') { $nextmonth = 1; $nextyear++; } + $nextmonth = sprintf('%02d', $nextmonth); + $prevmonth = sprintf('%02d', $prevmonth); + $nextyear = sprintf('%04d', $nextyear); + $prevyear = sprintf('%04d', $prevyear); // For month $link = "<a href='".$_SERVER["PHP_SELF"]."?account=".$account.(GETPOST("option") != 'all' ? '' : '&option=all')."&year=".$prevyear."&month=".$prevmonth."'>".img_previous('', 'class="valignbottom"')."</a> ".$langs->trans("Month")." <a href='".$_SERVER["PHP_SELF"]."?account=".$account.(GETPOST("option") != 'all' ? '' : '&option=all')."&year=".$nextyear."&month=".$nextmonth."'>".img_next('', 'class="valignbottom"')."</a>"; @@ -832,8 +843,10 @@ if ($mode == 'standard') { print '</div>'; // For year - $prevyear = $year - 1; - $nextyear = $year + 1; + $prevyear = (int) $year - 1; + $nextyear = (int) $year + 1; + $nextyear = sprintf('%04d', $nextyear); + $prevyear = sprintf('%04d', $prevyear); $link = "<a href='".$_SERVER["PHP_SELF"]."?account=".$account.(GETPOST("option") != 'all' ? '' : '&option=all')."&year=".($prevyear)."'>".img_previous('', 'class="valignbottom"')."</a> ".$langs->trans("Year")." <a href='".$_SERVER["PHP_SELF"]."?account=".$account.(GETPOST("option") != 'all' ? '' : '&option=all')."&year=".($nextyear)."'>".img_next('', 'class="valignbottom"')."</a>"; print '<div class="right clearboth margintoponly">'.$link.'</div>'; From 6eeab82dd420df854bfed331d342cfea664a58b4 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Thu, 21 Mar 2024 22:12:37 +0100 Subject: [PATCH 029/178] Fix typing with casts --- htdocs/comm/remx.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php index 1ed17699c6d..a357157a98a 100644 --- a/htdocs/comm/remx.php +++ b/htdocs/comm/remx.php @@ -84,7 +84,7 @@ if ($action == 'confirm_split' && GETPOST("confirm", "alpha") == 'yes' && $permi $error++; setEventMessages($langs->trans("ErrorFailedToLoadDiscount"), null, 'errors'); } - if (!$error && price2num($amount_ttc_1 + $amount_ttc_2) != $discount->amount_ttc) { + if (!$error && price2num((float) $amount_ttc_1 + (float) $amount_ttc_2) != $discount->amount_ttc) { $error++; setEventMessages($langs->trans("TotalOfTwoDiscountMustEqualsOriginal"), null, 'errors'); } From 629e445f307ed560bb265c74acda1898313ef751 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Thu, 21 Mar 2024 22:13:50 +0100 Subject: [PATCH 030/178] Fix typing with casts --- htdocs/compta/cashcontrol/report.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/cashcontrol/report.php b/htdocs/compta/cashcontrol/report.php index bf6a7310720..0fbf1d232f8 100644 --- a/htdocs/compta/cashcontrol/report.php +++ b/htdocs/compta/cashcontrol/report.php @@ -387,7 +387,7 @@ if ($resql) { print '<br>'; } - print $langs->trans("Total").' ('.$totalqty.' '.$langs->trans("Articles").') : <div class="inline-block amount width100">'.price($cash + $cheque + $bank + $other).'</div>'; + print $langs->trans("Total").' ('.$totalqty.' '.$langs->trans("Articles").') : <div class="inline-block amount width100">'.price((float) $cash + (float) $cheque + (float) $bank + (float) $other).'</div>'; print '<br>'.$langs->trans("TotalVAT").' : <div class="inline-block amount width100">'.price($totalvat).'</div>'; From c7c0d77dc875a97187d0da32fefc769a2e01c3f2 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Thu, 21 Mar 2024 22:18:23 +0100 Subject: [PATCH 031/178] Fix typing with casts --- htdocs/core/lib/profid.lib.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/core/lib/profid.lib.php b/htdocs/core/lib/profid.lib.php index fa5a75aae7e..18b787819bb 100644 --- a/htdocs/core/lib/profid.lib.php +++ b/htdocs/core/lib/profid.lib.php @@ -171,7 +171,7 @@ function isValidTinForBE($str) * - NIE = Número de Identidad de Extranjero * * @param string $str TIN to check - * @return int 1 if NIF ok, 2 if CIF ok, 3 if NIE ok, -1 if NIF bad, -2 if CIF bad, -3 if NIE bad, -4 if unexpected bad + * @return int<-4,3> 1 if NIF ok, 2 if CIF ok, 3 if NIE ok, -1 if NIF bad, -2 if CIF bad, -3 if NIE bad, -4 if unexpected bad * @since Dolibarr V20 */ function isValidTinForES($str) @@ -192,7 +192,7 @@ function isValidTinForES($str) //Check NIF if (preg_match('/(^[0-9]{8}[A-Z]{1}$)/', $str)) { - if ($num[8] == substr('TRWAGMYFPDXBNJZSQVHLCKE', substr($str, 0, 8) % 23, 1)) { + if ($num[8] == substr('TRWAGMYFPDXBNJZSQVHLCKE', (int) substr($str, 0, 8) % 23, 1)) { return 1; } else { return -1; @@ -200,15 +200,15 @@ function isValidTinForES($str) } //algorithm checking type code CIF - $sum = $num[2] + $num[4] + $num[6]; + $sum = (int) $num[2] + (int) $num[4] + (int) $num[6]; for ($i = 1; $i < 8; $i += 2) { - $sum += intval(substr((string) (2 * $num[$i]), 0, 1)) + intval(substr((string) (2 * $num[$i]), 1, 1)); + $sum += intval(substr((string) (2 * (int) $num[$i]), 0, 1)) + intval(substr((string) (2 * (int) $num[$i]), 1, 1)); } $n = 10 - substr((string) $sum, strlen((string) $sum) - 1, 1); //Check special NIF if (preg_match('/^[KLM]{1}/', $str)) { - if ($num[8] == chr(64 + $n) || $num[8] == substr('TRWAGMYFPDXBNJZSQVHLCKE', substr($str, 1, 8) % 23, 1)) { + if ($num[8] == chr(64 + $n) || $num[8] == substr('TRWAGMYFPDXBNJZSQVHLCKE', (int) substr($str, 1, 8) % 23, 1)) { return 1; } else { return -1; @@ -235,7 +235,7 @@ function isValidTinForES($str) //Check NIE XYZ if (preg_match('/^[XYZ]{1}/', $str)) { - if ($num[8] == substr('TRWAGMYFPDXBNJZSQVHLCKE', substr(str_replace(array('X', 'Y', 'Z'), array('0', '1', '2'), $str), 0, 8) % 23, 1)) { + if ($num[8] == substr('TRWAGMYFPDXBNJZSQVHLCKE', (int) substr(str_replace(array('X', 'Y', 'Z'), array('0', '1', '2'), $str), 0, 8) % 23, 1)) { return 3; } else { return -3; From 83ca2f80d88bc50f8ebe7317f1da56b18ef0e5ad Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Thu, 21 Mar 2024 22:23:48 +0100 Subject: [PATCH 032/178] Fix PHPdoc for typing --- .../asset/doc/pdf_standard_asset.modules.php | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php b/htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php index 5b6dc78bf0c..e8607a39ca6 100644 --- a/htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php +++ b/htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php @@ -9,6 +9,7 @@ * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr> + * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -262,7 +263,7 @@ class pdf_standard_asset extends ModelePDFAsset $hookmanager = new HookManager($this->db); } $hookmanager->initHooks(array('pdfgeneration')); - $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); + $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs); global $action; $reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks @@ -608,9 +609,9 @@ class pdf_standard_asset extends ModelePDFAsset $parameters = array( 'object' => $object, 'i' => $i, - 'pdf' =>& $pdf, - 'curY' =>& $curY, - 'nexY' =>& $nexY, + 'pdf' => & $pdf, + 'curY' => & $curY, + 'nexY' => & $nexY, 'outputlangs' => $outputlangs, 'hidedetails' => $hidedetails ); @@ -691,10 +692,10 @@ class pdf_standard_asset extends ModelePDFAsset // Add line if (getDolGlobalString('MAIN_PDF_DASH_BETWEEN_LINES') && $i < ($nblines - 1)) { $pdf->setPage($pageposafter); - $pdf->SetLineStyle(array('dash'=>'1,1', 'color'=>array(80, 80, 80))); + $pdf->SetLineStyle(array('dash' => '1,1', 'color' => array(80, 80, 80))); //$pdf->SetDrawColor(190,190,200); $pdf->line($this->marge_gauche, $nexY, $this->page_largeur - $this->marge_droite, $nexY); - $pdf->SetLineStyle(array('dash'=>0)); + $pdf->SetLineStyle(array('dash' => 0)); } // Detect if some page were added automatically and output _tableau for past pages @@ -768,7 +769,7 @@ class pdf_standard_asset extends ModelePDFAsset // Add pdfgeneration hook $hookmanager->initHooks(array('pdfgeneration')); - $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); + $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs); global $action; $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { @@ -778,7 +779,7 @@ class pdf_standard_asset extends ModelePDFAsset dolChmod($file); - $this->result = array('fullpath'=>$file); + $this->result = array('fullpath' => $file); return 1; // No error } else { @@ -809,9 +810,9 @@ class pdf_standard_asset extends ModelePDFAsset /** * Show table for lines * - * @param tcpdf $pdf Object PDF - * @param string $tab_top Top position of table - * @param string $tab_height Height of table (rectangle) + * @param TCPDF|TCPDI $pdf Object PDF + * @param int|float $tab_top Top position of table + * @param int|float $tab_height Height of table (rectangle) * @param int $nexY Y (not used) * @param Translate $outputlangs Langs object * @param int $hidetop 1=Hide top bar of array and title, 0=Hide nothing, -1=Hide only title @@ -870,7 +871,7 @@ class pdf_standard_asset extends ModelePDFAsset /** * Show top header of page. * - * @param Tcpdf $pdf Object PDF + * @param TCPDF|TCPDI $pdf Object PDF * @param Object $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output From 91a7f3b72194271f938067c4462c2fbd8c39e379 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Thu, 21 Mar 2024 22:25:15 +0100 Subject: [PATCH 033/178] Fix typing with casting and idate --- htdocs/core/class/html.form.class.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 0c62d6e7e2a..8cbc690cbf0 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -6920,8 +6920,8 @@ class Form } elseif ($usecalendar == 'jquery' || $usecalendar == 'html') { if (!$disabled && $usecalendar != 'html') { // Output javascript for datepicker - $minYear = getDolGlobalInt('MIN_YEAR_SELECT_DATE', (date('Y') - 100)); - $maxYear = getDolGlobalInt('MAX_YEAR_SELECT_DATE', (date('Y') + 100)); + $minYear = getDolGlobalInt('MIN_YEAR_SELECT_DATE', (idate('Y') - 100)); + $maxYear = getDolGlobalInt('MAX_YEAR_SELECT_DATE', (idate('Y') + 100)); $retstring .= '<script nonce="' . getNonce() . '" type="text/javascript">'; $retstring .= "$(function(){ $('#" . $prefix . "').datepicker({ @@ -7006,7 +7006,8 @@ class Form } else { $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth75imp" id="' . $prefix . 'year" name="' . $prefix . 'year">'; - for ($year = $syear - 10; $year < $syear + 10; $year++) { + $syear = (int) $syear; + for ($year = $syear - 10; $year < (int) $syear + 10; $year++) { $retstring .= '<option value="' . $year . '"' . ($year == $syear ? ' selected' : '') . '>' . $year . '</option>'; } $retstring .= "</select>\n"; From 4b438b42046da92bced46214fbe3f05dbcdf4d39 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Thu, 21 Mar 2024 22:26:56 +0100 Subject: [PATCH 034/178] Fix typing with idate --- htdocs/core/class/html.formother.class.php | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 86f850f7cdf..aa6cf26e580 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -11,6 +11,7 @@ * Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com> * Copyright (C) 2019 Thibault FOUCART <support@ptibogxiv.net> * Copyright (C) 2024 Frédéric France <frederic.france@free.fr> + * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com> * * 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 @@ -1043,13 +1044,13 @@ class FormOther global $langs; $week = array( - 0=>$langs->trans("Day0"), - 1=>$langs->trans("Day1"), - 2=>$langs->trans("Day2"), - 3=>$langs->trans("Day3"), - 4=>$langs->trans("Day4"), - 5=>$langs->trans("Day5"), - 6=>$langs->trans("Day6") + 0 => $langs->trans("Day0"), + 1 => $langs->trans("Day1"), + 2 => $langs->trans("Day2"), + 3 => $langs->trans("Day3"), + 4 => $langs->trans("Day4"), + 5 => $langs->trans("Day5"), + 6 => $langs->trans("Day6") ); $select_week = '<select class="flat" name="'.$htmlname.'" id="'.$htmlname.'">'; @@ -1164,7 +1165,7 @@ class FormOther { $out = ''; - $currentyear = date("Y") + $offset; + $currentyear = idate("Y") + $offset; $max_year = $currentyear + $max_year; $min_year = $currentyear - $min_year; if (empty($selected) && empty($useempty)) { @@ -1252,7 +1253,7 @@ class FormOther if (preg_match('/graph/', $box->class) && $conf->browser->layout != 'phone') { $label = $label.' <span class="fas fa-chart-bar"></span>'; } - $arrayboxtoactivatelabel[$box->id] = array('label'=>$label, 'data-html'=>img_picto('', $box->boximg, 'class="pictofixedwidth"').$langs->trans($label)); // We keep only boxes not shown for user, to show into combo list + $arrayboxtoactivatelabel[$box->id] = array('label' => $label, 'data-html' => img_picto('', $box->boximg, 'class="pictofixedwidth"').$langs->trans($label)); // We keep only boxes not shown for user, to show into combo list } foreach ($boxidactivatedforuser as $boxid) { if (empty($boxorder)) { @@ -1433,7 +1434,7 @@ class FormOther $boxlistb .= "<!-- End box right container -->\n"; } - return array('selectboxlist'=>count($boxactivated) ? $selectboxlist : '', 'boxactivated'=>$boxactivated, 'boxlista'=>$boxlista, 'boxlistb'=>$boxlistb); + return array('selectboxlist' => count($boxactivated) ? $selectboxlist : '', 'boxactivated' => $boxactivated, 'boxlista' => $boxlista, 'boxlistb' => $boxlistb); } From 4d56da4e8c72857226ae0366a5ebdaac70616543 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Thu, 21 Mar 2024 22:27:57 +0100 Subject: [PATCH 035/178] Fix typing with casts --- htdocs/core/class/utils.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php index 3b10ea563a1..88157550cf2 100644 --- a/htdocs/core/class/utils.class.php +++ b/htdocs/core/class/utils.class.php @@ -1228,7 +1228,7 @@ class Utils } elseif (is_string($row[$j]) && $row[$j] == '') { // if it's an empty string, we set it as an empty string $row[$j] = "''"; - } elseif (is_numeric($row[$j]) && !strcmp((string) $row[$j], (string) ($row[$j] + 0))) { // test if it's a numeric type and the numeric version ($nb+0) == string version (eg: if we have 01, it's probably not a number but rather a string, else it would not have any leading 0) + } elseif (is_numeric($row[$j]) && !strcmp((string) $row[$j], (string) ((float) $row[$j] + 0))) { // test if it's a numeric type and the numeric version ($nb+0) == string version (eg: if we have 01, it's probably not a number but rather a string, else it would not have any leading 0) // if it's a number, we return it as-is // $row[$j] = $row[$j]; } else { // else for all other cases we escape the value and put quotes around From 4168ddb1faf3e2b5d2cc180473a86f04bf854b37 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Thu, 21 Mar 2024 22:29:21 +0100 Subject: [PATCH 036/178] Fix typing with idate and casts --- htdocs/core/lib/functions2.lib.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 52c35c3fabe..648ec5f5f57 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1145,17 +1145,17 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $ } // If current month lower that month of return to zero, year is previous year if ($yearlen == 4) { - $yearcomp = sprintf("%04d", (int) date("Y", $date) + $yearoffset); + $yearcomp = sprintf("%04d", idate("Y", $date) + $yearoffset); } elseif ($yearlen == 2) { - $yearcomp = sprintf("%02d", (int) date("y", $date) + $yearoffset); + $yearcomp = sprintf("%02d", idate("y", $date) + $yearoffset); } elseif ($yearlen == 1) { - $yearcomp = substr(date('y', $date), 1, 1) + $yearoffset; + $yearcomp = (int) substr(date('y', $date), 1, 1) + $yearoffset; } if ($monthcomp > 1 && empty($resetEveryMonth)) { // Test with month is useless if monthcomp = 0 or 1 (0 is same as 1) (regis: $monthcomp can't equal 0) if ($yearlen == 4) { - $yearcomp1 = sprintf("%04d", (int) date("Y", $date) + $yearoffset + 1); + $yearcomp1 = sprintf("%04d", idate("Y", $date) + $yearoffset + 1); } elseif ($yearlen == 2) { - $yearcomp1 = sprintf("%02d", (int) date("y", $date) + $yearoffset + 1); + $yearcomp1 = sprintf("%02d", idate("y", $date) + $yearoffset + 1); } $sqlwhere .= "("; From 58a6ef8c7c5970b386890c688b423e699d200e70 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Thu, 21 Mar 2024 22:31:32 +0100 Subject: [PATCH 037/178] Fix typing with phpdoc --- htdocs/core/modules/commande/doc/pdf_einstein.modules.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index c4165030427..4ff5056fdcb 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -1143,8 +1143,8 @@ class pdf_einstein extends ModelePDFCommandes * Show table for lines * * @param TCPDF $pdf Object PDF - * @param string $tab_top Top position of table - * @param string $tab_height Height of table (rectangle) + * @param float|int $tab_top Top position of table + * @param float|int $tab_height Height of table (rectangle) * @param int $nexY Y (not used) * @param Translate $outputlangs Langs object * @param int $hidetop 1=Hide top bar of array and title, 0=Hide nothing, -1=Hide only title From b84c9a1d471fb68382ca7bee50be4ecb97c13b96 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Thu, 21 Mar 2024 22:34:38 +0100 Subject: [PATCH 038/178] Fix typing with phpdoc --- htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index 7eb01987cf1..9a3ac0fc0bc 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -1353,8 +1353,8 @@ class pdf_eratosthene extends ModelePDFCommandes * Show table for lines * * @param TCPDF $pdf Object PDF - * @param string $tab_top Top position of table - * @param string $tab_height Height of table (rectangle) + * @param float|int $tab_top Top position of table + * @param float|int $tab_height Height of table (rectangle) * @param int $nexY Y (not used) * @param Translate $outputlangs Langs object * @param int $hidetop 1=Hide top bar of array and title, 0=Hide nothing, -1=Hide only title From 378c98cac6cf17537f3ad5cea4542526b9dffc0f Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Thu, 21 Mar 2024 22:35:20 +0100 Subject: [PATCH 039/178] Fix typing with phpdoc --- htdocs/core/modules/delivery/doc/pdf_storm.modules.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/delivery/doc/pdf_storm.modules.php b/htdocs/core/modules/delivery/doc/pdf_storm.modules.php index 144ed4d8ae9..c420de7a9ca 100644 --- a/htdocs/core/modules/delivery/doc/pdf_storm.modules.php +++ b/htdocs/core/modules/delivery/doc/pdf_storm.modules.php @@ -629,8 +629,8 @@ class pdf_storm extends ModelePDFDeliveryOrder * Show table for lines * * @param TCPDF $pdf Object PDF - * @param string $tab_top Top position of table - * @param string $tab_height Height of table (rectangle) + * @param float|int $tab_top Top position of table + * @param float|int $tab_height Height of table (rectangle) * @param int $nexY Y (not used) * @param Translate $outputlangs Langs object * @param int $hidetop 1=Hide top bar of array and title, 0=Hide nothing, -1=Hide only title From 81c0026be648269634051e33ca002224a653dfe1 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Thu, 21 Mar 2024 22:36:42 +0100 Subject: [PATCH 040/178] Fix typing with phpdoc --- htdocs/core/modules/contract/doc/pdf_strato.modules.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php index 249e5ecbbf5..ffb30e314a7 100644 --- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php +++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php @@ -496,8 +496,8 @@ class pdf_strato extends ModelePDFContract * Show table for lines * * @param TCPDF $pdf Object PDF - * @param string $tab_top Top position of table - * @param string $tab_height Height of table (rectangle) + * @param float|int $tab_top Top position of table + * @param float|int $tab_height Height of table (rectangle) * @param int $nexY Y * @param Translate $outputlangs Langs object * @param int $hidetop Hide top bar of array From 6944e71ec2ae8075b9a9dbc69a9b224b0d308740 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Thu, 21 Mar 2024 23:02:39 +0100 Subject: [PATCH 041/178] Fix typing with phpdoc --- htdocs/core/modules/delivery/doc/pdf_typhon.modules.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php b/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php index fd6c949ab05..9278850664f 100644 --- a/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php +++ b/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php @@ -621,8 +621,8 @@ class pdf_typhon extends ModelePDFDeliveryOrder * Show table for lines * * @param TCPDF $pdf Object PDF - * @param string $tab_top Top position of table - * @param string $tab_height Height of table (rectangle) + * @param float|int $tab_top Top position of table + * @param float|int $tab_height Height of table (rectangle) * @param int $nexY Y (not used) * @param Translate $outputlangs Langs object * @param int $hidetop 1=Hide top bar of array and title, 0=Hide nothing, -1=Hide only title From 56b6ab31f9e338fed4852a87e970d72beeb616fd Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Thu, 21 Mar 2024 23:02:41 +0100 Subject: [PATCH 042/178] Fix typing with phpdoc --- htdocs/core/modules/expedition/doc/pdf_espadon.modules.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index 95c106013cf..4bb1ac468e4 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -880,8 +880,8 @@ class pdf_espadon extends ModelePdfExpedition * Show table for lines * * @param TCPDF $pdf Object PDF - * @param string $tab_top Top position of table - * @param string $tab_height Height of table (rectangle) + * @param float|int $tab_top Top position of table + * @param float|int $tab_height Height of table (rectangle) * @param int $nexY Y * @param Translate $outputlangs Langs object * @param int $hidetop Hide top bar of array From 2fc604b1af96b5f32dc00e27e6b2d051079cd720 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Thu, 21 Mar 2024 23:02:45 +0100 Subject: [PATCH 043/178] Fix typing with phpdoc --- htdocs/core/modules/expedition/doc/pdf_merou.modules.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php index 52878e4de21..0a84739a5f3 100644 --- a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2011 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> + * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com> * * 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 @@ -403,8 +404,8 @@ class pdf_merou extends ModelePdfExpedition * Show table for lines * * @param TCPDF $pdf Object PDF - * @param string $tab_top Top position of table - * @param string $tab_height Height of table (rectangle) + * @param float|int $tab_top Top position of table + * @param float|int $tab_height Height of table (rectangle) * @param int $nexY Y * @param Translate $outputlangs Langs object * @param int $hidetop Hide top bar of array From 78c1bb4619e3d3291e0f7ca72c51ddfba59ea828 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Thu, 21 Mar 2024 23:02:47 +0100 Subject: [PATCH 044/178] Fix typing with phpdoc --- htdocs/core/modules/expedition/doc/pdf_rouget.modules.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index 7e1675e40c9..76c2a1a93b1 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2018-2023 Frédéric France <frederic.france@netlogic.fr> + * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com> * * 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 @@ -761,8 +762,8 @@ class pdf_rouget extends ModelePdfExpedition * Show table for lines * * @param TCPDF $pdf Object PDF - * @param string $tab_top Top position of table - * @param string $tab_height Height of table (rectangle) + * @param float|int $tab_top Top position of table + * @param float|int $tab_height Height of table (rectangle) * @param int $nexY Y * @param Translate $outputlangs Langs object * @param int $hidetop Hide top bar of array From 90f36e46137966d5ef02990dde352589d2f24494 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Thu, 21 Mar 2024 23:02:49 +0100 Subject: [PATCH 045/178] Fix typing with phpdoc --- htdocs/core/modules/facture/doc/pdf_crabe.modules.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 2af6846e4e4..279ccc02a5c 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -1680,8 +1680,8 @@ class pdf_crabe extends ModelePDFFactures * Show table for lines * * @param TCPDF $pdf Object PDF - * @param string $tab_top Top position of table - * @param string $tab_height Height of table (rectangle) + * @param float|int $tab_top Top position of table + * @param float|int $tab_height Height of table (rectangle) * @param int $nexY Y (not used) * @param Translate $outputlangs Langs object * @param int $hidetop 1=Hide top bar of array and title, 0=Hide nothing, -1=Hide only title From a7b00efafefeaabc12f0d992de37285c7975eeaf Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Thu, 21 Mar 2024 23:02:51 +0100 Subject: [PATCH 046/178] Fix typing with phpdoc --- htdocs/core/modules/facture/doc/pdf_sponge.modules.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 24888f2b052..2823afc2d5d 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -1985,8 +1985,8 @@ class pdf_sponge extends ModelePDFFactures * Show table for lines * * @param TCPDF $pdf Object PDF - * @param string $tab_top Top position of table - * @param string $tab_height Height of table (rectangle) + * @param float|int $tab_top Top position of table + * @param float|int $tab_height Height of table (rectangle) * @param int $nexY Y (not used) * @param Translate $outputlangs Langs object * @param int $hidetop 1=Hide top bar of array and title, 0=Hide nothing, -1=Hide only title From 8bf8972a2d4739b988d6df62cd4035f23ceeedd4 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Thu, 21 Mar 2024 23:02:53 +0100 Subject: [PATCH 047/178] Fix typing with phpdoc --- htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php index 82871ffae52..750f26bca6c 100644 --- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php +++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php @@ -444,8 +444,8 @@ class pdf_soleil extends ModelePDFFicheinter * Show table for lines * * @param TCPDF $pdf Object PDF - * @param string $tab_top Top position of table - * @param string $tab_height Height of table (rectangle) + * @param float|int $tab_top Top position of table + * @param float|int $tab_height Height of table (rectangle) * @param int $nexY Y * @param Translate $outputlangs Langs object * @param int $hidetop Hide top bar of array From d148c3f9558ff54132190241a4e84ae3d0b03930 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Thu, 21 Mar 2024 23:02:56 +0100 Subject: [PATCH 048/178] Fix typing with phpdoc --- htdocs/core/modules/movement/doc/pdf_standard.modules.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/movement/doc/pdf_standard.modules.php b/htdocs/core/modules/movement/doc/pdf_standard.modules.php index 7226cf40377..a24e0704e97 100644 --- a/htdocs/core/modules/movement/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/movement/doc/pdf_standard.modules.php @@ -779,8 +779,8 @@ class pdf_standard extends ModelePDFMovement * Show table for lines * * @param TCPDF $pdf Object PDF - * @param string $tab_top Top position of table - * @param string $tab_height Height of table (rectangle) + * @param float|int $tab_top Top position of table + * @param float|int $tab_height Height of table (rectangle) * @param int $nexY Y (not used) * @param Translate $outputlangs Langs object * @param int $hidetop 1=Hide top bar of array and title, 0=Hide nothing, -1=Hide only title From 4500b30b8e3791158623f5449c29ae58ad55443d Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Thu, 21 Mar 2024 23:02:58 +0100 Subject: [PATCH 049/178] Fix typing with phpdoc --- htdocs/core/modules/mrp/doc/pdf_vinci.modules.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php b/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php index 5d6e29c13d1..001eca9943a 100644 --- a/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php +++ b/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php @@ -942,8 +942,8 @@ class pdf_vinci extends ModelePDFMo * Show table for lines * * @param TCPDF $pdf Object PDF - * @param string $tab_top Top position of table - * @param string $tab_height Height of table (rectangle) + * @param float|int $tab_top Top position of table + * @param float|int $tab_height Height of table (rectangle) * @param int $nexY Y (not used) * @param Translate $outputlangs Langs object * @param int $hidetop Hide top bar of array From ec855a2e5c672770287fb9934f5c3acbe5581125 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Thu, 21 Mar 2024 23:03:01 +0100 Subject: [PATCH 050/178] Fix typing with phpdoc --- htdocs/core/modules/product/doc/pdf_standard.modules.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/product/doc/pdf_standard.modules.php b/htdocs/core/modules/product/doc/pdf_standard.modules.php index 0173754268a..da0260b6627 100644 --- a/htdocs/core/modules/product/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/product/doc/pdf_standard.modules.php @@ -1,6 +1,7 @@ <?php /* Copyright (C) 2017 Laurent Destailleur <eldy@products.sourceforge.net> * Copyright (C) 2023 Anthony Berton <anthony.berton@bb2a.fr> + * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com> * * 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 @@ -601,8 +602,8 @@ class pdf_standard extends ModelePDFProduct * Show table for lines * * @param TCPDF $pdf Object PDF - * @param string $tab_top Top position of table - * @param string $tab_height Height of table (rectangle) + * @param float|int $tab_top Top position of table + * @param float|int $tab_height Height of table (rectangle) * @param int $nexY Y (not used) * @param Translate $outputlangs Langs object * @param int $hidetop 1=Hide top bar of array and title, 0=Hide nothing, -1=Hide only title From 4d5e2d23a64e349f5ad7eb702bd37428e5472e02 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Thu, 21 Mar 2024 23:03:05 +0100 Subject: [PATCH 051/178] Fix typing with phpdoc --- htdocs/core/modules/project/doc/pdf_baleine.modules.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/project/doc/pdf_baleine.modules.php b/htdocs/core/modules/project/doc/pdf_baleine.modules.php index 498143880a3..3f26a05791c 100644 --- a/htdocs/core/modules/project/doc/pdf_baleine.modules.php +++ b/htdocs/core/modules/project/doc/pdf_baleine.modules.php @@ -1,6 +1,7 @@ <?php /* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2018 Laurent Destailleur <eldy@users.sourceforge.net> + * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com> * * 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 @@ -505,8 +506,8 @@ class pdf_baleine extends ModelePDFProjects * Show table for lines * * @param TCPDF $pdf Object PDF - * @param string $tab_top Top position of table - * @param string $tab_height Height of table (rectangle) + * @param float|int $tab_top Top position of table + * @param float|int $tab_height Height of table (rectangle) * @param int $nexY Y * @param Translate $outputlangs Langs object * @param int $hidetop Hide top bar of array From aff10352c27275bec4d502e617a5ffd2c027eb6c Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Thu, 21 Mar 2024 23:03:08 +0100 Subject: [PATCH 052/178] Fix typing with phpdoc --- htdocs/core/modules/project/doc/pdf_beluga.modules.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/project/doc/pdf_beluga.modules.php b/htdocs/core/modules/project/doc/pdf_beluga.modules.php index 6102bbaf379..98b86f94000 100644 --- a/htdocs/core/modules/project/doc/pdf_beluga.modules.php +++ b/htdocs/core/modules/project/doc/pdf_beluga.modules.php @@ -2,6 +2,7 @@ /* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2015-2018 Charlene Benke <charlie@patas-monkey.com> * Copyright (C) 2018 Laurent Destailleur <eldy@users.sourceforge.net> + * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com> * * 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 @@ -737,8 +738,8 @@ class pdf_beluga extends ModelePDFProjects * Show table for lines * * @param TCPDF $pdf Object PDF - * @param string $tab_top Top position of table - * @param string $tab_height Height of table (rectangle) + * @param float|int $tab_top Top position of table + * @param float|int $tab_height Height of table (rectangle) * @param int $nexY Y * @param Translate $outputlangs Langs object * @param int $hidetop Hide top bar of array From d5400967ce520b83c6797f0ebd3b3afc1bec3623 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Thu, 21 Mar 2024 23:03:10 +0100 Subject: [PATCH 053/178] Fix typing with phpdoc --- htdocs/core/modules/project/doc/pdf_timespent.modules.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/project/doc/pdf_timespent.modules.php b/htdocs/core/modules/project/doc/pdf_timespent.modules.php index 7d3b887dfd8..e806a681de0 100644 --- a/htdocs/core/modules/project/doc/pdf_timespent.modules.php +++ b/htdocs/core/modules/project/doc/pdf_timespent.modules.php @@ -1,5 +1,6 @@ <?php /* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@inodbox.com> + * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com> * 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 @@ -503,8 +504,8 @@ class pdf_timespent extends ModelePDFProjects * Show table for lines * * @param TCPDF $pdf Object PDF - * @param string $tab_top Top position of table - * @param string $tab_height Height of table (rectangle) + * @param float|int $tab_top Top position of table + * @param float|int $tab_height Height of table (rectangle) * @param int $nexY Y * @param Translate $outputlangs Langs object * @param int $hidetop Hide top bar of array From f75e5cd13a5f89828b0f0030a9d67a65f0793194 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Thu, 21 Mar 2024 23:03:12 +0100 Subject: [PATCH 054/178] Fix typing with phpdoc --- htdocs/core/modules/propale/doc/pdf_azur.modules.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index dae580d2d47..1d2d3d24400 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -9,6 +9,7 @@ * Copyright (C) 2017-2018 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2019 Pierre Ardoin <mapiolca@me.com> + * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com> * * 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 @@ -1336,8 +1337,8 @@ class pdf_azur extends ModelePDFPropales * Show table for lines * * @param TCPDF $pdf Object PDF - * @param string $tab_top Top position of table - * @param string $tab_height Height of table (rectangle) + * @param float|int $tab_top Top position of table + * @param float|int $tab_height Height of table (rectangle) * @param int $nexY Y (not used) * @param Translate $outputlangs Langs object * @param int $hidetop 1=Hide top bar of array and title, 0=Hide nothing, -1=Hide only title From afda2103ffc9fc030f3f2370d5eb87dda862bf66 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Thu, 21 Mar 2024 23:03:15 +0100 Subject: [PATCH 055/178] Fix typing with phpdoc --- htdocs/core/modules/propale/doc/pdf_cyan.modules.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index d661b0ce260..9b2ffa29fd9 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -8,6 +8,7 @@ * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr> + * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com> * * 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 @@ -1443,8 +1444,8 @@ class pdf_cyan extends ModelePDFPropales * Show table for lines * * @param TCPDF $pdf Object PDF - * @param string $tab_top Top position of table - * @param string $tab_height Height of table (rectangle) + * @param float|int $tab_top Top position of table + * @param float|int $tab_height Height of table (rectangle) * @param int $nexY Y (not used) * @param Translate $outputlangs Langs object * @param int $hidetop 1=Hide top bar of array and title, 0=Hide nothing, -1=Hide only title From 280dadbf6c5bd2a71479c0ec60984e23bef7612d Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Thu, 21 Mar 2024 23:03:17 +0100 Subject: [PATCH 056/178] Fix typing with phpdoc --- htdocs/core/modules/reception/doc/pdf_squille.modules.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/reception/doc/pdf_squille.modules.php b/htdocs/core/modules/reception/doc/pdf_squille.modules.php index e79a5b70d5a..7faeeeeb1f9 100644 --- a/htdocs/core/modules/reception/doc/pdf_squille.modules.php +++ b/htdocs/core/modules/reception/doc/pdf_squille.modules.php @@ -1,6 +1,7 @@ <?php /* Copyright (C) 2018 Quentin Vial-Gouteyron <quentin.vial-gouteyron@atm-consulting.fr> * Copyright (C) 2023 Frédéric France <frederic.france@netlogic.fr> + * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com> * * 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 @@ -756,8 +757,8 @@ class pdf_squille extends ModelePdfReception * Show table for lines * * @param TCPDF $pdf Object PDF - * @param string $tab_top Top position of table - * @param string $tab_height Height of table (rectangle) + * @param float|int $tab_top Top position of table + * @param float|int $tab_height Height of table (rectangle) * @param int $nexY Y * @param Translate $outputlangs Langs object * @param int $hidetop Hide top bar of array From 2db76fbfffd90a37b0da42d1bc5b2ed4b20a02ff Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Thu, 21 Mar 2024 23:03:21 +0100 Subject: [PATCH 057/178] Fix typing with phpdoc --- htdocs/core/modules/stock/doc/pdf_standard.modules.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/stock/doc/pdf_standard.modules.php b/htdocs/core/modules/stock/doc/pdf_standard.modules.php index faada7164ef..0fc6c5539c8 100644 --- a/htdocs/core/modules/stock/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/stock/doc/pdf_standard.modules.php @@ -576,8 +576,8 @@ class pdf_standard extends ModelePDFStock * Show table for lines * * @param TCPDF $pdf Object PDF - * @param string $tab_top Top position of table - * @param string $tab_height Height of table (rectangle) + * @param float|int $tab_top Top position of table + * @param float|int $tab_height Height of table (rectangle) * @param int $nexY Y (not used) * @param Translate $outputlangs Langs object * @param int $hidetop 1=Hide top bar of array and title, 0=Hide nothing, -1=Hide only title From 396bf9079ee6a1fd8d4e6a7fc133a3696837376d Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Thu, 21 Mar 2024 23:03:23 +0100 Subject: [PATCH 058/178] Fix typing with phpdoc --- htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php b/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php index 8f14233e320..006d1ecbf2d 100644 --- a/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php +++ b/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php @@ -825,8 +825,8 @@ class pdf_eagle extends ModelePDFStockTransfer * Show table for lines * * @param TCPDF $pdf Object PDF - * @param string $tab_top Top position of table - * @param string $tab_height Height of table (rectangle) + * @param float|int $tab_top Top position of table + * @param float|int $tab_height Height of table (rectangle) * @param int $nexY Y * @param Translate $outputlangs Langs object * @param int $hidetop Hide top bar of array From e31fa59fd4276ade9ee003d41008fa4ef71754ca Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Thu, 21 Mar 2024 23:03:27 +0100 Subject: [PATCH 059/178] Fix typing with phpdoc --- .../modules/stocktransfer/doc/pdf_eagle_proforma.modules.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php b/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php index 4f12b778d63..6ec5b466299 100644 --- a/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php +++ b/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php @@ -9,6 +9,7 @@ * Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr> + * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com> * * 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 @@ -1100,8 +1101,8 @@ class pdf_eagle_proforma extends ModelePDFCommandes * Show table for lines * * @param TCPDF $pdf Object PDF - * @param string $tab_top Top position of table - * @param string $tab_height Height of table (rectangle) + * @param float|int $tab_top Top position of table + * @param float|int $tab_height Height of table (rectangle) * @param int $nexY Y (not used) * @param Translate $outputlangs Langs object * @param int $hidetop 1=Hide top bar of array and title, 0=Hide nothing, -1=Hide only title From fbb3cb35883f614d6d8db6cf081b1c9563ad25ca Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Thu, 21 Mar 2024 23:03:29 +0100 Subject: [PATCH 060/178] Fix typing with phpdoc --- .../core/modules/supplier_invoice/doc/pdf_canelle.modules.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php index 3327e63506d..41ea1ccaea6 100644 --- a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php @@ -834,8 +834,8 @@ class pdf_canelle extends ModelePDFSuppliersInvoices * Show table for lines * * @param TCPDF $pdf Object PDF - * @param string $tab_top Top position of table - * @param string $tab_height Height of table (rectangle) + * @param float|int $tab_top Top position of table + * @param float|int $tab_height Height of table (rectangle) * @param int $nexY Y (not used) * @param Translate $outputlangs Langs object * @param int $hidetop 1=Hide top bar of array and title, 0=Hide nothing, -1=Hide only title From e7e2ff95f61682e2dc552d59d901bec8a9e36594 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Thu, 21 Mar 2024 23:03:31 +0100 Subject: [PATCH 061/178] Fix typing with phpdoc --- htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php index 1861620567d..3193028139d 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php @@ -1123,8 +1123,8 @@ class pdf_cornas extends ModelePDFSuppliersOrders * Show table for lines * * @param TCPDF $pdf Object PDF - * @param string $tab_top Top position of table - * @param string $tab_height Height of table (rectangle) + * @param float|int $tab_top Top position of table + * @param float|int $tab_height Height of table (rectangle) * @param int $nexY Y (not used) * @param Translate $outputlangs Langs object * @param int $hidetop Hide top bar of array From 37ceda734fcbae72f441b74fd78081c466ee6550 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Thu, 21 Mar 2024 23:03:34 +0100 Subject: [PATCH 062/178] Fix typing with phpdoc --- .../core/modules/supplier_order/doc/pdf_muscadet.modules.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php index 405ab5933b4..1bf5d40cc06 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php @@ -991,8 +991,8 @@ class pdf_muscadet extends ModelePDFSuppliersOrders * Show table for lines * * @param TCPDF $pdf Object PDF - * @param string $tab_top Top position of table - * @param string $tab_height Height of table (rectangle) + * @param float|int $tab_top Top position of table + * @param float|int $tab_height Height of table (rectangle) * @param int $nexY Y (not used) * @param Translate $outputlangs Langs object * @param int $hidetop Hide top bar of array From ba7a452451a264443cc9735c42627a1de840a718 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Thu, 21 Mar 2024 23:03:36 +0100 Subject: [PATCH 063/178] Fix typing with phpdoc --- .../modules/supplier_proposal/doc/pdf_zenith.modules.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php index 1c77541020b..6b4e6580fbc 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php @@ -6,6 +6,7 @@ * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr> + * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com> * * 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 @@ -1111,8 +1112,8 @@ class pdf_zenith extends ModelePDFSupplierProposal * Show table for lines * * @param TCPDF $pdf Object PDF - * @param string $tab_top Top position of table - * @param string $tab_height Height of table (rectangle) + * @param float|int $tab_top Top position of table + * @param float|int $tab_height Height of table (rectangle) * @param int $nexY Y (not used) * @param Translate $outputlangs Langs object * @param int $hidetop Hide top bar of array From 69081c727ed908886b3318451b0f928487ab71b8 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Thu, 21 Mar 2024 23:35:11 +0100 Subject: [PATCH 064/178] Add typing to fetchAll --- htdocs/website/class/websitepage.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/website/class/websitepage.class.php b/htdocs/website/class/websitepage.class.php index c31844bbd6a..4448e29b2b1 100644 --- a/htdocs/website/class/websitepage.class.php +++ b/htdocs/website/class/websitepage.class.php @@ -240,7 +240,7 @@ class WebsitePage extends CommonObject * @param string $website_id Web site id (page name must also be filled if this parameter is used) * @param string $page Page name (website id must also be filled if this parameter is used). Example 'myaliaspage' or 'fr/myaliaspage' * @param string $aliasalt Alternative alias to search page (slow) - * @return int Return integer <0 if KO, 0 if not found, >0 if OK + * @return int<-1,1> Return integer <0 if KO, 0 if not found, >0 if OK */ public function fetch($id, $website_id = null, $page = null, $aliasalt = null) { @@ -365,7 +365,7 @@ class WebsitePage extends CommonObject * @param string|array $filter Filter as an Universal Search string. * Example: '((client:=:1) OR ((client:>=:2) AND (client:<=:3))) AND (client:!=:8) AND (nom:like:'a%')' * @param string $filtermode No more used - * @return array|int int <0 if KO, array of pages if OK + * @return WebSitePage[]|int<-1,-1> int <0 if KO, array of pages if OK */ public function fetchAll($websiteid, $sortorder = '', $sortfield = '', $limit = 0, $offset = 0, $filter = '', $filtermode = 'AND') { From a853f8e6bebb2249e39cb25bcfb169c558164556 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Thu, 21 Mar 2024 23:36:07 +0100 Subject: [PATCH 065/178] Fix type with cast/idate/phpdoc --- htdocs/expensereport/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index d9d609822a8..ed06c3b8f17 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -1142,7 +1142,7 @@ if (empty($reshook)) { $value_unit_ht = price2num(GETPOST('value_unit_ht', 'alpha'), 'MU'); $value_unit = price2num(GETPOST('value_unit', 'alpha'), 'MU'); if (empty($value_unit)) { - $value_unit = price2num($value_unit_ht + ($value_unit_ht * $tmpvat / 100), 'MU'); + $value_unit = price2num((float) $value_unit_ht + ((float) $value_unit_ht * (float) $tmpvat / 100), 'MU'); } $fk_c_exp_tax_cat = GETPOSTINT('fk_c_exp_tax_cat'); @@ -1314,7 +1314,7 @@ if (empty($reshook)) { $value_unit_ht = price2num(GETPOST('value_unit_ht', 'alpha'), 'MU'); $value_unit = price2num(GETPOST('value_unit', 'alpha'), 'MU'); if (empty($value_unit)) { - $value_unit = price2num($value_unit_ht + ($value_unit_ht * $tmpvat / 100), 'MU'); + $value_unit = price2num((float) $value_unit_ht + ((float) $value_unit_ht * (float) $tmpvat / 100), 'MU'); } if (!GETPOSTINT('fk_c_type_fees') > 0) { From 09b73086075c1634e91c50824d028416556bdf71 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Thu, 21 Mar 2024 23:36:10 +0100 Subject: [PATCH 066/178] Fix type with cast/idate/phpdoc --- htdocs/fourn/commande/dispatch.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index f9ec2a67379..df9251a63a5 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -9,6 +9,7 @@ * Copyright (C) 2017-2022 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2018-2022 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2019-2020 Christophe Battarel <christophe@altairis.fr> + * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com> * * 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 @@ -336,7 +337,7 @@ if ($action == 'dispatch' && $permissiontoreceive) { if (!(GETPOSTINT($ent) > 0)) { dol_syslog('No dispatch for line '.$key.' as no warehouse was chosen.'); - $text = $langs->transnoentities('Warehouse').', '.$langs->transnoentities('Line').' '.($numline).'-'.($reg[1] + 1); + $text = $langs->transnoentities('Warehouse').', '.$langs->transnoentities('Line').' '.($numline).'-'.((int) $reg[1] + 1); setEventMessages($langs->trans('ErrorFieldRequired', $text), null, 'errors'); $error++; } @@ -352,7 +353,7 @@ if ($action == 'dispatch' && $permissiontoreceive) { }*/ if (!GETPOST($lot, 'alpha') && !$dDLUO && !$dDLC) { dol_syslog('No dispatch for line '.$key.' as serial/eat-by/sellby date are not set'); - $text = $langs->transnoentities('atleast1batchfield').', '.$langs->transnoentities('Line').' '.($numline).'-'.($reg[1] + 1); + $text = $langs->transnoentities('atleast1batchfield').', '.$langs->transnoentities('Line').' '.($numline).'-'.((int) $reg[1] + 1); setEventMessages($langs->trans('ErrorFieldRequired', $text), null, 'errors'); $error++; } From 6a81335da9bda8ebba23851d538e1ff287ad225e Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Thu, 21 Mar 2024 23:36:15 +0100 Subject: [PATCH 067/178] Fix type with cast/idate/phpdoc --- htdocs/loan/class/loanschedule.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/loan/class/loanschedule.class.php b/htdocs/loan/class/loanschedule.class.php index e6caeeb9de2..588adac4529 100644 --- a/htdocs/loan/class/loanschedule.class.php +++ b/htdocs/loan/class/loanschedule.class.php @@ -1,6 +1,7 @@ <?php /* Copyright (C) 2017 Florian HENRY <florian.henry@atm-consulting.fr> * Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr> + * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com> * * 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 @@ -167,7 +168,7 @@ class LoanSchedule extends CommonObject $this->fk_user_modif = (int) $this->fk_user_modif; } - $totalamount = $this->amount_capital + $this->amount_insurance + $this->amount_interest; + $totalamount = (float) $this->amount_capital + (float) $this->amount_insurance + (float) $this->amount_interest; $totalamount = price2num($totalamount); // Check parameters From 549d72905d67d6bcf14c5050d37a65cb14b04d05 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Thu, 21 Mar 2024 23:36:20 +0100 Subject: [PATCH 068/178] Fix type with cast/idate/phpdoc --- htdocs/loan/schedule.php | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/htdocs/loan/schedule.php b/htdocs/loan/schedule.php index ae61486bcfe..0432a7822e0 100644 --- a/htdocs/loan/schedule.php +++ b/htdocs/loan/schedule.php @@ -2,6 +2,7 @@ /* Copyright (C) 2017 Franck Moreau <franck.moreau@theobald.com> * Copyright (C) 2018-2023 Alexandre Spangaro <aspangaro@easya.solutions> * Copyright (C) 2020 Maxime DEMAREST <maxime@indelog.fr> + * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com> * * 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 @@ -80,7 +81,7 @@ if ($action == 'createecheancier' && empty($pay_without_schedule)) { $new_echeance->datec = dol_now(); $new_echeance->tms = dol_now(); $new_echeance->datep = $date; - $new_echeance->amount_capital = $mens - $int; + $new_echeance->amount_capital = $mens - (float) $int; $new_echeance->amount_insurance = $insurance; $new_echeance->amount_interest = $int; $new_echeance->fk_typepayment = 3; @@ -114,7 +115,7 @@ if ($action == 'updateecheancier' && empty($pay_without_schedule)) { $new_echeance = new LoanSchedule($db); $new_echeance->fetch($id); $new_echeance->tms = dol_now(); - $new_echeance->amount_capital = $mens - $int; + $new_echeance->amount_capital = $mens - (float) $int; $new_echeance->amount_insurance = $insurance; $new_echeance->amount_interest = $int; $new_echeance->fk_user_modif = $user->id; @@ -266,19 +267,19 @@ print '</tr>'."\n"; if ($object->nbterm > 0 && count($echeances->lines) == 0) { $i = 1; $capital = $object->capital; - $insurance = $object->insurance_amount / $object->nbterm; + $insurance = (float) $object->insurance_amount / $object->nbterm; $insurance = price2num($insurance, 'MT'); - $regulInsurance = price2num($object->insurance_amount - ($insurance * $object->nbterm)); + $regulInsurance = price2num((float) $object->insurance_amount - ((float) $insurance * $object->nbterm)); while ($i < $object->nbterm + 1) { $mens = price2num($echeances->calcMonthlyPayments($capital, $object->rate / 100, $object->nbterm - $i + 1), 'MT'); $int = ($capital * ($object->rate / 12)) / 100; $int = price2num($int, 'MT'); - $insu = ($insurance + (($i == 1) ? $regulInsurance : 0)); - $cap_rest = price2num($capital - ($mens - $int), 'MT'); + $insu = ((float) $insurance + (($i == 1) ? (float) $regulInsurance : 0)); + $cap_rest = price2num((float) $capital - ((float) $mens - (float) $int), 'MT'); print '<tr>'; print '<td class="center" id="n'.$i.'">'.$i.'</td>'; print '<td class="center" id ="date'.$i.'"><input type="hidden" name="hi_date'.$i.'" id ="hi_date'.$i.'" value="'.dol_time_plus_duree($object->datestart, $i - 1, 'm').'">'.dol_print_date(dol_time_plus_duree($object->datestart, $i - 1, 'm'), 'day').'</td>'; - print '<td class="center amount" id="insurance'.$i.'">'.price($insurance + (($i == 1) ? $regulInsurance : 0), 0, '', 1, -1, -1, $conf->currency).'</td><input type="hidden" name="hi_insurance'.$i.'" id ="hi_insurance'.$i.'" value="'.($insurance + (($i == 1) ? $regulInsurance : 0)).'">'; + print '<td class="center amount" id="insurance'.$i.'">'.price($insu, 0, '', 1, -1, -1, $conf->currency).'</td><input type="hidden" name="hi_insurance'.$i.'" id ="hi_insurance'.$i.'" value="'.$insu.'">'; print '<td class="center amount" id="interets'.$i.'">'.price($int, 0, '', 1, -1, -1, $conf->currency).'</td><input type="hidden" name="hi_interets'.$i.'" id ="hi_interets'.$i.'" value="'.$int.'">'; print '<td class="center"><input class="width75 right" name="mens'.$i.'" id="mens'.$i.'" value="'.$mens.'" ech="'.$i.'"></td>'; print '<td class="center amount" id="capital'.$i.'">'.price($cap_rest).'</td><input type="hidden" name="hi_capital'.$i.'" id ="hi_capital'.$i.'" value="'.$cap_rest.'">'; @@ -289,14 +290,14 @@ if ($object->nbterm > 0 && count($echeances->lines) == 0) { } elseif (count($echeances->lines) > 0) { $i = 1; $capital = $object->capital; - $insurance = $object->insurance_amount / $object->nbterm; + $insurance = (float) $object->insurance_amount / $object->nbterm; $insurance = price2num($insurance, 'MT'); - $regulInsurance = price2num($object->insurance_amount - ($insurance * $object->nbterm)); + $regulInsurance = price2num((float) $object->insurance_amount - ((float) $insurance * $object->nbterm)); $printed = false; foreach ($echeances->lines as $line) { $mens = $line->amount_capital + $line->amount_interest; $int = $line->amount_interest; - $insu = ($insurance + (($i == 1) ? $regulInsurance : 0)); + $insu = ((float) $insurance + (($i == 1) ? (float) $regulInsurance : 0)); $cap_rest = price2num($capital - ($mens - $int), 'MT'); print '<tr>'; From d542a112c7369f1fb2abbe89d32d5a3e80cbe2f7 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Thu, 21 Mar 2024 23:36:23 +0100 Subject: [PATCH 069/178] Fix type with cast/idate/phpdoc --- htdocs/opensurvey/wizard/choix_date.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/opensurvey/wizard/choix_date.php b/htdocs/opensurvey/wizard/choix_date.php index ff15655c5ff..b6e868fe940 100644 --- a/htdocs/opensurvey/wizard/choix_date.php +++ b/htdocs/opensurvey/wizard/choix_date.php @@ -1,6 +1,7 @@ <?php /* Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2014 Marcos García <marcosgdf@gmail.com> + * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com> * * 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 @@ -259,8 +260,8 @@ if (!issetAndNoEmpty('choixjourajout') && !issetAndNoEmpty('choixjourretrait') & //mise a jour des valeurs de session si mois avant if (issetAndNoEmpty('moisavant_x') || issetAndNoEmpty('moisavant')) { if ($_SESSION["mois"] == 1) { - $_SESSION["mois"] = 12; - $_SESSION["annee"] = $_SESSION["annee"] - 1; + $_SESSION["mois"] = 12; + $_SESSION["annee"] -= 1; } else { $_SESSION["mois"] -= 1; } @@ -335,12 +336,12 @@ if (issetAndNoEmpty('anneeapres_x') || issetAndNoEmpty('anneeapres')) { } //valeurs du nombre de jour dans le mois et du premier jour du mois -$nbrejourmois = date("t", mktime(0, 0, 0, $_SESSION["mois"], 1, $_SESSION["annee"])); -$premierjourmois = date("N", mktime(0, 0, 0, $_SESSION["mois"], 1, $_SESSION["annee"])) - 1; +$nbrejourmois = idate("t", mktime(0, 0, 0, (int) $_SESSION["mois"], 1, (int) $_SESSION["annee"])); +$premierjourmois = idate("N", mktime(0, 0, 0, (int) $_SESSION["mois"], 1, (int) $_SESSION["annee"])) - 1; //traduction de la valeur du mois if (is_int($_SESSION["mois"]) && $_SESSION["mois"] > 0 && $_SESSION["mois"] < 13) { - $motmois = dol_print_date(mktime(0, 0, 0, $_SESSION["mois"], 10), '%B'); + $motmois = dol_print_date(mktime(0, 0, 0, (int) $_SESSION["mois"], 10), '%B'); } else { $motmois = dol_print_date(dol_now(), '%B'); } From d23a296941478633d86a8986be623415ece3ef9e Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Thu, 21 Mar 2024 23:36:26 +0100 Subject: [PATCH 070/178] Fix type with cast/idate/phpdoc --- htdocs/partnership/class/partnershiputils.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/partnership/class/partnershiputils.class.php b/htdocs/partnership/class/partnershiputils.class.php index 4194b117698..656be5bad2f 100644 --- a/htdocs/partnership/class/partnershiputils.class.php +++ b/htdocs/partnership/class/partnershiputils.class.php @@ -367,8 +367,8 @@ class PartnershipUtils if (!$backlinkfound) { $tmpcount = $object->count_last_url_check_error + 1; - $nbminbacklinkerrorforcancel = getDolGlobalString('PARTNERSHIP_MIN_BACKLINK_ERROR_FOR_CANCEL', 3); - $nbmaxbacklinkerrorforcancel = getDolGlobalString('PARTNERSHIP_MAX_BACKLINK_ERROR_FOR_CANCEL', $nbminbacklinkerrorforcancel + 2); + $nbminbacklinkerrorforcancel = (int) getDolGlobalString('PARTNERSHIP_MIN_BACKLINK_ERROR_FOR_CANCEL', 3); + $nbmaxbacklinkerrorforcancel = (int) getDolGlobalString('PARTNERSHIP_MAX_BACKLINK_ERROR_FOR_CANCEL', (int) $nbminbacklinkerrorforcancel + 2); // If $nbminbacklinkerrorforemail = 0, no autoemail if ($nbminbacklinkerrorforcancel > 0) { From 6539a125ca187f993520f1960b57d6dc3bd8bc28 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Thu, 21 Mar 2024 23:36:28 +0100 Subject: [PATCH 071/178] Fix type with cast/idate/phpdoc --- htdocs/public/bookcal/index.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/public/bookcal/index.php b/htdocs/public/bookcal/index.php index ba43b12a5d0..83ba4ccfb3e 100644 --- a/htdocs/public/bookcal/index.php +++ b/htdocs/public/bookcal/index.php @@ -60,10 +60,10 @@ $action = GETPOST('action', 'aZ09'); $id = GETPOSTINT('id'); $id_availability = GETPOSTINT('id_availability'); -$year = GETPOSTINT("year") ? GETPOSTINT("year") : date("Y"); -$month = GETPOSTINT("month") ? GETPOSTINT("month") : date("m"); -$week = GETPOSTINT("week") ? GETPOSTINT("week") : date("W"); -$day = GETPOSTINT("day") ? GETPOSTINT("day") : date("d"); +$year = GETPOSTINT("year") ? GETPOSTINT("year") : idate("Y"); +$month = GETPOSTINT("month") ? GETPOSTINT("month") : idate("m"); +$week = GETPOSTINT("week") ? GETPOSTINT("week") : idate("W"); +$day = GETPOSTINT("day") ? GETPOSTINT("day") : idate("d"); $dateselect = dol_mktime(0, 0, 0, GETPOSTINT('dateselectmonth'), GETPOSTINT('dateselectday'), GETPOSTINT('dateselectyear'), 'tzuserrel'); if ($dateselect > 0) { $day = GETPOSTINT('dateselectday'); @@ -93,10 +93,10 @@ $next = dol_get_next_month($month, $year); $next_year = $next['year']; $next_month = $next['month']; -$max_day_in_prev_month = date("t", dol_mktime(0, 0, 0, $prev_month, 1, $prev_year, 'gmt')); // Nb of days in previous month -$max_day_in_month = date("t", dol_mktime(0, 0, 0, $month, 1, $year)); // Nb of days in next month +$max_day_in_prev_month = idate("t", dol_mktime(0, 0, 0, $prev_month, 1, $prev_year, 'gmt')); // Nb of days in previous month +$max_day_in_month = idate("t", dol_mktime(0, 0, 0, $month, 1, $year)); // Nb of days in next month // tmpday is a negative or null cursor to know how many days before the 1st to show on month view (if tmpday=0, 1st is monday) -$tmpday = - (int) date("w", dol_mktime(12, 0, 0, $month, 1, $year, 'gmt')) + 2; // date('w') is 0 for sunday +$tmpday = - idate("w", dol_mktime(12, 0, 0, $month, 1, $year, 'gmt')) + 2; // idate('w') is 0 for sunday $tmpday += ((isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK : 1) - 1); if ($tmpday >= 1) { $tmpday -= 7; // If tmpday is 0 we start with sunday, if -6, we start with monday of previous week. @@ -446,7 +446,7 @@ if ($action == 'afteradd') { $currdate0 = sprintf("%04d", $next_year).sprintf("%02d", $next_month).sprintf("%02d", $tmpday - $max_day_in_month); } // Get week number for the targeted date '$currdate0' - $numweek0 = date("W", strtotime(date($currdate0))); + $numweek0 = idate("W", strtotime(date($currdate0))); // Show the week number, and define column width echo ' <td class="center weeknumber opacitymedium hideonsmartphone" style="min-width: 40px">'.$numweek0.'</td>'; From 8602c4ba4c561a879557857afddf2bef37e0c904 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Thu, 21 Mar 2024 23:36:31 +0100 Subject: [PATCH 072/178] Fix type with cast/idate/phpdoc --- .../doc/pdf_standard_recruitmentjobposition.modules.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php b/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php index 11727b809f1..743d456eaeb 100644 --- a/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php +++ b/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php @@ -9,6 +9,7 @@ * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr> + * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com> * * 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 @@ -754,8 +755,8 @@ class pdf_standard_recruitmentjobposition extends ModelePDFRecruitmentJobPositio * Show table for lines * * @param tcpdf $pdf Object PDF - * @param string $tab_top Top position of table - * @param string $tab_height Height of table (rectangle) + * @param float|int $tab_top Top position of table + * @param float|int $tab_height Height of table (rectangle) * @param int $nexY Y (not used) * @param Translate $outputlangs Langs object * @param int $hidetop 1=Hide top bar of array and title, 0=Hide nothing, -1=Hide only title From a1ba13e229580d62b71e4e265a22a23fab15d064 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Thu, 21 Mar 2024 23:36:34 +0100 Subject: [PATCH 073/178] Fix type with cast/idate/phpdoc --- htdocs/societe/class/societe.class.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index d78cf8bdb4e..4f01261cc9e 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2469,12 +2469,12 @@ class Societe extends CommonObject if ($price_base_type == 'TTC') { $discount->amount_ttc = $discount->multicurrency_amount_ttc = price2num($remise, 'MT'); - $discount->amount_ht = $discount->multicurrency_amount_ht = price2num($remise / (1 + $vatrate / 100), 'MT'); - $discount->amount_tva = $discount->multicurrency_amount_tva = price2num($discount->amount_ttc - $discount->amount_ht, 'MT'); + $discount->amount_ht = $discount->multicurrency_amount_ht = price2num((float) $remise / (1 + (float) $vatrate / 100), 'MT'); + $discount->amount_tva = $discount->multicurrency_amount_tva = price2num((float) $discount->amount_ttc - (float) $discount->amount_ht, 'MT'); } else { $discount->amount_ht = $discount->multicurrency_amount_ht = price2num($remise, 'MT'); - $discount->amount_tva = $discount->multicurrency_amount_tva = price2num($remise * $vatrate / 100, 'MT'); - $discount->amount_ttc = $discount->multicurrency_amount_ttc = price2num($discount->amount_ht + $discount->amount_tva, 'MT'); + $discount->amount_tva = $discount->multicurrency_amount_tva = price2num((float) $remise * (float) $vatrate / 100, 'MT'); + $discount->amount_ttc = $discount->multicurrency_amount_ttc = price2num((float) $discount->amount_ht + (float) $discount->amount_tva, 'MT'); } $discount->tva_tx = price2num($vatrate); @@ -5219,7 +5219,7 @@ class Societe extends CommonObject * @param array $arraydata Array of data * @return string HTML Code for Kanban thumb. */ - public function getKanbanView($option = '', $arraydata = null) + public function getKanbanView($option = '', $arraydata = array()) { $selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']); @@ -5353,8 +5353,8 @@ class Societe extends CommonObject $this->db->begin(); // Recopy some data - $this->client = $this->client | $soc_origin->client; - $this->fournisseur = $this->fournisseur | $soc_origin->fournisseur; + $this->client |= $soc_origin->client; + $this->fournisseur |= $soc_origin->fournisseur; $listofproperties = array( 'address', 'zip', 'town', 'state_id', 'country_id', 'phone', 'phone_mobile', 'fax', 'email', 'socialnetworks', 'url', 'barcode', 'idprof1', 'idprof2', 'idprof3', 'idprof4', 'idprof5', 'idprof6', From 47a4c65591c2f8dc73bdb953fc1db9f195dfcbde Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Thu, 21 Mar 2024 23:36:36 +0100 Subject: [PATCH 074/178] Fix type with cast/idate/phpdoc --- htdocs/website/class/website.class.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php index e8d198f61b3..da5d9a255e4 100644 --- a/htdocs/website/class/website.class.php +++ b/htdocs/website/class/website.class.php @@ -742,7 +742,7 @@ class Website extends CommonObject if (!$error) { // @phan-suppress-next-line PhanPluginSuspiciousParamOrder - dolCopyDir($pathofwebsiteold, $pathofwebsitenew, getDolGlobalString('MAIN_UMASK'), 0, null, 2); + dolCopyDir($pathofwebsiteold, $pathofwebsitenew, getDolGlobalString('MAIN_UMASK'), 0, [], 2); // Check symlink to medias and restore it if ko $pathtomedias = DOL_DATA_ROOT.'/medias'; // Target @@ -1312,8 +1312,8 @@ class Website extends CommonObject // Scan the line if (preg_match('/^-- Page ID (\d+)\s[^\s]+\s(\d+).*Aliases\s(.+)\s--;/i', $buf, $reg)) { // Example of line: "-- Page ID 179 -> 1__+MAX_llx_website_page__ - Aliases about-us --;" - $oldid = $reg[1]; - $newid = ($reg[2] + $maxrowid); + $oldid = (int) $reg[1]; + $newid = ((int) $reg[2] + $maxrowid); $aliasesarray = explode(',', $reg[3]); dol_syslog("In sql source file, we have the page ID ".$oldid." to replace with the new ID ".$newid.", and we must create the shortcut aliases: ".$reg[3]); @@ -1321,7 +1321,7 @@ class Website extends CommonObject //dol_move($conf->website->dir_output.'/'.$object->ref.'/page'.$oldid.'.tpl.php', $conf->website->dir_output.'/'.$object->ref.'/page'.$newid.'.tpl.php', 0, 1, 0, 0); } elseif (preg_match('/^-- Page ID (\d+).*Aliases\s(.*)\s--;/i', $buf, /** @var string[] $reg */ $reg)) { // Example of line: "-- Page ID 1__+MAX_llx_website_page__ - Aliases about-us --;" - $newid = ($reg[1] + $maxrowid); + $newid = ((int) $reg[1] + $maxrowid); $aliasesarray = explode(',', $reg[2]); dol_syslog("In sql source file, we have the page with the new ID ".$newid.", and we must create the shortcut aliases: ".$reg[2]); @@ -1480,7 +1480,7 @@ class Website extends CommonObject */ public function isMultiLang() { - return (empty($this->otherlang) ? false : true); + return !empty($this->otherlang); } /** @@ -1893,7 +1893,7 @@ class Website extends CommonObject * @param string $str1 first string * @param string $str2 second string * @param array $exceptNumPge num of page files we don't want to change - * @return array|int -1 if KO, array if OK + * @return array|int<-1,-1> -1 if KO, array if OK */ protected function showDifferences($str1, $str2, $exceptNumPge = array()) { From 8e577b6d5a237ed032a276ce37b263c83efe115e Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Thu, 21 Mar 2024 23:45:25 +0100 Subject: [PATCH 075/178] Fix typing with phpdoc --- .../modules/supplier_proposal/doc/pdf_aurore.modules.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php index c9a8dc17770..12341238df0 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -6,6 +6,7 @@ * Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2024 Frédéric France <frederic.france@free.fr> + * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com> * * 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 @@ -1109,8 +1110,8 @@ class pdf_aurore extends ModelePDFSupplierProposal * Show table for lines * * @param TCPDF $pdf Object PDF - * @param string $tab_top Top position of table - * @param string $tab_height Height of table (rectangle) + * @param float|int $tab_top Top position of table + * @param float|int $tab_height Height of table (rectangle) * @param int $nexY Y (not used) * @param Translate $outputlangs Langs object * @param int $hidetop 1=Hide top bar of array and title, 0=Hide nothing, -1=Hide only title From b53d322f1bbc4541d16c87e98a6f0c08842cc261 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Fri, 22 Mar 2024 00:45:43 +0100 Subject: [PATCH 076/178] Add exception for PhanTypeInvalidRightOperandOfAdd to baseline because issue to handle later --- dev/tools/phan/baseline.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tools/phan/baseline.txt b/dev/tools/phan/baseline.txt index f39b1262064..52c70f4f641 100644 --- a/dev/tools/phan/baseline.txt +++ b/dev/tools/phan/baseline.txt @@ -47,7 +47,7 @@ return [ 'htdocs/core/lib/functions.lib.php' => ['PhanParamTooMany', 'PhanRedefineFunctionInternal'], 'htdocs/core/lib/price.lib.php' => ['PhanPluginSuspiciousParamPosition'], 'htdocs/core/modules/movement/doc/pdf_standard.modules.php' => ['PhanPluginDuplicateExpressionBinaryOp'], - 'htdocs/core/modules/mrp/doc/pdf_vinci.modules.php' => ['PhanTypeArraySuspiciousNull'], + 'htdocs/core/modules/mrp/doc/pdf_vinci.modules.php' => ['PhanTypeArraySuspiciousNull', 'PhanTypeInvalidRightOperandOfAdd'], 'htdocs/core/modules/syslog/mod_syslog_file.php' => ['PhanParamSignatureMismatch'], 'htdocs/core/modules/syslog/mod_syslog_syslog.php' => ['PhanParamSignatureMismatch'], 'htdocs/don/class/don.class.php' => ['PhanParamTooMany'], From ea9e34ebd95e6d77e05c8680af8d27b569658a6d Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Fri, 22 Mar 2024 00:46:44 +0100 Subject: [PATCH 077/178] Fix typing issue with cast --- htdocs/compta/cashcontrol/report.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/cashcontrol/report.php b/htdocs/compta/cashcontrol/report.php index 0fbf1d232f8..c59c5be8b34 100644 --- a/htdocs/compta/cashcontrol/report.php +++ b/htdocs/compta/cashcontrol/report.php @@ -356,7 +356,7 @@ if ($resql) { print "</div>"; //$cash = $amountpertype['LIQ'] + $object->opening; - $cash = price2num($cash + $object->opening, 'MT'); + $cash = price2num($cash + (float) $object->opening, 'MT'); print '<div style="text-align: right">'; print '<h2>'; From e01f4670e2a81c152acf0daf5b7c03500ba56549 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Fri, 22 Mar 2024 00:51:05 +0100 Subject: [PATCH 078/178] Fix several typing issues with casts, deprecation, css class --- htdocs/compta/paiement.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index 14984794eab..1d549dc2d02 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -83,7 +83,7 @@ $formquestion = array(); $usercanissuepayment = $user->hasRight('facture', 'paiement'); $fieldid = 'rowid'; -$isdraft = (($object->statut == Facture::STATUS_DRAFT) ? 1 : 0); +$isdraft = (($object->status == Facture::STATUS_DRAFT) ? 1 : 0); $result = restrictedArea($user, 'facture', $object->id, '', '', 'fk_soc', $fieldid, $isdraft); @@ -115,8 +115,8 @@ if (empty($reshook)) { if (substr($key, 0, 7) == 'amount_' && GETPOST($key) != '') { $cursorfacid = substr($key, 7); $amounts[$cursorfacid] = price2num(GETPOST($key)); - $totalpayment = $totalpayment + $amounts[$cursorfacid]; if (!empty($amounts[$cursorfacid])) { + $totalpayment += (float) $amounts[$cursorfacid]; $atleastonepaymentnotnull++; } $result = $tmpinvoice->fetch($cursorfacid); @@ -463,7 +463,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie //Add js for AutoFill print ' $(document).ready(function () {'; - print ' $(".AutoFillAmout").on(\'click touchstart\', function(){ + print ' $(".AutoFillAmount").on(\'click touchstart\', function(){ $("input[name="+$(this).data(\'rowname\')+"]").val($(this).data("value")).trigger("change"); });'; print ' });'."\n"; @@ -730,7 +730,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie // Multicurrency remain to pay print '<td class="right">'; if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) { - print price($sign * $multicurrency_remaintopay); + print price($sign * (float) $multicurrency_remaintopay); } print '</td>'; @@ -743,7 +743,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) { if ($action != 'add_paiement') { if (!empty($conf->use_javascript_ajax)) { - print img_picto("Auto fill", 'rightarrow', "class='AutoFillAmout' data-rowname='".$namef."' data-value='".($sign * $multicurrency_remaintopay)."'"); + print img_picto("Auto fill", 'rightarrow', "class='AutoFillAmount' data-rowname='".$namef."' data-value='".($sign * (float) $multicurrency_remaintopay)."'"); } print '<input type="text" class="maxwidth75 multicurrency_amount" name="'.$namef.'" value="'.GETPOST($namef).'">'; print '<input type="hidden" class="multicurrency_remain" name="'.$nameRemain.'" value="'.$multicurrency_remaintopay.'">'; @@ -770,7 +770,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie // Remain to take or to pay back print '<td class="right">'; - print price($sign * $remaintopay); + print price($sign * (float) $remaintopay); if (isModEnabled('prelevement')) { $numdirectdebitopen = 0; $totaldirectdebit = 0; @@ -805,7 +805,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie if ($action != 'add_paiement') { if (!empty($conf->use_javascript_ajax)) { - print img_picto("Auto fill", 'rightarrow', "class='AutoFillAmout' data-rowname='".$namef."' data-value='".($sign * $remaintopay)."'"); + print img_picto("Auto fill", 'rightarrow', "class='AutoFillAmount' data-rowname='".$namef."' data-value='".($sign * (float) $remaintopay)."'"); } print '<input type="text" class="maxwidth75 amount" id="'.$namef.'" name="'.$namef.'" value="'.dol_escape_htmltag(GETPOST($namef)).'">'; print '<input type="hidden" class="remain" name="'.$nameRemain.'" value="'.$remaintopay.'">'; @@ -856,7 +856,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print '+'.price($totalrecudeposits); } print '</b></td>'; - print '<td class="right"><b>'.price($sign * price2num($total_ttc - $totalrecu - $totalrecucreditnote - $totalrecudeposits, 'MT')).'</b></td>'; + print '<td class="right"><b>'.price($sign * (float) price2num($total_ttc - $totalrecu - $totalrecucreditnote - $totalrecudeposits, 'MT')).'</b></td>'; print '<td class="right" id="result" style="font-weight: bold;"></td>'; // Autofilled print '<td align="center"> </td>'; print "</tr>\n"; From 7a42dab6d21fa5669b144a930881e161829a0328 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Fri, 22 Mar 2024 00:53:03 +0100 Subject: [PATCH 079/178] Fix PHPdoc typing --- htdocs/core/class/utils_diff.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/utils_diff.class.php b/htdocs/core/class/utils_diff.class.php index 81242f72705..bcc06609ff9 100644 --- a/htdocs/core/class/utils_diff.class.php +++ b/htdocs/core/class/utils_diff.class.php @@ -115,9 +115,9 @@ class Diff * * @param string $sequence1 the first sequence * @param string $sequence2 the second sequence - * @param string $start the starting index - * @param string $end1 the ending index for the first sequence - * @param string $end2 the ending index for the second sequence + * @param int $start the starting index + * @param int $end1 the ending index for the first sequence + * @param int $end2 the ending index for the second sequence * @return array<array<int>> array of diff */ private static function computeTable($sequence1, $sequence2, $start, $end1, $end2) @@ -157,7 +157,7 @@ class Diff * @param array<array{0:string,1:int<0,2>}> $table the table returned by the computeTable function * @param string $sequence1 the first sequence * @param string $sequence2 the second sequence - * @param string $start the starting index + * @param int $start the starting index * @return array<array{0:string,1:int<0,2>}> array of diff */ private static function generatePartialDiff($table, $sequence1, $sequence2, $start) From fab3a7a02bd1265cb88b3ca0de75400fe6a196a7 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Fri, 22 Mar 2024 00:53:38 +0100 Subject: [PATCH 080/178] Fix typing with casts --- htdocs/core/lib/date.lib.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index 30431f10f27..8b7ea390b71 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -173,22 +173,22 @@ function dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforend } //Change the behavior of PHP over data-interval when the result of this function is Feb 29 (non-leap years), 30 or Feb 31 (so php returns March 1, 2 or 3 respectively) if ($ruleforendofmonth == 1 && $duration_unit == 'm') { - $timeyear = dol_print_date($time, '%Y'); - $timemonth = dol_print_date($time, '%m'); + $timeyear = (int) dol_print_date($time, '%Y'); + $timemonth = (int) dol_print_date($time, '%m'); $timetotalmonths = (($timeyear * 12) + $timemonth); $monthsexpected = ($timetotalmonths + $duration_value); $newtime = $date->getTimestamp(); - $newtimeyear = dol_print_date($newtime, '%Y'); - $newtimemonth = dol_print_date($newtime, '%m'); - $newtimetotalmonths = (($newtimeyear * 12) + $newtimemonth); + $newtimeyear = (int) dol_print_date($newtime, '%Y'); + $newtimemonth = (int) dol_print_date($newtime, '%m'); + $newtimetotalmonths = (($newtimeyear * 12) + $newtimemonth); if ($monthsexpected < $newtimetotalmonths) { - $newtimehours = dol_print_date($newtime, '%H'); - $newtimemins = dol_print_date($newtime, '%M'); - $newtimesecs = dol_print_date($newtime, '%S'); + $newtimehours = (int) dol_print_date($newtime, '%H'); + $newtimemins = (int) dol_print_date($newtime, '%M'); + $newtimesecs = (int) dol_print_date($newtime, '%S'); $datelim = dol_mktime($newtimehours, $newtimemins, $newtimesecs, $newtimemonth, 1, $newtimeyear); $datelim -= (3600 * 24); From 1af200b60a67be060a3279b0b607b2a7b4575057 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Fri, 22 Mar 2024 00:55:17 +0100 Subject: [PATCH 081/178] Fix AutoFillAmout typo --- htdocs/don/payment/payment.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/don/payment/payment.php b/htdocs/don/payment/payment.php index ebf7a741f80..e914988f780 100644 --- a/htdocs/don/payment/payment.php +++ b/htdocs/don/payment/payment.php @@ -1,6 +1,7 @@ <?php /* Copyright (C) 2015 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr> + * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com> * * 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 @@ -166,7 +167,7 @@ if ($action == 'create') { print "\n".'<script type="text/javascript">'; //Add js for AutoFill print ' $(document).ready(function () {'; - print ' $(".AutoFillAmout").on(\'click touchstart\', function(){ + print ' $(".AutoFillAmount").on(\'click touchstart\', function(){ $("input[name="+$(this).data(\'rowname\')+"]").val($(this).data("value")).trigger("change"); });'; print ' });'."\n"; @@ -253,7 +254,7 @@ if ($action == 'create') { if ($sumpaid < $objp->amount) { $namef = "amount_".$objp->id; if (!empty($conf->use_javascript_ajax)) { - print img_picto("Auto fill", 'rightarrow', "class='AutoFillAmout' data-rowname='".$namef."' data-value='".price($objp->amount - $sumpaid)."'"); + print img_picto("Auto fill", 'rightarrow', "class='AutoFillAmount' data-rowname='".$namef."' data-value='".price($objp->amount - $sumpaid)."'"); } print '<input type="text" size="8" name="'.$namef.'">'; } else { From 1164ba68d56ada4cce97e6c8673f9282a05d6f41 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Fri, 22 Mar 2024 00:56:30 +0100 Subject: [PATCH 082/178] Fix labelStatus typing, casts for typing, PHPdoc --- .../class/expensereport.class.php | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index b7aced293b3..b07e05620e0 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -248,12 +248,12 @@ class ExpenseReport extends CommonObject public $localtax2; // for backward compatibility (real field should be total_localtax2 defined into CommonObject) /** - * @var array + * @var array<int,string> */ public $labelStatus = array(); /** - * @var array + * @var array<int,string> */ public $labelStatusShort = array(); @@ -1036,8 +1036,8 @@ class ExpenseReport extends CommonObject $objp->fk_c_expensereport_status = $obj->status; $objp->rowid = $obj->rowid; - $total_HT = $total_HT + $objp->total_ht; - $total_TTC = $total_TTC + $objp->total_ttc; + $total_HT += $objp->total_ht; + $total_TTC += $objp->total_ttc; $author = new User($this->db); $author->fetch($objp->fk_user_author); @@ -1732,7 +1732,7 @@ class ExpenseReport extends CommonObject $mybool = ((bool) @include_once $dir.$file) || $mybool; } - if ($mybool === false) { + if (!$mybool) { dol_print_error(null, "Failed to include file ".$file); return ''; } @@ -1759,7 +1759,7 @@ class ExpenseReport extends CommonObject * * @param array $params ex option, infologin * @since v18 - * @return array + * @return array{picto:string,ref?:string,total_ht?:string,total_tva?:string,total_ttc?:string} */ public function getTooltipContentArray($params) { @@ -1897,9 +1897,9 @@ class ExpenseReport extends CommonObject public function update_totaux_add($ligne_total_ht, $ligne_total_tva) { // phpcs:enable - $this->total_ht = $this->total_ht + $ligne_total_ht; - $this->total_tva = $this->total_tva + $ligne_total_tva; - $this->total_ttc = $this->total_ht + $this->total_tva; + $this->total_ht += (float) $ligne_total_ht; + $this->total_tva += (float) $ligne_total_tva; + $this->total_ttc += $this->total_tva; $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET"; $sql .= " total_ht = ".$this->total_ht; @@ -2253,8 +2253,7 @@ class ExpenseReport extends CommonObject // calcul total of line //$total_ttc = price2num($qty*$value_unit, 'MT'); - $tx_tva = $vatrate / 100; - $tx_tva = $tx_tva + 1; + $tx_tva = 1 + (float) $vatrate / 100; $this->line = new ExpenseReportLine($this->db); $this->line->comments = $comments; @@ -2484,7 +2483,7 @@ class ExpenseReport extends CommonObject * @param int $hidedetails Hide details of lines * @param int $hidedesc Hide description * @param int $hideref Hide ref - * @param null|array $moreparams Array to provide more information + * @param ?array $moreparams Array to provide more information * @return int 0 if KO, 1 if OK */ public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null) From 668207b34bfeaba288af67a0c7dc35f7112fe9d5 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Fri, 22 Mar 2024 00:57:31 +0100 Subject: [PATCH 083/178] Fix typing with casts, fix AutoFillAmout typo --- htdocs/fourn/facture/paiement.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index 7776dd888d3..b25825207db 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -167,7 +167,7 @@ if (empty($reshook)) { if (!empty($amounts[$cursorfacid])) { $atleastonepaymentnotnull++; if (is_numeric($amounts[$cursorfacid])) { - $totalpayment = $totalpayment + $amounts[$cursorfacid]; + $totalpayment += (float) $amounts[$cursorfacid]; } else { setEventMessages($langs->transnoentities("InputValueIsNotAnNumber", GETPOST($key)), null, 'warnings'); } @@ -486,7 +486,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie //Add js for AutoFill print ' $(document).ready(function () {'; - print ' $(".AutoFillAmout").on(\'click touchstart\', function(){ + print ' $(".AutoFillAmount").on(\'click touchstart\', function(){ $("input[name="+$(this).data(\'rowname\')+"]").val($(this).data("value")).trigger("change"); });'; print ' });'."\n"; @@ -579,7 +579,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie //Add js for AutoFill print "\n".'<script type="text/javascript">'; print ' $(document).ready(function () {'; - print ' $(".AutoFillAmout").on(\'click touchstart\', function(){ + print ' $(".AutoFillAmount").on(\'click touchstart\', function(){ $("input[name="+$(this).data(\'rowname\')+"]").val($(this).data("value")); });'; print ' });'."\n"; @@ -709,7 +709,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) { if ($action != 'add_paiement') { if (!empty($conf->use_javascript_ajax)) { - print img_picto("Auto fill", 'rightarrow', "class='AutoFillAmout' data-rowname='".$namef."' data-value='".($sign * $multicurrency_remaintopay)."'"); + print img_picto("Auto fill", 'rightarrow', "class='AutoFillAmount' data-rowname='".$namef."' data-value='".($sign * (float) $multicurrency_remaintopay)."'"); } print '<input type=hidden class="multicurrency_remain" name="'.$nameRemain.'" value="'.$multicurrency_remaintopay.'">'; print '<input type="text" size="8" class="multicurrency_amount" name="'.$namef.'" value="'.GETPOST($namef).'">'; @@ -733,7 +733,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print '</td>'; print '<td class="right">'; - print price($sign * $remaintopay); + print price($sign * (float) $remaintopay); if (isModEnabled('paymentbybanktransfer')) { $numdirectdebitopen = 0; $totaldirectdebit = 0; @@ -766,7 +766,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie if ($action != 'add_paiement') { if (!empty($conf->use_javascript_ajax)) { - print img_picto("Auto fill", 'rightarrow', "class='AutoFillAmout' data-rowname='".$namef."' data-value='".($sign * $remaintopay)."'"); + print img_picto("Auto fill", 'rightarrow', "class='AutoFillAmount' data-rowname='".$namef."' data-value='".($sign * (float) $remaintopay)."'"); } print '<input type="hidden" class="remain" name="'.$nameRemain.'" value="'.$remaintopay.'">'; print '<input type="text" size="8" class="amount" name="'.$namef.'" value="'.dol_escape_htmltag(GETPOST($namef)).'">'; // class is required to be used by javascript callForResult(); From 5c073dfb6e48e7d0a86fc3d1110cc76df04ee475 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Fri, 22 Mar 2024 00:58:21 +0100 Subject: [PATCH 084/178] Qual: Enable PhanTypeInvalidRightOperandOfAdd --- dev/tools/phan/config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tools/phan/config.php b/dev/tools/phan/config.php index 8b4a5d5ab45..ee08ff3b561 100644 --- a/dev/tools/phan/config.php +++ b/dev/tools/phan/config.php @@ -480,7 +480,7 @@ return [ // 'PhanPluginDescriptionlessCommentOnProtectedProperty', 'PhanPluginRedundantAssignmentInGlobalScope', // 'PhanTypeMismatchDeclaredParamNullable', - 'PhanTypeInvalidRightOperandOfAdd', + // 'PhanTypeInvalidRightOperandOfAdd', // 'PhanPluginDescriptionlessCommentOnPrivateProperty', // 'PhanUndeclaredVariableDim', // Array initialisation on undeclared var: $abc['x']='ab' 'PhanTypeInvalidPropertyName', From 08733e8aeded9b8057b346988bacc4efc75fffca Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Fri, 22 Mar 2024 01:12:40 +0100 Subject: [PATCH 085/178] Fix a final left add operand typing issue + some typos --- htdocs/expensereport/class/expensereport.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index b07e05620e0..162f5cdb3d2 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -2756,7 +2756,7 @@ class ExpenseReport extends CommonObject $currentUser->fetch($this->fk_user); $currentUser->getrights('expensereport'); //Clean - $qty = price2num($qty); + $qty = (float) price2num($qty); $sql = " SELECT r.range_ik, t.ikoffset, t.coef"; $sql .= " FROM ".MAIN_DB_PREFIX."expensereport_ik t"; @@ -2786,7 +2786,7 @@ class ExpenseReport extends CommonObject $cumulYearQty = $obj->cumul; } - $qty = $cumulYearQty + $qty; + $qty += (float) $cumulYearQty; } $num = $this->db->num_rows($result); @@ -2826,7 +2826,7 @@ class ExpenseReport extends CommonObject } /** - * Return clicable link of object (with eventually picto) + * Return clickable link of object (with optional picto) * * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) * @param array $arraydata Array of data From df13bc5ab4b15b5530cb4d4bde95007094293fa0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= <frederic.france@free.fr> Date: Fri, 22 Mar 2024 12:24:52 +0100 Subject: [PATCH 086/178] fetch last_main_doc in invoice supplier --- htdocs/fourn/class/fournisseur.facture.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 845053a4d89..0acfd1a66d7 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -887,6 +887,7 @@ class FactureFournisseur extends CommonInvoice $sql .= " t.note_private,"; $sql .= " t.note_public,"; $sql .= " t.model_pdf,"; + $sql .= " t.last_main_doc,"; $sql .= " t.import_key,"; $sql .= " t.extraparams,"; $sql .= " cr.code as cond_reglement_code, cr.libelle as cond_reglement_label, cr.libelle_facture as cond_reglement_doc,"; @@ -967,6 +968,7 @@ class FactureFournisseur extends CommonInvoice $this->note_private = $obj->note_private; $this->note_public = $obj->note_public; $this->model_pdf = $obj->model_pdf; + $this->last_main_doc = $obj->last_main_doc; $this->import_key = $obj->import_key; //Incoterms From b78766b904b3e8b49bcfd4b934433c82f50779b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= <frederic.france@free.fr> Date: Fri, 22 Mar 2024 12:28:56 +0100 Subject: [PATCH 087/178] fetch last_main_doc in invoice supplier --- .../core/modules/supplier_invoice/doc/pdf_canelle.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php index 3327e63506d..9e71c73b268 100644 --- a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php @@ -125,7 +125,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices /* if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) || !empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN)) { $this->posxtva = $this->posxup; } */ - $this->posxpicture = $this->posxtva - (!getDolGlobalString('MAIN_DOCUMENTS_WITH_PICTURE_WIDTH') ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images + $this->posxpicture = $this->posxtva - (getDolGlobalInt('MAIN_DOCUMENTS_WITH_PICTURE_WIDTH', 20)); // width of images if ($this->page_largeur < 210) { // To work with US executive format $this->posxpicture -= 20; $this->posxtva -= 20; From 828cf2cbce4098c067eb92f09fef36703bb50d71 Mon Sep 17 00:00:00 2001 From: VESSILLER <lvessiller@open-dsi.fr> Date: Fri, 22 Mar 2024 14:20:03 +0100 Subject: [PATCH 088/178] NEW now button when editing an event --- htdocs/comm/action/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 9b688ac3d3e..cae65bdc3f5 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1916,9 +1916,9 @@ if ($id > 0) { */ print '</td><td td colspan="3">'; $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT'); - print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 0, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel'); + print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 0, "action", 1, 2, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel'); print ' <span class="hideonsmartphone">    -    </span> '; - print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel'); + print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 2, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel'); print '</td></tr>'; print '<tr><td class=""> </td><td></td></tr>'; From 3257f8405c824a3821d1d7e63a5f8989ee362121 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= <frederic34@users.noreply.github.com> Date: Fri, 22 Mar 2024 14:47:25 +0100 Subject: [PATCH 089/178] add inithook --- htdocs/margin/checkMargins.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/margin/checkMargins.php b/htdocs/margin/checkMargins.php index 5cdee16619b..f913582de28 100644 --- a/htdocs/margin/checkMargins.php +++ b/htdocs/margin/checkMargins.php @@ -64,6 +64,8 @@ $enddate = dol_mktime(23, 59, 59, GETPOSTINT('enddatemonth'), GETPOSTINT('enddat $search_ref = GETPOST('search_ref', 'alpha'); +$hookmanager->initHooks(array('checkmarginlist')); + // Security check $result = restrictedArea($user, 'margins'); From 7054f90d761174d21804d68872aabb32ce975a3b Mon Sep 17 00:00:00 2001 From: Hystepik <lmarcouiller@nltechno.com> Date: Fri, 22 Mar 2024 15:38:10 +0100 Subject: [PATCH 090/178] Fix expensereport bad search_user --- htdocs/expensereport/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index 6cc403e87d5..0a78143fb06 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -103,7 +103,7 @@ if (!$sortfield) { $sall = trim((GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); $search_ref = GETPOST('search_ref', 'alpha'); -$search_user = GETPOSTINT('search_user'); +$search_user = GETPOST('search_user', 'int'); $search_amount_ht = GETPOST('search_amount_ht', 'alpha'); $search_amount_vat = GETPOST('search_amount_vat', 'alpha'); $search_amount_ttc = GETPOST('search_amount_ttc', 'alpha'); From 0bf2f3b70dd1606e59cb9d086fd0f10ef033d428 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Fri, 22 Mar 2024 18:15:24 +0100 Subject: [PATCH 091/178] Fix warning --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 0c62d6e7e2a..fccbbfe9ed8 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -8165,7 +8165,7 @@ class Form $oldValueForShowOnCombobox = 0; foreach ($objecttmp->fields as $fieldK => $fielV) { - if (!$fielV['showoncombobox'] || empty($objecttmp->$fieldK)) { + if (empty($fielV['showoncombobox']) || empty($objecttmp->$fieldK)) { continue; } From 0ce1b9a9cce52eb69f62b549dd7dc4a6db5709f4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Fri, 22 Mar 2024 18:23:41 +0100 Subject: [PATCH 092/178] Fix doc --- htdocs/accountancy/customer/lines.php | 2 +- htdocs/accountancy/expensereport/lines.php | 4 ++-- htdocs/accountancy/index.php | 2 +- htdocs/accountancy/supplier/lines.php | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index a47a54ae40c..0bf1de32b21 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -392,7 +392,7 @@ if ($result) { print '<br><div class="inline-block divButAction paddingbottom">'.$langs->trans("ChangeAccount").' '; print $formaccounting->select_account($account_parent, 'account_parent', 2, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone valignmiddle'); - print '<input type="submit" class="button small valignmiddle" value="'.$langs->trans("ChangeBinding").'"/></div>'; + print '<input type="submit" class="button small smallpaddingimp valignmiddle" value="'.$langs->trans("ChangeBinding").'"/></div>'; $moreforfilter = ''; diff --git a/htdocs/accountancy/expensereport/lines.php b/htdocs/accountancy/expensereport/lines.php index 60f08f4992d..abfbfd2b257 100644 --- a/htdocs/accountancy/expensereport/lines.php +++ b/htdocs/accountancy/expensereport/lines.php @@ -39,7 +39,7 @@ $langs->loadLangs(array("compta", "bills", "other", "accountancy", "trips", "pro $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') -$account_parent = GETPOSTINT('account_parent'); +$account_parent = GETPOST('account_parent'); $changeaccount = GETPOST('changeaccount'); // Search Getpost $search_login = GETPOST('search_login', 'alpha'); @@ -314,7 +314,7 @@ if ($result) { print '<br><div class="inline-block divButAction paddingbottom">'.$langs->trans("ChangeAccount").' '; print $formaccounting->select_account($account_parent, 'account_parent', 2, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone valignmiddle'); - print '<input type="submit" class="button small valignmiddle" value="'.$langs->trans("ChangeBinding").'"/></div>'; + print '<input type="submit" class="button small smallpaddingimp valignmiddle" value="'.$langs->trans("ChangeBinding").'"/></div>'; $moreforfilter = ''; diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php index 10adfea0bc8..54b794fe17d 100644 --- a/htdocs/accountancy/index.php +++ b/htdocs/accountancy/index.php @@ -102,7 +102,7 @@ if (isModEnabled('accounting')) { </script>'; } - print load_fiche_titre($langs->trans("AccountancyArea"), $resultboxes['selectboxlist'], 'accountancy', 0, '', '', $showtutorial); + print load_fiche_titre($langs->trans("AccountancyArea"), empty($resultboxes['selectboxlist']) ? '' : $resultboxes['selectboxlist'], 'accountancy', 0, '', '', $showtutorial); if (getDolGlobalInt('INVOICE_USE_SITUATION') == 1) { print info_admin($langs->trans("SorryThisModuleIsNotCompatibleWithTheExperimentalFeatureOfSituationInvoices")); diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index 16d1d3d0202..52c1d42131f 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -400,7 +400,7 @@ if ($result) { print '<br><div class="inline-block divButAction paddingbottom">'.$langs->trans("ChangeAccount").' '; print $formaccounting->select_account($account_parent, 'account_parent', 2, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone valignmiddle'); - print '<input type="submit" class="button small valignmiddle" value="'.$langs->trans("ChangeBinding").'"/></div>'; + print '<input type="submit" class="button small smallpaddingimp valignmiddle" value="'.$langs->trans("ChangeBinding").'"/></div>'; $moreforfilter = ''; From 0f4df0bed03174537d9de21bff7b8fcc05f6f494 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Fri, 22 Mar 2024 19:10:22 +0100 Subject: [PATCH 093/178] Clean page --- htdocs/accountancy/customer/lines.php | 4 ++-- htdocs/accountancy/customer/list.php | 2 +- htdocs/accountancy/expensereport/lines.php | 15 +++++++++----- htdocs/accountancy/expensereport/list.php | 24 +++++++++++++--------- htdocs/accountancy/index.php | 24 +++++++++++----------- htdocs/accountancy/supplier/lines.php | 4 ++-- htdocs/accountancy/supplier/list.php | 16 +++++++-------- 7 files changed, 49 insertions(+), 40 deletions(-) diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index 0bf1de32b21..9b9daf3d07b 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -45,7 +45,7 @@ $account_parent = GETPOST('account_parent'); $changeaccount = GETPOST('changeaccount'); // Search Getpost $search_societe = GETPOST('search_societe', 'alpha'); -$search_lineid = GETPOSTINT('search_lineid'); +$search_lineid = GETPOST('search_lineid', 'alpha'); $search_ref = GETPOST('search_ref', 'alpha'); $search_invoice = GETPOST('search_invoice', 'alpha'); $search_label = GETPOST('search_label', 'alpha'); @@ -400,7 +400,7 @@ if ($result) { print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n"; print '<tr class="liste_titre_filter">'; - print '<td class="liste_titre"><input type="text" class="flat maxwidth25" name="search_lineid" value="'.dol_escape_htmltag($search_lineid).'"></td>'; + print '<td class="liste_titre"><input type="text" class="flat maxwidth40" name="search_lineid" value="'.dol_escape_htmltag($search_lineid).'"></td>'; print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="'.dol_escape_htmltag($search_invoice).'"></td>'; print '<td class="liste_titre center">'; print '<div class="nowrapfordate">'; diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 84128d37f94..eedb807e396 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -55,7 +55,7 @@ $mesCasesCochees = GETPOST('toselect', 'array'); // Search Getpost $search_societe = GETPOST('search_societe', 'alpha'); -$search_lineid = GETPOSTINT('search_lineid'); +$search_lineid = GETPOST('search_lineid', 'alpha'); // Can be '> 100' $search_ref = GETPOST('search_ref', 'alpha'); $search_invoice = GETPOST('search_invoice', 'alpha'); $search_label = GETPOST('search_label', 'alpha'); diff --git a/htdocs/accountancy/expensereport/lines.php b/htdocs/accountancy/expensereport/lines.php index abfbfd2b257..cb0317d5c01 100644 --- a/htdocs/accountancy/expensereport/lines.php +++ b/htdocs/accountancy/expensereport/lines.php @@ -42,6 +42,7 @@ $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' $account_parent = GETPOST('account_parent'); $changeaccount = GETPOST('changeaccount'); // Search Getpost +$search_lineid = GETPOST('search_lineid', 'alpha'); // Can be '> 100' $search_login = GETPOST('search_login', 'alpha'); $search_expensereport = GETPOST('search_expensereport', 'alpha'); $search_label = GETPOST('search_label', 'alpha'); @@ -101,6 +102,7 @@ $formaccounting = new FormAccounting($db); // Purge search criteria if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // Both test are required to be compatible with all browsers + $search_lineid = ''; $search_login = ''; $search_expensereport = ''; $search_label = ''; @@ -203,6 +205,9 @@ $sql .= " WHERE erd.fk_code_ventilation > 0"; $sql .= " AND er.entity IN (".getEntity('expensereport', 0).")"; // We don't share object for accountancy $sql .= " AND er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseReport::STATUS_CLOSED.")"; // Add search filter like +if (strlen($search_lineid)) { + $sql .= natural_search("fd.rowid", $search_lineid, 1); +} if (strlen(trim($search_login))) { $sql .= natural_search("u.login", $search_login); } @@ -322,8 +327,8 @@ if ($result) { print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n"; print '<tr class="liste_titre_filter">'; + print '<td class="liste_titre"><input type="text" class="flat maxwidth40" name="search_lineid" value="'.dol_escape_htmltag($search_lineid).'"></td>'; print '<td class="liste_titre"><input type="text" name="search_login" class="maxwidth50" value="'.$search_login.'"></td>'; - print '<td class="liste_titre"></td>'; print '<td><input type="text" class="flat maxwidth50" name="search_expensereport" value="'.dol_escape_htmltag($search_expensereport).'"></td>'; if (getDolGlobalString('ACCOUNTANCY_USE_EXPENSE_REPORT_VALIDATION_DATE')) { print '<td class="liste_titre"></td>'; @@ -348,8 +353,8 @@ if ($result) { print "</tr>\n"; print '<tr class="liste_titre">'; - print_liste_field_titre("Employees", $_SERVER['PHP_SELF'], "u.login", $param, "", "", $sortfield, $sortorder); print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "erd.rowid", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre("Employees", $_SERVER['PHP_SELF'], "u.login", $param, "", "", $sortfield, $sortorder); print_liste_field_titre("ExpenseReport", $_SERVER["PHP_SELF"], "er.ref", "", $param, '', $sortfield, $sortorder); if (getDolGlobalString('ACCOUNTANCY_USE_EXPENSE_REPORT_VALIDATION_DATE')) { print_liste_field_titre("DateValidation", $_SERVER["PHP_SELF"], "er.date_valid", "", $param, '', $sortfield, $sortorder, 'center '); @@ -393,14 +398,14 @@ if ($result) { print '<tr class="oddeven">'; + // Line id + print '<td>'.$objp->rowid.'</td>'; + // Login print '<td class="nowraponall">'; print $userstatic->getNomUrl(-1, '', 0, 0, 24, 1, 'login', '', 1); print '</td>'; - // Line id - print '<td>'.$objp->rowid.'</td>'; - // Ref Expense report print '<td>'.$expensereportstatic->getNomUrl(1).'</td>'; diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php index 9bb346e153a..0ce64a66fa0 100644 --- a/htdocs/accountancy/expensereport/list.php +++ b/htdocs/accountancy/expensereport/list.php @@ -25,8 +25,8 @@ * \ingroup Accountancy (Double entries) * \brief Ventilation page from expense reports */ -require '../../main.inc.php'; +require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; @@ -135,6 +135,7 @@ if ($reshook < 0) { if (empty($reshook)) { // Purge search criteria if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All test are required to be compatible with all browsers + $search_lineid = ''; $search_login = ''; $search_expensereport = ''; $search_label = ''; @@ -249,6 +250,9 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = er.fk_user_author"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON f.accountancy_code = aa.account_number AND aa.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa.entity = ".$conf->entity; $sql .= " WHERE er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseReport::STATUS_CLOSED.") AND erd.fk_code_ventilation <= 0"; // Add search filter like +if (strlen($search_lineid)) { + $sql .= natural_search("er.rowid", $search_lineid, 1); +} if (strlen(trim($search_login))) { $sql .= natural_search("u.login", $search_login); } @@ -320,12 +324,12 @@ if ($result) { if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.((int) $limit); } - if ($search_login) { - $param .= '&search_login='.urlencode($search_login); - } if ($search_lineid) { $param .= '&search_lineid='.urlencode($search_lineid); } + if ($search_login) { + $param .= '&search_login='.urlencode($search_login); + } if ($search_date_startday) { $param .= '&search_date_startday='.urlencode((string) ($search_date_startday)); } @@ -392,8 +396,8 @@ if ($result) { // We add search filter print '<tr class="liste_titre_filter">'; - print '<td class="liste_titre"><input type="text" name="search_login" class="maxwidth50" value="'.$search_login.'"></td>'; - print '<td class="liste_titre"></td>'; + print '<td class="liste_titre"><input type="text" class="flat maxwidth40" name="search_lineid" value="'.dol_escape_htmltag($search_lineid).'"></td>'; + print '<td class="liste_titre"><input type="text" name="search_login" class="maxwidth50" value="'.dol_escape_htmltag($search_login).'"></td>'; print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_expensereport" value="'.dol_escape_htmltag($search_expensereport).'"></td>'; if (getDolGlobalString('ACCOUNTANCY_USE_EXPENSE_REPORT_VALIDATION_DATE')) { print '<td class="liste_titre"></td>'; @@ -419,8 +423,8 @@ if ($result) { print '</tr>'; print '<tr class="liste_titre">'; - print_liste_field_titre("Employee", $_SERVER['PHP_SELF'], "u.login", $param, "", "", $sortfield, $sortorder); print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "erd.rowid", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre("Employee", $_SERVER['PHP_SELF'], "u.login", $param, "", "", $sortfield, $sortorder); print_liste_field_titre("ExpenseReport", $_SERVER["PHP_SELF"], "er.ref", "", $param, '', $sortfield, $sortorder); if (getDolGlobalString('ACCOUNTANCY_USE_EXPENSE_REPORT_VALIDATION_DATE')) { print_liste_field_titre("DateValidation", $_SERVER["PHP_SELF"], "er.date_valid", "", $param, '', $sortfield, $sortorder, 'center '); @@ -465,14 +469,14 @@ if ($result) { print '<tr class="oddeven">'; + // Line id + print '<td>'.$objp->rowid.'</td>'; + // Login print '<td class="nowraponall">'; print $userstatic->getNomUrl(-1, '', 0, 0, 24, 1, 'login', '', 1); print '</td>'; - // Line id - print '<td>'.$objp->rowid.'</td>'; - // Ref Expense report print '<td>'.$expensereport_static->getNomUrl(1).'</td>'; diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php index 54b794fe17d..49fccc7d147 100644 --- a/htdocs/accountancy/index.php +++ b/htdocs/accountancy/index.php @@ -77,11 +77,21 @@ $help_url = 'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilit&eacut llxHeader('', $langs->trans("AccountancyArea"), $help_url); +$resultboxes = FormOther::getBoxesArea($user, "27"); // Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb) +$boxlist = '<div class="twocolumns">'; +$boxlist .= '<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">'; +$boxlist .= $resultboxes['boxlista']; +$boxlist .= '</div>'; +$boxlist .= '<div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">'; +$boxlist .= $resultboxes['boxlistb']; +$boxlist .= '</div>'; +$boxlist .= "\n"; +$boxlist .= '</div>'; + + if (isModEnabled('accounting')) { $step = 0; - - $helpisexpanded = empty($resultboxes['boxactivated']) || (empty($resultboxes['boxlista']) && empty($resultboxes['boxlistb'])); // If there is no widget, the tooltip help is expanded by default. $showtutorial = ''; @@ -276,16 +286,6 @@ if (isModEnabled('accounting')) { /* * Show boxes */ -$resultboxes = FormOther::getBoxesArea($user, "27"); // Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb) -$boxlist = '<div class="twocolumns">'; -$boxlist .= '<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">'; -$boxlist .= $resultboxes['boxlista']; -$boxlist .= '</div>'; -$boxlist .= '<div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">'; -$boxlist .= $resultboxes['boxlistb']; -$boxlist .= '</div>'; -$boxlist .= "\n"; -$boxlist .= '</div>'; print $boxlist; // End of page diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index 52c1d42131f..6dd160ed9b9 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -46,7 +46,7 @@ $account_parent = GETPOST('account_parent'); $changeaccount = GETPOST('changeaccount'); // Search Getpost $search_societe = GETPOST('search_societe', 'alpha'); -$search_lineid = GETPOSTINT('search_lineid'); +$search_lineid = GETPOST('search_lineid', 'alpha'); // Can be '> 100' $search_ref = GETPOST('search_ref', 'alpha'); $search_invoice = GETPOST('search_invoice', 'alpha'); //$search_ref_supplier = GETPOST('search_ref_supplier', 'alpha'); @@ -409,7 +409,7 @@ if ($result) { // We add search filter print '<tr class="liste_titre_filter">'; - print '<td class="liste_titre"><input type="text" class="flat maxwidth25" name="search_lineid" value="'.dol_escape_htmltag($search_lineid).'"></td>'; + print '<td class="liste_titre"><input type="text" class="flat maxwidth40" name="search_lineid" value="'.dol_escape_htmltag($search_lineid).'"></td>'; print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="'.dol_escape_htmltag($search_invoice).'"></td>'; //print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref_supplier" value="'.dol_escape_htmltag($search_ref_supplier).'"></td>'; print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="'.dol_escape_htmltag($search_label).'"></td>'; diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index b086cdd1914..b7411f66fd5 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -55,8 +55,8 @@ $default_account = GETPOSTINT('default_account'); $mesCasesCochees = GETPOST('toselect', 'array'); // Search Getpost +$search_lineid = GETPOST('search_lineid', 'alpha'); // Can be '> 100' $search_societe = GETPOST('search_societe', 'alpha'); -$search_lineid = GETPOSTINT('search_lineid'); $search_ref = GETPOST('search_ref', 'alpha'); $search_ref_supplier = GETPOST('search_ref_supplier', 'alpha'); $search_invoice = GETPOST('search_invoice', 'alpha'); @@ -291,12 +291,12 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa4 ON " . $alias_so $sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0"; $sql .= " AND l.product_type <= 2"; // Add search filter like -if ($search_societe) { - $sql .= natural_search('s.nom', $search_societe); -} -if ($search_lineid) { +if (strlen($search_lineid)) { $sql .= natural_search("l.rowid", $search_lineid, 1); } +if (strlen($search_societe)) { + $sql .= natural_search('s.nom', $search_societe); +} if (strlen(trim($search_invoice))) { $sql .= natural_search(array("f.ref", "f.ref_supplier"), $search_invoice); } @@ -399,12 +399,12 @@ if ($result) { if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.((int) $limit); } - if ($search_societe) { - $param .= '&search_societe='.urlencode($search_societe); - } if ($search_lineid) { $param .= '&search_lineid='.urlencode((string) ($search_lineid)); } + if ($search_societe) { + $param .= '&search_societe='.urlencode($search_societe); + } if ($search_date_startday) { $param .= '&search_date_startday='.urlencode((string) ($search_date_startday)); } From d448b57cf21906e4dcc33c7c817ee60120329862 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Fri, 22 Mar 2024 19:58:33 +0100 Subject: [PATCH 094/178] Debug v20 --- htdocs/core/boxes/box_accountancy_last_manual_entries.php | 2 +- htdocs/core/boxes/box_accountancy_suspense_account.php | 2 +- htdocs/core/modules/modAccounting.class.php | 2 -- htdocs/langs/en_US/accountancy.lang | 8 ++++---- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/htdocs/core/boxes/box_accountancy_last_manual_entries.php b/htdocs/core/boxes/box_accountancy_last_manual_entries.php index f10fd4ee61c..14169dfe17c 100644 --- a/htdocs/core/boxes/box_accountancy_last_manual_entries.php +++ b/htdocs/core/boxes/box_accountancy_last_manual_entries.php @@ -33,7 +33,7 @@ include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php'; class box_accountancy_last_manual_entries extends ModeleBoxes { public $boxcode = "accountancy_last_manual_entries"; - public $boximg = "accounting"; + public $boximg = "accountancy"; public $boxlabel = "BoxLastManualEntries"; public $depends = array("accounting"); diff --git a/htdocs/core/boxes/box_accountancy_suspense_account.php b/htdocs/core/boxes/box_accountancy_suspense_account.php index 49ad1322d15..a52f0a1a3b8 100644 --- a/htdocs/core/boxes/box_accountancy_suspense_account.php +++ b/htdocs/core/boxes/box_accountancy_suspense_account.php @@ -33,7 +33,7 @@ include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php'; class box_accountancy_suspense_account extends ModeleBoxes { public $boxcode = "accountancy_suspense_account"; - public $boximg = "accounting"; + public $boximg = "accountancy"; public $boxlabel = "BoxSuspenseAccount"; public $depends = array("accounting"); diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php index f8788d09ba4..49c01ed7569 100644 --- a/htdocs/core/modules/modAccounting.class.php +++ b/htdocs/core/modules/modAccounting.class.php @@ -39,8 +39,6 @@ class modAccounting extends DolibarrModules */ public function __construct($db) { - global $conf; - $this->db = $db; $this->numero = 50400; diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index d8b67a715cd..624868be06c 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -199,7 +199,7 @@ ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT=Account (from the Chart Of Account) to b ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT=Account (from the Chart Of Account) to be used as the default account to register customer deposit UseAuxiliaryAccountOnCustomerDeposit=Store customer account as individual account in subsidiary ledger for lines of down payments (if disabled, individual account for down payment lines will remain empty) -ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT=Account (from the Chart Of Account) to be used as the default +ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT=Account (from the Chart Of Account) to be used as the default UseAuxiliaryAccountOnSupplierDeposit=Store supplier account as individual account in subsidiary ledger for lines of down payments (if disabled, individual account for down payment lines will remain empty) ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY=Accounting account by default to register customer retained warranty @@ -329,7 +329,7 @@ WarningRecordWithoutSubledgerAreExcluded=Warning, all lines without subledger ac AccountRemovedFromCurrentChartOfAccount=Accounting account that does not exist in the current chart of accounts ## Admin -BindingOptions=Binding options +BindingOptions=Options for the tool to bind lines with products ApplyMassCategories=Apply mass categories AddAccountFromBookKeepingWithNoCategories=Available account not yet in the personalized group CategoryDeleted=Category for the accounting account has been removed @@ -354,14 +354,14 @@ ACCOUNTING_DISABLE_BINDING_ON_PURCHASES=Disable binding & transfer in accountanc ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS=Disable binding & transfer in accountancy on expense reports (expense reports will not be taken into account in accounting) ACCOUNTING_ENABLE_LETTERING=Enable the lettering function in the accounting ACCOUNTING_ENABLE_LETTERING_DESC=When this options is enabled, you can define, on each accounting entry, a code so you can group different accounting movements together. In the past, when different journals was managed independently, this feature was necessary to group movement lines of different journals together. However, with Dolibarr accountancy, such a tracking code, called "<b>%s</b>" is already saved automatically, so an automatic lettering is already done, with no risk of error so this feature has become useless for a common usage. Manual lettering feature is provided for end users that really don't trust the computer engine making the transfer of data in accountancy. -EnablingThisFeatureIsNotNecessary=Enabling this feature is no more necessary for a rigorous accounting management. +EnablingThisFeatureIsNotNecessary=Enabling this feature is no more necessary for a rigorous accounting management. ACCOUNTING_ENABLE_AUTOLETTERING=Enable the automatic lettering when transferring to accounting ACCOUNTING_ENABLE_AUTOLETTERING_DESC=The code for the lettering is automatically generated and incremented and not chosen by the end user ACCOUNTING_LETTERING_NBLETTERS=Number of letters when generating lettering code (default 3) ACCOUNTING_LETTERING_NBLETTERS_DESC=Some accounting software only accepts a two-letter code. This parameter allows you to set this aspect. The default number of letters is three. OptionsAdvanced=Advanced options ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE=Activate the management of VAT reverse charge on supplier purchases -ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE_DESC=When this option is enabled, you can define that a supplier or a given vendor invoice must be transferred into accountancy differently: A additional debit and a credit line will generated into the accounting on 2 given accounts from the chart of account defined into the "%s" setup page. +ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE_DESC=When this option is enabled, you can define that a supplier or a given vendor invoice must be transferred into accountancy differently: A additional debit and a credit line will generated into the accounting on 2 given accounts from the chart of account defined into the "%s" setup page. ## Export NotExportLettering=Do not export the lettering when generating the file From 4d6bd2a8e004df59c1c43ba04692229acea040a2 Mon Sep 17 00:00:00 2001 From: Can Arslan <138895927+mc2rcanarslan@users.noreply.github.com> Date: Fri, 22 Mar 2024 14:17:39 -0600 Subject: [PATCH 095/178] FIX: PHP Warning: Undefined properties --- htdocs/comm/action/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index a7118ccffcf..dbc0b02d8bf 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -267,7 +267,7 @@ if (empty($reshook)) { $objectlabel = 'Events'; $uploaddir = true; // Only users that can delete any event can remove records. - $permissiontodelete = $user->rights->agenda->allactions->delete; + $permissiontodelete = $user->hasRight('agenda', 'allactions', 'delete'); $permissiontoadd = $user->hasRight('agenda', 'myactions', 'create'); include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } @@ -708,7 +708,7 @@ $url = DOL_URL_ROOT.'/comm/action/card.php?action=create'; $url .= '&datep='.sprintf("%04d%02d%02d", $tmpforcreatebutton['year'], $tmpforcreatebutton['mon'], $tmpforcreatebutton['mday']).$hourminsec; $url .= '&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam ? '?'.$newparam : '')); -$newcardbutton = dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', $url, '', $user->rights->agenda->myactions->create || $user->hasRight('agenda', 'allactions', 'create')); +$newcardbutton = dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', $url, '', $user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create')); $param .= '&mode='.$mode; From c22dce308b63b2fdb68ce618b7a7c40ddca9f5c9 Mon Sep 17 00:00:00 2001 From: Jon Bendtsen <xcodeauthor@jonb.dk> Date: Fri, 22 Mar 2024 22:41:00 +0100 Subject: [PATCH 096/178] allow user to self edit their bank account details + allowing a user administrator edit bank account details --- htdocs/user/bank.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php index ff445c5cf85..ec3c2d2e426 100644 --- a/htdocs/user/bank.php +++ b/htdocs/user/bank.php @@ -87,7 +87,7 @@ if (empty($account->userid)) { // Define value to know what current user can do on users $canadduser = (!empty($user->admin) || $user->hasRight('user', 'user', 'creer') || $user->rights->hrm->write_personal_information->write); $canreaduser = (!empty($user->admin) || $user->rights->user->user->lire || $user->rights->hrm->read_personal_information->read); -$permissiontoaddbankaccount = ($user->hasRight('salaries', 'write') || $user->hasRight('hrm', 'employee', 'write') || $user->hasRight('user', 'creer')); +$permissiontoaddbankaccount = ($user->hasRight('salaries', 'write') || $user->hasRight('hrm', 'employee', 'write') || $user->hasRight('user', 'user', 'creer') || $user->hasRight('user', 'self', 'creer')); $permissiontoreadhr = $user->hasRight('hrm', 'read_personal_information', 'read') || $user->hasRight('hrm', 'write_personal_information', 'write'); $permissiontowritehr = $user->hasRight('hrm', 'write_personal_information', 'write'); From 4489187edd6368d87b38b16d8a46249e44d95b2f Mon Sep 17 00:00:00 2001 From: Jon Bendtsen <xcodeauthor@jonb.dk> Date: Fri, 22 Mar 2024 23:13:12 +0100 Subject: [PATCH 097/178] create and edit actions uses permissiontoaddbankaccount variable --- htdocs/user/bank.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php index ec3c2d2e426..a42790ea222 100644 --- a/htdocs/user/bank.php +++ b/htdocs/user/bank.php @@ -282,7 +282,7 @@ llxHeader('', $title, $help_url); $head = user_prepare_head($object); -if ($id && $bankid && $action == 'edit' && ($user->hasRight('user', 'user', 'creer') || $user->hasRight('hrm', 'write_personal_information', 'write'))) { +if ($id && $bankid && $action == 'edit' && !$cancel && $permissiontoaddbankaccount)) { if ($conf->use_javascript_ajax) { print "\n<script>"; print 'jQuery(document).ready(function () { @@ -303,7 +303,7 @@ if ($id && $bankid && $action == 'edit' && ($user->hasRight('user', 'user', 'cre print '<input type="hidden" name="id" value="'.GETPOSTINT("id").'">'; print '<input type="hidden" name="bankid" value="'.$bankid.'">'; } -if ($id && $action == 'create' && $user->hasRight('user', 'user', 'creer')) { +if ($id && $action == 'create' && !$cancel && $permissiontoaddbankaccount)) { if ($conf->use_javascript_ajax) { print "\n<script>"; print 'jQuery(document).ready(function () { From 8f4d7d6336049dec007097b7b5f44c6cdafadd59 Mon Sep 17 00:00:00 2001 From: Jon Bendtsen <xcodeauthor@jonb.dk> Date: Fri, 22 Mar 2024 23:16:11 +0100 Subject: [PATCH 098/178] updating to new user->hasRight method --- htdocs/user/bank.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php index a42790ea222..46391d061c0 100644 --- a/htdocs/user/bank.php +++ b/htdocs/user/bank.php @@ -85,8 +85,8 @@ if (empty($account->userid)) { } // Define value to know what current user can do on users -$canadduser = (!empty($user->admin) || $user->hasRight('user', 'user', 'creer') || $user->rights->hrm->write_personal_information->write); -$canreaduser = (!empty($user->admin) || $user->rights->user->user->lire || $user->rights->hrm->read_personal_information->read); +$canadduser = (!empty($user->admin) || $user->hasRight('user', 'user', 'creer') || $user->hasRight('hrm', 'write_personal_information', 'write') ); +$canreaduser = (!empty($user->admin) || $user->hasRight('user', 'user', 'lire') || $user->hasRight('hrm', 'read_personal_information', 'read') ); $permissiontoaddbankaccount = ($user->hasRight('salaries', 'write') || $user->hasRight('hrm', 'employee', 'write') || $user->hasRight('user', 'user', 'creer') || $user->hasRight('user', 'self', 'creer')); $permissiontoreadhr = $user->hasRight('hrm', 'read_personal_information', 'read') || $user->hasRight('hrm', 'write_personal_information', 'write'); $permissiontowritehr = $user->hasRight('hrm', 'write_personal_information', 'write'); From e739c0d0923a33d5096db15b83e8ae2878d0685a Mon Sep 17 00:00:00 2001 From: Jon Bendtsen <xcodeauthor@jonb.dk> Date: Fri, 22 Mar 2024 23:18:19 +0100 Subject: [PATCH 099/178] too many ) --- htdocs/user/bank.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php index 46391d061c0..9e3af3968c0 100644 --- a/htdocs/user/bank.php +++ b/htdocs/user/bank.php @@ -282,7 +282,7 @@ llxHeader('', $title, $help_url); $head = user_prepare_head($object); -if ($id && $bankid && $action == 'edit' && !$cancel && $permissiontoaddbankaccount)) { +if ($id && $bankid && $action == 'edit' && !$cancel && $permissiontoaddbankaccount) { if ($conf->use_javascript_ajax) { print "\n<script>"; print 'jQuery(document).ready(function () { @@ -303,7 +303,7 @@ if ($id && $bankid && $action == 'edit' && !$cancel && $permissiontoaddbankaccou print '<input type="hidden" name="id" value="'.GETPOSTINT("id").'">'; print '<input type="hidden" name="bankid" value="'.$bankid.'">'; } -if ($id && $action == 'create' && !$cancel && $permissiontoaddbankaccount)) { +if ($id && $action == 'create' && !$cancel && $permissiontoaddbankaccount) { if ($conf->use_javascript_ajax) { print "\n<script>"; print 'jQuery(document).ready(function () { From f5e2444a2cca2a5a22475564b8629d9b079311ef Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Sat, 23 Mar 2024 00:02:52 +0100 Subject: [PATCH 100/178] Add typing for cols, phpmin --- htdocs/core/class/commondocgenerator.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index ab8c695c143..d8784d559e8 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -147,18 +147,18 @@ abstract class CommonDocGenerator public $emetteur; /** - * @var array Minimum version of PHP required by module. + * @var array{0:int,1:int} Minimum version of PHP required by module. * e.g.: PHP ≥ 7.1 = array(7, 1) */ public $phpmin = array(7, 1); /** - * @var array Array of columns + * @var array<string,array{rank:int,width:float|int,title:array{textkey:string,label:string,align:string,padding:array{0:float,1:float,2:float,3:float}},content:array{align:string,padding:array{0:float,1:float,2:float,3:float}}}> Array of columns */ public $cols; /** - * @var array Array with result of doc generation. content is array('fullpath'=>$file) + * @var array{fullpath:string} Array with result of doc generation. content is array('fullpath'=>$file) */ public $result; @@ -856,7 +856,7 @@ abstract class CommonDocGenerator include_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; $object->list_delivery_methods($object->shipping_method_id); - $calculatedVolume = ($object->trueWidth * $object->trueHeight * $object->trueDepth); + $calculatedVolume = ((float) $object->trueWidth * (float) $object->trueHeight * $object->trueDepth); $array_shipment = array( $array_key.'_id' => $object->id, From 360753ed04c181fd750a37831648ec93b5aa4ff9 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Sat, 23 Mar 2024 01:11:24 +0100 Subject: [PATCH 101/178] Fix PhanTypeInvalid{Left,Right}OperandOfNumericOp mostly by typing, casting, idate --- htdocs/adherents/index.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php index baa8560b9c6..214060ad2d2 100644 --- a/htdocs/adherents/index.php +++ b/htdocs/adherents/index.php @@ -6,6 +6,7 @@ * Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com> * Copyright (C) 2021-2023 Frédéric France <frederic.france@netlgic.fr> * Copyright (C) 2021-2023 Waël Almoman <info@almoman.com> + * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -90,13 +91,13 @@ print load_fiche_titre($langs->trans("MembersArea"), $resultboxes['selectboxlist $boxgraph = ''; if ($conf->use_javascript_ajax) { - $year = date('Y'); + $year = idate('Y'); $numberyears = getDolGlobalInt("MAIN_NB_OF_YEAR_IN_MEMBERSHIP_WIDGET_GRAPH"); - $boxgraph .='<div class="div-table-responsive-no-min">'; - $boxgraph .='<table class="noborder nohover centpercent">'; - $boxgraph .='<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").($numberyears ? ' ('.($year-$numberyears).' - '.$year.')' : '').'</th></tr>'; - $boxgraph .='<tr><td class="center" colspan="2">'; + $boxgraph .= '<div class="div-table-responsive-no-min">'; + $boxgraph .= '<table class="noborder nohover centpercent">'; + $boxgraph .= '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").($numberyears ? ' ('.($year - $numberyears).' - '.$year.')' : '').'</th></tr>'; + $boxgraph .= '<tr><td class="center" colspan="2">'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherentstats.class.php'; $stats = new AdherentStats($db, 0, $userid); @@ -133,7 +134,7 @@ if ($conf->use_javascript_ajax) { $dolgraph->SetType(array('pie')); $dolgraph->setHeight('200'); $dolgraph->draw('idgraphstatus'); - $boxgraph .=$dolgraph->show($total ? 0 : 1); + $boxgraph .= $dolgraph->show($total ? 0 : 1); $boxgraph .= '</td></tr>'; $boxgraph .= '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td class="right">'; From 1c429c285af4976652eb924ddd10c7a40cac7287 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Sat, 23 Mar 2024 01:11:27 +0100 Subject: [PATCH 102/178] Fix PhanTypeInvalid{Left,Right}OperandOfNumericOp mostly by typing, casting, idate --- htdocs/adherents/stats/byproperties.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/adherents/stats/byproperties.php b/htdocs/adherents/stats/byproperties.php index 43875336810..f7d530f0f62 100644 --- a/htdocs/adherents/stats/byproperties.php +++ b/htdocs/adherents/stats/byproperties.php @@ -1,5 +1,6 @@ <?php /* Copyright (c) 2012 Laurent Destailleur <eldy@users.sourceforge.net> + * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com> * * 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 @@ -40,7 +41,7 @@ if ($user->socid > 0) { } $result = restrictedArea($user, 'adherent', '', '', 'cotisation'); -$year = dol_print_date(dol_now('gmt'), "%Y", 'gmt'); +$year = (int) dol_print_date(dol_now('gmt'), "%Y", 'gmt'); $startyear = $year - (!getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS')))); $endyear = $year; @@ -90,7 +91,7 @@ if ($resql) { $foundmor++; } - $data[$obj->code] = array('label'=>$obj->code, 'nb'=>$obj->nb, 'nbsubscriptions'=>$obj->nbsubscriptions, 'lastdate'=>$db->jdate($obj->lastdate), 'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)); + $data[$obj->code] = array('label' => $obj->code, 'nb' => $obj->nb, 'nbsubscriptions' => $obj->nbsubscriptions, 'lastdate' => $db->jdate($obj->lastdate), 'lastsubscriptiondate' => $db->jdate($obj->lastsubscriptiondate)); $i++; } @@ -162,10 +163,10 @@ print '<td class="center">'.$langs->trans("LatestSubscriptionDate").'</td>'; print '</tr>'; if (!$foundphy) { - $data[] = array('label'=>'phy', 'nb'=>'0', 'nbactive'=>'0', 'lastdate'=>'', 'lastsubscriptiondate'=>''); + $data[] = array('label' => 'phy', 'nb' => '0', 'nbactive' => '0', 'lastdate' => '', 'lastsubscriptiondate' => ''); } if (!$foundmor) { - $data[] = array('label'=>'mor', 'nb'=>'0', 'nbactive'=>'0', 'lastdate'=>'', 'lastsubscriptiondate'=>''); + $data[] = array('label' => 'mor', 'nb' => '0', 'nbactive' => '0', 'lastdate' => '', 'lastsubscriptiondate' => ''); } foreach ($data as $val) { From 5164b5af2ce78e69fed752e2871b9a95a09b05a2 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Sat, 23 Mar 2024 01:11:30 +0100 Subject: [PATCH 103/178] Fix PhanTypeInvalid{Left,Right}OperandOfNumericOp mostly by typing, casting, idate --- htdocs/adherents/stats/geo.php | 51 +++++++++++++++++----------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/htdocs/adherents/stats/geo.php b/htdocs/adherents/stats/geo.php index 443249a525b..b9d09f6f683 100644 --- a/htdocs/adherents/stats/geo.php +++ b/htdocs/adherents/stats/geo.php @@ -1,5 +1,6 @@ <?php /* Copyright (c) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> + * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com> * * 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 @@ -42,7 +43,7 @@ if ($user->socid > 0) { } $result = restrictedArea($user, 'adherent', '', '', 'cotisation'); -$year = dol_print_date(dol_now('gmt'), "%Y", 'gmt'); +$year = (int) dol_print_date(dol_now('gmt'), "%Y", 'gmt'); $startyear = $year - (!getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS')))); $endyear = $year; @@ -162,40 +163,40 @@ if ($mode) { while ($i < $num) { $obj = $db->fetch_object($resql); if ($mode == 'memberbycountry') { - $data[] = array('label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? img_picto('', DOL_URL_ROOT.'/theme/common/flags/'.strtolower($obj->code).'.png', '', 1).' '.$langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>')), - 'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>')), - 'code'=>$obj->code, - 'nb'=>$obj->nb, - 'lastdate'=>$db->jdate($obj->lastdate), - 'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate) + $data[] = array('label' => (($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? img_picto('', DOL_URL_ROOT.'/theme/common/flags/'.strtolower($obj->code).'.png', '', 1).' '.$langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>')), + 'label_en' => (($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>')), + 'code' => $obj->code, + 'nb' => $obj->nb, + 'lastdate' => $db->jdate($obj->lastdate), + 'lastsubscriptiondate' => $db->jdate($obj->lastsubscriptiondate) ); } if ($mode == 'memberbyregion') { //+ $data[] = array( - 'label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? img_picto('', DOL_URL_ROOT.'/theme/common/flags/'.strtolower($obj->code).'.png', '', 1).' '.$langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>')), - 'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>')), - 'label2'=>($obj->label2 ? $obj->label2 : '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>'), - 'nb'=>$obj->nb, - 'lastdate'=>$db->jdate($obj->lastdate), - 'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate) + 'label' => (($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? img_picto('', DOL_URL_ROOT.'/theme/common/flags/'.strtolower($obj->code).'.png', '', 1).' '.$langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>')), + 'label_en' => (($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>')), + 'label2' => ($obj->label2 ? $obj->label2 : '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>'), + 'nb' => $obj->nb, + 'lastdate' => $db->jdate($obj->lastdate), + 'lastsubscriptiondate' => $db->jdate($obj->lastsubscriptiondate) ); } if ($mode == 'memberbystate') { - $data[] = array('label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? img_picto('', DOL_URL_ROOT.'/theme/common/flags/'.strtolower($obj->code).'.png', '', 1).' '.$langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>')), - 'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>')), - 'label2'=>($obj->label2 ? $obj->label2 : '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>'), - 'nb'=>$obj->nb, - 'lastdate'=>$db->jdate($obj->lastdate), - 'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate) + $data[] = array('label' => (($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? img_picto('', DOL_URL_ROOT.'/theme/common/flags/'.strtolower($obj->code).'.png', '', 1).' '.$langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>')), + 'label_en' => (($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>')), + 'label2' => ($obj->label2 ? $obj->label2 : '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>'), + 'nb' => $obj->nb, + 'lastdate' => $db->jdate($obj->lastdate), + 'lastsubscriptiondate' => $db->jdate($obj->lastsubscriptiondate) ); } if ($mode == 'memberbytown') { - $data[] = array('label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? img_picto('', DOL_URL_ROOT.'/theme/common/flags/'.strtolower($obj->code).'.png', '', 1).' '.$langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>')), - 'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>')), - 'label2'=>($obj->label2 ? $obj->label2 : '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>'), - 'nb'=>$obj->nb, - 'lastdate'=>$db->jdate($obj->lastdate), - 'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate) + $data[] = array('label' => (($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? img_picto('', DOL_URL_ROOT.'/theme/common/flags/'.strtolower($obj->code).'.png', '', 1).' '.$langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>')), + 'label_en' => (($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>')), + 'label2' => ($obj->label2 ? $obj->label2 : '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>'), + 'nb' => $obj->nb, + 'lastdate' => $db->jdate($obj->lastdate), + 'lastsubscriptiondate' => $db->jdate($obj->lastsubscriptiondate) ); } From 34a541d7deb3064a34e1edd6bc2bdb7cff6cf529 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Sat, 23 Mar 2024 01:11:32 +0100 Subject: [PATCH 104/178] Fix PhanTypeInvalid{Left,Right}OperandOfNumericOp mostly by typing, casting, idate --- htdocs/adherents/stats/index.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/adherents/stats/index.php b/htdocs/adherents/stats/index.php index 0672b5f90c0..17488f72508 100644 --- a/htdocs/adherents/stats/index.php +++ b/htdocs/adherents/stats/index.php @@ -2,6 +2,7 @@ /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com> + * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com> * * 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 @@ -49,7 +50,7 @@ if ($user->socid > 0) { } $result = restrictedArea($user, 'adherent', '', '', 'cotisation'); -$year = dol_print_date(dol_now('gmt'), "%Y", 'gmt'); +$year = (int) dol_print_date(dol_now('gmt'), "%Y", 'gmt'); $startyear = $year - (!getDolGlobalInt('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, getDolGlobalInt('MAIN_STATS_GRAPHS_SHOW_N_YEARS')))); $endyear = $year; if (getDolGlobalString('MEMBER_SUBSCRIPTION_START_AFTER')) { From 139451f2f1e7978de231046e8cb7d65a76b2a819 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Sat, 23 Mar 2024 01:11:34 +0100 Subject: [PATCH 105/178] Fix PhanTypeInvalid{Left,Right}OperandOfNumericOp mostly by typing, casting, idate --- htdocs/admin/limits.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/admin/limits.php b/htdocs/admin/limits.php index a4911e94e52..c3a08c3612f 100644 --- a/htdocs/admin/limits.php +++ b/htdocs/admin/limits.php @@ -3,6 +3,7 @@ * Copyright (C) 2009-2018 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2023 Alexandre Spangaro <aspangaro@open-dsi.fr> + * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com> * * 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 @@ -80,7 +81,7 @@ if ($action == 'update' && !$cancel) { } if ($valmainroundingruletot) { - if ($valmainroundingruletot * pow(10, $valmainmaxdecimalstot) < 1) { + if ((float) $valmainroundingruletot * pow(10, $valmainmaxdecimalstot) < 1) { $langs->load("errors"); $error++; setEventMessages($langs->trans("ErrorMAIN_ROUNDING_RULE_TOTCanMAIN_MAX_DECIMALS_TOT"), null, 'errors'); @@ -239,7 +240,7 @@ if (empty($mysoc->country_code)) { $s = 2 / 3; $qty = 1; $vat = 0; - $tmparray = calcul_price_total(1, $qty * price2num($s, 'MU'), 0, $vat, 0, 0, 0, 'HT', 0, 0, $mysoc); + $tmparray = calcul_price_total(1, $qty * (float) price2num($s, 'MU'), 0, $vat, 0, 0, 0, 'HT', 0, 0, $mysoc); print '<span class="opacitymedium">'.$langs->trans("UnitPriceOfProduct").":</span> ".price2num($s, 'MU'); print ' x <span class="opacitymedium">'.$langs->trans("Quantity").":</span> ".$qty; print ' - <span class="opacitymedium">'.$langs->trans("VAT").":</span> ".$vat.'%'; @@ -248,7 +249,7 @@ if (empty($mysoc->country_code)) { $s = 10 / 3; $qty = 1; $vat = 0; - $tmparray = calcul_price_total(1, $qty * price2num($s, 'MU'), 0, $vat, 0, 0, 0, 'HT', 0, 0, $mysoc); + $tmparray = calcul_price_total(1, $qty * (float) price2num($s, 'MU'), 0, $vat, 0, 0, 0, 'HT', 0, 0, $mysoc); print '<span class="opacitymedium">'.$langs->trans("UnitPriceOfProduct").":</span> ".price2num($s, 'MU'); print ' x <span class="opacitymedium">'.$langs->trans("Quantity").":</span> ".$qty; print ' - <span class="opacitymedium">'.$langs->trans("VAT").":</span> ".$vat.'%'; @@ -257,7 +258,7 @@ if (empty($mysoc->country_code)) { $s = 10 / 3; $qty = 2; $vat = 0; - $tmparray = calcul_price_total(1, $qty * price2num($s, 'MU'), 0, $vat, 0, 0, 0, 'HT', 0, 0, $mysoc); + $tmparray = calcul_price_total(1, $qty * (float) price2num($s, 'MU'), 0, $vat, 0, 0, 0, 'HT', 0, 0, $mysoc); print '<span class="opacitymedium">'.$langs->trans("UnitPriceOfProduct").":</span> ".price2num($s, 'MU'); print ' x <span class="opacitymedium">'.$langs->trans("Quantity").":</span> ".$qty; print ' - <span class="opacitymedium">'.$langs->trans("VAT").":</span> ".$vat.'%'; @@ -277,7 +278,7 @@ if (empty($mysoc->country_code)) { if ($num) { for ($i = 0; $i < $num; $i++) { $obj = $db->fetch_object($resql); - $vat_rates[] = array('vat_rate'=>$obj->vat_rate, 'code'=>$obj->vat_code, 'localtax_rate1'=>$obj->localtax_rate1, 'locltax_rate2'=>$obj->localtax_rate2); + $vat_rates[] = array('vat_rate' => $obj->vat_rate, 'code' => $obj->vat_code, 'localtax_rate1' => $obj->localtax_rate1, 'locltax_rate2' => $obj->localtax_rate2); } } } else { From 0732c4301ea15d2d40cabf3cc0c03439f37a2229 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Sat, 23 Mar 2024 01:11:37 +0100 Subject: [PATCH 106/178] Fix PhanTypeInvalid{Left,Right}OperandOfNumericOp mostly by typing, casting, idate --- htdocs/bom/tpl/objectline_view.tpl.php | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php index 38da2d0077c..cf6ca335125 100644 --- a/htdocs/bom/tpl/objectline_view.tpl.php +++ b/htdocs/bom/tpl/objectline_view.tpl.php @@ -6,6 +6,7 @@ * Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2017 Juanjo Menent <jmenent@2byte.es> + * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -34,7 +35,14 @@ * $type, $text, $description, $line */ -/** var ObjectLine $line */ +/** + * @var CommonObjectLine $line + * @var int $num + */ +'@phan-var-force CommonObjectLine $line + @phan-var-force int $num + @phan-var-force CommonObject $this + @phan-var-force CommonObject $object'; require_once DOL_DOCUMENT_ROOT.'/workstation/class/workstation.class.php'; @@ -44,8 +52,6 @@ if (empty($object) || !is_object($object)) { exit(1); } -'@phan-var-force CommonObject $this - @phan-var-force CommonObject $object'; global $filtertype; if (empty($filtertype)) { @@ -249,7 +255,7 @@ print '</tr>'; // Select of all the sub-BOM lines // From this point to the end of the file, we only take care of sub-BOM lines $sql = 'SELECT rowid, fk_bom_child, fk_product, qty FROM '.MAIN_DB_PREFIX.'bom_bomline AS bl'; -$sql.= ' WHERE fk_bom ='. (int) $tmpbom->id; +$sql .= ' WHERE fk_bom ='. (int) $tmpbom->id; $resql = $object->db->query($sql); if ($resql) { @@ -323,7 +329,7 @@ if ($resql) { if (!empty($sub_bom->id)) { $sub_bom->calculateCosts(); print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'"><span class="amount">'.price(price2num($sub_bom->total_cost * $sub_bom_line->qty * $line->qty, 'MT')).'</span></td>'; - $total_cost+= $sub_bom->total_cost * $sub_bom_line->qty * $line->qty; + $total_cost += $sub_bom->total_cost * $sub_bom_line->qty * $line->qty; } elseif ($sub_bom_product->type == Product::TYPE_SERVICE && isModEnabled('workstation') && !empty($sub_bom_product->fk_default_workstation)) { //Convert qty to hour $unit = measuringUnitString($sub_bom_line->fk_unit, '', '', 1); @@ -339,24 +345,24 @@ if ($resql) { } elseif ($sub_bom_product->cost_price > 0) { print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'">'; print '<span class="amount">'.price(price2num($sub_bom_product->cost_price * $sub_bom_line->qty * $line->qty, 'MT')).'</span></td>'; - $total_cost+= $sub_bom_product->cost_price * $sub_bom_line->qty * $line->qty; + $total_cost += $sub_bom_product->cost_price * $sub_bom_line->qty * $line->qty; } elseif ($sub_bom_product->pmp > 0) { // PMP if cost price isn't defined print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'">'; print '<span class="amount">'.price(price2num($sub_bom_product->pmp * $sub_bom_line->qty * $line->qty, 'MT')).'</span></td>'; - $total_cost.= $sub_bom_product->pmp * $sub_bom_line->qty * $line->qty; + $total_cost .= $sub_bom_product->pmp * $sub_bom_line->qty * $line->qty; } else { // Minimum purchase price if cost price and PMP aren't defined $sql_supplier_price = 'SELECT MIN(price) AS min_price, quantity AS qty FROM '.MAIN_DB_PREFIX.'product_fournisseur_price'; - $sql_supplier_price.= ' WHERE fk_product = '. (int) $sub_bom_product->id; + $sql_supplier_price .= ' WHERE fk_product = '. (int) $sub_bom_product->id; $resql_supplier_price = $object->db->query($sql_supplier_price); if ($resql_supplier_price) { $obj = $object->db->fetch_object($resql_supplier_price); if (!empty($obj->qty) && !empty($sub_bom_line->qty) && !empty($line->qty)) { - $line_cost = $obj->min_price/$obj->qty * $sub_bom_line->qty * $line->qty; + $line_cost = $obj->min_price / $obj->qty * $sub_bom_line->qty * $line->qty; } else { $line_cost = $obj->min_price; } print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'"><span class="amount">'.price2num($line_cost, 'MT').'</span></td>'; - $total_cost+= $line_cost; + $total_cost += $line_cost; } } From 1fee38e1d0087e02e3fc1a55845b2dc14529a322 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Sat, 23 Mar 2024 01:11:41 +0100 Subject: [PATCH 107/178] Fix PhanTypeInvalid{Left,Right}OperandOfNumericOp mostly by typing, casting, idate --- htdocs/comm/mailing/list.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/htdocs/comm/mailing/list.php b/htdocs/comm/mailing/list.php index 42673dea754..652f771cb4e 100644 --- a/htdocs/comm/mailing/list.php +++ b/htdocs/comm/mailing/list.php @@ -1,6 +1,7 @@ <?php /* Copyright (C) 2005-2023 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2010 Regis Houssin <regis.houssin@inodbox.com> + * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com> * * 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 @@ -45,7 +46,7 @@ $mode = GETPOST('mode', 'aZ'); // The output mode ('list', 'kanban', 'hier $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); -$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOSTINT("page"); +$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page"); if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // If $page is not defined, or '' or -1 or if we click on clear filters $page = 0; @@ -80,7 +81,7 @@ if (!$sortfield) { // List of fields to search into when doing a "search in all" $fieldstosearchall = array( - 'm.titre'=>'Ref', + 'm.titre' => 'Ref', ); $permissiontoread = $user->hasRight('mailing', 'lire'); @@ -370,7 +371,7 @@ if (empty($reshook)) { if (!empty($moreforfilter)) { print '<div class="liste_titre liste_titre_bydiv centpercent">'; print $moreforfilter; - $parameters = array('type'=>$type); + $parameters = array('type' => $type); $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; print '</div>'; @@ -415,7 +416,7 @@ print '<td class="liste_titre"> </td>'; // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; // Fields from hook -$parameters = array('arrayfields'=>$arrayfields); +$parameters = array('arrayfields' => $arrayfields); $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column @@ -466,7 +467,7 @@ if (!$filteremail) { // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields -$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray); +$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'totalarray' => &$totalarray); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; print_liste_field_titre("Status", $_SERVER["PHP_SELF"], ($filteremail ? "mc.statut" : "m.statut"), $param, "", '', $sortfield, $sortorder, 'center '); @@ -603,7 +604,7 @@ if (empty($num)) { $db->free($resql); -$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); +$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql); $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; From 6b0e99be286670ce5cb491645b8446fa86501f29 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Sat, 23 Mar 2024 01:11:44 +0100 Subject: [PATCH 108/178] Fix PhanTypeInvalid{Left,Right}OperandOfNumericOp mostly by typing, casting, idate --- htdocs/comm/propal/card.php | 40 ++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 444a2c97a66..8044e284b73 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -974,20 +974,20 @@ if (empty($reshook)) { setEventMessages($prod->ref.' - '.$prod->label.' ('.$price_subprice.' < '.$price_price_min.' '.strtolower($langs->trans("MinPrice")).')'."\n", null, 'warnings'); } // Manage $line->subprice and $line->multicurrency_subprice - $multicurrency_subprice = $subprice * $line->multicurrency_subprice / $line->subprice; + $multicurrency_subprice = (float) $subprice * $line->multicurrency_subprice / $line->subprice; // Update DB $result = $object->updateline($line->id, $subprice, $line->qty, $line->remise_percent, $line->tva_tx, $line->localtax1_rate, $line->localtax2_rate, $line->desc, 'HT', $line->info_bits, $line->special_code, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->product_type, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $multicurrency_subprice); // Update $object with new margin info $line->price = $subprice; $line->marge_tx = $margin_rate; - $line->marque_tx = $margin_rate * $line->pa_ht / $subprice; - $line->total_ht = $line->qty * $subprice; - $line->total_tva = $line->tva_tx * $line->qty * $subprice; - $line->total_ttc = (1 + $line->tva_tx) * $line->qty * $subprice; + $line->marque_tx = $margin_rate * $line->pa_ht / (float) $subprice; + $line->total_ht = $line->qty * (float) $subprice; + $line->total_tva = $line->tva_tx * $line->qty * (float) $subprice; + $line->total_ttc = (1 + $line->tva_tx) * $line->qty * (float) $subprice; // Manage $line->subprice and $line->multicurrency_subprice - $line->multicurrency_total_ht = $line->qty * $subprice * $line->multicurrency_subprice / $line->subprice; - $line->multicurrency_total_tva = $line->tva_tx * $line->qty * $subprice * $line->multicurrency_subprice / $line->subprice; - $line->multicurrency_total_ttc = (1 + $line->tva_tx) * $line->qty * $subprice * $line->multicurrency_subprice / $line->subprice; + $line->multicurrency_total_ht = $line->qty * (float) $subprice * $line->multicurrency_subprice / $line->subprice; + $line->multicurrency_total_tva = $line->tva_tx * $line->qty * (float) $subprice * $line->multicurrency_subprice / $line->subprice; + $line->multicurrency_total_ttc = (1 + $line->tva_tx) * $line->qty * (float) $subprice * $line->multicurrency_subprice / $line->subprice; // Used previous $line->subprice and $line->multicurrency_subprice above, now they can be set to their new values $line->subprice = $subprice; $line->multicurrency_subprice = $multicurrency_subprice; @@ -1206,20 +1206,20 @@ if (empty($reshook)) { // Set unit price to use if (!empty($price_ht) || (string) $price_ht === '0') { $pu_ht = price2num($price_ht, 'MU'); - $pu_ttc = price2num($pu_ht * (1 + ((float) $tmpvat / 100)), 'MU'); + $pu_ttc = price2num((float) $pu_ht * (1 + ((float) $tmpvat / 100)), 'MU'); } elseif (!empty($price_ht_devise) || (string) $price_ht_devise === '0') { $pu_ht_devise = price2num($price_ht_devise, 'MU'); $pu_ht = ''; $pu_ttc = ''; } elseif (!empty($price_ttc) || (string) $price_ttc === '0') { $pu_ttc = price2num($price_ttc, 'MU'); - $pu_ht = price2num($pu_ttc / (1 + ((float) $tmpvat / 100)), 'MU'); + $pu_ht = price2num((float) $pu_ttc / (1 + ((float) $tmpvat / 100)), 'MU'); } elseif ($tmpvat != $tmpprodvat) { // Is this still used ? if ($price_base_type != 'HT') { - $pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU'); + $pu_ht = price2num((float) $pu_ttc / (1 + ($tmpvat / 100)), 'MU'); } else { - $pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU'); + $pu_ttc = price2num((float) $pu_ht * (1 + ($tmpvat / 100)), 'MU'); } } @@ -1344,10 +1344,10 @@ if (empty($reshook)) { // Check if we have a foreign currency // If so, we update the pu_equiv as the equivalent price in base currency if ($pu_ht == '' && $pu_ht_devise != '' && $currency_tx != '') { - $pu_equivalent = $pu_ht_devise * $currency_tx; + $pu_equivalent = (float) $pu_ht_devise * (float) $currency_tx; } if ($pu_ttc == '' && $pu_ttc_devise != '' && $currency_tx != '') { - $pu_equivalent_ttc = $pu_ttc_devise * $currency_tx; + $pu_equivalent_ttc = (float) $pu_ttc_devise * (float) $currency_tx; } // TODO $pu_equivalent or $pu_equivalent_ttc must be calculated from the one not null taking into account all taxes @@ -1366,11 +1366,11 @@ if (empty($reshook)) { // Check price is not lower than minimum if ($usermustrespectpricemin) { - if ($pu_equivalent && $price_min && ((price2num($pu_equivalent) * (1 - $remise_percent / 100)) < price2num($price_min)) && $price_base_type == 'HT') { + if ($pu_equivalent && $price_min && (((float) price2num($pu_equivalent) * (1 - $remise_percent / 100)) < price2num($price_min)) && $price_base_type == 'HT') { $mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, -1, $conf->currency)); setEventMessages($mesg, null, 'errors'); $error++; - } elseif ($pu_equivalent_ttc && $price_min_ttc && ((price2num($pu_equivalent_ttc) * (1 - $remise_percent / 100)) < price2num($price_min_ttc)) && $price_base_type == 'TTC') { + } elseif ($pu_equivalent_ttc && $price_min_ttc && (((float) price2num($pu_equivalent_ttc) * (1 - $remise_percent / 100)) < price2num($price_min_ttc)) && $price_base_type == 'TTC') { $mesg = $langs->trans("CantBeLessThanMinPriceInclTax", price(price2num($price_min_ttc, 'MU'), 0, $langs, 0, 0, -1, $conf->currency)); setEventMessages($mesg, null, 'errors'); $error++; @@ -1482,10 +1482,10 @@ if (empty($reshook)) { // Check if we have a foreign currency // If so, we update the pu_equiv as the equivalent price in base currency if ($pu_ht == '' && $pu_ht_devise != '' && $currency_tx != '') { - $pu_equivalent = $pu_ht_devise * $currency_tx; + $pu_equivalent = (float) $pu_ht_devise * (float) $currency_tx; } if ($pu_ttc == '' && $pu_ttc_devise != '' && $currency_tx != '') { - $pu_equivalent_ttc = $pu_ttc_devise * $currency_tx; + $pu_equivalent_ttc = (float) $pu_ttc_devise * (float) $currency_tx; } // TODO $pu_equivalent or $pu_equivalent_ttc must be calculated from the one not null taking into account all taxes @@ -1539,12 +1539,12 @@ if (empty($reshook)) { // Check price is not lower than minimum if ($usermustrespectpricemin) { - if ($pu_equivalent && $price_min && ((price2num($pu_equivalent) * (1 - (float) $remise_percent / 100)) < price2num($price_min)) && $price_base_type == 'HT') { + if ($pu_equivalent && $price_min && (((float) price2num($pu_equivalent) * (1 - (float) $remise_percent / 100)) < (float) price2num($price_min)) && $price_base_type == 'HT') { $mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, -1, $conf->currency)); setEventMessages($mesg, null, 'errors'); $error++; $action = 'editline'; - } elseif ($pu_equivalent_ttc && $price_min_ttc && ((price2num($pu_equivalent_ttc) * (1 - (float) $remise_percent / 100)) < price2num($price_min_ttc)) && $price_base_type == 'TTC') { + } elseif ($pu_equivalent_ttc && $price_min_ttc && (((float) price2num($pu_equivalent_ttc) * (1 - (float) $remise_percent / 100)) < (float) price2num($price_min_ttc)) && $price_base_type == 'TTC') { $mesg = $langs->trans("CantBeLessThanMinPriceInclTax", price(price2num($price_min_ttc, 'MU'), 0, $langs, 0, 0, -1, $conf->currency)); setEventMessages($mesg, null, 'errors'); $error++; From c4fe7773cb099d9def36d9f70c864f4467a82678 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Sat, 23 Mar 2024 01:11:47 +0100 Subject: [PATCH 109/178] Fix PhanTypeInvalid{Left,Right}OperandOfNumericOp mostly by typing, casting, idate --- htdocs/comm/propal/class/propal.class.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 04b4a6e99b2..f7e4da009f9 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -694,9 +694,9 @@ class Propal extends CommonObject // Anciens indicateurs: $price, $remise (a ne plus utiliser) $price = $pu; $remise = 0; - if ($remise_percent > 0) { - $remise = round(($pu * $remise_percent / 100), 2); - $price = $pu - $remise; + if ((float) $remise_percent > 0) { + $remise = round(((float) $pu * (float) $remise_percent / 100), 2); + $price = (float) $pu - $remise; } // Insert line @@ -901,9 +901,9 @@ class Propal extends CommonObject // Anciens indicateurs: $price, $remise (a ne plus utiliser) $price = $pu; $remise = 0; - if ($remise_percent > 0) { - $remise = round(($pu * $remise_percent / 100), 2); - $price = $pu - $remise; + if ((float) $remise_percent > 0) { + $remise = round(((float) $pu * (float) $remise_percent / 100), 2); + $price = (float) $pu - $remise; } //Fetch current line from the database and then clone the object and set it in $oldline property From eb3ee3db442b9658444d685a20915f738fd8151a Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Sat, 23 Mar 2024 01:11:49 +0100 Subject: [PATCH 110/178] Fix PhanTypeInvalid{Left,Right}OperandOfNumericOp mostly by typing, casting, idate --- htdocs/comm/remx.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php index a357157a98a..f98eb74fcee 100644 --- a/htdocs/comm/remx.php +++ b/htdocs/comm/remx.php @@ -134,7 +134,7 @@ if ($action == 'confirm_split' && GETPOST("confirm", "alpha") == 'yes' && $permi $newdiscount1->amount_tva = price2num($newdiscount1->amount_ttc - $newdiscount1->amount_ht); $newdiscount2->amount_tva = price2num($newdiscount2->amount_ttc - $newdiscount2->amount_ht); - $newdiscount1->multicurrency_amount_ttc = $amount_ttc_1 * ($discount->multicurrency_amount_ttc / $discount->amount_ttc); + $newdiscount1->multicurrency_amount_ttc = (float) $amount_ttc_1 * ($discount->multicurrency_amount_ttc / $discount->amount_ttc); $newdiscount2->multicurrency_amount_ttc = price2num($discount->multicurrency_amount_ttc - $newdiscount1->multicurrency_amount_ttc); $newdiscount1->multicurrency_amount_ht = price2num($newdiscount1->multicurrency_amount_ttc / (1 + $newdiscount1->tva_tx / 100), 'MT'); $newdiscount2->multicurrency_amount_ht = price2num($newdiscount2->multicurrency_amount_ttc / (1 + $newdiscount2->tva_tx / 100), 'MT'); @@ -558,7 +558,7 @@ if ($socid > 0) { if (count($showconfirminfo)) { $amount1 = price2num($showconfirminfo['amount_ttc'] / 2, 'MT'); - $amount2 = ($showconfirminfo['amount_ttc'] - $amount1); + $amount2 = ($showconfirminfo['amount_ttc'] - (float) $amount1); $formquestion = array( 'text' => $langs->trans('TypeAmountOfEachNewDiscount'), 0 => array('type' => 'text', 'name' => 'amount_ttc_1', 'label' => $langs->trans("AmountTTC").' 1', 'value' => $amount1, 'size' => '5'), @@ -705,7 +705,7 @@ if ($socid > 0) { if (count($showconfirminfo)) { $amount1 = price2num($showconfirminfo['amount_ttc'] / 2, 'MT'); - $amount2 = ($showconfirminfo['amount_ttc'] - $amount1); + $amount2 = ($showconfirminfo['amount_ttc'] - (float) $amount1); $formquestion = array( 'text' => $langs->trans('TypeAmountOfEachNewDiscount'), 0 => array('type' => 'text', 'name' => 'amount_ttc_1', 'label' => $langs->trans("AmountTTC").' 1', 'value' => $amount1, 'size' => '5'), From 7762e3eb6951eefb9cf28206a6990771691dba6a Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Sat, 23 Mar 2024 01:11:52 +0100 Subject: [PATCH 111/178] Fix PhanTypeInvalid{Left,Right}OperandOfNumericOp mostly by typing, casting, idate --- htdocs/commande/card.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index eb3b5fd0fa5..46309e4168e 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -899,10 +899,10 @@ if (empty($reshook)) { // Set unit price to use if (!empty($price_ht) || $price_ht === '0') { $pu_ht = price2num($price_ht, 'MU'); - $pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU'); + $pu_ttc = price2num((float) $pu_ht * (1 + ($tmpvat / 100)), 'MU'); } elseif (!empty($price_ttc) || $price_ttc === '0') { $pu_ttc = price2num($price_ttc, 'MU'); - $pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU'); + $pu_ht = price2num((float) $pu_ttc / (1 + ($tmpvat / 100)), 'MU'); } elseif ($tmpvat != $tmpprodvat) { // Is this still used ? if ($price_base_type != 'HT') { @@ -1031,10 +1031,10 @@ if (empty($reshook)) { // Check if we have a foreign currency // If so, we update the pu_equiv as the equivalent price in base currency if ($pu_ht == '' && $pu_ht_devise != '' && $currency_tx != '') { - $pu_equivalent = $pu_ht_devise * $currency_tx; + $pu_equivalent = (float) $pu_ht_devise * (float) $currency_tx; } if ($pu_ttc == '' && $pu_ttc_devise != '' && $currency_tx != '') { - $pu_equivalent_ttc = $pu_ttc_devise * $currency_tx; + $pu_equivalent_ttc = (float) $pu_ttc_devise * (float) $currency_tx; } // TODO $pu_equivalent or $pu_equivalent_ttc must be calculated from the one defined @@ -1052,11 +1052,11 @@ if (empty($reshook)) { // Check price is not lower than minimum if ($usermustrespectpricemin) { - if ($pu_equivalent && $price_min && ((price2num($pu_equivalent) * (1 - $remise_percent / 100)) < price2num($price_min)) && $price_base_type == 'HT') { + if ($pu_equivalent && $price_min && (((float) price2num($pu_equivalent) * (1 - $remise_percent / 100)) < (float) price2num($price_min)) && $price_base_type == 'HT') { $mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, -1, $conf->currency)); setEventMessages($mesg, null, 'errors'); $error++; - } elseif ($pu_equivalent_ttc && $price_min_ttc && ((price2num($pu_equivalent_ttc) * (1 - $remise_percent / 100)) < price2num($price_min_ttc)) && $price_base_type == 'TTC') { + } elseif ($pu_equivalent_ttc && $price_min_ttc && (((float) price2num($pu_equivalent_ttc) * (1 - $remise_percent / 100)) < (float) price2num($price_min_ttc)) && $price_base_type == 'TTC') { $mesg = $langs->trans("CantBeLessThanMinPriceInclTax", price(price2num($price_min_ttc, 'MU'), 0, $langs, 0, 0, -1, $conf->currency)); setEventMessages($mesg, null, 'errors'); $error++; @@ -1161,10 +1161,10 @@ if (empty($reshook)) { // Check if we have a foreign currency // If so, we update the pu_equiv as the equivalent price in base currency if ($pu_ht == '' && $pu_ht_devise != '' && $currency_tx != '') { - $pu_equivalent = $pu_ht_devise * $currency_tx; + $pu_equivalent = (float) $pu_ht_devise * (float) $currency_tx; } if ($pu_ttc == '' && $pu_ttc_devise != '' && $currency_tx != '') { - $pu_equivalent_ttc = $pu_ttc_devise * $currency_tx; + $pu_equivalent_ttc = (float) $pu_ttc_devise * (float) $currency_tx; } // TODO $pu_equivalent or $pu_equivalent_ttc must be calculated from the one not null taking into account all taxes @@ -1221,12 +1221,12 @@ if (empty($reshook)) { // Check price is not lower than minimum if ($usermustrespectpricemin) { - if ($pu_equivalent && $price_min && ((price2num($pu_equivalent) * (1 - $remise_percent / 100)) < price2num($price_min)) && $price_base_type == 'HT') { + if ($pu_equivalent && $price_min && (((float) price2num($pu_equivalent) * (1 - $remise_percent / 100)) < (float) price2num($price_min)) && $price_base_type == 'HT') { $mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, -1, $conf->currency)); setEventMessages($mesg, null, 'errors'); $error++; $action = 'editline'; - } elseif ($pu_equivalent_ttc && $price_min_ttc && ((price2num($pu_equivalent_ttc) * (1 - $remise_percent / 100)) < price2num($price_min_ttc)) && $price_base_type == 'TTC') { + } elseif ($pu_equivalent_ttc && $price_min_ttc && (((float) price2num($pu_equivalent_ttc) * (1 - $remise_percent / 100)) < (float) price2num($price_min_ttc)) && $price_base_type == 'TTC') { $mesg = $langs->trans("CantBeLessThanMinPriceInclTax", price(price2num($price_min_ttc, 'MU'), 0, $langs, 0, 0, -1, $conf->currency)); setEventMessages($mesg, null, 'errors'); $error++; From c822795cc14238765475ea2f5e95c3950f11d1fb Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Sat, 23 Mar 2024 01:11:55 +0100 Subject: [PATCH 112/178] Fix PhanTypeInvalid{Left,Right}OperandOfNumericOp mostly by typing, casting, idate --- htdocs/commande/class/commande.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 291ead61cd3..d2ee2bb3079 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1634,8 +1634,8 @@ class Commande extends CommonOrder $price = $pu; $remise = 0; if ($remise_percent > 0) { - $remise = round(($pu * $remise_percent / 100), 2); - $price = $pu - $remise; + $remise = round(((float) $pu * $remise_percent / 100), 2); + $price = (float) $pu - $remise; } // Insert line @@ -3187,8 +3187,8 @@ class Commande extends CommonOrder } $remise = 0; if ($remise_percent > 0) { - $remise = round(($pu * $remise_percent / 100), 2); - $price = ($pu - $remise); + $remise = round(((float) $pu * $remise_percent / 100), 2); + $price = ((float) $pu - $remise); } //Fetch current line from the database and then clone the object and set it in $oldline property From 76cf8ebe065f20be39f4ff9294b67f16abfa4bc5 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Sat, 23 Mar 2024 01:11:57 +0100 Subject: [PATCH 113/178] Fix PhanTypeInvalid{Left,Right}OperandOfNumericOp mostly by typing, casting, idate --- htdocs/compta/ajaxpayment.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/ajaxpayment.php b/htdocs/compta/ajaxpayment.php index 7a593ad368d..849e13a5ed8 100644 --- a/htdocs/compta/ajaxpayment.php +++ b/htdocs/compta/ajaxpayment.php @@ -1,5 +1,6 @@ <?php /* Copyright (C) 2011 Auguria <anthony.poiret@auguria.net> + * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -69,7 +70,7 @@ if (is_array($amounts)) { if (is_array($remains)) { foreach ($remains as $key => $value) { $value = price2num($value); - $remains[$key] = (($invoice_type) == 2 ? -1 : 1) * $value; + $remains[$key] = ($invoice_type == 2 ? -1 : 1) * (float) $value; if (empty($value)) { unset($remains[$key]); } @@ -81,7 +82,7 @@ if (is_array($remains)) { } // Treatment -$result = ($amountPayment != '') ? ($amountPayment - array_sum($amounts)) : array_sum($amounts); // Remaining amountPayment +$result = ($amountPayment != '') ? ((float) $amountPayment - array_sum($amounts)) : array_sum($amounts); // Remaining amountPayment $toJsonArray = array(); $totalRemaining = price2num(array_sum($remains)); $toJsonArray['label'] = $amountPayment == '' ? '' : $langs->transnoentities('RemainingAmountPayment'); From 94808e7cddd23180da4c0c0fe079886348b5d47b Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Sat, 23 Mar 2024 01:11:59 +0100 Subject: [PATCH 114/178] Fix PhanTypeInvalid{Left,Right}OperandOfNumericOp mostly by typing, casting, idate --- htdocs/compta/bank/class/api_bankaccounts.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/bank/class/api_bankaccounts.class.php b/htdocs/compta/bank/class/api_bankaccounts.class.php index bc973b0045b..a05b8dfd965 100644 --- a/htdocs/compta/bank/class/api_bankaccounts.class.php +++ b/htdocs/compta/bank/class/api_bankaccounts.class.php @@ -1,6 +1,7 @@ <?php /* * Copyright (C) 2016 Xebax Christy <xebax@wanadoo.fr> + * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com> * * 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 @@ -265,7 +266,7 @@ class BankAccounts extends DolibarrApi */ if (!$error) { - $bank_line_id_from = $accountfrom->addline($date, $typefrom, $description, -1 * price2num($amount), '', '', $user, $cheque_number); + $bank_line_id_from = $accountfrom->addline($date, $typefrom, $description, -1 * (float) price2num($amount), '', '', $user, $cheque_number); } if (!($bank_line_id_from > 0)) { $error++; From c6bc7eac882e3180326dc9b6ccdaec9c03a1a361 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Sat, 23 Mar 2024 01:12:01 +0100 Subject: [PATCH 115/178] Fix PhanTypeInvalid{Left,Right}OperandOfNumericOp mostly by typing, casting, idate --- htdocs/compta/bank/transfer.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/bank/transfer.php b/htdocs/compta/bank/transfer.php index 1ecfab6693c..f0aef136fd4 100644 --- a/htdocs/compta/bank/transfer.php +++ b/htdocs/compta/bank/transfer.php @@ -8,6 +8,7 @@ * Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2023 Maxime Nicolas <maxime@oarces.com> * Copyright (C) 2023 Benjamin GREMBI <benjamin@oarces.com> + * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com> * * 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 @@ -164,7 +165,7 @@ if ($action == 'add' && $user->hasRight('banque', 'transfer')) { } if (!$error) { - $bank_line_id_from = $tmpaccountfrom->addline($dateo[$n], $typefrom, $label[$n], price2num(-1 * $amount[$n]), '', '', $user); + $bank_line_id_from = $tmpaccountfrom->addline($dateo[$n], $typefrom, $label[$n], price2num(-1 * (float) $amount[$n]), '', '', $user); } if (!($bank_line_id_from > 0)) { $error++; From 0c8eae7240759ff19f402ae1474131f765e6ce9e Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Sat, 23 Mar 2024 01:12:03 +0100 Subject: [PATCH 116/178] Fix PhanTypeInvalid{Left,Right}OperandOfNumericOp mostly by typing, casting, idate --- htdocs/compta/facture/card.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 69c113e86d7..4293ae1abe0 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1599,7 +1599,7 @@ if (empty($reshook)) { if ($qualified) { $totalamount += $lines[$i]->total_ht; // Fixme : is it not for the customer ? Shouldn't we take total_ttc ? $tva_tx = $lines[$i]->tva_tx; - $amountdeposit[$tva_tx] += ($lines[$i]->total_ht * $valuedeposit) / 100; + $amountdeposit[$tva_tx] += ($lines[$i]->total_ht * (float) $valuedeposit) / 100; } } @@ -1691,7 +1691,7 @@ if (empty($reshook)) { if (is_array($lines)) { foreach ($lines as $line) { // We keep ->subprice and ->pa_ht, but we change the qty - $line->qty = price2num($line->qty * $valuestandardinvoice / 100, 'MS'); + $line->qty = price2num($line->qty * (float) $valuestandardinvoice / 100, 'MS'); } } } @@ -1700,7 +1700,7 @@ if (empty($reshook)) { if (is_array($lines)) { foreach ($lines as $line) { // We keep ->subprice and ->pa_ht, but we change the qty - $line->qty = price2num($line->qty * $valuedeposit / 100, 'MS'); + $line->qty = price2num($line->qty * (float) $valuedeposit / 100, 'MS'); } } } @@ -2253,14 +2253,14 @@ if (empty($reshook)) { // TODO We should not have this if (!empty($price_ht) || $price_ht === '0') { $pu_ht = price2num($price_ht, 'MU'); - $pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU'); + $pu_ttc = price2num((float) $pu_ht * (1 + ($tmpvat / 100)), 'MU'); } elseif (!empty($price_ht_devise) || $price_ht_devise === '0') { $pu_ht_devise = price2num($price_ht_devise, 'MU'); $pu_ht = ''; $pu_ttc = ''; } elseif (!empty($price_ttc) || $price_ttc === '0') { $pu_ttc = price2num($price_ttc, 'MU'); - $pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU'); + $pu_ht = price2num((float) $pu_ttc / (1 + ($tmpvat / 100)), 'MU'); } elseif ($tmpvat != $tmpprodvat) { // Is this still used ? if ($price_base_type != 'HT') { @@ -2399,7 +2399,7 @@ if (empty($reshook)) { $pu_equivalent = $pu_ht_devise * $currency_tx; } if ($pu_ttc == '' && $pu_ttc_devise != '' && $currency_tx != '') { - $pu_equivalent_ttc = $pu_ttc_devise * $currency_tx; + $pu_equivalent_ttc = (float) $pu_ttc_devise * $currency_tx; } // TODO $pu_equivalent or $pu_equivalent_ttc must be calculated from the one not null taking into account all taxes @@ -2437,11 +2437,11 @@ if (empty($reshook)) { // Check price is not lower than minimum (check is done only for standard or replacement invoices) if ($usermustrespectpricemin && ($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT)) { - if ($pu_equivalent && $price_min && ((price2num($pu_equivalent) * (1 - $remise_percent / 100)) < price2num($price_min)) && $price_base_type == 'HT') { + if ($pu_equivalent && $price_min && (((float) price2num($pu_equivalent) * (1 - $remise_percent / 100)) < (float) price2num($price_min)) && $price_base_type == 'HT') { $mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, -1, $conf->currency)); setEventMessages($mesg, null, 'errors'); $error++; - } elseif ($pu_equivalent_ttc && $price_min_ttc && ((price2num($pu_equivalent_ttc) * (1 - $remise_percent / 100)) < price2num($price_min_ttc)) && $price_base_type == 'TTC') { + } elseif ($pu_equivalent_ttc && $price_min_ttc && (((float) price2num($pu_equivalent_ttc) * (1 - $remise_percent / 100)) < (float) price2num($price_min_ttc)) && $price_base_type == 'TTC') { $mesg = $langs->trans("CantBeLessThanMinPriceInclTax", price(price2num($price_min_ttc, 'MU'), 0, $langs, 0, 0, -1, $conf->currency)); setEventMessages($mesg, null, 'errors'); $error++; @@ -2572,10 +2572,10 @@ if (empty($reshook)) { // Check if we have a foreign currency // If so, we update the pu_equiv as the equivalent price in base currency if ($pu_ht == '' && $pu_ht_devise != '' && $currency_tx != '') { - $pu_equivalent = $pu_ht_devise * $currency_tx; + $pu_equivalent = (float) $pu_ht_devise * (float) $currency_tx; } if ($pu_ttc == '' && $pu_ttc_devise != '' && $currency_tx != '') { - $pu_equivalent_ttc = $pu_ttc_devise * $currency_tx; + $pu_equivalent_ttc = (float) $pu_ttc_devise * (float) $currency_tx; } // TODO $pu_equivalent or $pu_equivalent_ttc must be calculated from the one not null taking into account all taxes @@ -2659,7 +2659,7 @@ if (empty($reshook)) { setEventMessages($mesg, null, 'errors'); $error++; $action = 'editline'; - } elseif ($pu_equivalent_ttc && $price_min_ttc && ((price2num($pu_equivalent_ttc) * (1 - (float) $remise_percent / 100)) < price2num($price_min_ttc)) && $price_base_type == 'TTC') { + } elseif ($pu_equivalent_ttc && $price_min_ttc && (((float) price2num($pu_equivalent_ttc) * (1 - (float) $remise_percent / 100)) < (float) price2num($price_min_ttc)) && $price_base_type == 'TTC') { $mesg = $langs->trans("CantBeLessThanMinPriceInclTax", price(price2num($price_min_ttc, 'MU'), 0, $langs, 0, 0, -1, $conf->currency)); setEventMessages($mesg, null, 'errors'); $error++; @@ -4195,7 +4195,7 @@ if ($action == 'create') { // TODO We should not need this. Also data comes from a not reliable value of $object->multicurrency_total_ttc that may be wrong if it was // calculated by summing lines that were in a currency for some of them and into another for others (lines from discount/down payment into another currency for example) if ($resteapayer == 0 && $multicurrency_resteapayer != 0 && $object->multicurrency_code != $conf->currency) { - $resteapayer = price2num($multicurrency_resteapayer / $object->multicurrency_tx, 'MT'); + $resteapayer = price2num((float) $multicurrency_resteapayer / $object->multicurrency_tx, 'MT'); } } From 359a2688ffc2ea21720346e21cf34b091b324b91 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Sat, 23 Mar 2024 01:12:06 +0100 Subject: [PATCH 117/178] Fix PhanTypeInvalid{Left,Right}OperandOfNumericOp mostly by typing, casting, idate --- htdocs/compta/facture/class/api_invoices.class.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index ef52e74f6c8..8ca14c775a7 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2020 Thibault FOUCART <support@ptibogxiv.net> * Copyright (C) 2023 Joachim Kueter <git-jk@bloxera.com> * Copyright (C) 2024 Frédéric France <frederic.france@free.fr> + * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com> * * 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 @@ -1480,10 +1481,10 @@ class Invoices extends DolibarrApi // Clean parameters amount if payment is for a credit note if ($this->invoice->type == Facture::TYPE_CREDIT_NOTE) { $resteapayer = price2num($resteapayer, 'MT'); - $amounts[$id] = (float) price2num(-1 * $resteapayer, 'MT'); + $amounts[$id] = (float) price2num(-1 * (float) $resteapayer, 'MT'); // Multicurrency $newvalue = price2num($this->invoice->multicurrency_total_ttc, 'MT'); - $multicurrency_amounts[$id] = (float) price2num(-1 * $newvalue, 'MT'); + $multicurrency_amounts[$id] = (float) price2num(-1 * (float) $newvalue, 'MT'); } else { $resteapayer = price2num($resteapayer, 'MT'); $amounts[$id] = (float) $resteapayer; @@ -1626,7 +1627,7 @@ class Invoices extends DolibarrApi } if ($this->invoice->type == Facture::TYPE_CREDIT_NOTE) { - $amount = price2num(-1 * $amount, 'MT'); + $amount = price2num(-1 * (float) $amount, 'MT'); } if ($is_multicurrency) { From 03f32e50bed2fc00d10f04833518ecfb91c913f4 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Sat, 23 Mar 2024 01:12:08 +0100 Subject: [PATCH 118/178] Fix PhanTypeInvalid{Left,Right}OperandOfNumericOp mostly by typing, casting, idate --- htdocs/compta/localtax/index.php | 109 ++++++++++++++++--------------- 1 file changed, 55 insertions(+), 54 deletions(-) diff --git a/htdocs/compta/localtax/index.php b/htdocs/compta/localtax/index.php index 0e6ffde780c..1c277b80f3f 100644 --- a/htdocs/compta/localtax/index.php +++ b/htdocs/compta/localtax/index.php @@ -3,6 +3,7 @@ * Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2018 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr> + * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com> * * 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 @@ -333,26 +334,26 @@ while ((($y < $yend) || ($y == $yend && $m <= $mend)) && $mcursor < 1000) { // $ //$invoice_customer->type=$x_coll[$my_coll_rate]['type'][$id]; //$company_static->fetch($x_coll[$my_coll_rate]['company_id'][$id]); $x_both[$my_coll_rate]['coll']['detail'][] = array( - 'id' =>$x_coll[$my_coll_rate]['facid'][$id], - 'descr' =>$x_coll[$my_coll_rate]['descr'][$id], - 'pid' =>$x_coll[$my_coll_rate]['pid'][$id], - 'pref' =>$x_coll[$my_coll_rate]['pref'][$id], - 'ptype' =>$x_coll[$my_coll_rate]['ptype'][$id], - 'payment_id'=>$x_coll[$my_coll_rate]['payment_id'][$id], - 'payment_amount'=>$x_coll[$my_coll_rate]['payment_amount'][$id], - 'ftotal_ttc'=>$x_coll[$my_coll_rate]['ftotal_ttc'][$id], - 'dtotal_ttc'=>$x_coll[$my_coll_rate]['dtotal_ttc'][$id], - 'dtype' =>$x_coll[$my_coll_rate]['dtype'][$id], - 'datef' =>$x_coll[$my_coll_rate]['datef'][$id], - 'datep' =>$x_coll[$my_coll_rate]['datep'][$id], + 'id' => $x_coll[$my_coll_rate]['facid'][$id], + 'descr' => $x_coll[$my_coll_rate]['descr'][$id], + 'pid' => $x_coll[$my_coll_rate]['pid'][$id], + 'pref' => $x_coll[$my_coll_rate]['pref'][$id], + 'ptype' => $x_coll[$my_coll_rate]['ptype'][$id], + 'payment_id' => $x_coll[$my_coll_rate]['payment_id'][$id], + 'payment_amount' => $x_coll[$my_coll_rate]['payment_amount'][$id], + 'ftotal_ttc' => $x_coll[$my_coll_rate]['ftotal_ttc'][$id], + 'dtotal_ttc' => $x_coll[$my_coll_rate]['dtotal_ttc'][$id], + 'dtype' => $x_coll[$my_coll_rate]['dtype'][$id], + 'datef' => $x_coll[$my_coll_rate]['datef'][$id], + 'datep' => $x_coll[$my_coll_rate]['datep'][$id], //'company_link'=>$company_static->getNomUrl(1,'',20), - 'ddate_start'=>$x_coll[$my_coll_rate]['ddate_start'][$id], - 'ddate_end' =>$x_coll[$my_coll_rate]['ddate_end'][$id], + 'ddate_start' => $x_coll[$my_coll_rate]['ddate_start'][$id], + 'ddate_end' => $x_coll[$my_coll_rate]['ddate_end'][$id], - 'totalht' =>$x_coll[$my_coll_rate]['totalht_list'][$id], - 'vat' =>$x_coll[$my_coll_rate]['vat_list'][$id], - 'localtax1' =>$x_coll[$my_coll_rate]['localtax1_list'][$id], - 'localtax2' =>$x_coll[$my_coll_rate]['localtax2_list'][$id], + 'totalht' => $x_coll[$my_coll_rate]['totalht_list'][$id], + 'vat' => $x_coll[$my_coll_rate]['vat_list'][$id], + 'localtax1' => $x_coll[$my_coll_rate]['localtax1_list'][$id], + 'localtax2' => $x_coll[$my_coll_rate]['localtax2_list'][$id], //'link' =>$invoice_customer->getNomUrl(1,'',12) ); } @@ -381,23 +382,23 @@ while ((($y < $yend) || ($y == $yend && $m <= $mend)) && $mcursor < 1000) { // $ //$expensereport->type=$x_paye[$my_paye_rate]['type'][$id]; $x_both[$my_paye_rate]['paye']['detail'][] = array( - 'id' =>$x_paye[$my_paye_rate]['facid'][$id], - 'descr' =>$x_paye[$my_paye_rate]['descr'][$id], - 'pid' =>$x_paye[$my_paye_rate]['pid'][$id], - 'pref' =>$x_paye[$my_paye_rate]['pref'][$id], - 'ptype' =>$x_paye[$my_paye_rate]['ptype'][$id], - 'payment_id' =>$x_paye[$my_paye_rate]['payment_id'][$id], - 'payment_amount' =>$x_paye[$my_paye_rate]['payment_amount'][$id], - 'ftotal_ttc' =>price2num($x_paye[$my_paye_rate]['ftotal_ttc'][$id]), - 'dtotal_ttc' =>price2num($x_paye[$my_paye_rate]['dtotal_ttc'][$id]), - 'dtype' =>$x_paye[$my_paye_rate]['dtype'][$id], - 'ddate_start' =>$x_paye[$my_paye_rate]['ddate_start'][$id], - 'ddate_end' =>$x_paye[$my_paye_rate]['ddate_end'][$id], + 'id' => $x_paye[$my_paye_rate]['facid'][$id], + 'descr' => $x_paye[$my_paye_rate]['descr'][$id], + 'pid' => $x_paye[$my_paye_rate]['pid'][$id], + 'pref' => $x_paye[$my_paye_rate]['pref'][$id], + 'ptype' => $x_paye[$my_paye_rate]['ptype'][$id], + 'payment_id' => $x_paye[$my_paye_rate]['payment_id'][$id], + 'payment_amount' => $x_paye[$my_paye_rate]['payment_amount'][$id], + 'ftotal_ttc' => price2num($x_paye[$my_paye_rate]['ftotal_ttc'][$id]), + 'dtotal_ttc' => price2num($x_paye[$my_paye_rate]['dtotal_ttc'][$id]), + 'dtype' => $x_paye[$my_paye_rate]['dtype'][$id], + 'ddate_start' => $x_paye[$my_paye_rate]['ddate_start'][$id], + 'ddate_end' => $x_paye[$my_paye_rate]['ddate_end'][$id], - 'totalht' =>price2num($x_paye[$my_paye_rate]['totalht_list'][$id]), - 'vat' =>$x_paye[$my_paye_rate]['vat_list'][$id], - 'localtax1' =>$x_paye[$my_paye_rate]['localtax1_list'][$id], - 'localtax2' =>$x_paye[$my_paye_rate]['localtax2_list'][$id], + 'totalht' => price2num($x_paye[$my_paye_rate]['totalht_list'][$id]), + 'vat' => $x_paye[$my_paye_rate]['vat_list'][$id], + 'localtax1' => $x_paye[$my_paye_rate]['localtax1_list'][$id], + 'localtax2' => $x_paye[$my_paye_rate]['localtax2_list'][$id], //'link' =>$expensereport->getNomUrl(1) ); } else { @@ -406,26 +407,26 @@ while ((($y < $yend) || ($y == $yend && $m <= $mend)) && $mcursor < 1000) { // $ //$invoice_supplier->type=$x_paye[$my_paye_rate]['type'][$id]; //$company_static->fetch($x_paye[$my_paye_rate]['company_id'][$id]); $x_both[$my_paye_rate]['paye']['detail'][] = array( - 'id' =>$x_paye[$my_paye_rate]['facid'][$id], - 'descr' =>$x_paye[$my_paye_rate]['descr'][$id], - 'pid' =>$x_paye[$my_paye_rate]['pid'][$id], - 'pref' =>$x_paye[$my_paye_rate]['pref'][$id], - 'ptype' =>$x_paye[$my_paye_rate]['ptype'][$id], - 'payment_id'=>$x_paye[$my_paye_rate]['payment_id'][$id], - 'payment_amount'=>$x_paye[$my_paye_rate]['payment_amount'][$id], - 'ftotal_ttc'=>price2num($x_paye[$my_paye_rate]['ftotal_ttc'][$id]), - 'dtotal_ttc'=>price2num($x_paye[$my_paye_rate]['dtotal_ttc'][$id]), - 'dtype' =>$x_paye[$my_paye_rate]['dtype'][$id], - 'datef' =>$x_paye[$my_paye_rate]['datef'][$id], - 'datep' =>$x_paye[$my_paye_rate]['datep'][$id], + 'id' => $x_paye[$my_paye_rate]['facid'][$id], + 'descr' => $x_paye[$my_paye_rate]['descr'][$id], + 'pid' => $x_paye[$my_paye_rate]['pid'][$id], + 'pref' => $x_paye[$my_paye_rate]['pref'][$id], + 'ptype' => $x_paye[$my_paye_rate]['ptype'][$id], + 'payment_id' => $x_paye[$my_paye_rate]['payment_id'][$id], + 'payment_amount' => $x_paye[$my_paye_rate]['payment_amount'][$id], + 'ftotal_ttc' => price2num($x_paye[$my_paye_rate]['ftotal_ttc'][$id]), + 'dtotal_ttc' => price2num($x_paye[$my_paye_rate]['dtotal_ttc'][$id]), + 'dtype' => $x_paye[$my_paye_rate]['dtype'][$id], + 'datef' => $x_paye[$my_paye_rate]['datef'][$id], + 'datep' => $x_paye[$my_paye_rate]['datep'][$id], //'company_link'=>$company_static->getNomUrl(1,'',20), - 'ddate_start'=>$x_paye[$my_paye_rate]['ddate_start'][$id], - 'ddate_end' =>$x_paye[$my_paye_rate]['ddate_end'][$id], + 'ddate_start' => $x_paye[$my_paye_rate]['ddate_start'][$id], + 'ddate_end' => $x_paye[$my_paye_rate]['ddate_end'][$id], - 'totalht' =>price2num($x_paye[$my_paye_rate]['totalht_list'][$id]), - 'vat' =>$x_paye[$my_paye_rate]['vat_list'][$id], - 'localtax1' =>$x_paye[$my_paye_rate]['localtax1_list'][$id], - 'localtax2' =>$x_paye[$my_paye_rate]['localtax2_list'][$id], + 'totalht' => price2num($x_paye[$my_paye_rate]['totalht_list'][$id]), + 'vat' => $x_paye[$my_paye_rate]['vat_list'][$id], + 'localtax1' => $x_paye[$my_paye_rate]['localtax1_list'][$id], + 'localtax2' => $x_paye[$my_paye_rate]['localtax2_list'][$id], //'link' =>$invoice_supplier->getNomUrl(1,'',12) ); } @@ -514,12 +515,12 @@ while ((($y < $yend) || ($y == $yend && $m <= $mend)) && $mcursor < 1000) { // $ //print $langs->trans("NA"); } else { if (isset($fields['payment_amount']) && price2num($fields['ftotal_ttc'])) { - $ratiopaymentinvoice = ($fields['payment_amount'] / $fields['ftotal_ttc']); + $ratiopaymentinvoice = ($fields['payment_amount'] / (float) $fields['ftotal_ttc']); } } } //var_dump('type='.$type.' '.$fields['totalht'].' '.$ratiopaymentinvoice); - $temp_ht = $fields['totalht'] * $ratiopaymentinvoice; + $temp_ht = (float) $fields['totalht'] * $ratiopaymentinvoice; $temp_vat = $fields['localtax'.$localTaxType] * $ratiopaymentinvoice; $subtot_paye_total_ht += $temp_ht; $subtot_paye_vat += $temp_vat; From e01d205172afe055fe66882084e0de6b1f481875 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Sat, 23 Mar 2024 01:12:11 +0100 Subject: [PATCH 119/178] Fix PhanTypeInvalid{Left,Right}OperandOfNumericOp mostly by typing, casting, idate --- htdocs/compta/localtax/quadri_detail.php | 89 ++++++++++++------------ 1 file changed, 45 insertions(+), 44 deletions(-) diff --git a/htdocs/compta/localtax/quadri_detail.php b/htdocs/compta/localtax/quadri_detail.php index 63df3750d22..6644378a926 100644 --- a/htdocs/compta/localtax/quadri_detail.php +++ b/htdocs/compta/localtax/quadri_detail.php @@ -5,6 +5,7 @@ * Copyright (C) 2006-2007 Yannick Warnier <ywarnier@beeznest.org> * Copyright (C) 2014-2016 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr> + * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com> * * 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 @@ -169,7 +170,7 @@ $calcmode .= ' <span class="opacitymedium">('.$langs->trans("TaxModuleSetupToMod // Set period $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); $prevyear = $year_start; -$q=0; +$q = 0; $prevquarter = $q; if ($prevquarter > 1) { $prevquarter--; @@ -277,26 +278,26 @@ if (!is_array($x_coll) || !is_array($x_paye)) { $invoice_customer->type = $x_coll[$my_coll_rate]['type'][$id]; $company_static->fetch($x_coll[$my_coll_rate]['company_id'][$id]); $x_both[$my_coll_rate]['coll']['detail'][] = array( - 'id' =>$x_coll[$my_coll_rate]['facid'][$id], - 'descr' =>$x_coll[$my_coll_rate]['descr'][$id], - 'pid' =>$x_coll[$my_coll_rate]['pid'][$id], - 'pref' =>$x_coll[$my_coll_rate]['pref'][$id], - 'ptype' =>$x_coll[$my_coll_rate]['ptype'][$id], - 'payment_id'=>$x_coll[$my_coll_rate]['payment_id'][$id], - 'payment_amount'=>$x_coll[$my_coll_rate]['payment_amount'][$id], - 'ftotal_ttc'=>$x_coll[$my_coll_rate]['ftotal_ttc'][$id], - 'dtotal_ttc'=>$x_coll[$my_coll_rate]['dtotal_ttc'][$id], - 'dtype' =>$x_coll[$my_coll_rate]['dtype'][$id], - 'datef' =>$x_coll[$my_coll_rate]['datef'][$id], - 'datep' =>$x_coll[$my_coll_rate]['datep'][$id], - 'company_link'=>$company_static->getNomUrl(1, '', 20), - 'ddate_start'=>$x_coll[$my_coll_rate]['ddate_start'][$id], - 'ddate_end' =>$x_coll[$my_coll_rate]['ddate_end'][$id], - 'totalht' =>$x_coll[$my_coll_rate]['totalht_list'][$id], - 'localtax1'=> $x_coll[$my_coll_rate]['localtax1_list'][$id], - 'localtax2'=> $x_coll[$my_coll_rate]['localtax2_list'][$id], - 'vat' =>$x_coll[$my_coll_rate]['vat_list'][$id], - 'link' =>$invoice_customer->getNomUrl(1, '', 12) + 'id' => $x_coll[$my_coll_rate]['facid'][$id], + 'descr' => $x_coll[$my_coll_rate]['descr'][$id], + 'pid' => $x_coll[$my_coll_rate]['pid'][$id], + 'pref' => $x_coll[$my_coll_rate]['pref'][$id], + 'ptype' => $x_coll[$my_coll_rate]['ptype'][$id], + 'payment_id' => $x_coll[$my_coll_rate]['payment_id'][$id], + 'payment_amount' => $x_coll[$my_coll_rate]['payment_amount'][$id], + 'ftotal_ttc' => $x_coll[$my_coll_rate]['ftotal_ttc'][$id], + 'dtotal_ttc' => $x_coll[$my_coll_rate]['dtotal_ttc'][$id], + 'dtype' => $x_coll[$my_coll_rate]['dtype'][$id], + 'datef' => $x_coll[$my_coll_rate]['datef'][$id], + 'datep' => $x_coll[$my_coll_rate]['datep'][$id], + 'company_link' => $company_static->getNomUrl(1, '', 20), + 'ddate_start' => $x_coll[$my_coll_rate]['ddate_start'][$id], + 'ddate_end' => $x_coll[$my_coll_rate]['ddate_end'][$id], + 'totalht' => $x_coll[$my_coll_rate]['totalht_list'][$id], + 'localtax1' => $x_coll[$my_coll_rate]['localtax1_list'][$id], + 'localtax2' => $x_coll[$my_coll_rate]['localtax2_list'][$id], + 'vat' => $x_coll[$my_coll_rate]['vat_list'][$id], + 'link' => $invoice_customer->getNomUrl(1, '', 12) ); } } @@ -316,26 +317,26 @@ if (!is_array($x_coll) || !is_array($x_paye)) { $invoice_supplier->ref = $x_paye[$my_paye_rate]['facnum'][$id]; $invoice_supplier->type = $x_paye[$my_paye_rate]['type'][$id]; $x_both[$my_paye_rate]['paye']['detail'][] = array( - 'id' =>$x_paye[$my_paye_rate]['facid'][$id], - 'descr' =>$x_paye[$my_paye_rate]['descr'][$id], - 'pid' =>$x_paye[$my_paye_rate]['pid'][$id], - 'pref' =>$x_paye[$my_paye_rate]['pref'][$id], - 'ptype' =>$x_paye[$my_paye_rate]['ptype'][$id], - 'payment_id'=>$x_paye[$my_paye_rate]['payment_id'][$id], - 'payment_amount'=>$x_paye[$my_paye_rate]['payment_amount'][$id], - 'ftotal_ttc'=>price2num($x_paye[$my_paye_rate]['ftotal_ttc'][$id]), - 'dtotal_ttc'=>price2num($x_paye[$my_paye_rate]['dtotal_ttc'][$id]), - 'dtype' =>$x_paye[$my_paye_rate]['dtype'][$id], - 'datef' =>$x_paye[$my_paye_rate]['datef'][$id], - 'datep' =>$x_paye[$my_paye_rate]['datep'][$id], - 'company_link'=>$company_static->getNomUrl(1, '', 20), - 'ddate_start'=>$x_paye[$my_paye_rate]['ddate_start'][$id], - 'ddate_end' =>$x_paye[$my_paye_rate]['ddate_end'][$id], - 'totalht' =>price2num($x_paye[$my_paye_rate]['totalht_list'][$id]), - 'localtax1'=> $x_paye[$my_paye_rate]['localtax1_list'][$id], - 'localtax2'=> $x_paye[$my_paye_rate]['localtax2_list'][$id], - 'vat' =>$x_paye[$my_paye_rate]['vat_list'][$id], - 'link' =>$invoice_supplier->getNomUrl(1, '', 12) + 'id' => $x_paye[$my_paye_rate]['facid'][$id], + 'descr' => $x_paye[$my_paye_rate]['descr'][$id], + 'pid' => $x_paye[$my_paye_rate]['pid'][$id], + 'pref' => $x_paye[$my_paye_rate]['pref'][$id], + 'ptype' => $x_paye[$my_paye_rate]['ptype'][$id], + 'payment_id' => $x_paye[$my_paye_rate]['payment_id'][$id], + 'payment_amount' => $x_paye[$my_paye_rate]['payment_amount'][$id], + 'ftotal_ttc' => price2num($x_paye[$my_paye_rate]['ftotal_ttc'][$id]), + 'dtotal_ttc' => price2num($x_paye[$my_paye_rate]['dtotal_ttc'][$id]), + 'dtype' => $x_paye[$my_paye_rate]['dtype'][$id], + 'datef' => $x_paye[$my_paye_rate]['datef'][$id], + 'datep' => $x_paye[$my_paye_rate]['datep'][$id], + 'company_link' => $company_static->getNomUrl(1, '', 20), + 'ddate_start' => $x_paye[$my_paye_rate]['ddate_start'][$id], + 'ddate_end' => $x_paye[$my_paye_rate]['ddate_end'][$id], + 'totalht' => price2num($x_paye[$my_paye_rate]['totalht_list'][$id]), + 'localtax1' => $x_paye[$my_paye_rate]['localtax1_list'][$id], + 'localtax2' => $x_paye[$my_paye_rate]['localtax2_list'][$id], + 'vat' => $x_paye[$my_paye_rate]['vat_list'][$id], + 'link' => $invoice_supplier->getNomUrl(1, '', 12) ); } } @@ -593,7 +594,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) { print price($fields['totalht']); if (price2num($fields['ftotal_ttc'])) { //print $fields['dtotal_ttc']."/".$fields['ftotal_ttc']." - "; - $ratiolineinvoice = ($fields['dtotal_ttc'] / $fields['ftotal_ttc']); + $ratiolineinvoice = ((float) $fields['dtotal_ttc'] / (float) $fields['ftotal_ttc']); //print ' ('.round($ratiolineinvoice*100,2).'%)'; } print '</td>'; @@ -604,7 +605,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) { if ($modetax != 1) { print '<td class="nowrap right">'; if (isset($fields['payment_amount']) && $fields['ftotal_ttc']) { - $ratiopaymentinvoice = ($fields['payment_amount'] / $fields['ftotal_ttc']); + $ratiopaymentinvoice = ($fields['payment_amount'] / (float) $fields['ftotal_ttc']); } if ($fields['payment_amount'] && $fields['ftotal_ttc']) { $paymentfourn_static->id = $fields['payment_id']; @@ -623,7 +624,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) { // VAT paid print '<td class="nowrap right">'; - $temp_ht = $fields['totalht'] * $ratiopaymentinvoice; + $temp_ht = (float) $fields['totalht'] * $ratiopaymentinvoice; print price(price2num($temp_ht, 'MT'), 1); print '</td>'; From 5c2ff03077d145051f4536b8e7e9659ea7b2a33c Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Sat, 23 Mar 2024 01:12:14 +0100 Subject: [PATCH 120/178] Fix PhanTypeInvalid{Left,Right}OperandOfNumericOp mostly by typing, casting, idate --- htdocs/compta/tva/clients.php | 135 +++++++++++++++++----------------- 1 file changed, 68 insertions(+), 67 deletions(-) diff --git a/htdocs/compta/tva/clients.php b/htdocs/compta/tva/clients.php index e2e45bac9dd..060072bdb95 100644 --- a/htdocs/compta/tva/clients.php +++ b/htdocs/compta/tva/clients.php @@ -5,6 +5,7 @@ * Copyright (C) 2006 Yannick Warnier <ywarnier@beeznest.org> * Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr> + * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com> * * 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 @@ -122,7 +123,7 @@ $calcmode .= ' <span class="opacitymedium">('.$langs->trans("TaxModuleSetupToMod // Set period $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); $prevyear = $date_start_year; -$q=0; +$q = 0; $prevquarter = $q; if ($prevquarter > 1) { $prevquarter--; @@ -254,32 +255,32 @@ if (!is_array($x_coll) || !is_array($x_paye)) { $company_static->code_compta_fournisseur = $x_coll[$my_coll_thirdpartyid]['company_supplier_accounting_code'][$id]; $x_both[$my_coll_thirdpartyid]['coll']['detail'][] = array( - 'id' =>$x_coll[$my_coll_thirdpartyid]['facid'][$id], - 'descr' =>$x_coll[$my_coll_thirdpartyid]['descr'][$id], + 'id' => $x_coll[$my_coll_thirdpartyid]['facid'][$id], + 'descr' => $x_coll[$my_coll_thirdpartyid]['descr'][$id], - 'pid' =>$x_coll[$my_coll_thirdpartyid]['pid'][$id], - 'pref' =>isset($x_coll[$my_coll_thirdpartyid]['pref'][$id]) ? $x_coll[$my_coll_thirdpartyid]['pref'][$id] : '', - 'ptype' =>$x_coll[$my_coll_thirdpartyid]['ptype'][$id], - 'pstatus' =>isset($x_paye[$my_coll_thirdpartyid]['pstatus'][$id]) ? $x_paye[$my_coll_thirdpartyid]['pstatus'][$id] : '', - 'pstatusbuy'=>isset($x_paye[$my_coll_thirdpartyid]['pstatusbuy'][$id]) ? $x_paye[$my_coll_thirdpartyid]['pstatusbuy'][$id] : '', + 'pid' => $x_coll[$my_coll_thirdpartyid]['pid'][$id], + 'pref' => isset($x_coll[$my_coll_thirdpartyid]['pref'][$id]) ? $x_coll[$my_coll_thirdpartyid]['pref'][$id] : '', + 'ptype' => $x_coll[$my_coll_thirdpartyid]['ptype'][$id], + 'pstatus' => isset($x_paye[$my_coll_thirdpartyid]['pstatus'][$id]) ? $x_paye[$my_coll_thirdpartyid]['pstatus'][$id] : '', + 'pstatusbuy' => isset($x_paye[$my_coll_thirdpartyid]['pstatusbuy'][$id]) ? $x_paye[$my_coll_thirdpartyid]['pstatusbuy'][$id] : '', - 'payment_id'=>$x_coll[$my_coll_thirdpartyid]['payment_id'][$id], - 'payment_ref'=>isset($x_coll[$my_coll_thirdpartyid]['payment_ref'][$id]) ? $x_coll[$my_coll_thirdpartyid]['payment_ref'][$id] : '', - 'payment_amount'=>$x_coll[$my_coll_thirdpartyid]['payment_amount'][$id], - 'ftotal_ttc'=>$x_coll[$my_coll_thirdpartyid]['ftotal_ttc'][$id], - 'dtotal_ttc'=>$x_coll[$my_coll_thirdpartyid]['dtotal_ttc'][$id], - 'dtype' =>$x_coll[$my_coll_thirdpartyid]['dtype'][$id], - 'drate' =>$x_coll[$my_coll_thirdpartyid]['drate'][$id], - 'datef' =>$x_coll[$my_coll_thirdpartyid]['datef'][$id], - 'datep' =>$x_coll[$my_coll_thirdpartyid]['datep'][$id], + 'payment_id' => $x_coll[$my_coll_thirdpartyid]['payment_id'][$id], + 'payment_ref' => isset($x_coll[$my_coll_thirdpartyid]['payment_ref'][$id]) ? $x_coll[$my_coll_thirdpartyid]['payment_ref'][$id] : '', + 'payment_amount' => $x_coll[$my_coll_thirdpartyid]['payment_amount'][$id], + 'ftotal_ttc' => $x_coll[$my_coll_thirdpartyid]['ftotal_ttc'][$id], + 'dtotal_ttc' => $x_coll[$my_coll_thirdpartyid]['dtotal_ttc'][$id], + 'dtype' => $x_coll[$my_coll_thirdpartyid]['dtype'][$id], + 'drate' => $x_coll[$my_coll_thirdpartyid]['drate'][$id], + 'datef' => $x_coll[$my_coll_thirdpartyid]['datef'][$id], + 'datep' => $x_coll[$my_coll_thirdpartyid]['datep'][$id], - 'company_link'=>$company_static->getNomUrl(1, '', 20), + 'company_link' => $company_static->getNomUrl(1, '', 20), - 'ddate_start'=>$x_coll[$my_coll_thirdpartyid]['ddate_start'][$id], - 'ddate_end' =>$x_coll[$my_coll_thirdpartyid]['ddate_end'][$id], - 'totalht' =>$x_coll[$my_coll_thirdpartyid]['totalht_list'][$id], - 'vat' =>$x_coll[$my_coll_thirdpartyid]['vat_list'][$id], - 'link' =>$invoice_customer->getNomUrl(1, '', 12) + 'ddate_start' => $x_coll[$my_coll_thirdpartyid]['ddate_start'][$id], + 'ddate_end' => $x_coll[$my_coll_thirdpartyid]['ddate_end'][$id], + 'totalht' => $x_coll[$my_coll_thirdpartyid]['totalht_list'][$id], + 'vat' => $x_coll[$my_coll_thirdpartyid]['vat_list'][$id], + 'link' => $invoice_customer->getNomUrl(1, '', 12) ); } } @@ -302,27 +303,27 @@ if (!is_array($x_coll) || !is_array($x_paye)) { $expensereport->type = $x_paye[$my_paye_thirdpartyid]['type'][$id]; $x_both[$my_paye_thirdpartyid]['paye']['detail'][] = array( - 'id' =>$x_paye[$my_paye_thirdpartyid]['facid'][$id], - 'descr' =>$x_paye[$my_paye_thirdpartyid]['descr'][$id], + 'id' => $x_paye[$my_paye_thirdpartyid]['facid'][$id], + 'descr' => $x_paye[$my_paye_thirdpartyid]['descr'][$id], - 'pid' =>$x_paye[$my_paye_thirdpartyid]['pid'][$id], - 'pref' =>$x_paye[$my_paye_thirdpartyid]['pref'][$id], - 'ptype' =>$x_paye[$my_paye_thirdpartyid]['ptype'][$id], - 'pstatus' =>$x_paye[$my_paye_thirdpartyid]['pstatus'][$id], - 'pstatusbuy' =>$x_paye[$my_paye_thirdpartyid]['pstatusbuy'][$id], + 'pid' => $x_paye[$my_paye_thirdpartyid]['pid'][$id], + 'pref' => $x_paye[$my_paye_thirdpartyid]['pref'][$id], + 'ptype' => $x_paye[$my_paye_thirdpartyid]['ptype'][$id], + 'pstatus' => $x_paye[$my_paye_thirdpartyid]['pstatus'][$id], + 'pstatusbuy' => $x_paye[$my_paye_thirdpartyid]['pstatusbuy'][$id], - 'payment_id' =>$x_paye[$my_paye_thirdpartyid]['payment_id'][$id], - 'payment_ref' =>$x_paye[$my_paye_thirdpartyid]['payment_ref'][$id], - 'payment_amount' =>$x_paye[$my_paye_thirdpartyid]['payment_amount'][$id], - 'ftotal_ttc' =>price2num($x_paye[$my_paye_thirdpartyid]['ftotal_ttc'][$id]), - 'dtotal_ttc' =>price2num($x_paye[$my_paye_thirdpartyid]['dtotal_ttc'][$id]), - 'dtype' =>$x_paye[$my_paye_thirdpartyid]['dtype'][$id], - 'drate' =>$x_paye[$my_coll_thirdpartyid]['drate'][$id], - 'ddate_start' =>$x_paye[$my_paye_thirdpartyid]['ddate_start'][$id], - 'ddate_end' =>$x_paye[$my_paye_thirdpartyid]['ddate_end'][$id], - 'totalht' =>price2num($x_paye[$my_paye_thirdpartyid]['totalht_list'][$id]), - 'vat' =>$x_paye[$my_paye_thirdpartyid]['vat_list'][$id], - 'link' =>$expensereport->getNomUrl(1) + 'payment_id' => $x_paye[$my_paye_thirdpartyid]['payment_id'][$id], + 'payment_ref' => $x_paye[$my_paye_thirdpartyid]['payment_ref'][$id], + 'payment_amount' => $x_paye[$my_paye_thirdpartyid]['payment_amount'][$id], + 'ftotal_ttc' => price2num($x_paye[$my_paye_thirdpartyid]['ftotal_ttc'][$id]), + 'dtotal_ttc' => price2num($x_paye[$my_paye_thirdpartyid]['dtotal_ttc'][$id]), + 'dtype' => $x_paye[$my_paye_thirdpartyid]['dtype'][$id], + 'drate' => $x_paye[$my_coll_thirdpartyid]['drate'][$id], + 'ddate_start' => $x_paye[$my_paye_thirdpartyid]['ddate_start'][$id], + 'ddate_end' => $x_paye[$my_paye_thirdpartyid]['ddate_end'][$id], + 'totalht' => price2num($x_paye[$my_paye_thirdpartyid]['totalht_list'][$id]), + 'vat' => $x_paye[$my_paye_thirdpartyid]['vat_list'][$id], + 'link' => $expensereport->getNomUrl(1) ); } else { $invoice_supplier->id = $x_paye[$my_paye_thirdpartyid]['facid'][$id]; @@ -344,32 +345,32 @@ if (!is_array($x_coll) || !is_array($x_paye)) { $company_static->code_compta_fournisseur = $x_paye[$my_paye_thirdpartyid]['company_supplier_accounting_code'][$id]; $x_both[$my_paye_thirdpartyid]['paye']['detail'][] = array( - 'id' =>$x_paye[$my_paye_thirdpartyid]['facid'][$id], - 'descr' =>$x_paye[$my_paye_thirdpartyid]['descr'][$id], + 'id' => $x_paye[$my_paye_thirdpartyid]['facid'][$id], + 'descr' => $x_paye[$my_paye_thirdpartyid]['descr'][$id], - 'pid' =>$x_paye[$my_paye_thirdpartyid]['pid'][$id], - 'pref' =>$x_paye[$my_paye_thirdpartyid]['pref'][$id], - 'ptype' =>$x_paye[$my_paye_thirdpartyid]['ptype'][$id], - 'pstatus' =>$x_paye[$my_paye_thirdpartyid]['pstatus'][$id], - 'pstatusbuy'=>$x_paye[$my_paye_thirdpartyid]['pstatusbuy'][$id], + 'pid' => $x_paye[$my_paye_thirdpartyid]['pid'][$id], + 'pref' => $x_paye[$my_paye_thirdpartyid]['pref'][$id], + 'ptype' => $x_paye[$my_paye_thirdpartyid]['ptype'][$id], + 'pstatus' => $x_paye[$my_paye_thirdpartyid]['pstatus'][$id], + 'pstatusbuy' => $x_paye[$my_paye_thirdpartyid]['pstatusbuy'][$id], - 'payment_id'=>$x_paye[$my_paye_thirdpartyid]['payment_id'][$id], - 'payment_ref'=>$x_paye[$my_paye_thirdpartyid]['payment_ref'][$id], - 'payment_amount'=>$x_paye[$my_paye_thirdpartyid]['payment_amount'][$id], - 'ftotal_ttc'=>price2num($x_paye[$my_paye_thirdpartyid]['ftotal_ttc'][$id]), - 'dtotal_ttc'=>price2num($x_paye[$my_paye_thirdpartyid]['dtotal_ttc'][$id]), - 'dtype' =>$x_paye[$my_paye_thirdpartyid]['dtype'][$id], - 'drate' =>$x_paye[$my_coll_thirdpartyid]['drate'][$id], - 'datef' =>$x_paye[$my_paye_thirdpartyid]['datef'][$id], - 'datep' =>$x_paye[$my_paye_thirdpartyid]['datep'][$id], + 'payment_id' => $x_paye[$my_paye_thirdpartyid]['payment_id'][$id], + 'payment_ref' => $x_paye[$my_paye_thirdpartyid]['payment_ref'][$id], + 'payment_amount' => $x_paye[$my_paye_thirdpartyid]['payment_amount'][$id], + 'ftotal_ttc' => price2num($x_paye[$my_paye_thirdpartyid]['ftotal_ttc'][$id]), + 'dtotal_ttc' => price2num($x_paye[$my_paye_thirdpartyid]['dtotal_ttc'][$id]), + 'dtype' => $x_paye[$my_paye_thirdpartyid]['dtype'][$id], + 'drate' => $x_paye[$my_coll_thirdpartyid]['drate'][$id], + 'datef' => $x_paye[$my_paye_thirdpartyid]['datef'][$id], + 'datep' => $x_paye[$my_paye_thirdpartyid]['datep'][$id], - 'company_link'=>$company_static->getNomUrl(1, '', 20), + 'company_link' => $company_static->getNomUrl(1, '', 20), - 'ddate_start'=>$x_paye[$my_paye_thirdpartyid]['ddate_start'][$id], - 'ddate_end' =>$x_paye[$my_paye_thirdpartyid]['ddate_end'][$id], - 'totalht' =>price2num($x_paye[$my_paye_thirdpartyid]['totalht_list'][$id]), - 'vat' =>$x_paye[$my_paye_thirdpartyid]['vat_list'][$id], - 'link' =>$invoice_supplier->getNomUrl(1, '', 12) + 'ddate_start' => $x_paye[$my_paye_thirdpartyid]['ddate_start'][$id], + 'ddate_end' => $x_paye[$my_paye_thirdpartyid]['ddate_end'][$id], + 'totalht' => price2num($x_paye[$my_paye_thirdpartyid]['totalht_list'][$id]), + 'vat' => $x_paye[$my_paye_thirdpartyid]['vat_list'][$id], + 'link' => $invoice_supplier->getNomUrl(1, '', 12) ); } } @@ -699,7 +700,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) { print price($fields['totalht']); if (price2num($fields['ftotal_ttc'])) { //print $fields['dtotal_ttc']."/".$fields['ftotal_ttc']." - "; - $ratiolineinvoice = ($fields['dtotal_ttc'] / $fields['ftotal_ttc']); + $ratiolineinvoice = ((float) $fields['dtotal_ttc'] / (float) $fields['ftotal_ttc']); //print ' ('.round($ratiolineinvoice*100,2).'%)'; } print '</span></td>'; @@ -720,7 +721,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) { print $langs->trans("NA"); } else { if (isset($fields['payment_amount']) && $fields['ftotal_ttc']) { - $ratiopaymentinvoice = ($fields['payment_amount'] / $fields['ftotal_ttc']); + $ratiopaymentinvoice = ($fields['payment_amount'] / (float) $fields['ftotal_ttc']); } print '<span class="amount">'.price(price2num($fields['payment_amount'], 'MT')).'</span>'; if (isset($fields['payment_amount'])) { @@ -732,7 +733,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) { // VAT paid print '<td class="nowrap right"><span class="amount">'; - $temp_ht = $fields['totalht'] * $ratiopaymentinvoice; + $temp_ht = (float) $fields['totalht'] * $ratiopaymentinvoice; print price(price2num($temp_ht, 'MT'), 1); print '</span></td>'; From f09430a064b73b05df874be162c25596604bb764 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Sat, 23 Mar 2024 01:12:16 +0100 Subject: [PATCH 121/178] Fix PhanTypeInvalid{Left,Right}OperandOfNumericOp mostly by typing, casting, idate --- htdocs/compta/tva/index.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/tva/index.php b/htdocs/compta/tva/index.php index db73cc25e56..994123bc0db 100644 --- a/htdocs/compta/tva/index.php +++ b/htdocs/compta/tva/index.php @@ -7,6 +7,7 @@ * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr> * Copyright (C) 2021 Open-Dsi <support@open-dsi.fr> + * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com> * * 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 @@ -464,12 +465,12 @@ if ($refresh === true) { //print $langs->trans("NA"); } else { if (isset($fields['payment_amount']) && price2num($fields['ftotal_ttc'])) { - $ratiopaymentinvoice = ($fields['payment_amount'] / $fields['ftotal_ttc']); + $ratiopaymentinvoice = ($fields['payment_amount'] / (float) $fields['ftotal_ttc']); } } } //var_dump('type='.$type.' '.$fields['totalht'].' '.$ratiopaymentinvoice); - $temp_ht = $fields['totalht'] * $ratiopaymentinvoice; + $temp_ht = (float) $fields['totalht'] * $ratiopaymentinvoice; $temp_vat = $fields['vat'] * $ratiopaymentinvoice; $subtot_paye_total_ht += $temp_ht; $subtot_paye_vat += $temp_vat; From 2ea00c10c0a27e83595fc6e6026b5bcb194a0667 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Sat, 23 Mar 2024 01:12:18 +0100 Subject: [PATCH 122/178] Fix PhanTypeInvalid{Left,Right}OperandOfNumericOp mostly by typing, casting, idate --- htdocs/compta/tva/quadri_detail.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/tva/quadri_detail.php b/htdocs/compta/tva/quadri_detail.php index 0873ab75072..441c6bee6cd 100644 --- a/htdocs/compta/tva/quadri_detail.php +++ b/htdocs/compta/tva/quadri_detail.php @@ -7,6 +7,7 @@ * Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2019 Eric Seigne <eric.seigne@cap-rel.fr> * Copyright (C) 2021-2022 Open-Dsi <support@open-dsi.fr> + * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com> * * 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 @@ -131,7 +132,7 @@ $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0, 0, '', $period .= ' - '; $period .= $form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzserver'); $prevyear = $date_start_year; -$q=0; +$q = 0; $prevquarter = $q; if ($prevquarter > 1) { $prevquarter--; @@ -684,13 +685,13 @@ if (!is_array($x_coll) || !is_array($x_paye)) { || ($type == 1 && getDolGlobalString('TAX_MODE_BUY_SERVICE') == 'invoice')) { } else { if (isset($fields['payment_amount']) && $fields['ftotal_ttc']) { - $ratiopaymentinvoice = ($fields['payment_amount'] / $fields['ftotal_ttc']); + $ratiopaymentinvoice = ($fields['payment_amount'] / (float) $fields['ftotal_ttc']); } } } // VAT paid - $temp_ht = $fields['totalht'] * $ratiopaymentinvoice; + $temp_ht = (float) $fields['totalht'] * $ratiopaymentinvoice; // VAT $temp_vat = $fields['vat'] * $ratiopaymentinvoice; @@ -787,7 +788,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) { print price($fields['totalht']); if (price2num($fields['ftotal_ttc'])) { //print $fields['dtotal_ttc']."/".$fields['ftotal_ttc']." - "; - $ratiolineinvoice = ($fields['dtotal_ttc'] / $fields['ftotal_ttc']); + $ratiolineinvoice = ((float) $fields['dtotal_ttc'] / (float) $fields['ftotal_ttc']); //print ' ('.round($ratiolineinvoice*100,2).'%)'; } print '</td>'; @@ -808,7 +809,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) { print $langs->trans("NA"); } else { if (isset($fields['payment_amount']) && $fields['ftotal_ttc']) { - $ratiopaymentinvoice = ($fields['payment_amount'] / $fields['ftotal_ttc']); + $ratiopaymentinvoice = ($fields['payment_amount'] / (float) $fields['ftotal_ttc']); } print price(price2num($fields['payment_amount'], 'MT')); if (isset($fields['payment_amount'])) { @@ -820,7 +821,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) { // VAT paid print '<td class="nowrap right">'; - $temp_ht = $fields['totalht'] * $ratiopaymentinvoice; + $temp_ht = (float) $fields['totalht'] * $ratiopaymentinvoice; print price(price2num($temp_ht, 'MT'), 1); print '</td>'; From 58ca5d112d01807c7fd10b849c4df25b2e31c714 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Sat, 23 Mar 2024 01:12:20 +0100 Subject: [PATCH 123/178] Fix PhanTypeInvalid{Left,Right}OperandOfNumericOp mostly by typing, casting, idate --- htdocs/contrat/card.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 5877525b7fe..97ce15937e2 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -551,11 +551,11 @@ if (empty($reshook)) { // Set unit price to use if (!empty($price_ht) || $price_ht === '0') { $pu_ht = price2num($price_ht, 'MU'); - $pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU'); + $pu_ttc = price2num((float) $pu_ht * (1 + ((float) $tmpvat / 100)), 'MU'); $price_base_type = 'HT'; } elseif (!empty($price_ttc) || $price_ttc === '0') { $pu_ttc = price2num($price_ttc, 'MU'); - $pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU'); + $pu_ht = price2num((float) $pu_ttc / (1 + ((float) $tmpvat / 100)), 'MU'); $price_base_type = 'TTC'; } @@ -591,11 +591,11 @@ if (empty($reshook)) { // Set unit price to use if (!empty($price_ht) || $price_ht === '0') { $pu_ht = price2num($price_ht, 'MU'); - $pu_ttc = price2num($pu_ht * (1 + ((float) $tmpvat / 100)), 'MU'); + $pu_ttc = price2num((float) $pu_ht * (1 + ((float) $tmpvat / 100)), 'MU'); $price_base_type = 'HT'; } elseif (!empty($price_ttc) || $price_ttc === '0') { $pu_ttc = price2num($price_ttc, 'MU'); - $pu_ht = price2num($pu_ttc / (1 + ((float) $tmpvat / 100)), 'MU'); + $pu_ht = price2num((float) $pu_ttc / (1 + ((float) $tmpvat / 100)), 'MU'); $price_base_type = 'TTC'; } } @@ -617,7 +617,7 @@ if (empty($reshook)) { } if (((getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !$user->hasRight('produit', 'ignore_price_min_advance')) - || !getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) && ($price_min && (price2num($pu_ht) * (1 - price2num($remise_percent) / 100) < price2num($price_min)))) { + || !getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) && ($price_min && ((float) price2num($pu_ht) * (1 - (float) price2num($remise_percent) / 100) < (float) price2num($price_min)))) { $object->error = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, -1, $conf->currency)); $result = -1; } else { @@ -769,7 +769,7 @@ if (empty($reshook)) { $price_ht = price2num(GETPOST('elprice'), 'MU'); $remise_percent = price2num(GETPOST('elremise_percent'), '', 2); if ($remise_percent > 0) { - $remise = round(($price_ht * $remise_percent / 100), 2); + $remise = round(((float) $price_ht * (float) $remise_percent / 100), 2); } $objectline->fk_product = GETPOSTINT('idprod'); From cb68c955041ecd059cb4b4d043bcd8271196a378 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Sat, 23 Mar 2024 01:12:23 +0100 Subject: [PATCH 124/178] Fix PhanTypeInvalid{Left,Right}OperandOfNumericOp mostly by typing, casting, idate --- htdocs/core/ajax/flowjs-server.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/ajax/flowjs-server.php b/htdocs/core/ajax/flowjs-server.php index 73617cbc008..dfe8b4ad2ce 100644 --- a/htdocs/core/ajax/flowjs-server.php +++ b/htdocs/core/ajax/flowjs-server.php @@ -1,5 +1,6 @@ <?php /* Copyright (C) 2023 Laurent Destailleur <eldy@users.sourceforge.net> + * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com> * * 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 @@ -162,10 +163,10 @@ function createFileFromChunks($temp_dir, $upload_dir, $fileName, $chunkSize, $to // check that all the parts are present // the size of the last part is between chunkSize and 2*$chunkSize - if ($total_files * $chunkSize >= ($totalSize - $chunkSize + 1)) { + if ($total_files * (float) $chunkSize >= ((float) $totalSize - (float) $chunkSize + 1)) { // create the final destination file if (($fp = fopen($upload_dir.'/'.$fileName, 'w')) !== false) { - for ($i=1; $i<=$total_files; $i++) { + for ($i = 1; $i <= $total_files; $i++) { fwrite($fp, file_get_contents($temp_dir.'/'.$fileName.'.part'.$i)); dol_syslog('writing chunk '.$i); } From 9607d8e45ab275e35a0f4b2e684f5c7799054cd4 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Sat, 23 Mar 2024 01:12:25 +0100 Subject: [PATCH 125/178] Fix PhanTypeInvalid{Left,Right}OperandOfNumericOp mostly by typing, casting, idate --- htdocs/core/boxes/box_birthdays.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/boxes/box_birthdays.php b/htdocs/core/boxes/box_birthdays.php index 3abab74e28a..050611acc00 100644 --- a/htdocs/core/boxes/box_birthdays.php +++ b/htdocs/core/boxes/box_birthdays.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2015 Frederic France <frederic.france@free.fr> + * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -121,7 +122,7 @@ class box_birthdays extends ModeleBoxes $userstatic->statut = $data[$j]->status; $dateb = $this->db->jdate($data[$j]->datea); - $age = date('Y', dol_now()) - date('Y', $dateb); + $age = idate('Y', dol_now()) - idate('Y', $dateb); $picb = '<i class="fas fa-birthday-cake inline-block"></i>'; $pice = '<i class="fas fa-briefcase inline-block"></i>'; From 0f186a582db48624bde07dda3f842a8a491af58e Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Sat, 23 Mar 2024 01:12:29 +0100 Subject: [PATCH 126/178] Fix PhanTypeInvalid{Left,Right}OperandOfNumericOp mostly by typing, casting, idate --- htdocs/core/boxes/box_birthdays_members.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/boxes/box_birthdays_members.php b/htdocs/core/boxes/box_birthdays_members.php index 8ac73aa4bd0..062eeb31506 100644 --- a/htdocs/core/boxes/box_birthdays_members.php +++ b/htdocs/core/boxes/box_birthdays_members.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2015-2023 Frederic France <frederic.france@netlogic.fr> + * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com> * * 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 @@ -115,7 +116,7 @@ class box_birthdays_members extends ModeleBoxes $memberstatic->datefin = $this->db->jdate($data[$j]->datefin); $dateb = $this->db->jdate($data[$j]->birth); - $age = date('Y', dol_now()) - date('Y', $dateb); + $age = idate('Y', dol_now()) - idate('Y', $dateb); $typea = '<i class="fas fa-birthday-cake inline-block"></i>'; From d9d09ce7e9a1f5917759fd9d582676569d1cef84 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Sat, 23 Mar 2024 01:12:31 +0100 Subject: [PATCH 127/178] Fix PhanTypeInvalid{Left,Right}OperandOfNumericOp mostly by typing, casting, idate --- htdocs/core/class/commondocgenerator.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index d8784d559e8..6d1a31a1677 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -856,7 +856,7 @@ abstract class CommonDocGenerator include_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; $object->list_delivery_methods($object->shipping_method_id); - $calculatedVolume = ((float) $object->trueWidth * (float) $object->trueHeight * $object->trueDepth); + $calculatedVolume = ((float) $object->trueWidth * (float) $object->trueHeight * (float) $object->trueDepth); $array_shipment = array( $array_key.'_id' => $object->id, From 886b4c8cc17c500c1102879bc5b0242fad997f0d Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Sat, 23 Mar 2024 01:12:33 +0100 Subject: [PATCH 128/178] Fix PhanTypeInvalid{Left,Right}OperandOfNumericOp mostly by typing, casting, idate --- htdocs/core/class/commonobject.class.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 41a9a69114d..1cfcea32108 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3861,7 +3861,7 @@ abstract class CommonObject if ($forcedroundingmode == '1') { // Check if we need adjustment onto line for vat. TODO This works on the company currency but not on foreign currency $tmpvat = price2num($total_ht_by_vats[$obj->vatrate] * $obj->vatrate / 100, 'MT', 1); - $diff = price2num($total_tva_by_vats[$obj->vatrate] - $tmpvat, 'MT', 1); + $diff = price2num($total_tva_by_vats[$obj->vatrate] - (float) $tmpvat, 'MT', 1); //print 'Line '.$i.' rowid='.$obj->rowid.' vat_rate='.$obj->vatrate.' total_ht='.$obj->total_ht.' total_tva='.$obj->total_tva.' total_ttc='.$obj->total_ttc.' total_ht_by_vats='.$total_ht_by_vats[$obj->vatrate].' total_tva_by_vats='.$total_tva_by_vats[$obj->vatrate].' (new calculation = '.$tmpvat.') total_ttc_by_vats='.$total_ttc_by_vats[$obj->vatrate].($diff?" => DIFF":"")."<br>\n"; if ($diff) { if (abs((float) $diff) > (10 * pow(10, -1 * getDolGlobalInt('MAIN_MAX_DECIMALS_TOT', 0)))) { @@ -3872,7 +3872,7 @@ abstract class CommonObject $error++; break; } - $sqlfix = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldtva." = ".price2num($obj->total_tva - $diff).", total_ttc = ".price2num($obj->total_ttc - $diff)." WHERE rowid = ".((int) $obj->rowid); + $sqlfix = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldtva." = ".price2num($obj->total_tva - (float) $diff).", total_ttc = ".price2num($obj->total_ttc - (float) $diff)." WHERE rowid = ".((int) $obj->rowid); dol_syslog('We found a difference of '.$diff.' for line rowid = '.$obj->rowid.". We fix the total_vat and total_ttc of line by running sqlfix = ".$sqlfix); $resqlfix = $this->db->query($sqlfix); @@ -3881,10 +3881,10 @@ abstract class CommonObject dol_print_error($this->db, 'Failed to update line'); } - $this->total_tva = (float) price2num($this->total_tva - $diff, '', 1); - $this->total_ttc = (float) price2num($this->total_ttc - $diff, '', 1); - $total_tva_by_vats[$obj->vatrate] = (float) price2num($total_tva_by_vats[$obj->vatrate] - $diff, '', 1); - $total_ttc_by_vats[$obj->vatrate] = (float) price2num($total_ttc_by_vats[$obj->vatrate] - $diff, '', 1); + $this->total_tva = (float) price2num($this->total_tva - (float) $diff, '', 1); + $this->total_ttc = (float) price2num($this->total_ttc - (float) $diff, '', 1); + $total_tva_by_vats[$obj->vatrate] = (float) price2num($total_tva_by_vats[$obj->vatrate] - (float) $diff, '', 1); + $total_ttc_by_vats[$obj->vatrate] = (float) price2num($total_ttc_by_vats[$obj->vatrate] - (float) $diff, '', 1); } } From 000af5da26d29d0fe3d2ae6f32e02335d8f6f5e1 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Sat, 23 Mar 2024 01:12:35 +0100 Subject: [PATCH 129/178] Fix PhanTypeInvalid{Left,Right}OperandOfNumericOp mostly by typing, casting, idate --- htdocs/core/lib/bank.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/bank.lib.php b/htdocs/core/lib/bank.lib.php index 5c22a696d6d..9cf971e6613 100644 --- a/htdocs/core/lib/bank.lib.php +++ b/htdocs/core/lib/bank.lib.php @@ -447,7 +447,7 @@ function checkES($IentOfi, $InumCta) $sum = 0; for ($i = 2; $i < 10; $i++) { - $sum += $values[$i] * substr($IentOfi, $i - 2, 1); + $sum += $values[$i] * (int) substr($IentOfi, $i - 2, 1); } $key = 11 - $sum % 11; From 3a45f5f4435928fd480658e9ca5b253db588ca45 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Sat, 23 Mar 2024 01:12:37 +0100 Subject: [PATCH 130/178] Fix PhanTypeInvalid{Left,Right}OperandOfNumericOp mostly by typing, casting, idate --- htdocs/core/lib/barcode.lib.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/lib/barcode.lib.php b/htdocs/core/lib/barcode.lib.php index 330585e18fb..ca18ed00cb1 100644 --- a/htdocs/core/lib/barcode.lib.php +++ b/htdocs/core/lib/barcode.lib.php @@ -468,7 +468,7 @@ function barcode_outimage($text, $bars, $scale = 1, $mode = "png", $total_y = 0, for ($i = 0; $i < $ln; $i++) { $val = strtolower($bars[$i]); if ($width) { - $xpos += $val * $scale; + $xpos += (float) $val * $scale; $width = false; continue; } @@ -479,7 +479,7 @@ function barcode_outimage($text, $bars, $scale = 1, $mode = "png", $total_y = 0, } else { $h = $height; } - imagefilledrectangle($im, $xpos, $space['top'], $xpos + ($val * $scale) - 1, $h, $col_bar); + imagefilledrectangle($im, $xpos, $space['top'], $xpos + (int) ((float) $val * $scale) - 1, $h, $col_bar); $xpos += $val * $scale; $width = true; } @@ -488,9 +488,9 @@ function barcode_outimage($text, $bars, $scale = 1, $mode = "png", $total_y = 0, foreach ($chars as $v) { if (trim($v)) { $inf = explode(":", $v); - $fontsize = $scale * ($inf[1] / 1.8); + $fontsize = $scale * ((float) $inf[1] / 1.8); $fontheight = (int) round($total_y - ($fontsize / 2.7) + 2); - imagettftext($im, $fontsize, 0, $space['left'] + ($scale * $inf[0]) + 2, $fontheight, $col_text, $font_loc, $inf[2]); + imagettftext($im, $fontsize, 0, $space['left'] + (int) ($scale * (float) $inf[0]) + 2, $fontheight, $col_text, $font_loc, $inf[2]); } } From b7112d8f5d092f84b06df05cae3f5338883d5690 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Sat, 23 Mar 2024 01:12:39 +0100 Subject: [PATCH 131/178] Fix PhanTypeInvalid{Left,Right}OperandOfNumericOp mostly by typing, casting, idate --- htdocs/core/lib/price.lib.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/core/lib/price.lib.php b/htdocs/core/lib/price.lib.php index 1faf1a0e828..844c975421d 100644 --- a/htdocs/core/lib/price.lib.php +++ b/htdocs/core/lib/price.lib.php @@ -280,23 +280,23 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt $result[6] = price2num($tot_sans_remise, 'MT'); $result[8] = price2num($tot_sans_remise * (1 + ((($info_bits & 1) ? 0 : $txtva) / 100)) + $localtaxes[0], 'MT'); // Selon TVA NPR ou non $result8bis = price2num($tot_sans_remise * (1 + ($txtva / 100)) + $localtaxes[0], 'MT'); // Si TVA consideree normal (non NPR) - $result[7] = price2num($result8bis - ((float) $result[6] + $localtaxes[0]), 'MT'); + $result[7] = price2num((float) $result8bis - ((float) $result[6] + $localtaxes[0]), 'MT'); $result[0] = price2num($tot_avec_remise, 'MT'); $result[2] = price2num($tot_avec_remise * (1 + ((($info_bits & 1) ? 0 : $txtva) / 100)) + $localtaxes[1], 'MT'); // Selon TVA NPR ou non $result2bis = price2num($tot_avec_remise * (1 + ($txtva / 100)) + $localtaxes[1], 'MT'); // Si TVA consideree normal (non NPR) - $result[1] = price2num($result2bis - ((float) $result[0] + $localtaxes[1]), 'MT'); // Total VAT = TTC - (HT + localtax) + $result[1] = price2num((float) $result2bis - ((float) $result[0] + $localtaxes[1]), 'MT'); // Total VAT = TTC - (HT + localtax) $result[3] = price2num($pu, 'MU'); $result[5] = price2num($pu * (1 + ((($info_bits & 1) ? 0 : $txtva) / 100)) + $localtaxes[2], 'MU'); // Selon TVA NPR ou non $result5bis = price2num($pu * (1 + ($txtva / 100)) + $localtaxes[2], 'MU'); // Si TVA consideree normal (non NPR) - $result[4] = price2num($result5bis - ((float) $result[3] + $localtaxes[2]), 'MU'); + $result[4] = price2num((float) $result5bis - ((float) $result[3] + $localtaxes[2]), 'MU'); } else { // We work to define prices using the price with tax $result[8] = price2num($tot_sans_remise + $localtaxes[0], 'MT'); $result[6] = price2num($tot_sans_remise / (1 + ((($info_bits & 1) ? 0 : $txtva) / 100)), 'MT'); // Selon TVA NPR ou non $result6bis = price2num($tot_sans_remise / (1 + ($txtva / 100)), 'MT'); // Si TVA consideree normal (non NPR) - $result[7] = price2num($result[8] - ((float) $result6bis + $localtaxes[0]), 'MT'); + $result[7] = price2num((float) $result[8] - ((float) $result6bis + $localtaxes[0]), 'MT'); $result[2] = price2num((float) $tot_avec_remise + (float) $localtaxes[1], 'MT'); $result[0] = price2num((float) $tot_avec_remise / (1 + ((($info_bits & 1) ? 0 : (float) $txtva) / 100)), 'MT'); // Selon TVA NPR ou non @@ -375,16 +375,16 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt // If rounding is not using base 10 (rare) if (getDolGlobalString('MAIN_ROUNDING_RULE_TOT')) { if ($price_base_type == 'HT') { - $result[0] = price2num(round((float) $result[0] / (float) $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT'); - $result[1] = price2num(round((float) $result[1] / (float) $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT'); - $result[9] = price2num(round((float) $result[9] / (float) $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT'); - $result[10] = price2num(round((float) $result[10] / (float) $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT'); + $result[0] = price2num(round((float) $result[0] / (float) $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * (float) $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT'); + $result[1] = price2num(round((float) $result[1] / (float) $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * (float) $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT'); + $result[9] = price2num(round((float) $result[9] / (float) $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * (float) $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT'); + $result[10] = price2num(round((float) $result[10] / (float) $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * (float) $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT'); $result[2] = price2num((float) $result[0] + (float) $result[1] + (float) $result[9] + (float) $result[10], 'MT'); } else { - $result[1] = price2num(round((float) $result[1] / (float) $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT'); - $result[2] = price2num(round((float) $result[2] / (float) $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT'); - $result[9] = price2num(round((float) $result[9] / (float) $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT'); - $result[10] = price2num(round((float) $result[10] / (float) $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT'); + $result[1] = price2num(round((float) $result[1] / (float) $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * (float) $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT'); + $result[2] = price2num(round((float) $result[2] / (float) $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * (float) $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT'); + $result[9] = price2num(round((float) $result[9] / (float) $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * (float) $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT'); + $result[10] = price2num(round((float) $result[10] / (float) $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * (float) $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT'); $result[0] = price2num((float) $result[2] - (float) $result[1] - (float) $result[9] - (float) $result[10], 'MT'); } } From 6502101546884f818b7201d1f26c41d4fbde64ec Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Sat, 23 Mar 2024 01:12:41 +0100 Subject: [PATCH 132/178] Fix PhanTypeInvalid{Left,Right}OperandOfNumericOp mostly by typing, casting, idate --- htdocs/core/lib/profid.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/profid.lib.php b/htdocs/core/lib/profid.lib.php index 18b787819bb..f4b54afb18b 100644 --- a/htdocs/core/lib/profid.lib.php +++ b/htdocs/core/lib/profid.lib.php @@ -204,7 +204,7 @@ function isValidTinForES($str) for ($i = 1; $i < 8; $i += 2) { $sum += intval(substr((string) (2 * (int) $num[$i]), 0, 1)) + intval(substr((string) (2 * (int) $num[$i]), 1, 1)); } - $n = 10 - substr((string) $sum, strlen((string) $sum) - 1, 1); + $n = 10 - (int) substr((string) $sum, strlen((string) $sum) - 1, 1); //Check special NIF if (preg_match('/^[KLM]{1}/', $str)) { From a5ed552a876d9c771771bf1f888b305208f45408 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Sat, 23 Mar 2024 01:12:43 +0100 Subject: [PATCH 133/178] Fix PhanTypeInvalid{Left,Right}OperandOfNumericOp mostly by typing, casting, idate --- htdocs/core/lib/project.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 578b5d9c7aa..a67e47d5d47 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -825,7 +825,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t $shtml = ''; if ($lines[$i]->planned_workload || $lines[$i]->duration_effective) { if ($lines[$i]->planned_workload) { - $s = round(100 * $lines[$i]->duration_effective / $lines[$i]->planned_workload, 2).' %'; + $s = round(100 * (float) $lines[$i]->duration_effective / (float) $lines[$i]->planned_workload, 2).' %'; $shtml = $s; } else { $s = $langs->trans('WorkloadNotDefined'); @@ -974,7 +974,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t $total_projectlinesa_spent_if_planned += $lines[$i]->duration_effective; } if ($lines[$i]->planned_workload) { - $total_projectlinesa_declared_if_planned += $lines[$i]->planned_workload * $lines[$i]->progress / 100; + $total_projectlinesa_declared_if_planned += (float) $lines[$i]->planned_workload * $lines[$i]->progress / 100; } } } else { From 7fe931c46f207ceb70ee9204c67c88334c0452ca Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Sat, 23 Mar 2024 01:12:45 +0100 Subject: [PATCH 134/178] Fix PhanTypeInvalid{Left,Right}OperandOfNumericOp mostly by typing, casting, idate --- htdocs/core/modules/expedition/doc/pdf_espadon.modules.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index 4bb1ac468e4..bde1187b00e 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -820,8 +820,8 @@ class pdf_espadon extends ModelePdfExpedition $totalToShip = $tmparray['toship']; // Set trueVolume and volume_units not currently stored into database if ($object->trueWidth && $object->trueHeight && $object->trueDepth) { - $object->trueVolume = $object->trueWidth * $object->trueHeight * $object->trueDepth; - $object->volume_units = $object->size_units * 3; + $object->trueVolume = (float) $object->trueWidth * (float) $object->trueHeight * (float) $object->trueDepth; + $object->volume_units = (float) $object->size_units * 3; } if ($totalWeight != '') { From c97e400b9d643ffbad02aad57cfa99a73cc830c4 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Sat, 23 Mar 2024 01:12:46 +0100 Subject: [PATCH 135/178] Fix PhanTypeInvalid{Left,Right}OperandOfNumericOp mostly by typing, casting, idate --- htdocs/core/modules/expedition/doc/pdf_rouget.modules.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index 76c2a1a93b1..3b440ea9615 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -694,8 +694,8 @@ class pdf_rouget extends ModelePdfExpedition $totalToShip = $tmparray['toship']; // Set trueVolume and volume_units not currently stored into database if ($object->trueWidth && $object->trueHeight && $object->trueDepth) { - $object->trueVolume = price(($object->trueWidth * $object->trueHeight * $object->trueDepth), 0, $outputlangs, 0, 0); - $object->volume_units = $object->size_units * 3; + $object->trueVolume = price(((float) $object->trueWidth * (float) $object->trueHeight * (float) $object->trueDepth), 0, $outputlangs, 0, 0); + $object->volume_units = (float) $object->size_units * 3; } if ($totalWeight != '') { From 35d2dd561160d10d6bf397a59609b42a89a9cc94 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Sat, 23 Mar 2024 01:12:48 +0100 Subject: [PATCH 136/178] Fix PhanTypeInvalid{Left,Right}OperandOfNumericOp mostly by typing, casting, idate --- htdocs/core/modules/reception/doc/pdf_squille.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/reception/doc/pdf_squille.modules.php b/htdocs/core/modules/reception/doc/pdf_squille.modules.php index 7faeeeeb1f9..6eaca2b4d01 100644 --- a/htdocs/core/modules/reception/doc/pdf_squille.modules.php +++ b/htdocs/core/modules/reception/doc/pdf_squille.modules.php @@ -688,7 +688,7 @@ class pdf_squille extends ModelePdfReception // Set trueVolume and volume_units not currently stored into database if ($object->trueWidth && $object->trueHeight && $object->trueDepth) { - $object->trueVolume = ($object->trueWidth * $object->trueHeight * $object->trueDepth); + $object->trueVolume = ((float) $object->trueWidth * (float) $object->trueHeight * (float) $object->trueDepth); $object->volume_units = $object->size_units * 3; } From c517a8008a609640b0dd5baeb9ff564a7740a7b6 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Sat, 23 Mar 2024 01:12:50 +0100 Subject: [PATCH 137/178] Fix PhanTypeInvalid{Left,Right}OperandOfNumericOp mostly by typing, casting, idate --- htdocs/expensereport/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index ed06c3b8f17..edd68aa6904 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -2003,7 +2003,7 @@ if ($action == 'create') { $totalpaid = price2num($totalpaid); // Round $totalpaid to fix floating problem after addition into loop } - $remaintopay = price2num($object->total_ttc - $totalpaid); + $remaintopay = price2num($object->total_ttc - (float) $totalpaid); $resteapayeraffiche = $remaintopay; $cssforamountpaymentcomplete = 'amountpaymentcomplete'; @@ -2154,7 +2154,7 @@ if ($action == 'create') { print price($line->value_unit_ht); } else { $tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $line->vatrate)); - $pricenettoshow = price2num($line->value_unit / (1 + $tmpvat / 100), 'MU'); + $pricenettoshow = price2num((float) $line->value_unit / (1 + $tmpvat / 100), 'MU'); print price($pricenettoshow); } print '</td>'; From eb01d15e78e063fcd05c3e24ef49693727347a09 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Sat, 23 Mar 2024 01:12:53 +0100 Subject: [PATCH 138/178] Fix PhanTypeInvalid{Left,Right}OperandOfNumericOp mostly by typing, casting, idate --- htdocs/fichinter/class/fichinter.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index d54497125c1..1624e74ff14 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -783,7 +783,7 @@ class Fichinter extends CommonObject $thm = $this->author->thm; foreach ($this->lines as $line) { - $amount += ($line->duration / 60 / 60 * $thm); + $amount += ($line->duration / 60 / 60 * (float) $thm); } return (float) price2num($amount, 'MT'); From ef894b0bec68468d386d907672690eb9b89767cb Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Sat, 23 Mar 2024 01:12:55 +0100 Subject: [PATCH 139/178] Fix PhanTypeInvalid{Left,Right}OperandOfNumericOp mostly by typing, casting, idate --- htdocs/fourn/facture/card.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 28c442eb5c6..c2aa985a103 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1161,7 +1161,7 @@ if (empty($reshook)) { if ($typeamount == 'amount') { $amount = $valuedeposit; } else { - $amount = $srcobject->total_ttc * ($valuedeposit / 100); + $amount = $srcobject->total_ttc * ((float) $valuedeposit / 100); } $TTotalByTva = array(); @@ -1198,7 +1198,7 @@ if (empty($reshook)) { if ($qualified) { $totalamount += $lines[$i]->total_ht; // Fixme : is it not for the customer ? Shouldn't we take total_ttc ? $tva_tx = $lines[$i]->tva_tx; - $amountdeposit[$tva_tx] += ($lines[$i]->total_ht * $valuedeposit) / 100; + $amountdeposit[$tva_tx] += ($lines[$i]->total_ht * (float) $valuedeposit) / 100; } } @@ -1790,7 +1790,7 @@ if (empty($reshook)) { $pu_ht = price2num($price_ht, 'MU'); // $pu_ht must be rounded according to settings } else { $pu_ttc = price2num(GETPOST('price_ttc'), 'MU'); - $pu_ht = price2num($pu_ttc / (1 + ($tva_tx / 100)), 'MU'); // $pu_ht must be rounded according to settings + $pu_ht = price2num((float) $pu_ttc / (1 + ((float) $tva_tx / 100)), 'MU'); // $pu_ht must be rounded according to settings } $price_base_type = 'HT'; $pu_devise = price2num($price_ht_devise, 'CU'); @@ -2915,7 +2915,7 @@ if ($action == 'create') { // TODO We should not need this. Also data comes from not reliable value of $object->multicurrency_total_ttc that may be wrong if it was // calculated by summing lines that were in a currency for some of them and into another for others (lines from discount/down payment into another currency for example) if ($resteapayer == 0 && $multicurrency_resteapayer != 0 && $object->multicurrency_code != $conf->currency) { - $resteapayer = price2num($multicurrency_resteapayer / $object->multicurrency_tx, 'MT'); + $resteapayer = price2num((float) $multicurrency_resteapayer / $object->multicurrency_tx, 'MT'); } } From d68dc69c92eb41d30b0b30c4969673fb9da94982 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Sat, 23 Mar 2024 01:12:59 +0100 Subject: [PATCH 140/178] Fix PhanTypeInvalid{Left,Right}OperandOfNumericOp mostly by typing, casting, idate --- htdocs/fourn/facture/paiement.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index b25825207db..f2143d5454c 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -698,7 +698,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print '<td class="right">'; if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) { - print price($sign * $multicurrency_remaintopay); + print price($sign * (float) $multicurrency_remaintopay); } print '</td>'; @@ -804,7 +804,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print '+'.price($totalrecudeposits); } print '</b></td>'; - print '<td class="right"><b>'.price($sign * price2num($total_ttc - $totalrecu - $totalrecucreditnote - $totalrecudeposits, 'MT')).'</b></td>'; + print '<td class="right"><b>'.price($sign * (float) price2num($total_ttc - $totalrecu - $totalrecucreditnote - $totalrecudeposits, 'MT')).'</b></td>'; print '<td class="center" id="result" style="font-weight: bold;"></td>'; // Autofilled print "</tr>\n"; } From 4c946725fb9a2eb034fa9a68b6f027407aa38096 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Sat, 23 Mar 2024 01:13:02 +0100 Subject: [PATCH 141/178] Fix PhanTypeInvalid{Left,Right}OperandOfNumericOp mostly by typing, casting, idate --- htdocs/margin/lib/margins.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/margin/lib/margins.lib.php b/htdocs/margin/lib/margins.lib.php index 8eaf9523c46..f6d94797387 100644 --- a/htdocs/margin/lib/margins.lib.php +++ b/htdocs/margin/lib/margins.lib.php @@ -145,7 +145,7 @@ function getMarginInfos($pv_ht, $remise_percent, $tva_tx, $localtax1_tx, $localt if ($pu_ht_remise < 0) { $marge = -1 * (abs((float) $pu_ht_remise) - $pa_ht_ret); } else { - $marge = $pu_ht_remise - $pa_ht_ret; + $marge = (float) $pu_ht_remise - $pa_ht_ret; } // calcul taux marge @@ -154,7 +154,7 @@ function getMarginInfos($pv_ht, $remise_percent, $tva_tx, $localtax1_tx, $localt } // calcul taux marque if ($pu_ht_remise != 0) { - $marque_tx_ret = (100 * $marge) / $pu_ht_remise; + $marque_tx_ret = (100 * $marge) / (float) $pu_ht_remise; } return array($pa_ht_ret, $marge_tx_ret, $marque_tx_ret); From 8c240a3337d41820c7e0a19323148cdddb770387 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Sat, 23 Mar 2024 01:13:05 +0100 Subject: [PATCH 142/178] Fix PhanTypeInvalid{Left,Right}OperandOfNumericOp mostly by typing, casting, idate --- htdocs/product/class/product.class.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 6fb66541fa3..3a09766af48 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1114,11 +1114,11 @@ class Product extends CommonObject // Automated compute surface and volume if not filled if (empty($this->surface) && !empty($this->length) && !empty($this->width) && $this->length_units == $this->width_units) { - $this->surface = $this->length * $this->width; + $this->surface = (float) $this->length * (float) $this->width; $this->surface_units = measuring_units_squared($this->length_units); } if (empty($this->volume) && !empty($this->surface) && !empty($this->height) && $this->length_units == $this->height_units) { - $this->volume = $this->surface * $this->height; + $this->volume = $this->surface * (float) $this->height; $this->volume_units = measuring_units_cubed($this->height_units); } @@ -2360,12 +2360,12 @@ class Product extends CommonObject if ($newprice !== '' || $newprice === 0) { if ($newpricebase == 'TTC') { $price_ttc = price2num($newprice, 'MU'); - $price = price2num($newprice) / (1 + ($newvat / 100)); + $price = (float) price2num($newprice) / (1 + ((float) $newvat / 100)); $price = price2num($price, 'MU'); if ($newminprice != '' || $newminprice == 0) { $price_min_ttc = price2num($newminprice, 'MU'); - $price_min = price2num($newminprice) / (1 + ($newvat / 100)); + $price_min = (float) price2num($newminprice) / (1 + ($newvat / 100)); $price_min = price2num($price_min, 'MU'); } else { $price_min = 0; @@ -2378,7 +2378,7 @@ class Product extends CommonObject if ($newminprice !== '' || $newminprice === 0) { $price_min = price2num($newminprice, 'MU'); - $price_min_ttc = price2num($newminprice) * (1 + ($newvat / 100)); + $price_min_ttc = (float) price2num($newminprice) * (1 + ($newvat / 100)); $price_min_ttc = price2num($price_min_ttc, 'MU'); //print 'X'.$newminprice.'-'.$price_min; } else { From df9794393a1abfbd5826832adec3da778a99a5f5 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Sat, 23 Mar 2024 01:13:07 +0100 Subject: [PATCH 143/178] Fix PhanTypeInvalid{Left,Right}OperandOfNumericOp mostly by typing, casting, idate --- htdocs/product/price.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 0ece26ed6d8..2ad194f3413 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -13,6 +13,7 @@ * Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com> + * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com> * * 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 @@ -566,11 +567,11 @@ if (empty($reshook)) { if (!$error) { // Calcul du prix HT et du prix unitaire if ($object->price_base_type == 'TTC') { - $price = price2num($newprice) / (1 + ($object->tva_tx / 100)); + $price = (float) price2num($newprice) / (1 + ($object->tva_tx / 100)); } $price = price2num($newprice, 'MU'); - $unitPrice = price2num($price / $quantity, 'MU'); + $unitPrice = price2num((float) $price / (float) $quantity, 'MU'); // Ajout / mise à jour if ($rowid > 0) { From 46ee9889b58c97f8a6b758250f19c9dae00bc0cf Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Sat, 23 Mar 2024 01:13:10 +0100 Subject: [PATCH 144/178] Fix PhanTypeInvalid{Left,Right}OperandOfNumericOp mostly by typing, casting, idate --- htdocs/public/stripe/ipn.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/public/stripe/ipn.php b/htdocs/public/stripe/ipn.php index ceba4a94a41..ed8dac838c5 100644 --- a/htdocs/public/stripe/ipn.php +++ b/htdocs/public/stripe/ipn.php @@ -243,7 +243,7 @@ if ($event->type == 'payout.created') { $typeto = 'VIR'; if (!$error) { - $bank_line_id_from = $accountfrom->addline($dateo, $typefrom, $label, -1 * price2num($amount), '', '', $user); + $bank_line_id_from = $accountfrom->addline($dateo, $typefrom, $label, -1 * (float) price2num($amount), '', '', $user); } if (!($bank_line_id_from > 0)) { $error++; From 911a2c05adf55833acce16ca0c79d0873e4813d4 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Sat, 23 Mar 2024 01:13:13 +0100 Subject: [PATCH 145/178] Fix PhanTypeInvalid{Left,Right}OperandOfNumericOp mostly by typing, casting, idate --- htdocs/supplier_proposal/class/supplier_proposal.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 503f99b65aa..9ba40dbacf0 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -550,7 +550,7 @@ class SupplierProposal extends CommonObject $price = $pu; $remise = 0; if ($remise_percent > 0) { - $remise = round(($pu * $remise_percent / 100), 2); + $remise = round(($pu * (float) $remise_percent / 100), 2); $price = $pu - $remise; } From 27091da3f3e29973bcde8b652b4bc1dec5948166 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Sat, 23 Mar 2024 01:18:47 +0100 Subject: [PATCH 146/178] Qual: Enable lidLeftOperandOfNumericOp --- dev/tools/phan/config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tools/phan/config.php b/dev/tools/phan/config.php index ee08ff3b561..f477b500b20 100644 --- a/dev/tools/phan/config.php +++ b/dev/tools/phan/config.php @@ -473,7 +473,7 @@ return [ // 'PhanPluginRedundantAssignment', 'PhanTypeExpectedObjectPropAccess', - 'PhanTypeInvalidRightOperandOfNumericOp', + // 'PhanTypeInvalidRightOperandOfNumericOp', // 'PhanPluginInlineHTML', // 'PhanPluginInlineHTMLTrailing', // 'PhanPluginUnknownFunctionReturnType', From f96819398f678acf4937347f00dc44e560ccfe75 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Sat, 23 Mar 2024 02:54:57 +0100 Subject: [PATCH 147/178] Add stub for multicompany --- dev/tools/phan/stubs/multicompany.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 dev/tools/phan/stubs/multicompany.php diff --git a/dev/tools/phan/stubs/multicompany.php b/dev/tools/phan/stubs/multicompany.php new file mode 100644 index 00000000000..db62b11c722 --- /dev/null +++ b/dev/tools/phan/stubs/multicompany.php @@ -0,0 +1,20 @@ +<?php +/* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com> + */ +class ActionsMulticompany +{ + /** + * @param DoliDB $db + */ + public function __construct($db) + { + } + /** @ver string */ + public $id; + /** @ver string */ + public $label; + /** @var array{stock:string[],referent:string} */ + public $sharings; + /** @ver DoliDB */ + public $db; +} From 09b931e8fc852c92dfd8161710e45134d39b19d0 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Sat, 23 Mar 2024 02:57:38 +0100 Subject: [PATCH 148/178] Qual: Enable PhanUndeclaredClassProperty --- dev/tools/phan/config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tools/phan/config.php b/dev/tools/phan/config.php index f477b500b20..96fa1ad14de 100644 --- a/dev/tools/phan/config.php +++ b/dev/tools/phan/config.php @@ -608,7 +608,7 @@ return [ // 'PhanPluginAlwaysReturnMethod', // 'PhanPluginMissingReturnMethod', // 'PhanUndeclaredTypeReturnType', - 'PhanUndeclaredClassProperty', + // 'PhanUndeclaredClassProperty', 'PhanTypeArraySuspiciousNullable', // 'PhanPluginInconsistentReturnMethod', 'PhanTypeExpectedObjectPropAccessButGotNull', From dc3a46c88defa05568ab369691a2d98de26751d9 Mon Sep 17 00:00:00 2001 From: Jon Bendtsen <xcodeauthor@jonb.dk> Date: Sat, 23 Mar 2024 11:18:04 +0100 Subject: [PATCH 149/178] bug fix that allowed to view /user/bank.php?id= for any other user id (salaries read -> readall. + allowing user to edit their own bank account as well as personal email and phone. + allowing user to change their own bank account and allow useradmin to add a bank account for a user --- htdocs/user/bank.php | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php index 9e3af3968c0..616e9198e7e 100644 --- a/htdocs/user/bank.php +++ b/htdocs/user/bank.php @@ -85,19 +85,21 @@ if (empty($account->userid)) { } // Define value to know what current user can do on users +$selfpermission = ( $user->id == $id && $user->hasRight('user', 'self', 'creer')); $canadduser = (!empty($user->admin) || $user->hasRight('user', 'user', 'creer') || $user->hasRight('hrm', 'write_personal_information', 'write') ); $canreaduser = (!empty($user->admin) || $user->hasRight('user', 'user', 'lire') || $user->hasRight('hrm', 'read_personal_information', 'read') ); -$permissiontoaddbankaccount = ($user->hasRight('salaries', 'write') || $user->hasRight('hrm', 'employee', 'write') || $user->hasRight('user', 'user', 'creer') || $user->hasRight('user', 'self', 'creer')); +$permissiontoaddbankaccount = ($user->hasRight('salaries', 'write') || $user->hasRight('hrm', 'employee', 'write') || $user->hasRight('user', 'user', 'creer') || $selfpermission); $permissiontoreadhr = $user->hasRight('hrm', 'read_personal_information', 'read') || $user->hasRight('hrm', 'write_personal_information', 'write'); $permissiontowritehr = $user->hasRight('hrm', 'write_personal_information', 'write'); +$permissiontosimpleedit = ( $selfpermission || $canadduser ); -// Ok if user->hasRight('salaries', 'read') or user->hasRight('hrm', 'read') +// Ok if user->hasRight('salaries', 'readall') or user->hasRight('hrm', 'read') //$result = restrictedArea($user, 'salaries|hrm', $object->id, 'user&user', $feature2); $ok = false; if ($user->id == $id) { $ok = true; // A user can always read its own card } -if ($user->hasRight('salaries', 'read')) { +if ($user->hasRight('salaries', 'readall')) { $ok = true; } if ($user->hasRight('hrm', 'read')) { @@ -201,7 +203,7 @@ if ($action == 'setbirth' && $canadduser && !$cancel) { } // update personal email -if ($action == 'setpersonal_email' && $canadduser && !$cancel) { +if ($action == 'setpersonal_email' && $permissiontosimpleedit && !$cancel) { $object->personal_email = (string) GETPOST('personal_email', 'alphanohtml'); $result = $object->update($user); if ($result < 0) { @@ -210,7 +212,7 @@ if ($action == 'setpersonal_email' && $canadduser && !$cancel) { } // update personal mobile -if ($action == 'setpersonal_mobile' && $canadduser && !$cancel) { +if ($action == 'setpersonal_mobile' && $permissiontosimpleedit && !$cancel) { $object->personal_mobile = (string) GETPOST('personal_mobile', 'alphanohtml'); $result = $object->update($user); if ($result < 0) { @@ -493,7 +495,7 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac } // Personal email - if ($user->hasRight('hrm', 'read_personal_information', 'read') || $user->hasRight('hrm', 'write_personal_information', 'write')) { + if ($user->hasRight('hrm', 'read_personal_information', 'read') || $user->hasRight('hrm', 'write_personal_information', 'write') || $permissiontosimpleedit) { print '<tr class="nowrap">'; print '<td>'; print $form->editfieldkey("UserPersonalEmail", 'personal_email', $object->personal_email, $object, $user->hasRight('user', 'user', 'creer') || $user->hasRight('hrm', 'write_personal_information', 'write')); @@ -504,7 +506,7 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac } // Personal phone - if ($user->hasRight('hrm', 'read_personal_information', 'read') || $user->hasRight('hrm', 'write_personal_information', 'write')) { + if ($user->hasRight('hrm', 'read_personal_information', 'read') || $user->hasRight('hrm', 'write_personal_information', 'write') || $permissiontosimpleedit) { print '<tr class="nowrap">'; print '<td>'; print $form->editfieldkey("UserPersonalMobile", 'personal_mobile', $object->personal_mobile, $object, $user->hasRight('user', 'user', 'creer') || $user->hasRight('hrm', 'write_personal_information', 'write')); @@ -895,7 +897,7 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac } // Edit -if ($id && ($action == 'edit' || $action == 'create') && $user->hasRight('user', 'user', 'creer')) { +if ($id && ($action == 'edit' || $action == 'create') && $permissiontoaddbankaccount) { $title = $langs->trans("User"); print dol_get_fiche_head($head, 'bank', $title, 0, 'user'); @@ -1030,11 +1032,11 @@ if ($id && ($action == 'edit' || $action == 'create') && $user->hasRight('user', print $form->buttonsSaveCancel($action == 'create' ? "Create" : "Modify"); } -if ($id && $action == 'edit' && $user->hasRight('user', 'user', 'creer')) { +if ($id && $action == 'edit' && $permissiontoaddbankaccount) { print '</form>'; } -if ($id && $action == 'create' && $user->hasRight('user', 'user', 'creer')) { +if ($id && $action == 'create' && $permissiontoaddbankaccount) { print '</form>'; } From 4857c6e33982b33727330225deda024dd1f4a7b4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Sat, 23 Mar 2024 11:58:55 +0100 Subject: [PATCH 150/178] FIX navigation after filter in subaccount --- htdocs/accountancy/admin/subaccount.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/htdocs/accountancy/admin/subaccount.php b/htdocs/accountancy/admin/subaccount.php index 188915b0ec0..8c9a493a258 100644 --- a/htdocs/accountancy/admin/subaccount.php +++ b/htdocs/accountancy/admin/subaccount.php @@ -128,6 +128,7 @@ $form = new Form($db); // Page Header $help_url = 'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilité_en_Partie_Double#Configuration'; $title = $langs->trans('ChartOfIndividualAccountsOfSubsidiaryLedger'); + llxHeader('', $title, $help_url); @@ -300,14 +301,17 @@ if ($resql) { if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.((int) $limit); } + if ($optioncss != '') { + $param .= '&optioncss='.urlencode($optioncss); + } if ($search_subaccount) { $param .= '&search_subaccount='.urlencode($search_subaccount); } if ($search_label) { $param .= '&search_label='.urlencode($search_label); } - if ($optioncss != '') { - $param .= '&optioncss='.urlencode($optioncss); + if ($search_type) { + $param .= '&search_type='.urlencode($search_type); } // List of mass actions available @@ -373,7 +377,7 @@ if ($resql) { print '<tr class="liste_titre">'; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'center maxwidthsearch '); } if (!empty($arrayfields['subaccount']['checked'])) { print_liste_field_titre($arrayfields['subaccount']['label'], $_SERVER["PHP_SELF"], "subaccount", "", $param, '', $sortfield, $sortorder); @@ -391,7 +395,7 @@ if ($resql) { } // Action column if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'center maxwidthsearch '); } print "</tr>\n"; From 1282e6840e95710804458bafded99238cb7fefc5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Sat, 23 Mar 2024 11:58:55 +0100 Subject: [PATCH 151/178] FIX navigation after filter in subaccount --- htdocs/accountancy/admin/subaccount.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/htdocs/accountancy/admin/subaccount.php b/htdocs/accountancy/admin/subaccount.php index fb9a61e36d0..38e672e132d 100644 --- a/htdocs/accountancy/admin/subaccount.php +++ b/htdocs/accountancy/admin/subaccount.php @@ -128,6 +128,7 @@ $form = new Form($db); // Page Header $help_url = 'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilité_en_Partie_Double#Configuration'; $title = $langs->trans('ChartOfIndividualAccountsOfSubsidiaryLedger'); + llxHeader('', $title, $help_url); @@ -300,14 +301,17 @@ if ($resql) { if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.((int) $limit); } + if ($optioncss != '') { + $param .= '&optioncss='.urlencode($optioncss); + } if ($search_subaccount) { $param .= '&search_subaccount='.urlencode($search_subaccount); } if ($search_label) { $param .= '&search_label='.urlencode($search_label); } - if ($optioncss != '') { - $param .= '&optioncss='.urlencode($optioncss); + if ($search_type) { + $param .= '&search_type='.urlencode($search_type); } // List of mass actions available @@ -373,7 +377,7 @@ if ($resql) { print '<tr class="liste_titre">'; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'center maxwidthsearch '); } if (!empty($arrayfields['subaccount']['checked'])) { print_liste_field_titre($arrayfields['subaccount']['label'], $_SERVER["PHP_SELF"], "subaccount", "", $param, '', $sortfield, $sortorder); @@ -391,7 +395,7 @@ if ($resql) { } // Action column if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'center maxwidthsearch '); } print "</tr>\n"; From 06bbdf2a67126ac2f58ef18f9dfc4f612d679505 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Sat, 23 Mar 2024 12:25:28 +0100 Subject: [PATCH 152/178] Debug v20 --- htdocs/accountancy/bookkeeping/export.php | 66 ++++++++++++++--------- htdocs/core/ajax/ajaxtooltip.php | 2 +- 2 files changed, 42 insertions(+), 26 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/export.php b/htdocs/accountancy/bookkeeping/export.php index cb9e8ea09d4..438b45dc9b8 100644 --- a/htdocs/accountancy/bookkeeping/export.php +++ b/htdocs/accountancy/bookkeeping/export.php @@ -845,7 +845,7 @@ if ($action == 'export_file') { ); } - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans("ExportFilteredList").'...', $langs->trans('ConfirmExportFile'), 'export_fileconfirm', $form_question, '', 1, 420, 600); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans("ExportFilteredList").'...', $langs->trans('ConfirmExportFile'), 'export_fileconfirm', $form_question, '', 1, 390, 700); } // Print form confirm @@ -924,12 +924,15 @@ if ($massactionbutton && $contextpage != 'poslist') { } $moreforfilter = ''; -$moreforfilter .= '<div class="divsearchfield">'; -$moreforfilter .= $langs->trans('AccountingCategory').': '; -$moreforfilter .= '<div class="nowrap inline-block">'; -$moreforfilter .= $formaccounting->select_accounting_category($search_account_category, 'search_account_category', 1, 0, 0, 0); -$moreforfilter .= '</div>'; -$moreforfilter .= '</div>'; + +if (!empty($search_account_category)) { + $moreforfilter .= '<div class="divsearchfield">'; + $moreforfilter .= $langs->trans('AccountingCategory').': '; + $moreforfilter .= '<div class="nowrap inline-block">'; + $moreforfilter .= $formaccounting->select_accounting_category($search_account_category, 'search_account_category', 1, 0, 0, 0); + $moreforfilter .= '</div>'; + $moreforfilter .= '</div>'; +} $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook @@ -939,9 +942,11 @@ if (empty($reshook)) { $moreforfilter = $hookmanager->resPrint; } -print '<div class="liste_titre liste_titre_bydiv centpercent">'; -print $moreforfilter; -print '</div>'; +if ($moreforfilter) { + print '<div class="liste_titre liste_titre_bydiv centpercent">'; + print $moreforfilter; + print '</div>'; +} print '<div class="div-table-responsive">'; print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'; @@ -1257,6 +1262,7 @@ while ($i < min($num, $limit)) { // Document ref if (!empty($arrayfields['t.doc_ref']['checked'])) { + $documentlink = ''; if ($line->doc_type == 'customer_invoice') { $langs->loadLangs(array('bills')); @@ -1265,10 +1271,12 @@ while ($i < min($num, $limit)) { $objectstatic->fetch($line->fk_doc); //$modulepart = 'facture'; - $filename = dol_sanitizeFileName($line->doc_ref); - $filedir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($line->doc_ref); - $urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id; - $documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); + if ($objectstatic->id > 0) { + $filename = dol_sanitizeFileName($line->doc_ref); + $filedir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($line->doc_ref); + $urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id; + $documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); + } } elseif ($line->doc_type == 'supplier_invoice') { $langs->loadLangs(array('bills')); @@ -1277,10 +1285,12 @@ while ($i < min($num, $limit)) { $objectstatic->fetch($line->fk_doc); //$modulepart = 'invoice_supplier'; - $filename = dol_sanitizeFileName($line->doc_ref); - $filedir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($line->fk_doc, 2, 0, 0, $objectstatic, $modulepart).dol_sanitizeFileName($line->doc_ref); - $subdir = get_exdir($objectstatic->id, 2, 0, 0, $objectstatic, $modulepart).dol_sanitizeFileName($line->doc_ref); - $documentlink = $formfile->getDocumentsLink($objectstatic->element, $subdir, $filedir); + if ($objectstatic->id > 0) { + $filename = dol_sanitizeFileName($line->doc_ref); + $filedir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($line->fk_doc, 2, 0, 0, $objectstatic, $modulepart).dol_sanitizeFileName($line->doc_ref); + $subdir = get_exdir($objectstatic->id, 2, 0, 0, $objectstatic, $modulepart).dol_sanitizeFileName($line->doc_ref); + $documentlink = $formfile->getDocumentsLink($objectstatic->element, $subdir, $filedir); + } } elseif ($line->doc_type == 'expense_report') { $langs->loadLangs(array('trips')); @@ -1289,10 +1299,12 @@ while ($i < min($num, $limit)) { $objectstatic->fetch($line->fk_doc); //$modulepart = 'expensereport'; - $filename = dol_sanitizeFileName($line->doc_ref); - $filedir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($line->doc_ref); - $urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id; - $documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); + if ($objectstatic->id > 0) { + $filename = dol_sanitizeFileName($line->doc_ref); + $filedir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($line->doc_ref); + $urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id; + $documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); + } } elseif ($line->doc_type == 'bank') { require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; $objectstatic = new AccountLine($db); @@ -1304,9 +1316,13 @@ while ($i < min($num, $limit)) { $labeltoshow = ''; $labeltoshowalt = ''; if ($line->doc_type == 'customer_invoice' || $line->doc_type == 'supplier_invoice' || $line->doc_type == 'expense_report') { - $labeltoshow .= $objectstatic->getNomUrl(1, '', 0, 0, '', 0, -1, 1); - $labeltoshow .= $documentlink; - $labeltoshowalt .= $objectstatic->ref; + if ($objectstatic->id > 0) { + $labeltoshow .= $objectstatic->getNomUrl(1, '', 0, 0, '', 0, -1, 1); + $labeltoshow .= $documentlink; + $labeltoshowalt .= $objectstatic->ref; + } else { + $labeltoshow = '<span class="opacitymedium">'.$langs->trans("Deleted").'</span>'; + } } elseif ($line->doc_type == 'bank') { $labeltoshow .= $objectstatic->getNomUrl(1); $labeltoshowalt .= $objectstatic->ref; diff --git a/htdocs/core/ajax/ajaxtooltip.php b/htdocs/core/ajax/ajaxtooltip.php index 782123ca317..8bc7305d744 100644 --- a/htdocs/core/ajax/ajaxtooltip.php +++ b/htdocs/core/ajax/ajaxtooltip.php @@ -85,7 +85,7 @@ if (is_object($object)) { if ($object->id > 0 || !empty($object->ref)) { /** @var CommonObject $object */ $html = $object->getTooltipContent($params); - } elseif ($res == 0) { + } elseif ($id > 0) { $html = $langs->trans('Deleted'); } unset($object); From f2a96ed529a02e3baec0fe690f1c3867bb3ba5d2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Sat, 23 Mar 2024 12:30:52 +0100 Subject: [PATCH 153/178] css --- htdocs/accountancy/bookkeeping/export.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/export.php b/htdocs/accountancy/bookkeeping/export.php index 438b45dc9b8..72aee30478d 100644 --- a/htdocs/accountancy/bookkeeping/export.php +++ b/htdocs/accountancy/bookkeeping/export.php @@ -726,7 +726,7 @@ if ($action == 'export_fileconfirm' && $user->hasRight('accounting', 'mouvements setEventMessages('', $accountancyexport->errors, 'errors'); header('Location: '.$_SERVER['PHP_SELF']); } - exit(); // download or show errors + exit(0); // download or show errors } @@ -1004,10 +1004,10 @@ if (!empty($arrayfields['t.subledger_account']['checked'])) { if (getDolGlobalString('ACCOUNTANCY_COMBO_FOR_AUX')) { print '<div class="nowrap">'; //print $langs->trans('From').' '; - print $formaccounting->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', $langs->trans('From'), 'maxwidth250', 'subledgeraccount'); + print $formaccounting->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', $langs->trans('From'), 'maxwidth150', 'subledgeraccount'); print '</div>'; print '<div class="nowrap">'; - print $formaccounting->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', $langs->trans('to'), 'maxwidth250', 'subledgeraccount'); + print $formaccounting->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', $langs->trans('to'), 'maxwidth150', 'subledgeraccount'); print '</div>'; } else { print '<input type="text" class="maxwidth75" name="search_accountancy_aux_code" value="'.dol_escape_htmltag($search_accountancy_aux_code).'">'; From 30b7ae336f774ebbf3dad076c129078f7c811da0 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Sat, 23 Mar 2024 13:14:35 +0100 Subject: [PATCH 154/178] Qual: Enable dev/tools/phan/config.php --- dev/tools/phan/config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tools/phan/config.php b/dev/tools/phan/config.php index 96fa1ad14de..32572fea8fa 100644 --- a/dev/tools/phan/config.php +++ b/dev/tools/phan/config.php @@ -600,7 +600,7 @@ return [ // 'PhanPluginUnreachableCode', // 'PhanTypeMismatchArgumentInternal', // 'PhanPluginAlwaysReturnMethod', - 'PhanUndeclaredClassMethod', + // 'PhanUndeclaredClassMethod', 'PhanUndeclaredMethod', 'PhanTypeMismatchArgumentProbablyReal', 'PhanPluginDuplicateExpressionAssignmentOperation', // Suggestions for optimisation From 3aaa4ef0707f3337688a34adda12e12daa5e2901 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Sat, 23 Mar 2024 13:31:49 +0100 Subject: [PATCH 155/178] Debug v20 --- htdocs/blockedlog/admin/blockedlog_list.php | 27 +++++++++------------ 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/htdocs/blockedlog/admin/blockedlog_list.php b/htdocs/blockedlog/admin/blockedlog_list.php index bb385e34984..fb8f92d9e12 100644 --- a/htdocs/blockedlog/admin/blockedlog_list.php +++ b/htdocs/blockedlog/admin/blockedlog_list.php @@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php'; require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/authority.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; // Load translation files required by the page $langs->loadLangs(array('admin', 'bills', 'blockedlog', 'other')); @@ -154,7 +155,10 @@ if ($action === 'downloadblockchain') { $previoushash = ''; $firstid = ''; - if (!$error) { + if (! (GETPOSTINT('yeartoexport') > 0)) { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Year")), null, "errors"); + $error++; + } else { // Get ID of first line $sql = "SELECT rowid,date_creation,tms,user_fullname,action,amounts,element,fk_object,date_object,ref_object,signature,fk_user,object_data"; $sql .= " FROM ".MAIN_DB_PREFIX."blockedlog"; @@ -292,6 +296,7 @@ if ($action === 'downloadblockchain') { */ $form = new Form($db); +$formother = new FormOther($db); if (GETPOST('withtab', 'alpha')) { $title = $langs->trans("ModuleSetup").' '.$langs->trans('BlockedLog'); @@ -379,19 +384,9 @@ print '<input type="hidden" name="token" value="'.newToken().'">'; print '<div class="right">'; print $langs->trans("RestrictYearToExport").': '; -$smonth = GETPOSTINT('monthtoexport'); // Month -$retstring = ''; -$retstring .= '<select class="flat valignmiddle maxwidth75imp marginrightonly" id="monthtoexport" name="monthtoexport">'; -$retstring .= '<option value="0" selected> </option>'; -for ($month = 1; $month <= 12; $month++) { - $retstring .= '<option value="'.$month.'"'.($month == $smonth ? ' selected' : '').'>'; - $retstring .= dol_print_date(mktime(12, 0, 0, $month, 1, 2000), "%b"); - $retstring .= "</option>"; -} -$retstring .= "</select>"; -print $retstring; -print '<input type="text" name="yeartoexport" class="valignmiddle maxwidth50imp" value="'.GETPOSTINT('yeartoexport').'">'; +print $formother->select_month(GETPOSTINT('monthtoexport'), 'monthtoexport', 1, 0, 'minwidth50 maxwidth75imp valignmiddle', true); +print '<input type="text" name="yeartoexport" class="valignmiddle maxwidth50imp" value="'.GETPOST('yeartoexport').'" placeholder="'.$langs->trans("Year").'">'; print '<input type="hidden" name="withtab" value="'.GETPOST('withtab', 'alpha').'">'; print '<input type="submit" name="downloadcsv" class="button" value="'.$langs->trans('DownloadLogCSV').'">'; if (getDolGlobalString('BLOCKEDLOG_USE_REMOTE_AUTHORITY')) { @@ -416,7 +411,7 @@ print '<input type="hidden" name="contextpage" value="'.$contextpage.'">'; print '<input type="hidden" name="withtab" value="'.GETPOST('withtab', 'alpha').'">'; print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table -print '<table class="noborder centpercent">'; +print '<table class="noborder centpercent liste">'; // Line of filters print '<tr class="liste_titre_filter">'; @@ -465,9 +460,9 @@ print '<td class="liste_titre"></td>'; print '<td class="liste_titre"></td>'; // Status -print '<td class="liste_titre">'; +print '<td class="liste_titre center minwidth75imp parentonrightofpage">'; $array = array("1" => "OnlyNonValid"); -print $form->selectarray('search_showonlyerrors', $array, $search_showonlyerrors, 1, 0, 0, '', 1, 0, 0, 'ASC', 'search_status maxwidth200 onrightofpage', 1); +print $form->selectarray('search_showonlyerrors', $array, $search_showonlyerrors, 1, 0, 0, '', 1, 0, 0, 'ASC', 'search_status width100 onrightofpage', 1); print '</td>'; // Status note From 2a13f7134ce4cbc01d463cf0b85e36bcd57764bb Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Sat, 23 Mar 2024 14:29:54 +0100 Subject: [PATCH 156/178] Qual: Add extra phan stubs fixing PhanUndeclaredClassMethod --- dev/tools/phan/config.php | 3 + dev/tools/phan/config_extended.php | 3 + dev/tools/phan/config_fixer.php | 3 + dev/tools/phan/stubs/imagick.phan_php | 1216 +++++++++++++++++++++++ dev/tools/phan/stubs/memcached.phan_php | 180 ++++ dev/tools/phan/stubs/tidy.phan_php | 244 +++++ 6 files changed, 1649 insertions(+) create mode 100644 dev/tools/phan/stubs/imagick.phan_php create mode 100644 dev/tools/phan/stubs/memcached.phan_php create mode 100644 dev/tools/phan/stubs/tidy.phan_php diff --git a/dev/tools/phan/config.php b/dev/tools/phan/config.php index 32572fea8fa..5de8de73754 100644 --- a/dev/tools/phan/config.php +++ b/dev/tools/phan/config.php @@ -643,11 +643,13 @@ return [ 'ftp' => PHAN_DIR . '/stubs/ftp.phan_php', 'gd' => PHAN_DIR . '/stubs/gd.phan_php', 'geoip' => PHAN_DIR . '/stubs/geoip.phan_php', + 'imagick' => PHAN_DIR . '/stubs/imagick.phan_php', 'imap' => PHAN_DIR . '/stubs/imap.phan_php', 'intl' => PHAN_DIR . '/stubs/intl.phan_php', 'ldap' => PHAN_DIR . '/stubs/ldap.phan_php', 'mcrypt' => PHAN_DIR . '/stubs/mcrypt.phan_php', 'memcache' => PHAN_DIR . '/stubs/memcache.phan_php', + 'memcached' => PHAN_DIR . '/stubs/memcached.phan_php', 'mysqli' => PHAN_DIR . '/stubs/mysqli.phan_php', 'pdo_cubrid' => PHAN_DIR . '/stubs/pdo_cubrid.phan_php', 'pdo_mysql' => PHAN_DIR . '/stubs/pdo_mysql.phan_php', @@ -658,6 +660,7 @@ return [ 'simplexml' => PHAN_DIR . '/stubs/SimpleXML.phan_php', 'soap' => PHAN_DIR . '/stubs/soap.phan_php', 'sockets' => PHAN_DIR . '/stubs/sockets.phan_php', + 'tidy' => PHAN_DIR . '/stubs/tidy.phan_php', 'zip' => PHAN_DIR . '/stubs/zip.phan_php', ], ]; diff --git a/dev/tools/phan/config_extended.php b/dev/tools/phan/config_extended.php index b5f0123526c..6fdb39c0621 100644 --- a/dev/tools/phan/config_extended.php +++ b/dev/tools/phan/config_extended.php @@ -397,10 +397,12 @@ return [ 'gd' => PHAN_DIR . '/stubs/gd.phan_php', 'geoip' => PHAN_DIR . '/stubs/geoip.phan_php', 'imap' => PHAN_DIR . '/stubs/imap.phan_php', + 'imagick' => PHAN_DIR . '/stubs/imagick.phan_php', 'intl' => PHAN_DIR . '/stubs/intl.phan_php', 'ldap' => PHAN_DIR . '/stubs/ldap.phan_php', 'mcrypt' => PHAN_DIR . '/stubs/mcrypt.phan_php', 'memcache' => PHAN_DIR . '/stubs/memcache.phan_php', + 'memcached' => PHAN_DIR . '/stubs/memcached.phan_php', 'mysqli' => PHAN_DIR . '/stubs/mysqli.phan_php', 'pdo_cubrid' => PHAN_DIR . '/stubs/pdo_cubrid.phan_php', 'pdo_mysql' => PHAN_DIR . '/stubs/pdo_mysql.phan_php', @@ -411,6 +413,7 @@ return [ 'simplexml' => PHAN_DIR . '/stubs/SimpleXML.phan_php', 'soap' => PHAN_DIR . '/stubs/soap.phan_php', 'sockets' => PHAN_DIR . '/stubs/sockets.phan_php', + 'tidy' => PHAN_DIR . '/stubs/tidy.phan_php', 'zip' => PHAN_DIR . '/stubs/zip.phan_php', ], diff --git a/dev/tools/phan/config_fixer.php b/dev/tools/phan/config_fixer.php index b12c94d6468..5df01eb7ae6 100644 --- a/dev/tools/phan/config_fixer.php +++ b/dev/tools/phan/config_fixer.php @@ -228,10 +228,12 @@ return [ 'gd' => PHAN_DIR . '/stubs/gd.phan_php', 'geoip' => PHAN_DIR . '/stubs/geoip.phan_php', 'imap' => PHAN_DIR . '/stubs/imap.phan_php', + 'imagick' => PHAN_DIR . '/stubs/imagick.phan_php', 'intl' => PHAN_DIR . '/stubs/intl.phan_php', 'ldap' => PHAN_DIR . '/stubs/ldap.phan_php', 'mcrypt' => PHAN_DIR . '/stubs/mcrypt.phan_php', 'memcache' => PHAN_DIR . '/stubs/memcache.phan_php', + 'memcached' => PHAN_DIR . '/stubs/memcached.phan_php', 'mysqli' => PHAN_DIR . '/stubs/mysqli.phan_php', 'pdo_cubrid' => PHAN_DIR . '/stubs/pdo_cubrid.phan_php', 'pdo_mysql' => PHAN_DIR . '/stubs/pdo_mysql.phan_php', @@ -241,6 +243,7 @@ return [ 'session' => PHAN_DIR . '/stubs/session.phan_php', 'simplexml' => PHAN_DIR . '/stubs/SimpleXML.phan_php', 'soap' => PHAN_DIR . '/stubs/soap.phan_php', + 'tidy' => PHAN_DIR . '/stubs/tidy.phan_php', 'sockets' => PHAN_DIR . '/stubs/sockets.phan_php', 'zip' => PHAN_DIR . '/stubs/zip.phan_php', ], diff --git a/dev/tools/phan/stubs/imagick.phan_php b/dev/tools/phan/stubs/imagick.phan_php new file mode 100644 index 00000000000..e9bb9db450a --- /dev/null +++ b/dev/tools/phan/stubs/imagick.phan_php @@ -0,0 +1,1216 @@ +<?php +// These stubs were generated by the phan stub generator. +// @phan-stub-for-extension imagick@3.7.0 + +namespace { +class Imagick implements \Iterator, \Traversable, \Countable { + + // constants + const COLOR_BLACK = 11; + const COLOR_BLUE = 12; + const COLOR_CYAN = 13; + const COLOR_GREEN = 14; + const COLOR_RED = 15; + const COLOR_YELLOW = 16; + const COLOR_MAGENTA = 17; + const COLOR_OPACITY = 18; + const COLOR_ALPHA = 19; + const COLOR_FUZZ = 20; + const IMAGICK_EXTNUM = 30700; + const IMAGICK_EXTVER = '3.7.0'; + const QUANTUM_RANGE = 65535; + const USE_ZEND_MM = 0; + const COMPOSITE_DEFAULT = 40; + const COMPOSITE_UNDEFINED = 0; + const COMPOSITE_NO = 1; + const COMPOSITE_ADD = 2; + const COMPOSITE_ATOP = 3; + const COMPOSITE_BLEND = 4; + const COMPOSITE_BUMPMAP = 5; + const COMPOSITE_CLEAR = 7; + const COMPOSITE_COLORBURN = 8; + const COMPOSITE_COLORDODGE = 9; + const COMPOSITE_COLORIZE = 10; + const COMPOSITE_COPYBLACK = 11; + const COMPOSITE_COPYBLUE = 12; + const COMPOSITE_COPY = 13; + const COMPOSITE_COPYCYAN = 14; + const COMPOSITE_COPYGREEN = 15; + const COMPOSITE_COPYMAGENTA = 16; + const COMPOSITE_COPYOPACITY = 17; + const COMPOSITE_COPYRED = 18; + const COMPOSITE_COPYYELLOW = 19; + const COMPOSITE_DARKEN = 20; + const COMPOSITE_DSTATOP = 21; + const COMPOSITE_DST = 22; + const COMPOSITE_DSTIN = 23; + const COMPOSITE_DSTOUT = 24; + const COMPOSITE_DSTOVER = 25; + const COMPOSITE_DIFFERENCE = 26; + const COMPOSITE_DISPLACE = 27; + const COMPOSITE_DISSOLVE = 28; + const COMPOSITE_EXCLUSION = 29; + const COMPOSITE_HARDLIGHT = 30; + const COMPOSITE_HUE = 31; + const COMPOSITE_IN = 32; + const COMPOSITE_LIGHTEN = 33; + const COMPOSITE_LUMINIZE = 35; + const COMPOSITE_MINUS = 36; + const COMPOSITE_MODULATE = 37; + const COMPOSITE_MULTIPLY = 38; + const COMPOSITE_OUT = 39; + const COMPOSITE_OVER = 40; + const COMPOSITE_OVERLAY = 41; + const COMPOSITE_PLUS = 42; + const COMPOSITE_REPLACE = 43; + const COMPOSITE_SATURATE = 44; + const COMPOSITE_SCREEN = 45; + const COMPOSITE_SOFTLIGHT = 46; + const COMPOSITE_SRCATOP = 47; + const COMPOSITE_SRC = 48; + const COMPOSITE_SRCIN = 49; + const COMPOSITE_SRCOUT = 50; + const COMPOSITE_SRCOVER = 51; + const COMPOSITE_SUBTRACT = 52; + const COMPOSITE_THRESHOLD = 53; + const COMPOSITE_XOR = 54; + const COMPOSITE_CHANGEMASK = 6; + const COMPOSITE_LINEARLIGHT = 34; + const COMPOSITE_DIVIDE = 55; + const COMPOSITE_DISTORT = 56; + const COMPOSITE_BLUR = 57; + const COMPOSITE_PEGTOPLIGHT = 58; + const COMPOSITE_VIVIDLIGHT = 59; + const COMPOSITE_PINLIGHT = 60; + const COMPOSITE_LINEARDODGE = 61; + const COMPOSITE_LINEARBURN = 62; + const COMPOSITE_MATHEMATICS = 63; + const COMPOSITE_MODULUSADD = 2; + const COMPOSITE_MODULUSSUBTRACT = 52; + const COMPOSITE_MINUSDST = 36; + const COMPOSITE_DIVIDEDST = 55; + const COMPOSITE_DIVIDESRC = 64; + const COMPOSITE_MINUSSRC = 65; + const COMPOSITE_DARKENINTENSITY = 66; + const COMPOSITE_LIGHTENINTENSITY = 67; + const COMPOSITE_HARDMIX = 68; + const COMPOSITE_STEREO = 69; + const MONTAGEMODE_FRAME = 1; + const MONTAGEMODE_UNFRAME = 2; + const MONTAGEMODE_CONCATENATE = 3; + const STYLE_NORMAL = 1; + const STYLE_ITALIC = 2; + const STYLE_OBLIQUE = 3; + const STYLE_ANY = 4; + const FILTER_UNDEFINED = 0; + const FILTER_POINT = 1; + const FILTER_BOX = 2; + const FILTER_TRIANGLE = 3; + const FILTER_HERMITE = 4; + const FILTER_HANNING = 5; + const FILTER_HAMMING = 6; + const FILTER_BLACKMAN = 7; + const FILTER_GAUSSIAN = 8; + const FILTER_QUADRATIC = 9; + const FILTER_CUBIC = 10; + const FILTER_CATROM = 11; + const FILTER_MITCHELL = 12; + const FILTER_LANCZOS = 22; + const FILTER_BESSEL = 13; + const FILTER_SINC = 14; + const FILTER_KAISER = 16; + const FILTER_WELSH = 17; + const FILTER_PARZEN = 18; + const FILTER_LAGRANGE = 21; + const FILTER_SENTINEL = 31; + const FILTER_BOHMAN = 19; + const FILTER_BARTLETT = 20; + const FILTER_JINC = 13; + const FILTER_SINCFAST = 15; + const FILTER_ROBIDOUX = 26; + const FILTER_LANCZOSSHARP = 23; + const FILTER_LANCZOS2 = 24; + const FILTER_LANCZOS2SHARP = 25; + const FILTER_ROBIDOUXSHARP = 27; + const FILTER_COSINE = 28; + const FILTER_SPLINE = 29; + const FILTER_LANCZOSRADIUS = 30; + const IMGTYPE_UNDEFINED = 0; + const IMGTYPE_BILEVEL = 1; + const IMGTYPE_GRAYSCALE = 2; + const IMGTYPE_GRAYSCALEMATTE = 3; + const IMGTYPE_PALETTE = 4; + const IMGTYPE_PALETTEMATTE = 5; + const IMGTYPE_TRUECOLOR = 6; + const IMGTYPE_TRUECOLORMATTE = 7; + const IMGTYPE_COLORSEPARATION = 8; + const IMGTYPE_COLORSEPARATIONMATTE = 9; + const IMGTYPE_OPTIMIZE = 10; + const IMGTYPE_PALETTEBILEVELMATTE = 11; + const RESOLUTION_UNDEFINED = 0; + const RESOLUTION_PIXELSPERINCH = 1; + const RESOLUTION_PIXELSPERCENTIMETER = 2; + const COMPRESSION_UNDEFINED = 0; + const COMPRESSION_NO = 1; + const COMPRESSION_BZIP = 2; + const COMPRESSION_FAX = 6; + const COMPRESSION_GROUP4 = 7; + const COMPRESSION_JPEG = 8; + const COMPRESSION_JPEG2000 = 9; + const COMPRESSION_LOSSLESSJPEG = 10; + const COMPRESSION_LZW = 11; + const COMPRESSION_RLE = 12; + const COMPRESSION_ZIP = 13; + const COMPRESSION_DXT1 = 3; + const COMPRESSION_DXT3 = 4; + const COMPRESSION_DXT5 = 5; + const COMPRESSION_ZIPS = 14; + const COMPRESSION_PIZ = 15; + const COMPRESSION_PXR24 = 16; + const COMPRESSION_B44 = 17; + const COMPRESSION_B44A = 18; + const COMPRESSION_LZMA = 19; + const COMPRESSION_JBIG1 = 20; + const COMPRESSION_JBIG2 = 21; + const PAINT_POINT = 1; + const PAINT_REPLACE = 2; + const PAINT_FLOODFILL = 3; + const PAINT_FILLTOBORDER = 4; + const PAINT_RESET = 5; + const GRAVITY_NORTHWEST = 1; + const GRAVITY_NORTH = 2; + const GRAVITY_NORTHEAST = 3; + const GRAVITY_WEST = 4; + const GRAVITY_CENTER = 5; + const GRAVITY_EAST = 6; + const GRAVITY_SOUTHWEST = 7; + const GRAVITY_SOUTH = 8; + const GRAVITY_SOUTHEAST = 9; + const GRAVITY_FORGET = 0; + const GRAVITY_STATIC = 10; + const STRETCH_NORMAL = 1; + const STRETCH_ULTRACONDENSED = 2; + const STRETCH_EXTRACONDENSED = 3; + const STRETCH_CONDENSED = 4; + const STRETCH_SEMICONDENSED = 5; + const STRETCH_SEMIEXPANDED = 6; + const STRETCH_EXPANDED = 7; + const STRETCH_EXTRAEXPANDED = 8; + const STRETCH_ULTRAEXPANDED = 9; + const STRETCH_ANY = 10; + const ALIGN_UNDEFINED = 0; + const ALIGN_LEFT = 1; + const ALIGN_CENTER = 2; + const ALIGN_RIGHT = 3; + const DECORATION_NO = 1; + const DECORATION_UNDERLINE = 2; + const DECORATION_OVERLINE = 3; + const DECORATION_LINETROUGH = 4; + const DECORATION_LINETHROUGH = 4; + const NOISE_UNIFORM = 1; + const NOISE_GAUSSIAN = 2; + const NOISE_MULTIPLICATIVEGAUSSIAN = 3; + const NOISE_IMPULSE = 4; + const NOISE_LAPLACIAN = 5; + const NOISE_POISSON = 6; + const NOISE_RANDOM = 7; + const CHANNEL_UNDEFINED = 0; + const CHANNEL_RED = 1; + const CHANNEL_GRAY = 1; + const CHANNEL_CYAN = 1; + const CHANNEL_GREEN = 2; + const CHANNEL_MAGENTA = 2; + const CHANNEL_BLUE = 4; + const CHANNEL_YELLOW = 4; + const CHANNEL_ALPHA = 8; + const CHANNEL_OPACITY = 8; + const CHANNEL_MATTE = 8; + const CHANNEL_BLACK = 32; + const CHANNEL_INDEX = 32; + const CHANNEL_ALL = 134217727; + const CHANNEL_DEFAULT = 134217719; + const CHANNEL_RGBA = 15; + const CHANNEL_TRUEALPHA = 64; + const CHANNEL_RGBS = 128; + const CHANNEL_GRAY_CHANNELS = 128; + const CHANNEL_SYNC = 256; + const CHANNEL_COMPOSITES = 47; + const METRIC_UNDEFINED = 0; + const METRIC_ABSOLUTEERRORMETRIC = 1; + const METRIC_MEANABSOLUTEERROR = 2; + const METRIC_MEANERRORPERPIXELMETRIC = 3; + const METRIC_MEANSQUAREERROR = 4; + const METRIC_PEAKABSOLUTEERROR = 5; + const METRIC_PEAKSIGNALTONOISERATIO = 6; + const METRIC_ROOTMEANSQUAREDERROR = 7; + const METRIC_NORMALIZEDCROSSCORRELATIONERRORMETRIC = 8; + const METRIC_FUZZERROR = 9; + const METRIC_PERCEPTUALHASH_ERROR = 255; + const PIXEL_CHAR = 1; + const PIXELSTORAGE_CHAR = 1; + const PIXEL_DOUBLE = 2; + const PIXELSTORAGE_DOUBLE = 2; + const PIXEL_FLOAT = 3; + const PIXELSTORAGE_FLOAT = 3; + const PIXEL_INTEGER = 4; + const PIXELSTORAGE_INTEGER = 4; + const PIXEL_LONG = 5; + const PIXELSTORAGE_LONG = 5; + const PIXEL_QUANTUM = 6; + const PIXELSTORAGE_QUANTUM = 6; + const PIXEL_SHORT = 7; + const PIXELSTORAGE_SHORT = 7; + const EVALUATE_UNDEFINED = 0; + const EVALUATE_ADD = 1; + const EVALUATE_AND = 2; + const EVALUATE_DIVIDE = 3; + const EVALUATE_LEFTSHIFT = 4; + const EVALUATE_MAX = 5; + const EVALUATE_MIN = 6; + const EVALUATE_MULTIPLY = 7; + const EVALUATE_OR = 8; + const EVALUATE_RIGHTSHIFT = 9; + const EVALUATE_SET = 10; + const EVALUATE_SUBTRACT = 11; + const EVALUATE_XOR = 12; + const EVALUATE_POW = 13; + const EVALUATE_LOG = 14; + const EVALUATE_THRESHOLD = 15; + const EVALUATE_THRESHOLDBLACK = 16; + const EVALUATE_THRESHOLDWHITE = 17; + const EVALUATE_GAUSSIANNOISE = 18; + const EVALUATE_IMPULSENOISE = 19; + const EVALUATE_LAPLACIANNOISE = 20; + const EVALUATE_MULTIPLICATIVENOISE = 21; + const EVALUATE_POISSONNOISE = 22; + const EVALUATE_UNIFORMNOISE = 23; + const EVALUATE_COSINE = 24; + const EVALUATE_SINE = 25; + const EVALUATE_ADDMODULUS = 26; + const EVALUATE_MEAN = 27; + const EVALUATE_ABS = 28; + const EVALUATE_EXPONENTIAL = 29; + const EVALUATE_MEDIAN = 30; + const EVALUATE_SUM = 31; + const EVALUATE_ROOT_MEAN_SQUARE = 32; + const COLORSPACE_UNDEFINED = 0; + const COLORSPACE_RGB = 1; + const COLORSPACE_GRAY = 2; + const COLORSPACE_TRANSPARENT = 3; + const COLORSPACE_OHTA = 4; + const COLORSPACE_LAB = 5; + const COLORSPACE_XYZ = 6; + const COLORSPACE_YCBCR = 7; + const COLORSPACE_YCC = 8; + const COLORSPACE_YIQ = 9; + const COLORSPACE_YPBPR = 10; + const COLORSPACE_YUV = 11; + const COLORSPACE_CMYK = 12; + const COLORSPACE_SRGB = 13; + const COLORSPACE_HSB = 14; + const COLORSPACE_HSL = 15; + const COLORSPACE_HWB = 16; + const COLORSPACE_REC601LUMA = 17; + const COLORSPACE_REC709LUMA = 19; + const COLORSPACE_LOG = 21; + const COLORSPACE_CMY = 22; + const COLORSPACE_LUV = 23; + const COLORSPACE_HCL = 24; + const COLORSPACE_LCH = 25; + const COLORSPACE_LMS = 26; + const COLORSPACE_LCHAB = 27; + const COLORSPACE_LCHUV = 28; + const COLORSPACE_SCRGB = 29; + const COLORSPACE_HSI = 30; + const COLORSPACE_HSV = 31; + const COLORSPACE_HCLP = 32; + const COLORSPACE_YDBDR = 33; + const COLORSPACE_REC601YCBCR = 18; + const COLORSPACE_REC709YCBCR = 20; + const COLORSPACE_XYY = 34; + const COLORSPACE_LINEARGRAY = 35; + const VIRTUALPIXELMETHOD_UNDEFINED = 0; + const VIRTUALPIXELMETHOD_BACKGROUND = 1; + const VIRTUALPIXELMETHOD_CONSTANT = 2; + const VIRTUALPIXELMETHOD_EDGE = 4; + const VIRTUALPIXELMETHOD_MIRROR = 5; + const VIRTUALPIXELMETHOD_TILE = 7; + const VIRTUALPIXELMETHOD_TRANSPARENT = 8; + const VIRTUALPIXELMETHOD_MASK = 9; + const VIRTUALPIXELMETHOD_BLACK = 10; + const VIRTUALPIXELMETHOD_GRAY = 11; + const VIRTUALPIXELMETHOD_WHITE = 12; + const VIRTUALPIXELMETHOD_HORIZONTALTILE = 13; + const VIRTUALPIXELMETHOD_VERTICALTILE = 14; + const VIRTUALPIXELMETHOD_HORIZONTALTILEEDGE = 15; + const VIRTUALPIXELMETHOD_VERTICALTILEEDGE = 16; + const VIRTUALPIXELMETHOD_CHECKERTILE = 17; + const VIRTUALPIXELMETHOD_DITHER = 3; + const VIRTUALPIXELMETHOD_RANDOM = 6; + const PREVIEW_UNDEFINED = 0; + const PREVIEW_ROTATE = 1; + const PREVIEW_SHEAR = 2; + const PREVIEW_ROLL = 3; + const PREVIEW_HUE = 4; + const PREVIEW_SATURATION = 5; + const PREVIEW_BRIGHTNESS = 6; + const PREVIEW_GAMMA = 7; + const PREVIEW_SPIFF = 8; + const PREVIEW_DULL = 9; + const PREVIEW_GRAYSCALE = 10; + const PREVIEW_QUANTIZE = 11; + const PREVIEW_DESPECKLE = 12; + const PREVIEW_REDUCENOISE = 13; + const PREVIEW_ADDNOISE = 14; + const PREVIEW_SHARPEN = 15; + const PREVIEW_BLUR = 16; + const PREVIEW_THRESHOLD = 17; + const PREVIEW_EDGEDETECT = 18; + const PREVIEW_SPREAD = 19; + const PREVIEW_SOLARIZE = 20; + const PREVIEW_SHADE = 21; + const PREVIEW_RAISE = 22; + const PREVIEW_SEGMENT = 23; + const PREVIEW_SWIRL = 24; + const PREVIEW_IMPLODE = 25; + const PREVIEW_WAVE = 26; + const PREVIEW_OILPAINT = 27; + const PREVIEW_CHARCOALDRAWING = 28; + const PREVIEW_JPEG = 29; + const RENDERINGINTENT_UNDEFINED = 0; + const RENDERINGINTENT_SATURATION = 1; + const RENDERINGINTENT_PERCEPTUAL = 2; + const RENDERINGINTENT_ABSOLUTE = 3; + const RENDERINGINTENT_RELATIVE = 4; + const INTERLACE_UNDEFINED = 0; + const INTERLACE_NO = 1; + const INTERLACE_LINE = 2; + const INTERLACE_PLANE = 3; + const INTERLACE_PARTITION = 4; + const INTERLACE_GIF = 5; + const INTERLACE_JPEG = 6; + const INTERLACE_PNG = 7; + const FILLRULE_UNDEFINED = 0; + const FILLRULE_EVENODD = 1; + const FILLRULE_NONZERO = 2; + const PATHUNITS_UNDEFINED = 0; + const PATHUNITS_USERSPACE = 1; + const PATHUNITS_USERSPACEONUSE = 2; + const PATHUNITS_OBJECTBOUNDINGBOX = 3; + const LINECAP_UNDEFINED = 0; + const LINECAP_BUTT = 1; + const LINECAP_ROUND = 2; + const LINECAP_SQUARE = 3; + const LINEJOIN_UNDEFINED = 0; + const LINEJOIN_MITER = 1; + const LINEJOIN_ROUND = 2; + const LINEJOIN_BEVEL = 3; + const RESOURCETYPE_UNDEFINED = 0; + const RESOURCETYPE_AREA = 1; + const RESOURCETYPE_DISK = 2; + const RESOURCETYPE_FILE = 3; + const RESOURCETYPE_MAP = 4; + const RESOURCETYPE_MEMORY = 5; + const RESOURCETYPE_TIME = 7; + const RESOURCETYPE_THROTTLE = 8; + const RESOURCETYPE_THREAD = 6; + const RESOURCETYPE_WIDTH = 9; + const RESOURCETYPE_HEIGHT = 10; + const RESOURCETYPE_LISTLENGTH = 11; + const DISPOSE_UNRECOGNIZED = 0; + const DISPOSE_UNDEFINED = 0; + const DISPOSE_NONE = 1; + const DISPOSE_BACKGROUND = 2; + const DISPOSE_PREVIOUS = 3; + const INTERPOLATE_UNDEFINED = 0; + const INTERPOLATE_AVERAGE = 1; + const INTERPOLATE_BICUBIC = 2; + const INTERPOLATE_BILINEAR = 3; + const INTERPOLATE_FILTER = 4; + const INTERPOLATE_INTEGER = 5; + const INTERPOLATE_MESH = 6; + const INTERPOLATE_NEARESTNEIGHBOR = 7; + const INTERPOLATE_SPLINE = 8; + const INTERPOLATE_AVERAGE_9 = 9; + const INTERPOLATE_AVERAGE_16 = 10; + const INTERPOLATE_BLEND = 11; + const INTERPOLATE_BACKGROUND_COLOR = 12; + const INTERPOLATE_CATROM = 13; + const LAYERMETHOD_UNDEFINED = 0; + const LAYERMETHOD_COALESCE = 1; + const LAYERMETHOD_COMPAREANY = 2; + const LAYERMETHOD_COMPARECLEAR = 3; + const LAYERMETHOD_COMPAREOVERLAY = 4; + const LAYERMETHOD_DISPOSE = 5; + const LAYERMETHOD_OPTIMIZE = 6; + const LAYERMETHOD_OPTIMIZEPLUS = 8; + const LAYERMETHOD_OPTIMIZETRANS = 9; + const LAYERMETHOD_COMPOSITE = 12; + const LAYERMETHOD_OPTIMIZEIMAGE = 7; + const LAYERMETHOD_REMOVEDUPS = 10; + const LAYERMETHOD_REMOVEZERO = 11; + const LAYERMETHOD_TRIMBOUNDS = 16; + const ORIENTATION_UNDEFINED = 0; + const ORIENTATION_TOPLEFT = 1; + const ORIENTATION_TOPRIGHT = 2; + const ORIENTATION_BOTTOMRIGHT = 3; + const ORIENTATION_BOTTOMLEFT = 4; + const ORIENTATION_LEFTTOP = 5; + const ORIENTATION_RIGHTTOP = 6; + const ORIENTATION_RIGHTBOTTOM = 7; + const ORIENTATION_LEFTBOTTOM = 8; + const DISTORTION_UNDEFINED = 0; + const DISTORTION_AFFINE = 1; + const DISTORTION_AFFINEPROJECTION = 2; + const DISTORTION_ARC = 9; + const DISTORTION_BILINEAR = 6; + const DISTORTION_PERSPECTIVE = 4; + const DISTORTION_PERSPECTIVEPROJECTION = 5; + const DISTORTION_SCALEROTATETRANSLATE = 3; + const DISTORTION_POLYNOMIAL = 8; + const DISTORTION_POLAR = 10; + const DISTORTION_DEPOLAR = 11; + const DISTORTION_BARREL = 14; + const DISTORTION_SHEPARDS = 16; + const DISTORTION_SENTINEL = 18; + const DISTORTION_BARRELINVERSE = 15; + const DISTORTION_BILINEARFORWARD = 6; + const DISTORTION_BILINEARREVERSE = 7; + const DISTORTION_RESIZE = 17; + const DISTORTION_CYLINDER2PLANE = 12; + const DISTORTION_PLANE2CYLINDER = 13; + const LAYERMETHOD_MERGE = 13; + const LAYERMETHOD_FLATTEN = 14; + const LAYERMETHOD_MOSAIC = 15; + const ALPHACHANNEL_ACTIVATE = 1; + const ALPHACHANNEL_RESET = 7; + const ALPHACHANNEL_SET = 8; + const ALPHACHANNEL_UNDEFINED = 0; + const ALPHACHANNEL_COPY = 3; + const ALPHACHANNEL_DEACTIVATE = 4; + const ALPHACHANNEL_EXTRACT = 5; + const ALPHACHANNEL_OPAQUE = 6; + const ALPHACHANNEL_SHAPE = 9; + const ALPHACHANNEL_TRANSPARENT = 10; + const ALPHACHANNEL_ASSOCIATE = 13; + const ALPHACHANNEL_DISSOCIATE = 14; + const SPARSECOLORMETHOD_UNDEFINED = 0; + const SPARSECOLORMETHOD_BARYCENTRIC = 1; + const SPARSECOLORMETHOD_BILINEAR = 7; + const SPARSECOLORMETHOD_POLYNOMIAL = 8; + const SPARSECOLORMETHOD_SPEPARDS = 16; + const SPARSECOLORMETHOD_VORONOI = 18; + const SPARSECOLORMETHOD_INVERSE = 19; + const SPARSECOLORMETHOD_MANHATTAN = 20; + const DITHERMETHOD_UNDEFINED = 0; + const DITHERMETHOD_NO = 1; + const DITHERMETHOD_RIEMERSMA = 2; + const DITHERMETHOD_FLOYDSTEINBERG = 3; + const FUNCTION_UNDEFINED = 0; + const FUNCTION_POLYNOMIAL = 1; + const FUNCTION_SINUSOID = 2; + const ALPHACHANNEL_BACKGROUND = 2; + const FUNCTION_ARCSIN = 3; + const FUNCTION_ARCTAN = 4; + const ALPHACHANNEL_FLATTEN = 11; + const ALPHACHANNEL_REMOVE = 12; + const STATISTIC_GRADIENT = 1; + const STATISTIC_MAXIMUM = 2; + const STATISTIC_MEAN = 3; + const STATISTIC_MEDIAN = 4; + const STATISTIC_MINIMUM = 5; + const STATISTIC_MODE = 6; + const STATISTIC_NONPEAK = 7; + const STATISTIC_STANDARD_DEVIATION = 8; + const STATISTIC_ROOT_MEAN_SQUARE = 9; + const MORPHOLOGY_CONVOLVE = 1; + const MORPHOLOGY_CORRELATE = 2; + const MORPHOLOGY_ERODE = 3; + const MORPHOLOGY_DILATE = 4; + const MORPHOLOGY_ERODE_INTENSITY = 5; + const MORPHOLOGY_DILATE_INTENSITY = 6; + const MORPHOLOGY_DISTANCE = 7; + const MORPHOLOGY_OPEN = 8; + const MORPHOLOGY_CLOSE = 9; + const MORPHOLOGY_OPEN_INTENSITY = 10; + const MORPHOLOGY_CLOSE_INTENSITY = 11; + const MORPHOLOGY_SMOOTH = 12; + const MORPHOLOGY_EDGE_IN = 13; + const MORPHOLOGY_EDGE_OUT = 14; + const MORPHOLOGY_EDGE = 15; + const MORPHOLOGY_TOP_HAT = 16; + const MORPHOLOGY_BOTTOM_HAT = 17; + const MORPHOLOGY_HIT_AND_MISS = 18; + const MORPHOLOGY_THINNING = 19; + const MORPHOLOGY_THICKEN = 20; + const MORPHOLOGY_VORONOI = 21; + const MORPHOLOGY_ITERATIVE = 22; + const KERNEL_UNITY = 1; + const KERNEL_GAUSSIAN = 2; + const KERNEL_DIFFERENCE_OF_GAUSSIANS = 3; + const KERNEL_LAPLACIAN_OF_GAUSSIANS = 4; + const KERNEL_BLUR = 5; + const KERNEL_COMET = 6; + const KERNEL_LAPLACIAN = 7; + const KERNEL_SOBEL = 8; + const KERNEL_FREI_CHEN = 9; + const KERNEL_ROBERTS = 10; + const KERNEL_PREWITT = 11; + const KERNEL_COMPASS = 12; + const KERNEL_KIRSCH = 13; + const KERNEL_DIAMOND = 14; + const KERNEL_SQUARE = 15; + const KERNEL_RECTANGLE = 16; + const KERNEL_OCTAGON = 17; + const KERNEL_DISK = 18; + const KERNEL_PLUS = 19; + const KERNEL_CROSS = 20; + const KERNEL_RING = 21; + const KERNEL_PEAKS = 22; + const KERNEL_EDGES = 23; + const KERNEL_CORNERS = 24; + const KERNEL_DIAGONALS = 25; + const KERNEL_LINE_ENDS = 26; + const KERNEL_LINE_JUNCTIONS = 27; + const KERNEL_RIDGES = 28; + const KERNEL_CONVEX_HULL = 29; + const KERNEL_THIN_SE = 30; + const KERNEL_SKELETON = 31; + const KERNEL_CHEBYSHEV = 32; + const KERNEL_MANHATTAN = 33; + const KERNEL_OCTAGONAL = 34; + const KERNEL_EUCLIDEAN = 35; + const KERNEL_USER_DEFINED = 36; + const KERNEL_BINOMIAL = 37; + const DIRECTION_LEFT_TO_RIGHT = 2; + const DIRECTION_RIGHT_TO_LEFT = 1; + const NORMALIZE_KERNEL_NONE = 0; + const NORMALIZE_KERNEL_VALUE = 8192; + const NORMALIZE_KERNEL_CORRELATE = 65536; + const NORMALIZE_KERNEL_PERCENT = 4096; + + // methods + public function optimizeImageLayers() {} + public function compareImageLayers($metric) {} + public function pingImageBlob($image) {} + public function pingImageFile($filehandle, $filename = null) {} + public function transposeImage() {} + public function transverseImage() {} + public function trimImage($fuzz) {} + public function waveImage($amplitude, $length) {} + public function vignetteImage($black_point, $white_point, $x, $y) {} + public function uniqueImageColors() {} + public function getImageMatte() {} + public function setImageMatte($matte) {} + public function adaptiveResizeImage($columns, $rows, $bestfit = null, $legacy = null) {} + public function sketchImage($radius, $sigma, $angle) {} + public function shadeImage($gray, $azimuth, $elevation) {} + public function getSizeOffset() {} + public function setSizeOffset($columns, $rows, $offset) {} + public function adaptiveBlurImage($radius, $sigma, $channel = null) {} + public function contrastStretchImage($black_point, $white_point, $channel = null) {} + public function adaptiveSharpenImage($radius, $sigma, $channel = null) {} + public function randomThresholdImage($low, $high, $channel = null) {} + public function roundCornersImage($x_rounding, $y_rounding, $stroke_width = null, $displace = null, $size_correction = null) {} + public function roundCorners($x_rounding, $y_rounding, $stroke_width = null, $displace = null, $size_correction = null) {} + public function setIteratorIndex($index) {} + public function getIteratorIndex() {} + public function transformImage($crop, $geometry) {} + public function setImageOpacity($opacity) {} + public function orderedPosterizeImage($threshold_map, $channel = null) {} + public function polaroidImage(\ImagickDraw $settings, $angle) {} + public function getImageProperty($name) {} + public function setImageProperty($name, $value) {} + public function deleteImageProperty($name) {} + public function identifyFormat($format) {} + public function setImageInterpolateMethod($method) {} + public function getImageInterpolateMethod() {} + public function linearStretchImage($black_point, $white_point) {} + public function getImageLength() {} + public function extentImage($width, $height, $x, $y) {} + public function getImageOrientation() {} + public function setImageOrientation($orientation) {} + public function paintFloodfillImage($fill_color, $fuzz, $border_color, $x, $y, $channel = null) {} + public function clutImage(\Imagick $lookup_table, $channel = null) {} + public function getImageProperties($pattern = null, $include_values = null) {} + public function getImageProfiles($pattern = null, $include_values = null) {} + public function distortImage($distortion, $arguments, $bestfit) {} + public function writeImageFile($filehandle, $format = null) {} + public function writeImagesFile($filehandle, $format = null) {} + public function resetImagePage($page) {} + public function setImageClipMask(\Imagick $clip_mask) {} + public function getImageClipMask() {} + public function animateImages($x_server) {} + public function recolorImage($matrix) {} + public function setFont($font) {} + public function getFont() {} + public function setPointSize($point_size) {} + public function getPointSize() {} + public function mergeImageLayers($layermethod) {} + public function setImageAlphaChannel($alphachannel) {} + public function floodfillPaintImage($fill_color, $fuzz, $border_color, $x, $y, $invert, $channel = null) {} + public function opaquePaintImage($target_color, $fill_color, $fuzz, $invert, $channel = null) {} + public function transparentPaintImage($target_color, $alpha, $fuzz, $invert) {} + public function liquidRescaleImage($width, $height, $delta_x, $rigidity) {} + public function encipherImage($passphrase) {} + public function decipherImage($passphrase) {} + public function setGravity($gravity) {} + public function getGravity() {} + public function getImageChannelRange($channel) {} + public function getImageAlphaChannel() {} + public function getImageChannelDistortions(\Imagick $reference_image, $metric, $channel = null) {} + public function setImageGravity($gravity) {} + public function getImageGravity() {} + public function importImagePixels($x, $y, $width, $height, $map, $pixelstorage, $pixels) {} + public function deskewImage($threshold) {} + public function segmentImage($colorspace, $cluster_threshold, $smooth_threshold, $verbose = null) {} + public function sparseColorImage($sparsecolormethod, $arguments, $channel = null) {} + public function remapImage(\Imagick $replacement, $dither_method) {} + public function exportImagePixels($x, $y, $width, $height, $map, $pixelstorage) {} + public function getImageChannelKurtosis($channel = null) {} + public function functionImage($function, $parameters, $channel = null) {} + public function transformImageColorspace($colorspace) {} + public function haldClutImage(\Imagick $clut, $channel = null) {} + public function autoLevelImage($channel = null) {} + public function blueShiftImage($factor = null) {} + public function getImageArtifact($artifact) {} + public function setImageArtifact($artifact, $value) {} + public function deleteImageArtifact($artifact) {} + public function getColorspace() {} + public function setColorspace($colorspace) {} + public function clampImage($channel = null) {} + public function smushImages($stack, $offset) {} + public function __construct($files = null) {} + public function __toString() {} + public function count($mode = null) {} + public function getPixelIterator() {} + public function getPixelRegionIterator($x, $y, $columns, $rows) {} + public function readImage($filename) {} + public function readImages($filenames) {} + public function readImageBlob($image, $filename = null) {} + public function setImageFormat($format) {} + public function scaleImage($columns, $rows, $bestfit = null, $legacy = null) {} + public function writeImage($filename = null) {} + public function writeImages($filename, $adjoin) {} + public function blurImage($radius, $sigma, $channel = null) {} + public function thumbnailImage($columns, $rows, $bestfit = null, $fill = null, $legacy = null) {} + public function cropThumbnailImage($width, $height, $legacy = null) {} + public function getImageFilename() {} + public function setImageFilename($filename) {} + public function getImageFormat() {} + public function getImageMimeType() {} + public function removeImage() {} + public function destroy() {} + public function clear() {} + public function clone() {} + public function getImageSize() {} + public function getImageBlob() {} + public function getImagesBlob() {} + public function setFirstIterator() {} + public function setLastIterator() {} + public function resetIterator() {} + public function previousImage() {} + public function nextImage() {} + public function hasPreviousImage() {} + public function hasNextImage() {} + public function setImageIndex($index) {} + public function getImageIndex() {} + public function commentImage($comment) {} + public function cropImage($width, $height, $x, $y) {} + public function labelImage($label) {} + public function getImageGeometry() {} + public function drawImage(\ImagickDraw $drawing) {} + public function setImageCompressionQuality($quality) {} + public function getImageCompressionQuality() {} + public function setImageCompression($compression) {} + public function getImageCompression() {} + public function annotateImage(\ImagickDraw $settings, $x, $y, $angle, $text) {} + public function compositeImage(\Imagick $composite_image, $composite, $x, $y, $channel = null) {} + public function modulateImage($brightness, $saturation, $hue) {} + public function getImageColors() {} + public function montageImage(\ImagickDraw $settings, $tile_geometry, $thumbnail_geometry, $monatgemode, $frame) {} + public function identifyImage($append_raw_output = null) {} + public function thresholdImage($threshold, $channel = null) {} + public function adaptiveThresholdImage($width, $height, $offset) {} + public function blackThresholdImage($threshold_color) {} + public function whiteThresholdImage($threshold_color) {} + public function appendImages($stack) {} + public function charcoalImage($radius, $sigma) {} + public function normalizeImage($channel = null) {} + public function oilPaintImage($radius) {} + public function posterizeImage($levels, $dither) {} + public function radialBlurImage($angle, $channel = null) {} + public function raiseImage($width, $height, $x, $y, $raise) {} + public function resampleImage($x_resolution, $y_resolution, $filter, $blur) {} + public function resizeImage($columns, $rows, $filter, $blur, $bestfit = null, $legacy = null) {} + public function rollImage($x, $y) {} + public function rotateImage($background_color, $degrees) {} + public function sampleImage($columns, $rows) {} + public function solarizeImage($threshold) {} + public function shadowImage($opacity, $sigma, $x, $y) {} + public function setImageAttribute($key, $value) {} + public function setImageBackgroundColor($background_color) {} + public function setImageCompose($compose) {} + public function setImageDelay($delay) {} + public function setImageDepth($depth) {} + public function setImageGamma($gamma) {} + public function setImageIterations($iterations) {} + public function setImageMatteColor($matte_color) {} + public function setImagePage($width, $height, $x, $y) {} + public function setImageProgressMonitor($filename) {} + public function setProgressMonitor($callback) {} + public function setImageResolution($x_resolution, $y_resolution) {} + public function setImageScene($scene) {} + public function setImageTicksPerSecond($ticks_per_second) {} + public function setImageType($image_type) {} + public function setImageUnits($units) {} + public function sharpenImage($radius, $sigma, $channel = null) {} + public function shaveImage($columns, $rows) {} + public function shearImage($background_color, $x_shear, $y_shear) {} + public function spliceImage($width, $height, $x, $y) {} + public function pingImage($filename) {} + public function readImageFile($filehandle, $filename = null) {} + public function displayImage($servername) {} + public function displayImages($servername) {} + public function spreadImage($radius) {} + public function swirlImage($degrees) {} + public function stripImage() {} + public static function queryFormats($pattern = null) {} + public static function queryFonts($pattern = null) {} + public function queryFontMetrics(\ImagickDraw $settings, $text, $multiline = null) {} + public function steganoImage(\Imagick $watermark, $offset) {} + public function addNoiseImage($noise, $channel = null) {} + public function motionBlurImage($radius, $sigma, $angle, $channel = null) {} + public function mosaicImages() {} + public function morphImages($number_frames) {} + public function minifyImage() {} + public function affineTransformImage(\ImagickDraw $settings) {} + public function averageImages() {} + public function borderImage($border_color, $width, $height) {} + public static function calculateCrop($original_width, $original_height, $desired_width, $desired_height, $legacy = null) {} + public function chopImage($width, $height, $x, $y) {} + public function clipImage() {} + public function clipPathImage($pathname, $inside) {} + public function clipImagePath($pathname, $inside) {} + public function coalesceImages() {} + public function colorFloodfillImage($fill_color, $fuzz, $border_color, $x, $y) {} + public function colorizeImage($colorize_color, $opacity_color, $legacy = null) {} + public function compareImageChannels(\Imagick $reference, $channel, $metric) {} + public function compareImages(\Imagick $reference, $metric) {} + public function contrastImage($sharpen) {} + public function combineImages($colorspace) {} + public function convolveImage($kernel, $channel = null) {} + public function cycleColormapImage($displace) {} + public function deconstructImages() {} + public function despeckleImage() {} + public function edgeImage($radius) {} + public function embossImage($radius, $sigma) {} + public function enhanceImage() {} + public function equalizeImage() {} + public function evaluateImage($evaluate, $constant, $channel = null) {} + public function evaluateImages($evaluate) {} + public function flattenImages() {} + public function flipImage() {} + public function flopImage() {} + public function forwardFourierTransformImage($magnitude) {} + public function frameImage($matte_color, $width, $height, $inner_bevel, $outer_bevel) {} + public function fxImage($expression, $channel = null) {} + public function gammaImage($gamma, $channel = null) {} + public function gaussianBlurImage($radius, $sigma, $channel = null) {} + public function getImageAttribute($key) {} + public function getImageBackgroundColor() {} + public function getImageBluePrimary() {} + public function getImageBorderColor() {} + public function getImageChannelDepth($channel) {} + public function getImageChannelDistortion(\Imagick $reference, $channel, $metric) {} + public function getImageChannelExtrema($channel) {} + public function getImageChannelMean($channel) {} + public function getImageChannelStatistics() {} + public function getImageColormapColor($index) {} + public function getImageColorspace() {} + public function getImageCompose() {} + public function getImageDelay() {} + public function getImageDepth() {} + public function getImageDistortion(\Imagick $reference, $metric) {} + public function getImageExtrema() {} + public function getImageDispose() {} + public function getImageGamma() {} + public function getImageGreenPrimary() {} + public function getImageHeight() {} + public function getImageHistogram() {} + public function getImageInterlaceScheme() {} + public function getImageIterations() {} + public function getImageMatteColor() {} + public function getImagePage() {} + public function getImagePixelColor($x, $y) {} + public function getImageProfile($name) {} + public function getImageRedPrimary() {} + public function getImageRenderingIntent() {} + public function getImageResolution() {} + public function getImageScene() {} + public function getImageSignature() {} + public function getImageTicksPerSecond() {} + public function getImageType() {} + public function getImageUnits() {} + public function getImageVirtualPixelMethod() {} + public function getImageWhitePoint() {} + public function getImageWidth() {} + public function getNumberImages() {} + public function getImageTotalInkDensity() {} + public function getImageRegion($width, $height, $x, $y) {} + public function implodeImage($radius) {} + public function inverseFourierTransformImage(\Imagick $complement, $magnitude) {} + public function levelImage($black_point, $gamma, $white_point, $channel = null) {} + public function magnifyImage() {} + public function mapImage(\Imagick $map, $dither) {} + public function matteFloodfillImage($alpha, $fuzz, $border_color, $x, $y) {} + public function medianFilterImage($radius) {} + public function negateImage($gray, $channel = null) {} + public function paintOpaqueImage($target_color, $fill_color, $fuzz, $channel = null) {} + public function paintTransparentImage($target_color, $alpha, $fuzz) {} + public function previewImages($preview) {} + public function profileImage($name, $profile) {} + public function quantizeImage($number_colors, $colorspace, $tree_depth, $dither, $measure_error) {} + public function quantizeImages($number_colors, $colorspace, $tree_depth, $dither, $measure_error) {} + public function reduceNoiseImage($radius) {} + public function removeImageProfile($name) {} + public function separateImageChannel($channel) {} + public function sepiaToneImage($threshold) {} + public function setImageBias($bias) {} + public function setImageBiasQuantum($bias) {} + public function setImageBluePrimary($x, $y) {} + public function setImageBorderColor($border_color) {} + public function setImageChannelDepth($channel, $depth) {} + public function setImageColormapColor($index, $color) {} + public function setImageColorspace($colorspace) {} + public function setImageDispose($dispose) {} + public function setImageExtent($columns, $rows) {} + public function setImageGreenPrimary($x, $y) {} + public function setImageInterlaceScheme($interlace) {} + public function setImageProfile($name, $profile) {} + public function setImageRedPrimary($x, $y) {} + public function setImageRenderingIntent($rendering_intent) {} + public function setImageVirtualPixelMethod($method) {} + public function setImageWhitePoint($x, $y) {} + public function sigmoidalContrastImage($sharpen, $alpha, $beta, $channel = null) {} + public function stereoImage(\Imagick $offset_image) {} + public function textureImage(\Imagick $texture) {} + public function tintImage($tint_color, $opacity_color, $legacy = null) {} + public function unsharpMaskImage($radius, $sigma, $amount, $threshold, $channel = null) {} + public function getImage() {} + public function addImage(\Imagick $image) {} + public function setImage(\Imagick $image) {} + public function newImage($columns, $rows, $background_color, $format = null) {} + public function newPseudoImage($columns, $rows, $pseudo_format) {} + public function getCompression() {} + public function getCompressionQuality() {} + public static function getCopyright() {} + public static function getConfigureOptions($pattern = null) {} + public static function getFeatures() {} + public function getFilename() {} + public function getFormat() {} + public static function getHomeURL() {} + public function getInterlaceScheme() {} + public function getOption($key) {} + public static function getPackageName() {} + public function getPage() {} + public static function getQuantum() {} + public static function getHdriEnabled() {} + public static function getQuantumDepth() {} + public static function getQuantumRange() {} + public static function getReleaseDate() {} + public static function getResource($type) {} + public static function getResourceLimit($type) {} + public function getSamplingFactors() {} + public function getSize() {} + public static function getVersion() {} + public function setBackgroundColor($background_color) {} + public function setCompression($compression) {} + public function setCompressionQuality($quality) {} + public function setFilename($filename) {} + public function setFormat($format) {} + public function setInterlaceScheme($interlace) {} + public function setOption($key, $value) {} + public function setPage($width, $height, $x, $y) {} + public static function setResourceLimit($type, $limit) {} + public function setResolution($x_resolution, $y_resolution) {} + public function setSamplingFactors($factors) {} + public function setSize($columns, $rows) {} + public function setType($imgtype) {} + public function key() {} + public function next() {} + public function rewind() {} + public function valid() {} + public function current() {} + public function brightnessContrastImage($brightness, $contrast, $channel = null) {} + public function colorMatrixImage($color_matrix) {} + public function selectiveBlurImage($radius, $sigma, $threshold, $channel = null) {} + public function rotationalBlurImage($angle, $channel = null) {} + public function statisticImage($type, $width, $height, $channel = null) {} + public function subimageMatch(\Imagick $image, &$offset = null, &$similarity = null, $threshold = null, $metric = null) {} + public function similarityImage(\Imagick $image, &$offset = null, &$similarity = null, $threshold = null, $metric = null) {} + public static function setRegistry($key, $value) {} + public static function getRegistry($key) {} + public static function listRegistry() {} + public function morphology($morphology, $iterations, \ImagickKernel $kernel, $channel = null) {} + public function filter(\ImagickKernel $kernel, $channel = null) {} + public function setAntialias($antialias) {} + public function getAntialias() {} + public function colorDecisionListImage($color_correction_collection) {} + public function optimizeImageTransparency() {} + public function autoGammaImage($channel = null) {} + public function autoOrient() {} + public function autoOrientate() {} + public function compositeImageGravity(\Imagick $image, $composite_constant, $gravity) {} + public function localContrastImage($radius, $strength) {} +} + +class ImagickDraw { + + // methods + public function resetVectorGraphics() {} + public function getTextKerning() {} + public function setTextKerning($kerning) {} + public function getTextInterwordSpacing() {} + public function setTextInterwordSpacing($spacing) {} + public function getTextInterlineSpacing() {} + public function setTextInterlineSpacing($spacing) {} + public function __construct() {} + public function setFillColor($fill_color) {} + public function setFillAlpha($alpha) {} + public function setResolution($resolution_x, $resolution_y) {} + public function setStrokeColor($color) {} + public function setStrokeAlpha($alpha) {} + public function setStrokeWidth($width) {} + public function clear() {} + public function circle($origin_x, $origin_y, $perimeter_x, $perimeter_y) {} + public function annotation($x, $y, $text) {} + public function setTextAntialias($antialias) {} + public function setTextEncoding($encoding) {} + public function setFont($font_name) {} + public function setFontFamily($font_family) {} + public function setFontSize($point_size) {} + public function setFontStyle($style) {} + public function setFontWeight($weight) {} + public function getFont() {} + public function getFontFamily() {} + public function getFontSize() {} + public function getFontStyle() {} + public function getFontWeight() {} + public function destroy() {} + public function rectangle($top_left_x, $top_left_y, $bottom_right_x, $bottom_right_y) {} + public function roundRectangle($top_left_x, $top_left_y, $bottom_right_x, $bottom_right_y, $rounding_x, $rounding_y) {} + public function ellipse($origin_x, $origin_y, $radius_x, $radius_y, $angle_start, $angle_end) {} + public function skewX($degrees) {} + public function skewY($degrees) {} + public function translate($x, $y) {} + public function line($start_x, $start_y, $end_x, $end_y) {} + public function arc($start_x, $start_y, $end_x, $end_y, $start_angle, $end_angle) {} + public function matte($x, $y, $paint) {} + public function polygon($coordinates) {} + public function point($x, $y) {} + public function getTextDecoration() {} + public function getTextEncoding() {} + public function getFontStretch() {} + public function setFontStretch($stretch) {} + public function setStrokeAntialias($enabled) {} + public function setTextAlignment($align) {} + public function setTextDecoration($decoration) {} + public function setTextUnderColor($under_color) {} + public function setViewbox($left_x, $top_y, $right_x, $bottom_y) {} + public function clone() {} + public function affine($affine) {} + public function bezier($coordinates) {} + public function composite($composite, $x, $y, $width, $height, \Imagick $image) {} + public function color($x, $y, $paint) {} + public function comment($comment) {} + public function getClipPath() {} + public function getClipRule() {} + public function getClipUnits() {} + public function getFillColor() {} + public function getFillOpacity() {} + public function getFillRule() {} + public function getGravity() {} + public function getStrokeAntialias() {} + public function getStrokeColor() {} + public function getStrokeDashArray() {} + public function getStrokeDashOffset() {} + public function getStrokeLineCap() {} + public function getStrokeLineJoin() {} + public function getStrokeMiterLimit() {} + public function getStrokeOpacity() {} + public function getStrokeWidth() {} + public function getTextAlignment() {} + public function getTextAntialias() {} + public function getVectorGraphics() {} + public function getTextUnderColor() {} + public function pathClose() {} + public function pathCurveToAbsolute($x1, $y1, $x2, $y2, $x, $y) {} + public function pathCurveToRelative($x1, $y1, $x2, $y2, $x, $y) {} + public function pathCurveToQuadraticBezierAbsolute($x1, $y1, $x_end, $y) {} + public function pathCurveToQuadraticBezierRelative($x1, $y1, $x_end, $y) {} + public function pathCurveToQuadraticBezierSmoothAbsolute($x, $y) {} + public function pathCurveToQuadraticBezierSmoothRelative($x, $y) {} + public function pathCurveToSmoothAbsolute($x2, $y2, $x, $y) {} + public function pathCurveToSmoothRelative($x2, $y2, $x, $y) {} + public function pathEllipticArcAbsolute($rx, $ry, $x_axis_rotation, $large_arc, $sweep, $x, $y) {} + public function pathEllipticArcRelative($rx, $ry, $x_axis_rotation, $large_arc, $sweep, $x, $y) {} + public function pathFinish() {} + public function pathLineToAbsolute($x, $y) {} + public function pathLineToRelative($x, $y) {} + public function pathLineToHorizontalAbsolute($x) {} + public function pathLineToHorizontalRelative($x) {} + public function pathLineToVerticalAbsolute($y) {} + public function pathLineToVerticalRelative($y) {} + public function pathMoveToAbsolute($x, $y) {} + public function pathMoveToRelative($x, $y) {} + public function pathStart() {} + public function polyline($coordinates) {} + public function popClipPath() {} + public function popDefs() {} + public function popPattern() {} + public function pushClipPath($clip_mask_id) {} + public function pushDefs() {} + public function pushPattern($pattern_id, $x, $y, $width, $height) {} + public function render() {} + public function rotate($degrees) {} + public function scale($x, $y) {} + public function setClipPath($clip_mask) {} + public function setClipRule($fillrule) {} + public function setClipUnits($pathunits) {} + public function setFillOpacity($opacity) {} + public function setFillPatternUrl($fill_url) {} + public function setFillRule($fillrule) {} + public function setGravity($gravity) {} + public function setStrokePatternUrl($stroke_url) {} + public function setStrokeDashOffset($dash_offset) {} + public function setStrokeLineCap($linecap) {} + public function setStrokeLineJoin($linejoin) {} + public function setStrokeMiterLimit($miterlimit) {} + public function setStrokeOpacity($opacity) {} + public function setVectorGraphics($xml) {} + public function pop() {} + public function push() {} + public function setStrokeDashArray($dashes) {} + public function getOpacity() {} + public function setOpacity($opacity) {} + public function getFontResolution() {} + public function setFontResolution($x, $y) {} + public function getBorderColor() {} + public function setBorderColor($color) {} + public function setDensity($density) {} + public function getDensity() {} + public function getTextDirection() {} + public function setTextDirection($direction) {} +} + +class ImagickDrawException extends \Exception { + + // properties + protected $message; + protected $code; + protected $file; + protected $line; +} + +class ImagickException extends \Exception { + + // properties + protected $message; + protected $code; + protected $file; + protected $line; +} + +class ImagickKernel { + + // methods + public function addKernel(\ImagickKernel $kernel) {} + public function addUnityKernel($scale) {} + public static function fromBuiltin($kernel, $shape) {} + public static function fromMatrix($matrix, $origin) {} + public function getMatrix() {} + public function scale($scale, $normalize_kernel = null) {} + public function separate() {} +} + +class ImagickKernelException extends \Exception { + + // properties + protected $message; + protected $code; + protected $file; + protected $line; +} + +class ImagickPixel { + + // methods + public function __construct($color = null) {} + public function clear() {} + public function destroy() {} + public function getColor($normalized = null) {} + public function getColorAsString() {} + public function getColorCount() {} + public function getColorQuantum() {} + public function getColorValue($color) {} + public function getColorValueQuantum($color) {} + public function getHSL() {} + public function getIndex() {} + public function isPixelSimilar($color, $fuzz) {} + public function isPixelSimilarQuantum($color, $fuzz_quantum_range_scaled_by_square_root_of_three) {} + public function isSimilar($color, $fuzz_quantum_range_scaled_by_square_root_of_three) {} + public function setColor($color) {} + public function setColorCount($color_count) {} + public function setColorValue($color, $value) {} + public function setColorValueQuantum($color, $value) {} + public function setHSL($hue, $saturation, $luminosity) {} + public function setIndex($index) {} + public function setColorFromPixel(\ImagickPixel $pixel) {} +} + +class ImagickPixelException extends \Exception { + + // properties + protected $message; + protected $code; + protected $file; + protected $line; +} + +class ImagickPixelIterator implements \Iterator, \Traversable { + + // methods + public function __construct(\Imagick $imagick) {} + public function clear() {} + public static function getPixelIterator(\Imagick $imagick) {} + public static function getPixelRegionIterator(\Imagick $imagick, $x, $y, $columns, $rows) {} + public function destroy() {} + public function getCurrentIteratorRow() {} + public function getIteratorRow() {} + public function getNextIteratorRow() {} + public function getPreviousIteratorRow() {} + public function key() {} + public function next() {} + public function rewind() {} + public function current() {} + public function newPixelIterator(\Imagick $imagick) {} + public function newPixelRegionIterator(\Imagick $imagick, $x, $y, $columns, $rows) {} + public function resetIterator() {} + public function setIteratorFirstRow() {} + public function setIteratorLastRow() {} + public function setIteratorRow($row) {} + public function syncIterator() {} + public function valid() {} +} + +class ImagickPixelIteratorException extends \Exception { + + // properties + protected $message; + protected $code; + protected $file; + protected $line; +} + +} diff --git a/dev/tools/phan/stubs/memcached.phan_php b/dev/tools/phan/stubs/memcached.phan_php new file mode 100644 index 00000000000..8fe248bb676 --- /dev/null +++ b/dev/tools/phan/stubs/memcached.phan_php @@ -0,0 +1,180 @@ +<?php +// These stubs were generated by the phan stub generator. +// @phan-stub-for-extension memcached@3.0.3 + +namespace { +class Memcached { + + // constants + public const LIBMEMCACHED_VERSION_HEX = 16777240; + public const OPT_COMPRESSION = -1001; + public const OPT_COMPRESSION_TYPE = -1004; + public const OPT_PREFIX_KEY = -1002; + public const OPT_SERIALIZER = -1003; + public const OPT_USER_FLAGS = -1006; + public const OPT_STORE_RETRY_COUNT = -1005; + public const HAVE_IGBINARY = false; + public const HAVE_JSON = false; + public const HAVE_MSGPACK = false; + public const HAVE_SESSION = true; + public const HAVE_SASL = true; + public const OPT_HASH = 2; + public const HASH_DEFAULT = 0; + public const HASH_MD5 = 1; + public const HASH_CRC = 2; + public const HASH_FNV1_64 = 3; + public const HASH_FNV1A_64 = 4; + public const HASH_FNV1_32 = 5; + public const HASH_FNV1A_32 = 6; + public const HASH_HSIEH = 7; + public const HASH_MURMUR = 8; + public const OPT_DISTRIBUTION = 9; + public const DISTRIBUTION_MODULA = 0; + public const DISTRIBUTION_CONSISTENT = 1; + public const DISTRIBUTION_VIRTUAL_BUCKET = 6; + public const OPT_LIBKETAMA_COMPATIBLE = 16; + public const OPT_LIBKETAMA_HASH = 17; + public const OPT_TCP_KEEPALIVE = 32; + public const OPT_BUFFER_WRITES = 10; + public const OPT_BINARY_PROTOCOL = 18; + public const OPT_NO_BLOCK = 0; + public const OPT_TCP_NODELAY = 1; + public const OPT_SOCKET_SEND_SIZE = 4; + public const OPT_SOCKET_RECV_SIZE = 5; + public const OPT_CONNECT_TIMEOUT = 14; + public const OPT_RETRY_TIMEOUT = 15; + public const OPT_DEAD_TIMEOUT = 36; + public const OPT_SEND_TIMEOUT = 19; + public const OPT_RECV_TIMEOUT = 20; + public const OPT_POLL_TIMEOUT = 8; + public const OPT_CACHE_LOOKUPS = 6; + public const OPT_SERVER_FAILURE_LIMIT = 21; + public const OPT_AUTO_EJECT_HOSTS = 28; + public const OPT_HASH_WITH_PREFIX_KEY = 25; + public const OPT_NOREPLY = 26; + public const OPT_SORT_HOSTS = 12; + public const OPT_VERIFY_KEY = 13; + public const OPT_USE_UDP = 27; + public const OPT_NUMBER_OF_REPLICAS = 29; + public const OPT_RANDOMIZE_REPLICA_READ = 30; + public const OPT_REMOVE_FAILED_SERVERS = 35; + public const OPT_SERVER_TIMEOUT_LIMIT = 37; + public const RES_SUCCESS = 0; + public const RES_FAILURE = 1; + public const RES_HOST_LOOKUP_FAILURE = 2; + public const RES_UNKNOWN_READ_FAILURE = 7; + public const RES_PROTOCOL_ERROR = 8; + public const RES_CLIENT_ERROR = 9; + public const RES_SERVER_ERROR = 10; + public const RES_WRITE_FAILURE = 5; + public const RES_DATA_EXISTS = 12; + public const RES_NOTSTORED = 14; + public const RES_NOTFOUND = 16; + public const RES_PARTIAL_READ = 18; + public const RES_SOME_ERRORS = 19; + public const RES_NO_SERVERS = 20; + public const RES_END = 21; + public const RES_ERRNO = 26; + public const RES_BUFFERED = 32; + public const RES_TIMEOUT = 31; + public const RES_BAD_KEY_PROVIDED = 33; + public const RES_STORED = 15; + public const RES_DELETED = 22; + public const RES_STAT = 24; + public const RES_ITEM = 25; + public const RES_NOT_SUPPORTED = 28; + public const RES_FETCH_NOTFINISHED = 30; + public const RES_SERVER_MARKED_DEAD = 35; + public const RES_UNKNOWN_STAT_KEY = 36; + public const RES_INVALID_HOST_PROTOCOL = 34; + public const RES_MEMORY_ALLOCATION_FAILURE = 17; + public const RES_CONNECTION_SOCKET_CREATE_FAILURE = 11; + public const RES_E2BIG = 37; + public const RES_KEY_TOO_BIG = 39; + public const RES_SERVER_TEMPORARILY_DISABLED = 47; + public const RES_SERVER_MEMORY_ALLOCATION_FAILURE = 48; + public const RES_AUTH_PROBLEM = 40; + public const RES_AUTH_FAILURE = 41; + public const RES_AUTH_CONTINUE = 42; + public const RES_PAYLOAD_FAILURE = -1001; + public const SERIALIZER_PHP = 1; + public const SERIALIZER_IGBINARY = 2; + public const SERIALIZER_JSON = 3; + public const SERIALIZER_JSON_ARRAY = 4; + public const SERIALIZER_MSGPACK = 5; + public const COMPRESSION_FASTLZ = 2; + public const COMPRESSION_ZLIB = 1; + public const GET_PRESERVE_ORDER = 1; + public const GET_EXTENDED = 2; + public const GET_ERROR_RETURN_VALUE = false; + + // methods + public function __construct($persistent_id = NULL, $callback = NULL) {} + public function getResultCode() {} + public function getResultMessage() {} + public function get($key, $cache_cb = NULL, $get_flags = NULL) {} + public function getByKey($server_key, $key, $cache_cb = NULL, $get_flags = NULL) {} + public function getMulti(array $keys, $get_flags = NULL) {} + public function getMultiByKey($server_key, array $keys, $get_flags = NULL) {} + public function getDelayed(array $keys, $with_cas = NULL, $value_cb = NULL) {} + public function getDelayedByKey($server_key, array $keys, $with_cas = NULL, $value_cb = NULL) {} + public function fetch() {} + public function fetchAll() {} + public function set($key, $value, $expiration = NULL) {} + public function setByKey($server_key, $key, $value, $expiration = NULL) {} + public function touch($key, $expiration) {} + public function touchByKey($server_key, $key, $expiration) {} + public function setMulti(array $items, $expiration = NULL) {} + public function setMultiByKey($server_key, array $items, $expiration = NULL) {} + public function cas($cas_token, $key, $value, $expiration = NULL) {} + public function casByKey($cas_token, $server_key, $key, $value, $expiration = NULL) {} + public function add($key, $value, $expiration = NULL) {} + public function addByKey($server_key, $key, $value, $expiration = NULL) {} + public function append($key, $value, $expiration = NULL) {} + public function appendByKey($server_key, $key, $value, $expiration = NULL) {} + public function prepend($key, $value, $expiration = NULL) {} + public function prependByKey($server_key, $key, $value, $expiration = NULL) {} + public function replace($key, $value, $expiration = NULL) {} + public function replaceByKey($server_key, $key, $value, $expiration = NULL) {} + public function delete($key, $time = NULL) {} + public function deleteMulti($keys, $time = NULL) {} + public function deleteByKey($server_key, $key, $time = NULL) {} + public function deleteMultiByKey($server_key, $keys, $time = NULL) {} + public function increment($key, $offset = NULL, $initial_value = NULL, $expiry = NULL) {} + public function decrement($key, $offset = NULL, $initial_value = NULL, $expiry = NULL) {} + public function incrementByKey($server_key, $key, $offset = NULL, $initial_value = NULL, $expiry = NULL) {} + public function decrementByKey($server_key, $key, $offset = NULL, $initial_value = NULL, $expiry = NULL) {} + public function addServer($host, $port, $weight = NULL) {} + public function addServers(array $servers) {} + public function getServerList() {} + public function getServerByKey($server_key) {} + public function resetServerList() {} + public function quit() {} + public function flushBuffers() {} + public function getLastErrorMessage() {} + public function getLastErrorCode() {} + public function getLastErrorErrno() {} + public function getLastDisconnectedServer() {} + public function getStats($args) {} + public function getVersion() {} + public function getAllKeys() {} + public function flush($delay = NULL) {} + public function getOption($option) {} + public function setOption($option, $value) {} + public function setOptions($options) {} + public function setBucket($host_map, $forward_map, $replicas) {} + public function setSaslAuthData($username, $password) {} + public function isPersistent() {} + public function isPristine() {} +} + +class MemcachedException extends \RuntimeException { + + // properties + public $message; + public $code; + public $file; + public $line; +} + +} diff --git a/dev/tools/phan/stubs/tidy.phan_php b/dev/tools/phan/stubs/tidy.phan_php new file mode 100644 index 00000000000..5ac1bc69f4e --- /dev/null +++ b/dev/tools/phan/stubs/tidy.phan_php @@ -0,0 +1,244 @@ +<?php +// These stubs were generated by the phan stub generator. +// @phan-stub-for-extension tidy@7.4.33 + +namespace { +class tidy { + + // properties + public $errorBuffer; + + // methods + public function getOpt($option) {} + public function cleanRepair() {} + public function parseFile($file, $config_options = null, $encoding = null, $use_include_path = null) {} + public function parseString($input, $config_options = null, $encoding = null) {} + public function repairString($data, $config_file = null, $encoding = null) {} + public function repairFile($filename, $config_file = null, $encoding = null, $use_include_path = null) {} + public function diagnose() {} + public function getRelease() {} + public function getConfig() {} + public function getStatus() {} + public function getHtmlVer() {} + public function getOptDoc($optname) {} + public function isXhtml() {} + public function isXml() {} + public function root() {} + public function head() {} + public function html() {} + public function body() {} + public function __construct($filename = null, $config_file = null, $encoding = null, $use_include_path = null) {} +} + +final class tidyNode { + + // properties + public $attribute; + public $child; + public $column; + public $id; + public $line; + public $name; + public $proprietary; + public $type; + public $value; + + // methods + public function hasChildren() {} + public function hasSiblings() {} + public function isComment() {} + public function isHtml() {} + public function isText() {} + public function isJste() {} + public function isAsp() {} + public function isPhp() {} + public function getParent() {} + private function __construct() {} +} + +function tidy_access_count($object) {} +function tidy_clean_repair($object) {} +function tidy_config_count($object) {} +function tidy_diagnose($object) {} +function tidy_error_count($object) {} +function tidy_get_body($tidy) {} +function tidy_get_config($object) {} +function tidy_get_error_buffer($object) {} +function tidy_get_head($object) {} +function tidy_get_html($object) {} +function tidy_get_html_ver($object) {} +function tidy_get_opt_doc($resource, $optname) {} +function tidy_get_output($object) {} +function tidy_get_release() {} +function tidy_get_root($object) {} +function tidy_get_status($object) {} +function tidy_getopt($object, $option) {} +function tidy_is_xhtml($object) {} +function tidy_is_xml($object) {} +function tidy_parse_file($file, $config_options = null, $encoding = null, $use_include_path = null) {} +function tidy_parse_string($input, $config_options = null, $encoding = null) {} +function tidy_repair_file($filename, $config_file = null, $encoding = null, $use_include_path = null) {} +function tidy_repair_string($data, $config_file = null, $encoding = null) {} +function tidy_warning_count($object) {} +const TIDY_NODETYPE_ASP = 10; +const TIDY_NODETYPE_CDATA = 8; +const TIDY_NODETYPE_COMMENT = 2; +const TIDY_NODETYPE_DOCTYPE = 1; +const TIDY_NODETYPE_END = 6; +const TIDY_NODETYPE_JSTE = 11; +const TIDY_NODETYPE_PHP = 12; +const TIDY_NODETYPE_PROCINS = 3; +const TIDY_NODETYPE_ROOT = 0; +const TIDY_NODETYPE_SECTION = 9; +const TIDY_NODETYPE_START = 5; +const TIDY_NODETYPE_STARTEND = 7; +const TIDY_NODETYPE_TEXT = 4; +const TIDY_NODETYPE_XMLDECL = 13; +const TIDY_TAG_A = 1; +const TIDY_TAG_ABBR = 2; +const TIDY_TAG_ACRONYM = 3; +const TIDY_TAG_ADDRESS = 4; +const TIDY_TAG_ALIGN = 5; +const TIDY_TAG_APPLET = 6; +const TIDY_TAG_AREA = 7; +const TIDY_TAG_ARTICLE = 123; +const TIDY_TAG_ASIDE = 124; +const TIDY_TAG_AUDIO = 125; +const TIDY_TAG_B = 8; +const TIDY_TAG_BASE = 9; +const TIDY_TAG_BASEFONT = 10; +const TIDY_TAG_BDI = 126; +const TIDY_TAG_BDO = 11; +const TIDY_TAG_BGSOUND = 12; +const TIDY_TAG_BIG = 13; +const TIDY_TAG_BLINK = 14; +const TIDY_TAG_BLOCKQUOTE = 15; +const TIDY_TAG_BODY = 16; +const TIDY_TAG_BR = 17; +const TIDY_TAG_BUTTON = 18; +const TIDY_TAG_CANVAS = 127; +const TIDY_TAG_CAPTION = 19; +const TIDY_TAG_CENTER = 20; +const TIDY_TAG_CITE = 21; +const TIDY_TAG_CODE = 22; +const TIDY_TAG_COL = 23; +const TIDY_TAG_COLGROUP = 24; +const TIDY_TAG_COMMAND = 128; +const TIDY_TAG_COMMENT = 25; +const TIDY_TAG_DATALIST = 129; +const TIDY_TAG_DD = 26; +const TIDY_TAG_DEL = 27; +const TIDY_TAG_DETAILS = 130; +const TIDY_TAG_DFN = 28; +const TIDY_TAG_DIALOG = 131; +const TIDY_TAG_DIR = 29; +const TIDY_TAG_DIV = 30; +const TIDY_TAG_DL = 31; +const TIDY_TAG_DT = 32; +const TIDY_TAG_EM = 33; +const TIDY_TAG_EMBED = 34; +const TIDY_TAG_FIELDSET = 35; +const TIDY_TAG_FIGCAPTION = 132; +const TIDY_TAG_FIGURE = 133; +const TIDY_TAG_FONT = 36; +const TIDY_TAG_FOOTER = 134; +const TIDY_TAG_FORM = 37; +const TIDY_TAG_FRAME = 38; +const TIDY_TAG_FRAMESET = 39; +const TIDY_TAG_H1 = 40; +const TIDY_TAG_H2 = 41; +const TIDY_TAG_H3 = 42; +const TIDY_TAG_H4 = 43; +const TIDY_TAG_H5 = 44; +const TIDY_TAG_H6 = 45; +const TIDY_TAG_HEAD = 46; +const TIDY_TAG_HEADER = 135; +const TIDY_TAG_HGROUP = 136; +const TIDY_TAG_HR = 47; +const TIDY_TAG_HTML = 48; +const TIDY_TAG_I = 49; +const TIDY_TAG_IFRAME = 50; +const TIDY_TAG_ILAYER = 51; +const TIDY_TAG_IMG = 52; +const TIDY_TAG_INPUT = 53; +const TIDY_TAG_INS = 54; +const TIDY_TAG_ISINDEX = 55; +const TIDY_TAG_KBD = 56; +const TIDY_TAG_KEYGEN = 57; +const TIDY_TAG_LABEL = 58; +const TIDY_TAG_LAYER = 59; +const TIDY_TAG_LEGEND = 60; +const TIDY_TAG_LI = 61; +const TIDY_TAG_LINK = 62; +const TIDY_TAG_LISTING = 63; +const TIDY_TAG_MAIN = 137; +const TIDY_TAG_MAP = 64; +const TIDY_TAG_MARK = 138; +const TIDY_TAG_MARQUEE = 66; +const TIDY_TAG_MENU = 67; +const TIDY_TAG_MENUITEM = 139; +const TIDY_TAG_META = 68; +const TIDY_TAG_METER = 140; +const TIDY_TAG_MULTICOL = 69; +const TIDY_TAG_NAV = 141; +const TIDY_TAG_NOBR = 70; +const TIDY_TAG_NOEMBED = 71; +const TIDY_TAG_NOFRAMES = 72; +const TIDY_TAG_NOLAYER = 73; +const TIDY_TAG_NOSAVE = 74; +const TIDY_TAG_NOSCRIPT = 75; +const TIDY_TAG_OBJECT = 76; +const TIDY_TAG_OL = 77; +const TIDY_TAG_OPTGROUP = 78; +const TIDY_TAG_OPTION = 79; +const TIDY_TAG_OUTPUT = 142; +const TIDY_TAG_P = 80; +const TIDY_TAG_PARAM = 81; +const TIDY_TAG_PLAINTEXT = 83; +const TIDY_TAG_PRE = 84; +const TIDY_TAG_PROGRESS = 143; +const TIDY_TAG_Q = 85; +const TIDY_TAG_RB = 86; +const TIDY_TAG_RBC = 87; +const TIDY_TAG_RP = 88; +const TIDY_TAG_RT = 89; +const TIDY_TAG_RTC = 90; +const TIDY_TAG_RUBY = 91; +const TIDY_TAG_S = 92; +const TIDY_TAG_SAMP = 93; +const TIDY_TAG_SCRIPT = 94; +const TIDY_TAG_SECTION = 144; +const TIDY_TAG_SELECT = 95; +const TIDY_TAG_SERVER = 96; +const TIDY_TAG_SERVLET = 97; +const TIDY_TAG_SMALL = 98; +const TIDY_TAG_SOURCE = 145; +const TIDY_TAG_SPACER = 99; +const TIDY_TAG_SPAN = 100; +const TIDY_TAG_STRIKE = 101; +const TIDY_TAG_STRONG = 102; +const TIDY_TAG_STYLE = 103; +const TIDY_TAG_SUB = 104; +const TIDY_TAG_SUMMARY = 146; +const TIDY_TAG_SUP = 105; +const TIDY_TAG_TABLE = 107; +const TIDY_TAG_TBODY = 108; +const TIDY_TAG_TD = 109; +const TIDY_TAG_TEMPLATE = 147; +const TIDY_TAG_TEXTAREA = 110; +const TIDY_TAG_TFOOT = 111; +const TIDY_TAG_TH = 112; +const TIDY_TAG_THEAD = 113; +const TIDY_TAG_TIME = 148; +const TIDY_TAG_TITLE = 114; +const TIDY_TAG_TR = 115; +const TIDY_TAG_TRACK = 149; +const TIDY_TAG_TT = 116; +const TIDY_TAG_U = 117; +const TIDY_TAG_UL = 118; +const TIDY_TAG_UNKNOWN = 0; +const TIDY_TAG_VAR = 119; +const TIDY_TAG_VIDEO = 150; +const TIDY_TAG_WBR = 120; +const TIDY_TAG_XMP = 121; +} From 3d130e3bd5b357ade4eaad364115b3f61c471f90 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Sat, 23 Mar 2024 15:17:12 +0100 Subject: [PATCH 157/178] Fix double $conf->global->$conf into $conf->global->... # Fix double $conf->global->$conf into $conf->global->... Found with PhanTypeInvalidPropertyName - may be appropriate for backport --- htdocs/core/modules/societe/mod_codecompta_digitaria.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/societe/mod_codecompta_digitaria.php b/htdocs/core/modules/societe/mod_codecompta_digitaria.php index fc0e9f7ebb4..ff7caf85e5b 100644 --- a/htdocs/core/modules/societe/mod_codecompta_digitaria.php +++ b/htdocs/core/modules/societe/mod_codecompta_digitaria.php @@ -123,7 +123,7 @@ class mod_codecompta_digitaria extends ModeleAccountancyCode $texte = str_replace(array('{s1}', '{s2}', '{s3}', '{s4}'), array($s1, $s2, $s3, $s4), $texte); $texte .= "<br>\n"; // Remove special char if COMPANY_DIGITARIA_REMOVE_SPECIAL is set to 1 or not set (default) - if (!isset($conf->global->COMPANY_DIGITARIA_REMOVE_SPECIAL) || !empty($conf->global->$conf->global->COMPANY_DIGITARIA_REMOVE_SPECIAL)) { + if (!isset($conf->global->COMPANY_DIGITARIA_REMOVE_SPECIAL) || !empty($conf->global->COMPANY_DIGITARIA_REMOVE_SPECIAL)) { $texte .= $langs->trans('RemoveSpecialChars').' = '.yn(1)."<br>\n"; } // Apply a regex replacement pattern on code if COMPANY_DIGITARIA_CLEAN_REGEX is set. Value must be a regex with parenthesis. The part into parenthesis is kept, the rest removed. From 8906df343a5bf644dba4e1e20d0fbfdbc6dd8771 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Sat, 23 Mar 2024 16:01:41 +0100 Subject: [PATCH 158/178] NEW Add option THIRDPARTY_MIN_NB_PROF_ID and THIRDPARTY_MAX_NB_PROF_ID --- dev/translation/dynamic_translation_keys.lst | 13 ++- .../sanity_check_trans_missing_unused.sh | 2 +- htdocs/admin/company.php | 28 +++---- htdocs/core/class/html.formother.class.php | 2 +- htdocs/langs/en_US/companies.lang | 83 ------------------- htdocs/societe/card.php | 21 +++-- htdocs/theme/eldy/global.inc.php | 11 ++- htdocs/theme/md/style.css.php | 9 +- 8 files changed, 50 insertions(+), 119 deletions(-) diff --git a/dev/translation/dynamic_translation_keys.lst b/dev/translation/dynamic_translation_keys.lst index 47ab2e14a79..2dcd99eafbc 100644 --- a/dev/translation/dynamic_translation_keys.lst +++ b/dev/translation/dynamic_translation_keys.lst @@ -2650,9 +2650,7 @@ ProductsOrServicesTranslations ProductsPipeServices ProductsPricePerCustomer ProfId10 -ProfId10FR ProfId10Short -ProfId10ShortFR ProfId1ShortCM ProfId1ShortFR ProfId2ShortCM @@ -2663,14 +2661,15 @@ ProfId4ShortCM ProfId4ShortFR ProfId5ShortCM ProfId5ShortFR -ProfId6ShortCM -ProfId6ShortFR +ProfId1Short +ProfId2Short +ProfId3Short +ProfId4Short +ProfId5Short +ProfId6Short ProfId7Short -ProfId7ShortFR ProfId8Short -ProfId8ShortFR ProfId9Short -ProfId9ShortFR ProformaBill ProjectCreatedByEmailCollector ProjectHasNoCategory diff --git a/dev/translation/sanity_check_trans_missing_unused.sh b/dev/translation/sanity_check_trans_missing_unused.sh index 459f59117a5..b003127d5be 100755 --- a/dev/translation/sanity_check_trans_missing_unused.sh +++ b/dev/translation/sanity_check_trans_missing_unused.sh @@ -129,7 +129,7 @@ if [ -s "${MISSING_AND_UNUSED_FILE}" ] ; then echo "## :warning: Unused Translations may match ->trans(\$key.'SomeString')." echo "## You can add such dynamic keys to $(basename "$DYNAMIC_KEYS_SRC_FILE")" echo "## so that they are ignored for this report." - echo "## :warning: Unused Translations may be commented in the code" + echo "## :warning: Unused Translations may also be commented in the code" echo "## You can add such 'disabled' keys to $(basename "$EXCLUDE_KEYS_SRC_FILE")" echo "## so that they are ignored for this report." echo diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index f07961486c6..1a5a68fc085 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -652,7 +652,7 @@ print '</td></tr>'; if ($langs->transcountry("ProfId1", $mysoc->country_code) != '-') { print '<tr class="oddeven"><td><label for="profid1">'.$langs->transcountry("ProfId1", $mysoc->country_code).'</label></td><td>'; if (!empty($mysoc->country_code)) { - print '<input name="siren" id="profid1" class="minwidth200" value="'.dol_escape_htmltag(getDolGlobalString('MAIN_INFO_SIREN') ? $conf->global->MAIN_INFO_SIREN : '').'">'; + print '<input name="siren" id="profid1" class="minwidth200" value="'.dol_escape_htmltag(getDolGlobalString('MAIN_INFO_SIREN')).'">'; } else { print $countrynotdefined; } @@ -663,7 +663,7 @@ if ($langs->transcountry("ProfId1", $mysoc->country_code) != '-') { if ($langs->transcountry("ProfId2", $mysoc->country_code) != '-') { print '<tr class="oddeven"><td><label for="profid2">'.$langs->transcountry("ProfId2", $mysoc->country_code).'</label></td><td>'; if (!empty($mysoc->country_code)) { - print '<input name="siret" id="profid2" class="minwidth200" value="'.dol_escape_htmltag(getDolGlobalString('MAIN_INFO_SIRET') ? $conf->global->MAIN_INFO_SIRET : '').'">'; + print '<input name="siret" id="profid2" class="minwidth200" value="'.dol_escape_htmltag(getDolGlobalString('MAIN_INFO_SIRET')).'">'; } else { print $countrynotdefined; } @@ -674,7 +674,7 @@ if ($langs->transcountry("ProfId2", $mysoc->country_code) != '-') { if ($langs->transcountry("ProfId3", $mysoc->country_code) != '-') { print '<tr class="oddeven"><td><label for="profid3">'.$langs->transcountry("ProfId3", $mysoc->country_code).'</label></td><td>'; if (!empty($mysoc->country_code)) { - print '<input name="ape" id="profid3" class="minwidth200" value="'.dol_escape_htmltag(getDolGlobalString('MAIN_INFO_APE') ? $conf->global->MAIN_INFO_APE : '').'">'; + print '<input name="ape" id="profid3" class="minwidth200" value="'.dol_escape_htmltag(getDolGlobalString('MAIN_INFO_APE')).'">'; } else { print $countrynotdefined; } @@ -685,7 +685,7 @@ if ($langs->transcountry("ProfId3", $mysoc->country_code) != '-') { if ($langs->transcountry("ProfId4", $mysoc->country_code) != '-') { print '<tr class="oddeven"><td><label for="profid4">'.$langs->transcountry("ProfId4", $mysoc->country_code).'</label></td><td>'; if (!empty($mysoc->country_code)) { - print '<input name="rcs" id="profid4" class="minwidth200" value="'.dol_escape_htmltag(getDolGlobalString('MAIN_INFO_RCS') ? $conf->global->MAIN_INFO_RCS : '').'">'; + print '<input name="rcs" id="profid4" class="minwidth200" value="'.dol_escape_htmltag(getDolGlobalString('MAIN_INFO_RCS')).'">'; } else { print $countrynotdefined; } @@ -696,7 +696,7 @@ if ($langs->transcountry("ProfId4", $mysoc->country_code) != '-') { if ($langs->transcountry("ProfId5", $mysoc->country_code) != '-') { print '<tr class="oddeven"><td><label for="profid5">'.$langs->transcountry("ProfId5", $mysoc->country_code).'</label></td><td>'; if (!empty($mysoc->country_code)) { - print '<input name="MAIN_INFO_PROFID5" id="profid5" class="minwidth200" value="'.dol_escape_htmltag(getDolGlobalString('MAIN_INFO_PROFID5') ? $conf->global->MAIN_INFO_PROFID5 : '').'">'; + print '<input name="MAIN_INFO_PROFID5" id="profid5" class="minwidth200" value="'.dol_escape_htmltag(getDolGlobalString('MAIN_INFO_PROFID5')).'">'; } else { print $countrynotdefined; } @@ -707,7 +707,7 @@ if ($langs->transcountry("ProfId5", $mysoc->country_code) != '-') { if ($langs->transcountry("ProfId6", $mysoc->country_code) != '-') { print '<tr class="oddeven"><td><label for="profid6">'.$langs->transcountry("ProfId6", $mysoc->country_code).'</label></td><td>'; if (!empty($mysoc->country_code)) { - print '<input name="MAIN_INFO_PROFID6" id="profid6" class="minwidth200" value="'.dol_escape_htmltag(getDolGlobalString('MAIN_INFO_PROFID6') ? $conf->global->MAIN_INFO_PROFID6 : '').'">'; + print '<input name="MAIN_INFO_PROFID6" id="profid6" class="minwidth200" value="'.dol_escape_htmltag(getDolGlobalString('MAIN_INFO_PROFID6')).'">'; } else { print $countrynotdefined; } @@ -716,9 +716,9 @@ if ($langs->transcountry("ProfId6", $mysoc->country_code) != '-') { // ProfId7 if ($langs->transcountry("ProfId7", $mysoc->country_code) != '-') { - print '<tr class="oddeven"><td><label for="profid7">'.$langs->transcountry("profid7", $mysoc->country_code).'</label></td><td>'; + print '<tr class="oddeven"><td><label for="profid7">'.$langs->transcountry("ProfId7", $mysoc->country_code).'</label></td><td>'; if (!empty($mysoc->country_code)) { - print '<input name="MAIN_INFO_PROFID7" id="profid7" class="minwidth200" value="'.dol_escape_htmltag(getDolGlobalString('MAIN_INFO_PROFID7') ? $conf->global->MAIN_INFO_PROFID7 : '').'">'; + print '<input name="MAIN_INFO_PROFID7" id="profid7" class="minwidth200" value="'.dol_escape_htmltag(getDolGlobalString('MAIN_INFO_PROFID7')).'">'; } else { print $countrynotdefined; } @@ -727,9 +727,9 @@ if ($langs->transcountry("ProfId7", $mysoc->country_code) != '-') { // ProfId8 if ($langs->transcountry("ProfId8", $mysoc->country_code) != '-') { - print '<tr class="oddeven"><td><label for="profid8">'.$langs->transcountry("profid8", $mysoc->country_code).'</label></td><td>'; + print '<tr class="oddeven"><td><label for="profid8">'.$langs->transcountry("ProfId8", $mysoc->country_code).'</label></td><td>'; if (!empty($mysoc->country_code)) { - print '<input name="MAIN_INFO_PROFID8" id="profid8" class="minwidth200" value="'.dol_escape_htmltag(getDolGlobalString('MAIN_INFO_PROFID8') ? $conf->global->MAIN_INFO_PROFID8 : '').'">'; + print '<input name="MAIN_INFO_PROFID8" id="profid8" class="minwidth200" value="'.dol_escape_htmltag(getDolGlobalString('MAIN_INFO_PROFID8')).'">'; } else { print $countrynotdefined; } @@ -738,9 +738,9 @@ if ($langs->transcountry("ProfId8", $mysoc->country_code) != '-') { // ProfId9 if ($langs->transcountry("ProfId9", $mysoc->country_code) != '-') { - print '<tr class="oddeven"><td><label for="profid9">'.$langs->transcountry("profid9", $mysoc->country_code).'</label></td><td>'; + print '<tr class="oddeven"><td><label for="profid9">'.$langs->transcountry("ProfId9", $mysoc->country_code).'</label></td><td>'; if (!empty($mysoc->country_code)) { - print '<input name="MAIN_INFO_PROFID9" id="profid9" class="minwidth200" value="'.dol_escape_htmltag(getDolGlobalString('MAIN_INFO_PROFID9') ? $conf->global->MAIN_INFO_PROFID9 : '').'">'; + print '<input name="MAIN_INFO_PROFID9" id="profid9" class="minwidth200" value="'.dol_escape_htmltag(getDolGlobalString('MAIN_INFO_PROFID9')).'">'; } else { print $countrynotdefined; } @@ -749,9 +749,9 @@ if ($langs->transcountry("ProfId9", $mysoc->country_code) != '-') { // ProfId10 if ($langs->transcountry("ProfId10", $mysoc->country_code) != '-') { - print '<tr class="oddeven"><td><label for="profid10">'.$langs->transcountry("profid10", $mysoc->country_code).'</label></td><td>'; + print '<tr class="oddeven"><td><label for="profid10">'.$langs->transcountry("ProfId10", $mysoc->country_code).'</label></td><td>'; if (!empty($mysoc->country_code)) { - print '<input name="MAIN_INFO_PROFID10" id="profid10" class="minwidth200" value="'.dol_escape_htmltag(getDolGlobalString('MAIN_INFO_PROFID10') ? $conf->global->MAIN_INFO_PROFID10 : '').'">'; + print '<input name="MAIN_INFO_PROFID10" id="profid10" class="minwidth200" value="'.dol_escape_htmltag(getDolGlobalString('MAIN_INFO_PROFID10')).'">'; } else { print $countrynotdefined; } diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 86f850f7cdf..b0f25e98872 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -1271,7 +1271,7 @@ class FormOther $selectboxlist .= '<input type="hidden" name="userid" value="'.$user->id.'">'; $selectboxlist .= '<input type="hidden" name="areacode" value="'.$areacode.'">'; $selectboxlist .= '<input type="hidden" name="boxorder" value="'.$boxorder.'">'; - $selectboxlist .= Form::selectarray('boxcombo', $arrayboxtoactivatelabel, -1, $langs->trans("ChooseBoxToAdd").'...', 0, 0, '', 0, 0, 0, 'ASC', 'maxwidth150onsmartphone hideonprint', 0, 'hidden selected', 0, 0); + $selectboxlist .= Form::selectarray('boxcombo', $arrayboxtoactivatelabel, -1, $langs->trans("ChooseBoxToAdd").'...', 0, 0, '', 0, 0, 0, 'ASC', 'maxwidth300 hideonprint', 0, 'hidden selected', 0, 0); if (empty($conf->use_javascript_ajax)) { $selectboxlist .= ' <input type="submit" class="button" value="'.$langs->trans("AddBox").'">'; } diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index 526483b1339..d1ca72b826a 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -135,180 +135,97 @@ ProfId9=Professional ID 9 ProfId10=Professional ID 10 ProfId1AR=Prof Id 1 (CUIT/CUIL) ProfId2AR=Prof Id 2 (Revenu brutes) -ProfId3AR=- -ProfId4AR=- -ProfId5AR=- -ProfId6AR=- ProfId1AT=Prof Id 1 (USt.-IdNr) ProfId2AT=Prof Id 2 (USt.-Nr) ProfId3AT=Prof Id 3 (Handelsregister-Nr.) -ProfId4AT=- ProfId5AT=EORI number -ProfId6AT=- ProfId1AU=Prof Id 1 (ABN) -ProfId2AU=- -ProfId3AU=- -ProfId4AU=- -ProfId5AU=- -ProfId6AU=- ProfId1BE=Prof Id 1 (Professional number) -ProfId2BE=- -ProfId3BE=- -ProfId4BE=- ProfId5BE=EORI number -ProfId6BE=- -ProfId1BR=- ProfId2BR=IE (Inscricao Estadual) ProfId3BR=IM (Inscricao Municipal) ProfId4BR=CPF #ProfId5BR=CNAE #ProfId6BR=INSS ProfId1CH=UID-Nummer -ProfId2CH=- ProfId3CH=Prof Id 1 (Federal number) ProfId4CH=Prof Id 2 (Commercial Record number) ProfId5CH=EORI number -ProfId6CH=- ProfId1CL=Prof Id 1 (R.U.T.) -ProfId2CL=- -ProfId3CL=- -ProfId4CL=- -ProfId5CL=- -ProfId6CL=- ProfId1CM=Id. prof. 1 (Trade Register) ProfId2CM=Id. prof. 2 (Taxpayer No.) ProfId3CM=Id. prof. 3 (No. of Creation decree) ProfId4CM=Id. prof. 4 (No. of Deposit certificate) ProfId5CM=Id. prof. 5 (Others) -ProfId6CM=- ProfId1ShortCM=Trade Register ProfId2ShortCM=Taxpayer No. ProfId3ShortCM=No. of Creation decree ProfId4ShortCM=No. of Deposit certificate ProfId5ShortCM=Others -ProfId6ShortCM=- ProfId1CO=Prof Id 1 (R.U.T.) -ProfId2CO=- -ProfId3CO=- -ProfId4CO=- -ProfId5CO=- -ProfId6CO=- ProfId1DE=Prof Id 1 (USt.-IdNr) ProfId2DE=Prof Id 2 (USt.-Nr) ProfId3DE=Prof Id 3 (Handelsregister-Nr.) -ProfId4DE=- ProfId5DE=EORI number -ProfId6DE=- ProfId1ES=Prof Id 1 (CIF/NIF) ProfId2ES=Prof Id 2 (Social security number) ProfId3ES=Prof Id 3 (CNAE) ProfId4ES=Prof Id 4 (Collegiate number) ProfId5ES=Prof Id 5 (EORI number) -ProfId6ES=- ProfId1FR=Prof Id 1 (SIREN) ProfId2FR=Prof Id 2 (SIRET) ProfId3FR=Prof Id 3 (NAF, old APE) ProfId4FR=Prof Id 4 (RCS/RM) ProfId5FR=Prof Id 5 (numéro EORI) -ProfId6FR=- -ProfId7FR=- -ProfId8FR=- -ProfId9FR=- -ProfId10FR=- ProfId1ShortFR=SIREN ProfId2ShortFR=SIRET ProfId3ShortFR=NAF ProfId4ShortFR=RCS ProfId5ShortFR=EORI -ProfId6ShortFR=- -ProfId7ShortFR=- -ProfId8ShortFR=- -ProfId9ShortFR=- -ProfId10ShortFR=- ProfId1GB=Registration Number -ProfId2GB=- ProfId3GB=SIC -ProfId4GB=- -ProfId5GB=- -ProfId6GB=- ProfId1HN=Id prof. 1 (RTN) -ProfId2HN=- -ProfId3HN=- -ProfId4HN=- -ProfId5HN=- -ProfId6HN=- ProfId1IN=Prof Id 1 (TIN) ProfId2IN=Prof Id 2 (PAN) ProfId3IN=Prof Id 3 (SRVC TAX) ProfId4IN=Prof Id 4 ProfId5IN=Prof Id 5 -ProfId6IN=- -ProfId1IT=- -ProfId2IT=- -ProfId3IT=- -ProfId4IT=- ProfId5IT=EORI number -ProfId6IT=- ProfId1LU=Id. prof. 1 (R.C.S. Luxembourg) ProfId2LU=Id. prof. 2 (Business permit) -ProfId3LU=- -ProfId4LU=- ProfId5LU=EORI number -ProfId6LU=- ProfId1MA=Id prof. 1 (R.C.) ProfId2MA=Id prof. 2 (Patente) ProfId3MA=Id prof. 3 (I.F.) ProfId4MA=Id prof. 4 (C.N.S.S.) ProfId5MA=Id prof. 5 (I.C.E.) -ProfId6MA=- ProfId1MX=Prof Id 1 (R.F.C). ProfId2MX=Prof Id 2 (R..P. IMSS) ProfId3MX=Prof Id 3 (Professional Charter) -ProfId4MX=- -ProfId5MX=- -ProfId6MX=- ProfId1NL=KVK nummer -ProfId2NL=- -ProfId3NL=- ProfId4NL=Burgerservicenummer (BSN) ProfId5NL=EORI number -ProfId6NL=- ProfId1PT=Prof Id 1 (NIPC) ProfId2PT=Prof Id 2 (Social security number) ProfId3PT=Prof Id 3 (Commercial Record number) ProfId4PT=Prof Id 4 (Conservatory) ProfId5PT=Prof Id 5 (EORI number) -ProfId6PT=- ProfId1SN=RC ProfId2SN=NINEA -ProfId3SN=- -ProfId4SN=- -ProfId5SN=- -ProfId6SN=- ProfId1TN=Prof Id 1 (RC) ProfId2TN=Prof Id 2 (Fiscal matricule) ProfId3TN=Prof Id 3 (Douane code) ProfId4TN=Prof Id 4 (BAN) -ProfId5TN=- -ProfId6TN=- ProfId1US=Prof Id (FEIN) -ProfId2US=- -ProfId3US=- -ProfId4US=- -ProfId5US=- -ProfId6US=- ProfId1RO=Prof Id 1 (CUI) ProfId2RO=Prof Id 2 (Nr. Înmatriculare) ProfId3RO=Prof Id 3 (CAEN) ProfId4RO=Prof Id 5 (EUID) ProfId5RO=Prof Id 5 (EORI number) -ProfId6RO=- ProfId1RU=Prof Id 1 (OGRN) ProfId2RU=Prof Id 2 (INN) ProfId3RU=Prof Id 3 (KPP) ProfId4RU=Prof Id 4 (OKPO) -ProfId5RU=- -ProfId6RU=- ProfId1UA=Prof Id 1 (EDRPOU) ProfId2UA=Prof Id 2 (DRFO) ProfId3UA=Prof Id 3 (INN) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 7db221036f3..39cbc75b199 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1539,9 +1539,11 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio $i = 1; $j = 0; $NBCOLS = ($conf->browser->layout == 'phone' ? 1 : 2); - while ($i <= 6) { + $NBPROFIDMIN = getDolGlobalInt('THIRDPARTY_MIN_NB_PROF_ID', 2); + $NBPROFIDMAX = getDolGlobalInt('THIRDPARTY_MAX_NB_PROF_ID', 6); + while ($i <= $NBPROFIDMAX) { $idprof = $langs->transcountry('ProfId'.$i, $object->country_code); - if ($idprof != '-') { + if ($idprof != '-' && ($i <= $NBPROFIDMIN || !empty($langs->tab_translate['ProfId'.$i.$object->country_code]))) { $key = 'idprof'.$i; if (($j % $NBCOLS) == 0) { @@ -2281,9 +2283,11 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio $i = 1; $j = 0; $NBCOLS = ($conf->browser->layout == 'phone' ? 1 : 2); - while ($i <= 6) { + $NBPROFIDMIN = getDolGlobalInt('THIRDPARTY_MIN_NB_PROF_ID', 2); + $NBPROFIDMAX = getDolGlobalInt('THIRDPARTY_MAX_NB_PROF_ID', 6); + while ($i <= $NBPROFIDMAX) { $idprof = $langs->transcountry('ProfId'.$i, $object->country_code); - if ($idprof != '-') { + if ($idprof != '-' && ($i <= $NBPROFIDMIN || !empty($langs->tab_translate['ProfId'.$i.$object->country_code]))) { $key = 'idprof'.$i; if (($j % $NBCOLS) == 0) { @@ -2705,10 +2709,11 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio // Prof ids $i = 1; $j = 0; - while ($i <= 6) { + $NBPROFIDMIN = getDolGlobalInt('THIRDPARTY_MIN_NB_PROF_ID', 2); + $NBPROFIDMAX = getDolGlobalInt('THIRDPARTY_MAX_NB_PROF_ID', 6); + while ($i <= $NBPROFIDMAX) { $idprof = $langs->transcountry('ProfId'.$i, $object->country_code); - if ($idprof != '-') { - //if (($j % 2) == 0) print '<tr>'; + if ($idprof != '-' && ($i <= $NBPROFIDMIN || !empty($langs->tab_translate['ProfId'.$i.$object->country_code]))) { print '<tr>'; print '<td>'.$idprof.'</td><td>'; $key = 'idprof'.$i; @@ -2723,13 +2728,11 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio } } print '</td>'; - //if (($j % 2) == 1) print '</tr>'; print '</tr>'; $j++; } $i++; } - //if ($j % 2 == 1) print '<td colspan="2"></td></tr>'; // This fields are used to know VAT to include in an invoice when the thirdparty is making a sale, so when it is a supplier. diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index dfdf1bc9439..ee97261191a 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -3961,6 +3961,13 @@ table.liste tr:last-of-type td, table.noborder:not(#tablelines):not(#tableliness border-bottom-color: var(--colortopbordertitle1); border-bottom-style: solid; } +/* CSS to remove the interline border */ +table.nointerlines tr:not(:last-child) td { + border-bottom: unset !important; + border-top: unset !important; +} + + /* div.tabBar div.fichehalfright table.noborder:not(.margintable):not(.paymenttable):not(.lastrecordtable):last-of-type { border-bottom: 1px solid var(--colortopbordertitle1); @@ -4019,10 +4026,10 @@ table.liste tr, table.noborder tr, div.noborder form { min-height: 20px; } table.liste th, table.noborder th, table.noborder tr.liste_titre td, table.noborder tr.box_titre td { - padding: 7px 8px 7px 8px; /* t r b l */ + padding: 7px 10px 7px 12px; /* t r b l */ } table.liste td, table.noborder td, div.noborder form div, table.tableforservicepart1 td, table.tableforservicepart2 td { - padding: 8px 6px 8px 6px; /* t r b l */ + padding: 8px 10px 8px 12px; /* t r b l */ /* line-height: 22px; This create trouble on cell login on list of last events of a contract*/ height: 22px; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 129015d839b..d569b99b6b3 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -4086,6 +4086,11 @@ table.paddingtopbottomonly tr td { padding-top: 1px; padding-bottom: 2px; } +/* CSS to remove the interline border */ +table.nointerlines tr:not(:last-child) td { + border-bottom: unset !important; + border-top: unset !important; +} .liste_titre_filter { background: var(--colorbacktitle1) !important; @@ -4117,11 +4122,11 @@ tr#trlinefordates td { } table.liste th, table.noborder th, table.noborder tr.liste_titre td, table.noborder tr.box_titre td { - padding: 8px 6px 8px 6px; /* t r b l */ + padding: 8px 8px 8px 10px; /* t r b l */ } table.liste td, table.noborder td, div.noborder form div, table.tableforservicepart1 td, table.tableforservicepart2 td { - padding: 4px 6px 4px 6px; /* t r b l */ + padding: 4px 8px 4px 10px; /* t r b l */ height: 22px; } table.liste tr.trkanban td { From 0ce6e016b42b9c2f910019f898c9f27bbf40cbcd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Sat, 23 Mar 2024 16:29:23 +0100 Subject: [PATCH 159/178] Update bank.php --- htdocs/user/bank.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php index 616e9198e7e..44577d24e8a 100644 --- a/htdocs/user/bank.php +++ b/htdocs/user/bank.php @@ -85,13 +85,13 @@ if (empty($account->userid)) { } // Define value to know what current user can do on users -$selfpermission = ( $user->id == $id && $user->hasRight('user', 'self', 'creer')); +$selfpermission = ($user->id == $id && $user->hasRight('user', 'self', 'creer')); $canadduser = (!empty($user->admin) || $user->hasRight('user', 'user', 'creer') || $user->hasRight('hrm', 'write_personal_information', 'write') ); $canreaduser = (!empty($user->admin) || $user->hasRight('user', 'user', 'lire') || $user->hasRight('hrm', 'read_personal_information', 'read') ); $permissiontoaddbankaccount = ($user->hasRight('salaries', 'write') || $user->hasRight('hrm', 'employee', 'write') || $user->hasRight('user', 'user', 'creer') || $selfpermission); $permissiontoreadhr = $user->hasRight('hrm', 'read_personal_information', 'read') || $user->hasRight('hrm', 'write_personal_information', 'write'); $permissiontowritehr = $user->hasRight('hrm', 'write_personal_information', 'write'); -$permissiontosimpleedit = ( $selfpermission || $canadduser ); +$permissiontosimpleedit = ($selfpermission || $canadduser); // Ok if user->hasRight('salaries', 'readall') or user->hasRight('hrm', 'read') //$result = restrictedArea($user, 'salaries|hrm', $object->id, 'user&user', $feature2); @@ -495,7 +495,7 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac } // Personal email - if ($user->hasRight('hrm', 'read_personal_information', 'read') || $user->hasRight('hrm', 'write_personal_information', 'write') || $permissiontosimpleedit) { + if ($user->hasRight('hrm', 'read_personal_information', 'read') || $user->hasRight('hrm', 'write_personal_information', 'write') || ) { print '<tr class="nowrap">'; print '<td>'; print $form->editfieldkey("UserPersonalEmail", 'personal_email', $object->personal_email, $object, $user->hasRight('user', 'user', 'creer') || $user->hasRight('hrm', 'write_personal_information', 'write')); @@ -506,7 +506,7 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac } // Personal phone - if ($user->hasRight('hrm', 'read_personal_information', 'read') || $user->hasRight('hrm', 'write_personal_information', 'write') || $permissiontosimpleedit) { + if ($user->hasRight('hrm', 'read_personal_information', 'read') || $user->hasRight('hrm', 'write_personal_information', 'write') || ) { print '<tr class="nowrap">'; print '<td>'; print $form->editfieldkey("UserPersonalMobile", 'personal_mobile', $object->personal_mobile, $object, $user->hasRight('user', 'user', 'creer') || $user->hasRight('hrm', 'write_personal_information', 'write')); From f7323cd7bfab1e6b36e2beea9fc2b953a14db2a1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Sat, 23 Mar 2024 16:30:46 +0100 Subject: [PATCH 160/178] Update list.php --- htdocs/expensereport/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index 0a78143fb06..ccabebed79f 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -103,7 +103,7 @@ if (!$sortfield) { $sall = trim((GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); $search_ref = GETPOST('search_ref', 'alpha'); -$search_user = GETPOST('search_user', 'int'); +$search_user = GETPOST('search_user', 'intcomma'); $search_amount_ht = GETPOST('search_amount_ht', 'alpha'); $search_amount_vat = GETPOST('search_amount_vat', 'alpha'); $search_amount_ttc = GETPOST('search_amount_ttc', 'alpha'); From 7521febb881e96e386cd435cfb0d6ba28c1f0db9 Mon Sep 17 00:00:00 2001 From: Francis Appels <francis.appels@yahoo.com> Date: Sat, 23 Mar 2024 16:43:53 +0100 Subject: [PATCH 161/178] Fix cancel edit line dispatch should not update line --- htdocs/fourn/commande/dispatch.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index f9ec2a67379..9de6922119f 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -451,7 +451,7 @@ if ($action == 'confirm_deleteline' && $confirm == 'yes' && $permissiontoreceive } // Update a dispatched line -if ($action == 'updateline' && $permissiontoreceive) { +if ($action == 'updateline' && $permissiontoreceive && empty($cancel)) { $db->begin(); $error = 0; From b36b915140450b1ae68b06a54cbeb021f6398001 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Sat, 23 Mar 2024 16:50:34 +0100 Subject: [PATCH 162/178] Fix access to db results (fix PhanNonClassMethodCall) # Fix access to db results (fix PhanNonClassMethodCall) Fixed the access to db results - may need to be backported --- htdocs/accountancy/bookkeeping/balance.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index b27805ca1a7..8dc85fb642c 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -475,9 +475,9 @@ if ($action != 'export_csv') { $resql = $db->query($sql); $opening_balances = array(); if ($resql) { - $nrows = $resql->num_rows; + $nrows = $db->num_rows($resql); for ($i = 0; $i < $nrows; $i++) { - $arr = $resql->fetch_array(); + $arr = $db->fetch_array($resql); $opening_balances["'" . $arr['numero_compte'] . "'"] = $arr['opening_balance']; } } From 50aadc43f90fbd96c4343289ad1aa01196da32dd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Sat, 23 Mar 2024 17:18:11 +0100 Subject: [PATCH 163/178] NEW Upgrade jsChantImproved to 2.8.10 --- COPYRIGHT | 2 +- dev/dolibarr_changes.txt | 45 +- htdocs/includes/jsgantt/jsgantt.css | 76 +- htdocs/includes/jsgantt/jsgantt.js | 2390 +++++++++++++++++---------- htdocs/projet/ganttchart.inc.php | 6 +- htdocs/projet/ganttview.php | 2 +- htdocs/projet/tasks/contact.php | 4 +- htdocs/theme/eldy/global.inc.php | 2 +- 8 files changed, 1566 insertions(+), 961 deletions(-) diff --git a/COPYRIGHT b/COPYRIGHT index e6525d5ccb2..a94d93ede38 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -68,7 +68,7 @@ jQuery jqueryFileTree 1.0.1 GPL and MIT License Yes jQuery jquerytreeview 1.4.1 MIT License Yes JS library for filetree jQuery TableDnD 0.6 GPL and MIT License Yes JS library plugin TableDnD (to reorder table rows) jQuery Timepicker 1.1.0 GPL and MIT License Yes JS library Timepicker addon for Datepicker -jsGanttImproved 2.7.3 BSD License Yes JS library (to build Gantt reports) +jsGanttImproved 2.8.10 BSD License Yes JS library (to build Gantt reports) SwaggerUI 2.2.10 GPL-2+ Yes JS library to offer the REST API explorer Image libraries: diff --git a/dev/dolibarr_changes.txt b/dev/dolibarr_changes.txt index 58723960150..3f62333d5e8 100644 --- a/dev/dolibarr_changes.txt +++ b/dev/dolibarr_changes.txt @@ -31,7 +31,7 @@ Replace: d.items&& With d&&d.items&& - + ESCPOS: ------- @@ -55,8 +55,8 @@ NUSOAP: * Line 1257 of file nusoap.php. Add: libxml_disable_entity_loader(true); // Avoid load of external entities (security problem). Required only for libxml < 2. - - + + * Line 4346 of file nusoap.php $rev = array(); @@ -128,13 +128,13 @@ with if (!@TCPDF_STATIC::file_exists($file)) { // DOL CHANGE If we keep this, the image is not visible on pages after the first one. //var_dump($file.' '.(!@TCPDF_STATIC::file_exists($file))); - //return false; + //return false; $tfile = str_replace(' ', '%20', $file); if (@TCPDF_STATIC::file_exists($tfile)) { $file = $tfile; } } - + * Replace in tcpdf.php: if (($imgsrc[0] === '/') AND !empty($_SERVER['DOCUMENT_ROOT']) AND ($_SERVER['DOCUMENT_ROOT'] != '/')) { with @@ -174,7 +174,7 @@ with imagesetpixel($imgalpha, $xpx, $ypx, $alpha); into imagesetpixel($imgalpha, $xpx, $ypx, (int) $alpha); - + * Removed useless directories ("examples", "tools") * Optionally, removed all fonts except @@ -243,7 +243,7 @@ with: with foreach ($value[1] as $k => $v) { -* Fix by replacing +* Fix by replacing if ($res[0] == PDF_TYPE_OBJECT) with if (isset($res[0]) && $res[0] == PDF_TYPE_OBJECT) @@ -253,23 +253,16 @@ with JSGANTT: -------- * Replace in function JSGantt.taskLink - var OpenWindow=window.open(pRef, "newwin", "height="+vHeight+",width="+vWidth); + window.open(pRef, 'newwin', 'height=' + vHeight + ',width=' + vWidth); with - // LDR To open in same window + // @CHANGE DOLI To open in same window //var OpenWindow=window.open(pRef, "newwin", "height="+vHeight+",width="+vWidth); window.location.href=pRef -* Replace - vTmpDiv=this.newNode(vTmpCell, 'div', null, null, vTaskList[i].getResource()); -with - var vTmpNode=this.newNode(vTmpCell, 'div', null, ''); - vTmpNode=this.newNode(vTmpNode, 'a', null, '', vLangs[vLang]['moreinfo']); - vTmpNode.setAttribute('href',vTaskList[i].getLink()); - * Replace '% Comp.' to have a smaller text column header - 'comp':'% Comp.' + 'comp': '%...' with - 'comp':'%' + 'comp': '%' @@ -307,19 +300,19 @@ RESTLER: // @CHANGE LDR if (!is_string($haystack)) return false; -* Replace +* Replace $loaders = array_unique(static::$rogueLoaders); - - with - + + with + $loaders = array_unique(static::$rogueLoaders, SORT_REGULAR); - + * Replace CommentParser.php line 423 elseif (count($value) && is_numeric($value[0])) - + with - + elseif (count($value) && isset($value[0]) && is_numeric($value[0])) * Add CommentParser.php line 406 & 407 to remove a warning on api request in php 8.1 @@ -417,5 +410,3 @@ Edit CSS to restore line removed between 4.0.5 and 4.0.6. It generates this bug: .select2-hidden-accessible { margin: -10000px !important; /* line to restore */ } - - diff --git a/htdocs/includes/jsgantt/jsgantt.css b/htdocs/includes/jsgantt/jsgantt.css index f5c2d2971f8..3c9121a3c13 100644 --- a/htdocs/includes/jsgantt/jsgantt.css +++ b/htdocs/includes/jsgantt/jsgantt.css @@ -2,7 +2,7 @@ div.gantt { font-family: tahoma, arial, verdana, Sans-serif; - font-size: 10px; + font-size: 12px; color: #656565; } @@ -31,10 +31,9 @@ div.gantt { font-size: 12px; border: #efefef 1px solid; text-align: center; - cursor: default + cursor: default; } - .gtasklist { height: 19px; min-width: 5px; @@ -44,7 +43,7 @@ div.gantt { border-right: none; } -.gtasknolist-label{ +.gtasknolist-label { padding: 10px 50px; } /* all three width values set just to make sure - helps resizing code */ @@ -56,7 +55,7 @@ div.gantt { .gminorheading { background-color: #ffffff; font-weight: bold; - font-size: 9px; + font-size: 11px; white-space: nowrap; } @@ -154,9 +153,9 @@ td.gspanning { .gtaskname { min-width: 170px; - max-width: 170px; - width: 170px; - font-size: 9px; + max-width: 220px; + width: 220px; + font-size: 12px; border-left: none; } @@ -246,6 +245,11 @@ span.gfoldercollapse { background-color: #fffde5; } +.gitemdifferent td { + background-image: none; + background-color: rgba(0, 0, 0, 0.05); +} + /* task bar caption text styles */ .gmilecaption, @@ -487,7 +491,7 @@ span.gfoldercollapse { div.gtaskbarcontainer { z-index: 1; position: absolute; - top: 0px + top: 0px; } .textbar { @@ -510,7 +514,7 @@ div.gtaskbarcontainer { font-size: 10px; display: block; background: #ffffff; - color: #656565 + color: #656565; } .gTaskInfo { @@ -652,7 +656,7 @@ div.gtaskbarcontainer { /* Old Internet Explorer version hacks */ .gantt { - _height: 100% + _height: 100%; } /* otherwise the chart disappears! */ @@ -777,7 +781,6 @@ td.gspanning div { } @media print { - /* All your print styles go here */ html, .gchartgrid { @@ -787,6 +790,32 @@ td.gspanning div { .glistgrid { float: none !important; } + + /* Hide scrollbar for Chrome, Safari and Opera */ + .gchartcontainer *::-webkit-scrollbar { + display: none; + } + + /* Hide scrollbar for IE, Edge and Firefox */ + .gchartcontainer * { + -ms-overflow-style: none; /* IE and Edge */ + scrollbar-width: none; /* Firefox */ + } + + /* Hide tool-tip */ + .JSGanttToolTip { + display: none !important; + } + + /* This is the default css, injected by the JSGantt.printChart(width,height); function --> + @page { + size: ${width}mm ${height}mm; + } + + .gchartcontainer { + width: ${width}mm; + } + <-- This will be injected by the JSGantt.printChart() function */ } /* if using setUseSingleCell(1) the following is a suggested set of CSS3 styles to recreate the table grid - won't work on old browsers @@ -812,16 +841,21 @@ td.gspanning div { display: flex; flex-direction: column; + /* Allow resize */ + resize: horizontal; } .gmainright { overflow: hidden; - flex: auto; + flex: 1 1 auto; } .gmainleft { overflow: hidden; - flex: 0 0 50%; + flex: 0 0 20%; + min-width: 220px; + /* Allow side to grow and shrink */ + flex: 1 0 auto; } .gtasktableh tr, @@ -927,25 +961,25 @@ td.gspanning div { } table { - page-break-after: auto + page-break-after: auto; } tr { page-break-inside: avoid; - page-break-after: auto + page-break-after: auto; } td { page-break-inside: avoid; - page-break-after: auto + page-break-after: auto; } thead { - display: table-header-group + display: table-header-group; } tfoot { - display: table-footer-group + display: table-footer-group; } } @@ -966,7 +1000,7 @@ td.gspanning div { border-radius: 8px; border: 2px solid white; /* should match background, can't be transparent */ - background-color: rgba(0, 0, 0, .5); + background-color: rgba(0, 0, 0, 0.5); } .frame::-webkit-scrollbar-track { @@ -979,4 +1013,4 @@ td.gspanning div { overflow: scroll; -ms-overflow-style: scrollbar; display: block; -} \ No newline at end of file +} diff --git a/htdocs/includes/jsgantt/jsgantt.js b/htdocs/includes/jsgantt/jsgantt.js index be9a20611f2..d0ba238bb89 100644 --- a/htdocs/includes/jsgantt/jsgantt.js +++ b/htdocs/includes/jsgantt/jsgantt.js @@ -1,6 +1,7 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.JSGantt = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); +exports.JSGantt = void 0; var jsGantt = require("./src/jsgantt"); module.exports = jsGantt.JSGantt; exports.JSGantt = jsGantt.JSGantt; @@ -8,6 +9,7 @@ exports.JSGantt = jsGantt.JSGantt; },{"./src/jsgantt":6}],2:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); +exports.GanttChart = void 0; var lang = require("./lang"); var events_1 = require("./events"); var general_utils_1 = require("./utils/general_utils"); @@ -60,7 +62,7 @@ exports.GanttChart = function (pDiv, pFormat) { 3: true, 4: true, 5: true, - 6: true + 6: true, }; this.vEventClickCollapse = null; this.vEventClickRow = null; @@ -79,7 +81,7 @@ exports.GanttChart = function (pDiv, pFormat) { beforeLineDraw: null, afterLineDraw: null, onLineDraw: null, - onLineContainerHover: null + onLineContainerHover: null, }; this.vEventsChange = { taskname: null, @@ -91,36 +93,36 @@ exports.GanttChart = function (pDiv, pFormat) { planstartdate: null, planenddate: null, cost: null, - line: null + line: null, }; this.vResources = null; this.vAdditionalHeaders = {}; this.vColumnOrder = draw_columns_1.COLUMN_ORDER; this.vEditable = false; this.vDebug = false; - this.vShowSelector = new Array('top'); - this.vDateInputFormat = 'yyyy-mm-dd'; - this.vDateTaskTableDisplayFormat = date_utils_1.parseDateFormatStr('dd/mm/yyyy'); - this.vDateTaskDisplayFormat = date_utils_1.parseDateFormatStr('dd month yyyy'); - this.vHourMajorDateDisplayFormat = date_utils_1.parseDateFormatStr('day dd month yyyy'); - this.vHourMinorDateDisplayFormat = date_utils_1.parseDateFormatStr('HH'); - this.vDayMajorDateDisplayFormat = date_utils_1.parseDateFormatStr('dd/mm/yyyy'); - this.vDayMinorDateDisplayFormat = date_utils_1.parseDateFormatStr('dd'); - this.vWeekMajorDateDisplayFormat = date_utils_1.parseDateFormatStr('yyyy'); - this.vWeekMinorDateDisplayFormat = date_utils_1.parseDateFormatStr('dd/mm'); - this.vMonthMajorDateDisplayFormat = date_utils_1.parseDateFormatStr('yyyy'); - this.vMonthMinorDateDisplayFormat = date_utils_1.parseDateFormatStr('mon'); - this.vQuarterMajorDateDisplayFormat = date_utils_1.parseDateFormatStr('yyyy'); - this.vQuarterMinorDateDisplayFormat = date_utils_1.parseDateFormatStr('qq'); - this.vUseFullYear = date_utils_1.parseDateFormatStr('dd/mm/yyyy'); + this.vShowSelector = new Array("top"); + this.vDateInputFormat = "yyyy-mm-dd"; + this.vDateTaskTableDisplayFormat = date_utils_1.parseDateFormatStr("dd/mm/yyyy"); + this.vDateTaskDisplayFormat = date_utils_1.parseDateFormatStr("dd month yyyy"); + this.vHourMajorDateDisplayFormat = date_utils_1.parseDateFormatStr("day dd month yyyy"); + this.vHourMinorDateDisplayFormat = date_utils_1.parseDateFormatStr("HH"); + this.vDayMajorDateDisplayFormat = date_utils_1.parseDateFormatStr("dd/mm/yyyy"); + this.vDayMinorDateDisplayFormat = date_utils_1.parseDateFormatStr("dd"); + this.vWeekMajorDateDisplayFormat = date_utils_1.parseDateFormatStr("yyyy"); + this.vWeekMinorDateDisplayFormat = date_utils_1.parseDateFormatStr("dd/mm"); + this.vMonthMajorDateDisplayFormat = date_utils_1.parseDateFormatStr("yyyy"); + this.vMonthMinorDateDisplayFormat = date_utils_1.parseDateFormatStr("mon"); + this.vQuarterMajorDateDisplayFormat = date_utils_1.parseDateFormatStr("yyyy"); + this.vQuarterMinorDateDisplayFormat = date_utils_1.parseDateFormatStr("qq"); + this.vUseFullYear = date_utils_1.parseDateFormatStr("dd/mm/yyyy"); this.vCaptionType; this.vDepId = 1; this.vTaskList = new Array(); - this.vFormatArr = new Array('hour', 'day', 'week', 'month', 'quarter'); + this.vFormatArr = new Array("hour", "day", "week", "month", "quarter"); this.vMonthDaysArr = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); this.vProcessNeeded = true; this.vMinGpLen = 8; - this.vScrollTo = ''; + this.vScrollTo = ""; this.vHourColWidth = 18; this.vDayColWidth = 18; this.vWeekColWidth = 36; @@ -129,7 +131,7 @@ exports.GanttChart = function (pDiv, pFormat) { this.vRowHeight = 20; this.vTodayPx = -1; this.vLangs = lang; - this.vLang = navigator.language && navigator.language in lang ? navigator.language : 'en'; + this.vLang = navigator.language && navigator.language in lang ? navigator.language : "en"; this.vChartBody = null; this.vChartHead = null; this.vListBody = null; @@ -160,12 +162,12 @@ exports.GanttChart = function (pDiv, pFormat) { this.DrawDependencies = draw_dependencies_1.DrawDependencies.bind(this); this.getArrayLocationByID = draw_utils_1.getArrayLocationByID.bind(this); this.drawSelector = draw_utils_1.drawSelector.bind(this); + this.printChart = general_utils_1.printChart.bind(this); this.clearDependencies = function () { var parent = this.getLines(); - if (this.vEventsChange.line && - typeof this.vEventsChange.line === 'function') { - this.removeListener('click', this.vEventsChange.line, parent); - this.addListener('click', this.vEventsChange.line, parent); + if (this.vEventsChange.line && typeof this.vEventsChange.line === "function") { + this.removeListener("click", this.vEventsChange.line, parent); + this.addListener("click", this.vEventsChange.line, parent); } while (parent.hasChildNodes()) parent.removeChild(parent.firstChild); @@ -173,20 +175,20 @@ exports.GanttChart = function (pDiv, pFormat) { }; this.drawListHead = function (vLeftHeader) { var _this = this; - var vTmpDiv = draw_utils_1.newNode(vLeftHeader, 'div', this.vDivId + 'glisthead', 'glistlbl gcontainercol'); + var vTmpDiv = draw_utils_1.newNode(vLeftHeader, "div", this.vDivId + "glisthead", "glistlbl gcontainercol"); var gListLbl = vTmpDiv; this.setListBody(vTmpDiv); - var vTmpTab = draw_utils_1.newNode(vTmpDiv, 'table', null, 'gtasktableh'); - var vTmpTBody = draw_utils_1.newNode(vTmpTab, 'tbody'); - var vTmpRow = draw_utils_1.newNode(vTmpTBody, 'tr'); - draw_utils_1.newNode(vTmpRow, 'td', null, 'gtasklist', '\u00A0'); - var vTmpCell = draw_utils_1.newNode(vTmpRow, 'td', null, 'gspanning gtaskname', null, null, null, null, this.getColumnOrder().length + 1); - vTmpCell.appendChild(this.drawSelector('top')); - vTmpRow = draw_utils_1.newNode(vTmpTBody, 'tr'); - draw_utils_1.newNode(vTmpRow, 'td', null, 'gtasklist', '\u00A0'); - draw_utils_1.newNode(vTmpRow, 'td', null, 'gtaskname', '\u00A0'); + var vTmpTab = draw_utils_1.newNode(vTmpDiv, "table", null, "gtasktableh"); + var vTmpTBody = draw_utils_1.newNode(vTmpTab, "tbody"); + var vTmpRow = draw_utils_1.newNode(vTmpTBody, "tr"); + draw_utils_1.newNode(vTmpRow, "td", null, "gtasklist", "\u00A0"); + var vTmpCell = draw_utils_1.newNode(vTmpRow, "td", null, "gspanning gtaskname", null, null, null, null, this.getColumnOrder().length + 1); + vTmpCell.appendChild(this.drawSelector("top")); + vTmpRow = draw_utils_1.newNode(vTmpTBody, "tr"); + draw_utils_1.newNode(vTmpRow, "td", null, "gtasklist", "\u00A0"); + draw_utils_1.newNode(vTmpRow, "td", null, "gtaskname", "\u00A0"); this.getColumnOrder().forEach(function (column) { - if (_this[column] == 1 || column === 'vAdditionalHeaders') { + if (_this[column] == 1 || column === "vAdditionalHeaders") { draw_columns_1.draw_task_headings(column, vTmpRow, _this.vLangs, _this.vLang, _this.vAdditionalHeaders, _this.vEvents); } }); @@ -194,38 +196,38 @@ exports.GanttChart = function (pDiv, pFormat) { }; this.drawListBody = function (vLeftHeader) { var _this = this; - var vTmpContentTabOuterWrapper = draw_utils_1.newNode(vLeftHeader, 'div', null, 'gtasktableouterwrapper'); - var vTmpContentTabWrapper = draw_utils_1.newNode(vTmpContentTabOuterWrapper, 'div', null, 'gtasktablewrapper'); + var vTmpContentTabOuterWrapper = draw_utils_1.newNode(vLeftHeader, "div", null, "gtasktableouterwrapper"); + var vTmpContentTabWrapper = draw_utils_1.newNode(vTmpContentTabOuterWrapper, "div", null, "gtasktablewrapper"); vTmpContentTabWrapper.style.width = "calc(100% + " + general_utils_1.getScrollbarWidth() + "px)"; - var vTmpContentTab = draw_utils_1.newNode(vTmpContentTabWrapper, 'table', null, 'gtasktable'); - var vTmpContentTBody = draw_utils_1.newNode(vTmpContentTab, 'tbody'); + var vTmpContentTab = draw_utils_1.newNode(vTmpContentTabWrapper, "table", null, "gtasktable"); + var vTmpContentTBody = draw_utils_1.newNode(vTmpContentTab, "tbody"); var vNumRows = 0; var _loop_1 = function (i) { var vBGColor = void 0; if (this_1.vTaskList[i].getGroup() == 1) - vBGColor = 'ggroupitem'; + vBGColor = "ggroupitem"; else - vBGColor = 'glineitem'; + vBGColor = "glineitem a"; var vID = this_1.vTaskList[i].getID(); var vTmpRow_1, vTmpCell_1 = void 0; - if ((!(this_1.vTaskList[i].getParItem() && this_1.vTaskList[i].getParItem().getGroup() == 2)) || this_1.vTaskList[i].getGroup() == 2) { + if (!(this_1.vTaskList[i].getParItem() && this_1.vTaskList[i].getParItem().getGroup() == 2) || this_1.vTaskList[i].getGroup() == 2) { if (this_1.vTaskList[i].getVisible() == 0) - vTmpRow_1 = draw_utils_1.newNode(vTmpContentTBody, 'tr', this_1.vDivId + 'child_' + vID, 'gname ' + vBGColor, null, null, null, 'none'); + vTmpRow_1 = draw_utils_1.newNode(vTmpContentTBody, "tr", this_1.vDivId + "child_" + vID, "gname " + vBGColor, null, null, null, "none"); else - vTmpRow_1 = draw_utils_1.newNode(vTmpContentTBody, 'tr', this_1.vDivId + 'child_' + vID, 'gname ' + vBGColor); + vTmpRow_1 = draw_utils_1.newNode(vTmpContentTBody, "tr", this_1.vDivId + "child_" + vID, "gname " + vBGColor); this_1.vTaskList[i].setListChildRow(vTmpRow_1); - draw_utils_1.newNode(vTmpRow_1, 'td', null, 'gtasklist', '\u00A0'); - var editableClass = this_1.vEditable ? 'gtaskname gtaskeditable' : 'gtaskname'; - vTmpCell_1 = draw_utils_1.newNode(vTmpRow_1, 'td', null, editableClass); - var vCellContents = ''; + draw_utils_1.newNode(vTmpRow_1, "td", null, "gtasklist", "\u00A0"); + var editableClass = this_1.vEditable ? "gtaskname gtaskeditable" : "gtaskname"; + vTmpCell_1 = draw_utils_1.newNode(vTmpRow_1, "td", null, editableClass); + var vCellContents = ""; for (var j = 1; j < this_1.vTaskList[i].getLevel(); j++) { - vCellContents += '\u00A0\u00A0\u00A0\u00A0'; + vCellContents += "\u00A0\u00A0\u00A0\u00A0"; } var task_2 = this_1.vTaskList[i]; var vEventClickRow_1 = this_1.vEventClickRow; var vEventClickCollapse_1 = this_1.vEventClickCollapse; - events_1.addListener('click', function (e) { - if (e.target.classList.contains('gfoldercollapse') === false) { + events_1.addListener("click", function (e) { + if (e.target.classList.contains("gfoldercollapse") === false) { if (vEventClickRow_1 && typeof vEventClickRow_1 === "function") { vEventClickRow_1(task_2); } @@ -237,29 +239,29 @@ exports.GanttChart = function (pDiv, pFormat) { } }, vTmpRow_1); if (this_1.vTaskList[i].getGroup() == 1) { - var vTmpDiv = draw_utils_1.newNode(vTmpCell_1, 'div', null, null, vCellContents); - var vTmpSpan = draw_utils_1.newNode(vTmpDiv, 'span', this_1.vDivId + 'group_' + vID, 'gfoldercollapse', (this_1.vTaskList[i].getOpen() == 1) ? '-' : '+'); + var vTmpDiv = draw_utils_1.newNode(vTmpCell_1, "div", null, null, vCellContents); + var vTmpSpan = draw_utils_1.newNode(vTmpDiv, "span", this_1.vDivId + "group_" + vID, "gfoldercollapse", this_1.vTaskList[i].getOpen() == 1 ? "-" : "+"); this_1.vTaskList[i].setGroupSpan(vTmpSpan); events_1.addFolderListeners(this_1, vTmpSpan, vID); - var divTask = document.createElement('span'); - divTask.innerHTML = '\u00A0' + this_1.vTaskList[i].getName(); + var divTask = document.createElement("span"); + divTask.innerHTML = "\u00A0" + this_1.vTaskList[i].getName(); vTmpDiv.appendChild(divTask); // const text = makeInput(this.vTaskList[i].getName(), this.vEditable, 'text'); // vTmpDiv.appendChild(document.createNode(text)); var callback = function (task, e) { return task.setName(e.target.value); }; - events_1.addListenerInputCell(vTmpCell_1, this_1.vEventsChange, callback, this_1.vTaskList, i, 'taskname', this_1.Draw.bind(this_1)); - events_1.addListenerClickCell(vTmpDiv, this_1.vEvents, this_1.vTaskList[i], 'taskname'); + events_1.addListenerInputCell(vTmpCell_1, this_1.vEventsChange, callback, this_1.vTaskList, i, "taskname", this_1.Draw.bind(this_1)); + events_1.addListenerClickCell(vTmpDiv, this_1.vEvents, this_1.vTaskList[i], "taskname"); } else { - vCellContents += '\u00A0\u00A0\u00A0\u00A0'; - var text = draw_utils_1.makeInput(this_1.vTaskList[i].getName(), this_1.vEditable, 'text'); - var vTmpDiv = draw_utils_1.newNode(vTmpCell_1, 'div', null, null, vCellContents + text); + vCellContents += "\u00A0\u00A0\u00A0\u00A0"; + var text = draw_utils_1.makeInput(this_1.vTaskList[i].getName(), this_1.vEditable, "text"); + var vTmpDiv = draw_utils_1.newNode(vTmpCell_1, "div", null, null, vCellContents + text); var callback = function (task, e) { return task.setName(e.target.value); }; - events_1.addListenerInputCell(vTmpCell_1, this_1.vEventsChange, callback, this_1.vTaskList, i, 'taskname', this_1.Draw.bind(this_1)); - events_1.addListenerClickCell(vTmpCell_1, this_1.vEvents, this_1.vTaskList[i], 'taskname'); + events_1.addListenerInputCell(vTmpCell_1, this_1.vEventsChange, callback, this_1.vTaskList, i, "taskname", this_1.Draw.bind(this_1)); + events_1.addListenerClickCell(vTmpCell_1, this_1.vEvents, this_1.vTaskList[i], "taskname"); } this_1.getColumnOrder().forEach(function (column) { - if (_this[column] == 1 || column === 'vAdditionalHeaders') { + if (_this[column] == 1 || column === "vAdditionalHeaders") { draw_columns_1.draw_header(column, i, vTmpRow_1, _this.vTaskList, _this.vEditable, _this.vEventsChange, _this.vEvents, _this.vDateTaskTableDisplayFormat, _this.vAdditionalHeaders, _this.vFormat, _this.vLangs, _this.vLang, _this.vResources, _this.Draw.bind(_this)); } }); @@ -272,23 +274,21 @@ exports.GanttChart = function (pDiv, pFormat) { } // Render no daa in the chart if (this.vTaskList.length == 0) { - var totalColumns = this.getColumnOrder() - .filter(function (column) { return _this[column] == 1 || column === 'vAdditionalHeaders'; }) - .length; - var vTmpRow_2 = draw_utils_1.newNode(vTmpContentTBody, 'tr', this.vDivId + 'child_', 'gname '); + var totalColumns = this.getColumnOrder().filter(function (column) { return _this[column] == 1 || column === "vAdditionalHeaders"; }).length; + var vTmpRow_2 = draw_utils_1.newNode(vTmpContentTBody, "tr", this.vDivId + "child_", "gname "); // this.vTaskList[i].setListChildRow(vTmpRow); - var vTmpCell_2 = draw_utils_1.newNode(vTmpRow_2, 'td', null, 'gtasknolist', '', null, null, null, totalColumns); + var vTmpCell_2 = draw_utils_1.newNode(vTmpRow_2, "td", null, "gtasknolist", "", null, null, null, totalColumns); var vOutput = document.createDocumentFragment(); - draw_utils_1.newNode(vOutput, 'div', null, 'gtasknolist-label', this.vLangs[this.vLang]['nodata'] + '.'); + draw_utils_1.newNode(vOutput, "div", null, "gtasknolist-label", this.vLangs[this.vLang]["nodata"] + "."); vTmpCell_2.appendChild(vOutput); } // DRAW the date format selector at bottom left. - var vTmpRow = draw_utils_1.newNode(vTmpContentTBody, 'tr'); - draw_utils_1.newNode(vTmpRow, 'td', null, 'gtasklist', '\u00A0'); - var vTmpCell = draw_utils_1.newNode(vTmpRow, 'td', null, 'gspanning gtaskname'); - vTmpCell.appendChild(this.drawSelector('bottom')); + var vTmpRow = draw_utils_1.newNode(vTmpContentTBody, "tr"); + draw_utils_1.newNode(vTmpRow, "td", null, "gtasklist", "\u00A0"); + var vTmpCell = draw_utils_1.newNode(vTmpRow, "td", null, "gspanning gtaskname"); + vTmpCell.appendChild(this.drawSelector("bottom")); this.getColumnOrder().forEach(function (column) { - if (_this[column] == 1 || column === 'vAdditionalHeaders') { + if (_this[column] == 1 || column === "vAdditionalHeaders") { draw_columns_1.draw_bottom(column, vTmpRow, _this.vAdditionalHeaders); } }); @@ -298,7 +298,7 @@ exports.GanttChart = function (pDiv, pFormat) { // newNode(vTmpDiv2, 'br'); return { vNumRows: vNumRows, - vTmpContentTabWrapper: vTmpContentTabWrapper + vTmpContentTabWrapper: vTmpContentTabWrapper, }; }; /** @@ -308,15 +308,15 @@ exports.GanttChart = function (pDiv, pFormat) { */ this.drawChartHead = function (vMinDate, vMaxDate, vColWidth, vNumRows) { var vRightHeader = document.createDocumentFragment(); - var vTmpDiv = draw_utils_1.newNode(vRightHeader, 'div', this.vDivId + 'gcharthead', 'gchartlbl gcontainercol'); + var vTmpDiv = draw_utils_1.newNode(vRightHeader, "div", this.vDivId + "gcharthead", "gchartlbl gcontainercol"); var gChartLbl = vTmpDiv; this.setChartHead(vTmpDiv); - var vTmpTab = draw_utils_1.newNode(vTmpDiv, 'table', this.vDivId + 'chartTableh', 'gcharttableh'); - var vTmpTBody = draw_utils_1.newNode(vTmpTab, 'tbody'); - var vTmpRow = draw_utils_1.newNode(vTmpTBody, 'tr'); + var vTmpTab = draw_utils_1.newNode(vTmpDiv, "table", this.vDivId + "chartTableh", "gcharttableh"); + var vTmpTBody = draw_utils_1.newNode(vTmpTab, "tbody"); + var vTmpRow = draw_utils_1.newNode(vTmpTBody, "tr"); var vTmpDate = new Date(); vTmpDate.setFullYear(vMinDate.getFullYear(), vMinDate.getMonth(), vMinDate.getDate()); - if (this.vFormat == 'hour') + if (this.vFormat == "hour") vTmpDate.setHours(vMinDate.getHours()); else vTmpDate.setHours(0); @@ -326,90 +326,88 @@ exports.GanttChart = function (pDiv, pFormat) { var vColSpan = 1; // Major Date Header while (vTmpDate.getTime() <= vMaxDate.getTime()) { - var vHeaderCellClass = 'gmajorheading'; - var vCellContents = ''; - if (this.vFormat == 'day') { + var vHeaderCellClass = "gmajorheading"; + var vCellContents = ""; + if (this.vFormat == "day") { var colspan = 7; if (!this.vShowWeekends) { - vHeaderCellClass += ' headweekends'; + vHeaderCellClass += " headweekends"; colspan = 5; } - var vTmpCell = draw_utils_1.newNode(vTmpRow, 'td', null, vHeaderCellClass, null, null, null, null, colspan); + var vTmpCell = draw_utils_1.newNode(vTmpRow, "td", null, vHeaderCellClass, null, null, null, null, colspan); vCellContents += date_utils_1.formatDateStr(vTmpDate, this.vDayMajorDateDisplayFormat, this.vLangs[this.vLang]); vTmpDate.setDate(vTmpDate.getDate() + 6); if (this.vShowEndWeekDate == 1) - vCellContents += ' - ' + date_utils_1.formatDateStr(vTmpDate, this.vDayMajorDateDisplayFormat, this.vLangs[this.vLang]); - draw_utils_1.newNode(vTmpCell, 'div', null, null, vCellContents, vColWidth * colspan); + vCellContents += " - " + date_utils_1.formatDateStr(vTmpDate, this.vDayMajorDateDisplayFormat, this.vLangs[this.vLang]); + draw_utils_1.newNode(vTmpCell, "div", null, null, vCellContents, vColWidth * colspan); vTmpDate.setDate(vTmpDate.getDate() + 1); } - else if (this.vFormat == 'week') { - var vTmpCell = draw_utils_1.newNode(vTmpRow, 'td', null, vHeaderCellClass, null, vColWidth); - draw_utils_1.newNode(vTmpCell, 'div', null, null, date_utils_1.formatDateStr(vTmpDate, this.vWeekMajorDateDisplayFormat, this.vLangs[this.vLang]), vColWidth); + else if (this.vFormat == "week") { + var vTmpCell = draw_utils_1.newNode(vTmpRow, "td", null, vHeaderCellClass, null, vColWidth); + draw_utils_1.newNode(vTmpCell, "div", null, null, date_utils_1.formatDateStr(vTmpDate, this.vWeekMajorDateDisplayFormat, this.vLangs[this.vLang]), vColWidth); vTmpDate.setDate(vTmpDate.getDate() + 7); } - else if (this.vFormat == 'month') { - vColSpan = (12 - vTmpDate.getMonth()); + else if (this.vFormat == "month") { + vColSpan = 12 - vTmpDate.getMonth(); if (vTmpDate.getFullYear() == vMaxDate.getFullYear()) - vColSpan -= (11 - vMaxDate.getMonth()); - var vTmpCell = draw_utils_1.newNode(vTmpRow, 'td', null, vHeaderCellClass, null, null, null, null, vColSpan); - draw_utils_1.newNode(vTmpCell, 'div', null, null, date_utils_1.formatDateStr(vTmpDate, this.vMonthMajorDateDisplayFormat, this.vLangs[this.vLang]), vColWidth * vColSpan); + vColSpan -= 11 - vMaxDate.getMonth(); + var vTmpCell = draw_utils_1.newNode(vTmpRow, "td", null, vHeaderCellClass, null, null, null, null, vColSpan); + draw_utils_1.newNode(vTmpCell, "div", null, null, date_utils_1.formatDateStr(vTmpDate, this.vMonthMajorDateDisplayFormat, this.vLangs[this.vLang]), vColWidth * vColSpan); vTmpDate.setFullYear(vTmpDate.getFullYear() + 1, 0, 1); } - else if (this.vFormat == 'quarter') { - vColSpan = (4 - Math.floor(vTmpDate.getMonth() / 3)); + else if (this.vFormat == "quarter") { + vColSpan = 4 - Math.floor(vTmpDate.getMonth() / 3); if (vTmpDate.getFullYear() == vMaxDate.getFullYear()) - vColSpan -= (3 - Math.floor(vMaxDate.getMonth() / 3)); - var vTmpCell = draw_utils_1.newNode(vTmpRow, 'td', null, vHeaderCellClass, null, null, null, null, vColSpan); - draw_utils_1.newNode(vTmpCell, 'div', null, null, date_utils_1.formatDateStr(vTmpDate, this.vQuarterMajorDateDisplayFormat, this.vLangs[this.vLang]), vColWidth * vColSpan); + vColSpan -= 3 - Math.floor(vMaxDate.getMonth() / 3); + var vTmpCell = draw_utils_1.newNode(vTmpRow, "td", null, vHeaderCellClass, null, null, null, null, vColSpan); + draw_utils_1.newNode(vTmpCell, "div", null, null, date_utils_1.formatDateStr(vTmpDate, this.vQuarterMajorDateDisplayFormat, this.vLangs[this.vLang]), vColWidth * vColSpan); vTmpDate.setFullYear(vTmpDate.getFullYear() + 1, 0, 1); } - else if (this.vFormat == 'hour') { - vColSpan = (24 - vTmpDate.getHours()); - if (vTmpDate.getFullYear() == vMaxDate.getFullYear() && - vTmpDate.getMonth() == vMaxDate.getMonth() && - vTmpDate.getDate() == vMaxDate.getDate()) - vColSpan -= (23 - vMaxDate.getHours()); - var vTmpCell = draw_utils_1.newNode(vTmpRow, 'td', null, vHeaderCellClass, null, null, null, null, vColSpan); - draw_utils_1.newNode(vTmpCell, 'div', null, null, date_utils_1.formatDateStr(vTmpDate, this.vHourMajorDateDisplayFormat, this.vLangs[this.vLang]), vColWidth * vColSpan); + else if (this.vFormat == "hour") { + vColSpan = 24 - vTmpDate.getHours(); + if (vTmpDate.getFullYear() == vMaxDate.getFullYear() && vTmpDate.getMonth() == vMaxDate.getMonth() && vTmpDate.getDate() == vMaxDate.getDate()) + vColSpan -= 23 - vMaxDate.getHours(); + var vTmpCell = draw_utils_1.newNode(vTmpRow, "td", null, vHeaderCellClass, null, null, null, null, vColSpan); + draw_utils_1.newNode(vTmpCell, "div", null, null, date_utils_1.formatDateStr(vTmpDate, this.vHourMajorDateDisplayFormat, this.vLangs[this.vLang]), vColWidth * vColSpan); vTmpDate.setHours(0); vTmpDate.setDate(vTmpDate.getDate() + 1); } } - vTmpRow = draw_utils_1.newNode(vTmpTBody, 'tr', null, 'footerdays'); + vTmpRow = draw_utils_1.newNode(vTmpTBody, "tr", null, "footerdays"); // Minor Date header and Cell Rows vTmpDate.setFullYear(vMinDate.getFullYear(), vMinDate.getMonth(), vMinDate.getDate()); // , vMinDate.getHours() - if (this.vFormat == 'hour') + if (this.vFormat == "hour") vTmpDate.setHours(vMinDate.getHours()); var vNumCols = 0; while (vTmpDate.getTime() <= vMaxDate.getTime()) { - var vMinorHeaderCellClass = 'gminorheading'; - if (this.vFormat == 'day') { + var vMinorHeaderCellClass = "gminorheading"; + if (this.vFormat == "day") { if (vTmpDate.getDay() % 6 == 0) { if (!this.vShowWeekends) { vTmpDate.setDate(vTmpDate.getDate() + 1); continue; } - vMinorHeaderCellClass += 'wkend'; + vMinorHeaderCellClass += "wkend"; } if (vTmpDate <= vMaxDate) { - var vTmpCell = draw_utils_1.newNode(vTmpRow, 'td', null, vMinorHeaderCellClass); - draw_utils_1.newNode(vTmpCell, 'div', null, null, date_utils_1.formatDateStr(vTmpDate, this.vDayMinorDateDisplayFormat, this.vLangs[this.vLang]), vColWidth); + var vTmpCell = draw_utils_1.newNode(vTmpRow, "td", null, vMinorHeaderCellClass); + draw_utils_1.newNode(vTmpCell, "div", null, null, date_utils_1.formatDateStr(vTmpDate, this.vDayMinorDateDisplayFormat, this.vLangs[this.vLang]), vColWidth); vNumCols++; } vTmpDate.setDate(vTmpDate.getDate() + 1); } - else if (this.vFormat == 'week') { + else if (this.vFormat == "week") { if (vTmpDate <= vMaxDate) { - var vTmpCell = draw_utils_1.newNode(vTmpRow, 'td', null, vMinorHeaderCellClass); - draw_utils_1.newNode(vTmpCell, 'div', null, null, date_utils_1.formatDateStr(vTmpDate, this.vWeekMinorDateDisplayFormat, this.vLangs[this.vLang]), vColWidth); + var vTmpCell = draw_utils_1.newNode(vTmpRow, "td", null, vMinorHeaderCellClass); + draw_utils_1.newNode(vTmpCell, "div", null, null, date_utils_1.formatDateStr(vTmpDate, this.vWeekMinorDateDisplayFormat, this.vLangs[this.vLang]), vColWidth); vNumCols++; } vTmpDate.setDate(vTmpDate.getDate() + 7); } - else if (this.vFormat == 'month') { + else if (this.vFormat == "month") { if (vTmpDate <= vMaxDate) { - var vTmpCell = draw_utils_1.newNode(vTmpRow, 'td', null, vMinorHeaderCellClass); - draw_utils_1.newNode(vTmpCell, 'div', null, null, date_utils_1.formatDateStr(vTmpDate, this.vMonthMinorDateDisplayFormat, this.vLangs[this.vLang]), vColWidth); + var vTmpCell = draw_utils_1.newNode(vTmpRow, "td", null, vMinorHeaderCellClass); + draw_utils_1.newNode(vTmpCell, "div", null, null, date_utils_1.formatDateStr(vTmpDate, this.vMonthMinorDateDisplayFormat, this.vLangs[this.vLang]), vColWidth); vNumCols++; } vTmpDate.setDate(vTmpDate.getDate() + 1); @@ -417,22 +415,22 @@ exports.GanttChart = function (pDiv, pFormat) { vTmpDate.setDate(vTmpDate.getDate() + 1); } } - else if (this.vFormat == 'quarter') { + else if (this.vFormat == "quarter") { if (vTmpDate <= vMaxDate) { - var vTmpCell = draw_utils_1.newNode(vTmpRow, 'td', null, vMinorHeaderCellClass); - draw_utils_1.newNode(vTmpCell, 'div', null, null, date_utils_1.formatDateStr(vTmpDate, this.vQuarterMinorDateDisplayFormat, this.vLangs[this.vLang]), vColWidth); + var vTmpCell = draw_utils_1.newNode(vTmpRow, "td", null, vMinorHeaderCellClass); + draw_utils_1.newNode(vTmpCell, "div", null, null, date_utils_1.formatDateStr(vTmpDate, this.vQuarterMinorDateDisplayFormat, this.vLangs[this.vLang]), vColWidth); vNumCols++; } vTmpDate.setDate(vTmpDate.getDate() + 81); while (vTmpDate.getDate() > 1) vTmpDate.setDate(vTmpDate.getDate() + 1); } - else if (this.vFormat == 'hour') { + else if (this.vFormat == "hour") { for (var i = vTmpDate.getHours(); i < 24; i++) { vTmpDate.setHours(i); //works around daylight savings but may look a little odd on days where the clock goes forward if (vTmpDate <= vMaxDate) { - var vTmpCell = draw_utils_1.newNode(vTmpRow, 'td', null, vMinorHeaderCellClass); - draw_utils_1.newNode(vTmpCell, 'div', null, null, date_utils_1.formatDateStr(vTmpDate, this.vHourMinorDateDisplayFormat, this.vLangs[this.vLang]), vColWidth); + var vTmpCell = draw_utils_1.newNode(vTmpRow, "td", null, vMinorHeaderCellClass); + draw_utils_1.newNode(vTmpCell, "div", null, null, date_utils_1.formatDateStr(vTmpDate, this.vHourMinorDateDisplayFormat, this.vLangs[this.vLang]), vColWidth); vNumCols++; } } @@ -442,18 +440,18 @@ exports.GanttChart = function (pDiv, pFormat) { } var vDateRow = vTmpRow; // Calculate size of grids : Plus 3 because 1 border left + 2 of paddings - var vTaskLeftPx = (vNumCols * (vColWidth + 3)) + 1; + var vTaskLeftPx = vNumCols * (vColWidth + 3) + 1; // Fix a small space at the end for day - if (this.vFormat === 'day') { + if (this.vFormat === "day") { vTaskLeftPx += 2; } - vTmpTab.style.width = vTaskLeftPx + 'px'; // Ensure that the headings has exactly the same width as the chart grid + vTmpTab.style.width = vTaskLeftPx + "px"; // Ensure that the headings has exactly the same width as the chart grid // const vTaskPlanLeftPx = (vNumCols * (vColWidth + 3)) + 1; var vSingleCell = false; - if (this.vUseSingleCell !== 0 && this.vUseSingleCell < (vNumCols * vNumRows)) + if (this.vUseSingleCell !== 0 && this.vUseSingleCell < vNumCols * vNumRows) vSingleCell = true; - draw_utils_1.newNode(vTmpDiv, 'div', null, 'rhscrpad', null, null, vTaskLeftPx + 1); - vTmpDiv = draw_utils_1.newNode(vRightHeader, 'div', null, 'glabelfooter'); + draw_utils_1.newNode(vTmpDiv, "div", null, "rhscrpad", null, null, vTaskLeftPx + 1); + vTmpDiv = draw_utils_1.newNode(vRightHeader, "div", null, "glabelfooter"); return { gChartLbl: gChartLbl, vTaskLeftPx: vTaskLeftPx, vSingleCell: vSingleCell, vDateRow: vDateRow, vRightHeader: vRightHeader, vNumCols: vNumCols }; }; /** @@ -463,23 +461,23 @@ exports.GanttChart = function (pDiv, pFormat) { */ this.drawCharBody = function (vTaskLeftPx, vTmpContentTabWrapper, gChartLbl, gListLbl, vMinDate, vMaxDate, vSingleCell, vNumCols, vColWidth, vDateRow) { var vRightTable = document.createDocumentFragment(); - var vTmpDiv = draw_utils_1.newNode(vRightTable, 'div', this.vDivId + 'gchartbody', 'gchartgrid gcontainercol'); + var vTmpDiv = draw_utils_1.newNode(vRightTable, "div", this.vDivId + "gchartbody", "gchartgrid gcontainercol"); this.setChartBody(vTmpDiv); - var vTmpTab = draw_utils_1.newNode(vTmpDiv, 'table', this.vDivId + 'chartTable', 'gcharttable', null, vTaskLeftPx); + var vTmpTab = draw_utils_1.newNode(vTmpDiv, "table", this.vDivId + "chartTable", "gcharttable", null, vTaskLeftPx); this.setChartTable(vTmpTab); - draw_utils_1.newNode(vTmpDiv, 'div', null, 'rhscrpad', null, null, vTaskLeftPx + 1); - var vTmpTBody = draw_utils_1.newNode(vTmpTab, 'tbody'); - var vTmpTFoot = draw_utils_1.newNode(vTmpTab, 'tfoot'); - events_1.syncScroll([vTmpContentTabWrapper, vTmpDiv], 'scrollTop'); - events_1.syncScroll([gChartLbl, vTmpDiv], 'scrollLeft'); - events_1.syncScroll([vTmpContentTabWrapper, gListLbl], 'scrollLeft'); + draw_utils_1.newNode(vTmpDiv, "div", null, "rhscrpad", null, null, vTaskLeftPx + 1); + var vTmpTBody = draw_utils_1.newNode(vTmpTab, "tbody"); + var vTmpTFoot = draw_utils_1.newNode(vTmpTab, "tfoot"); + events_1.syncScroll([vTmpContentTabWrapper, vTmpDiv], "scrollTop"); + events_1.syncScroll([gChartLbl, vTmpDiv], "scrollLeft"); + events_1.syncScroll([vTmpContentTabWrapper, gListLbl], "scrollLeft"); // Draw each row var i = 0; var j = 0; var bd; if (this.vDebug) { bd = new Date(); - console.info('before tasks loop', bd); + console.info("before tasks loop", bd); } for (i = 0; i < this.vTaskList.length; i++) { var curTaskStart = this.vTaskList[i].getStart() ? this.vTaskList[i].getStart() : this.vTaskList[i].getPlanStart(); @@ -496,31 +494,31 @@ exports.GanttChart = function (pDiv, pFormat) { vTaskPlanRightPx = general_utils_1.getOffset(curTaskPlanStart, curTaskPlanEnd, vColWidth, this.vFormat, this.vShowWeekends); } var vID = this.vTaskList[i].getID(); - var vComb = (this.vTaskList[i].getParItem() && this.vTaskList[i].getParItem().getGroup() == 2); - var vCellFormat = ''; + var vComb = this.vTaskList[i].getParItem() && this.vTaskList[i].getParItem().getGroup() == 2; + var vCellFormat = ""; var vTmpDiv_1 = null; var vTmpItem = this.vTaskList[i]; var vCaptClass = null; // set cell width only for first row because of table-layout:fixed var taskCellWidth = i === 0 ? vColWidth : null; if (this.vTaskList[i].getMile() && !vComb) { - var vTmpRow = draw_utils_1.newNode(vTmpTBody, 'tr', this.vDivId + 'childrow_' + vID, 'gmileitem gmile' + this.vFormat, null, null, null, ((this.vTaskList[i].getVisible() == 0) ? 'none' : null)); + var vTmpRow = draw_utils_1.newNode(vTmpTBody, "tr", this.vDivId + "childrow_" + vID, "gmileitem gmile" + this.vFormat, null, null, null, this.vTaskList[i].getVisible() == 0 ? "none" : null); this.vTaskList[i].setChildRow(vTmpRow); events_1.addThisRowListeners(this, this.vTaskList[i].getListChildRow(), vTmpRow); - var vTmpCell = draw_utils_1.newNode(vTmpRow, 'td', null, 'gtaskcell gtaskcellmile', null, vColWidth, null, null, null); - vTmpDiv_1 = draw_utils_1.newNode(vTmpCell, 'div', null, 'gtaskcelldiv', '\u00A0\u00A0'); - vTmpDiv_1 = draw_utils_1.newNode(vTmpDiv_1, 'div', this.vDivId + 'bardiv_' + vID, 'gtaskbarcontainer', null, 12, vTaskLeftPx_1 + vTaskRightPx - 6); + var vTmpCell = draw_utils_1.newNode(vTmpRow, "td", null, "gtaskcell gtaskcellmile", null, vColWidth, null, null, null); + vTmpDiv_1 = draw_utils_1.newNode(vTmpCell, "div", null, "gtaskcelldiv", "\u00A0\u00A0"); + vTmpDiv_1 = draw_utils_1.newNode(vTmpDiv_1, "div", this.vDivId + "bardiv_" + vID, "gtaskbarcontainer", null, 12, vTaskLeftPx_1 + vTaskRightPx - 6); this.vTaskList[i].setBarDiv(vTmpDiv_1); - var vTmpDiv2 = draw_utils_1.newNode(vTmpDiv_1, 'div', this.vDivId + 'taskbar_' + vID, this.vTaskList[i].getClass(), null, 12); + var vTmpDiv2 = draw_utils_1.newNode(vTmpDiv_1, "div", this.vDivId + "taskbar_" + vID, this.vTaskList[i].getClass(), null, 12); this.vTaskList[i].setTaskDiv(vTmpDiv2); if (this.vTaskList[i].getCompVal() < 100) - vTmpDiv2.appendChild(document.createTextNode('\u25CA')); + vTmpDiv2.appendChild(document.createTextNode("\u25CA")); else { - vTmpDiv2 = draw_utils_1.newNode(vTmpDiv2, 'div', null, 'gmilediamond'); - draw_utils_1.newNode(vTmpDiv2, 'div', null, 'gmdtop'); - draw_utils_1.newNode(vTmpDiv2, 'div', null, 'gmdbottom'); + vTmpDiv2 = draw_utils_1.newNode(vTmpDiv2, "div", null, "gmilediamond"); + draw_utils_1.newNode(vTmpDiv2, "div", null, "gmdtop"); + draw_utils_1.newNode(vTmpDiv2, "div", null, "gmdbottom"); } - vCaptClass = 'gmilecaption'; + vCaptClass = "gmilecaption"; if (!vSingleCell && !vComb) { this.drawColsChart(vNumCols, vTmpRow, taskCellWidth, vMinDate, vMaxDate); } @@ -530,31 +528,31 @@ exports.GanttChart = function (pDiv, pFormat) { // Draw Group Bar which has outer div with inner group div // and several small divs to left and right to create angled-end indicators if (this.vTaskList[i].getGroup()) { - vTaskWidth = (vTaskWidth > this.vMinGpLen && vTaskWidth < this.vMinGpLen * 2) ? this.vMinGpLen * 2 : vTaskWidth; // Expand to show two end points - vTaskWidth = (vTaskWidth < this.vMinGpLen) ? this.vMinGpLen : vTaskWidth; // expand to show one end point - var vTmpRow = draw_utils_1.newNode(vTmpTBody, 'tr', this.vDivId + 'childrow_' + vID, ((this.vTaskList[i].getGroup() == 2) ? 'glineitem gitem' : 'ggroupitem ggroup') + this.vFormat, null, null, null, ((this.vTaskList[i].getVisible() == 0) ? 'none' : null)); + vTaskWidth = vTaskWidth > this.vMinGpLen && vTaskWidth < this.vMinGpLen * 2 ? this.vMinGpLen * 2 : vTaskWidth; // Expand to show two end points + vTaskWidth = vTaskWidth < this.vMinGpLen ? this.vMinGpLen : vTaskWidth; // expand to show one end point + var vTmpRow = draw_utils_1.newNode(vTmpTBody, "tr", this.vDivId + "childrow_" + vID, (this.vTaskList[i].getGroup() == 2 ? "glineitem gitem" : "ggroupitem ggroup") + this.vFormat, null, null, null, this.vTaskList[i].getVisible() == 0 ? "none" : null); this.vTaskList[i].setChildRow(vTmpRow); events_1.addThisRowListeners(this, this.vTaskList[i].getListChildRow(), vTmpRow); - var vTmpCell = draw_utils_1.newNode(vTmpRow, 'td', null, 'gtaskcell gtaskcellbar', null, vColWidth, null, null); - vTmpDiv_1 = draw_utils_1.newNode(vTmpCell, 'div', null, 'gtaskcelldiv', '\u00A0\u00A0'); + var vTmpCell = draw_utils_1.newNode(vTmpRow, "td", null, "gtaskcell gtaskcellbar", null, vColWidth, null, null); + vTmpDiv_1 = draw_utils_1.newNode(vTmpCell, "div", null, "gtaskcelldiv", "\u00A0\u00A0"); this.vTaskList[i].setCellDiv(vTmpDiv_1); if (this.vTaskList[i].getGroup() == 1) { - vTmpDiv_1 = draw_utils_1.newNode(vTmpDiv_1, 'div', this.vDivId + 'bardiv_' + vID, 'gtaskbarcontainer', null, vTaskWidth, vTaskLeftPx_1); + vTmpDiv_1 = draw_utils_1.newNode(vTmpDiv_1, "div", this.vDivId + "bardiv_" + vID, "gtaskbarcontainer", null, vTaskWidth, vTaskLeftPx_1); this.vTaskList[i].setBarDiv(vTmpDiv_1); - var vTmpDiv2 = draw_utils_1.newNode(vTmpDiv_1, 'div', this.vDivId + 'taskbar_' + vID, this.vTaskList[i].getClass(), null, vTaskWidth); + var vTmpDiv2 = draw_utils_1.newNode(vTmpDiv_1, "div", this.vDivId + "taskbar_" + vID, this.vTaskList[i].getClass(), null, vTaskWidth); this.vTaskList[i].setTaskDiv(vTmpDiv2); - draw_utils_1.newNode(vTmpDiv2, 'div', this.vDivId + 'complete_' + vID, this.vTaskList[i].getClass() + 'complete', null, this.vTaskList[i].getCompStr()); - draw_utils_1.newNode(vTmpDiv_1, 'div', null, this.vTaskList[i].getClass() + 'endpointleft'); + draw_utils_1.newNode(vTmpDiv2, "div", this.vDivId + "complete_" + vID, this.vTaskList[i].getClass() + "complete", null, this.vTaskList[i].getCompStr()); + draw_utils_1.newNode(vTmpDiv_1, "div", null, this.vTaskList[i].getClass() + "endpointleft"); if (vTaskWidth >= this.vMinGpLen * 2) - draw_utils_1.newNode(vTmpDiv_1, 'div', null, this.vTaskList[i].getClass() + 'endpointright'); - vCaptClass = 'ggroupcaption'; + draw_utils_1.newNode(vTmpDiv_1, "div", null, this.vTaskList[i].getClass() + "endpointright"); + vCaptClass = "ggroupcaption"; } if (!vSingleCell && !vComb) { this.drawColsChart(vNumCols, vTmpRow, taskCellWidth, vMinDate, vMaxDate); } } else { - vTaskWidth = (vTaskWidth <= 0) ? 1 : vTaskWidth; + vTaskWidth = vTaskWidth <= 0 ? 1 : vTaskWidth; /** * DRAW THE BOXES FOR GANTT */ @@ -564,40 +562,44 @@ exports.GanttChart = function (pDiv, pFormat) { } else { // Draw Task Bar which has colored bar div - vTmpRow = draw_utils_1.newNode(vTmpTBody, 'tr', this.vDivId + 'childrow_' + vID, 'glineitem gitem' + this.vFormat, null, null, null, ((this.vTaskList[i].getVisible() == 0) ? 'none' : null)); + var differentDatesHighlight = ""; + if (this.vTaskList[i].getEnd() && this.vTaskList[i].getPlanEnd() && this.vTaskList[i].getStart() && this.vTaskList[i].getPlanStart()) + if (Date.parse(this.vTaskList[i].getEnd()) !== Date.parse(this.vTaskList[i].getPlanEnd()) || Date.parse(this.vTaskList[i].getStart()) !== Date.parse(this.vTaskList[i].getPlanStart())) + differentDatesHighlight = "gitemdifferent "; + vTmpRow = draw_utils_1.newNode(vTmpTBody, "tr", this.vDivId + "childrow_" + vID, "glineitem " + differentDatesHighlight + "gitem" + this.vFormat, null, null, null, this.vTaskList[i].getVisible() == 0 ? "none" : null); this.vTaskList[i].setChildRow(vTmpRow); events_1.addThisRowListeners(this, this.vTaskList[i].getListChildRow(), vTmpRow); - var vTmpCell = draw_utils_1.newNode(vTmpRow, 'td', null, 'gtaskcell gtaskcellcolorbar', null, taskCellWidth, null, null); - vTmpDivCell = vTmpDiv_1 = draw_utils_1.newNode(vTmpCell, 'div', null, 'gtaskcelldiv', '\u00A0\u00A0'); + var vTmpCell = draw_utils_1.newNode(vTmpRow, "td", null, "gtaskcell gtaskcellcolorbar", null, taskCellWidth, null, null); + vTmpDivCell = vTmpDiv_1 = draw_utils_1.newNode(vTmpCell, "div", null, "gtaskcelldiv", "\u00A0\u00A0"); } // DRAW TASK BAR - vTmpDiv_1 = draw_utils_1.newNode(vTmpDiv_1, 'div', this.vDivId + 'bardiv_' + vID, 'gtaskbarcontainer', null, vTaskWidth, vTaskLeftPx_1); + vTmpDiv_1 = draw_utils_1.newNode(vTmpDiv_1, "div", this.vDivId + "bardiv_" + vID, "gtaskbarcontainer", null, vTaskWidth, vTaskLeftPx_1); this.vTaskList[i].setBarDiv(vTmpDiv_1); var vTmpDiv2 = void 0; if (this.vTaskList[i].getStartVar()) { // textbar - vTmpDiv2 = draw_utils_1.newNode(vTmpDiv_1, 'div', this.vDivId + 'taskbar_' + vID, this.vTaskList[i].getClass(), null, vTaskWidth); + vTmpDiv2 = draw_utils_1.newNode(vTmpDiv_1, "div", this.vDivId + "taskbar_" + vID, this.vTaskList[i].getClass(), null, vTaskWidth); if (this.vTaskList[i].getBarText()) { - draw_utils_1.newNode(vTmpDiv2, 'span', this.vDivId + 'tasktextbar_' + vID, 'textbar', this.vTaskList[i].getBarText(), this.vTaskList[i].getCompRestStr()); + draw_utils_1.newNode(vTmpDiv2, "span", this.vDivId + "tasktextbar_" + vID, "textbar", this.vTaskList[i].getBarText(), this.vTaskList[i].getCompRestStr()); } this.vTaskList[i].setTaskDiv(vTmpDiv2); } // PLANNED // If exist and one of them are different, show plan bar... show if there is no real vStart as well (just plan dates) - if (vTaskPlanLeftPx && ((vTaskPlanLeftPx != vTaskLeftPx_1 || vTaskPlanRightPx != vTaskRightPx) || !this.vTaskList[i].getStartVar())) { - var vTmpPlanDiv = draw_utils_1.newNode(vTmpDivCell, 'div', this.vDivId + 'bardiv_' + vID, 'gtaskbarcontainer gplan', null, vTaskPlanRightPx, vTaskPlanLeftPx); - var vTmpPlanDiv2 = draw_utils_1.newNode(vTmpPlanDiv, 'div', this.vDivId + 'taskbar_' + vID, this.vTaskList[i].getClass() + ' gplan', null, vTaskPlanRightPx); + if (vTaskPlanLeftPx && (vTaskPlanLeftPx != vTaskLeftPx_1 || vTaskPlanRightPx != vTaskRightPx || !this.vTaskList[i].getStartVar())) { + var vTmpPlanDiv = draw_utils_1.newNode(vTmpDivCell, "div", this.vDivId + "bardiv_" + vID, "gtaskbarcontainer gplan", null, vTaskPlanRightPx, vTaskPlanLeftPx); + var vTmpPlanDiv2 = draw_utils_1.newNode(vTmpPlanDiv, "div", this.vDivId + "taskbar_" + vID, this.vTaskList[i].getPlanClass() + " gplan", null, vTaskPlanRightPx); this.vTaskList[i].setPlanTaskDiv(vTmpPlanDiv2); } // and opaque completion div if (vTmpDiv2) { - draw_utils_1.newNode(vTmpDiv2, 'div', this.vDivId + 'complete_' + vID, this.vTaskList[i].getClass() + 'complete', null, this.vTaskList[i].getCompStr()); + draw_utils_1.newNode(vTmpDiv2, "div", this.vDivId + "complete_" + vID, this.vTaskList[i].getClass() + "complete", null, this.vTaskList[i].getCompStr()); } // caption if (vComb) vTmpItem = this.vTaskList[i].getParItem(); if (!vComb || (vComb && this.vTaskList[i].getParItem().getEnd() == this.vTaskList[i].getEnd())) - vCaptClass = 'gcaption'; + vCaptClass = "gcaption"; // Background cells if (!vSingleCell && !vComb && vTmpRow) { this.drawColsChart(vNumCols, vTmpRow, taskCellWidth, vMinDate, vMaxDate); @@ -607,31 +609,31 @@ exports.GanttChart = function (pDiv, pFormat) { if (this.getCaptionType() && vCaptClass !== null) { var vCaptionStr = void 0; switch (this.getCaptionType()) { - case 'Caption': + case "Caption": vCaptionStr = vTmpItem.getCaption(); break; - case 'Resource': + case "Resource": vCaptionStr = vTmpItem.getResource(); break; - case 'Duration': + case "Duration": vCaptionStr = vTmpItem.getDuration(this.vFormat, this.vLangs[this.vLang]); break; - case 'Complete': + case "Complete": vCaptionStr = vTmpItem.getCompStr(); break; } - draw_utils_1.newNode(vTmpDiv_1, 'div', null, vCaptClass, vCaptionStr, 120, (vCaptClass == 'gmilecaption') ? 12 : 0); + draw_utils_1.newNode(vTmpDiv_1, "div", null, vCaptClass, vCaptionStr, 120, vCaptClass == "gmilecaption" ? 12 : 0); } // Add Task Info div for tooltip if (this.vTaskList[i].getTaskDiv() && vTmpDiv_1) { - var vTmpDiv2 = draw_utils_1.newNode(vTmpDiv_1, 'div', this.vDivId + 'tt' + vID, null, null, null, null, 'none'); + var vTmpDiv2 = draw_utils_1.newNode(vTmpDiv_1, "div", this.vDivId + "tt" + vID, null, null, null, null, "none"); var _a = this.createTaskInfo(this.vTaskList[i], this.vTooltipTemplate), component = _a.component, callback = _a.callback; vTmpDiv2.appendChild(component); events_1.addTooltipListeners(this, this.vTaskList[i].getTaskDiv(), vTmpDiv2, callback); } // Add Plan Task Info div for tooltip if (this.vTaskList[i].getPlanTaskDiv() && vTmpDiv_1) { - var vTmpDiv2 = draw_utils_1.newNode(vTmpDiv_1, 'div', this.vDivId + 'tt' + vID, null, null, null, null, 'none'); + var vTmpDiv2 = draw_utils_1.newNode(vTmpDiv_1, "div", this.vDivId + "tt" + vID, null, null, null, null, "none"); var _b = this.createTaskInfo(this.vTaskList[i], this.vTooltipTemplate), component = _b.component, callback = _b.callback; vTmpDiv2.appendChild(component); events_1.addTooltipListeners(this, this.vTaskList[i].getPlanTaskDiv(), vTmpDiv2, callback); @@ -639,10 +641,10 @@ exports.GanttChart = function (pDiv, pFormat) { } // Include the footer with the days/week/month... if (vSingleCell) { - var vTmpTFootTRow = draw_utils_1.newNode(vTmpTFoot, 'tr'); - var vTmpTFootTCell = draw_utils_1.newNode(vTmpTFootTRow, 'td', null, null, null, '100%'); - var vTmpTFootTCellTable = draw_utils_1.newNode(vTmpTFootTCell, 'table', null, 'gcharttableh', null, '100%'); - var vTmpTFootTCellTableTBody = draw_utils_1.newNode(vTmpTFootTCellTable, 'tbody'); + var vTmpTFootTRow = draw_utils_1.newNode(vTmpTFoot, "tr"); + var vTmpTFootTCell = draw_utils_1.newNode(vTmpTFootTRow, "td", null, null, null, "100%"); + var vTmpTFootTCellTable = draw_utils_1.newNode(vTmpTFootTCell, "table", null, "gcharttableh", null, "100%"); + var vTmpTFootTCellTableTBody = draw_utils_1.newNode(vTmpTFootTCellTable, "tbody"); vTmpTFootTCellTableTBody.appendChild(vDateRow.cloneNode(true)); } else { @@ -655,28 +657,28 @@ exports.GanttChart = function (pDiv, pFormat) { if (pEndDate === void 0) { pEndDate = null; } var columnCurrentDay = null; // Find the Current day cell to put a different class - if (this.vShowWeekends !== false && pStartDate && pEndDate && (this.vFormat == 'day' || this.vFormat == 'week')) { + if (this.vShowWeekends !== false && pStartDate && pEndDate && (this.vFormat == "day" || this.vFormat == "week")) { var curTaskStart = new Date(pStartDate.getTime()); var curTaskEnd = new Date(); var onePeriod = 3600000; - if (this.vFormat == 'day') { + if (this.vFormat == "day") { onePeriod *= 24; } - else if (this.vFormat == 'week') { + else if (this.vFormat == "week") { onePeriod *= 24 * 7; } columnCurrentDay = Math.floor(general_utils_1.calculateCurrentDateOffset(curTaskStart, curTaskEnd) / onePeriod) - 1; } for (var j = 0; j < vNumCols - 1; j++) { - var vCellFormat = 'gtaskcell gtaskcellcols'; - if (this.vShowWeekends !== false && this.vFormat == 'day' && ((j % 7 == 4) || (j % 7 == 5))) { - vCellFormat = 'gtaskcellwkend'; + var vCellFormat = "gtaskcell gtaskcellcols"; + if (this.vShowWeekends !== false && this.vFormat == "day" && (j % 7 == 4 || j % 7 == 5)) { + vCellFormat = "gtaskcellwkend"; } //When is the column is the current day/week,give a different class - else if ((this.vFormat == 'week' || this.vFormat == 'day') && j === columnCurrentDay) { - vCellFormat = 'gtaskcellcurrent'; + else if ((this.vFormat == "week" || this.vFormat == "day") && j === columnCurrentDay) { + vCellFormat = "gtaskcellcurrent"; } - draw_utils_1.newNode(vTmpRow, 'td', null, vCellFormat, '\u00A0\u00A0', taskCellWidth); + draw_utils_1.newNode(vTmpRow, "td", null, vCellFormat, "\u00A0\u00A0", taskCellWidth); } }; /** @@ -696,7 +698,7 @@ exports.GanttChart = function (pDiv, pFormat) { } if (this.vDebug) { bd = new Date(); - console.info('before draw', bd); + console.info("before draw", bd); } // Process all tasks, reset parent date and completion % if task list has altered if (this.vProcessNeeded) @@ -706,25 +708,25 @@ exports.GanttChart = function (pDiv, pFormat) { vMinDate = date_utils_1.getMinDate(this.vTaskList, this.vFormat, this.getMinDate() && date_utils_1.coerceDate(this.getMinDate())); vMaxDate = date_utils_1.getMaxDate(this.vTaskList, this.vFormat, this.getMaxDate() && date_utils_1.coerceDate(this.getMaxDate())); // Calculate chart width variables. - if (this.vFormat == 'day') + if (this.vFormat == "day") vColWidth = this.vDayColWidth; - else if (this.vFormat == 'week') + else if (this.vFormat == "week") vColWidth = this.vWeekColWidth; - else if (this.vFormat == 'month') + else if (this.vFormat == "month") vColWidth = this.vMonthColWidth; - else if (this.vFormat == 'quarter') + else if (this.vFormat == "quarter") vColWidth = this.vQuarterColWidth; - else if (this.vFormat == 'hour') + else if (this.vFormat == "hour") vColWidth = this.vHourColWidth; // DRAW the Left-side of the chart (names, resources, comp%) var vLeftHeader = document.createDocumentFragment(); /** * LIST HEAD - */ + */ var gListLbl = this.drawListHead(vLeftHeader); /** * LIST BODY - */ + */ var _a = this.drawListBody(vLeftHeader), vNumRows = _a.vNumRows, vTmpContentTabWrapper = _a.vTmpContentTabWrapper; /** * CHART HEAD @@ -736,28 +738,28 @@ exports.GanttChart = function (pDiv, pFormat) { var vRightTable = this.drawCharBody(vTaskLeftPx, vTmpContentTabWrapper, gChartLbl, gListLbl, vMinDate, vMaxDate, vSingleCell, vNumCols, vColWidth, vDateRow).vRightTable; if (this.vDebug) { var ad = new Date(); - console.info('after tasks loop', ad, (ad.getTime() - bd.getTime())); + console.info("after tasks loop", ad, ad.getTime() - bd.getTime()); } // MAIN VIEW: Appending all generated components to main view while (this.vDiv.hasChildNodes()) this.vDiv.removeChild(this.vDiv.firstChild); - var vTmpDiv = draw_utils_1.newNode(this.vDiv, 'div', null, 'gchartcontainer'); + var vTmpDiv = draw_utils_1.newNode(this.vDiv, "div", null, "gchartcontainer"); vTmpDiv.style.height = this.vTotalHeight; - var leftvTmpDiv = draw_utils_1.newNode(vTmpDiv, 'div', null, 'gmain gmainleft'); + var leftvTmpDiv = draw_utils_1.newNode(vTmpDiv, "div", null, "gmain gmainleft"); leftvTmpDiv.appendChild(vLeftHeader); // leftvTmpDiv.appendChild(vLeftTable); - var rightvTmpDiv = draw_utils_1.newNode(vTmpDiv, 'div', null, 'gmain gmainright'); + var rightvTmpDiv = draw_utils_1.newNode(vTmpDiv, "div", null, "gmain gmainright"); rightvTmpDiv.appendChild(vRightHeader); rightvTmpDiv.appendChild(vRightTable); vTmpDiv.appendChild(leftvTmpDiv); vTmpDiv.appendChild(rightvTmpDiv); - draw_utils_1.newNode(vTmpDiv, 'div', null, 'ggridfooter'); - var vTmpDiv2 = draw_utils_1.newNode(this.getChartBody(), 'div', this.vDivId + 'Lines', 'glinediv'); - if (this.vEvents.onLineContainerHover && typeof this.vEvents.onLineContainerHover === 'function') { - events_1.addListener('mouseover', this.vEvents.onLineContainerHover, vTmpDiv2); - events_1.addListener('mouseout', this.vEvents.onLineContainerHover, vTmpDiv2); + draw_utils_1.newNode(vTmpDiv, "div", null, "ggridfooter"); + var vTmpDiv2 = draw_utils_1.newNode(this.getChartBody(), "div", this.vDivId + "Lines", "glinediv"); + if (this.vEvents.onLineContainerHover && typeof this.vEvents.onLineContainerHover === "function") { + events_1.addListener("mouseover", this.vEvents.onLineContainerHover, vTmpDiv2); + events_1.addListener("mouseout", this.vEvents.onLineContainerHover, vTmpDiv2); } - vTmpDiv2.style.visibility = 'hidden'; + vTmpDiv2.style.visibility = "hidden"; this.setLines(vTmpDiv2); /* Quick hack to show the generated HTML on older browsers let tmpGenSrc=document.createElement('textarea'); @@ -767,14 +769,14 @@ exports.GanttChart = function (pDiv, pFormat) { // LISTENERS: Now all the content exists, register scroll listeners events_1.addScrollListeners(this); // SCROLL: now check if we are actually scrolling the pane - if (this.vScrollTo != '') { + if (this.vScrollTo != "") { var vScrollDate = new Date(vMinDate.getTime()); var vScrollPx = 0; - if (this.vScrollTo.substr && this.vScrollTo.substr(0, 2) == 'px') { + if (this.vScrollTo.substr && this.vScrollTo.substr(0, 2) == "px") { vScrollPx = parseInt(this.vScrollTo.substr(2)); } else { - if (this.vScrollTo === 'today') { + if (this.vScrollTo === "today") { vScrollDate = new Date(); } else if (this.vScrollTo instanceof Date) { @@ -783,7 +785,7 @@ exports.GanttChart = function (pDiv, pFormat) { else { vScrollDate = date_utils_1.parseDateStr(this.vScrollTo, this.getDateInputFormat()); } - if (this.vFormat == 'hour') + if (this.vFormat == "hour") vScrollDate.setMinutes(0, 0, 0); else vScrollDate.setHours(0, 0, 0, 0); @@ -791,7 +793,7 @@ exports.GanttChart = function (pDiv, pFormat) { } this.getChartBody().scrollLeft = vScrollPx; } - if (vMinDate.getTime() <= (new Date()).getTime() && vMaxDate.getTime() >= (new Date()).getTime()) { + if (vMinDate.getTime() <= new Date().getTime() && vMaxDate.getTime() >= new Date().getTime()) { this.vTodayPx = general_utils_1.getOffset(vMinDate, new Date(), vColWidth, this.vFormat, this.vShowWeekends); } else @@ -800,20 +802,20 @@ exports.GanttChart = function (pDiv, pFormat) { var bdd; if (this.vDebug) { bdd = new Date(); - console.info('before DrawDependencies', bdd); + console.info("before DrawDependencies", bdd); } - if (this.vEvents && typeof this.vEvents.beforeLineDraw === 'function') { + if (this.vEvents && typeof this.vEvents.beforeLineDraw === "function") { this.vEvents.beforeLineDraw(); } this.DrawDependencies(this.vDebug); events_1.addListenerDependencies(this.vLineOptions); // EVENTS - if (this.vEvents && typeof this.vEvents.afterLineDraw === 'function') { + if (this.vEvents && typeof this.vEvents.afterLineDraw === "function") { this.vEvents.afterLineDraw(); } if (this.vDebug) { var ad = new Date(); - console.info('after DrawDependencies', ad, (ad.getTime() - bdd.getTime())); + console.info("after DrawDependencies", ad, ad.getTime() - bdd.getTime()); } this.drawComplete(vMinDate, vColWidth, bd); }; @@ -823,7 +825,7 @@ exports.GanttChart = function (pDiv, pFormat) { this.drawComplete = function (vMinDate, vColWidth, bd) { if (this.vDebug) { var ad = new Date(); - console.info('after draw', ad, (ad.getTime() - bd.getTime())); + console.info("after draw", ad, ad.getTime() - bd.getTime()); } events_1.updateGridHeaderWidth(this); this.chartRowDateToX = function (date) { @@ -833,13 +835,14 @@ exports.GanttChart = function (pDiv, pFormat) { this.vEvents.afterDraw(); } }; - if (this.vDiv && this.vDiv.nodeName && this.vDiv.nodeName.toLowerCase() == 'div') + if (this.vDiv && this.vDiv.nodeName && this.vDiv.nodeName.toLowerCase() == "div") this.vDivId = this.vDiv.id; }; //GanttChart },{"./draw_columns":3,"./draw_dependencies":4,"./events":5,"./lang":8,"./options":9,"./task":10,"./utils/date_utils":11,"./utils/draw_utils":12,"./utils/general_utils":13,"./xml":14}],3:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); +exports.draw_task_headings = exports.draw_bottom = exports.draw_header = exports.COLUMN_ORDER = void 0; var date_utils_1 = require("./utils/date_utils"); var task_1 = require("./task"); var events_1 = require("./events"); @@ -1009,6 +1012,7 @@ exports.draw_task_headings = function (column, vTmpRow, vLangs, vLang, vAddition },{"./events":5,"./task":10,"./utils/date_utils":11,"./utils/draw_utils":12}],4:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); +exports.DrawDependencies = exports.drawDependency = void 0; exports.drawDependency = function (x1, y1, x2, y2, pType, pClass) { var vDir = 1; var vBend = false; @@ -1105,6 +1109,7 @@ exports.DrawDependencies = function (vDebug) { },{}],5:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); +exports.addListenerDependencies = exports.addListenerInputCell = exports.addListenerClickCell = exports.addScrollListeners = exports.addFormatListeners = exports.addFolderListeners = exports.updateGridHeaderWidth = exports.addThisRowListeners = exports.addTooltipListeners = exports.syncScroll = exports.removeListener = exports.addListener = exports.showToolTip = exports.mouseOut = exports.mouseOver = exports.show = exports.hide = exports.folder = void 0; var general_utils_1 = require("./utils/general_utils"); // Function to open/close and hide/show children of specified task exports.folder = function (pID, ganttObj) { @@ -1505,6 +1510,7 @@ var vColumnsNames = { Copyright (c) 2009, Shlomy Gantz BlueBrick Inc. */ Object.defineProperty(exports, "__esModule", { value: true }); +exports.JSGantt = void 0; var events_1 = require("./events"); var general_utils_1 = require("./utils/general_utils"); var xml_1 = require("./xml"); @@ -1545,7 +1551,7 @@ exports.JSGantt.taskLink = task_1.taskLink; exports.JSGantt.parseDateStr = date_utils_1.parseDateStr; exports.JSGantt.formatDateStr = date_utils_1.formatDateStr; exports.JSGantt.parseDateFormatStr = date_utils_1.parseDateFormatStr; -// XML +// XML exports.JSGantt.parseXML = xml_1.parseXML; exports.JSGantt.parseXMLString = xml_1.parseXMLString; exports.JSGantt.findXMLNode = xml_1.findXMLNode; @@ -1568,10 +1574,11 @@ exports.JSGantt.criticalPath = general_utils_1.criticalPath; },{"./draw":2,"./events":5,"./json":7,"./task":10,"./utils/date_utils":11,"./utils/general_utils":13,"./xml":14}],7:[function(require,module,exports){ "use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; @@ -1603,6 +1610,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) { } }; Object.defineProperty(exports, "__esModule", { value: true }); +exports.addJSONTask = exports.parseJSONString = exports.parseJSON = void 0; var task_1 = require("./task"); var general_utils_1 = require("./utils/general_utils"); /** @@ -1649,6 +1657,7 @@ exports.addJSONTask = function (pGanttVar, pJsonObj) { var planstart = void 0; var planend = void 0; var itemClass = void 0; + var planClass = void 0; var link = ''; var milestone = 0; var resourceName = ''; @@ -1695,6 +1704,10 @@ exports.addJSONTask = function (pGanttVar, pJsonObj) { case 'class': itemClass = value; break; + case 'pplanclass': + case 'planclass': + planClass = value; + break; case 'plink': case 'link': link = value; @@ -1752,7 +1765,7 @@ exports.addJSONTask = function (pGanttVar, pJsonObj) { } } //if (id != undefined && !isNaN(parseInt(id)) && isFinite(id) && name && start && end && itemClass && completion != undefined && !isNaN(parseFloat(completion)) && isFinite(completion) && !isNaN(parseInt(parent)) && isFinite(parent)) { - pGanttVar.AddTaskItem(new task_1.TaskItem(id, name_1, start, end, itemClass, link, milestone, resourceName, completion, group, parent_1, open_1, dependsOn, caption, notes, pGanttVar, cost, planstart, planend, duration, bartext, additionalObject)); + pGanttVar.AddTaskItem(new task_1.TaskItem(id, name_1, start, end, itemClass, link, milestone, resourceName, completion, group, parent_1, open_1, dependsOn, caption, notes, pGanttVar, cost, planstart, planend, duration, bartext, additionalObject, planClass)); //} } }; @@ -1760,6 +1773,374 @@ exports.addJSONTask = function (pGanttVar, pJsonObj) { },{"./task":10,"./utils/general_utils":13}],8:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); +exports.ua = exports.tr = exports.sv = exports.ru = exports.pt = exports.pl = exports.nl = exports.ko = exports.ja = exports.id = exports.it = exports.hu = exports.he = exports.fr = exports.fi = exports.de = exports.es = exports.en = exports.cs = exports.cn = exports.scn = exports.ar = void 0; +var ar = { + 'format': 'التنسيق', + 'hour': 'ساعة', + 'day': 'يوم', + 'week': 'أسبوع', + 'month': 'شهر', + 'quarter': 'ربع', + 'hours': 'ساعات', + 'days': 'أيام', + 'weeks': 'أسابيع', + 'months': 'أشهر', + 'quarters': 'أرباع', + 'hr': 'س', + 'dy': 'يو', + 'wk': 'أ', + 'mth': 'ش', + 'qtr': 'ر', + 'hrs': 'س', + 'dys': 'ي', + 'wks': 'أ', + 'mths': 'ش', + 'qtrs': 'ر', + 'res': 'الموارد', + 'dur': 'المدة', + 'comp': '%', + 'completion': 'الإنجاز', + 'startdate': 'تاريخ البدء', + 'planstartdate': 'تاريخ بدء الخطة', + 'enddate': 'تاريخ الانتهاء', + 'planenddate': 'تاريخ نهاية الخطة', + 'cost': 'التكلفة', + 'moreinfo': 'مزيد من المعلومات', + 'nodata': 'لم يتم العثور على مهام', + 'notes': 'ملاحظات', + 'january': 'يناير', + 'february': 'فبراير', + 'march': 'مارس', + 'april': 'أبريل', + 'maylong': 'مايو', + 'june': 'يونيو', + 'july': 'يوليو', + 'august': 'أغسطس', + 'september': 'سبتمبر', + 'october': 'أكتوبر', + 'november': 'نوفمبر', + 'december': 'ديسمبر', + 'jan': 'يناير', + 'feb': 'فبراير', + 'mar': 'مارس', + 'apr': 'أبريل', + 'may': 'مايو', + 'jun': 'يونيو', + 'jul': 'يوليو', + 'aug': 'أغسطس', + 'sep': 'سبتمبر', + 'oct': 'أكتوبر', + 'nov': 'نوفمبر', + 'dec': 'ديسمبر', + 'sunday': 'الأحد', + 'monday': 'الإثنين', + 'tuesday': 'الثلاثاء', + 'wednesday': 'الأربعاء', + 'thursday': 'الخميس', + 'friday': 'الجمعة', + 'saturday': 'السبت', + 'sun': 'الأحد', + 'mon': 'الإثنين', + 'tue': 'الثلاثاء', + 'wed': 'الأربعاء', + 'thu': 'الخميس', + 'fri': 'الجمعة', + 'sat': 'السبت', + 'tooltipLoading': 'جاري التحميل...' +}; +exports.ar = ar; +var scn = { + 'january': '一月', + 'february': '二月', + 'march': '三月', + 'april': '四月', + 'maylong': '五月', + 'june': '六月', + 'july': '七月', + 'august': '八月', + 'september': '九月', + 'october': '十月', + 'november': '十一月', + 'december': '十二月', + 'jan': '一月', + 'feb': '二月', + 'mar': '三月', + 'apr': '四月', + 'may': '五月', + 'jun': '六月', + 'jul': '七月', + 'aug': '八月', + 'sep': '九月', + 'oct': '十月', + 'nov': '十一月', + 'dec': '十二月', + 'sunday': '星期日', + 'monday': '星期一', + 'tuesday': '星期二', + 'wednesday': '星期三', + 'thursday': '星期四', + 'friday': '星期五', + 'saturday': '星期六', + 'sun': '星期日', + 'mon': '星期一', + 'tue': '星期二', + 'wed': '星期三', + 'thu': '星期四', + 'fri': '星期五', + 'sat': '星期六', + 'res': '资源', + 'dur': '时长', + 'comp': '完成度', + 'completion': '完成', + 'startdate': '起始日期', + 'planstartdate': '计划起始日期', + 'enddate': '截止日期', + 'planenddate': '计划截止日期', + 'cost': '成本', + 'moreinfo': "更多信息", + 'nodata': 'No tasks found', + 'notes': '备注', + 'format': '格式', + 'hour': '时', + 'day': '日', + 'week': '星期', + 'month': '月', + 'quarter': '季', + 'hours': '小时', + 'days': '天', + 'weeks': '周', + 'months': '月', + 'quarters': '季', + 'hr': '小时', + 'dy': '天', + 'wk': '周', + 'mth': '月', + 'qtr': '季', + 'hrs': '小时', + 'dys': '天', + 'wks': '周', + 'mths': '月', + 'qtrs': '季' +}; +exports.scn = scn; +var cn = { + 'january': '一月', + 'february': '二月', + 'march': '三月', + 'april': '四月', + 'maylong': '五月', + 'june': '六月', + 'july': '七月', + 'august': '八月', + 'september': '九月', + 'october': '十月', + 'november': '十一月', + 'december': '十二月', + 'jan': '一月', + 'feb': '二月', + 'mar': '三月', + 'apr': '四月', + 'may': '五月', + 'jun': '六月', + 'jul': '七月', + 'aug': '八月', + 'sep': '九月', + 'oct': '十月', + 'nov': '十一月', + 'dec': '十二月', + 'sunday': '星期日', + 'monday': '星期一', + 'tuesday': '星期二', + 'wednesday': '星期三', + 'thursday': '星期四', + 'friday': '星期五', + 'saturday': '星期六', + 'sun': '星期日', + 'mon': '星期一', + 'tue': '星期二', + 'wed': '星期三', + 'thu': '星期四', + 'fri': '星期五', + 'sat': '星期六', + 'res': '資源', + 'dur': '時程', + 'comp': '達成率', + 'completion': '達成', + 'startdate': '起始日期', + 'planstartdate': '計劃起始日期', + 'enddate': '截止日期', + 'planenddate': '計劃截止日期', + 'cost': '成本', + 'moreinfo': "更多資訊", + 'nodata': 'No tasks found', + 'notes': '備註', + 'format': '格式', + 'hour': '時', + 'day': '日', + 'week': '星期', + 'month': '月', + 'quarter': '季', + 'hours': '小時', + 'days': '天', + 'weeks': '週', + 'months': '月', + 'quarters': '季', + 'hr': '小時', + 'dy': '天', + 'wk': '週', + 'mth': '月', + 'qtr': '季', + 'hrs': '小時', + 'dys': '天', + 'wks': '週', + 'mths': '月', + 'qtrs': '季' +}; +exports.cn = cn; +var cs = { + 'format': 'Zobrazení', + 'hour': 'Hodina', + 'day': 'Den', + 'week': 'Týden', + 'month': 'Měsíc', + 'quarter': 'Kvartál', + 'hours': 'Hodiny', + 'days': 'Dni', + 'weeks': 'Týdny', + 'months': 'Měsíce', + 'quarters': 'Kvartály', + 'hr': 'Ho', + 'dy': 'Den', + 'wk': 'Tyd', + 'mth': 'Měs', + 'qtr': 'Kvar', + 'hrs': 'Ho', + 'dys': 'Dni', + 'wks': 'Tyd', + 'mths': 'Měs', + 'qtrs': 'Kvar', + 'res': 'Přiřazeno', + 'dur': 'Trvání', + 'comp': '%', + 'completion': 'Hotovo', + 'startdate': 'Start', + 'planstartdate': 'Plánovaný start', + 'enddate': 'Konec', + 'planenddate': 'Plánovaný konec', + 'cost': 'Náklady', + 'moreinfo': 'Více informací', + 'nodata': 'No tasks found', + 'notes': 'Poznámky', + 'january': 'Leden', + 'february': 'Únor', + 'march': 'Březen', + 'april': 'Duben', + 'maylong': 'Květen', + 'june': 'Červen', + 'july': 'Červenec', + 'august': 'Srpen', + 'september': 'Září', + 'october': 'Říjen', + 'november': 'Listopad', + 'december': 'Prosinec', + 'jan': 'Led', + 'feb': 'Úno', + 'mar': 'Bře', + 'apr': 'Dub', + 'may': 'Kvě', + 'jun': 'Čer', + 'jul': 'Čvc', + 'aug': 'Srp', + 'sep': 'Zář', + 'oct': 'Říj', + 'nov': 'Lis', + 'dec': 'Pro', + 'sunday': 'Neděle', + 'monday': 'Pondělí', + 'tuesday': 'Úterý', + 'wednesday': 'Středa', + 'thursday': 'Čtvrtek', + 'friday': 'Pátek', + 'saturday': 'Sobota', + 'sun': 'Ne', + 'mon': 'Po', + 'tue': 'Út', + 'wed': 'St', + 'thu': 'Čt', + 'fri': 'Pa', + 'sat': 'So', + 'tooltipLoading': 'Nahrávám...' +}; +exports.cs = cs; +var de = { + 'format': 'Ansicht', + 'hour': 'Stunde', + 'day': 'Tag', + 'week': 'Woche', + 'month': 'Monat', + 'quarter': 'Quartal', + 'hours': 'Stunden', + 'days': 'Tage', + 'weeks': 'Wochen', + 'months': 'Monate', + 'quarters': 'Quartale', + 'hr': 'h', + 'dy': 'T', + 'wk': 'W', + 'mth': 'M', + 'qtr': 'Q', + 'hrs': 'Std', + 'dys': 'Tage', + 'wks': 'Wochen', + 'mths': 'Monate', + 'qtrs': 'Quartal', + 'res': 'Resource', + 'dur': 'Dauer', + 'comp': '%', + 'completion': 'Fertigstellung', + 'startdate': 'Erste Buchu', + 'planstartdate': 'Erste Buchu Plan', + 'enddate': 'Letzte Buchung', + 'planenddate': 'Plan Letzte Buchung', + 'cost': 'Cost', + 'moreinfo': 'Weitere Infos', + 'nodata': 'No tasks found', + 'notes': 'Anmerkung', + 'january': 'Jänner', + 'february': 'Februar', + 'march': 'März', + 'april': 'April', + 'maylong': 'Mai', + 'june': 'Juni', + 'july': 'Juli', + 'august': 'August', + 'september': 'September', + 'october': 'Oktober', + 'november': 'November', + 'december': 'Dezember', + 'jan': 'Jan', + 'feb': 'Feb', + 'mar': 'Mar', + 'apr': 'Apr', + 'may': 'Mai', + 'jun': 'Jun', + 'jul': 'Jul', + 'aug': 'Aug', + 'sep': 'Sep', + 'oct': 'Okt', + 'nov': 'Nov', + 'dec': 'Dez', + 'sunday': 'Sonntag', + 'monday': 'Montag', + 'tuesday': 'Dienstag', + 'wednesday': 'Mittwoch', + 'thursday': 'Donnerstag', + 'friday': 'Freitag', + 'saturday': 'Samstag', + 'sun': 'So', + 'mon': 'Mo', 'tue': 'Di', 'wed': 'Mi', 'thu': 'Do', 'fri': 'Fr', 'sat': 'Sa' +}; +exports.de = de; var es = { 'january': 'Enero', 'february': 'Febrero', @@ -1801,7 +2182,7 @@ var es = { 'sat': ' Sab', 'res': 'Recurso', 'dur': 'Duración', - 'comp': '% Compl.', + 'comp': '%', 'completion': 'Completado', 'startdate': 'Inicio', 'planstartdate': 'Inicio Planificado', @@ -1859,7 +2240,7 @@ var en = { 'qtrs': 'Qtrs', 'res': 'Resource', 'dur': 'Duration', - 'comp': '% Comp.', + 'comp': '%', 'completion': 'Completion', 'startdate': 'Start Date', 'planstartdate': 'Plan Start Date', @@ -1910,75 +2291,757 @@ var en = { 'tooltipLoading': 'Loading...' }; exports.en = en; -var de = { - 'format': 'Ansicht', - 'hour': 'Stunde', - 'day': 'Tag', - 'week': 'Woche', - 'month': 'Monat', - 'quarter': 'Quartal', - 'hours': 'Stunden', - 'days': 'Tage', - 'weeks': 'Wochen', - 'months': 'Monate', - 'quarters': 'Quartale', - 'hr': 'h', - 'dy': 'T', - 'wk': 'W', - 'mth': 'M', +var fi = { + 'format': 'Näkymä', + 'hour': 'Tunti', + 'day': 'Päivä', + 'week': 'Viikko', + 'month': 'Kuukausi', + 'quarter': 'Kvartaali', + 'hours': 'Tunnit', + 'days': 'Päivät', + 'weeks': 'Viikot', + 'months': 'Kuukaudet', + 'quarters': 'Kvartaalit', + 'hr': 't', + 'dy': 'pv', + 'wk': 'vk', + 'mth': 'kk', 'qtr': 'Q', - 'hrs': 'Std', - 'dys': 'Tage', - 'wks': 'Wochen', - 'mths': 'Monate', - 'qtrs': 'Quartal', - 'res': 'Resource', - 'dur': 'Dauer', - 'comp': '%Fertig', - 'completion': 'Fertigstellung', - 'startdate': 'Erste Buchu', - 'planstartdate': 'Erste Buchu Plan', - 'enddate': 'Letzte Buchung', - 'planenddate': 'Plan Letzte Buchung', - 'cost': 'Cost', - 'moreinfo': 'Weitere Infos', - 'nodata': 'No tasks found', - 'notes': 'Anmerkung', - 'january': 'Jänner', - 'february': 'Februar', - 'march': 'März', - 'april': 'April', + 'hrs': 't:t', + 'dys': 'pv:t', + 'wks': 'vk:t', + 'mths': 'kk:t', + 'qtrs': 'Kvartaalit', + 'res': 'Henkilö', + 'dur': 'Kesto', + 'comp': '%', + 'completion': 'Valmius', + 'startdate': 'Alkupäivä', + 'planstartdate': 'Suunniteltu alkupäivä', + 'enddate': 'Päättymispäivä', + 'planenddate': 'Suunniteltu päättymispäivä', + 'cost': 'Kustannus', + 'moreinfo': 'Lisätieto', + 'nodata': 'Tehtäviä ei löydy', + 'notes': 'Muistiinpanot', + 'january': 'Tammikuu', + 'february': 'Helmikuu', + 'march': 'Maaliskuu', + 'april': 'Huhtikuu', + 'maylong': 'Toukokuu', + 'june': 'Kesäkuu', + 'july': 'Heinäkuu', + 'august': 'Elokuu', + 'september': 'Syyskuu', + 'october': 'Lokakuu', + 'november': 'Marraskuu', + 'december': 'Joulukuu', + 'jan': 'Tammi', + 'feb': 'Helmi', + 'mar': 'Maalis', + 'apr': 'Huhti', + 'may': 'Touko', + 'jun': 'Kesä', + 'jul': 'Heinä', + 'aug': 'Elo', + 'sep': 'Syys', + 'oct': 'Loka', + 'nov': 'Marras', + 'dec': 'Joulu', + 'sunday': 'Sunnuntai', + 'monday': 'Maanantai', + 'tuesday': 'Tiista', + 'wednesday': 'Keskiviikko', + 'thursday': 'Torstai', + 'friday': 'Perjantai', + 'saturday': 'Lauantai', + 'sun': 'Su', + 'mon': 'Ma', + 'tue': 'Ti', + 'wed': 'Ke', + 'thu': 'To', + 'fri': 'Pe', + 'sat': 'La', + 'tooltipLoading': 'Ladataan...' +}; +exports.fi = fi; +/** + * Mois : http://bdl.oqlf.gouv.qc.ca/bdl/gabarit_bdl.asp?id=3619 + Jours : http://bdl.oqlf.gouv.qc.ca/bdl/gabarit_bdl.asp?id=3617 + */ +var fr = { + 'january': 'Janvier', + 'february': 'Février', + 'march': 'Mars', + 'april': 'Avril', 'maylong': 'Mai', + 'june': 'Juin', + 'july': 'Juillet', + 'august': 'Août', + 'september': 'Septembre', + 'october': 'Octobre', + 'november': 'Novembre', + 'december': 'Décembre', + 'jan': 'Janv', + 'feb': 'Févr', + 'mar': 'Mars', + 'apr': 'Avr', + 'may': 'Mai', + 'jun': 'Juin', + 'jul': 'Juil', + 'aug': 'Août', + 'sep': 'Sept', + 'oct': 'Oct', + 'nov': 'Nov', + 'dec': 'Déc', + 'sunday': 'Dimanche', + 'monday': 'Lundi', + 'tuesday': 'Mardi', + 'wednesday': 'Mercredi', + 'thursday': 'Jeudi', + 'friday': 'Vendredi', + 'saturday': 'Samedi', + 'sun': 'Dim', + 'mon': 'Lun', + 'tue': 'Mar', + 'wed': 'Mer', + 'thu': 'Jeu', + 'fri': 'Ven', + 'sat': 'Sam', + 'res': 'Ressource', + 'dur': 'Durée', + 'comp': '%', + 'completion': 'Terminé', + 'startdate': 'Début', + 'planstartdate': 'Plan Début', + 'enddate': 'Fin', + 'planenddate': 'Plan Fin', + 'cost': 'Cost', + 'moreinfo': "Plus d'informations", + 'nodata': 'No tasks found', + 'notes': 'Notes', + 'format': 'Format', + 'hour': 'Heure', + 'day': 'Jour', + 'week': 'Semaine', + 'month': 'Mois', + 'quarter': 'Trimestre', + 'hours': 'Heures', + 'days': 'Jours', + 'weeks': 'Semaines', + 'months': 'Mois', + 'quarters': 'Trimestres', + 'hr': 'h', + 'dy': 'j', + 'wk': 'sem', + 'mth': 'mois', + 'qtr': 'tri', + 'hrs': 'h', + 'dys': 'j', + 'wks': 'sem', + 'mths': 'mois', + 'qtrs': 'tri' +}; +exports.fr = fr; +var he = { + 'format': 'תבנית', + 'hour': 'שעה', + 'day': 'יום', + 'week': 'שבוע', + 'month': 'חודש', + 'quarter': 'רבעון', + 'hours': 'שעות', + 'days': 'ימים', + 'weeks': 'שבועות', + 'months': 'חודשים', + 'quarters': 'רבעונים', + 'hr': 'שעה', + 'dy': 'יום', + 'wk': 'שבוע', + 'mth': 'חודש', + 'qtr': 'רבעון', + 'hrs': 'שעות', + 'dys': 'ימים', + 'wks': 'שבועות', + 'mths': 'חודשים', + 'qtrs': 'רבעונים', + 'res': 'משאב', + 'dur': 'משך', + 'comp': '%', + 'completion': 'השלמה', + 'startdate': 'תאריך התחלה', + 'planstartdate': 'תאריך התחלה מתוכנן', + 'enddate': 'תאריך סיום', + 'planenddate': 'תאריך סיום מתוכנן', + 'cost': 'עלות', + 'moreinfo': 'מידע נוסף', + 'nodata': 'לא נמצאו משימות', + 'notes': 'הערות', + 'january': 'ינואר', + 'february': 'פברואר', + 'march': 'מרץ', + 'april': 'אפריל', + 'maylong': 'מאי', + 'june': 'יוני', + 'july': 'יולי', + 'august': 'אוגוסט', + 'september': 'ספטמבר', + 'october': 'אוקטובר', + 'november': 'נובמבר', + 'december': 'דצמבר', + 'jan': 'ינו', + 'feb': 'פבר', + 'mar': 'מרץ', + 'apr': 'אפר', + 'may': 'מאי', + 'jun': 'יוני', + 'jul': 'יולי', + 'aug': 'אוג', + 'sep': 'ספט', + 'oct': 'אוק', + 'nov': 'נוב', + 'dec': 'דצמ', + 'sunday': 'יום ראשון', + 'monday': 'יום שני', + 'tuesday': 'יום שלישי', + 'wednesday': 'יום רביעי', + 'thursday': 'الخميس', + 'friday': 'الجمعة', + 'saturday': 'السبت', + 'sun': 'الأحد', + 'mon': 'الإثنين', + 'tue': 'الثلاثاء', + 'wed': 'الأربعاء', + 'thu': 'الخميس', + 'fri': 'الجمعة', + 'sat': 'السبت', + 'tooltipLoading': 'جارٍ التحميل...' +}; +exports.he = he; +var it = { + 'format': 'Formato', + 'hour': 'Ora', + 'day': 'Giorno', + 'week': 'Settimana', + 'month': 'Mese', + 'quarter': 'Trimestre', + 'hours': 'Ore', + 'days': 'Giorni', + 'weeks': 'Mesi', + 'months': 'Settimane', + 'quarters': 'Trimestri', + 'hr': 'Ora', + 'dy': 'G', + 'wk': 'Sett.', + 'mth': 'Mese', + 'qtr': 'Trim.', + 'hrs': 'Ora', + 'dys': 'GG', + 'wks': 'Sett.', + 'mths': 'Mesi', + 'qtrs': 'Trim.', + 'res': 'Risorsa', + 'dur': 'Durata', + 'comp': '%', + 'completion': 'Completamento', + 'startdate': 'Data inizio', + 'planstartdate': 'Piano data inizio', + 'enddate': 'Data fine', + 'planenddate': 'Piano data fine', + 'cost': 'Costo', + 'moreinfo': 'Più informazioni', + 'nodata': 'Nessun task trovato', + 'notes': 'Note', + 'january': 'Gennaio', + 'february': 'Febbraio', + 'march': 'Marzo', + 'april': 'Aprile', + 'maylong': 'Maggio', + 'june': 'Giugno', + 'july': 'Luglio', + 'august': 'Agosto', + 'september': 'Settembre', + 'october': 'Ottobre', + 'november': 'Novembre', + 'december': 'Dicembre', + 'jan': 'Gen', + 'feb': 'Feb', + 'mar': 'Mar', + 'apr': 'Apr', + 'may': 'Mag', + 'jun': 'Giu', + 'jul': 'Lug', + 'aug': 'Ago', + 'sep': 'Set', + 'oct': 'Ott', + 'nov': 'Nov', + 'dec': 'Dic', + 'sunday': 'Domenica', + 'monday': 'Lunedì', + 'tuesday': 'Martedì', + 'wednesday': 'Mercoledì', + 'thursday': 'Giovedì', + 'friday': 'Venerdì', + 'saturday': 'Sabato', + 'sun': 'Dom', + 'mon': 'Lun', + 'tue': 'Mar', + 'wed': 'Mer', + 'thu': 'Gio', + 'fri': 'Ven', + 'sat': 'Sab', + 'tooltipLoading': 'Caricamento...' +}; +exports.it = it; +var hu = { + 'format': 'Formátum', + 'hour': 'Óra', + 'day': 'Nap', + 'week': 'Hét', + 'month': 'Hónap', + 'quarter': 'Negyedév ', + 'hours': 'Órák', + 'days': 'Nap', + 'weeks': 'Hét', + 'months': 'Hónap', + 'quarters': 'Negyedév', + 'hr': 'Ó', + 'dy': 'Nap', + 'wk': 'Hét', + 'mth': 'Hó', + 'qtr': 'NÉ', + 'hrs': 'Óra', + 'dys': 'Nap', + 'wks': 'Hét', + 'mths': 'Hó', + 'qtrs': 'NÉ', + 'res': 'Erőforrás', + 'dur': 'Időtartam', + 'comp': '%', + 'completion': 'Elkészült', + 'startdate': 'Kezdés', + 'planstartdate': 'Tervezett kezdés', + 'enddate': 'Befejezés', + 'planenddate': 'Tervezett befejezés', + 'cost': 'Költség', + 'moreinfo': 'További információ', + 'nodata': 'No tasks found', + 'notes': 'Jegyzetek', + 'january': 'Január', + 'february': 'Február', + 'march': 'Március', + 'april': 'Április', + 'maylong': 'Május', + 'june': 'Június', + 'july': 'Július', + 'august': 'Augusztus', + 'september': 'Szeptember', + 'october': 'Október', + 'november': 'November', + 'december': 'December', + 'jan': 'Jan', + 'feb': 'Feb', + 'mar': 'Már', + 'apr': 'Ápr', + 'may': 'Máj', + 'jun': 'Jún', + 'jul': 'Júl', + 'aug': 'Aug', + 'sep': 'Szep', + 'oct': 'Okt', + 'nov': 'Nov', + 'dec': 'Dec', + 'sunday': 'Vasárnap', + 'monday': 'Hétfő', + 'tuesday': 'Kedd', + 'wednesday': 'Szerda', + 'thursday': 'Csütörtök', + 'friday': 'Péntek', + 'saturday': 'Szombat', + 'sun': 'Vas', + 'mon': 'Hé', + 'tue': 'Ke', + 'wed': 'Sze', + 'thu': 'Csü', + 'fri': 'Pén', + 'sat': 'Szo', + 'tooltipLoading': 'Belöltés...' +}; +exports.hu = hu; +var id = { + 'format': 'Format', + 'hour': 'Jam', + 'day': 'Hari', + 'week': 'Minggu', + 'month': 'Bulan', + 'quarter': 'Kuartal', + 'hours': 'Jam', + 'days': 'Hari', + 'weeks': 'Minggu', + 'months': 'Bulan', + 'quarters': 'Kuartal', + 'hr': 'Jam', + 'dy': 'Hari', + 'wk': 'Min', + 'mth': 'Bln', + 'qtr': 'Krtl', + 'hrs': 'Jam', + 'dys': 'Hari', + 'wks': 'Min', + 'mths': 'Bln', + 'qtrs': 'Krtl', + 'res': 'Sumber Daya', + 'dur': 'Durasi', + 'comp': '%', + 'completion': 'Penyelesaian', + 'startdate': 'Tanggal Mulai', + 'planstartdate': 'Perencanaan Tanggal Mulai', + 'enddate': 'Tanggal Akhir', + 'planenddate': 'Perencanaan Tanggal Akhir', + 'cost': 'Biaya', + 'moreinfo': 'Informasi Lebih Lanjut', + 'nodata': 'No tasks found', + 'notes': 'Catatan', + 'january': 'Januari', + 'february': 'Februari', + 'march': 'Maret', + 'april': 'April', + 'maylong': 'Mei', 'june': 'Juni', 'july': 'Juli', - 'august': 'August', + 'august': 'Agustus', 'september': 'September', 'october': 'Oktober', 'november': 'November', - 'december': 'Dezember', + 'december': 'Desember', 'jan': 'Jan', 'feb': 'Feb', 'mar': 'Mar', 'apr': 'Apr', - 'may': 'Mai', + 'may': 'Mei', 'jun': 'Jun', 'jul': 'Jul', - 'aug': 'Aug', + 'aug': 'Agu', 'sep': 'Sep', 'oct': 'Okt', 'nov': 'Nov', - 'dec': 'Dez', - 'sunday': 'Sonntag', - 'monday': 'Montag', - 'tuesday': 'Dienstag', - 'wednesday': 'Mittwoch', - 'thursday': 'Donnerstag', - 'friday': 'Freitag', - 'saturday': 'Samstag', - 'sun': 'So', - 'mon': 'Mo', 'tue': 'Di', 'wed': 'Mi', 'thu': 'Do', 'fri': 'Fr', 'sat': 'Sa' + 'dec': 'Des', + 'sunday': 'Minggu', + 'monday': 'Senin', + 'tuesday': 'Selasa', + 'wednesday': 'Rabu', + 'thursday': 'Kamis', + 'friday': 'Jumat', + 'saturday': 'Sabtu', + 'sun': 'Min', + 'mon': 'Sen', + 'tue': 'Sel', + 'wed': 'Rab', + 'thu': 'Kam', + 'fri': 'Jum', + 'sat': 'Sab' }; -exports.de = de; +exports.id = id; +var ja = { + 'format': 'タイムライン表示', + 'hour': '時', + 'day': '日', + 'week': '週', + 'month': '月', + 'quarter': '四半期', + 'hours': '時間', + 'days': '日間', + 'weeks': '週間', + 'months': '月間', + 'quarters': '四半期', + 'hr': '時', + 'dy': '日', + 'wk': '週', + 'mth': '月', + 'qtr': '四', + 'hrs': '時間', + 'dys': '日間', + 'wks': '週間', + 'mths': '月間', + 'qtrs': '四半期', + 'res': 'リソース', + 'dur': '期間', + 'comp': '進捗率', + 'completion': '進捗率', + 'startdate': '開始日', + 'planstartdate': '予定開始日', + 'enddate': '期日', + 'planenddate': '予定期日', + 'cost': 'コスト', + 'moreinfo': '詳細', + 'nodata': 'No tasks found', + 'notes': 'ノート', + 'january': '1月', + 'february': '2月', + 'march': '3月', + 'april': '4月', + 'maylong': '5月', + 'june': '6月', + 'july': '7月', + 'august': '8月', + 'september': '9月', + 'october': '10月', + 'november': '11月', + 'december': '12月', + 'jan': '1月', + 'feb': '2月', + 'mar': '3月', + 'apr': '4月', + 'may': '5月', + 'jun': '6月', + 'jul': '7月', + 'aug': '8月', + 'sep': '9月', + 'oct': '10月', + 'nov': '11月', + 'dec': '12月', + 'sunday': '日曜日', + 'monday': '月曜日', + 'tuesday': '火曜日', + 'wednesday': '水曜日', + 'thursday': '木曜日', + 'friday': '金曜日', + 'saturday': '土曜日', + 'sun': '日', + 'mon': '月', + 'tue': '火', + 'wed': '水', + 'thu': '木', + 'fri': '金', + 'sat': '土', + 'tooltipLoading': 'ローディング中...' +}; +exports.ja = ja; +var ko = { + 'format': '구분', + 'hour': '시', + 'day': '일', + 'week': '주', + 'month': '월', + 'quarter': '분기', + 'hours': '시', + 'days': '일', + 'weeks': '주', + 'months': '월', + 'quarters': '분기', + 'hr': '시', + 'dy': '일', + 'wk': '주', + 'mth': '월', + 'qtr': '분기', + 'hrs': '시', + 'dys': '일', + 'wks': '주', + 'mths': '월', + 'qtrs': '분기', + 'res': '이름', + 'dur': '기간', + 'comp': '%', + 'completion': '완료', + 'startdate': '시작일자', + 'planstartdate': '계획 시작일자', + 'enddate': '종료일자', + 'planenddate': '계획 종료일자', + 'cost': '비용', + 'moreinfo': '더 많은 정보', + 'nodata': 'No tasks found', + 'notes': '비고', + 'january': '1월', + 'february': '2월', + 'march': '3월', + 'april': '4월', + 'maylong': '5월', + 'june': '6월', + 'july': '7월', + 'august': '8월', + 'september': '9월', + 'october': '10월', + 'november': '11월', + 'december': '12월', + 'jan': '1', + 'feb': '2', + 'mar': '3', + 'apr': '4', + 'may': '5', + 'jun': '6', + 'jul': '7', + 'aug': '8', + 'sep': '9', + 'oct': '10', + 'nov': '11', + 'dec': '12', + 'sunday': '일요일', + 'monday': '월요일', + 'tuesday': '화요일', + 'wednesday': '수요일', + 'thursday': '목요일', + 'friday': '금요일', + 'saturday': '토요일', + 'sun': '일', + 'mon': '월', + 'tue': '화', + 'wed': '수', + 'thu': '목', + 'fri': '금', + 'sat': '토', + 'tooltipLoading': '로딩중...' +}; +exports.ko = ko; +var nl = { + 'format': 'Format', + 'hour': 'Uur', + 'day': 'Dag', + 'week': 'Week', + 'month': 'Maand', + 'quarter': 'Kwartaal', + 'hours': 'Uren', + 'days': 'Dagen', + 'weeks': 'Weken', + 'months': 'Maanden', + 'quarters': 'Kwartalen', + 'hr': 'uur', + 'dy': 'dag', + 'wk': 'wk', + 'mth': 'mnd', + 'qtr': 'kw', + 'hrs': 'uren', + 'dys': 'dagen', + 'wks': 'weken', + 'mths': 'maanden', + 'qtrs': 'kwartalen', + 'res': 'Resource', + 'dur': 'Doorlooptijd', + 'comp': '%', + 'completion': 'Gereed', + 'startdate': 'Startdatum', + 'planstartdate': 'Geplande startdatum', + 'enddate': 'Einddatum', + 'planenddate': 'Geplande einddatum', + 'cost': 'Kosten', + 'moreinfo': 'Meer informatie', + 'nodata': 'Geen taken gevonden', + 'notes': 'Notities', + 'january': 'januari', + 'february': 'februari', + 'march': 'maart', + 'april': 'april', + 'maylong': 'mei', + 'june': 'juni', + 'july': 'juli', + 'august': 'augustus', + 'september': 'september', + 'october': 'oktober', + 'november': 'november', + 'december': 'december', + 'jan': 'jan', + 'feb': 'feb', + 'mar': 'mrt', + 'apr': 'apr', + 'may': 'mei', + 'jun': 'jun', + 'jul': 'jul', + 'aug': 'aug', + 'sep': 'sep', + 'oct': 'okt', + 'nov': 'nov', + 'dec': 'dec', + 'sunday': 'zondag', + 'monday': 'maandag', + 'tuesday': 'dinsdag', + 'wednesday': 'woensdag', + 'thursday': 'donderdag', + 'friday': 'vrijdag', + 'saturday': 'zaterdag', + 'sun': 'zo', + 'mon': 'ma', + 'tue': 'di', + 'wed': 'wo', + 'thu': 'do', + 'fri': 'vr', + 'sat': 'za' +}; +exports.nl = nl; +var pl = { + 'format': 'Format', + 'hour': 'Godzina', + 'day': 'Dzień', + 'week': 'Tydzień', + 'month': 'Miesiąc', + 'quarter': 'Kwartał', + 'hours': 'Godziny', + 'days': 'Dni', + 'weeks': 'Tygodni', + 'months': 'Miesięcy', + 'quarters': 'Kwartały', + 'hr': 'godz.', + 'dy': 'd.', + 'wk': 'tydz.', + 'mth': 'mies.', + 'qtr': 'kw.', + 'hrs': 'godz.', + 'dys': 'd.', + 'wks': 'tyg.', + 'mths': 'mies.', + 'qtrs': 'kw.', + 'res': 'Zasób', + 'dur': 'Czas trwania', + 'comp': '%', + 'completion': 'Ukończenie', + 'startdate': 'Data Startu', + 'planstartdate': 'Planowana Data Startu', + 'enddate': 'Data Zakończenia', + 'planenddate': 'Planowana Data Zakończenia', + 'cost': 'Koszt', + 'moreinfo': 'Więcej Inormacji', + 'nodata': 'Nie znaleziono zadań', + 'notes': 'Dodatkowe Informacje', + 'january': 'Styczeń', + 'february': 'Luty', + 'march': 'Marzec', + 'april': 'Kwiecień', + 'maylong': 'Maj', + 'june': 'Czerwiec', + 'july': 'Lipiec', + 'august': 'Sierpień', + 'september': 'Wrzesień', + 'october': 'Październik', + 'november': 'Listopad', + 'december': 'Grudzień', + 'jan': 'St', + 'feb': 'Lut', + 'mar': 'Mar', + 'apr': 'Kw', + 'may': 'Maj', + 'jun': 'Cz', + 'jul': 'Lip', + 'aug': 'Sier', + 'sep': 'Wrz', + 'oct': 'Paź', + 'nov': 'Lis', + 'dec': 'Gr', + 'sunday': 'Niedziela', + 'monday': 'Poniedziałek', + 'tuesday': 'Wtorek', + 'wednesday': 'Środa', + 'thursday': 'Czwartek', + 'friday': 'Piątek', + 'saturday': 'Sobota', + 'sun': 'Nd', + 'mon': 'Pon', + 'tue': 'Wt', + 'wed': 'Śr', + 'thu': 'Czw', + 'fri': 'Pt', + 'sat': 'So', + 'tooltipLoading': 'Ładowanie...' +}; +exports.pl = pl; var pt = { 'hours': 'Horas', 'days': 'Dias', @@ -2002,7 +3065,7 @@ var pt = { 'mths': 'meses', 'qtrs': 'qtrs', 'completion': 'Terminado', - 'comp': '% Completado', + 'comp': '%', 'moreinfo': 'Mais informações', 'nodata': 'Sem atividades', 'notes': 'Notas', @@ -2086,7 +3149,7 @@ var ru = { 'sat': ' Сб', 'res': 'Ресурс', 'dur': 'Длительность', - 'comp': '% выполнения', + 'comp': '%', 'completion': 'Выполнено', 'startdate': 'Нач. дата', 'planstartdate': 'Plan Нач. дата', @@ -2120,158 +3183,6 @@ var ru = { 'tooltipLoading': 'Загрузка...' }; exports.ru = ru; -/** - * Mois : http://bdl.oqlf.gouv.qc.ca/bdl/gabarit_bdl.asp?id=3619 - Jours : http://bdl.oqlf.gouv.qc.ca/bdl/gabarit_bdl.asp?id=3617 - */ -var fr = { - 'january': 'Janvier', - 'february': 'Février', - 'march': 'Mars', - 'april': 'Avril', - 'maylong': 'Mai', - 'june': 'Juin', - 'july': 'Juillet', - 'august': 'Août', - 'september': 'Septembre', - 'october': 'Octobre', - 'november': 'Novembre', - 'december': 'Décembre', - 'jan': 'Janv', - 'feb': 'Févr', - 'mar': 'Mars', - 'apr': 'Avr', - 'may': 'Mai', - 'jun': 'Juin', - 'jul': 'Juil', - 'aug': 'Août', - 'sep': 'Sept', - 'oct': 'Oct', - 'nov': 'Nov', - 'dec': 'Déc', - 'sunday': 'Dimanche', - 'monday': 'Lundi', - 'tuesday': 'Mardi', - 'wednesday': 'Mercredi', - 'thursday': 'Jeudi', - 'friday': 'Vendredi', - 'saturday': 'Samedi', - 'sun': 'Dim', - 'mon': 'Lun', - 'tue': 'Mar', - 'wed': 'Mer', - 'thu': 'Jeu', - 'fri': 'Ven', - 'sat': 'Sam', - 'res': 'Ressource', - 'dur': 'Durée', - 'comp': '% Term.', - 'completion': 'Terminé', - 'startdate': 'Début', - 'planstartdate': 'Plan Début', - 'enddate': 'Fin', - 'planenddate': 'Plan Fin', - 'cost': 'Cost', - 'moreinfo': "Plus d'informations", - 'nodata': 'No tasks found', - 'notes': 'Notes', - 'format': 'Format', - 'hour': 'Heure', - 'day': 'Jour', - 'week': 'Semaine', - 'month': 'Mois', - 'quarter': 'Trimestre', - 'hours': 'Heures', - 'days': 'Jours', - 'weeks': 'Semaines', - 'months': 'Mois', - 'quarters': 'Trimestres', - 'hr': 'h', - 'dy': 'j', - 'wk': 'sem', - 'mth': 'mois', - 'qtr': 'tri', - 'hrs': 'h', - 'dys': 'j', - 'wks': 'sem', - 'mths': 'mois', - 'qtrs': 'tri' -}; -exports.fr = fr; -var cn = { - 'january': '一月', - 'february': '二月', - 'march': '三月', - 'april': '四月', - 'maylong': '五月', - 'june': '六月', - 'july': '七月', - 'august': '八月', - 'september': '九月', - 'october': '十月', - 'november': '十一月', - 'december': '十二月', - 'jan': '一月', - 'feb': '二月', - 'mar': '三月', - 'apr': '四月', - 'may': '五月', - 'jun': '六月', - 'jul': '七月', - 'aug': '八月', - 'sep': '九月', - 'oct': '十月', - 'nov': '十一月', - 'dec': '十二月', - 'sunday': '星期日', - 'monday': '星期一', - 'tuesday': '星期二', - 'wednesday': '星期三', - 'thursday': '星期四', - 'friday': '星期五', - 'saturday': '星期六', - 'sun': '星期日', - 'mon': '星期一', - 'tue': '星期二', - 'wed': '星期三', - 'thu': '星期四', - 'fri': '星期五', - 'sat': '星期六', - 'res': '資源', - 'dur': '時程', - 'comp': '達成率', - 'completion': '達成', - 'startdate': '起始日期', - 'planstartdate': '計劃起始日期', - 'enddate': '截止日期', - 'planenddate': '計劃截止日期', - 'cost': '成本', - 'moreinfo': "更多資訊", - 'nodata': 'No tasks found', - 'notes': '備註', - 'format': '格式', - 'hour': '時', - 'day': '日', - 'week': '星期', - 'month': '月', - 'quarter': '季', - 'hours': '小時', - 'days': '天', - 'weeks': '週', - 'months': '月', - 'quarters': '季', - 'hr': '小時', - 'dy': '天', - 'wk': '週', - 'mth': '月', - 'qtr': '季', - 'hrs': '小時', - 'dys': '天', - 'wks': '週', - 'mths': '月', - 'qtrs': '季' -}; -exports.cn = cn; var sv = { 'format': 'Filter', 'hour': 'Timme', @@ -2296,7 +3207,7 @@ var sv = { 'qtrs': 'Q', 'res': 'Resurs', 'dur': 'Tidsåtgång', - 'comp': '% klart', + 'comp': '%', 'completion': 'Klart', 'startdate': 'Startdatum', 'planstartdate': 'Planerad startdatum', @@ -2346,154 +3257,6 @@ var sv = { 'sat': 'lör' }; exports.sv = sv; -var nl = { - 'format': 'Format', - 'hour': 'Uur', - 'day': 'Dag', - 'week': 'Week', - 'month': 'Maand', - 'quarter': 'Kwartaal', - 'hours': 'Uren', - 'days': 'Dagen', - 'weeks': 'Weken', - 'months': 'Maanden', - 'quarters': 'Kwartalen', - 'hr': 'uur', - 'dy': 'dag', - 'wk': 'wk', - 'mth': 'mnd', - 'qtr': 'kw', - 'hrs': 'uren', - 'dys': 'dagen', - 'wks': 'weken', - 'mths': 'maanden', - 'qtrs': 'kwartalen', - 'res': 'Resource', - 'dur': 'Doorlooptijd', - 'comp': '% gereed', - 'completion': 'Gereed', - 'startdate': 'Startdatum', - 'planstartdate': 'Geplande startdatum', - 'enddate': 'Einddatum', - 'planenddate': 'Geplande einddatum', - 'cost': 'Kosten', - 'moreinfo': 'Meer informatie', - 'nodata': 'No tasks found', - 'notes': 'Notities', - 'january': 'januari', - 'february': 'februari', - 'march': 'maart', - 'april': 'april', - 'maylong': 'mei', - 'june': 'juni', - 'july': 'juli', - 'august': 'augustus', - 'september': 'september', - 'october': 'oktober', - 'november': 'november', - 'december': 'december', - 'jan': 'jan', - 'feb': 'feb', - 'mar': 'mrt', - 'apr': 'apr', - 'may': 'mei', - 'jun': 'jun', - 'jul': 'jul', - 'aug': 'aug', - 'sep': 'sep', - 'oct': 'okt', - 'nov': 'nov', - 'dec': 'dec', - 'sunday': 'zondag', - 'monday': 'maandag', - 'tuesday': 'dinsdag', - 'wednesday': 'woensdag', - 'thursday': 'donderdag', - 'friday': 'vrijdag', - 'saturday': 'zaterdag', - 'sun': 'zo', - 'mon': 'ma', - 'tue': 'di', - 'wed': 'wo', - 'thu': 'do', - 'fri': 'vr', - 'sat': 'za' -}; -exports.nl = nl; -var id = { - 'format': 'Format', - 'hour': 'Jam', - 'day': 'Hari', - 'week': 'Minggu', - 'month': 'Bulan', - 'quarter': 'Kuartal', - 'hours': 'Jam', - 'days': 'Hari', - 'weeks': 'Minggu', - 'months': 'Bulan', - 'quarters': 'Kuartal', - 'hr': 'Jam', - 'dy': 'Hari', - 'wk': 'Min', - 'mth': 'Bln', - 'qtr': 'Krtl', - 'hrs': 'Jam', - 'dys': 'Hari', - 'wks': 'Min', - 'mths': 'Bln', - 'qtrs': 'Krtl', - 'res': 'Sumber Daya', - 'dur': 'Durasi', - 'comp': '% Penyelesaian', - 'completion': 'Penyelesaian', - 'startdate': 'Tanggal Mulai', - 'planstartdate': 'Perencanaan Tanggal Mulai', - 'enddate': 'Tanggal Akhir', - 'planenddate': 'Perencanaan Tanggal Akhir', - 'cost': 'Biaya', - 'moreinfo': 'Informasi Lebih Lanjut', - 'nodata': 'No tasks found', - 'notes': 'Catatan', - 'january': 'Januari', - 'february': 'Februari', - 'march': 'Maret', - 'april': 'April', - 'maylong': 'Mei', - 'june': 'Juni', - 'july': 'Juli', - 'august': 'Agustus', - 'september': 'September', - 'october': 'Oktober', - 'november': 'November', - 'december': 'Desember', - 'jan': 'Jan', - 'feb': 'Feb', - 'mar': 'Mar', - 'apr': 'Apr', - 'may': 'Mei', - 'jun': 'Jun', - 'jul': 'Jul', - 'aug': 'Agu', - 'sep': 'Sep', - 'oct': 'Okt', - 'nov': 'Nov', - 'dec': 'Des', - 'sunday': 'Minggu', - 'monday': 'Senin', - 'tuesday': 'Selasa', - 'wednesday': 'Rabu', - 'thursday': 'Kamis', - 'friday': 'Jumat', - 'saturday': 'Sabtu', - 'sun': 'Min', - 'mon': 'Sen', - 'tue': 'Sel', - 'wed': 'Rab', - 'thu': 'Kam', - 'fri': 'Jum', - 'sat': 'Sab' -}; -exports.id = id; var tr = { 'format': 'Biçim', 'hour': 'Saat', @@ -2518,7 +3281,7 @@ var tr = { 'qtrs': 'Çyrk', 'res': 'Kaynak', 'dur': 'Süre', - 'comp': '% Tamamlanma.', + 'comp': '%.', 'completion': 'Tamamlanma', 'startdate': 'Başlangıç Tarihi', 'planstartdate': 'Plan Başlama Tarihi', @@ -2568,310 +3331,86 @@ var tr = { 'sat': 'Cmt' }; exports.tr = tr; -var ja = { - 'format': 'タイムライン表示', - 'hour': '時', - 'day': '日', - 'week': '週', - 'month': '月', - 'quarter': '四半期', - 'hours': '時間', - 'days': '日間', - 'weeks': '週間', - 'months': '月間', - 'quarters': '四半期', - 'hr': '時', - 'dy': '日', - 'wk': '週', - 'mth': '月', - 'qtr': '四', - 'hrs': '時間', - 'dys': '日間', - 'wks': '週間', - 'mths': '月間', - 'qtrs': '四半期', - 'res': 'リソース', - 'dur': '期間', - 'comp': '進捗率', - 'completion': '進捗率', - 'startdate': '開始日', - 'planstartdate': '予定開始日', - 'enddate': '期日', - 'planenddate': '予定期日', - 'cost': 'コスト', - 'moreinfo': '詳細', - 'nodata': 'No tasks found', - 'notes': 'ノート', - 'january': '1月', - 'february': '2月', - 'march': '3月', - 'april': '4月', - 'maylong': '5月', - 'june': '6月', - 'july': '7月', - 'august': '8月', - 'september': '9月', - 'october': '10月', - 'november': '11月', - 'december': '12月', - 'jan': '1月', - 'feb': '2月', - 'mar': '3月', - 'apr': '4月', - 'may': '5月', - 'jun': '6月', - 'jul': '7月', - 'aug': '8月', - 'sep': '9月', - 'oct': '10月', - 'nov': '11月', - 'dec': '12月', - 'sunday': '日曜日', - 'monday': '月曜日', - 'tuesday': '火曜日', - 'wednesday': '水曜日', - 'thursday': '木曜日', - 'friday': '金曜日', - 'saturday': '土曜日', - 'sun': '日', - 'mon': '月', - 'tue': '火', - 'wed': '水', - 'thu': '木', - 'fri': '金', - 'sat': '土', - 'tooltipLoading': 'ローディング中...' +var ua = { + 'january': 'Січень', + 'february': 'Лютий', + 'march': 'Березень', + 'april': 'Квітень', + 'maylong': 'Травень', + 'june': 'Червень', + 'july': 'Липень', + 'august': 'Серпень', + 'september': 'Вересень', + 'october': 'Жовтень', + 'november': 'Листопад', + 'december': 'Грудень', + 'jan': 'Січ', + 'feb': 'Лют', + 'mar': 'Бер', + 'apr': 'Кві', + 'may': 'Тра', + 'jun': 'Чер', + 'jul': 'Лип', + 'aug': 'Сер', + 'sep': 'Вер', + 'oct': 'Жов', + 'nov': 'Лис', + 'dec': 'Гру', + 'sunday': 'Неділя', + 'monday': 'Понеділок', + 'tuesday': 'Вівторок', + 'wednesday': 'Середа', + 'thursday': 'Четвер', + 'friday': 'П\'ятниця', + 'saturday': 'Субота', + 'sun': ' Нд', + 'mon': 'Пн', + 'tue': ' Вт', + 'wed': 'Ср', + 'thu': ' Чт', + 'fri': ' Пт', + 'sat': ' Сб', + 'res': 'Ресурс', + 'dur': 'Тривалість', + 'comp': '%', + 'completion': 'Виконано', + 'startdate': 'Поч. дата', + 'planstartdate': 'План Поч. дата', + 'enddate': 'Кін. дата', + 'planenddate': 'План Кін. дата', + 'cost': 'Вартість', + 'moreinfo': 'Деталі', + 'nodata': 'Нічого не знайдено', + 'notes': 'Нотатки', + 'format': 'Формат', + 'hour': 'Година', + 'day': 'День', + 'week': 'Тиждень', + 'month': 'Місяць', + 'quarter': 'Кварт', + 'hours': 'Годин', + 'days': 'Днів', + 'weeks': 'Тижнів', + 'months': 'Місяців', + 'quarters': 'Кварталів', + 'hr': 'г.', + 'dy': 'дн.', + 'wk': 'тиж.', + 'mth': 'міс.', + 'qtr': 'кв.', + 'hrs': 'г.', + 'dys': 'дн.', + 'wks': 'тиж.', + 'mths': 'міс.', + 'qtrs': 'кв.', + 'tooltipLoading': 'Загрузка...' }; -exports.ja = ja; -var cs = { - 'format': 'Zobrazení', - 'hour': 'Hodina', - 'day': 'Den', - 'week': 'Týden', - 'month': 'Měsíc', - 'quarter': 'Kvartál', - 'hours': 'Hodiny', - 'days': 'Dni', - 'weeks': 'Týdny', - 'months': 'Měsíce', - 'quarters': 'Kvartály', - 'hr': 'Ho', - 'dy': 'Den', - 'wk': 'Tyd', - 'mth': 'Měs', - 'qtr': 'Kvar', - 'hrs': 'Ho', - 'dys': 'Dni', - 'wks': 'Tyd', - 'mths': 'Měs', - 'qtrs': 'Kvar', - 'res': 'Přiřazeno', - 'dur': 'Trvání', - 'comp': '% Hotovo', - 'completion': 'Hotovo', - 'startdate': 'Start', - 'planstartdate': 'Plánovaný start', - 'enddate': 'Konec', - 'planenddate': 'Plánovaný konec', - 'cost': 'Náklady', - 'moreinfo': 'Více informací', - 'nodata': 'No tasks found', - 'notes': 'Poznámky', - 'january': 'Leden', - 'february': 'Únor', - 'march': 'Březen', - 'april': 'Duben', - 'maylong': 'Květen', - 'june': 'Červen', - 'july': 'Červenec', - 'august': 'Srpen', - 'september': 'Září', - 'october': 'Říjen', - 'november': 'Listopad', - 'december': 'Prosinec', - 'jan': 'Led', - 'feb': 'Úno', - 'mar': 'Bře', - 'apr': 'Dub', - 'may': 'Kvě', - 'jun': 'Čer', - 'jul': 'Čvc', - 'aug': 'Srp', - 'sep': 'Zář', - 'oct': 'Říj', - 'nov': 'Lis', - 'dec': 'Pro', - 'sunday': 'Neděle', - 'monday': 'Pondělí', - 'tuesday': 'Úterý', - 'wednesday': 'Středa', - 'thursday': 'Čtvrtek', - 'friday': 'Pátek', - 'saturday': 'Sobota', - 'sun': 'Ne', - 'mon': 'Po', - 'tue': 'Út', - 'wed': 'St', - 'thu': 'Čt', - 'fri': 'Pa', - 'sat': 'So', - 'tooltipLoading': 'Nahrávám...' -}; -exports.cs = cs; -var hu = { - 'format': 'Formátum', - 'hour': 'Óra', - 'day': 'Nap', - 'week': 'Hét', - 'month': 'Hónap', - 'quarter': 'Negyedév ', - 'hours': 'Órák', - 'days': 'Nap', - 'weeks': 'Hét', - 'months': 'Hónap', - 'quarters': 'Negyedév', - 'hr': 'Ó', - 'dy': 'Nap', - 'wk': 'Hét', - 'mth': 'Hó', - 'qtr': 'NÉ', - 'hrs': 'Óra', - 'dys': 'Nap', - 'wks': 'Hét', - 'mths': 'Hó', - 'qtrs': 'NÉ', - 'res': 'Erőforrás', - 'dur': 'Időtartam', - 'comp': '% Kész', - 'completion': 'Elkészült', - 'startdate': 'Kezdés', - 'planstartdate': 'Tervezett kezdés', - 'enddate': 'Befejezés', - 'planenddate': 'Tervezett befejezés', - 'cost': 'Költség', - 'moreinfo': 'További információ', - 'nodata': 'No tasks found', - 'notes': 'Jegyzetek', - 'january': 'Január', - 'february': 'Február', - 'march': 'Március', - 'april': 'Április', - 'maylong': 'Május', - 'june': 'Június', - 'july': 'Július', - 'august': 'Augusztus', - 'september': 'Szeptember', - 'october': 'Október', - 'november': 'November', - 'december': 'December', - 'jan': 'Jan', - 'feb': 'Feb', - 'mar': 'Már', - 'apr': 'Ápr', - 'may': 'Máj', - 'jun': 'Jún', - 'jul': 'Júl', - 'aug': 'Aug', - 'sep': 'Szep', - 'oct': 'Okt', - 'nov': 'Nov', - 'dec': 'Dec', - 'sunday': 'Vasárnap', - 'monday': 'Hétfő', - 'tuesday': 'Kedd', - 'wednesday': 'Szerda', - 'thursday': 'Csütörtök', - 'friday': 'Péntek', - 'saturday': 'Szombat', - 'sun': 'Vas', - 'mon': 'Hé', - 'tue': 'Ke', - 'wed': 'Sze', - 'thu': 'Csü', - 'fri': 'Pén', - 'sat': 'Szo', - 'tooltipLoading': 'Belöltés...' -}; -exports.hu = hu; -var ko = { - 'format': '구분', - 'hour': '시', - 'day': '일', - 'week': '주', - 'month': '월', - 'quarter': '분기', - 'hours': '시', - 'days': '일', - 'weeks': '주', - 'months': '월', - 'quarters': '분기', - 'hr': '시', - 'dy': '일', - 'wk': '주', - 'mth': '월', - 'qtr': '분기', - 'hrs': '시', - 'dys': '일', - 'wks': '주', - 'mths': '월', - 'qtrs': '분기', - 'res': '이름', - 'dur': '기간', - 'comp': '% ', - 'completion': '완료', - 'startdate': '시작일자', - 'planstartdate': '계획 시작일자', - 'enddate': '종료일자', - 'planenddate': '계획 종료일자', - 'cost': '비용', - 'moreinfo': '더 많은 정보', - 'nodata': 'No tasks found', - 'notes': '비고', - 'january': '1월', - 'february': '2월', - 'march': '3월', - 'april': '4월', - 'maylong': '5월', - 'june': '6월', - 'july': '7월', - 'august': '8월', - 'september': '9월', - 'october': '10월', - 'november': '11월', - 'december': '12월', - 'jan': '1', - 'feb': '2', - 'mar': '3', - 'apr': '4', - 'may': '5', - 'jun': '6', - 'jul': '7', - 'aug': '8', - 'sep': '9', - 'oct': '10', - 'nov': '11', - 'dec': '12', - 'sunday': '일요일', - 'monday': '월요일', - 'tuesday': '화요일', - 'wednesday': '수요일', - 'thursday': '목요일', - 'friday': '금요일', - 'saturday': '토요일', - 'sun': '일', - 'mon': '월', - 'tue': '화', - 'wed': '수', - 'thu': '목', - 'fri': '금', - 'sat': '토', - 'tooltipLoading': '로딩중...' -}; -exports.ko = ko; +exports.ua = ua; },{}],9:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); +exports.includeGetSet = void 0; var date_utils_1 = require("./utils/date_utils"); var draw_columns_1 = require("./draw_columns"); exports.includeGetSet = function () { @@ -2996,6 +3535,12 @@ exports.includeGetSet = function () { this.vLangs[pLang][vKey] = (pVals[vKey]) ? document.createTextNode(pVals[vKey]).data : this.vLangs['en'][vKey]; } }; + this.setCustomLang = function (pVals) { + this.vLangs[this.vLang] = new Object(); + for (var vKey in this.vLangs['en']) { + this.vLangs[this.vLang][vKey] = (pVals[vKey]) ? document.createTextNode(pVals[vKey]).data : this.vLangs['en'][vKey]; + } + }; this.setTotalHeight = function (pVal) { this.vTotalHeight = pVal; }; // EVENTS this.setEvents = function (pEvents) { this.vEvents = pEvents; }; @@ -3094,6 +3639,7 @@ var __assign = (this && this.__assign) || function () { return __assign.apply(this, arguments); }; Object.defineProperty(exports, "__esModule", { value: true }); +exports.processRows = exports.ClearTasks = exports.RemoveTaskItem = exports.AddTaskItemObject = exports.AddTaskItem = exports.createTaskInfo = exports.TaskItem = exports.TaskItemObject = exports.sortTasks = exports.taskLink = void 0; var general_utils_1 = require("./utils/general_utils"); var draw_utils_1 = require("./utils/draw_utils"); var date_utils_1 = require("./utils/date_utils"); @@ -3108,7 +3654,9 @@ exports.taskLink = function (pRef, pWidth, pHeight) { vHeight = pHeight; else vHeight = 400; - window.open(pRef, 'newwin', 'height=' + vHeight + ',width=' + vWidth); // let OpenWindow = + // @CHANGE LDR To open in same window + //window.open(pRef, 'newwin', 'height=' + vHeight + ',width=' + vWidth); // let OpenWindow = + window.location.href=pRef }; exports.sortTasks = function (pList, pID, pIdx) { if (pList.length < 2) { @@ -3146,15 +3694,16 @@ exports.TaskItemObject = function (object) { general_utils_1.internalProperties.forEach(function (property) { delete pDataObject[property]; }); - return new exports.TaskItem(object.pID, object.pName, object.pStart, object.pEnd, object.pClass, object.pLink, object.pMile, object.pRes, object.pComp, object.pGroup, object.pParent, object.pOpen, object.pDepend, object.pCaption, object.pNotes, object.pGantt, object.pCost, object.pPlanStart, object.pPlanEnd, object.pDuration, object.pBarText, object); + return new exports.TaskItem(object.pID, object.pName, object.pStart, object.pEnd, object.pClass, object.pLink, object.pMile, object.pRes, object.pComp, object.pGroup, object.pParent, object.pOpen, object.pDepend, object.pCaption, object.pNotes, object.pGantt, object.pCost, object.pPlanStart, object.pPlanEnd, object.pDuration, object.pBarText, object, object.pPlanClass); }; -exports.TaskItem = function (pID, pName, pStart, pEnd, pClass, pLink, pMile, pRes, pComp, pGroup, pParent, pOpen, pDepend, pCaption, pNotes, pGantt, pCost, pPlanStart, pPlanEnd, pDuration, pBarText, pDataObject) { +exports.TaskItem = function (pID, pName, pStart, pEnd, pClass, pLink, pMile, pRes, pComp, pGroup, pParent, pOpen, pDepend, pCaption, pNotes, pGantt, pCost, pPlanStart, pPlanEnd, pDuration, pBarText, pDataObject, pPlanClass) { if (pCost === void 0) { pCost = null; } if (pPlanStart === void 0) { pPlanStart = null; } if (pPlanEnd === void 0) { pPlanEnd = null; } if (pDuration === void 0) { pDuration = null; } if (pBarText === void 0) { pBarText = null; } if (pDataObject === void 0) { pDataObject = null; } + if (pPlanClass === void 0) { pPlanClass = null; } var vGantt = pGantt ? pGantt : this; var _id = document.createTextNode(pID).data; var vID = general_utils_1.hashKey(document.createTextNode(pID).data); @@ -3168,6 +3717,7 @@ exports.TaskItem = function (pID, pName, pStart, pEnd, pClass, pLink, pMile, pRe var vGroupMinPlanStart = null; var vGroupMinPlanEnd = null; var vClass = document.createTextNode(pClass).data; + var vPlanClass = document.createTextNode(pPlanClass).data; var vLink = document.createTextNode(pLink).data; var vMile = parseInt(document.createTextNode(pMile).data); var vRes = document.createTextNode(pRes).data; @@ -3305,6 +3855,7 @@ exports.TaskItem = function (pID, pName, pStart, pEnd, pClass, pLink, pMile, pRe return vEnd; }; this.getPlanStart = function () { return vPlanStart ? vPlanStart : vStart; }; + this.getPlanClass = function () { return vPlanClass && vPlanClass !== "null" ? vPlanClass : vClass; }; this.getPlanEnd = function () { return vPlanEnd ? vPlanEnd : vEnd; }; this.getCost = function () { return vCost; }; this.getGroupMinStart = function () { return vGroupMinStart; }; @@ -3407,11 +3958,11 @@ exports.TaskItem = function (pID, pName, pStart, pEnd, pClass, pLink, pMile, pRe vDuration = tmpPer + ' ' + ((tmpPer != 1) ? pLang['wks'] : pLang['wk']); break; case 'month': - tmpPer = Math.round(hours / 24 / 7 / 30); + tmpPer = Math.round(hours / 24 / 7 / 4.35); vDuration = tmpPer + ' ' + ((tmpPer != 1) ? pLang['mths'] : pLang['mth']); break; case 'quarter': - tmpPer = Math.round(hours / 24 / 7 / 30 / 3); + tmpPer = Math.round(hours / 24 / 7 / 13); vDuration = tmpPer + ' ' + ((tmpPer != 1) ? pLang['qtrs'] : pLang['qtr']); break; } @@ -3440,6 +3991,7 @@ exports.TaskItem = function (pID, pName, pStart, pEnd, pClass, pLink, pMile, pRe this.setName = function (pName) { vName = pName; }; this.setNotes = function (pNotes) { vNotes = pNotes; }; this.setClass = function (pClass) { vClass = pClass; }; + this.setPlanClass = function (pPlanClass) { vPlanClass = pPlanClass; }; this.setCost = function (pCost) { vCost = pCost; }; this.setResource = function (pRes) { vRes = pRes; }; this.setDuration = function (pDuration) { vDuration = pDuration; }; @@ -3546,7 +4098,8 @@ exports.TaskItem = function (pID, pName, pStart, pEnd, pClass, pLink, pMile, pRe pComp: vComp, pCost: vCost, pGroup: vGroup, - pDataObjec: vDataObject + pDataObject: vDataObject, + pPlanClass: vPlanClass }; }; }; @@ -3601,7 +4154,7 @@ exports.createTaskInfo = function (pTask, templateStrOrFn) { } if (_this.vShowTaskInfoDur == 1 && !pTask.getMile()) { vTmpDiv = draw_utils_1.newNode(vTaskInfo, 'div', null, 'gTILine gTId'); - draw_utils_1.newNode(vTmpDiv, 'span', null, 'gTaskLabel', _this.vLangs[_this.vLang]['duration'] + ': '); + draw_utils_1.newNode(vTmpDiv, 'span', null, 'gTaskLabel', _this.vLangs[_this.vLang]['dur'] + ': '); draw_utils_1.newNode(vTmpDiv, 'span', null, 'gTaskText', pTask.getDuration(_this.vFormat, _this.vLangs[_this.vLang])); } if (_this.vShowTaskInfoComp == 1) { @@ -3611,7 +4164,7 @@ exports.createTaskInfo = function (pTask, templateStrOrFn) { } if (_this.vShowTaskInfoRes == 1) { vTmpDiv = draw_utils_1.newNode(vTaskInfo, 'div', null, 'gTILine gTIr'); - draw_utils_1.newNode(vTmpDiv, 'span', null, 'gTaskLabel', _this.vLangs[_this.vLang]['resource'] + ': '); + draw_utils_1.newNode(vTmpDiv, 'span', null, 'gTaskLabel', _this.vLangs[_this.vLang]['res'] + ': '); draw_utils_1.newNode(vTmpDiv, 'span', null, 'gTaskText', pTask.getResource()); } if (_this.vShowTaskInfoLink == 1 && pTask.getLink() != '') { @@ -3815,6 +4368,7 @@ exports.processRows = function (pList, pID, pRow, pLevel, pOpen, pUseSort, vDebu },{"./utils/date_utils":11,"./utils/draw_utils":12,"./utils/general_utils":13}],11:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); +exports.getIsoWeek = exports.parseDateFormatStr = exports.formatDateStr = exports.parseDateStr = exports.coerceDate = exports.getMaxDate = exports.getMinDate = void 0; /** * DATES */ @@ -4110,6 +4664,7 @@ exports.getIsoWeek = function (pDate) { },{}],12:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); +exports.drawSelector = exports.sLine = exports.CalcTaskXY = exports.getArrayLocationByID = exports.newNode = exports.makeInput = void 0; var events_1 = require("../events"); exports.makeInput = function (formattedValue, editable, type, value, choices) { if (type === void 0) { type = 'text'; } @@ -4274,8 +4829,9 @@ exports.drawSelector = function (pPos) { },{"../events":5}],13:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); +exports.printChart = exports.calculateStartEndFromDepend = exports.makeRequestOldBrowsers = exports.makeRequest = exports.moveToolTip = exports.updateFlyingObj = exports.isParentElementOrSelf = exports.criticalPath = exports.hashKey = exports.hashString = exports.fadeToolTip = exports.hideToolTip = exports.isIE = exports.getOffset = exports.calculateCurrentDateOffset = exports.getScrollbarWidth = exports.getScrollPositions = exports.benchMark = exports.getZoomFactor = exports.delayedHide = exports.stripUnwanted = exports.stripIds = exports.changeFormat = exports.findObj = exports.internalPropertiesLang = exports.internalProperties = void 0; exports.internalProperties = ['pID', 'pName', 'pStart', 'pEnd', 'pClass', 'pLink', 'pMile', 'pRes', 'pComp', 'pGroup', 'pParent', - 'pOpen', 'pDepend', 'pCaption', 'pNotes', 'pGantt', 'pCost', 'pPlanStart', 'pPlanEnd']; + 'pOpen', 'pDepend', 'pCaption', 'pNotes', 'pGantt', 'pCost', 'pPlanStart', 'pPlanEnd', 'pPlanClass']; exports.internalPropertiesLang = { 'pID': 'id', 'pName': 'name', @@ -4283,7 +4839,8 @@ exports.internalPropertiesLang = { 'pEnd': 'enddate', 'pLink': 'link', 'pMile': 'mile', - 'pRes': 'resource', + 'pRes': 'res', + 'pDuration': 'dur', 'pComp': 'comp', 'pGroup': 'group', 'pParent': 'parent', @@ -4293,7 +4850,8 @@ exports.internalPropertiesLang = { 'pNotes': 'notes', 'pCost': 'cost', 'pPlanStart': 'planstartdate', - 'pPlanEnd': 'planenddate' + 'pPlanEnd': 'planenddate', + 'pPlanClass': 'planclass' }; exports.findObj = function (theObj, theDoc) { if (theDoc === void 0) { theDoc = null; } @@ -4567,14 +5125,16 @@ function isParentElementOrSelf(child, parent) { } exports.isParentElementOrSelf = isParentElementOrSelf; exports.updateFlyingObj = function (e, pGanttChartObj, pTimer) { + var documentElement = document.documentElement; + var bodyElement = document.getElementsByTagName('body')[0]; var vCurTopBuf = 3; var vCurLeftBuf = 5; var vCurBotBuf = 3; var vCurRightBuf = 15; var vMouseX = (e) ? e.clientX : window.event.clientX; var vMouseY = (e) ? e.clientY : window.event.clientY; - var vViewportX = document.documentElement.clientWidth || document.getElementsByTagName('body')[0].clientWidth; - var vViewportY = document.documentElement.clientHeight || document.getElementsByTagName('body')[0].clientHeight; + var vViewportX = (documentElement === null || documentElement === void 0 ? void 0 : documentElement.clientWidth) || (bodyElement === null || bodyElement === void 0 ? void 0 : bodyElement.clientWidth); + var vViewportY = (documentElement === null || documentElement === void 0 ? void 0 : documentElement.clientHeight) || (bodyElement === null || bodyElement === void 0 ? void 0 : bodyElement.clientHeight); var vNewX = vMouseX; var vNewY = vMouseY; var screenX = screen.availWidth || window.innerWidth; @@ -4583,8 +5143,8 @@ exports.updateFlyingObj = function (e, pGanttChartObj, pTimer) { var vOldY = parseInt(pGanttChartObj.vTool.style.top); if (navigator.appName.toLowerCase() == 'microsoft internet explorer') { // the clientX and clientY properties include the left and top borders of the client area - vMouseX -= document.documentElement.clientLeft; - vMouseY -= document.documentElement.clientTop; + vMouseX -= documentElement === null || documentElement === void 0 ? void 0 : documentElement.clientLeft; + vMouseY -= documentElement === null || documentElement === void 0 ? void 0 : documentElement.clientTop; var vZoomFactor = exports.getZoomFactor(); if (vZoomFactor != 1) { // IE 7 at non-default zoom level vMouseX = Math.round(vMouseX / vZoomFactor); @@ -4724,10 +5284,26 @@ exports.makeRequestOldBrowsers = function (pFile, vDebug) { }; exports.calculateStartEndFromDepend = function (tasksList) { }; +exports.printChart = function (width, height, css) { + if (css === void 0) { css = undefined; } + if (css === undefined) { + css = // Default injected CSS + "@media print {\n @page {\n size: " + width + "mm " + height + "mm;\n }\n /* set gantt container to the same width as the page */\n .gchartcontainer {\n width: " + width + "mm;\n }\n };"; + } + var $container = document.querySelector('.gchartcontainer'); + $container.insertAdjacentHTML('afterbegin', "<style>" + css + "</style>"); + // Remove the print CSS when the print dialog is closed + window.addEventListener('afterprint', function () { + $container.removeChild($container.children[0]); + }, { 'once': true }); + // Trigger the print + window.print(); +}; },{}],14:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); +exports.getXMLTask = exports.getXMLProject = exports.AddXMLTask = exports.getXMLNodeValue = exports.findXMLNode = exports.parseXMLString = exports.parseXML = void 0; var task_1 = require("./task"); var date_utils_1 = require("./utils/date_utils"); var draw_utils_1 = require("./utils/draw_utils"); @@ -4955,7 +5531,7 @@ exports.AddXMLTask = function (pGanttVar, pXmlDoc) { if (vSubCreated) pDepend = ''; // Finally add the task - pGanttVar.AddTaskItem(new task_1.TaskItem(pID, pName, pStart, pEnd, pClass, pLink, pMile, pRes, pComp, pGroup, pParent, pOpen, pDepend, pCaption, pNotes, pGanttVar, pCost, pPlanStart, pPlanEnd, pDuration)); + pGanttVar.AddTaskItem(new task_1.TaskItem(pID, pName, pStart, pEnd, pClass, pLink, pMile, pRes, pComp, pGroup, pParent, pOpen, pDepend, pCaption, pNotes, pGanttVar, pCost, pPlanStart, pPlanEnd, pDuration, undefined, undefined, pClass)); } } } @@ -4985,6 +5561,7 @@ exports.AddXMLTask = function (pGanttVar, pXmlDoc) { var pCaption = exports.getXMLNodeValue(Task[i], 'pCaption', 2, ''); var pNotes = exports.getXMLNodeValue(Task[i], 'pNotes', 2, ''); var pClass = exports.getXMLNodeValue(Task[i], 'pClass', 2, ''); + var pPlanClass = exports.getXMLNodeValue(Task[i], 'pPlanClass', 2, ''); if (typeof pClass == 'undefined') { if (pGroup > 0) pClass = 'ggroupblack'; @@ -4993,8 +5570,10 @@ exports.AddXMLTask = function (pGanttVar, pXmlDoc) { else pClass = 'gtaskblue'; } + if (typeof pPlanClass == 'undefined') + pPlanClass = pClass; // Finally add the task - pGanttVar.AddTaskItem(new task_1.TaskItem(pID, pName, pStart, pEnd, pClass, pLink, pMile, pRes, pComp, pGroup, pParent, pOpen, pDepend, pCaption, pNotes, pGanttVar, pCost, pPlanStart, pPlanEnd, pDuration)); + pGanttVar.AddTaskItem(new task_1.TaskItem(pID, pName, pStart, pEnd, pClass, pLink, pMile, pRes, pComp, pGroup, pParent, pOpen, pDepend, pCaption, pNotes, pGanttVar, pCost, pPlanStart, pPlanEnd, pDuration, undefined, undefined, pPlanClass)); } } } @@ -5055,10 +5634,11 @@ exports.getXMLTask = function (pID, pIdx) { var vTmpFrag = document.createDocumentFragment(); var vTmpDiv = draw_utils_1.newNode(vTmpFrag, 'div', null, null, this.vTaskList[vIdx].getNotes().innerHTML); vTask += '<pNotes>' + vTmpDiv.innerHTML + '</pNotes>'; + vTask += '<pPlanClass>' + this.vTaskList[vIdx].getPlanClass() + '</pPlanClass>'; vTask += '</task>'; } return vTask; }; },{"./task":10,"./utils/date_utils":11,"./utils/draw_utils":12,"./utils/general_utils":13}]},{},[1])(1) -}); \ No newline at end of file +}); diff --git a/htdocs/projet/ganttchart.inc.php b/htdocs/projet/ganttchart.inc.php index 40d6bc3ebdf..bc55ffd671c 100644 --- a/htdocs/projet/ganttchart.inc.php +++ b/htdocs/projet/ganttchart.inc.php @@ -204,7 +204,7 @@ function constructGanttLine($tarr, $task, $task_dependencies, $level = 0, $proje //$parent = $task["task_parent"]; } // Define percent - $percent = $task['task_percent_complete'] ? $task['task_percent_complete'] : 0; + $percent = empty($task['task_percent_complete']) ? 0 : $task['task_percent_complete']; // Link (more information) if ($task["task_id"] < 0) { //$link=DOL_URL_ROOT.'/projet/tasks.php?withproject=1&id='.abs($task["task_id"]); @@ -264,9 +264,9 @@ function constructGanttLine($tarr, $task, $task_dependencies, $level = 0, $proje $taskid = $task["task_alternate_id"]; //$taskid = $task['task_id']; - $note = $task['note']; + $note = empty($task['note']) ? '' : $task['note']; - $note = dol_concatdesc($note, $langs->trans("Workload").' : '.($task['task_planned_workload'] ? convertSecondToTime($task['task_planned_workload'], 'allhourmin') : '')); + $note = dol_concatdesc($note, $langs->trans("Workload").' : '.(empty($task['task_planned_workload']) ? '' : convertSecondToTime($task['task_planned_workload'], 'allhourmin'))); $s .= "g.AddTaskItem(new JSGantt.TaskItem('".$taskid."', '".dol_escape_js(trim($name))."', '".$start_date."', '".$end_date."', '".$css."', '".$link."', ".$task['task_milestone'].", '".dol_escape_js($resources)."', ".($percent >= 0 ? $percent : 0).", ".$line_is_auto_group.", '".$parent."', 1, '".$dependency."', '".(empty($task["task_is_group"]) ? (($percent >= 0 && $percent != '') ? $percent.'%' : '') : '')."', '".dol_escape_js($note)."', g));"; echo $s; diff --git a/htdocs/projet/ganttview.php b/htdocs/projet/ganttview.php index 1ea9da66f38..b88e9a899f7 100644 --- a/htdocs/projet/ganttview.php +++ b/htdocs/projet/ganttview.php @@ -356,7 +356,7 @@ if (count($tasksarray) > 0) { //if ($s) $tasks[$taskcursor]['task_resources']=implode(',',$idofusers); $tasks[$taskcursor]['task_resources'] = $s; if ($s) { - $tasks[$taskcursor]['task_resources'] = '<a href="'.DOL_URL_ROOT.'/projet/tasks/contact.php?id='.$val->id.'&withproject=1" title="'.dol_escape_htmltag($s).'">'.$langs->trans("List").'</a>'; + $tasks[$taskcursor]['task_resources'] = '<a href="'.DOL_URL_ROOT.'/projet/tasks/contact.php?id='.$val->id.'&withproject=1" title="'.dol_escape_htmltag($s).'">'.$langs->trans("Contacts").'</a>'; } //print "xxx".$val->id.$tasks[$taskcursor]['task_resources']; $tasks[$taskcursor]['note'] = $task->note_public; diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php index f8cc28e05a2..015c70a72e2 100644 --- a/htdocs/projet/tasks/contact.php +++ b/htdocs/projet/tasks/contact.php @@ -413,7 +413,7 @@ if ($id > 0 || !empty($ref)) { print '<td>'; $formcompany->selectTypeContact($object, '', 'type', 'internal', 'position'); print '</td>'; - print '<td class="right" colspan="3" ><input type="submit" class="button button-add" value="'.$langs->trans("Add").'" name="addsourceinternal"></td>'; + print '<td class="right" colspan="3" ><input type="submit" class="button button-add small" value="'.$langs->trans("Add").'" name="addsourceinternal"></td>'; print '</tr>'; // Line to add an external contact. Only if project linked to a third party. @@ -438,7 +438,7 @@ if ($id > 0 || !empty($ref)) { print '<td>'; $formcompany->selectTypeContact($object, '', 'typecontact', 'external', 'position'); print '</td>'; - print '<td class="right" colspan="3" ><input type="submit" class="button" id="add-customer-contact" name="addsourceexternal" value="'.$langs->trans("Add").'"'; + print '<td class="right" colspan="3" ><input type="submit" class="button button-add small" id="add-customer-contact" name="addsourceexternal" value="'.$langs->trans("Add").'"'; if (!$nbofcontacts) { print ' disabled'; } diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index ee97261191a..5af126ea5fd 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -6081,7 +6081,7 @@ td.gminorheading { }*/ .gtaskname div, .gtaskname { min-width: 250px !important; - max-width: unset !important; + max-width: 500px !important; width: unset !important; } .gpccomplete div, .gpccomplete { From 84ae24740a2f7aea228809b49524aeeffa627177 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Sat, 23 Mar 2024 17:22:22 +0100 Subject: [PATCH 164/178] Fix warning --- htdocs/accountancy/admin/subaccount.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/admin/subaccount.php b/htdocs/accountancy/admin/subaccount.php index 8c9a493a258..5e30c3d0a50 100644 --- a/htdocs/accountancy/admin/subaccount.php +++ b/htdocs/accountancy/admin/subaccount.php @@ -44,7 +44,7 @@ $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'ac $search_subaccount = GETPOST('search_subaccount', 'alpha'); $search_label = GETPOST('search_label', 'alpha'); -$search_type = GETPOSTINT('search_type'); +$search_type = GETPOST('search_type', 'intcomma'); // Security check if ($user->socid > 0) { From 73fea610d1c7fbe57eca2deec767f25a8e17c135 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Sat, 23 Mar 2024 17:27:40 +0100 Subject: [PATCH 165/178] Fix regression --- htdocs/user/bank.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php index 44577d24e8a..0fa0d805d28 100644 --- a/htdocs/user/bank.php +++ b/htdocs/user/bank.php @@ -495,7 +495,7 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac } // Personal email - if ($user->hasRight('hrm', 'read_personal_information', 'read') || $user->hasRight('hrm', 'write_personal_information', 'write') || ) { + if ($user->hasRight('hrm', 'read_personal_information', 'read') || $user->hasRight('hrm', 'write_personal_information', 'write') || $permissiontosimpleedit) { print '<tr class="nowrap">'; print '<td>'; print $form->editfieldkey("UserPersonalEmail", 'personal_email', $object->personal_email, $object, $user->hasRight('user', 'user', 'creer') || $user->hasRight('hrm', 'write_personal_information', 'write')); @@ -506,7 +506,7 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac } // Personal phone - if ($user->hasRight('hrm', 'read_personal_information', 'read') || $user->hasRight('hrm', 'write_personal_information', 'write') || ) { + if ($user->hasRight('hrm', 'read_personal_information', 'read') || $user->hasRight('hrm', 'write_personal_information', 'write') || $permissiontosimpleedit) { print '<tr class="nowrap">'; print '<td>'; print $form->editfieldkey("UserPersonalMobile", 'personal_mobile', $object->personal_mobile, $object, $user->hasRight('user', 'user', 'creer') || $user->hasRight('hrm', 'write_personal_information', 'write')); From d297dfe60e9534f49d627d46d43c1ad7f3f60b1f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Sat, 23 Mar 2024 17:32:09 +0100 Subject: [PATCH 166/178] Fix warning --- htdocs/core/lib/functions.lib.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index d150e866f02..3403a95d269 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -7648,7 +7648,11 @@ function dol_string_onlythesehtmlattributes($stringtoclean, $allowed_attributes // Warning: loadHTML does not support HTML5 on old libxml versions. $dom = new DOMDocument('', 'UTF-8'); + // If $stringtoclean is wrong, it will generates warnings. So we disable warnings and restore them later. + $savwarning = error_reporting(); + error_reporting(E_ALL & ~E_WARNING & ~E_NOTICE); $dom->loadHTML($stringtoclean, LIBXML_ERR_NONE | LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD | LIBXML_NONET | LIBXML_NOWARNING | LIBXML_NOXMLDECL); + error_reporting($savwarning); if ($dom instanceof DOMDocument) { for ($els = $dom->getElementsByTagname('*'), $i = $els->length - 1; $i >= 0; $i--) { From 8d1e21150021dc0ee48f93c984dc3086ceed8e68 Mon Sep 17 00:00:00 2001 From: MDW <mdeweerd@users.noreply.github.com> Date: Sat, 23 Mar 2024 16:50:34 +0100 Subject: [PATCH 167/178] Fix access to db results (fix PhanNonClassMethodCall) Fixed the access to db results - may need to be backported --- htdocs/accountancy/bookkeeping/balance.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index 0b5b0005694..697962ef486 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -473,9 +473,12 @@ if ($action != 'export_csv') { $resql = $db->query($sql); $nrows = $resql->num_rows; $opening_balances = array(); - for ($i = 0; $i < $nrows; $i++) { - $arr = $resql->fetch_array(); - $opening_balances["'" . $arr['numero_compte'] . "'"] = $arr['opening_balance']; + if ($resql) { + $nrows = $db->num_rows($resql); + for ($i = 0; $i < $nrows; $i++) { + $arr = $db->fetch_array($resql); + $opening_balances["'" . $arr['numero_compte'] . "'"] = $arr['opening_balance']; + } } } From ce274c403efc0459cabcea891cfa5e7dad649467 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Sat, 23 Mar 2024 19:06:54 +0100 Subject: [PATCH 168/178] Depreciate a method usage --- htdocs/core/db/Database.interface.php | 25 +++++++++++++------------ htdocs/core/db/mysqli.class.php | 1 - 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/htdocs/core/db/Database.interface.php b/htdocs/core/db/Database.interface.php index 9613688e753..1cedec5b34f 100644 --- a/htdocs/core/db/Database.interface.php +++ b/htdocs/core/db/Database.interface.php @@ -40,8 +40,9 @@ interface Database /** * Return datas as an array * - * @param resource $resultset Resultset of request - * @return array Array + * @param resource $resultset Resultset of request + * @return array Array + * @deprecated Use fetch_object() so you can access a field with its name instead of using an index of position of field. */ public function fetch_row($resultset); // phpcs:enable @@ -441,6 +442,16 @@ interface Database ); // phpcs:enable + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * List information of columns into a table. + * + * @param string $table Name of table + * @return array Array with information on table + */ + public function DDLInfoTable($table); + // phpcs:enable + /** * Convert (by PHP) a PHP server TZ string date into a Timestamps date (GMT if gm=true) * 19700101020000 -> 3600 with TZ+1 and gmt=0 @@ -470,16 +481,6 @@ interface Database */ public function commit($log = ''); - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * List information of columns into a table. - * - * @param string $table Name of table - * @return array Array with information on table - */ - public function DDLInfoTable($table); - // phpcs:enable - /** * Free last resultset used. * diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 7fc92bf23ff..485477d052d 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -481,7 +481,6 @@ class DoliDBMysqli extends DoliDB return $this->db->affected_rows; } - /** * Libere le dernier resultset utilise sur cette connection * From 27ad9573f64a57a85a8eeea579d238f3670f41c7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Sat, 23 Mar 2024 19:32:08 +0100 Subject: [PATCH 169/178] Debug v20 --- htdocs/blockedlog/admin/blockedlog_list.php | 2 +- htdocs/compta/accounting-files.php | 6 +++--- htdocs/theme/eldy/global.inc.php | 3 +++ htdocs/theme/md/style.css.php | 3 +++ 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/htdocs/blockedlog/admin/blockedlog_list.php b/htdocs/blockedlog/admin/blockedlog_list.php index fb8f92d9e12..2604e35f362 100644 --- a/htdocs/blockedlog/admin/blockedlog_list.php +++ b/htdocs/blockedlog/admin/blockedlog_list.php @@ -379,7 +379,7 @@ if (GETPOST('withtab', 'alpha')) { // Add $param from extra fields //include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; -print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'; +print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'?output=file">'; print '<input type="hidden" name="token" value="'.newToken().'">'; print '<div class="right">'; diff --git a/htdocs/compta/accounting-files.php b/htdocs/compta/accounting-files.php index 05351d41713..36b12bf6b36 100644 --- a/htdocs/compta/accounting-files.php +++ b/htdocs/compta/accounting-files.php @@ -72,7 +72,7 @@ $date_stopMonth = GETPOSTINT('date_stopmonth'); $date_stopYear = GETPOSTINT('date_stopyear'); $date_stop = dol_mktime(23, 59, 59, $date_stopMonth, $date_stopDay, $date_stopYear, 'tzuserrel'); $action = GETPOST('action', 'aZ09'); -$projectid = (GETPOSTINT('projectid') ? GETPOSTINT('projectid') : 0); +$projectid = GETPOSTINT('projectid'); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('comptafileslist', 'globallist')); @@ -667,7 +667,7 @@ foreach ($listofchoices as $choice => $val) { $disabled = ' disabled'; } $checked = (((!GETPOSTISSET('search') && $action != 'searchfiles') || GETPOST($choice)) ? ' checked="checked"' : ''); - print '<div class="'.($i > 0 ? 'paddingleft marginleftonly' : '').' inline-block marginrightonly paddingright"><input type="checkbox" id="'.$choice.'" name="'.$choice.'" value="1"'.$checked.$disabled.'><label for="'.$choice.'"> '; + print '<div class="inline-block marginrightonlylarge paddingright margintoponly"><input type="checkbox" id="'.$choice.'" name="'.$choice.'" value="1"'.$checked.$disabled.'><label for="'.$choice.'"> '; print img_picto($langs->trans($val['label']), $val['picto'], 'class=""').' '.$langs->trans($val['label']); print '</label></div>'; $i++; @@ -701,7 +701,7 @@ if (!empty($date_start) && !empty($date_stop)) { echo dol_print_date($date_start, 'day', 'tzuserrel')." - ".dol_print_date($date_stop, 'day', 'tzuserrel'); - print '<a class="marginleftonly small'.(empty($TData) ? ' butActionRefused' : ' butAction').'" href="'.$_SERVER["PHP_SELF"].'?action=dl&token='.currentToken().'&projectid='.$projectid.'&output=file&file='.urlencode($filename).$param.'"'; + print '<a class="marginleftonly small'.(empty($TData) ? ' butActionRefused' : ' butAction').'" href="'.$_SERVER["PHP_SELF"].'?action=dl&token='.currentToken().'&projectid='.((int) $projectid).'&output=file&file='.urlencode($filename).$param.'"'; if (empty($TData)) { print " disabled"; } diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 5af126ea5fd..9bfbc510ec2 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1346,6 +1346,9 @@ select.flat.selectlimit { .marginrightonlyshort { margin-<?php echo $right; ?>: 4px !important; } +.marginrightonlylarge { + margin-<?php echo $right; ?>: 20px !important; +} .margintoponly { margin-top: 10px !important; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index d569b99b6b3..df8118f4cbf 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1572,6 +1572,9 @@ select.flat.selectlimit { .marginrightonlyshort { margin-<?php echo $right; ?>: 4px !important; } +.marginrightonlylarge { + margin-<?php echo $right; ?>: 20px !important; +} .margintoponly { margin-top: 10px !important; } From 3b17fceadbbaa40bb4991790f0c81551cd1c34b7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Sat, 23 Mar 2024 19:38:35 +0100 Subject: [PATCH 170/178] Update modMyModule.class.php --- .../modulebuilder/template/core/modules/modMyModule.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php index 4e552c0275b..c288ca7f3d9 100644 --- a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php +++ b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php @@ -150,7 +150,7 @@ class modMyModule extends DolibarrModules // Prerequisites $this->phpmin = array(7, 1); // Minimum version of PHP required by module - $this->need_dolibarr_version = array(17, -3); // Minimum version of Dolibarr required by module + $this->need_dolibarr_version = array(19, -3); // Minimum version of Dolibarr required by module $this->need_javascript_ajax = 0; // Messages at activation From 4e483e4010d86b85bcea27aa89ee040bb54c7811 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Sat, 23 Mar 2024 19:39:47 +0100 Subject: [PATCH 171/178] Update filefunc.inc.php --- htdocs/filefunc.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index b6b2e7565e7..0eee6208397 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -143,7 +143,7 @@ $result = @include_once $conffile; // Keep @ because with some error reporting m $listofwrappers = stream_get_wrappers(); // We need '.phar' for geoip2. TODO Replace phar in geoip with exploded files so we can disable phar by default. // phar stream does not auto unserialize content (possible code execution) since PHP 8.1 -// zip stream is necessary in import module +// zip stream is necessary by excel import module $arrayofstreamtodisable = array('compress.zlib', 'compress.bzip2', 'ftp', 'ftps', 'glob', 'data', 'expect', 'ogg', 'rar', 'zlib'); if (!empty($dolibarr_main_stream_to_disable) && is_array($dolibarr_main_stream_to_disable)) { $arrayofstreamtodisable = $dolibarr_main_stream_to_disable; From 401d32cad54a1f139d2d3f17a1b9f42583ed381a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Sat, 23 Mar 2024 19:39:47 +0100 Subject: [PATCH 172/178] Update filefunc.inc.php --- htdocs/filefunc.inc.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index 4c4df29af50..d5f972b64f8 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -82,7 +82,8 @@ $result = @include_once $conffile; // Keep @ because with some error reporting t $listofwrappers = stream_get_wrappers(); // We need '.phar' for geoip2. TODO Replace phar in geoip with exploded files so we can disable phar by default. // phar stream does not auto unserialize content (possible code execution) since PHP 8.1 -$arrayofstreamtodisable = array('compress.zlib', 'compress.bzip2', 'ftp', 'ftps', 'glob', 'data', 'expect', 'ogg', 'rar', 'zip', 'zlib'); +// zip stream is necessary by excel import module +$arrayofstreamtodisable = array('compress.zlib', 'compress.bzip2', 'ftp', 'ftps', 'glob', 'data', 'expect', 'ogg', 'rar', 'zlib'); if (!empty($dolibarr_main_stream_to_disable) && is_array($dolibarr_main_stream_to_disable)) { $arrayofstreamtodisable = $dolibarr_main_stream_to_disable; } From 9bb7b88aac813eda1946c94f7e6f332f30205645 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Sat, 23 Mar 2024 20:38:59 +0100 Subject: [PATCH 173/178] Fix doc --- htdocs/cron/class/cronjob.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index be7f3f98f8b..266909fe17b 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -119,7 +119,7 @@ class Cronjob extends CommonObject public $lastoutput; /** - * @var string Unit frequency of job execution + * @var int Unit frequency of job execution (60, 86400, ...) */ public $unitfrequency; From b3358312d342d71df46fb3b505cd089fbc1b5621 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Sat, 23 Mar 2024 20:44:20 +0100 Subject: [PATCH 174/178] Fix bad use of array --- htdocs/website/class/website.class.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php index e8d198f61b3..a0820fdd808 100644 --- a/htdocs/website/class/website.class.php +++ b/htdocs/website/class/website.class.php @@ -1085,16 +1085,18 @@ class Website extends CommonObject $allaliases = $objectpageold->pageurl; $allaliases .= ($objectpageold->aliasalt ? ','.$objectpageold->aliasalt : ''); - if (!getDolGlobalInt('WEBSITE_EXPORT_KEEP_FILES_OF_PAGES')) { // We don't need to keep the PHP files of pages and aliases (they are regenerated at import) so we remove them. You can ask to keep them in the export + if (!getDolGlobalInt('WEBSITE_EXPORT_KEEP_FILES_OF_PAGES')) { + // We don't need to keep the PHP files of pages and aliases (they are regenerated at import) so we remove them. // Delete the pageX.tpl.php page dol_delete_file($conf->website->dir_temp.'/'.$website->ref.'/containers/page'.$objectpageold->id.'.tpl.php', 0, 0, 0, null, false, 0); // Delete the alias page dol_delete_file($conf->website->dir_temp.'/'.$website->ref.'/containers/'.$objectpageold->pageurl.'.php', 0, 0, 0, null, false, 0); dol_delete_file($conf->website->dir_temp.'/'.$website->ref.'/containers/*/'.$objectpageold->pageurl.'.php', 0, 0, 0, null, false, 0); // Delete alternative alias pages - foreach ($objectpageold->aliasalt as $tmpaliasalt) { - dol_delete_file($conf->website->dir_temp.'/'.$website->ref.'/containers/'.$tmpaliasalt.'.php', 0, 0, 0, null, false, 0); - dol_delete_file($conf->website->dir_temp.'/'.$website->ref.'/containers/*/'.$tmpaliasalt.'.php', 0, 0, 0, null, false, 0); + $arrayofaliases = explode(',', $objectpageold->aliasalt); + foreach ($arrayofaliases as $tmpaliasalt) { + dol_delete_file($conf->website->dir_temp.'/'.$website->ref.'/containers/'.trim($tmpaliasalt).'.php', 0, 0, 0, null, false, 0); + dol_delete_file($conf->website->dir_temp.'/'.$website->ref.'/containers/*/'.trim($tmpaliasalt).'.php', 0, 0, 0, null, false, 0); } } From fbc1890dfc32498a2ab5767f8f89dd0745eeb2da Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Sun, 24 Mar 2024 00:38:08 +0100 Subject: [PATCH 175/178] Remove deprecate. Seems not possible to depreciate a new function without adding comment on each call. --- htdocs/core/db/Database.interface.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/db/Database.interface.php b/htdocs/core/db/Database.interface.php index 1cedec5b34f..1c9c7a5a05f 100644 --- a/htdocs/core/db/Database.interface.php +++ b/htdocs/core/db/Database.interface.php @@ -39,10 +39,10 @@ interface Database // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return datas as an array + * @TODO deprecate this. Use fetch_object() so you can access a field with its name instead of using an index of position of field. * * @param resource $resultset Resultset of request * @return array Array - * @deprecated Use fetch_object() so you can access a field with its name instead of using an index of position of field. */ public function fetch_row($resultset); // phpcs:enable From 53eb79154a767df2893758df57b3c802561327d3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Sun, 24 Mar 2024 00:51:16 +0100 Subject: [PATCH 176/178] Fix warning on unitfrequency type --- htdocs/cron/class/cronjob.class.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index 0a625ab392c..66cafdf2205 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -117,7 +117,7 @@ class Cronjob extends CommonObject public $lastoutput; /** - * @var int Unit frequency of job execution (60, 86400, ...) + * @var string Unit frequency of job execution ('60', '86400', 'd', 'm', ...) */ public $unitfrequency; @@ -957,7 +957,7 @@ class Cronjob extends CommonObject $this->id = 0; $this->ref = ''; $this->entity = 0; - $this->tms = dol_now(); + $this->date_modification = dol_now(); $this->datec = ''; $this->label = ''; $this->jobtype = ''; @@ -976,7 +976,7 @@ class Cronjob extends CommonObject $this->datelastresult = ''; $this->lastoutput = ''; $this->lastresult = ''; - $this->unitfrequency = ''; + $this->unitfrequency = '86400'; $this->frequency = 0; $this->status = 0; $this->processing = 0; @@ -1473,27 +1473,27 @@ class Cronjob extends CommonObject if (empty($this->datenextrun)) { if (empty($this->datestart)) { - if ($this->unitfrequency == 2678400) { + if (!is_numeric($this->frequency) || (int) $this->unitfrequency == 2678400) { $this->datenextrun = dol_time_plus_duree($now, $this->frequency, 'm'); } else { - $this->datenextrun = $now + ($this->frequency * $this->unitfrequency); + $this->datenextrun = $now + ($this->frequency * (int) $this->unitfrequency); } } else { - if ($this->unitfrequency == 2678400) { + if (!is_numeric($this->frequency) || (int) $this->unitfrequency == 2678400) { $this->datenextrun = dol_time_plus_duree($this->datestart, $this->frequency, 'm'); } else { - $this->datenextrun = $this->datestart + ($this->frequency * $this->unitfrequency); + $this->datenextrun = $this->datestart + ($this->frequency * (int) $this->unitfrequency); } } } - if ($this->datenextrun < $now && $this->frequency > 0 && $this->unitfrequency > 0) { + if ($this->datenextrun < $now && $this->frequency > 0 && !empty($this->unitfrequency)) { // Loop until date is after future while ($this->datenextrun < $now) { - if ($this->unitfrequency == 2678400) { + if (!is_numeric($this->unitfrequency) || (int) $this->unitfrequency == 2678400 || (int) $this->unitfrequency <= 0) { $this->datenextrun = dol_time_plus_duree($this->datenextrun, $this->frequency, 'm'); } else { - $this->datenextrun += ($this->frequency * $this->unitfrequency); + $this->datenextrun += ($this->frequency * (int) $this->unitfrequency); } } } else { From d9488770ae88c5a10ac010ed6d3f735b08def229 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Sun, 24 Mar 2024 01:45:31 +0100 Subject: [PATCH 177/178] GETPOST(..., 'alpha') does not accept \ char anymore. Replaced with / --- htdocs/admin/dict.php | 4 ++-- htdocs/core/lib/functions.lib.php | 28 +++++++++++++++++----------- test/phpunit/SecurityTest.php | 4 ++-- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index da9b0271b15..b75e50e7a01 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -984,7 +984,7 @@ if (empty($reshook)) { } $i = 0; foreach ($listfieldmodify as $field) { - $keycode = $listfieldvalue[$i]; + $keycode = empty($listfieldvalue[$i]) ? '' : $listfieldvalue[$i]; if (empty($keycode)) { $keycode = $field; } @@ -1001,7 +1001,7 @@ if (empty($reshook)) { $sql .= ","; } $sql .= $field."="; - if ($listfieldvalue[$i] == 'sortorder') { // For column name 'sortorder', we use the field name 'position' + if ($keycode == 'sortorder') { // For column name 'sortorder', we use the field name 'position' $sql .= GETPOSTINT('position'); } elseif (GETPOST($keycode) == '' && !($keycode == 'code' && $id == 10)) { $sql .= "null"; // For vat, we want/accept code = '' diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 3403a95d269..3e7bebd4238 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -671,7 +671,7 @@ function GETPOSTISARRAY($paramname, $method = 0) * 'array', 'array:restricthtml' or 'array:aZ09' to check it's an array * 'int'=check it's numeric (integer or float) * 'intcomma'=check it's integer+comma ('1,2,3,4...') - * 'alpha'=Same than alphanohtml since v13 + * 'alpha'=Same than alphanohtml * 'alphawithlgt'=alpha with lgt * 'alphanohtml'=check there is no html content and no " and no ../ * 'aZ'=check it's a-z only @@ -1115,11 +1115,15 @@ function sanitizeVal($out = '', $check = 'alphanohtml', $filter = null, $options $oldstringtoclean = $out; // Remove html tags $out = dol_string_nohtmltag($out, 0); + // Convert '\' used for windows path into '/' so we can use for path but not for octal syntax \999, hexa syntax \x999 and unicode syntax \u{999} + $out = str_ireplace('\\', '/', $out); // Remove also other dangerous string sequences - // '"' is dangerous because param in url can close the href= or src= and add javascript functions. // '../' or '..\' is dangerous because it allows dir transversals - // Note &, '&', '&'... is a simple char like '&' alone but there is no reason to accept such way to encode input data. - $out = str_ireplace(array('&', '&', '&', '"', '"', '"', '"', '"', '/', '/', '\', '\', '/', '../', '..\\'), '', $out); + // '&', '&', '&'... is a the char '&' alone but there is no reason to accept such way to encode input char + // '"' = '"' = '"' = '"' is dangerous because param in url can close the href= or src= and add javascript functions. + // '/', '/', '/' is the char '/' but there is no reason to accept such way to encode this input char + // '\' = '\' = '\' is the char '\' but there is no reason to accept such way to encode this input char + $out = str_ireplace(array('../', '..\\', '&', '&', '&', '"', '"', '"', '"', '"', '/', '/', '/', '\', '\', '\'), '', $out); } while ($oldstringtoclean != $out); // keep lines feed } @@ -1129,12 +1133,17 @@ function sanitizeVal($out = '', $check = 'alphanohtml', $filter = null, $options $out = trim($out); do { $oldstringtoclean = $out; - // Remove html tags + // Decode html entities $out = dol_html_entity_decode($out, ENT_COMPAT | ENT_HTML5, 'UTF-8'); - // '"' is dangerous because param in url can close the href= or src= and add javascript functions. + // Convert '\' used for windows path into '/' so we can use for path but not for octal syntax \999, hexa syntax \x999 and unicode syntax \u{999} + $out = str_ireplace('\\', '/', $out); + // Remove also other dangerous string sequences // '../' or '..\' is dangerous because it allows dir transversals - // Note &, '&', '&'... is a simple char like '&' alone but there is no reason to accept such way to encode input data. - $out = str_ireplace(array('&', '&', '&', '"', '"', '"', '"', '"', '/', '/', '\', '\', '/', '../', '..\\'), '', $out); + // '&', '&', '&'... is a the char '&' alone but there is no reason to accept such way to encode input char + // '"' = '"' = '"' = '"' is dangerous because param in url can close the href= or src= and add javascript functions. + // '/', '/', '/' is the char '/' but there is no reason to accept such way to encode this input char + // '\' = '\' = '\' is the char '\' but there is no reason to accept such way to encode this input char + $out = str_ireplace(array('../', '..\\', '&', '&', '&', '"', '"', '"', '"', '"', '/', '/', '/', '\', '\', '\'), '', $out); } while ($oldstringtoclean != $out); } break; @@ -1152,9 +1161,6 @@ function sanitizeVal($out = '', $check = 'alphanohtml', $filter = null, $options if (empty($filter)) { return 'BadParameterForGETPOST - Param 3 of sanitizeVal()'; } - /*if (empty($options)) { - return 'BadParameterForGETPOST - Param 4 of sanitizeVal()'; - }*/ if (is_null($options)) { $options = 0; } diff --git a/test/phpunit/SecurityTest.php b/test/phpunit/SecurityTest.php index 5ff98738cd2..d558bc4ac97 100644 --- a/test/phpunit/SecurityTest.php +++ b/test/phpunit/SecurityTest.php @@ -358,11 +358,11 @@ class SecurityTest extends CommonClassTest $result = GETPOST("param2", 'alpha'); print __METHOD__." result=".$result."\n"; - $this->assertEquals($result, $_GET["param2"], 'Test on param2'); + $this->assertEquals($result, 'a/b#e(pr)qq-rr/cc', 'Test on param2'); $result = GETPOST("param3", 'alpha'); // Must return string sanitized from char " print __METHOD__." result=".$result."\n"; - $this->assertEquals($result, 'na/b#e(pr)qq-rr\cc', 'Test on param3'); + $this->assertEquals($result, 'na/b#e(pr)qq-rr/cc', 'Test on param3'); $result = GETPOST("param4a", 'alpha'); // Must return string sanitized from ../ print __METHOD__." result=".$result."\n"; From 6d8f946979f0743bd299c31437814d7c22b00b43 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Sun, 24 Mar 2024 02:03:34 +0100 Subject: [PATCH 178/178] Debug v20 --- htdocs/core/lib/functions.lib.php | 4 ++-- htdocs/core/tpl/admin_extrafields_add.tpl.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 3e7bebd4238..7945d96603f 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -9895,9 +9895,9 @@ function dol_eval($s, $returnvalue = 1, $hideerrors = 1, $onlysimplestring = '1' } if (preg_match('/[^a-z0-9\s'.preg_quote($specialcharsallowed, '/').']/i', $s)) { if ($returnvalue) { - return 'Bad string syntax to evaluate (found chars that are not chars for simplestring): '.$s; + return 'Bad string syntax to evaluate (found chars that are not chars for a simple clean eval string): '.$s; } else { - dol_syslog('Bad string syntax to evaluate (found chars that are not chars for simplestring): '.$s); + dol_syslog('Bad string syntax to evaluate (found chars that are not chars for a simple clean eval string): '.$s); return ''; } } diff --git a/htdocs/core/tpl/admin_extrafields_add.tpl.php b/htdocs/core/tpl/admin_extrafields_add.tpl.php index b7f59dddddd..9594dd362a3 100644 --- a/htdocs/core/tpl/admin_extrafields_add.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_add.tpl.php @@ -213,10 +213,10 @@ print $formadmin->selectTypeOfFields('type', GETPOST('type', 'alpha')); <tr class="extra_alwayseditable"><td><?php echo $form->textwithpicto($langs->trans("AlwaysEditable"), $langs->trans("EditableWhenDraftOnly")); ?></td><td class="valeur"><input id="alwayseditable" type="checkbox" name="alwayseditable"<?php echo((GETPOST('alwayseditable', 'alpha') || !GETPOST('button', 'alpha')) ? ' checked' : ''); ?>></td></tr> <!-- Visibility --> <tr><td class="extra_list"><?php echo $form->textwithpicto($langs->trans("Visibility"), $langs->trans("VisibleDesc").'<br><br>'.$langs->trans("ItCanBeAnExpression")); ?> -</td><td class="valeur"><input id="list" class="minwidth100" type="text" name="list" value="<?php echo GETPOSTINT('list') != '' ? GETPOSTINT('list') : '1'; ?>"></td></tr> +</td><td class="valeur"><input id="list" class="minwidth100" type="text" name="list" value="<?php echo GETPOSTISSET('list') ? GETPOSTINT('list') : '1'; ?>"></td></tr> <!-- Visibility for PDF--> <tr><td class="extra_pdf"><?php echo $form->textwithpicto($langs->trans("DisplayOnPdf"), $langs->trans("DisplayOnPdfDesc")); ?> -</td><td class="valeur"><input id="printable" class="minwidth100" type="text" name="printable" value="<?php echo dol_escape_htmltag(GETPOSTINT('printable')); ?>"></td></tr> +</td><td class="valeur"><input id="printable" class="minwidth100" type="text" name="printable" value="<?php echo dol_escape_htmltag(GETPOSTISSET('printable') ? GETPOST('printable') : '1'); ?>"></td></tr> <!-- Totalizable --> <tr class="extra_totalizable"><td><?php echo $langs->trans("Totalizable"); ?></td><td class="valeur"><input id="totalizable" type="checkbox" name="totalizable"<?php echo(GETPOST('totalizable', 'alpha') ? ' checked' : ''); ?>></td></tr> <!-- Css edit -->