From 69fdccf2a4d0e03d455b0dfde9fdf1df1cac8adf Mon Sep 17 00:00:00 2001 From: MDW Date: Sun, 16 Mar 2025 15:19:54 +0100 Subject: [PATCH] Qual: Fix phan notices (accountancy, adherents) (#33480) --- dev/tools/phan/baseline.txt | 35 ++------------- htdocs/accountancy/admin/categories_list.php | 2 +- htdocs/accountancy/admin/productaccount.php | 6 +-- htdocs/accountancy/admin/subaccount.php | 13 +++--- .../class/accountancycategory.class.php | 8 ++-- .../class/accountancyexport.class.php | 2 +- .../class/accountingjournal.class.php | 6 +-- htdocs/accountancy/class/lettering.class.php | 10 ++--- htdocs/accountancy/closure/index.php | 2 +- htdocs/accountancy/customer/index.php | 20 ++++----- htdocs/accountancy/customer/list.php | 12 ++--- htdocs/accountancy/expensereport/index.php | 19 ++++---- htdocs/accountancy/expensereport/list.php | 9 ++-- htdocs/accountancy/journal/bankjournal.php | 44 +++++++++---------- .../journal/expensereportsjournal.php | 10 ++--- .../accountancy/journal/purchasesjournal.php | 10 ++--- htdocs/accountancy/journal/sellsjournal.php | 10 ++--- htdocs/accountancy/journal/variousjournal.php | 6 +-- htdocs/accountancy/supplier/index.php | 23 +++++----- htdocs/accountancy/supplier/list.php | 12 ++--- htdocs/adherents/admin/member.php | 2 +- htdocs/adherents/class/adherent.class.php | 2 +- .../adherents/class/adherent_type.class.php | 4 +- htdocs/adherents/list.php | 9 ++-- htdocs/adherents/stats/geo.php | 4 +- htdocs/adherents/subscription.php | 6 +-- htdocs/adherents/type.php | 12 ++--- htdocs/adherents/vcard.php | 4 +- 28 files changed, 138 insertions(+), 164 deletions(-) diff --git a/dev/tools/phan/baseline.txt b/dev/tools/phan/baseline.txt index 93a965f1d33..18af391bf36 100644 --- a/dev/tools/phan/baseline.txt +++ b/dev/tools/phan/baseline.txt @@ -10,10 +10,10 @@ return [ // # Issue statistics: // PhanUndeclaredProperty : 460+ occurrences - // PhanTypeMismatchArgument : 320+ occurrences - // PhanTypeMismatchArgumentNullable : 120+ occurrences + // PhanTypeMismatchArgument : 280+ occurrences // PhanTypeMismatchProperty : 100+ occurrences // PhanUndeclaredGlobalVariable : 100+ occurrences + // PhanTypeMismatchArgumentNullable : 90+ occurrences // PhanTypeExpectedObjectPropAccess : 20+ occurrences // PhanTypeInvalidDimOffset : 20+ occurrences // PhanTypeMismatchDimFetch : 15+ occurrences @@ -37,35 +37,8 @@ return [ // Currently, file_suppressions and directory_suppressions are the only supported suppressions 'file_suppressions' => [ - 'htdocs/accountancy/admin/account.php' => ['PhanTypeMismatchArgument'], - 'htdocs/accountancy/admin/categories.php' => ['PhanTypeMismatchArgumentNullable'], - 'htdocs/accountancy/admin/categories_list.php' => ['PhanTypeMismatchArgumentNullable'], - 'htdocs/accountancy/admin/productaccount.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable'], - 'htdocs/accountancy/admin/subaccount.php' => ['PhanTypeMismatchArgument'], - 'htdocs/accountancy/class/accountancycategory.class.php' => ['PhanTypeMismatchArgument'], - 'htdocs/accountancy/class/accountancyexport.class.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable', 'PhanUndeclaredProperty'], - 'htdocs/accountancy/class/accountingjournal.class.php' => ['PhanTypeMismatchArgument'], - 'htdocs/accountancy/class/lettering.class.php' => ['PhanTypeMismatchArgument'], - 'htdocs/accountancy/closure/index.php' => ['PhanTypeMismatchArgument'], - 'htdocs/accountancy/customer/index.php' => ['PhanTypeMismatchArgument'], - 'htdocs/accountancy/customer/list.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable'], - 'htdocs/accountancy/expensereport/index.php' => ['PhanTypeMismatchArgument'], - 'htdocs/accountancy/expensereport/list.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable'], - 'htdocs/accountancy/journal/bankjournal.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable'], - 'htdocs/accountancy/journal/expensereportsjournal.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable'], - 'htdocs/accountancy/journal/purchasesjournal.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable'], - 'htdocs/accountancy/journal/sellsjournal.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable'], - 'htdocs/accountancy/journal/variousjournal.php' => ['PhanTypeMismatchArgumentNullable'], - 'htdocs/accountancy/supplier/index.php' => ['PhanTypeMismatchArgument'], - 'htdocs/accountancy/supplier/list.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable'], - 'htdocs/adherents/admin/member.php' => ['PhanTypeMismatchArgument'], - 'htdocs/adherents/class/adherent.class.php' => ['PhanTypeMismatchArgumentNullable'], - 'htdocs/adherents/class/adherent_type.class.php' => ['PhanTypeMismatchArgument'], - 'htdocs/adherents/list.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable', 'PhanUndeclaredGlobalVariable'], - 'htdocs/adherents/stats/geo.php' => ['PhanTypeMismatchArgumentNullable'], - 'htdocs/adherents/subscription.php' => ['PhanTypeMismatchArgument'], - 'htdocs/adherents/type.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchProperty'], - 'htdocs/adherents/vcard.php' => ['PhanTypeMismatchArgument'], + 'htdocs/accountancy/class/accountancyexport.class.php' => ['PhanTypeMismatchArgument', 'PhanUndeclaredProperty'], + 'htdocs/adherents/list.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/admin/agenda_other.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/admin/agenda_reminder.php' => ['PhanTypeMismatchArgumentNullable'], 'htdocs/admin/barcode.php' => ['PhanTypeMismatchArgument'], diff --git a/htdocs/accountancy/admin/categories_list.php b/htdocs/accountancy/admin/categories_list.php index ccc9d90da61..ef03710d939 100644 --- a/htdocs/accountancy/admin/categories_list.php +++ b/htdocs/accountancy/admin/categories_list.php @@ -477,7 +477,7 @@ if ($listlimit) { print '
'; print ''; print ''; -print ''; +print ''; print ''; diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index 242eaf88704..e5a934872c3 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -5,7 +5,7 @@ * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2015 Ari Elbaz (elarifr) * Copyright (C) 2021 Gauthier VERDOL - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -212,7 +212,7 @@ if ($action == 'update' && $permissiontobind) { $cpt = 0; foreach ($toselect as $productid) { - $accounting_account_id = GETPOST('codeventil_'.$productid); + $accounting_account_id = GETPOSTINT('codeventil_'.$productid); $result = 0; if ($accounting_account_id > 0) { @@ -550,7 +550,7 @@ if ($resql) { //print '
'.$buttonsave.'
'; $texte = $langs->trans("ListOfProductsServices"); - print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, '', 0, '', '', $limit, 0, 0, 1); + print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, (string) $massactionbutton, $num, $nbtotalofrecords, '', 0, '', '', $limit, 0, 0, 1); if ($massaction == 'set_default_account') { $formquestion = array(); diff --git a/htdocs/accountancy/admin/subaccount.php b/htdocs/accountancy/admin/subaccount.php index 8790cb6c9bc..03bb7c7da66 100644 --- a/htdocs/accountancy/admin/subaccount.php +++ b/htdocs/accountancy/admin/subaccount.php @@ -3,6 +3,7 @@ * Copyright (C) 2013-2024 Alexandre Spangaro * Copyright (C) 2016-2018 Laurent Destailleur * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -74,10 +75,10 @@ if (!$sortorder) { } $arrayfields = array( - 'subaccount'=>array('label'=>$langs->trans("AccountNumber"), 'checked'=>1), - 'label'=>array('label'=>$langs->trans("Label"), 'checked'=>1), - 'type'=>array('label'=>$langs->trans("Type"), 'checked'=>1), - 'reconcilable'=>array('label'=>$langs->trans("Reconcilable"), 'checked'=>1) + 'subaccount' => array('label' => $langs->trans("AccountNumber"), 'checked' => '1'), + 'label' => array('label' => $langs->trans("Label"), 'checked' => '1'), + 'type' => array('label' => $langs->trans("Type"), 'checked' => '1'), + 'reconcilable' => array('label' => $langs->trans("Reconcilable"), 'checked' => '1') ); if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { @@ -376,7 +377,7 @@ if ($resql) { print ''; } if (!empty($arrayfields['type']['checked'])) { - print ''.$form->selectarray('search_type', array('1'=>$langs->trans('Customer').' / '.$langs->trans("Prospect"), '2'=>$langs->trans('Supplier'), '3'=>$langs->trans('Employee')), $search_type, 1).''; + print ''.$form->selectarray('search_type', array('1' => $langs->trans('Customer').' / '.$langs->trans("Prospect"), '2' => $langs->trans('Supplier'), '3' => $langs->trans('Employee')), $search_type, 1).''; } if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { if (!empty($arrayfields['reconcilable']['checked'])) { @@ -566,7 +567,7 @@ if ($resql) { $db->free($resql); - $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); + $parameters = array('arrayfields' => $arrayfields, 'sql' => $sql); $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; diff --git a/htdocs/accountancy/class/accountancycategory.class.php b/htdocs/accountancy/class/accountancycategory.class.php index fbbdb35e7a8..4460153dbea 100644 --- a/htdocs/accountancy/class/accountancycategory.class.php +++ b/htdocs/accountancy/class/accountancycategory.class.php @@ -2,7 +2,7 @@ /* Copyright (C) 2016 Jamal Elbaz * Copyright (C) 2016-2017 Alexandre Spangaro * Copyright (C) 2018-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -215,8 +215,8 @@ class AccountancyCategory // extends CommonObject $sql .= " ".(!isset($this->code) ? "NULL" : "'".$this->db->escape($this->code)."'").","; $sql .= " ".(!isset($this->label) ? 'NULL' : "'".$this->db->escape($this->label)."'").","; $sql .= " ".(!isset($this->range_account) ? 'NULL' : "'".$this->db->escape($this->range_account)."'").","; - $sql .= " ".(!isset($this->sens) ? 'NULL' : "'".$this->db->escape($this->sens)."'").","; - $sql .= " ".(!isset($this->category_type) ? 'NULL' : "'".$this->db->escape($this->category_type)."'").","; + $sql .= " ".(!isset($this->sens) ? 'NULL' : "'".$this->db->escape((string) $this->sens)."'").","; + $sql .= " ".(!isset($this->category_type) ? 'NULL' : "'".$this->db->escape((string) $this->category_type)."'").","; $sql .= " ".(!isset($this->formula) ? 'NULL' : "'".$this->db->escape($this->formula)."'").","; $sql .= " ".(!isset($this->position) ? 'NULL' : ((int) $this->position)).","; $sql .= " ".(!isset($this->fk_country) ? 'NULL' : ((int) $this->fk_country)).","; @@ -663,7 +663,7 @@ class AccountancyCategory // extends CommonObject if (is_array($cpt)) { $sql .= " AND t.numero_compte IN (".$this->db->sanitize($listofaccount, 1).")"; } else { - $sql .= " AND t.numero_compte = '".$this->db->escape($cpt)."'"; + $sql .= " AND t.numero_compte = '".$this->db->escape((string) $cpt)."'"; } if (!empty($date_start) && !empty($date_end) && (empty($month) || empty($year))) { // If month/year provided, it is stronger than filter date_start/date_end $sql .= " AND (t.doc_date BETWEEN '".$this->db->idate($date_start)."' AND '".$this->db->idate($date_end)."')"; diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index ce74fb628ad..346777d2512 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -956,7 +956,7 @@ class AccountancyExport $tab = array(); $tab['type_ligne'] = 'M'; - $tab['num_compte'] = str_pad(self::trunc($code_compta, 8), 8); + $tab['num_compte'] = str_pad(self::trunc((string) $code_compta, 8), 8); $tab['code_journal'] = str_pad(self::trunc($line->code_journal, 2), 2); $tab['folio'] = '000'; diff --git a/htdocs/accountancy/class/accountingjournal.class.php b/htdocs/accountancy/class/accountingjournal.class.php index feb15158cac..532f0efb9f7 100644 --- a/htdocs/accountancy/class/accountingjournal.class.php +++ b/htdocs/accountancy/class/accountingjournal.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * Copyright (C) 2024 Alexandre Janniaux * @@ -256,7 +256,7 @@ class AccountingJournal extends CommonObject } if ($withlabel == 2 && !empty($this->nature)) { $key = $langs->trans("AccountingJournalType".$this->nature); - $transferlabel = ($key != "AccountingJournalType".strtoupper($langs->trans($this->nature)) ? $key : $this->label); + $transferlabel = ($key != "AccountingJournalType".strtoupper($langs->trans((string) $this->nature)) ? $key : $this->label); $label_link .= ' - '.($nourl ? '' : '').$transferlabel.($nourl ? '' : ''); } @@ -440,7 +440,7 @@ class AccountingJournal extends CommonObject } // Define begin binding date if (getDolGlobalString('ACCOUNTING_DATE_START_BINDING')) { - $sql .= " AND ad.depreciation_date >= '" . $this->db->idate(getDolGlobalString('ACCOUNTING_DATE_START_BINDING')) . "'"; + $sql .= " AND ad.depreciation_date >= '" . $this->db->idate(getDolGlobalInt('ACCOUNTING_DATE_START_BINDING')) . "'"; } $sql .= " ORDER BY ad.depreciation_date"; diff --git a/htdocs/accountancy/class/lettering.class.php b/htdocs/accountancy/class/lettering.class.php index 964369fb545..a05e7eda7c0 100644 --- a/htdocs/accountancy/class/lettering.class.php +++ b/htdocs/accountancy/class/lettering.class.php @@ -3,7 +3,7 @@ * Copyright (C) 2013 Olivier Geffroy * Copyright (C) 2013-2024 Alexandre Spangaro * Copyright (C) 2018-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -292,7 +292,6 @@ class Lettering extends BookKeeping } /** - * * @param int[] $ids ids array * @param int $notrigger no trigger * @param bool $partial Partial lettering @@ -434,7 +433,6 @@ class Lettering extends BookKeeping } /** - * * @param int[] $ids ids array * @param int $notrigger no trigger * @return int Nb of affectd rows or <0 if error @@ -769,8 +767,8 @@ class Lettering extends BookKeeping /** * Get all bank ids from list of document ids of a type * - * @param array $document_ids List of document id - * @param string $doc_type Type of document ('customer_invoice' or 'supplier_invoice', ...) + * @param int[] $document_ids List of document id + * @param string $doc_type Type of document ('customer_invoice' or 'supplier_invoice', ...) * @return array|int<-1,-1> Return integer <0 if error otherwise all all bank ids from list of document ids of a type */ public function getBankLinesFromFkDocAndDocType($document_ids, $doc_type) @@ -954,7 +952,7 @@ class Lettering extends BookKeeping // Set element id on the current group for each link key of the element foreach ($link_keys as $key) { - $this->getGroupElements($link_by_element, $element_by_link, $key, $current_group); + $this->getGroupElements($link_by_element, $element_by_link, (string) $key, $current_group); } } diff --git a/htdocs/accountancy/closure/index.php b/htdocs/accountancy/closure/index.php index 684b1b05507..44a5031b90a 100644 --- a/htdocs/accountancy/closure/index.php +++ b/htdocs/accountancy/closure/index.php @@ -288,7 +288,7 @@ if (isset($current_fiscal_period)) { 'name' => 'inventory_journal_id', 'type' => 'other', 'label' => $langs->trans('InventoryJournal'), - 'value' => $formaccounting->select_journal(0, "inventory_journal_id", 8, 1, 0, 0) + 'value' => $formaccounting->select_journal('0', "inventory_journal_id", 8, 1, 0, 0) ); $fiscal_period_arr = array(); foreach ($active_fiscal_periods as $info) { diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index 480d0629274..ac998f7b47e 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -164,8 +164,8 @@ if ($action == 'validatehistory' && $user->hasRight('accounting', 'bind', 'write $sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0"; $sql .= " AND l.product_type <= 2"; $sql .= " AND f.entity IN (".getEntity('invoice', 0).")"; // We don't share object for accountancy - if (getDolGlobalString('ACCOUNTING_DATE_START_BINDING')) { - $sql .= " AND f.datef >= '".$db->idate(getDolGlobalString('ACCOUNTING_DATE_START_BINDING'))."'"; + if (getDolGlobalInt('ACCOUNTING_DATE_START_BINDING')) { + $sql .= " AND f.datef >= '".$db->idate(getDolGlobalInt('ACCOUNTING_DATE_START_BINDING'))."'"; } if ($validatemonth && $validateyear) { $sql .= dolSqlDateFilter('f.datef', 0, $validatemonth, $validateyear); @@ -364,8 +364,8 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = fd $sql .= " WHERE f.datef >= '".$db->idate($search_date_start)."'"; $sql .= " AND f.datef <= '".$db->idate($search_date_end)."'"; // Define begin binding date -if (getDolGlobalString('ACCOUNTING_DATE_START_BINDING')) { - $sql .= " AND f.datef >= '".$db->idate(getDolGlobalString('ACCOUNTING_DATE_START_BINDING'))."'"; +if (getDolGlobalInt('ACCOUNTING_DATE_START_BINDING')) { + $sql .= " AND f.datef >= '".$db->idate(getDolGlobalInt('ACCOUNTING_DATE_START_BINDING'))."'"; } $sql .= " AND f.fk_statut > 0"; $sql .= " AND fd.product_type <= 2"; @@ -503,8 +503,8 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = fd $sql .= " WHERE f.datef >= '".$db->idate($search_date_start)."'"; $sql .= " AND f.datef <= '".$db->idate($search_date_end)."'"; // Define begin binding date -if (getDolGlobalString('ACCOUNTING_DATE_START_BINDING')) { - $sql .= " AND f.datef >= '".$db->idate(getDolGlobalString('ACCOUNTING_DATE_START_BINDING'))."'"; +if (getDolGlobalInt('ACCOUNTING_DATE_START_BINDING')) { + $sql .= " AND f.datef >= '".$db->idate(getDolGlobalInt('ACCOUNTING_DATE_START_BINDING'))."'"; } $sql .= " AND f.entity IN (".getEntity('invoice', 0).")"; // We don't share object for accountancy $sql .= " AND f.fk_statut > 0"; @@ -605,8 +605,8 @@ if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This pa $sql .= " WHERE f.datef >= '".$db->idate($search_date_start)."'"; $sql .= " AND f.datef <= '".$db->idate($search_date_end)."'"; // Define begin binding date - if (getDolGlobalString('ACCOUNTING_DATE_START_BINDING')) { - $sql .= " AND f.datef >= '".$db->idate(getDolGlobalString('ACCOUNTING_DATE_START_BINDING'))."'"; + if (getDolGlobalInt('ACCOUNTING_DATE_START_BINDING')) { + $sql .= " AND f.datef >= '".$db->idate(getDolGlobalInt('ACCOUNTING_DATE_START_BINDING'))."'"; } $sql .= " AND f.entity IN (".getEntity('invoice', 0).")"; // We don't share object for accountancy $sql .= " AND f.fk_statut > 0"; @@ -702,8 +702,8 @@ if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This pa $sql .= " WHERE f.datef >= '".$db->idate($search_date_start)."'"; $sql .= " AND f.datef <= '".$db->idate($search_date_end)."'"; // Define begin binding date - if (getDolGlobalString('ACCOUNTING_DATE_START_BINDING')) { - $sql .= " AND f.datef >= '".$db->idate(getDolGlobalString('ACCOUNTING_DATE_START_BINDING'))."'"; + if (getDolGlobalInt('ACCOUNTING_DATE_START_BINDING')) { + $sql .= " AND f.datef >= '".$db->idate(getDolGlobalInt('ACCOUNTING_DATE_START_BINDING'))."'"; } $sql .= " AND f.entity IN (".getEntity('invoice', 0).")"; // We don't share object for accountancy $sql .= " AND f.fk_statut > 0"; diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 7243323e258..25a8508baf6 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -7,7 +7,7 @@ * Copyright (C) 2016 Laurent Destailleur * Copyright (C) 2021 Gauthier VERDOL * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -86,8 +86,8 @@ $search_country = GETPOST('search_country', 'aZ09'); $search_tvaintra = GETPOST('search_tvaintra', 'alpha'); // Define begin binding date -if (empty($search_date_start) && getDolGlobalString('ACCOUNTING_DATE_START_BINDING')) { - $search_date_start = $db->idate(getDolGlobalString('ACCOUNTING_DATE_START_BINDING')); +if (empty($search_date_start) && getDolGlobalInt('ACCOUNTING_DATE_START_BINDING')) { + $search_date_start = $db->idate(getDolGlobalInt('ACCOUNTING_DATE_START_BINDING')); } // Load variable for pagination @@ -197,7 +197,7 @@ if ($massaction == 'ventil' && $user->hasRight('accounting', 'bind', 'write')) { foreach ($mesCasesCochees as $maLigneCochee) { $maLigneCourante = explode("_", $maLigneCochee); $monId = $maLigneCourante[0]; - $monCompte = GETPOST('codeventil'.$monId); + $monCompte = GETPOSTINT('codeventil'.$monId); if ($monCompte <= 0) { $msg .= '
'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NoAccountSelected").'
'; @@ -480,7 +480,7 @@ if ($result) { print ''; // @phan-suppress-next-line PhanPluginSuspiciousParamOrder - print_barre_liste($langs->trans("InvoiceLines").'
'.$langs->trans("DescVentilTodoCustomer").'', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit, 0, 0, 1); + print_barre_liste($langs->trans("InvoiceLines").'
'.$langs->trans("DescVentilTodoCustomer").'', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, (string) $massactionbutton, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit, 0, 0, 1); if ($massaction == 'set_default_account') { $formquestion = array(); @@ -781,7 +781,7 @@ if ($result) { // Suggested accounting account print ''; - print $formaccounting->select_account(($default_account > 0 && $confirm === 'yes' && in_array($objp->rowid."_".$i, $toselect)) ? $default_account : $suggestedid, 'codeventil'.$facture_static_det->id, 1, array(), 0, 0, 'codeventil maxwidth150 maxwidthonsmartphone', 'cachewithshowemptyone'); + print $formaccounting->select_account(($default_account > 0 && $confirm === 'yes' && in_array($objp->rowid."_".$i, $toselect)) ? (string) $default_account : (string) $suggestedid, 'codeventil'.$facture_static_det->id, 1, array(), 0, 0, 'codeventil maxwidth150 maxwidthonsmartphone', 'cachewithshowemptyone'); print ''; // Column with checkbox diff --git a/htdocs/accountancy/expensereport/index.php b/htdocs/accountancy/expensereport/index.php index b8d8a85216c..37f426f841f 100644 --- a/htdocs/accountancy/expensereport/index.php +++ b/htdocs/accountancy/expensereport/index.php @@ -4,6 +4,7 @@ * Copyright (C) 2013-2024 Alexandre Spangaro * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -256,8 +257,8 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = erd $sql .= " WHERE er.date_debut >= '".$db->idate($search_date_start)."'"; $sql .= " AND er.date_debut <= '".$db->idate($search_date_end)."'"; // Define begin binding date -if (getDolGlobalString('ACCOUNTING_DATE_START_BINDING')) { - $sql .= " AND er.date_debut >= '".$db->idate(getDolGlobalString('ACCOUNTING_DATE_START_BINDING'))."'"; +if (getDolGlobalInt('ACCOUNTING_DATE_START_BINDING')) { + $sql .= " AND er.date_debut >= '".$db->idate(getDolGlobalInt('ACCOUNTING_DATE_START_BINDING'))."'"; } $sql .= " AND er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseReport::STATUS_CLOSED.")"; $sql .= " AND er.entity IN (".getEntity('expensereport', 0).")"; // We don't share object for accountancy @@ -304,10 +305,10 @@ if ($resql) { $cursoryear = ($cursormonth < getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1)) ? $y + 1 : $y; $tmp = dol_getdate(dol_get_last_day($cursoryear, $cursormonth, 'gmt'), false, 'gmt'); - print ''; - print price($row[2*$i - 2]); + print ''; + print price($row[2 * $i - 2]); // Add link to make binding - if (!empty(price2num($row[2*$i - 2])) || !empty($row[2*$i - 1])) { + if (!empty(price2num($row[2 * $i - 2])) || !empty($row[2 * $i - 1])) { print ''; print img_picto($langs->trans("ValidateHistory").' ('.$langs->trans('Month'.str_pad((string) $cursormonth, 2, '0', STR_PAD_LEFT)).' '.$cursoryear.')', 'link', 'class="marginleft2"'); print ''; @@ -366,8 +367,8 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = erd $sql .= " WHERE er.date_debut >= '".$db->idate($search_date_start)."'"; $sql .= " AND er.date_debut <= '".$db->idate($search_date_end)."'"; // Define begin binding date -if (getDolGlobalString('ACCOUNTING_DATE_START_BINDING')) { - $sql .= " AND er.date_debut >= '".$db->idate(getDolGlobalString('ACCOUNTING_DATE_START_BINDING'))."'"; +if (getDolGlobalInt('ACCOUNTING_DATE_START_BINDING')) { + $sql .= " AND er.date_debut >= '".$db->idate(getDolGlobalInt('ACCOUNTING_DATE_START_BINDING'))."'"; } $sql .= " AND er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseReport::STATUS_CLOSED.")"; $sql .= " AND er.entity IN (".getEntity('expensereport', 0).")"; // We don't share object for accountancy @@ -449,8 +450,8 @@ if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This pa $sql .= " WHERE er.date_debut >= '".$db->idate($search_date_start)."'"; $sql .= " AND er.date_debut <= '".$db->idate($search_date_end)."'"; // Define begin binding date - if (getDolGlobalString('ACCOUNTING_DATE_START_BINDING')) { - $sql .= " AND er.date_debut >= '".$db->idate(getDolGlobalString('ACCOUNTING_DATE_START_BINDING'))."'"; + if (getDolGlobalInt('ACCOUNTING_DATE_START_BINDING')) { + $sql .= " AND er.date_debut >= '".$db->idate(getDolGlobalInt('ACCOUNTING_DATE_START_BINDING'))."'"; } $sql .= " AND er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseReport::STATUS_CLOSED.")"; $sql .= " AND er.entity IN (".getEntity('expensereport', 0).")"; // We don't share object for accountancy diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php index dbb3f37d445..9ddf89ea347 100644 --- a/htdocs/accountancy/expensereport/list.php +++ b/htdocs/accountancy/expensereport/list.php @@ -6,6 +6,7 @@ * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2016 Laurent Destailleur * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -77,8 +78,8 @@ $search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_s $search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear); // Define begin binding date -if (empty($search_date_start) && getDolGlobalString('ACCOUNTING_DATE_START_BINDING')) { - $search_date_start = $db->idate(getDolGlobalString('ACCOUNTING_DATE_START_BINDING')); +if (empty($search_date_start) && getDolGlobalInt('ACCOUNTING_DATE_START_BINDING')) { + $search_date_start = $db->idate(getDolGlobalInt('ACCOUNTING_DATE_START_BINDING')); } // Load variable for pagination @@ -187,7 +188,7 @@ if ($massaction == 'ventil' && $user->hasRight('accounting', 'bind', 'write')) { foreach ($mesCasesCochees as $maLigneCochee) { $maLigneCourante = explode("_", $maLigneCochee); $monId = $maLigneCourante[0]; - $monCompte = GETPOST('codeventil'.$monId); + $monCompte = GETPOSTINT('codeventil'.$monId); if ($monCompte <= 0) { $msg .= '
'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NoAccountSelected").'
'; @@ -393,7 +394,7 @@ if ($result) { print ''; // @phan-suppress-next-line PhanPluginSuspiciousParamOrder - print_barre_liste($langs->trans("ExpenseReportLines").'
'.$langs->trans("DescVentilTodoExpenseReport").'', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit, 0, 0, 1); + print_barre_liste($langs->trans("ExpenseReportLines").'
'.$langs->trans("DescVentilTodoExpenseReport").'', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, (string) $massactionbutton, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit, 0, 0, 1); if (!empty($msg)) { print $msg.'
'; diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 54b6c227ed4..3019406540b 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -12,7 +12,7 @@ * Copyright (C) 2018 Ferran Marcet * Copyright (C) 2018-2024 Eric Seigne * Copyright (C) 2021 Gauthier VERDOL - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -140,8 +140,8 @@ if (empty($date_endmonth)) { } if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))) { // We define date_start and date_end, only if we did not submit the form - $date_start = dol_get_first_day($pastmonthyear, $pastmonth, false); - $date_end = dol_get_last_day($pastmonthyear, $pastmonth, false); + $date_start = dol_get_first_day((int) $pastmonthyear, (int) $pastmonth, false); + $date_end = dol_get_last_day((int) $pastmonthyear, (int) $pastmonth, false); } $sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.amount_main_currency, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type, b.fk_account,"; @@ -503,7 +503,7 @@ if ($result) { $tabtp[$obj->rowid][$tmpcharge->type_accountancy_code] = isset($tabtp[$obj->rowid][$tmpcharge->type_accountancy_code]) ? $tabtp[$obj->rowid][$tmpcharge->type_accountancy_code] + $amounttouse : $amounttouse; } - $tabpay[$obj->rowid]["soclib"] = $chargestatic->getNomUrl(1, 30); + $tabpay[$obj->rowid]["soclib"] = $chargestatic->getNomUrl(1, '30'); $tabpay[$obj->rowid]["paymentscid"] = $chargestatic->id; } elseif ($links[$key]['type'] == 'payment_donation') { $paymentdonstatic->id = $links[$key]['url_id']; @@ -557,7 +557,7 @@ if ($result) { if (empty($obj->typeop_user)) { // Add test to avoid adding amount twice if a link already exists also on user. $accountancy_code_user_general = (!empty($obj->accountancy_code_user_general)) ? $obj->accountancy_code_user_general : $account_employee; - $compta_user = $userstatic->accountancy_code; + $compta_user = $userstatic->accountancy_code; if ($compta_user) { $tabtp[$obj->rowid][$compta_user] += $amounttouse; $tabuser[$obj->rowid] = array( @@ -1057,20 +1057,20 @@ if ($action == 'exportcsv' && $user->hasRight('accounting', 'bind', 'write')) { print '"'.$key.'"'.$sep; print '"'.$date.'"'.$sep; print '"'.$val["type_payment"].'"'.$sep; - if ($tabtype[$key] == 'payment_supplier') { - $account_ledger = (!empty($obj->accountancy_code_supplier_general)) ? $obj->accountancy_code_supplier_general : $account_supplier; - print '"'.length_accountg($account_ledger).'"'.$sep; - } elseif ($tabtype[$key] == 'payment') { - $account_ledger = (!empty($obj->accountancy_code_customer_general)) ? $obj->accountancy_code_customer_general : $account_customer; - print '"'.length_accountg($account_ledger).'"'.$sep; - } elseif ($tabtype[$key] == 'payment_expensereport') { - print '"'.length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_EXPENSEREPORT')).'"'.$sep; - } elseif ($tabtype[$key] == 'payment_salary') { - $account_ledger = (!empty($obj->accountancy_code_user_general)) ? $obj->accountancy_code_user_general : $account_employee; - print '"'.length_accountg($account_ledger).'"'.$sep; - } else { - print '"'.length_accountg(html_entity_decode($k)).'"'.$sep; - } + if ($tabtype[$key] == 'payment_supplier') { + $account_ledger = (!empty($obj->accountancy_code_supplier_general)) ? $obj->accountancy_code_supplier_general : $account_supplier; + print '"'.length_accountg($account_ledger).'"'.$sep; + } elseif ($tabtype[$key] == 'payment') { + $account_ledger = (!empty($obj->accountancy_code_customer_general)) ? $obj->accountancy_code_customer_general : $account_customer; + print '"'.length_accountg($account_ledger).'"'.$sep; + } elseif ($tabtype[$key] == 'payment_expensereport') { + print '"'.length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_EXPENSEREPORT')).'"'.$sep; + } elseif ($tabtype[$key] == 'payment_salary') { + $account_ledger = (!empty($obj->accountancy_code_user_general)) ? $obj->accountancy_code_user_general : $account_employee; + print '"'.length_accountg($account_ledger).'"'.$sep; + } else { + print '"'.length_accountg(html_entity_decode($k)).'"'.$sep; + } print '"'.length_accounta(html_entity_decode($k)).'"'.$sep; print '"'.$reflabel.'"'.$sep; print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep; @@ -1347,16 +1347,16 @@ if (empty($action) || $action == 'view') { $account_ledger = $k; // Try to force general ledger account depending on type if ($tabtype[$key] == 'payment') { - $account_ledger = (!empty($obj->accountancy_code_customer_general)) ? $obj->accountancy_code_customer_general : $account_customer; + $account_ledger = (!empty($obj->accountancy_code_customer_general)) ? $obj->accountancy_code_customer_general : $account_customer; } if ($tabtype[$key] == 'payment_supplier') { - $account_ledger = (!empty($obj->accountancy_code_supplier_general)) ? $obj->accountancy_code_supplier_general : $account_supplier; + $account_ledger = (!empty($obj->accountancy_code_supplier_general)) ? $obj->accountancy_code_supplier_general : $account_supplier; } if ($tabtype[$key] == 'payment_expensereport') { $account_ledger = getDolGlobalString('ACCOUNTING_ACCOUNT_EXPENSEREPORT'); } if ($tabtype[$key] == 'payment_salary') { - $account_ledger = (!empty($obj->accountancy_code_user_general)) ? $obj->accountancy_code_user_general : $account_employee; + $account_ledger = (!empty($obj->accountancy_code_user_general)) ? $obj->accountancy_code_user_general : $account_employee; } if ($tabtype[$key] == 'payment_vat') { $account_ledger = getDolGlobalString('ACCOUNTING_VAT_PAY_ACCOUNT'); diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php index 4091399cd42..396b296de0e 100644 --- a/htdocs/accountancy/journal/expensereportsjournal.php +++ b/htdocs/accountancy/journal/expensereportsjournal.php @@ -8,7 +8,7 @@ * Copyright (C) 2013-2016 Florian Henry * Copyright (C) 2018-2025 Frédéric France * Copyright (C) 2018 Eric Seigne - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -127,8 +127,8 @@ if (empty($date_endmonth)) { } if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))) { // We define date_start and date_end, only if we did not submit the form - $date_start = dol_get_first_day($pastmonthyear, $pastmonth, false); - $date_end = dol_get_last_day($pastmonthyear, $pastmonth, false); + $date_start = dol_get_first_day((int) $pastmonthyear, (int) $pastmonth, false); + $date_end = dol_get_last_day((int) $pastmonthyear, (int) $pastmonth, false); } $sql = "SELECT er.rowid, er.ref, er.date_debut as de, er.date_fin as df,"; @@ -153,8 +153,8 @@ if ($date_start && $date_end) { $sql .= " AND er.date_debut >= '".$db->idate($date_start)."' AND er.date_debut <= '".$db->idate($date_end)."'"; } // Define begin binding date -if (getDolGlobalString('ACCOUNTING_DATE_START_BINDING')) { - $sql .= " AND er.date_debut >= '".$db->idate(getDolGlobalString('ACCOUNTING_DATE_START_BINDING'))."'"; +if (getDolGlobalInt('ACCOUNTING_DATE_START_BINDING')) { + $sql .= " AND er.date_debut >= '".$db->idate(getDolGlobalInt('ACCOUNTING_DATE_START_BINDING'))."'"; } // Already in bookkeeping or not if ($in_bookkeeping == 'already') { diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index 2382d0ead5f..c4c2fc50995 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -8,7 +8,7 @@ * Copyright (C) 2013-2016 Florian Henry * Copyright (C) 2018-2025 Frédéric France * Copyright (C) 2018 Eric Seigne - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -134,8 +134,8 @@ if (empty($date_endmonth)) { } if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))) { // We define date_start and date_end, only if we did not submit the form - $date_start = dol_get_first_day($pastmonthyear, $pastmonth, false); - $date_end = dol_get_last_day($pastmonthyear, $pastmonth, false); + $date_start = dol_get_first_day((int) $pastmonthyear, (int) $pastmonth, false); + $date_end = dol_get_last_day((int) $pastmonthyear, (int) $pastmonth, false); } $sql = "SELECT f.rowid, f.ref as ref, f.type, f.datef as df, f.libelle as label, f.ref_supplier, f.date_lim_reglement as dlr, f.close_code, f.vat_reverse_charge,"; @@ -190,8 +190,8 @@ if ($date_start && $date_end) { $sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'"; } // Define begin binding date -if (getDolGlobalString('ACCOUNTING_DATE_START_BINDING')) { - $sql .= " AND f.datef >= '".$db->idate(getDolGlobalString('ACCOUNTING_DATE_START_BINDING'))."'"; +if (getDolGlobalInt('ACCOUNTING_DATE_START_BINDING')) { + $sql .= " AND f.datef >= '".$db->idate(getDolGlobalInt('ACCOUNTING_DATE_START_BINDING'))."'"; } // Already in bookkeeping or not if ($in_bookkeeping == 'already') { diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 19e8bc098f8..1e11a5cb503 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -9,7 +9,7 @@ * Copyright (C) 2013-2016 Olivier Geffroy * Copyright (C) 2014 Raphaël Doursenaud * Copyright (C) 2018-2025 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -135,8 +135,8 @@ if (getDolGlobalString('ACCOUNTANCY_JOURNAL_USE_CURRENT_MONTH')) { } if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))) { // We define date_start and date_end, only if we did not submit the form - $date_start = dol_get_first_day($pastmonthyear, $pastmonth, false); - $date_end = dol_get_last_day($pastmonthyear, $pastmonth, false); + $date_start = dol_get_first_day((int) $pastmonthyear, (int) $pastmonth, false); + $date_end = dol_get_last_day((int) $pastmonthyear, (int) $pastmonth, false); } $sql = "SELECT f.rowid, f.ref, f.type, f.situation_cycle_ref, f.datef as df, f.ref_client, f.date_lim_reglement as dlr, f.close_code, f.retained_warranty, f.revenuestamp,"; @@ -189,8 +189,8 @@ if ($date_start && $date_end) { $sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'"; } // Define begin binding date -if (getDolGlobalString('ACCOUNTING_DATE_START_BINDING')) { - $sql .= " AND f.datef >= '".$db->idate(getDolGlobalString('ACCOUNTING_DATE_START_BINDING'))."'"; +if (getDolGlobalInt('ACCOUNTING_DATE_START_BINDING')) { + $sql .= " AND f.datef >= '".$db->idate(getDolGlobalInt('ACCOUNTING_DATE_START_BINDING'))."'"; } // Already in bookkeeping or not if ($in_bookkeeping == 'already') { diff --git a/htdocs/accountancy/journal/variousjournal.php b/htdocs/accountancy/journal/variousjournal.php index 872bfce5d72..cebf7f41a07 100644 --- a/htdocs/accountancy/journal/variousjournal.php +++ b/htdocs/accountancy/journal/variousjournal.php @@ -1,6 +1,6 @@ - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -91,8 +91,8 @@ if (empty($date_endmonth)) { } if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))) { // We define date_start and date_end, only if we did not submit the form - $date_start = dol_get_first_day($pastmonthyear, $pastmonth, false); - $date_end = dol_get_last_day($pastmonthyear, $pastmonth, false); + $date_start = dol_get_first_day((int) $pastmonthyear, (int) $pastmonth, false); + $date_end = dol_get_last_day((int) $pastmonthyear, (int) $pastmonth, false); } $data_type = 'view'; diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php index 814ec1ab979..4b485491fb7 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -4,6 +4,7 @@ * Copyright (C) 2013-2022 Alexandre Spangaro * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -162,8 +163,8 @@ if ($action == 'validatehistory' && $user->hasRight('accounting', 'bind', 'write $sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0"; $sql .= " AND l.product_type <= 2"; $sql .= " AND f.entity IN (".getEntity('facture_fourn', 0).")"; // We don't share object for accountancy - if (getDolGlobalString('ACCOUNTING_DATE_START_BINDING')) { - $sql .= " AND f.datef >= '".$db->idate(getDolGlobalString('ACCOUNTING_DATE_START_BINDING'))."'"; + if (getDolGlobalInt('ACCOUNTING_DATE_START_BINDING')) { + $sql .= " AND f.datef >= '".$db->idate(getDolGlobalInt('ACCOUNTING_DATE_START_BINDING'))."'"; } if ($validatemonth && $validateyear) { $sql .= dolSqlDateFilter('f.datef', 0, $validatemonth, $validateyear); @@ -364,8 +365,8 @@ $sql .= " LEFT JOIN ".$db->prefix()."accounting_account as aa ON aa.rowid = ffd $sql .= " WHERE ff.datef >= '".$db->idate($search_date_start)."'"; $sql .= " AND ff.datef <= '".$db->idate($search_date_end)."'"; // Define begin binding date -if (getDolGlobalString('ACCOUNTING_DATE_START_BINDING')) { - $sql .= " AND ff.datef >= '".$db->idate(getDolGlobalString('ACCOUNTING_DATE_START_BINDING'))."'"; +if (getDolGlobalInt('ACCOUNTING_DATE_START_BINDING')) { + $sql .= " AND ff.datef >= '".$db->idate(getDolGlobalInt('ACCOUNTING_DATE_START_BINDING'))."'"; } $sql .= " AND ff.fk_statut > 0"; $sql .= " AND ffd.product_type <= 2"; @@ -417,10 +418,10 @@ if ($resql) { $cursoryear = ($cursormonth < getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1)) ? $y + 1 : $y; $tmp = dol_getdate(dol_get_last_day($cursoryear, $cursormonth, 'gmt'), false, 'gmt'); - print ''; - print price($row[2*$i - 2]); + print ''; + print price($row[2 * $i - 2]); // Add link to make binding - if (!empty(price2num($row[2*$i - 2])) || !empty($row[2*$i - 1])) { + if (!empty(price2num($row[2 * $i - 2])) || !empty($row[2 * $i - 1])) { print ''; print img_picto($langs->trans("ValidateHistory").' ('.$langs->trans('Month'.str_pad((string) $cursormonth, 2, '0', STR_PAD_LEFT)).' '.$cursoryear.')', 'link', 'class="marginleft2"'); print ''; @@ -495,8 +496,8 @@ $sql .= " LEFT JOIN ".$db->prefix()."accounting_account as aa ON aa.rowid = ffd $sql .= " WHERE ff.datef >= '".$db->idate($search_date_start)."'"; $sql .= " AND ff.datef <= '".$db->idate($search_date_end)."'"; // Define begin binding date -if (getDolGlobalString('ACCOUNTING_DATE_START_BINDING')) { - $sql .= " AND ff.datef >= '".$db->idate(getDolGlobalString('ACCOUNTING_DATE_START_BINDING'))."'"; +if (getDolGlobalInt('ACCOUNTING_DATE_START_BINDING')) { + $sql .= " AND ff.datef >= '".$db->idate(getDolGlobalInt('ACCOUNTING_DATE_START_BINDING'))."'"; } $sql .= " AND ff.entity IN (".getEntity('facture_fourn', 0).")"; // We don't share object for accountancy $sql .= " AND ff.fk_statut > 0"; @@ -588,8 +589,8 @@ if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This pa $sql .= " WHERE ff.datef >= '".$db->idate($search_date_start)."'"; $sql .= " AND ff.datef <= '".$db->idate($search_date_end)."'"; // Define begin binding date - if (getDolGlobalString('ACCOUNTING_DATE_START_BINDING')) { - $sql .= " AND ff.datef >= '".$db->idate(getDolGlobalString('ACCOUNTING_DATE_START_BINDING'))."'"; + if (getDolGlobalInt('ACCOUNTING_DATE_START_BINDING')) { + $sql .= " AND ff.datef >= '".$db->idate(getDolGlobalInt('ACCOUNTING_DATE_START_BINDING'))."'"; } $sql .= " AND ff.entity IN (".getEntity('facture_fourn', 0).")"; // We don't share object for accountancy $sql .= " AND ff.fk_statut > 0"; diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 788484b45ed..e584f7286d2 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -7,7 +7,7 @@ * Copyright (C) 2014 Juanjo Menent s * Copyright (C) 2016 Laurent Destailleur * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -129,8 +129,8 @@ if (!$user->hasRight('accounting', 'bind', 'write')) { } // Define begin binding date -if (empty($search_date_start) && getDolGlobalString('ACCOUNTING_DATE_START_BINDING')) { - $search_date_start = $db->idate(getDolGlobalString('ACCOUNTING_DATE_START_BINDING')); +if (empty($search_date_start) && getDolGlobalInt('ACCOUNTING_DATE_START_BINDING')) { + $search_date_start = $db->idate(getDolGlobalInt('ACCOUNTING_DATE_START_BINDING')); } @@ -199,7 +199,7 @@ if ($massaction == 'ventil' && $user->hasRight('accounting', 'bind', 'write')) { foreach ($mesCasesCochees as $maLigneCochee) { $maLigneCourante = explode("_", $maLigneCochee); $monId = $maLigneCourante[0]; - $monCompte = GETPOST('codeventil'.$monId); + $monCompte = GETPOSTINT('codeventil'.$monId); if ($monCompte <= 0) { $msg .= '
'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NoAccountSelected").'
'; @@ -487,7 +487,7 @@ if ($result) { print ''; // @phan-suppress-next-line PhanPluginSuspiciousParamOrder - print_barre_liste($langs->trans("InvoiceLines").'
'.$langs->trans("DescVentilTodoCustomer").'', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit, 0, 0, 1); + print_barre_liste($langs->trans("InvoiceLines").'
'.$langs->trans("DescVentilTodoCustomer").'', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, (string) $massactionbutton, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit, 0, 0, 1); if ($massaction == 'set_default_account') { $formquestion = array(); @@ -784,7 +784,7 @@ if ($result) { // Suggested accounting account print ''; - print $formaccounting->select_account(($default_account > 0 && $confirm === 'yes' && in_array($objp->rowid."_".$i, $toselect)) ? $default_account : $suggestedid, 'codeventil'.$facturefourn_static_det->id, 1, array(), 0, 0, 'codeventil maxwidth150 maxwidthonsmartphone', 'cachewithshowemptyone'); + print $formaccounting->select_account(($default_account > 0 && $confirm === 'yes' && in_array($objp->rowid."_".$i, $toselect)) ? (string) $default_account : (string) $suggestedid, 'codeventil'.$facturefourn_static_det->id, 1, array(), 0, 0, 'codeventil maxwidth150 maxwidthonsmartphone', 'cachewithshowemptyone'); print ''; // Column with checkbox diff --git a/htdocs/adherents/admin/member.php b/htdocs/adherents/admin/member.php index 788094b1934..1e0d3659821 100644 --- a/htdocs/adherents/admin/member.php +++ b/htdocs/adherents/admin/member.php @@ -604,7 +604,7 @@ if (isModEnabled('invoice')) { print ''; $selected = getDolGlobalString('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS'); print img_picto('', 'product', 'class="pictofixedwidth"'); - $form->select_produits($selected, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', '', 0, 0, 1, 2, '', 0, [], 0, 1, 0, 'minwidth100 maxwidth500 widthcentpercentminusx'); + $form->select_produits((int) $selected, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', '', 0, 0, 1, 2, '', 0, [], 0, 1, 0, 'minwidth100 maxwidth500 widthcentpercentminusx'); print ''; } print "\n"; diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 9a20a733ce1..3a71bde4cb0 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -672,7 +672,7 @@ class Adherent extends CommonObject // Check parameters if (getDolGlobalString('ADHERENT_MAIL_REQUIRED') && !isValidEmail((string) $this->email)) { $langs->load("errors"); - $this->error = $langs->trans("ErrorBadEMail", $this->email); + $this->error = $langs->trans("ErrorBadEMail", (string) $this->email); return -1; } if (!$this->datec) { diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 846a05b04e3..22a1a8bc307 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -494,12 +494,12 @@ class AdherentType extends CommonObject $sql .= "statut = ".((int) $this->status).","; $sql .= "libelle = '".$this->db->escape($this->label)."',"; $sql .= "morphy = '".$this->db->escape($this->morphy)."',"; - $sql .= "subscription = '".$this->db->escape($this->subscription)."',"; + $sql .= "subscription = '".$this->db->escape((string) $this->subscription)."',"; $sql .= "amount = ".((empty($this->amount) && $this->amount == '') ? "null" : ((float) $this->amount)).","; $sql .= "caneditamount = ".((int) $this->caneditamount).","; $sql .= "duration = '".$this->db->escape($this->duration_value.$this->duration_unit)."',"; $sql .= "note = '".$this->db->escape($this->note_public)."',"; - $sql .= "vote = ".(int) $this->db->escape($this->vote).","; + $sql .= "vote = ".(int) $this->db->escape((string) $this->vote).","; $sql .= "mail_valid = '".$this->db->escape($this->mail_valid)."'"; $sql .= " WHERE rowid =".((int) $this->id); diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 8b0aaf08db2..8b419ef384b 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -206,8 +206,8 @@ foreach ($object->fields as $key => $val) { $visible = (int) dol_eval((string) $val['visible'], 1); $arrayfields[$tableprefix.'.'.$key] = array( 'label' => $val['label'], - 'checked' => (($visible < 0) ? 0 : 1), - 'enabled' => (int) (abs($visible) != 3 && (bool) dol_eval($val['enabled'], 1)), + 'checked' => (($visible < 0) ? '0' : '1'), + 'enabled' => (string) (int) (abs($visible) != 3 && (bool) dol_eval($val['enabled'], 1)), 'position' => (int) $val['position'], 'help' => isset($val['help']) ? $val['help'] : '' ); @@ -221,7 +221,6 @@ $object->fields = dol_sort_array($object->fields, 'position'); //$arrayfields['anotherfield'] = array('type'=>'integer', 'label'=>'AnotherField', 'checked'=>1, 'enabled'=>1, 'position'=>90, 'csslist'=>'right'); $arrayfields = dol_sort_array($arrayfields, 'position'); -'@phan-var-force array,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan // Security check $result = restrictedArea($user, 'adherent'); @@ -640,7 +639,7 @@ $arrayofselected = is_array($toselect) ? $toselect : array(); if ($search_type > 0) { $membertype = new AdherentType($db); - $result = $membertype->fetch($search_type); + $result = $membertype->fetch((int) $search_type); $title .= " (".$membertype->label.")"; } @@ -1348,7 +1347,7 @@ while ($i < $imaxinloop) { } // Company if (!empty($arrayfields['d.company']['checked'])) { - print ''; + print ''; print $companynametoshow; print "\n"; } diff --git a/htdocs/adherents/stats/geo.php b/htdocs/adherents/stats/geo.php index e64831600ce..99aea16bd6b 100644 --- a/htdocs/adherents/stats/geo.php +++ b/htdocs/adherents/stats/geo.php @@ -1,6 +1,6 @@ - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Alexandre Spangaro * Copyright (C) 2024-2025 Frédéric France * @@ -234,7 +234,7 @@ if ($mode) { $head = member_stats_prepare_head($memberstatic); -print dol_get_fiche_head($head, $tab, '', -1, ''); +print dol_get_fiche_head($head, (string) $tab, '', -1, ''); // Print title diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index c2fdc4f40d9..40a3b6c9df1 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -670,7 +670,7 @@ if ($action != 'editlogin' && $user->hasRight('adherent', 'creer')) { print ''; print ''; if ($action == 'editlogin') { - $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id, $object->user_id, 'userid', array()); + $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id, (string) $object->user_id, 'userid', array()); } else { if ($object->user_id) { $linkeduser = new User($db); @@ -1070,7 +1070,7 @@ if (($action == 'addsubscription' || $action == 'create_thirdparty') && $user->h } if (getDolGlobalString('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS') && (isModEnabled('product') || isModEnabled('service'))) { $prodtmp = new Product($db); - $result = $prodtmp->fetch(getDolGlobalString('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS')); + $result = $prodtmp->fetch(getDolGlobalInt('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS')); if ($result < 0) { setEventMessage($prodtmp->error, 'errors'); } @@ -1100,7 +1100,7 @@ if (($action == 'addsubscription' || $action == 'create_thirdparty') && $user->h } if (getDolGlobalString('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS') && (isModEnabled('product') || isModEnabled('service'))) { $prodtmp = new Product($db); - $result = $prodtmp->fetch(getDolGlobalString('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS')); + $result = $prodtmp->fetch(getDolGlobalInt('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS')); if ($result < 0) { setEventMessage($prodtmp->error, 'errors'); } diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 0ed42f226b8..2fea8182f51 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -8,7 +8,7 @@ * Copyright (C) 2019-2022 Thibault Foucart * Copyright (C) 2020 Josep Lluís Amador * Copyright (C) 2021 Waël Almoman - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024-2025 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -225,7 +225,7 @@ if ($action == 'add' && $user->hasRight('adherent', 'configurer')) { if ($action == 'update' && $user->hasRight('adherent', 'configurer')) { $object->fetch($rowid); - $object->oldcopy = dol_clone($object, 2); + $object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty $object->label = trim($label); $object->morphy = trim($morphy); @@ -505,7 +505,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') { $colspan = 1; foreach ($arrayfields as $key => $val) { //if (!empty($val['checked'])) { - $colspan++; + $colspan++; //} } print ''.$langs->trans("NoRecordFound").''; @@ -654,7 +654,7 @@ if ($rowid > 0) { print ''.$langs->trans("Duration").''; print $object->duration_value > 0 ? $object->duration_value : ''; print ' '; - print (!empty($object->duration_unit) && isset($durationarray[$object->duration_unit]) ? $langs->trans($durationarray[$object->duration_unit]) : ''); + print(!empty($object->duration_unit) && isset($durationarray[$object->duration_unit]) ? $langs->trans($durationarray[$object->duration_unit]) : ''); print ''; // Description @@ -812,7 +812,7 @@ if ($rowid > 0) { if ($type > 0) { $membertype = new AdherentType($db); - $result = $membertype->fetch($type); + $result = $membertype->fetch((int) $type); $titre .= " (".$membertype->label.")"; } @@ -1076,7 +1076,7 @@ if ($rowid > 0) { print ''.$langs->trans("Amount").''; print ''; print ''; diff --git a/htdocs/adherents/vcard.php b/htdocs/adherents/vcard.php index 96f5481c35c..98c61b08db9 100644 --- a/htdocs/adherents/vcard.php +++ b/htdocs/adherents/vcard.php @@ -4,7 +4,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2020 Tobias Sekan * Copyright (C) 2020-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -96,7 +96,7 @@ $v = new vCard(); $v->setProdId('Dolibarr '.DOL_VERSION); $v->setUid('DOLIBARR-ADHERENTID-'.$object->id); -$v->setName($object->lastname, $object->firstname, "", $object->civility, ""); +$v->setName($object->lastname, $object->firstname, "", (string) $object->civility, ""); $v->setFormattedName($object->getFullName($langs, 1)); $v->setPhoneNumber($object->phone_pro, "TYPE=WORK;VOICE");