From d64298f6c111bf3190bdbbb470e85112796fe11e Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 12 Mar 2025 20:41:50 +0100 Subject: [PATCH] Qual: Fix phan notices (htdocs/compta) (#33427) --- dev/tools/phan/baseline.txt | 29 ++++--------- htdocs/comm/action/card.php | 21 +++++----- htdocs/comm/action/class/actioncomm.class.php | 30 ++++++------- .../comm/action/class/cactioncomm.class.php | 8 +--- htdocs/comm/action/document.php | 6 +-- htdocs/comm/action/index.php | 12 +++--- htdocs/comm/action/info.php | 3 +- htdocs/comm/action/list.php | 29 +++++++------ htdocs/comm/action/peruser.php | 2 +- htdocs/comm/card.php | 24 +++++------ htdocs/comm/mailing/card.php | 42 +++++++++---------- htdocs/comm/mailing/cibles.php | 6 +-- .../mailing/class/advtargetemailing.class.php | 6 +-- htdocs/comm/multiprix.php | 3 +- htdocs/comm/remise.php | 5 ++- htdocs/comm/remx.php | 6 +-- htdocs/core/class/html.form.class.php | 2 +- htdocs/core/class/html.formcompany.class.php | 4 +- htdocs/core/class/html.formfile.class.php | 2 +- htdocs/core/lib/agenda.lib.php | 4 +- 20 files changed, 113 insertions(+), 131 deletions(-) diff --git a/dev/tools/phan/baseline.txt b/dev/tools/phan/baseline.txt index 3b2fa85af8c..60a8efc9180 100644 --- a/dev/tools/phan/baseline.txt +++ b/dev/tools/phan/baseline.txt @@ -9,14 +9,14 @@ */ return [ // # Issue statistics: - // PhanTypeMismatchArgument : 660+ occurrences + // PhanTypeMismatchArgument : 600+ occurrences // PhanUndeclaredProperty : 460+ occurrences - // PhanTypeMismatchArgumentNullable : 200+ occurrences + // PhanTypeMismatchArgumentNullable : 190+ occurrences // PhanTypeMismatchProperty : 140+ occurrences // PhanUndeclaredGlobalVariable : 100+ occurrences // PhanTypeExpectedObjectPropAccess : 20+ occurrences // PhanTypeInvalidDimOffset : 20+ occurrences - // PhanTypeMismatchDimFetch : 20+ occurrences + // PhanTypeMismatchDimFetch : 15+ occurrences // PhanUndeclaredConstant : 15+ occurrences // PhanTypeMismatchArgumentProbablyReal : 10+ occurrences // PhanUndeclaredMethod : 9 occurrences @@ -28,13 +28,10 @@ return [ // PhanPluginUndeclaredVariableIsset : 5 occurrences // PhanParamTooMany : 4 occurrences // PhanPluginDuplicateArrayKey : 4 occurrences - // PhanPluginSuspiciousParamPosition : 2 occurrences // PhanTypeMismatchDimAssignment : 2 occurrences // PhanTypeMismatchReturn : 2 occurrences // PhanTypeSuspiciousStringExpression : 2 occurrences - // PhanPluginBothLiteralsBinaryOp : 1 occurrence // PhanPluginDuplicateExpressionAssignmentOperation : 1 occurrence - // PhanPluginUnknownArrayPropertyType : 1 occurrence // PhanPossiblyUndeclaredVariable : 1 occurrence // PhanTypeExpectedObjectPropAccessButGotNull : 1 occurrence @@ -93,7 +90,6 @@ return [ 'htdocs/admin/mails_ticket.php' => ['PhanTypeMismatchArgumentNullable'], 'htdocs/admin/menus/index.php' => ['PhanTypeMismatchArgument'], 'htdocs/admin/multicurrency.php' => ['PhanTypeMismatchArgument'], - 'htdocs/admin/pdf_other.php' => ['PhanTypeMismatchArgument'], 'htdocs/admin/receiptprinter.php' => ['PhanTypeMismatchArgument'], 'htdocs/admin/system/filecheck.php' => ['PhanTypeMismatchArgument'], 'htdocs/admin/system/modules.php' => ['PhanTypeMismatchArgument'], @@ -132,27 +128,16 @@ return [ 'htdocs/categories/photos.php' => ['PhanTypeMismatchArgument'], 'htdocs/categories/viewcat.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable', 'PhanUndeclaredProperty'], 'htdocs/collab/index.php' => ['PhanUndeclaredProperty'], - 'htdocs/comm/action/card.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanTypeMismatchArgument', 'PhanTypeMismatchProperty'], - 'htdocs/comm/action/class/actioncomm.class.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable'], - 'htdocs/comm/action/class/cactioncomm.class.php' => ['PhanPluginUnknownArrayPropertyType'], - 'htdocs/comm/action/document.php' => ['PhanTypeMismatchArgument'], - 'htdocs/comm/action/index.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty'], - 'htdocs/comm/action/info.php' => ['PhanTypeMismatchArgument', 'PhanUndeclaredProperty'], - 'htdocs/comm/action/list.php' => ['PhanTypeMismatchArgument'], + 'htdocs/comm/action/index.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchProperty'], + 'htdocs/comm/action/info.php' => ['PhanUndeclaredProperty'], 'htdocs/comm/action/pertype.php' => ['PhanTypeComparisonFromArray', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchDimFetch'], 'htdocs/comm/action/peruser.php' => ['PhanTypeComparisonFromArray', 'PhanTypeMismatchArgument'], - 'htdocs/comm/action/rapport/index.php' => ['PhanTypeMismatchArgument'], - 'htdocs/comm/card.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchProperty'], - 'htdocs/comm/mailing/card.php' => ['PhanPluginSuspiciousParamPosition', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable'], - 'htdocs/comm/mailing/cibles.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable', 'PhanUndeclaredProperty'], - 'htdocs/comm/mailing/class/advtargetemailing.class.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable'], + 'htdocs/comm/card.php' => ['PhanTypeMismatchArgument'], + 'htdocs/comm/mailing/cibles.php' => ['PhanUndeclaredProperty'], 'htdocs/comm/mailing/index.php' => ['PhanUndeclaredProperty'], - 'htdocs/comm/multiprix.php' => ['PhanTypeMismatchArgument'], 'htdocs/comm/propal/card.php' => ['PhanTypeMismatchProperty'], 'htdocs/comm/propal/list.php' => ['PhanUndeclaredProperty'], 'htdocs/comm/propal/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'], - 'htdocs/comm/remise.php' => ['PhanTypeMismatchArgument'], - 'htdocs/comm/remx.php' => ['PhanTypeMismatchArgument'], 'htdocs/commande/card.php' => ['PhanTypeMismatchArgument'], 'htdocs/commande/class/api_orders.class.php' => ['PhanTypeMismatchArgument'], 'htdocs/commande/class/commande.class.php' => ['PhanUndeclaredProperty'], diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 9ebc4408438..a698f28d24b 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -285,6 +285,7 @@ if (empty($reshook) && $action == 'classin' && ($user->hasRight('agenda', 'allac // Action clone object if (empty($reshook) && $action == 'confirm_clone' && $confirm == 'yes' && $usercancreate) { + // @phan-suppress-next-line PhanPluginBothLiteralsBinaryOp if (1 == 0 && !GETPOST('clone_content') && !GETPOST('clone_receivers')) { setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors'); } else { @@ -859,7 +860,7 @@ if (empty($reshook) && $action == 'update' && $usercancreate) { $object->fetch($id); $object->fetch_optionals(); $object->fetch_userassigned(); - $object->oldcopy = dol_clone($object, 2); + $object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty // Clean parameters if ($fulldayevent) { @@ -1138,7 +1139,7 @@ if (empty($reshook) && $action == 'confirm_delete' && GETPOST("confirm") == 'yes $object->fetch($id); $object->fetch_optionals(); $object->fetch_userassigned(); - $object->oldcopy = dol_clone($object, 2); + $object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty if ($user->hasRight('agenda', 'myactions', 'delete') || $user->hasRight('agenda', 'allactions', 'delete')) { @@ -1547,7 +1548,7 @@ if ($action == 'create') { } } print '
'; - print $form->select_dolusers_forevent(($action == 'create' ? 'add' : 'update'), 'assignedtouser', 1, array(), 0, '', array(), 0, 0, 0, 'u.statut:<>:0', 1, $listofuserid, $listofcontactid, $listofotherid); + print $form->select_dolusers_forevent(($action == 'create' ? 'add' : 'update'), 'assignedtouser', 1, array(), 0, '', array(), '0', 0, 0, 'u.statut:<>:0', 1, $listofuserid, $listofcontactid, $listofotherid); print '
'; print ''; @@ -1588,7 +1589,7 @@ if ($action == 'create') { } } print '
'; - print $form->select_dolresources_forevent(($action == 'create' ? 'add' : 'update'), 'assignedtoresource', 1, array(), 0, '', array(), 0, 0, 0, 'AND u.statut != 0', 1, $listofresourceid); + print $form->select_dolresources_forevent(($action == 'create' ? 'add' : 'update'), 'assignedtoresource', 1, array(), 0, '', array(), '0', 0, 0, 'AND u.statut != 0', 1, $listofresourceid); print '
'; print ''; } @@ -2169,7 +2170,7 @@ if ($id > 0) { print ''.$langs->trans("ActionAssignedTo").''; print '
'; - print $form->select_dolusers_forevent(($action == 'create' ? 'add' : 'update'), 'assignedtouser', 1, array(), 0, '', array(), 0, 0, 0, 'u.statut:<>:0', 1, $listofuserid, $listofcontactid, $listofotherid, $caneditdateorowner); + print $form->select_dolusers_forevent(($action == 'create' ? 'add' : 'update'), 'assignedtouser', 1, array(), 0, '', array(), '0', 0, 0, 'u.statut:<>:0', 1, $listofuserid, $listofcontactid, $listofotherid, (int) $caneditdateorowner); print '
'; /*if (in_array($user->id,array_keys($listofuserid))) { @@ -2187,7 +2188,7 @@ if ($id > 0) { // Status print ''.$langs->trans("Status").' / '.$langs->trans("Percentage").''; $percent = GETPOSTISSET("percentage") ? GETPOSTINT("percentage") : $object->percentage; - $formactions->form_select_status_action('formaction', $percent, 1, 'complete', 0, 0, 'maxwidth200'); + $formactions->form_select_status_action('formaction', (string) $percent, 1, 'complete', 0, 0, 'maxwidth200'); print ''; // Tags-Categories @@ -2384,7 +2385,7 @@ if ($id > 0) { // Mail Model if (getDolGlobalString('AGENDA_REMINDER_EMAIL')) { print ''.$langs->trans("EMailTemplates").''; - print $form->selectModelMail('actioncommsend', 'actioncomm_send', 1, 1, $actionCommReminder->fk_email_template); + print $form->selectModelMail('actioncommsend', 'actioncomm_send', 1, 1, (string) $actionCommReminder->fk_email_template); print ''; } @@ -2530,7 +2531,7 @@ if ($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); @@ -2648,7 +2649,7 @@ if ($id > 0) { $listofcontactid = array(); // not used yet $listofotherid = array(); // not used yet print '
'; - print $form->select_dolusers_forevent('view', 'assignedtouser', 1, array(), 0, '', array(), 0, 0, 0, '', ($object->datep != $object->datef) ? 1 : 0, $listofuserid, $listofcontactid, $listofotherid); + print $form->select_dolusers_forevent('view', 'assignedtouser', 1, array(), 0, '', array(), '0', 0, 0, '', ($object->datep != $object->datef) ? 1 : 0, $listofuserid, $listofcontactid, $listofotherid); print '
'; /* if ($object->datep != $object->datef && in_array($user->id,array_keys($listofuserid))) @@ -2861,7 +2862,7 @@ if ($id > 0) { $delallowed = $user->hasRight('agenda', 'myactions', 'create'); - print $formfile->showdocuments('actions', $object->id, $filedir, $urlsource, $genallowed, $delallowed, '', 0, 0, 0, 0, 0, '', '', '', $langs->getDefaultLang()); + print $formfile->showdocuments('actions', (string) $object->id, $filedir, $urlsource, $genallowed, $delallowed, '', 0, 0, 0, 0, 0, '', '', '', $langs->getDefaultLang()); print '
'; diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 99030dac62b..c2771df97ee 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -6,7 +6,7 @@ * Copyright (C) 2015 Marcos García * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2018-2025 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 William Mead * * This program is free software; you can redistribute it and/or modify @@ -72,7 +72,7 @@ class ActionComm extends CommonObject public $id; /** - * @var string Id of the event. Use $id as possible + * @var string Id of the event. Use as possible */ public $ref; @@ -382,7 +382,7 @@ class ActionComm extends CommonObject public $recurid; /** @var string Rule of recurring */ public $recurrule; - /** @var string Repeat until this date */ + /** @var int|'' Repeat until this date */ public $recurdateend; /** @var int Duration of phone call when the event is a phone call */ @@ -579,7 +579,7 @@ class ActionComm extends CommonObject $sql .= "'".$this->db->idate($now)."', "; // date creation $sql .= "'".$this->db->idate($this->datep)."', "; // date start event $sql .= (strval($this->datef) != '' ? "'".$this->db->idate($this->datef)."'" : "null").", "; - $sql .= ((isset($this->durationp) && $this->durationp >= 0 && $this->durationp != '') ? "'".$this->db->escape($this->durationp)."'" : "null").", "; // deprecated + $sql .= ((isset($this->durationp) && $this->durationp >= 0 && $this->durationp != '') ? "'".$this->db->escape((string) $this->durationp)."'" : "null").", "; // deprecated $sql .= (isset($this->type_id) ? $this->type_id : "null").","; $sql .= ($code ? ("'".$this->db->escape($code)."'") : "null").", "; $sql .= (!empty($this->ref_ext) ? "'".$this->db->escape($this->ref_ext)."'" : "null").", "; @@ -590,14 +590,14 @@ class ActionComm extends CommonObject $sql .= (isset($user->id) && $user->id > 0 ? $user->id : "null").", "; $sql .= ($userownerid > 0 ? $userownerid : "null").", "; $sql .= "'".$this->db->escape($this->label)."', "; - $sql .= "'".$this->db->escape($this->percentage)."', "; - $sql .= "'".$this->db->escape($this->priority)."', "; - $sql .= "'".$this->db->escape($this->fulldayevent)."', "; + $sql .= "'".$this->db->escape((string) $this->percentage)."', "; + $sql .= "'".$this->db->escape((string) $this->priority)."', "; + $sql .= "'".$this->db->escape((string) $this->fulldayevent)."', "; $sql .= "'".$this->db->escape($this->location)."', "; - $sql .= "'".$this->db->escape($this->transparency)."', "; + $sql .= "'".$this->db->escape((string) $this->transparency)."', "; $sql .= (!empty($this->elementid) ? ((int) $this->elementid) : "null").", "; $sql .= (!empty($this->elementtype) ? "'".$this->db->escape($this->elementtype)."'" : "null").", "; - $sql .= (!empty($this->fk_bookcal_calendar) ? "'".$this->db->escape($this->fk_bookcal_calendar)."'" : "null").", "; + $sql .= (!empty($this->fk_bookcal_calendar) ? "'".$this->db->escape((string) $this->fk_bookcal_calendar)."'" : "null").", "; $sql .= ((int) $conf->entity).","; $sql .= (!empty($extraparams) ? "'".$this->db->escape($extraparams)."'" : "null").", "; // Fields emails @@ -1184,21 +1184,21 @@ class ActionComm extends CommonObject $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."actioncomm"; - $sql .= " SET percent = '".$this->db->escape($this->percentage)."'"; + $sql .= " SET percent = '".$this->db->escape((string) $this->percentage)."'"; $sql .= ", fk_action = ".(int) $this->type_id; $sql .= ", code = " . ($code ? "'".$this->db->escape($code)."'" : "null"); $sql .= ", label = ".($this->label ? "'".$this->db->escape($this->label)."'" : "null"); $sql .= ", datep = ".(strval($this->datep) != '' ? "'".$this->db->idate($this->datep)."'" : 'null'); $sql .= ", datep2 = ".(strval($this->datef) != '' ? "'".$this->db->idate($this->datef)."'" : 'null'); - $sql .= ", durationp = ".(isset($this->durationp) && $this->durationp >= 0 && $this->durationp != '' ? "'".$this->db->escape($this->durationp)."'" : "null"); // deprecated + $sql .= ", durationp = ".(isset($this->durationp) && $this->durationp >= 0 && $this->durationp != '' ? "'".$this->db->escape((string) $this->durationp)."'" : "null"); // deprecated $sql .= ", note = '".$this->db->escape($this->note_private)."'"; $sql .= ", fk_project =".($this->fk_project > 0 ? ((int) $this->fk_project) : "null"); $sql .= ", fk_soc =".($socid > 0 ? ((int) $socid) : "null"); $sql .= ", fk_contact =".($contactid > 0 ? ((int) $contactid) : "null"); - $sql .= ", priority = '".$this->db->escape($this->priority)."'"; - $sql .= ", fulldayevent = '".$this->db->escape($this->fulldayevent)."'"; + $sql .= ", priority = '".$this->db->escape((string) $this->priority)."'"; + $sql .= ", fulldayevent = '".$this->db->escape((string) $this->fulldayevent)."'"; $sql .= ", location = ".($this->location ? "'".$this->db->escape($this->location)."'" : "null"); - $sql .= ", transparency = '".$this->db->escape($this->transparency)."'"; + $sql .= ", transparency = '".$this->db->escape((string) $this->transparency)."'"; $sql .= ", fk_user_mod = ".((int) $user->id); $sql .= ", fk_user_action = ".($userownerid > 0 ? ((int) $userownerid) : "null"); if (!empty($this->fk_element)) { @@ -2761,7 +2761,7 @@ class ActionComm extends CommonObject $errors_to = getDolGlobalString('MAIN_MAIL_ERRORS_TO'); // Mail Creation - $cMailFile = new CMailFile($sendTopic, $to, $from, $sendContent, array(), array(), array(), '', "", 0, 1, $errors_to, '', '', '', '', ''); + $cMailFile = new CMailFile($sendTopic, (string) $to, $from, $sendContent, array(), array(), array(), '', "", 0, 1, $errors_to, '', '', '', '', ''); // Sending Mail if ($cMailFile->sendfile()) { diff --git a/htdocs/comm/action/class/cactioncomm.class.php b/htdocs/comm/action/class/cactioncomm.class.php index db3fcfe1bbc..19b0fdf74e3 100644 --- a/htdocs/comm/action/class/cactioncomm.class.php +++ b/htdocs/comm/action/class/cactioncomm.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2004-2014 Laurent Destailleur - * 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 @@ -81,12 +81,6 @@ class CActionComm */ public $picto; - /** - * @var array array of type_actions // TODO: Remove or explain - */ - public $type_actions = array(); - - /** * @var array{id:array,code:array,all:array} Used to return value by some methods */ diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php index 8eb19ae19cd..6f211112a25 100644 --- a/htdocs/comm/action/document.php +++ b/htdocs/comm/action/document.php @@ -6,7 +6,7 @@ * Copyright (C) 2005 Simon TOSSER * Copyright (C) 2013 Cédric Salvador * 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 @@ -208,7 +208,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); @@ -299,7 +299,7 @@ if ($object->id > 0) { $listofcontactid = array(); // not used yet $listofotherid = array(); // not used yet print '
'; - print $form->select_dolusers_forevent('view', 'assignedtouser', 1, array(), 0, '', array(), 0, 0, 0, '', ($object->datep != $object->datef) ? 1 : 0, $listofuserid, $listofcontactid, $listofotherid); + print $form->select_dolusers_forevent('view', 'assignedtouser', 1, array(), 0, '', array(), '0', 0, 0, '', ($object->datep != $object->datef) ? 1 : 0, $listofuserid, $listofcontactid, $listofotherid); print '
'; /*if (in_array($user->id,array_keys($listofuserid))) { diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index a1d8b1605c9..ca410e07fa3 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -109,7 +109,7 @@ $mode = GETPOST('mode', 'aZ09'); if (empty($mode) && preg_match('/show_/', $action)) { $mode = $action; // For backward compatibility } -$resourceid = GETPOST("search_resourceid", 'int'); +$resourceid = GETPOSTINT("search_resourceid"); $year = GETPOSTINT("year") ? GETPOSTINT("year") : date("Y"); $month = GETPOSTINT("month") ? GETPOSTINT("month") : date("m"); $week = GETPOSTINT("week") ? GETPOSTINT("week") : date("W"); @@ -920,7 +920,7 @@ if ($resql) { $event = new ActionComm($db); $event->id = $obj->id; - $event->ref = $event->id; + $event->ref = (string) $event->id; $event->fulldayevent = $obj->fulldayevent; @@ -1076,7 +1076,7 @@ if ($showbirthday) { $event = new ActionComm($db); $event->id = $obj->rowid; // We put contact id in action id for birthdays events - $event->ref = $event->id; + $event->ref = (string) $event->id; $datebirth = dol_stringtotime($obj->birthday, 1); //print 'ee'.$obj->birthday.'-'.$datebirth; @@ -1159,7 +1159,7 @@ if ($user->hasRight("holiday", "read")) { // Need the id of the leave object for link to it $event->id = $obj->rowid; - $event->ref = $event->id; + $event->ref = (string) $event->id; $event->type_code = 'HOLIDAY'; $event->type_label = ''; @@ -1420,7 +1420,7 @@ if (count($listofextcals)) { if ($addevent) { $event->id = $icalevent['UID']; - $event->ref = $event->id; + $event->ref = (string) $event->id; $userId = $userstatic->findUserIdByEmail($namecal); if (!empty($userId) && $userId > 0) { $event->userassigned[$userId] = $userId; @@ -1861,7 +1861,7 @@ $db->close(); * @param int $showinfo Add extended information (used by day and week view) * @param int $minheight Minimum height for each event. 60px by default. * @param int<-1,1> $nonew 0=Add "new entry button", 1=No "new entry button", -1=Only "new entry button" - * @param array{}|array{0:array{0:int,1:int,2:int},1:array{0:int,1:int,2:int},2:array{0:int,1:int,2:int}} $bookcalcalendarsarray Used for Bookcal module array of calendar of bookcal + * @param array{}|array{help:'toreporttype',0:array{0:int,1:int,2:int},1:array{0:int,1:int,2:int},2:array{0:int,1:int,2:int}} $bookcalcalendarsarray Used for Bookcal module array of calendar of bookcal * @return void */ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint = 0, $maxnbofchar = 16, $newparam = '', $showinfo = 0, $minheight = 60, $nonew = 0, $bookcalcalendarsarray = array()) diff --git a/htdocs/comm/action/info.php b/htdocs/comm/action/info.php index bfaa5257c68..62dffe36493 100644 --- a/htdocs/comm/action/info.php +++ b/htdocs/comm/action/info.php @@ -2,6 +2,7 @@ /* Copyright (C) 2004 Rodolphe Quiedeville * Copyright (C) 2004-2023 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 @@ -130,7 +131,7 @@ if (isModEnabled('project')) { 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/comm/action/list.php b/htdocs/comm/action/list.php index 47debff0fd2..844569a9113 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -6,7 +6,7 @@ * Copyright (C) 2017 Open-DSI * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2020 Tobias Sekan - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify @@ -167,26 +167,25 @@ if (!$user->hasRight('agenda', 'allactions', 'read') || $filter == 'mine') { // } $arrayfields = array( - 'a.id' => array('label' => "Ref", 'checked' => 1), - 'owner' => array('label' => "Owner", 'checked' => 1), - 'c.libelle' => array('label' => "Type", 'checked' => 1), - 'a.label' => array('label' => "Title", 'checked' => 1), - 'a.note' => array('label' => 'Description', 'checked' => 0), - 'a.datep' => array('label' => "DateStart", 'checked' => 1), - 'a.datep2' => array('label' => "DateEnd", 'checked' => 1), - 's.nom' => array('label' => "ThirdParty", 'checked' => 1), - 'a.fk_contact' => array('label' => "Contact", 'checked' => 0), - 'a.fk_element' => array('label' => "LinkedObject", 'checked' => 1, 'enabled' => (getDolGlobalString('AGENDA_SHOW_LINKED_OBJECT'))), - 'a.datec' => array('label' => 'DateCreation', 'checked' => 0, 'position' => 510), - 'a.tms' => array('label' => 'DateModification', 'checked' => 0, 'position' => 520), - 'a.percent' => array('label' => "Status", 'checked' => 1, 'position' => 1000) + 'a.id' => array('label' => "Ref", 'checked' => '1'), + 'owner' => array('label' => "Owner", 'checked' => '1'), + 'c.libelle' => array('label' => "Type", 'checked' => '1'), + 'a.label' => array('label' => "Title", 'checked' => '1'), + 'a.note' => array('label' => 'Description', 'checked' => '0'), + 'a.datep' => array('label' => "DateStart", 'checked' => '1'), + 'a.datep2' => array('label' => "DateEnd", 'checked' => '1'), + 's.nom' => array('label' => "ThirdParty", 'checked' => '1'), + 'a.fk_contact' => array('label' => "Contact", 'checked' => '0'), + 'a.fk_element' => array('label' => "LinkedObject", 'checked' => '1', 'enabled' => (getDolGlobalString('AGENDA_SHOW_LINKED_OBJECT'))), + 'a.datec' => array('label' => 'DateCreation', 'checked' => '0', 'position' => 510), + 'a.tms' => array('label' => 'DateModification', 'checked' => '0', 'position' => 520), + 'a.percent' => array('label' => "Status", 'checked' => '1', 'position' => 1000) ); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); -'@phan-var-force array,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan $result = restrictedArea($user, 'agenda', 0, '', 'myactions'); if ($user->socid && $socid) { diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 805777bc1fb..546f69d1379 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -821,7 +821,7 @@ if ($search_categ_cus != -1) { if ($search_categ_cus == -2) { $sql .= " AND NOT EXISTS (SELECT ca.fk_actioncomm FROM ".MAIN_DB_PREFIX."categorie_actioncomm as ca WHERE ca.fk_actioncomm = a.id)"; } elseif ($search_categ_cus > 0) { - $sql .= " AND EXISTS (SELECT ca.fk_actioncomm FROM ".MAIN_DB_PREFIX."categorie_actioncomm as ca WHERE ca.fk_actioncomm = a.id AND ca.fk_categorie IN (".$db->sanitize($search_categ_cus)."))"; + $sql .= " AND EXISTS (SELECT ca.fk_actioncomm FROM ".MAIN_DB_PREFIX."categorie_actioncomm as ca WHERE ca.fk_actioncomm = a.id AND ca.fk_categorie IN (".$db->sanitize((string) $search_categ_cus)."))"; } } // Sort on date diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 7a11094875d..38e684f76cd 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -11,7 +11,7 @@ * Copyright (C) 2015 Marcos García * Copyright (C) 2020 Open-Dsi * Copyright (C) 2022 Anthony Berton - * 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 @@ -219,7 +219,7 @@ if (empty($reshook)) { // Transport mode if ($action == 'settransportmode' && $user->hasRight('societe', 'creer')) { $object->fetch($id); - $result = $object->setTransportMode(GETPOST('transport_mode_id', 'alpha')); + $result = $object->setTransportMode(GETPOSTINT('transport_mode_id')); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } @@ -304,7 +304,7 @@ if (empty($reshook)) { if ($action == 'update_extras' && $user->hasRight('societe', 'creer')) { $object->fetch($id); - $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')); @@ -470,9 +470,9 @@ if ($object->id > 0) { print ''; print ''; if ($action == 'editconditions') { - $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->cond_reglement_id, 'cond_reglement_id', 1, '', 1, $object->deposit_percent); + $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, (string) $object->cond_reglement_id, 'cond_reglement_id', 1, '', 1, $object->deposit_percent); } else { - $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->cond_reglement_id, 'none', 0, '', 1, $object->deposit_percent); + $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, (string) $object->cond_reglement_id, 'none', 0, '', 1, $object->deposit_percent); } print ""; print ''; @@ -488,9 +488,9 @@ if ($object->id > 0) { print ''; print ''; if ($action == 'editmode') { - $form->form_modes_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT', 1, 1); + $form->form_modes_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, (string) $object->mode_reglement_id, 'mode_reglement_id', 'CRDT', 1, 1); } else { - $form->form_modes_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->mode_reglement_id, 'none'); + $form->form_modes_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, (string) $object->mode_reglement_id, 'none'); } print ""; print ''; @@ -507,9 +507,9 @@ if ($object->id > 0) { print ''; print ''; if ($action == 'editbankaccount') { - $form->formSelectAccount($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->fk_account, 'fk_account', 1); + $form->formSelectAccount($_SERVER['PHP_SELF'].'?socid='.$object->id, (string) $object->fk_account, 'fk_account', 1); } else { - $form->formSelectAccount($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->fk_account, 'none'); + $form->formSelectAccount($_SERVER['PHP_SELF'].'?socid='.$object->id, (string) $object->fk_account, 'none'); } print ""; print ''; @@ -634,9 +634,9 @@ if ($object->id > 0) { print ''; print ''; if ($action == 'editshipping') { - $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->shipping_method_id, 'shipping_method_id', 1); + $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?socid='.$object->id, (string) $object->shipping_method_id, 'shipping_method_id', 1); } else { - $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->shipping_method_id, 'none'); + $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?socid='.$object->id, (string) $object->shipping_method_id, 'none'); } print ""; print ''; @@ -717,7 +717,7 @@ if ($object->id > 0) { print ''; print ''; if ($action == 'editlevel') { - $formcompany->form_prospect_level($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->fk_prospectlevel, 'prospect_level_id', 1); + $formcompany->form_prospect_level($_SERVER['PHP_SELF'].'?socid='.$object->id, (int) $object->fk_prospectlevel, 'prospect_level_id', 1); } else { print $object->getLibProspLevel(); } diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 0920ddae516..72e5b54d99a 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -3,7 +3,7 @@ * Copyright (C) 2005-2019 Laurent Destailleur * Copyright (C) 2005-2016 Regis Houssin * Copyright (C) 2021 Waël Almoman - * 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 @@ -153,7 +153,7 @@ if (empty($reshook)) { if (!GETPOST("clone_content", 'alpha') && !GETPOST("clone_receivers", 'alpha')) { setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors'); } else { - $result = $object->createFromClone($user, $object->id, GETPOST("clone_content", 'alpha'), GETPOST("clone_receivers", 'alpha')); + $result = $object->createFromClone($user, $object->id, GETPOSTINT("clone_content"), GETPOSTINT("clone_receivers")); if ($result > 0) { header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result); exit; @@ -452,14 +452,14 @@ if (empty($reshook)) { // Loop finished, set global statut of mail if ($nbko > 0) { $statut = 2; // Status 'sent partially' (because at least one error) - setEventMessages($langs->transnoentitiesnoconv("EMailSentToNRecipients", $nbok), null, 'mesgs'); + setEventMessages($langs->transnoentitiesnoconv("EMailSentToNRecipients", (string) $nbok), null, 'mesgs'); } else { if ($nbok >= $num) { $statut = 3; // Send to everybody } else { $statut = 2; // Status 'sent partially' (because not send to everybody) } - setEventMessages($langs->transnoentitiesnoconv("EMailSentToNRecipients", $nbok), null, 'mesgs'); + setEventMessages($langs->transnoentitiesnoconv("EMailSentToNRecipients", (string) $nbok), null, 'mesgs'); } $sql = "UPDATE ".MAIN_DB_PREFIX."mailing SET statut=".((int) $statut)." WHERE rowid = ".((int) $object->id); @@ -640,18 +640,18 @@ if (empty($reshook)) { } // Action of file remove - if (GETPOST("removedfile") && $permissiontocreate) { + if (GETPOSTINT("removedfile") && $permissiontocreate) { $upload_dir = $conf->mailing->dir_output."/".get_exdir($object->id, 2, 0, 1, $object, 'mailing'); require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - dol_remove_file_process(GETPOST('removedfile'), 0, 0); // We really delete file linked to mailing + dol_remove_file_process(GETPOSTINT('removedfile'), 0, 0); // We really delete file linked to mailing $action = "edit"; } // Action of emailing update - if ($action == 'update' && !GETPOST("removedfile") && !$cancel && $permissiontocreate) { + if ($action == 'update' && !GETPOSTINT("removedfile") && !$cancel && $permissiontocreate) { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $isupload = 0; @@ -1030,7 +1030,7 @@ if ($action == 'create') { // aaa // From print ''; - print $form->editfieldkey("MailFrom", 'email_from', $object->email_from, $object, $user->hasRight('mailing', 'creer') && $object->status < $object::STATUS_SENTCOMPLETELY, 'string'); + print $form->editfieldkey("MailFrom", 'email_from', $object->email_from, $object, (int) ($user->hasRight('mailing', 'creer') && $object->status < $object::STATUS_SENTCOMPLETELY), 'string'); print ''; print $form->editfieldval("MailFrom", 'email_from', $object->email_from, $object, $user->hasRight('mailing', 'creer') && $object->status < $object::STATUS_SENTCOMPLETELY, 'string'); $email = CMailFile::getValidAddress($object->email_from, 2); @@ -1047,13 +1047,13 @@ if ($action == 'create') { // aaa // Errors to if ($object->messtype != 'sms') { print ''; - print $form->editfieldkey("MailErrorsTo", 'email_errorsto', $object->email_errorsto, $object, $user->hasRight('mailing', 'creer') && $object->status < $object::STATUS_SENTCOMPLETELY, 'string'); + print $form->editfieldkey("MailErrorsTo", 'email_errorsto', $object->email_errorsto, $object, (int) ($user->hasRight('mailing', 'creer') && $object->status < $object::STATUS_SENTCOMPLETELY), 'string'); print ''; print $form->editfieldval("MailErrorsTo", 'email_errorsto', $object->email_errorsto, $object, $user->hasRight('mailing', 'creer') && $object->status < $object::STATUS_SENTCOMPLETELY, 'string'); $emailarray = CMailFile::getArrayAddress($object->email_errorsto); foreach ($emailarray as $email => $name) { if ($name != $email) { - print dol_escape_htmltag($name).' <'.$email; + print dol_escape_htmltag((string) $name).' <'.$email; print '>'; if ($email && !isValidEmail($email)) { $langs->load("errors"); @@ -1072,7 +1072,7 @@ if ($action == 'create') { // aaa // Reply to if ($object->messtype != 'sms') { print ''; - print $form->editfieldkey("MailReply", 'email_replyto', $object->email_replyto, $object, $user->hasRight('mailing', 'creer') && $object->status < $object::STATUS_SENTCOMPLETELY, 'string'); + print $form->editfieldkey("MailReply", 'email_replyto', $object->email_replyto, $object, (int) ($user->hasRight('mailing', 'creer') && $object->status < $object::STATUS_SENTCOMPLETELY), 'string'); print ''; print $form->editfieldval("MailReply", 'email_replyto', $object->email_replyto, $object, $user->hasRight('mailing', 'creer') && $object->status < $object::STATUS_SENTCOMPLETELY, 'string'); $email = CMailFile::getValidAddress($object->email_replyto, 2); @@ -1102,19 +1102,19 @@ if ($action == 'create') { // aaa print ''; $nbemail = ($object->nbemail ? $object->nbemail : 0); if (is_numeric($nbemail)) { - $text = ''; + $htmltooltip = ''; if ((getDolGlobalString('MAILING_LIMIT_SENDBYWEB') && getDolGlobalInt('MAILING_LIMIT_SENDBYWEB') < $nbemail) && ($object->status == 1 || ($object->status == 2 && $nbtry < $nbemail))) { if (getDolGlobalInt('MAILING_LIMIT_SENDBYWEB') > 0) { - $text .= $langs->trans('LimitSendingEmailing', getDolGlobalString('MAILING_LIMIT_SENDBYWEB')); + $htmltooltip .= $langs->trans('LimitSendingEmailing', getDolGlobalString('MAILING_LIMIT_SENDBYWEB')); } else { - $text .= $langs->trans('SendingFromWebInterfaceIsNotAllowed'); + $htmltooltip .= $langs->trans('SendingFromWebInterfaceIsNotAllowed'); } } if (empty($nbemail)) { $nbemail .= ' '.img_warning('').' '.$langs->trans("NoTargetYet").''; } - if ($text) { - print $form->textwithpicto($nbemail, $text, 1, 'warning'); + if ($htmltooltip) { + print $form->textwithpicto($nbemail, $htmltooltip, 1, 'warning'); } else { print $nbemail; } @@ -1410,19 +1410,19 @@ if ($action == 'create') { // aaa print ''; $nbemail = ($object->nbemail ? $object->nbemail : 0); if (is_numeric($nbemail)) { - $text = ''; + $htmltooltip = ''; if ((getDolGlobalString('MAILING_LIMIT_SENDBYWEB') && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) && ($object->status == 1 || $object->status == 2)) { if (getDolGlobalInt('MAILING_LIMIT_SENDBYWEB') > 0) { - $text .= $langs->trans('LimitSendingEmailing', getDolGlobalString('MAILING_LIMIT_SENDBYWEB')); + $htmltooltip .= $langs->trans('LimitSendingEmailing', getDolGlobalString('MAILING_LIMIT_SENDBYWEB')); } else { - $text .= $langs->trans('SendingFromWebInterfaceIsNotAllowed'); + $htmltooltip .= $langs->trans('SendingFromWebInterfaceIsNotAllowed'); } } if (empty($nbemail)) { $nbemail .= ' '.img_warning('').' '.$langs->trans("NoTargetYet").''; } - if ($text) { - print $form->textwithpicto($nbemail, $text, 1, 'warning'); + if ($htmltooltip) { + print $form->textwithpicto($nbemail, $htmltooltip, 1, 'warning'); } else { print $nbemail; } diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index cc3e8e07d70..f64332ba50a 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -3,7 +3,7 @@ * Copyright (C) 2005-2024 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin * Copyright (C) 2014 Florian Henry - * 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 @@ -393,7 +393,7 @@ if ($object->fetch($id) >= 0) { $emailarray = CMailFile::getArrayAddress($object->email_errorsto); foreach ($emailarray as $email => $name) { if ($name != $email) { - print dol_escape_htmltag($name).' <'.$email; + print dol_escape_htmltag((string) $name).' <'.$email; print '>'; if ($email && !isValidEmail($email)) { $langs->load("errors"); @@ -412,7 +412,7 @@ if ($object->fetch($id) >= 0) { // Reply to if ($object->messtype != 'sms') { print ''; - print $form->editfieldkey("MailReply", 'email_replyto', $object->email_replyto, $object, $user->hasRight('mailing', 'creer') && $object->status < $object::STATUS_SENTCOMPLETELY, 'string'); + print $form->editfieldkey("MailReply", 'email_replyto', $object->email_replyto, $object, (int) ($user->hasRight('mailing', 'creer') && $object->status < $object::STATUS_SENTCOMPLETELY), 'string'); print ''; print $form->editfieldval("MailReply", 'email_replyto', $object->email_replyto, $object, $user->hasRight('mailing', 'creer') && $object->status < $object::STATUS_SENTCOMPLETELY, 'string'); $email = CMailFile::getValidAddress($object->email_replyto, 2); diff --git a/htdocs/comm/mailing/class/advtargetemailing.class.php b/htdocs/comm/mailing/class/advtargetemailing.class.php index 0fd4ea09ccd..14da007e650 100644 --- a/htdocs/comm/mailing/class/advtargetemailing.class.php +++ b/htdocs/comm/mailing/class/advtargetemailing.class.php @@ -2,7 +2,7 @@ /* Advance Targeting Emailing for mass emailing module * Copyright (C) 2013 Florian Henry * 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 @@ -186,7 +186,7 @@ class AdvanceTargetingMailing extends CommonObject $sql .= ") VALUES ("; $sql .= " ".(!isset($this->name) ? 'NULL' : "'".$this->db->escape($this->name)."'").","; $sql .= " ".((int) $conf->entity).","; - $sql .= " ".(!isset($this->fk_element) ? 'NULL' : "'".$this->db->escape($this->fk_element)."'").","; + $sql .= " ".(!isset($this->fk_element) ? 'NULL' : "'".$this->db->escape((string) $this->fk_element)."'").","; $sql .= " ".(!isset($this->type_element) ? 'NULL' : "'".$this->db->escape($this->type_element)."'").","; $sql .= " ".(!isset($this->filtervalue) ? 'NULL' : "'".$this->db->escape($this->filtervalue)."'").","; $sql .= " ".((int) $user->id).","; @@ -734,7 +734,7 @@ class AdvanceTargetingMailing extends CommonObject if (!empty($arrayquery['contact_no_email'])) { $tmpwhere .= "(t.email IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE t.entity IN (".getEntity('mailing').") AND email = '".$this->db->escape($arrayquery['contact_no_email'])."'))"; } else { - $tmpwhere .= "(t.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE t.entity IN (".getEntity('mailing').") AND email = '".$this->db->escape($arrayquery['contact_no_email'])."'))"; + $tmpwhere .= "(t.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE t.entity IN (".getEntity('mailing').") AND email = '".$this->db->escape((string) $arrayquery['contact_no_email'])."'))"; } $sqlwhere[] = $tmpwhere; } diff --git a/htdocs/comm/multiprix.php b/htdocs/comm/multiprix.php index bf469345b8f..cdf5ae854bc 100644 --- a/htdocs/comm/multiprix.php +++ b/htdocs/comm/multiprix.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2006 Andre Cianfarani * 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 @@ -68,7 +69,7 @@ $result = restrictedArea($user, 'societe', $id, '&societe', '', 'fk_soc', 'rowid if ($action == 'setpricelevel' && $user->hasRight('societe', 'creer')) { $soc = new Societe($db); $soc->fetch($id); - $soc->setPriceLevel(GETPOST("price_level"), $user); + $soc->setPriceLevel(GETPOSTINT("price_level"), $user); header("Location: multiprix.php?id=".$id); exit; diff --git a/htdocs/comm/remise.php b/htdocs/comm/remise.php index 3bbd792aea0..0cef5254d90 100644 --- a/htdocs/comm/remise.php +++ b/htdocs/comm/remise.php @@ -2,6 +2,7 @@ /* Copyright (C) 2001-2004 Rodolphe Quiedeville * Copyright (C) 2004-2021 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 @@ -78,9 +79,9 @@ if ($action == 'setremise' && $user->hasRight('societe', 'lire')) { $discount_type = GETPOSTINT('discount_type'); if (!empty($discount_type)) { - $result = $object->set_remise_supplier(price2num(GETPOST("remise")), GETPOST("note", "alphanohtml"), $user); + $result = $object->set_remise_supplier((float) price2num(GETPOST("remise")), GETPOST("note", "alphanohtml"), $user); } else { - $result = $object->set_remise_client(price2num(GETPOST("remise")), GETPOST("note", "alphanohtml"), $user); + $result = $object->set_remise_client((float) price2num(GETPOST("remise")), GETPOST("note", "alphanohtml"), $user); } if ($result > 0) { diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php index aee066eca43..24f2baf1c8a 100644 --- a/htdocs/comm/remx.php +++ b/htdocs/comm/remx.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2019 Laurent Destailleur * Copyright (C) 2008 Raphael Bertrand (Resultic) * 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 @@ -187,7 +187,7 @@ if ($action == 'setremise' && $permissiontocreate) { if (!$error) { $soc = new Societe($db); $soc->fetch($id); - $discountid = $soc->set_remise_except($amount, $user, $desc, $tva_tx, $discount_type, $price_base_type); + $discountid = $soc->set_remise_except((float) $amount, $user, $desc, $tva_tx, $discount_type, $price_base_type); if ($discountid > 0) { if (!empty($backtopage)) { @@ -388,7 +388,7 @@ if ($socid > 0) { // VAT print ''.$langs->trans("VAT").''; print ''; - print $form->load_tva('tva_tx', (GETPOSTISSET('tva_tx') ? GETPOST('tva_tx', 'alpha') : getDolGlobalString('MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS', 0)), $mysoc, $object, 0, 0, '', 0, 1); + print $form->load_tva('tva_tx', (GETPOSTISSET('tva_tx') ? GETPOST('tva_tx', 'alpha') : getDolGlobalString('MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS', 0)), $mysoc, $object, 0, 0, '', false, 1); print ''; print ''.$langs->trans("NoteReason").''; print ''; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 7f2c8de8bcd..c4ce6e4aab7 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -10664,7 +10664,7 @@ class Form /** * Return select list of user groups * - * @param int|object|object[] $selected Id group or group(s) preselected + * @param int|object|array $selected Id group or group(s) preselected * @param string $htmlname Field name in form * @param int<0,1> $show_empty 0=liste sans valeur nulle, 1=ajoute valeur inconnue * @param string|int[] $exclude Array list of groups id to exclude diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index cf42ba4b738..6993b15a465 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -142,7 +142,7 @@ class FormCompany extends Form /** * Affiche formulaire de selection des modes de reglement * - * @param int $page Page + * @param string $page Page * @param int $selected Id or code preselected * @param string $htmlname Nom du formulaire select * @param int $empty Add empty value in list @@ -194,7 +194,7 @@ class FormCompany extends Form /** * Affiche formulaire de selection des niveau de prospection pour les contacts * - * @param int $page Page + * @param string $page Page * @param int $selected Id or code preselected * @param string $htmlname Nom du formulaire select * @param int $empty Add empty value in list diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 05c759dfc26..2b769b19461 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -2351,7 +2351,7 @@ class FormFile /** * Show detail icon with link for preview * - * @param array{name:string,path:string,level1name:string,relativename:string,fullname:string,date:string,size:int,perm:int,type:string} $file Array with data of file. Example: array('name'=>...) + * @param array{name:string,path?:string,level1name?:string,relativename?:string,fullname:string,date?:string,size?:int,perm?:int,type?:string} $file Array with data of file. Example: array('name'=>...) * @param string $modulepart propal, facture, facture_fourn, ... * @param string $relativepath Relative path of docs * @param int $ruleforpicto Rule for picto: 0=Use the generic preview picto, 1=Use the picto of mime type of file). Use a negative value to show a generic picto even if preview not available. diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php index 6185b847d1d..045810ef8e7 100644 --- a/htdocs/core/lib/agenda.lib.php +++ b/htdocs/core/lib/agenda.lib.php @@ -44,8 +44,8 @@ * @param string $action Action string * @param array|int<-1,-1> $showextcals Array with list of external calendars (used to show links to select calendar), or -1 to show no legend * @param string|string[] $actioncode Preselected value(s) of actioncode for filter on event type - * @param int $usergroupid Id of group to filter on users - * @param string $excludetype A type to exclude ('systemauto', 'system', '') + * @param int|int[] $usergroupid Id of group to filter on users + * @param ''|'systemauto'|'system' $excludetype A type to exclude ('systemauto', 'system', '') * @param int $resourceid Preselected value of resource for filter on resource * @param int $search_categ_cus Tag id * @return void