diff --git a/dev/tools/phan/baseline.txt b/dev/tools/phan/baseline.txt index 5d910884652..887472c6c4c 100644 --- a/dev/tools/phan/baseline.txt +++ b/dev/tools/phan/baseline.txt @@ -10,9 +10,10 @@ return [ // # Issue statistics: // PhanUndeclaredProperty : 460+ occurrences - // PhanTypeMismatchArgument : 150+ occurrences // PhanTypeMismatchProperty : 100+ occurrences // PhanUndeclaredGlobalVariable : 100+ occurrences + // PhanTypeMismatchArgument : 95+ occurrences + // PhanTypeMismatchArgumentNullable : 35+ occurrences // PhanTypeExpectedObjectPropAccess : 20+ occurrences // PhanTypeInvalidDimOffset : 20+ occurrences // PhanTypeMismatchDimFetch : 15+ occurrences @@ -30,7 +31,6 @@ return [ // PhanTypeMismatchDimAssignment : 2 occurrences // PhanTypeMismatchReturn : 2 occurrences // PhanTypeSuspiciousStringExpression : 2 occurrences - // PhanPluginDuplicateExpressionAssignmentOperation : 1 occurrence // PhanPossiblyUndeclaredVariable : 1 occurrence // PhanTypeExpectedObjectPropAccessButGotNull : 1 occurrence @@ -104,19 +104,11 @@ return [ 'htdocs/compta/resultat/index.php' => ['PhanTypeMismatchArgument'], 'htdocs/compta/resultat/projects.php' => ['PhanTypeMismatchArgument'], 'htdocs/compta/sociales/card.php' => ['PhanUndeclaredProperty'], - 'htdocs/compta/sociales/payments.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable'], - 'htdocs/compta/stats/cabyprodserv.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable'], - 'htdocs/compta/stats/supplier_turnover_by_prodserv.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable'], - 'htdocs/compta/stats/supplier_turnover_by_thirdparty.php' => ['PhanTypeMismatchArgument'], 'htdocs/compta/tva/class/paymentvat.class.php' => ['PhanUndeclaredProperty'], 'htdocs/compta/tva/clients.php' => ['PhanTypeArraySuspiciousNull', 'PhanTypeInvalidDimOffset', 'PhanTypeMismatchArgument'], 'htdocs/compta/tva/index.php' => ['PhanTypeMismatchArgument'], 'htdocs/compta/tva/payments.php' => ['PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchArgumentNullableInternal'], 'htdocs/compta/tva/quadri_detail.php' => ['PhanTypeArraySuspiciousNull', 'PhanTypeInvalidDimOffset', 'PhanTypeMismatchArgument'], - 'htdocs/contact/ajax/contact.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable'], - 'htdocs/contact/class/contact.class.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable'], - 'htdocs/contact/consumption.php' => ['PhanTypeMismatchArgument'], - 'htdocs/contact/list.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable'], 'htdocs/contrat/card.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/core/actions_addupdatedelete.inc.php' => ['PhanTypeMismatchDimFetch', 'PhanUndeclaredProperty'], 'htdocs/core/actions_massactions.inc.php' => ['PhanUndeclaredProperty'], @@ -132,15 +124,12 @@ return [ 'htdocs/core/class/commonsocialnetworks.class.php' => ['PhanUndeclaredProperty'], 'htdocs/core/class/conf.class.php' => ['PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchProperty'], 'htdocs/core/class/ctyperesource.class.php' => ['PhanUndeclaredProperty'], - 'htdocs/core/class/doleditor.class.php' => ['PhanPluginDuplicateExpressionAssignmentOperation'], 'htdocs/core/class/dolgraph.class.php' => ['PhanUndeclaredProperty'], 'htdocs/core/class/emailsenderprofile.class.php' => ['PhanUndeclaredProperty'], - 'htdocs/core/class/evalmath.class.php' => ['PhanTypeMismatchArgument'], 'htdocs/core/class/extrafields.class.php' => ['PhanTypeMismatchArgument'], 'htdocs/core/class/html.formcompany.class.php' => ['PhanUndeclaredProperty'], 'htdocs/core/class/html.formfile.class.php' => ['PhanTypeMismatchArgument'], 'htdocs/core/class/html.formmail.class.php' => ['PhanTypeMismatchArgument', 'PhanUndeclaredProperty'], - 'htdocs/core/class/html.formother.class.php' => ['PhanTypeMismatchArgument'], 'htdocs/core/class/notify.class.php' => ['PhanUndeclaredProperty'], 'htdocs/core/class/openid.class.php' => ['PhanTypeMismatchArgument'], 'htdocs/core/class/rssparser.class.php' => ['PhanTypeMismatchArgument'], @@ -209,8 +198,6 @@ return [ 'htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php' => ['PhanUndeclaredProperty'], 'htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php' => ['PhanUndeclaredProperty'], 'htdocs/datapolicy/class/datapolicycron.class.php' => ['PhanTypeMismatchArgument'], - 'htdocs/dav/dav.class.php' => ['PhanTypeMismatchArgument'], - 'htdocs/debugbar/class/TraceableDB.php' => ['PhanTypeMismatchArgument'], 'htdocs/delivery/class/delivery.class.php' => ['PhanUndeclaredProperty'], 'htdocs/don/admin/donation.php' => ['PhanUndeclaredMethod'], 'htdocs/don/class/don.class.php' => ['PhanParamTooMany'], @@ -218,42 +205,21 @@ return [ 'htdocs/don/info.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/don/list.php' => ['PhanTypeMismatchProperty'], 'htdocs/don/note.php' => ['PhanUndeclaredGlobalVariable'], - 'htdocs/ecm/class/ecmdirectory.class.php' => ['PhanTypeMismatchArgument'], - 'htdocs/ecm/class/ecmfiles.class.php' => ['PhanTypeMismatchArgument'], - 'htdocs/ecm/file_note.php' => ['PhanTypeMismatchArgument'], - 'htdocs/ecm/search.php' => ['PhanTypeMismatchArgument'], 'htdocs/emailcollector/class/emailcollector.class.php' => ['PhanUndeclaredProperty'], 'htdocs/eventorganization/class/conferenceorboothattendee.class.php' => ['PhanUndeclaredMethod', 'PhanUndeclaredProperty'], - 'htdocs/eventorganization/conferenceorbooth_contact.php' => ['PhanTypeMismatchArgument'], - 'htdocs/eventorganization/conferenceorbooth_document.php' => ['PhanTypeMismatchArgument'], 'htdocs/eventorganization/conferenceorbooth_list.php' => ['PhanTypeMismatchArgument'], - 'htdocs/eventorganization/conferenceorboothattendee_list.php' => ['PhanTypeMismatchArgument'], 'htdocs/eventorganization/core/actions_massactions_mail.inc.php' => ['PhanUndeclaredProperty'], - 'htdocs/expedition/ajax/searchfrombarcode.php' => ['PhanTypeMismatchArgument'], 'htdocs/expedition/card.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], - 'htdocs/expedition/class/expedition.class.php' => ['PhanTypeMismatchArgumentNullable', 'PhanUndeclaredProperty'], - 'htdocs/expedition/class/expeditionlinebatch.class.php' => ['PhanTypeMismatchArgumentNullable'], - 'htdocs/expedition/list.php' => ['PhanTypeMismatchArgument'], - 'htdocs/expedition/shipment.php' => ['PhanTypeMismatchProperty'], - 'htdocs/expensereport/ajax/ajaxik.php' => ['PhanTypeMismatchArgument'], + 'htdocs/expedition/class/expedition.class.php' => ['PhanUndeclaredProperty'], 'htdocs/expensereport/card.php' => ['PhanUndeclaredProperty'], 'htdocs/expensereport/class/expensereport.class.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable'], - 'htdocs/expensereport/class/expensereportline.class.php' => ['PhanTypeMismatchArgument'], - 'htdocs/expensereport/class/expensereportstats.class.php' => ['PhanTypeMismatchArgument'], - 'htdocs/expensereport/class/paymentexpensereport.class.php' => ['PhanTypeMismatchArgument'], 'htdocs/expensereport/payment/card.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/expensereport/payment/info.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/expensereport/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'], - 'htdocs/exports/export.php' => ['PhanTypeMismatchArgument'], 'htdocs/externalsite/frames.php' => ['PhanUndeclaredGlobalVariable'], - 'htdocs/fichinter/agenda.php' => ['PhanTypeMismatchArgument'], 'htdocs/fichinter/card-rec.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/fichinter/class/api_interventions.class.php' => ['PhanUndeclaredProperty'], 'htdocs/fichinter/class/fichinterrec.class.php' => ['PhanUndeclaredProperty'], - 'htdocs/fichinter/contact.php' => ['PhanTypeMismatchArgument'], - 'htdocs/fichinter/document.php' => ['PhanTypeMismatchArgument'], - 'htdocs/fichinter/note.php' => ['PhanTypeMismatchArgument'], - 'htdocs/fichinter/stats/index.php' => ['PhanTypeMismatchArgument'], 'htdocs/fichinter/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'], 'htdocs/filefunc.inc.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/fourn/class/api_supplier_orders.class.php' => ['PhanTypeMismatchArgumentProbablyReal'], @@ -299,7 +265,6 @@ return [ 'htdocs/product/class/productfournisseurprice.class.php' => ['PhanUndeclaredMethod', 'PhanUndeclaredProperty'], 'htdocs/product/inventory/class/inventory.class.php' => ['PhanUndeclaredProperty'], 'htdocs/product/price.php' => ['PhanUndeclaredProperty'], - 'htdocs/product/price_suppliers.php' => ['PhanTypeMismatchProperty'], 'htdocs/product/reassort.php' => ['PhanTypeExpectedObjectPropAccessButGotNull'], 'htdocs/product/stock/info.php' => ['PhanUndeclaredProperty'], 'htdocs/product/stock/list.php' => ['PhanUndeclaredProperty'], diff --git a/dev/tools/phan/config_extended.php b/dev/tools/phan/config_extended.php index c42693162df..10cc74de057 100644 --- a/dev/tools/phan/config_extended.php +++ b/dev/tools/phan/config_extended.php @@ -87,7 +87,7 @@ $config['suppress_issue_types'] = [ 'PhanPluginNonBoolBranch', // Not essential - 31240+ occurrences 'PhanPluginNumericalComparison', // Not essential - 19870+ occurrences - 'PhanTypeMismatchArgument', // Not showing in cti.dolibarr until low count - Can detect missing array keys, invalid types, objects being passed when scalar expected - Not all reported by phpstan - <=1200 cases (was: 12300+ before) + // 'PhanTypeMismatchArgument', // Most fixed ~120 occurrences (was: 12300+ before) 'PhanPluginNonBoolInLogicalArith', // Not essential - 11040+ occurrences 'PhanPluginConstantVariableScalar', // Not essential - 5180+ occurrences 'PhanPluginDuplicateAdjacentStatement', diff --git a/htdocs/compta/sociales/payments.php b/htdocs/compta/sociales/payments.php index fe9816caf40..89afdb7fe27 100644 --- a/htdocs/compta/sociales/payments.php +++ b/htdocs/compta/sociales/payments.php @@ -8,7 +8,7 @@ * Copyright (C) 2019 Nicolas ZABOURI * 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 @@ -184,7 +184,7 @@ if ($year > 0) { if ($sortfield !== null && preg_match('/^(cs|c|pc|pct|u|ba)\./', $sortfield) ) { - $sql .= $db->order($sortfield, $sortorder); + $sql .= $db->order($sortfield, (string) $sortorder); } // Count total nb of records @@ -226,7 +226,7 @@ print ''; print ''; print ''; print ''; -$formsocialcontrib->select_type_socialcontrib(GETPOSTISSET("search_sc_type") ? $search_sc_type : '', 'search_sc_type', 1, 0, 0, 'minwidth200 maxwidth300'); +$formsocialcontrib->select_type_socialcontrib(GETPOSTISSET("search_sc_type") ? (int) $search_sc_type : 0, 'search_sc_type', 1, 0, 0, 'minwidth200 maxwidth300'); print ''; print ''; print ''; diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php index a76a053dc27..e7b94fb8edc 100644 --- a/htdocs/compta/stats/cabyprodserv.php +++ b/htdocs/compta/stats/cabyprodserv.php @@ -5,7 +5,7 @@ * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2022 Alexandre Spangaro * Copyright (C) 2024 Charlene Benke - * 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 @@ -434,7 +434,7 @@ if ($modecompta == 'CREANCES-DETTES') { $sql .= $hookmanager->resPrint; $sql .= " GROUP BY p.rowid, p.ref, p.label, p.fk_product_type"; - $sql .= $db->order($sortfield, $sortorder); + $sql .= $db->order((string) $sortfield, (string) $sortorder); dol_syslog("cabyprodserv", LOG_DEBUG); $result = $db->query($sql); @@ -480,7 +480,7 @@ if ($modecompta == 'CREANCES-DETTES') { print ''; print ''; print img_picto('', 'category', 'class="pictofixedwidth"'); - print $formother->select_categories(Categorie::TYPE_PRODUCT, $selected_cat, 'search_categ', 0, $langs->trans("Category")); + print $formother->select_categories(Categorie::TYPE_PRODUCT, (int) $selected_cat, 'search_categ', 0, $langs->trans("Category")); print ' '; print ''; print img_picto('', 'category', 'class="pictofixedwidth"'); - print $formother->select_categories(Categorie::TYPE_CUSTOMER, $selected_catsoc, 'search_categ_soc', 0, $langs->trans("CustomersProspectsCategoriesShort")); + print $formother->select_categories(Categorie::TYPE_CUSTOMER, (int) $selected_catsoc, 'search_categ_soc', 0, $langs->trans("CustomersProspectsCategoriesShort")); // Type of third party filter print '   '; diff --git a/htdocs/compta/stats/supplier_turnover_by_prodserv.php b/htdocs/compta/stats/supplier_turnover_by_prodserv.php index d0800daddee..66401f051f0 100644 --- a/htdocs/compta/stats/supplier_turnover_by_prodserv.php +++ b/htdocs/compta/stats/supplier_turnover_by_prodserv.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 @@ -354,7 +354,7 @@ if ($modecompta == 'CREANCES-DETTES') { } $sql .= " AND f.entity IN (".getEntity('supplier_invoice').")"; $sql .= " GROUP BY p.rowid, p.ref, p.label, p.fk_product_type"; - $sql .= $db->order($sortfield, $sortorder); + $sql .= $db->order((string) $sortfield, (string) $sortorder); dol_syslog("supplier_turnover_by_prodserv", LOG_DEBUG); $resql = $db->query($sql); @@ -413,7 +413,7 @@ if ($modecompta == 'CREANCES-DETTES') { //select thirdparty print '
'; print img_picto('', 'company', 'class="paddingrightonly"'); - print $form->select_thirdparty_list($selected_soc, 'search_soc', '', $langs->trans("ThirdParty"), 0, 0, [], '', 0, 0, 'maxwidth250'); + print $form->select_thirdparty_list((string) $selected_soc, 'search_soc', '', $langs->trans("ThirdParty"), 0, 0, [], '', 0, 0, 'maxwidth250'); print ''; print ''; @@ -536,7 +536,7 @@ if ($modecompta == 'CREANCES-DETTES') { print '100%'; print ''; - $db->free($result); + $db->free($resql); } else { print ''.$langs->trans("NoRecordFound").''; } diff --git a/htdocs/compta/stats/supplier_turnover_by_thirdparty.php b/htdocs/compta/stats/supplier_turnover_by_thirdparty.php index 6c971cec66e..701d92c6ea1 100644 --- a/htdocs/compta/stats/supplier_turnover_by_thirdparty.php +++ b/htdocs/compta/stats/supplier_turnover_by_thirdparty.php @@ -1,7 +1,7 @@ * Copyright (C) 2023 Ferran Marcet - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * Copyright (C) 2025 Alexandre Spangaro * @@ -699,7 +699,7 @@ if (count($amount)) { print ''; print ''; - $db->free($result); + $db->free($resql); } else { print ''.$langs->trans("NoRecordFound").''; } diff --git a/htdocs/compta/tva/payments.php b/htdocs/compta/tva/payments.php index 48fa39fce67..82fdd69ecd0 100644 --- a/htdocs/compta/tva/payments.php +++ b/htdocs/compta/tva/payments.php @@ -6,7 +6,7 @@ * Copyright (C) 2011-2014 Juanjo Menent * Copyright (C) 2015 Jean-François Ferry * 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 @@ -58,8 +58,8 @@ if (!$year && $mode != 'tvaonly') { } $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; -$sortfield = GETPOST('sortfield', 'aZ09comma'); -$sortorder = GETPOST('sortorder', 'aZ09comma'); +$sortfield = (string) GETPOST('sortfield', 'aZ09comma'); +$sortorder = (string) GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page"); if (empty($page) || $page == -1) { $page = 0; @@ -143,7 +143,7 @@ if (preg_match('/^cs\./', $sortfield) || preg_match('/^ptva\./', $sortfield) || preg_match('/^pct\./', $sortfield) || preg_match('/^bank\./', $sortfield)) { - $sql .= $db->order($sortfield, $sortorder); + $sql .= $db->order($sortfield, (string) $sortorder); } //$sql.= $db->plimit($limit+1,$offset); //print $sql; @@ -210,10 +210,9 @@ if (isModEnabled('tax') && $user->hasRight('tax', 'charges', 'lire')) { $sql .= " OR (tva.datev IS NULL AND tva.datev between '" . $db->idate(dol_get_first_day($year)) . "' AND '" . $db->idate(dol_get_last_day($year)) . "')"; $sql .= ")"; } - if ($sortfield !== null - && preg_match('/^(cs|tva|ptva|pct|bank)\./', $sortfield) + if (preg_match('/^(cs|tva|ptva|pct|bank)\./', $sortfield) ) { - $sql .= $db->order($sortfield, $sortorder); + $sql .= $db->order($sortfield, (string) $sortorder); } if ($num) { diff --git a/htdocs/contact/ajax/contact.php b/htdocs/contact/ajax/contact.php index 5d5ea8093a0..d6138b9940c 100644 --- a/htdocs/contact/ajax/contact.php +++ b/htdocs/contact/ajax/contact.php @@ -2,7 +2,7 @@ /* Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2007-2019 Laurent Destailleur - * 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 @@ -158,7 +158,7 @@ if ($action == 'fetch' && !empty($id) && $permissiontoread) { if (getDolGlobalInt('CONTACT_USE_SEARCH_TO_SELECT') && $nbchar < getDolGlobalInt('CONTACT_USE_SEARCH_TO_SELECT')) { print json_encode(array()); } else { - $arrayresult = $form->selectcontacts($socid, array(), $htmlname, 1, $exclude, $limitto, $showfunction, $morecss, $options_only, $showsoc, $forcecombo, $events, $moreparam, $htmlid, $multiple, $disableifempty, $filter); + $arrayresult = $form->selectcontacts($socid, array(), (string) $htmlname, 1, $exclude, $limitto, $showfunction, $morecss, $options_only, $showsoc, $forcecombo, $events, $moreparam, $htmlid, (bool) $multiple, $disableifempty, $filter); print json_encode($arrayresult); } diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 2a726981ab8..b47d7017fe3 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -652,7 +652,7 @@ class Contact extends CommonObject $sql .= ", name_alias='".$this->db->escape($this->name_alias)."'"; $sql .= ", lastname='".$this->db->escape($this->lastname)."'"; $sql .= ", firstname='".$this->db->escape($this->firstname)."'"; - $sql .= ", address='".$this->db->escape($this->address)."'"; + $sql .= ", address='".$this->db->escape((string) $this->address)."'"; $sql .= ", zip='".$this->db->escape($this->zip)."'"; $sql .= ", town='".$this->db->escape($this->town)."'"; $sql .= ", ref_ext = ".(!empty($this->ref_ext) ? "'".$this->db->escape($this->ref_ext)."'" : "NULL"); @@ -675,7 +675,7 @@ class Contact extends CommonObject $sql .= ", fk_stcommcontact = ".($this->stcomm_id > 0 || $this->stcomm_id == -1 ? $this->stcomm_id : "0"); } $sql .= ", statut = ".((int) $this->statut); - $sql .= ", fk_user_modif=".($user->id > 0 ? "'".$this->db->escape($user->id)."'" : "NULL"); + $sql .= ", fk_user_modif=".($user->id > 0 ? "'".$this->db->escape((string) $user->id)."'" : "NULL"); $sql .= ", default_lang=".($this->default_lang ? "'".$this->db->escape($this->default_lang)."'" : "NULL"); $sql .= ", entity = ".((int) $this->entity); $sql .= " WHERE rowid = ".((int) $id); @@ -923,8 +923,8 @@ class Contact extends CommonObject * Update field alert birthday * * @param int $id Id of contact - * @param User $user User asking to change alert or birthday - * @param int $notrigger 0=no, 1=yes + * @param ?User $user User asking to change alert or birthday + * @param int<0,1> $notrigger 0=no, 1=yes * @return int Return integer <0 if KO, >=0 if OK */ public function update_perso($id, $user = null, $notrigger = 0) @@ -978,15 +978,15 @@ class Contact extends CommonObject $this->error = $this->db->lasterror(); } } - } - if (!$error && !$notrigger) { - // Call trigger - $result = $this->call_trigger('CONTACT_MODIFY', $user); - if ($result < 0) { - $error++; + if (!$error && !$notrigger) { + // Call trigger + $result = $this->call_trigger('CONTACT_MODIFY', $user); + if ($result < 0) { + $error++; + } + // End call triggers } - // End call triggers } if (!$error) { diff --git a/htdocs/contact/consumption.php b/htdocs/contact/consumption.php index 72eedc7bbe5..230be00d362 100644 --- a/htdocs/contact/consumption.php +++ b/htdocs/contact/consumption.php @@ -6,7 +6,7 @@ * Copyright (C) 2015-2017 Ferran Marcet * Copyright (C) 2024 Alexandre Spangaro * 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 @@ -437,8 +437,8 @@ if ($sql_select && $documentstatic !== null) { print ''; print ''; print ''; // date - print $formother->select_month($month ? $month : -1, 'month', 1, 0, 'valignmiddle'); - print $formother->selectyear($year ? $year : -1, 'year', 1, 20, 1); + print $formother->select_month($month ? (string) $month : '-1', 'month', 1, 0, 'valignmiddle'); + print $formother->selectyear($year ? (string) $year : '-1', 'year', 1, 20, 1); print ''; print ''; print ''; @@ -593,7 +593,7 @@ if ($sql_select && $documentstatic !== null) { } } else { if ($objp->fk_product > 0) { - echo $form->textwithtooltip($text, $description, 3, 0, '', $i, 0, ''); + echo $form->textwithtooltip($text, $description, 3, 0, '', (string) $i, 0, ''); // Show range echo get_date_range($objp->date_start, $objp->date_end); @@ -612,7 +612,7 @@ if ($sql_select && $documentstatic !== null) { if (!empty($objp->label)) { $text .= ' '.$objp->label.''; - echo $form->textwithtooltip($text, dol_htmlentitiesbr($objp->description), 3, 0, '', $i, 0, ''); + echo $form->textwithtooltip($text, dol_htmlentitiesbr($objp->description), 3, 0, '', (string) $i, 0, ''); } else { echo $text.' '.dol_htmlentitiesbr($objp->description); } diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 945acc6c664..3d21addc6d8 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -416,7 +416,7 @@ if (empty($reshook)) { if ($action == 'setstcomm' && $permissiontoadd) { $object = new Contact($db); - $result = $object->fetch(GETPOST('stcommcontactid')); + $result = $object->fetch(GETPOSTINT('stcommcontactid')); $object->stcomm_id = dol_getIdFromCode($db, GETPOST('stcomm', 'alpha'), 'c_stcommcontact'); $result = $object->update($object->id, $user); if ($result < 0) { @@ -991,7 +991,7 @@ if ($contextpage != 'poslist') { $newcardbutton .= dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', $url); } -print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'address', 0, $newcardbutton, '', $limit, 0, 0, 1); +print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, (string) $massactionbutton, $num, $nbtotalofrecords, 'address', 0, $newcardbutton, '', $limit, 0, 0, 1); $topicmail = "Information"; $modelmail = "contact"; @@ -1028,7 +1028,7 @@ if (isModEnabled('category') && $user->hasRight('categorie', 'lire')) { $moreforfilter .= '
'; $tmptitle = $langs->trans('ContactCategoriesShort'); $moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"'); - $moreforfilter .= $formother->select_categories(Categorie::TYPE_CONTACT, $search_categ, 'search_categ', 1, $tmptitle); + $moreforfilter .= $formother->select_categories(Categorie::TYPE_CONTACT, (int) $search_categ, 'search_categ', 1, $tmptitle); $moreforfilter .= '
'; if (empty($type) || $type == 'c' || $type == 'p') { $moreforfilter .= '
'; @@ -1041,7 +1041,7 @@ if (isModEnabled('category') && $user->hasRight('categorie', 'lire')) { $tmptitle .= $langs->trans('CustomersProspectsCategoriesShort'); } $moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"'); - $moreforfilter .= $formother->select_categories(Categorie::TYPE_CUSTOMER, $search_categ_thirdparty, 'search_categ_thirdparty', 1, $tmptitle); + $moreforfilter .= $formother->select_categories(Categorie::TYPE_CUSTOMER, (int) $search_categ_thirdparty, 'search_categ_thirdparty', 1, $tmptitle); $moreforfilter .= '
'; } @@ -1049,7 +1049,7 @@ if (isModEnabled('category') && $user->hasRight('categorie', 'lire')) { $moreforfilter .= '
'; $tmptitle = $langs->trans('SuppliersCategoriesShort'); $moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"'); - $moreforfilter .= $formother->select_categories(Categorie::TYPE_SUPPLIER, $search_categ_supplier, 'search_categ_supplier', 1, $tmptitle); + $moreforfilter .= $formother->select_categories(Categorie::TYPE_SUPPLIER, (int) $search_categ_supplier, 'search_categ_supplier', 1, $tmptitle); $moreforfilter .= '
'; } } diff --git a/htdocs/core/ajax/selectobject.php b/htdocs/core/ajax/selectobject.php index f7d12c6477e..0176203b55a 100644 --- a/htdocs/core/ajax/selectobject.php +++ b/htdocs/core/ajax/selectobject.php @@ -1,7 +1,7 @@ * 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 @@ -164,7 +164,7 @@ top_httphead($outjson ? 'application/json' : 'text/html'); //print ''."\n"; -$arrayresult = $form->selectForFormsList($objecttmp, $htmlname, 0, 0, $searchkey, '', '', '', 0, 1, 0, '', $filter); +$arrayresult = $form->selectForFormsList($objecttmp, (string) $htmlname, 0, 0, $searchkey, '', '', '', 0, 1, 0, '', $filter); $db->close(); diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php index 9a5e139d361..ff0b050daee 100644 --- a/htdocs/core/class/doleditor.class.php +++ b/htdocs/core/class/doleditor.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2021 Gaëtan MAISON - * 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 @@ -218,7 +218,7 @@ class DolEditor $found = 0; $out = ''; - $this->content = ($this->content ?? ''); // to avoid htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated + $this->content = (string) $this->content; // to avoid htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated if (in_array($this->tool, array('textarea', 'ckeditor'))) { $found = 1; diff --git a/htdocs/core/class/evalmath.class.php b/htdocs/core/class/evalmath.class.php index 5030a0ac154..7f6e7bc99b4 100644 --- a/htdocs/core/class/evalmath.class.php +++ b/htdocs/core/class/evalmath.class.php @@ -63,6 +63,8 @@ * Copyright (C) 2024 MDW * Copyright (C) 2025 MDW * Copyright (C) 2025 MDW + * Copyright (C) 2025 MDW + * Copyright (C) 2025 MDW * * LICENSE * Redistribution and use in source and binary forms, with or without @@ -354,7 +356,7 @@ class EvalMath if (preg_match("/^([a-z]\w*)\($/", $val, $matches)) { // may be func, or variable w/ implicit multiplication against parentheses... if (in_array($matches[1], $this->fb) or array_key_exists($matches[1], $this->f)) { // it's a func $stack->push($val); - $stack->push(1); + $stack->push('1'); $stack->push('('); $expecting_op = false; } else { // it's a var w/ implicit multiplication diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 5ffa87eba76..15bd3e07ac6 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -759,6 +759,7 @@ class ExtraFields dol_syslog(get_class($this).'::DDLUpdateField', LOG_DEBUG); if ($type != 'separate') { // No table update when separate type + // TODO: Verify, adjust - field_desc has 'value' (not expected), and is missing 'label','enabled','position','visible' $result = $this->db->DDLUpdateField($this->db->prefix().$table, $attrname, $field_desc); } if ($result > 0 || $type == 'separate') { diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 09a9daa5994..c1502d648f9 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -11,7 +11,7 @@ * Copyright (C) 2007 Patrick Raguin * Copyright (C) 2019 Thibault FOUCART * 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 @@ -1240,7 +1240,7 @@ class FormOther // $boxidactivatedforuser will be array of boxes chose by user $selectboxlist = ''; - $boxactivated = InfoBox::listBoxes($db, 'activated', $areacode, (empty($user->conf->$confuserzone) ? null : $user), array(), 0); // Search boxes of common+user (or common only if user has no specific setup) + $boxactivated = InfoBox::listBoxes($db, 'activated', (int) $areacode, (empty($user->conf->$confuserzone) ? null : $user), array(), 0); // Search boxes of common+user (or common only if user has no specific setup) $boxidactivatedforuser = array(); foreach ($boxactivated as $box) { diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index b9e931c0c67..2998e5f3396 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -2085,7 +2085,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = null, $nopr } // Now add events of emailing module - if (is_array($actioncode)) { + if (is_array($actioncode) && $objcon !== null) { foreach ($actioncode as $code) { $sql2 = addMailingEventTypeSQL($code, $objcon, $filterobj); if (!empty($sql2)) { diff --git a/htdocs/core/modules/cheque/modules_chequereceipts.php b/htdocs/core/modules/cheque/modules_chequereceipts.php index c38fe64d5fc..9a9b6b1e8c9 100644 --- a/htdocs/core/modules/cheque/modules_chequereceipts.php +++ b/htdocs/core/modules/cheque/modules_chequereceipts.php @@ -4,7 +4,7 @@ * Copyright (C) 2004 Eric Seigne * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2016 Juanjo Menent - * 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 diff --git a/htdocs/dav/dav.class.php b/htdocs/dav/dav.class.php index 13a6b449faa..649f520610c 100644 --- a/htdocs/dav/dav.class.php +++ b/htdocs/dav/dav.class.php @@ -1,6 +1,7 @@ * 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 @@ -60,9 +61,9 @@ class CdavLib /** * Base sql request for calendar events * - * @param int $calid Calendard id - * @param int|boolean $oid Oid - * @param int|boolean $ouri Ouri + * @param int $calid Calendar id + * @param int|bool $oid Oid + * @param int|bool $ouri Ouri * @return string */ public function getSqlCalEvents($calid, $oid = false, $ouri = false) @@ -101,7 +102,7 @@ class CdavLib if ($ouri === false) { $sql .= ' AND a.id = '.((int) $oid); } else { - $sql .= ' AND (a.id = '.((int) $oid)." OR ac.uuidext = '".$this->db->escape($ouri)."')"; + $sql .= ' AND (a.id = '.((int) $oid)." OR ac.uuidext = '".((int) $ouri)."')"; } } @@ -187,15 +188,15 @@ class CdavLib $caldata .= "DUE;VALUE=DATE:".date('Ymd', strtotime($obj->datep2) + 1)."\n"; } } else { - $caldata .= "DTSTART;TZID=".$timezone.":".strtr($obj->datep, array(" "=>"T", ":"=>"", "-"=>""))."\n"; + $caldata .= "DTSTART;TZID=".$timezone.":".strtr($obj->datep, array(" " => "T", ":" => "", "-" => ""))."\n"; if ($type == 'VEVENT') { if (trim($obj->datep2) != '') { - $caldata .= "DTEND;TZID=".$timezone.":".strtr($obj->datep2, array(" "=>"T", ":"=>"", "-"=>""))."\n"; + $caldata .= "DTEND;TZID=".$timezone.":".strtr($obj->datep2, array(" " => "T", ":" => "", "-" => ""))."\n"; } else { - $caldata .= "DTEND;TZID=".$timezone.":".strtr($obj->datep, array(" "=>"T", ":"=>"", "-"=>""))."\n"; + $caldata .= "DTEND;TZID=".$timezone.":".strtr($obj->datep, array(" " => "T", ":" => "", "-" => ""))."\n"; } } elseif (trim($obj->datep2) != '') { - $caldata .= "DUE;TZID=".$timezone.":".strtr($obj->datep2, array(" "=>"T", ":"=>"", "-"=>""))."\n"; + $caldata .= "DUE;TZID=".$timezone.":".strtr($obj->datep2, array(" " => "T", ":" => "", "-" => ""))."\n"; } } $caldata .= "CLASS:PUBLIC\n"; @@ -217,7 +218,7 @@ class CdavLib } $caldata .= "DESCRIPTION:"; - $caldata .= strtr($obj->note, array("\n"=>"\\n", "\r"=>"")); + $caldata .= strtr($obj->note, array("\n" => "\\n", "\r" => "")); if (!empty($obj->soc_nom)) { $caldata .= "\\n*DOLIBARR-SOC: ".$obj->soc_nom; } diff --git a/htdocs/debugbar/class/TraceableDB.php b/htdocs/debugbar/class/TraceableDB.php index d74e50d761f..5f659ada9a3 100644 --- a/htdocs/debugbar/class/TraceableDB.php +++ b/htdocs/debugbar/class/TraceableDB.php @@ -381,7 +381,7 @@ class TraceableDB extends DoliDB * End query tracing * * @param string $sql query string - * @param string $resql query result + * @param mysqli_result|bool|resource $resql query result * @return void */ protected function endTracing($sql, $resql) diff --git a/htdocs/ecm/class/ecmdirectory.class.php b/htdocs/ecm/class/ecmdirectory.class.php index 27b31001992..ad524cc17bb 100644 --- a/htdocs/ecm/class/ecmdirectory.class.php +++ b/htdocs/ecm/class/ecmdirectory.class.php @@ -2,7 +2,7 @@ /* Copyright (C) 2007-2012 Laurent Destailleur * Copyright (C) 2008-2012 Regis Houssin * 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 @@ -193,7 +193,7 @@ class EcmDirectory extends CommonObject $sql .= "fk_user_c"; $sql .= ") VALUES ("; $sql .= " '".$this->db->escape($this->label)."',"; - $sql .= " '".$this->db->escape($conf->entity)."',"; + $sql .= " '".$this->db->escape((string) $conf->entity)."',"; $sql .= " ".($this->fk_parent > 0 ? ((int) $this->fk_parent) : "null").","; $sql .= " '".$this->db->escape($this->description)."',"; $sql .= " ".((int) $this->cachenbofdoc).","; diff --git a/htdocs/ecm/class/ecmfiles.class.php b/htdocs/ecm/class/ecmfiles.class.php index ebeaa709323..a4166e29043 100644 --- a/htdocs/ecm/class/ecmfiles.class.php +++ b/htdocs/ecm/class/ecmfiles.class.php @@ -5,7 +5,7 @@ * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2018 Francis Appels * Copyright (C) 2019-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 @@ -73,7 +73,7 @@ class EcmFiles extends CommonObject public $entity; /** - * @var string filename, Note: Into ecm database record, the entry $filename never ends with .noexe + * @var string filename, Note: Into ecm database record, the entry never ends with .noexe */ public $filename; @@ -756,7 +756,7 @@ class EcmFiles extends CommonObject $sql .= ' content = '.(isset($this->content) ? "'".$this->db->escape($this->content)."'" : "null").','; } $sql .= ' cover = '.(isset($this->cover) ? "'".$this->db->escape($this->cover)."'" : "null").','; - $sql .= ' position = '.(isset($this->position) ? $this->db->escape($this->position) : "0").','; + $sql .= ' position = '.(isset($this->position) ? $this->db->escape((string) $this->position) : "0").','; $sql .= ' gen_or_uploaded = '.(isset($this->gen_or_uploaded) ? "'".$this->db->escape($this->gen_or_uploaded)."'" : "null").','; $sql .= ' extraparams = '.(isset($extraparams) ? "'".$this->db->escape($extraparams)."'" : "null").','; $sql .= ' date_c = '.(!isset($this->date_c) || dol_strlen($this->date_c) != 0 ? "'".$this->db->idate($this->date_c)."'" : 'null').','; diff --git a/htdocs/ecm/file_note.php b/htdocs/ecm/file_note.php index 524125c4249..fc5f390b506 100644 --- a/htdocs/ecm/file_note.php +++ b/htdocs/ecm/file_note.php @@ -5,6 +5,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2017 Ferran Marcet * 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 @@ -89,7 +90,7 @@ if (!$urlfile) { // Load ecm object $ecmdir = new EcmDirectory($db); -$result = $ecmdir->fetch(GETPOST("section", 'alpha')); +$result = $ecmdir->fetch(GETPOSTINT("section")); if (!($result > 0)) { dol_print_error($db, $ecmdir->error); exit; diff --git a/htdocs/ecm/search.php b/htdocs/ecm/search.php index 09b35f40e21..6d9c5f7e108 100644 --- a/htdocs/ecm/search.php +++ b/htdocs/ecm/search.php @@ -1,7 +1,7 @@ * Copyright (C) 2008-2009 Regis Houssin - * 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 @@ -88,7 +88,7 @@ if (!$sortfield) { $ecmdir = new EcmDirectory($db); if (!empty($section)) { - $result = $ecmdir->fetch($section); + $result = $ecmdir->fetch((int) $section); if (!($result > 0)) { dol_print_error($db, $ecmdir->error); exit; diff --git a/htdocs/eventorganization/conferenceorbooth_contact.php b/htdocs/eventorganization/conferenceorbooth_contact.php index dd8d9b6aa3f..be43d91349f 100644 --- a/htdocs/eventorganization/conferenceorbooth_contact.php +++ b/htdocs/eventorganization/conferenceorbooth_contact.php @@ -3,6 +3,7 @@ * Copyright (C) 2021 Florian HENRY * Copyright (C) 2024 Alexandre Spangaro * 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 @@ -160,7 +161,7 @@ $contactstatic = new Contact($db); $userstatic = new User($db); $title = $langs->trans('ConferenceOrBooth')." - ".$langs->trans('ContactsAddresses'); -$help_url='EN:Module_Event_Organization'; +$help_url = 'EN:Module_Event_Organization'; llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-eventorganization page-card_contact'); @@ -310,7 +311,7 @@ if (!empty($withproject)) { $htmltext = $langs->trans("AllowUnknownPeopleSuggestConfHelp"); print $form->editfieldkey('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', '', $projectstatic, 0, $typeofdata, '', 0, 0, 'projectid', $htmltext); print ''; - print $form->editfieldval('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', '1', $projectstatic, 0, $typeofdata, '', null, 0, '', 0, '', 'projectid'); + print $form->editfieldval('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', '1', $projectstatic, 0, $typeofdata, '', null, null, '', 0, '', 'projectid'); print ""; print ''; @@ -318,19 +319,19 @@ if (!empty($withproject)) { $htmltext = $langs->trans("AllowUnknownPeopleSuggestBoothHelp"); print $form->editfieldkey('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', '', $projectstatic, 0, $typeofdata, '', 0, 0, 'projectid', $htmltext); print ''; - print $form->editfieldval('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', '1', $projectstatic, 0, $typeofdata, '', null, 0, '', 0, '', 'projectid'); + print $form->editfieldval('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', '1', $projectstatic, 0, $typeofdata, '', null, null, '', 0, '', 'projectid'); print ""; print ''; print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid'); print ''; - print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', $projectstatic->price_booth, $projectstatic, 0, 'amount', '', null, 0, '', 0, '', 'projectid'); + print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', $projectstatic->price_booth, $projectstatic, 0, 'amount', '', null, null, '', 0, '', 'projectid'); print ""; print ''; print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid'); print ''; - print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', $projectstatic->price_registration, $projectstatic, 0, 'amount', '', null, 0, '', 0, '', 'projectid'); + print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', $projectstatic->price_registration, $projectstatic, 0, 'amount', '', null, null, '', 0, '', 'projectid'); print ""; print ''.$langs->trans("EventOrganizationICSLink").''; diff --git a/htdocs/eventorganization/conferenceorbooth_document.php b/htdocs/eventorganization/conferenceorbooth_document.php index e561ae99265..8bc9ea5a936 100644 --- a/htdocs/eventorganization/conferenceorbooth_document.php +++ b/htdocs/eventorganization/conferenceorbooth_document.php @@ -3,6 +3,7 @@ * Copyright (C) 2021 Florian Henry * Copyright (C) 2024 Alexandre Spangaro * 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 @@ -142,7 +143,7 @@ include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; $form = new Form($db); $title = $langs->trans("ConferenceOrBooth").' - '.$langs->trans("Files"); -$help_url='EN:Module_Event_Organization'; +$help_url = 'EN:Module_Event_Organization'; llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-eventorganization page-card_documents'); @@ -284,7 +285,7 @@ if (!empty($withproject)) { $htmltext = $langs->trans("AllowUnknownPeopleSuggestConfHelp"); print $form->editfieldkey('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', '', $projectstatic, 0, $typeofdata, '', 0, 0, 'projectid', $htmltext); print ''; - print $form->editfieldval('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', '1', $projectstatic, 0, $typeofdata, '', null, 0, '', 0, '', 'projectid'); + print $form->editfieldval('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', '1', $projectstatic, 0, $typeofdata, '', null, null, '', 0, '', 'projectid'); print ""; print ''; @@ -292,19 +293,19 @@ if (!empty($withproject)) { $htmltext = $langs->trans("AllowUnknownPeopleSuggestBoothHelp"); print $form->editfieldkey('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', '', $projectstatic, 0, $typeofdata, '', 0, 0, 'projectid', $htmltext); print ''; - print $form->editfieldval('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', '1', $projectstatic, 0, $typeofdata, '', null, 0, '', 0, '', 'projectid'); + print $form->editfieldval('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', '1', $projectstatic, 0, $typeofdata, '', null, null, '', 0, '', 'projectid'); print ""; print ''; print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid'); print ''; - print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', $projectstatic->price_booth, $projectstatic, 0, 'amount', '', null, 0, '', 0, '', 'projectid'); + print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', $projectstatic->price_booth, $projectstatic, 0, 'amount', '', null, null, '', 0, '', 'projectid'); print ""; print ''; print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid'); print ''; - print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', $projectstatic->price_registration, $projectstatic, 0, 'amount', '', null, 0, '', 0, '', 'projectid'); + print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', $projectstatic->price_registration, $projectstatic, 0, 'amount', '', null, null, '', 0, '', 'projectid'); print ""; print ''.$langs->trans("EventOrganizationICSLink").''; diff --git a/htdocs/eventorganization/conferenceorbooth_list.php b/htdocs/eventorganization/conferenceorbooth_list.php index a58ebc15c92..a4f5e94895b 100644 --- a/htdocs/eventorganization/conferenceorbooth_list.php +++ b/htdocs/eventorganization/conferenceorbooth_list.php @@ -470,7 +470,7 @@ if ($projectid > 0) { $htmltext = $langs->trans("AllowUnknownPeopleSuggestConfHelp"); print $form->editfieldkey('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', ($project->accept_conference_suggestions ? 1 : 0), $project, $permissiontoadd, $typeofdata, '', 0, 0, 'projectid', $htmltext); print ''; - print $form->editfieldval('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', ($project->accept_conference_suggestions ? 1 : 0), $project, $permissiontoadd, $typeofdata, '', null, 0, '', 0, '', 'projectid'); + print $form->editfieldval('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', ($project->accept_conference_suggestions ? 1 : 0), $project, $permissiontoadd, $typeofdata, '', null, null, '', 0, '', 'projectid'); print ""; print ''; @@ -478,25 +478,25 @@ if ($projectid > 0) { $htmltext = $langs->trans("AllowUnknownPeopleSuggestBoothHelp"); print $form->editfieldkey('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', ($project->accept_booth_suggestions ? 1 : 0), $project, $permissiontoadd, $typeofdata, '', 0, 0, 'projectid', $htmltext); print ''; - print $form->editfieldval('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', ($project->accept_booth_suggestions ? 1 : 0), $project, $permissiontoadd, $typeofdata, '', null, 0, '', 0, '', 'projectid'); + print $form->editfieldval('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', ($project->accept_booth_suggestions ? 1 : 0), $project, $permissiontoadd, $typeofdata, '', null, null, '', 0, '', 'projectid'); print ""; print ''; print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', '', $project, $permissiontoadd, 'amount', '', 0, 0, 'projectid'); print ''; - print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', $project->price_booth, $project, $permissiontoadd, 'amount', '', null, 0, '', 0, '', 'projectid'); + print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', $project->price_booth, $project, $permissiontoadd, 'amount', '', null, null, '', 0, '', 'projectid'); print ""; print ''; print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', '', $project, $permissiontoadd, 'amount', '', 0, 0, 'projectid'); print ''; - print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', $project->price_registration, $project, $permissiontoadd, 'amount', '', null, 0, '', 0, '', 'projectid'); + print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', $project->price_registration, $project, $permissiontoadd, 'amount', '', null, null, '', 0, '', 'projectid'); print ""; print ''; print $form->editfieldkey($form->textwithpicto($langs->trans('MaxNbOfAttendees'), ''), 'max_attendees', '', $project, $permissiontoadd, 'integer:3', '', 0, 0, 'projectid'); print ''; - print $form->editfieldval($form->textwithpicto($langs->trans('MaxNbOfAttendees'), ''), 'max_attendees', $project->max_attendees, $project, $permissiontoadd, 'integer:3', '', null, 0, '', 0, '', 'projectid'); + print $form->editfieldval($form->textwithpicto($langs->trans('MaxNbOfAttendees'), ''), 'max_attendees', $project->max_attendees, $project, $permissiontoadd, 'integer:3', '', null, null, '', 0, '', 'projectid'); print ""; // Link to ICS for the event diff --git a/htdocs/eventorganization/conferenceorboothattendee_list.php b/htdocs/eventorganization/conferenceorboothattendee_list.php index 14d85080c0b..466cdd3f1a9 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_list.php +++ b/htdocs/eventorganization/conferenceorboothattendee_list.php @@ -568,7 +568,7 @@ if ($projectstatic->id > 0 || $confOrBooth > 0) { print ''; $typeofdata = 'checkbox:'.($projectstatic->accept_conference_suggestions ? ' checked="checked"' : ''); $htmltext = $langs->trans("AllowUnknownPeopleSuggestConfHelp"); - print $form->editfieldkey('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', $projectstatic->accept_conference_suggestions ? 1 : 0, $projectstatic, 0, $typeofdata, '', 0, 0, 'projectid', $htmltext); + print $form->editfieldkey('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', $projectstatic->accept_conference_suggestions ? '1' : '0', $projectstatic, 0, $typeofdata, '', 0, 0, 'projectid', $htmltext); print ''; print $form->editfieldval('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', $projectstatic->accept_conference_suggestions ? 1 : 0, $projectstatic, 0, $typeofdata, '', null, null, '', 0, '', 'projectid'); print ""; @@ -576,7 +576,7 @@ if ($projectstatic->id > 0 || $confOrBooth > 0) { print ''; $typeofdata = 'checkbox:'.($projectstatic->accept_booth_suggestions ? ' checked="checked"' : ''); $htmltext = $langs->trans("AllowUnknownPeopleSuggestBoothHelp"); - print $form->editfieldkey('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', $projectstatic->accept_booth_suggestions ? 1 : 0, $projectstatic, 0, $typeofdata, '', 0, 0, 'projectid', $htmltext); + print $form->editfieldkey('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', $projectstatic->accept_booth_suggestions ? '1' : '0', $projectstatic, 0, $typeofdata, '', 0, 0, 'projectid', $htmltext); print ''; print $form->editfieldval('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', $projectstatic->accept_booth_suggestions ? 1 : 0, $projectstatic, 0, $typeofdata, '', null, null, '', 0, '', 'projectid'); print ""; diff --git a/htdocs/expedition/ajax/searchfrombarcode.php b/htdocs/expedition/ajax/searchfrombarcode.php index ed272bda6b4..52df6491699 100644 --- a/htdocs/expedition/ajax/searchfrombarcode.php +++ b/htdocs/expedition/ajax/searchfrombarcode.php @@ -1,5 +1,6 @@ + * Copyright (C) 2025 MDW */ /* * This program is free software; you can redistribute it and/or modify @@ -62,7 +63,7 @@ $warehouseid = 0; $objectreturn = array(); $usesublevelpermission = ''; -$object= new Product($db); +$object = new Product($db); // Security check if (!empty($user->socid)) { @@ -100,12 +101,12 @@ if ($action == "existbarcode" && !empty($barcode) && $user->hasRight('stock', 'l $sql .= " WHERE p.barcode = '".$db->escape($barcode)."'"; } if (!empty($fk_entrepot)) { - $sql .= " AND ps.fk_entrepot = '".$db->escape($fk_entrepot)."'"; + $sql .= " AND ps.fk_entrepot = '".$db->escape((string) $fk_entrepot)."'"; } $result = $db->query($sql); if ($result) { $nbline = $db->num_rows($result); - for ($i=0; $i < $nbline; $i++) { + for ($i = 0; $i < $nbline; $i++) { $obj = $db->fetch_object($result); if (($mode == "barcode" && $barcode == $obj->barcode) || ($mode == "lotserial" && $barcode == $obj->batch)) { if (!empty($obj->fk_entrepot) && $fk_entrepot == $obj->fk_entrepot) { @@ -114,22 +115,22 @@ if ($action == "existbarcode" && !empty($barcode) && $user->hasRight('stock', 'l $fk_product = $obj->fk_product; $reelqty = $obj->reel; - $objectreturn = array('fk_warehouse'=>$warehouseid,'fk_product'=>$fk_product,'reelqty'=>$reelqty); + $objectreturn = array('fk_warehouse' => $warehouseid,'fk_product' => $fk_product,'reelqty' => $reelqty); } } } if ($warehousefound < 1) { - $response = array('status'=>'error','errorcode'=>'NotFound','message'=>'No warehouse found for barcode'.$barcode); + $response = array('status' => 'error','errorcode' => 'NotFound','message' => 'No warehouse found for barcode'.$barcode); } elseif ($warehousefound > 1) { - $response = array('status'=>'error','errorcode'=>'TooManyWarehouse','message'=>'Too many warehouse found'); + $response = array('status' => 'error','errorcode' => 'TooManyWarehouse','message' => 'Too many warehouse found'); } else { - $response = array('status'=>'success','message'=>'Warehouse found','object'=>$objectreturn); + $response = array('status' => 'success','message' => 'Warehouse found','object' => $objectreturn); } } else { - $response = array('status'=>'error','errorcode'=>'NotFound','message'=>"No results found for barcode"); + $response = array('status' => 'error','errorcode' => 'NotFound','message' => "No results found for barcode"); } } else { - $response = array('status'=>'error','errorcode'=>'ActionError','message'=>"Error on action"); + $response = array('status' => 'error','errorcode' => 'ActionError','message' => "Error on action"); } $response = json_encode($response); diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index b6dcb1fcf4f..f122333059f 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -1363,7 +1363,7 @@ class Expedition extends CommonObject // We increment stock of batches // We use warehouse selected for each line foreach ($lotArray as $lot) { - $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $lot->qty, 0, $langs->trans("ShipmentCanceledInDolibarr", $this->ref), $lot->eatby, $lot->sellby, $lot->batch); // Price is set to 0, because we don't want to see WAP changed + $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $lot->qty, 0, $langs->trans("ShipmentCanceledInDolibarr", $this->ref), $lot->eatby, $lot->sellby, (string) $lot->batch); // Price is set to 0, because we don't want to see WAP changed if ($result < 0) { $error++; $this->errors = array_merge($this->errors, $mouvS->errors); @@ -1558,7 +1558,7 @@ class Expedition extends CommonObject // We increment stock of batches // We use warehouse selected for each line foreach ($lotArray as $lot) { - $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $lot->qty, 0, $langs->trans("ShipmentDeletedInDolibarr", $this->ref), $lot->eatby, $lot->sellby, $lot->batch); // Price is set to 0, because we don't want to see WAP changed + $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $lot->qty, 0, $langs->trans("ShipmentDeletedInDolibarr", $this->ref), $lot->eatby, $lot->sellby, (string) $lot->batch); // Price is set to 0, because we don't want to see WAP changed if ($result < 0) { $error++; $this->errors = array_merge($this->errors, $mouvS->errors); diff --git a/htdocs/expedition/class/expeditionlinebatch.class.php b/htdocs/expedition/class/expeditionlinebatch.class.php index a944a70c3b6..362251c308c 100644 --- a/htdocs/expedition/class/expeditionlinebatch.class.php +++ b/htdocs/expedition/class/expeditionlinebatch.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2013-2014 Cedric GROSS - * 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 @@ -162,7 +162,7 @@ class ExpeditionLineBatch extends CommonObject $sql .= $id_line_expdet; $sql .= ", ".(!isset($this->sellby) || dol_strlen($this->sellby) == 0 ? 'NULL' : ("'".$this->db->idate($this->sellby))."'"); $sql .= ", ".(!isset($this->eatby) || dol_strlen($this->eatby) == 0 ? 'NULL' : ("'".$this->db->idate($this->eatby))."'"); - $sql .= ", ".($this->batch == '' ? 'NULL' : ("'".$this->db->escape($this->batch)."'")); + $sql .= ", ".($this->batch == '' ? 'NULL' : ("'".$this->db->escape((string) $this->batch)."'")); $sql .= ", ".(!isset($this->qty) ? ((!isset($this->dluo_qty)) ? 'NULL' : $this->dluo_qty) : $this->qty); // dluo_qty deprecated, use qty $sql .= ", ".((int) $this->fk_origin_stock); $sql .= ", ".(empty($this->fk_warehouse) ? 'NULL' : $this->fk_warehouse); diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index c1dbceae6af..4294986000e 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -1162,7 +1162,7 @@ if (isModEnabled('category') && $user->hasRight('categorie', 'lire') && ($user-> $moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"'); //$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1); //$moreforfilter .= $form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1); - $moreforfilter .= $formother->select_categories(Categorie::TYPE_PRODUCT, $search_product_category, 'search_product_category', 1, $tmptitle); + $moreforfilter .= $formother->select_categories(Categorie::TYPE_PRODUCT, (int) $search_product_category, 'search_product_category', 1, $tmptitle); $moreforfilter .= ''; } diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index 46195c6e5df..987f0cd3c49 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -193,7 +193,7 @@ if (empty($reshook)) { } if ($action == 'update_extras' && $permissiontoadd) { - $object->oldcopy = dol_clone($object, 2); + $object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty // Fill array 'array_options' with data from update form $ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml')); diff --git a/htdocs/expensereport/ajax/ajaxik.php b/htdocs/expensereport/ajax/ajaxik.php index 7394938aa02..d0fd9ff8ee5 100644 --- a/htdocs/expensereport/ajax/ajaxik.php +++ b/htdocs/expensereport/ajax/ajaxik.php @@ -2,6 +2,7 @@ /* Copyright (C) 2017 ATM Consulting * Copyright (C) 2017 Pierre-Henry Favre * 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 @@ -76,9 +77,9 @@ $rep->errorMessage = ''; if (empty($fk_expense) || $fk_expense < 0) { - $rep->errorMessage = $langs->transnoentitiesnoconv('ErrorBadValueForParameter', $fk_expense, 'fk_expense'); + $rep->errorMessage = $langs->transnoentitiesnoconv('ErrorBadValueForParameter', (string) $fk_expense, 'fk_expense'); } elseif (empty($fk_c_exp_tax_cat) || $fk_c_exp_tax_cat < 0) { - $rep->errorMessage = $langs->transnoentitiesnoconv('ErrorBadValueForParameter', $fk_c_exp_tax_cat, 'fk_c_exp_tax_cat'); + $rep->errorMessage = $langs->transnoentitiesnoconv('ErrorBadValueForParameter', (string) $fk_c_exp_tax_cat, 'fk_c_exp_tax_cat'); $rep->response_status = 'error'; } else { diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 2eacf539c4e..50306162967 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -1991,7 +1991,7 @@ class ExpenseReport extends CommonObject } $vatrate = preg_replace('/\*/', '', $vatrate); - $tmp = calcul_price_total($qty, $up, 0, (float) price2num($vatrate), -1, -1, 0, 'TTC', 0, $type, $seller, $localtaxes_type); + $tmp = calcul_price_total($qty, (float) $up, 0, (float) price2num($vatrate), -1, -1, 0, 'TTC', 0, $type, $seller, $localtaxes_type); $this->line->value_unit = $up; diff --git a/htdocs/expensereport/class/expensereportline.class.php b/htdocs/expensereport/class/expensereportline.class.php index 2ebf7ec4f49..193479dfba7 100644 --- a/htdocs/expensereport/class/expensereportline.class.php +++ b/htdocs/expensereport/class/expensereportline.class.php @@ -5,7 +5,7 @@ * Copyright (C) 2018 Nicolas ZABOURI * Copyright (c) 2018-2024 Frédéric France * Copyright (C) 2016-2020 Ferran Marcet - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * Copyright (C) 2024 William Mead * @@ -346,7 +346,7 @@ class ExpenseReportLine extends CommonObjectLine $sql .= ' total_ht, total_tva, total_ttc,'; $sql .= ' total_localtax1, total_localtax2,'; $sql .= ' date, rule_warning_message, fk_c_exp_tax_cat, fk_ecm_files)'; - $sql .= " VALUES (".$this->db->escape($this->fk_expensereport).","; + $sql .= " VALUES (".$this->db->escape((string) $this->fk_expensereport).","; $sql .= " ".((int) $this->fk_c_type_fees).","; $sql .= " ".((int) (!empty($this->fk_project) && $this->fk_project > 0) ? $this->fk_project : ((!empty($this->fk_projet) && $this->fk_projet > 0) ? $this->fk_projet : 'null')).","; $sql .= " ".((float) $this->vatrate).","; @@ -490,7 +490,7 @@ class ExpenseReportLine extends CommonObjectLine $sql .= ", localtax1_type='".$this->db->escape($this->localtax1_type)."'"; $sql .= ", localtax2_type='".$this->db->escape($this->localtax2_type)."'"; $sql .= ", rule_warning_message='".$this->db->escape($this->rule_warning_message)."'"; - $sql .= ", fk_c_exp_tax_cat=".$this->db->escape($this->fk_c_exp_tax_cat); + $sql .= ", fk_c_exp_tax_cat=".$this->db->escape((string) $this->fk_c_exp_tax_cat); $sql .= ", fk_ecm_files=".($this->fk_ecm_files > 0 ? ((int) $this->fk_ecm_files) : 'null'); if ($this->fk_c_type_fees) { $sql .= ", fk_c_type_fees = ".((int) $this->fk_c_type_fees); diff --git a/htdocs/expensereport/class/expensereportstats.class.php b/htdocs/expensereport/class/expensereportstats.class.php index 8b25b65281a..6a6e9175e8a 100644 --- a/htdocs/expensereport/class/expensereportstats.class.php +++ b/htdocs/expensereport/class/expensereportstats.class.php @@ -3,7 +3,7 @@ * Copyright (c) 2005-2008 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * 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 @@ -159,7 +159,7 @@ class ExpenseReportStats extends Stats { $sql = "SELECT date_format(".$this->db->ifsql("e.".$this->datetouse." IS NULL", "e.date_create", "e.".$this->datetouse).",'%m') as dm, sum(".$this->field.")"; $sql .= " FROM ".$this->from; - $sql .= " WHERE date_format(".$this->db->ifsql("e.".$this->datetouse." IS NULL", "e.date_create", "e.".$this->datetouse).",'%Y') = '".$this->db->escape($year)."'"; + $sql .= " WHERE date_format(".$this->db->ifsql("e.".$this->datetouse." IS NULL", "e.date_create", "e.".$this->datetouse).",'%Y') = '".$this->db->escape((string) $year)."'"; $sql .= " AND ".$this->where; $sql .= " GROUP BY dm"; $sql .= $this->db->order('dm', 'DESC'); @@ -179,7 +179,7 @@ class ExpenseReportStats extends Stats { $sql = "SELECT date_format(".$this->db->ifsql("e.".$this->datetouse." IS NULL", "e.date_create", "e.".$this->datetouse).",'%m') as dm, avg(".$this->field.")"; $sql .= " FROM ".$this->from; - $sql .= " WHERE date_format(".$this->db->ifsql("e.".$this->datetouse." IS NULL", "e.date_create", "e.".$this->datetouse).",'%Y') = '".$this->db->escape($year)."'"; + $sql .= " WHERE date_format(".$this->db->ifsql("e.".$this->datetouse." IS NULL", "e.date_create", "e.".$this->datetouse).",'%Y') = '".$this->db->escape((string) $year)."'"; $sql .= " AND ".$this->where; $sql .= " GROUP BY dm"; $sql .= $this->db->order('dm', 'DESC'); diff --git a/htdocs/expensereport/class/paymentexpensereport.class.php b/htdocs/expensereport/class/paymentexpensereport.class.php index c0d0d5d09e5..e77828ee57a 100644 --- a/htdocs/expensereport/class/paymentexpensereport.class.php +++ b/htdocs/expensereport/class/paymentexpensereport.class.php @@ -566,7 +566,7 @@ class PaymentExpenseReport extends CommonObject // Insert payment into llx_bank $bank_line_id = $acc->addline( $this->datep, - $this->fk_typepayment, // Payment mode id or code ("CHQ or VIR for example") + (string) $this->fk_typepayment, // Payment mode id or code ("CHQ or VIR for example") $label, -$amount, $this->num_payment, diff --git a/htdocs/exports/export.php b/htdocs/exports/export.php index 8f6f88a21ce..c8039ad7806 100644 --- a/htdocs/exports/export.php +++ b/htdocs/exports/export.php @@ -570,7 +570,7 @@ if ($step == 2 && $datatoexport) { print ''; print '
'; print ''.$langs->trans("SelectExportFields").' '; - $htmlother->select_export_model($exportmodelid, 'exportmodelid', $datatoexport, 1, $user->id); + $htmlother->select_export_model((string) $exportmodelid, 'exportmodelid', $datatoexport, 1, $user->id); print ' '; print ''; print '
'; diff --git a/htdocs/fichinter/agenda.php b/htdocs/fichinter/agenda.php index b6f85933f02..59a19fb4f36 100644 --- a/htdocs/fichinter/agenda.php +++ b/htdocs/fichinter/agenda.php @@ -2,6 +2,7 @@ /* Copyright (C) 2017 Laurent Destailleur * Copyright (C) ---Put here your own copyright and developer email--- * 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 @@ -164,7 +165,7 @@ if ($object->id > 0) { if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, (string) $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); } else { if (!empty($object->fk_project)) { $proj = new Project($db); diff --git a/htdocs/fichinter/contact.php b/htdocs/fichinter/contact.php index d8137fdb262..4640b081548 100644 --- a/htdocs/fichinter/contact.php +++ b/htdocs/fichinter/contact.php @@ -3,6 +3,7 @@ * Copyright (C) 2007-2009 Laurent Destailleur * Copyright (C) 2012 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 @@ -133,8 +134,8 @@ if ($id > 0 || !empty($ref)) { // Ref customer //$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->ficheinter->creer, 'string', '', 0, 1); //$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->ficheinter->creer, 'string', '', null, null, '', 1); - $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); - $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); + $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); + $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); // Thirdparty $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1, 'customer'); // Project @@ -146,7 +147,7 @@ if ($id > 0 || !empty($ref)) { if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, (string) $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); } else { if (!empty($object->fk_project)) { $proj = new Project($db); diff --git a/htdocs/fichinter/document.php b/htdocs/fichinter/document.php index ba7cf13ea01..7c08f1926dd 100644 --- a/htdocs/fichinter/document.php +++ b/htdocs/fichinter/document.php @@ -8,6 +8,7 @@ * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2017 Ferran Marcet * 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 @@ -130,8 +131,8 @@ if ($object->id) { // Ref customer //$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->ficheinter->creer, 'string', '', 0, 1); //$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->ficheinter->creer, 'string', '', null, null, '', 1); - $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); - $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); + $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); + $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); // Thirdparty $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1, 'customer'); // Project @@ -143,7 +144,7 @@ if ($object->id) { if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, (string) $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); } else { if (!empty($object->fk_project)) { $proj = new Project($db); diff --git a/htdocs/fichinter/note.php b/htdocs/fichinter/note.php index 14a78a157be..091bc4209f0 100644 --- a/htdocs/fichinter/note.php +++ b/htdocs/fichinter/note.php @@ -4,6 +4,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2017 Ferran Marcet * 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 @@ -93,8 +94,8 @@ if ($id > 0 || !empty($ref)) { $morehtmlref = '
'; // Ref customer - $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); - $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); + $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); + $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); // Thirdparty $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1, 'customer'); // Project @@ -106,7 +107,7 @@ if ($id > 0 || !empty($ref)) { if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, (string) $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); } else { if (!empty($object->fk_project)) { $proj = new Project($db); diff --git a/htdocs/fichinter/stats/index.php b/htdocs/fichinter/stats/index.php index ec1a1485cb9..98eeef7b786 100644 --- a/htdocs/fichinter/stats/index.php +++ b/htdocs/fichinter/stats/index.php @@ -182,7 +182,7 @@ if (!$mesg) { $px3->SetLegend($legend); $px3->SetYLabel($langs->trans("AmountAverage")); $px3->SetMaxValue($px3->GetCeilMaxValue()); - $px3->SetMinValue($px3->GetFloorMinValue()); + $px3->SetMinValue((int) $px3->GetFloorMinValue()); $px3->SetWidth($WIDTH); $px3->SetHeight($HEIGHT); $px3->SetShading(3); diff --git a/htdocs/product/price_suppliers.php b/htdocs/product/price_suppliers.php index de770bd035f..8915e80df53 100644 --- a/htdocs/product/price_suppliers.php +++ b/htdocs/product/price_suppliers.php @@ -153,7 +153,7 @@ if (empty($reshook)) { if ($id) { $result = $object->fetch($id); //Need dol_clone methode 1 (same object class) because update product use hasbatch method on oldcopy - $object->oldcopy = dol_clone($object, 1); + $object->oldcopy = dol_clone($object, 1); // @phan-suppress-current-line PhanTypeMismatchProperty $object->cost_price = $cost_price; $result = $object->update($object->id, $user); if ($result > 0) { diff --git a/htdocs/ticket/contact.php b/htdocs/ticket/contact.php index 6af140e129c..236dbf26a7a 100644 --- a/htdocs/ticket/contact.php +++ b/htdocs/ticket/contact.php @@ -250,7 +250,7 @@ if ($id > 0 || !empty($track_id) || !empty($ref)) { if ($action != 'editcustomer' && $permissiontoadd) { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetThirdParty'), 0).' '; } - $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, $action == 'editcustomer' ? 'editcustomer' : 'none', '', 1, 0, 0, array(), 1); + $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, (string) $object->socid, $action == 'editcustomer' ? 'editcustomer' : 'none', '', 1, 0, 0, array(), 1); } // Project diff --git a/htdocs/webservices/server_order.php b/htdocs/webservices/server_order.php index b3846902014..61db098da58 100644 --- a/htdocs/webservices/server_order.php +++ b/htdocs/webservices/server_order.php @@ -711,7 +711,7 @@ function createOrder($authentication, $order) $newobject->ref_ext = $order['ref_ext']; $newobject->date = dol_stringtotime($order['date'], 'dayrfc'); // TODO: 'date_due' is not defined in the $order_fields for the WS - verify - $newobject->date_lim_reglement = dol_stringtotime($order['date_due'], 'dayrfc'); + $newobject->date_lim_reglement = dol_stringtotime((string) $order['date_due'], 'dayrfc'); $newobject->note_private = $order['note_private']; $newobject->note_public = $order['note_public']; $newobject->statut = Commande::STATUS_DRAFT; // We start with status draft