diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 12303ed2b1d..5dee9316b1e 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5648,7 +5648,7 @@ class Form * @param string $title Title * @param string $question Question * @param string $action Action - * @param array}>|string|null $formquestion An array with complementary inputs to add into forms: array(array('label'=> ,'type'=> , 'size'=>, 'morecss'=>, 'moreattr'=>'autofocus' or 'style=...')) + * @param array}>|string|null $formquestion An array with complementary inputs to add into forms: array(array('label'=> ,'type'=> , 'size'=>, 'morecss'=>, 'moreattr'=>'autofocus' or 'style=...')) * 'type' can be 'text', 'password', 'checkbox', 'radio', 'date', 'datetime', 'select', 'multiselect', 'morecss', * 'other', 'onecolumn' or 'hidden'... * @param int<0,1>|''|'no'|'yes'|'1'|'0' $selectedchoice '' or 'no', or 'yes' or '1', 1, '0' or 0 diff --git a/htdocs/core/class/html.formcontract.class.php b/htdocs/core/class/html.formcontract.class.php index b9be63dee34..11eca55e4b6 100644 --- a/htdocs/core/class/html.formcontract.class.php +++ b/htdocs/core/class/html.formcontract.class.php @@ -1,5 +1,6 @@ + * 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 @@ -180,17 +181,17 @@ class FormContract /** * Show a form to select a contract * - * @param int $page Page + * @param string $page Page * @param int $socid Id third party (-1=all, 0=only contracts not linked to a third party, id=contracts not linked or linked to third party id) * @param int $selected Id contract preselected * @param string $htmlname Nom de la zone html * @param int $maxlength Maximum length of label * @param int $showempty Show empty line * @param int $showRef Show customer and supplier reference on each contract (when found) - * @param int $noouput 1=Return the output instead of display + * @param int<0,1> $nooutput 1=Return the output instead of display * @return string|void html string */ - public function formSelectContract($page, $socid = -1, $selected = 0, $htmlname = 'contrattid', $maxlength = 16, $showempty = 1, $showRef = 0, $noouput = 0) + public function formSelectContract($page, $socid = -1, $selected = 0, $htmlname = 'contrattid', $maxlength = 16, $showempty = 1, $showRef = 0, $nooutput = 0) { global $langs; @@ -201,7 +202,7 @@ class FormContract $ret .= ''; $ret .= ''; - if ($noouput) { + if ($nooutput) { return $ret; } diff --git a/htdocs/core/lib/price.lib.php b/htdocs/core/lib/price.lib.php index 11df59e893a..ec5ff384592 100644 --- a/htdocs/core/lib/price.lib.php +++ b/htdocs/core/lib/price.lib.php @@ -48,7 +48,7 @@ * @param string $price_base_type 'HT'=Unit price parameter $pu is HT, 'TTC'=Unit price parameter $pu is TTC (HT+VAT but not Localtax. TODO Add also mode 'INCT' when pu is price HT+VAT+LT1+LT2) * @param int $info_bits Miscellaneous information on line * @param int<0,1> $type 0/1=Product/service - * @param string|Societe|string $seller Third party seller (we need $seller->country_id property). Provided only if seller is the supplier, otherwise $seller will be $mysoc. + * @param string|Societe|null $seller Third party seller (we need $seller->country_id property). Provided only if seller is the supplier, otherwise $seller will be $mysoc. * @param array{0:string,1:int|string,2:string,3:string}|array{0:string,1:int|string,2:string,3:int|string,4:string,5:string} $localtaxes_array Array with localtaxes info array('0'=>type1,'1'=>rate1,'2'=>type2,'3'=>rate2) (loaded by getLocalTaxesFromRate(vatrate, 0, ...) function). * @param float $progress Situation invoices progress (value from 0 to 100, 100 by default) * @param float $multicurrency_tx Currency rate (1 by default) @@ -87,7 +87,7 @@ * * @phan-suppress PhanTypeMismatchDefault */ -function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocaltax1_rate, $uselocaltax2_rate, $remise_percent_global, $price_base_type, $info_bits, $type, $seller = '', $localtaxes_array = [], $progress = 100, $multicurrency_tx = 1, $pu_devise = 0, $multicurrency_code = '') // @phpstan-ignore-line +function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocaltax1_rate, $uselocaltax2_rate, $remise_percent_global, $price_base_type, $info_bits, $type, $seller = null, $localtaxes_array = [], $progress = 100, $multicurrency_tx = 1, $pu_devise = 0, $multicurrency_code = '') // @phpstan-ignore-line { global $conf, $mysoc, $db; diff --git a/htdocs/eventorganization/conferenceorbooth_card.php b/htdocs/eventorganization/conferenceorbooth_card.php index ff6d66b04f3..2a35ceb8dfb 100644 --- a/htdocs/eventorganization/conferenceorbooth_card.php +++ b/htdocs/eventorganization/conferenceorbooth_card.php @@ -365,13 +365,13 @@ if (!empty($withproject)) { 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 ''; diff --git a/htdocs/eventorganization/conferenceorboothattendee_card.php b/htdocs/eventorganization/conferenceorboothattendee_card.php index 041e671a8f0..899debd01d4 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_card.php +++ b/htdocs/eventorganization/conferenceorboothattendee_card.php @@ -373,7 +373,7 @@ if (!empty($withproject)) { 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 ''; diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index e7ecf387ec1..c0d84059027 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -734,7 +734,7 @@ if ($id > 0 || !empty($ref)) { $text .= ' - '.$label; $description = (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE') ? '' : dol_htmlentitiesbr($objp->description)).'
'; $description .= $product_static->show_photos('product', $conf->product->multidir_output[$product_static->entity], 1, 1, 0, 0, 0, 80); - print $form->textwithtooltip($text, $description, 3, '', 0, (string) $i); + print $form->textwithtooltip($text, $description, 3, 0, '', (string) $i); // Show range print_date_range($db->jdate($objp->date_start), $db->jdate($objp->date_end)); diff --git a/htdocs/expensereport/payment/card.php b/htdocs/expensereport/payment/card.php index bd58dbaad93..9aa1c990e47 100644 --- a/htdocs/expensereport/payment/card.php +++ b/htdocs/expensereport/payment/card.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 @@ -130,6 +130,7 @@ print ''.$langs->trans('Amount').''.price($object->amount, 0, $ print ''.$langs->trans('Note').''.dol_string_onlythesehtmltags(dol_htmlentitiesbr($object->note_public)).''; $disable_delete = 0; +$title_button = ''; // Bank account if (isModEnabled("bank")) { if ($object->bank_account) { diff --git a/htdocs/expensereport/payment/info.php b/htdocs/expensereport/payment/info.php index cb83c850443..5b6fa16191c 100644 --- a/htdocs/expensereport/payment/info.php +++ b/htdocs/expensereport/payment/info.php @@ -4,6 +4,7 @@ * Copyright (C) 2013 Marcos García * Copyright (C) 2015 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 @@ -42,7 +43,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/expensereport.lib.php'; // Load translation files required by the page $langs->loadLangs(array('bills', 'trips')); -$id = GETPOST('id'); +$id = GETPOSTINT('id'); $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); diff --git a/htdocs/expensereport/payment/payment.php b/htdocs/expensereport/payment/payment.php index 2c69d7af7c9..b0045757bab 100644 --- a/htdocs/expensereport/payment/payment.php +++ b/htdocs/expensereport/payment/payment.php @@ -2,7 +2,7 @@ /* Copyright (C) 2015 Alexandre Spangaro * Copyright (C) 2015 Laurent Destailleur * Copyright (C) 2018-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -225,6 +225,7 @@ if ($action == 'create' || empty($action)) { $sql .= " FROM ".MAIN_DB_PREFIX."payment_expensereport as p, ".MAIN_DB_PREFIX."expensereport as e"; $sql .= " WHERE p.fk_expensereport = e.rowid AND p.fk_expensereport = ".((int) $id); $sql .= ' AND e.entity IN ('.getEntity('expensereport').')'; + $sumpaid = 0; $resql = $db->query($sql); if ($resql) { $obj = $db->fetch_object($resql); diff --git a/htdocs/expensereport/stats/index.php b/htdocs/expensereport/stats/index.php index 0ddaee0be92..e5bb55b9438 100644 --- a/htdocs/expensereport/stats/index.php +++ b/htdocs/expensereport/stats/index.php @@ -2,8 +2,8 @@ /* Copyright (C) 2003-2006 Rodolphe Quiedeville * Copyright (c) 2004-2012 Laurent Destailleur * Copyright (C) 2012 Marcos García - * Copyright (C) 2018-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2018-2024 Frédéric France + * 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,6 +159,7 @@ if (!$mesg) { $data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear); +$fileurl_avg = null; if (!$user->hasRight('societe', 'client', 'voir')) { $filename_avg = $dir.'/ordersaverage-'.$user->id.'-'.$year.'.png'; if ($mode == 'customer') { @@ -179,7 +180,7 @@ if (!$user->hasRight('societe', 'client', 'voir')) { $px3 = new DolGraph(); $mesg = $px3->isGraphKo(); -if (!$mesg) { +if (!$mesg && $fileurl_avg !== null) { $px3->SetData($data); $i = $startyear; $legend = array(); @@ -190,7 +191,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); @@ -248,7 +249,7 @@ if (!$user->hasRight('expensereport', 'readall') && !$user->hasRight('expenserep $include = 'hierarchy'; } print img_picto('', 'user', 'class="pictofixedwidth"'); -print $form->select_dolusers($userid, 'userid', 1, '', 0, $include, '', 0, 0, 0, '', 0, '', 'widthcentpercentminusx maxwidth300'); +print $form->select_dolusers($userid, 'userid', 1, null, 0, $include, '', '', 0, 0, '', 0, '', 'widthcentpercentminusx maxwidth300'); print ''; // Status print ''.$langs->trans("Status").''; diff --git a/htdocs/expensereport/tpl/expensereport_addfile.tpl.php b/htdocs/expensereport/tpl/expensereport_addfile.tpl.php index ff2fd3d4285..b0442bd9a10 100644 --- a/htdocs/expensereport/tpl/expensereport_addfile.tpl.php +++ b/htdocs/expensereport/tpl/expensereport_addfile.tpl.php @@ -1,4 +1,13 @@ + */ + +/** + * @var int $colspan + */ +' +@phan-var-force int $colspan +'; // Add line to upload new file print ''."\n"; diff --git a/htdocs/expensereport/tpl/expensereport_linktofile.tpl.php b/htdocs/expensereport/tpl/expensereport_linktofile.tpl.php index 2e02e7b8808..c4fbd00374b 100644 --- a/htdocs/expensereport/tpl/expensereport_linktofile.tpl.php +++ b/htdocs/expensereport/tpl/expensereport_linktofile.tpl.php @@ -1,6 +1,12 @@ +/* Copyright (C) 2024-2025 MDW */ +/** + * @var int $colspan + */ +' +@phan-var-force int $colspan +'; // Add line to select existing file if (!getDolGlobalString('EXPENSEREPORT_DISABLE_ATTACHMENT_ON_LINES')) { @@ -29,6 +35,7 @@ if (!getDolGlobalString('EXPENSEREPORT_DISABLE_ATTACHMENT_ON_LINES')) { $maxheightmini = 48; $relativepath = (!empty($object->ref) ? dol_sanitizeFileName($object->ref) : '').'/'; $filei = 0; + $minifile = null; // Loop on each attached file foreach ($arrayoffiles as $file) { $urlforhref = array(); @@ -95,6 +102,7 @@ if (!getDolGlobalString('EXPENSEREPORT_DISABLE_ATTACHMENT_ON_LINES')) { } print '
'; + // TODO: Check that $minifile has a proper value here (set in true part of if, not else part). print $thumbshown ? $thumbshown : img_mime($minifile); print '
'; diff --git a/htdocs/fichinter/card-rec.php b/htdocs/fichinter/card-rec.php index 93b6157ea19..a84871b25fc 100644 --- a/htdocs/fichinter/card-rec.php +++ b/htdocs/fichinter/card-rec.php @@ -10,7 +10,7 @@ * Copyright (C) 2016-2018 Charlie Benke * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2024 William Mead - * 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 @@ -121,7 +121,7 @@ $result = restrictedArea($user, 'ficheinter', $id, $objecttype); $permissiontoadd = $user->hasRight('ficheinter', 'creer'); $permissiontodelete = $user->hasRight('ficheinter', 'supprimer'); - +$objp = null; /* * Actions @@ -215,7 +215,7 @@ if ($action == 'add' && $permissiontoadd) { } $newinter->entity = $object->entity; - $newinter->duree = $object->duree; + $newinter->duration = $object->duration; $newinter->description = $object->description; $newinter->note_private = $object->note_private; @@ -254,7 +254,7 @@ if ($action == 'add' && $permissiontoadd) { } elseif ($action == 'setfrequency' && $permissiontoadd) { // Set frequency and unit frequency $object->fetch($id); - $object->setFrequencyAndUnit(GETPOST('frequency', 'int'), GETPOST('unit_frequency', 'alpha')); + $object->setFrequencyAndUnit(GETPOSTINT('frequency'), GETPOST('unit_frequency', 'alpha')); } elseif ($action == 'setdate_when' && $permissiontoadd) { // Set next date of execution $object->fetch($id); @@ -280,6 +280,8 @@ llxHeader('', $langs->trans("RepeatableIntervention"), $help_url, '', 0, 0, '', $form = new Form($db); $fichinterrecstatic = new FichinterRec($db); $companystatic = new Societe($db); +$contratstatic = null; +$projectstatic = null; if (isModEnabled('contract')) { $contratstatic = new Contrat($db); } @@ -508,7 +510,7 @@ if ($action == 'create') { $object->fetch_thirdparty(); $author = new User($db); - $author->fetch($object->user_author); + $author->fetch((int) $object->user_author); $head = fichinter_rec_prepare_head($object); @@ -535,11 +537,11 @@ if ($action == 'create') { $morehtmlref .= '
'; $morehtmlref .= ''; $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref .= $formproject->select_projects($object->socid, (string) $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); $morehtmlref .= ''; $morehtmlref .= '
'; } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300'); + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, (string) $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300'); } } else { if (!empty($object->fk_project)) { @@ -577,7 +579,7 @@ if ($action == 'create') { print ''.$langs->trans("Description").''.nl2br($object->description).""; // Contract - if (isModEnabled('contract')) { + if (isModEnabled('contract') && $contratstatic !== null) { $langs->load('contracts'); print ''; print ''; @@ -599,7 +601,7 @@ if ($action == 'create') { if ($object->fk_contrat) { $contratstatic = new Contrat($db); $contratstatic->fetch($object->fk_contrat); - print $contratstatic->getNomUrl(0, '', 1); + print $contratstatic->getNomUrl(0, 0, 1); } else { print " "; } @@ -666,7 +668,7 @@ if ($action == 'create') { // Max period / Rest period print ''; if ($user->hasRight('ficheinter', 'creer') && ($action == 'nb_gen_max' || $object->frequency > 0)) { - print $form->editfieldkey($langs->trans("MaxPeriodNumber"), 'nb_gen_max', $object->nb_gen_max, $object, $user->hasRight('facture', 'creer')); + print $form->editfieldkey($langs->trans("MaxPeriodNumber"), 'nb_gen_max', (string) $object->nb_gen_max, $object, $user->hasRight('facture', 'creer')); } else { print $langs->trans("MaxPeriodNumber"); } @@ -743,6 +745,7 @@ if ($action == 'create') { $type = $object->lines[$i]->product_type; } // else { $object->lines[$i]->fk_product_type; } + // TODO: $objp is not set here, so why test? if (isset($objp) && is_object($objp)) { // Try to enhance type detection using date_start and date_end for free lines when type // was not saved. @@ -871,7 +874,7 @@ if ($action == 'create') { print ''.$langs->trans("None").''; } - if (isModEnabled('contract')) { + if (isModEnabled('contract') && $contratstatic !== null) { print ''; if ($objp->fk_contrat > 0) { $contratstatic->fetch($objp->fk_contrat); @@ -879,7 +882,7 @@ if ($action == 'create') { } print ''; } - if (isModEnabled('project')) { + if (isModEnabled('project') && $projectstatic !== null) { print ''; if ($objp->fk_project > 0) { $projectstatic->fetch($objp->fk_project); diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 07311a5ca20..f3c6ca5250f 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -11,7 +11,7 @@ * Copyright (C) 2020-2024 Frédéric France * Copyright (C) 2023 Benjamin Grembi * Copyright (C) 2023-2024 William Mead - * 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 @@ -937,7 +937,7 @@ if ($action == 'create') { $classname = ucfirst($subelement); $objectsrc = new $classname($db); '@phan-var-force Commande|Propal|Contrat $objectsrc'; - $objectsrc->fetch(GETPOST('originid')); + $objectsrc->fetch(GETPOSTINT('originid')); if (empty($objectsrc->lines) && method_exists($objectsrc, 'fetch_lines')) { $objectsrc->fetch_lines(); $lines = $objectsrc->lines; @@ -1048,7 +1048,7 @@ if ($action == 'create') { print ''; print ''.$langs->trans('NotePublic').''; print ''; - $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', false, false, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3, '90%'); + $doleditor = new DolEditor('note_public', (string) $note_public, '', 80, 'dolibarr_notes', 'In', false, false, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3, '90%'); print $doleditor->Create(1); //print ''; print ''; @@ -1058,7 +1058,7 @@ if ($action == 'create') { print ''; print ''.$langs->trans('NotePrivate').''; print ''; - $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', false, false, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3, '90%'); + $doleditor = new DolEditor('note_private', (string) $note_private, '', 80, 'dolibarr_notes', 'In', false, false, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3, '90%'); print $doleditor->Create(1); //print ''; print ''; @@ -1316,7 +1316,7 @@ if ($action == 'create') { 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); @@ -1509,13 +1509,11 @@ if ($action == 'create') { $extrafields->fetch_name_optionals_label($objectline->table_element); - if (!empty($extrafields)) { - $temps = $objectline->showOptionals($extrafields, 'view', array(), '', '', 1, 'line'); - if (!empty($temps)) { - print '
'; - print $temps; - print '
'; - } + $temps = $objectline->showOptionals($extrafields, 'view', array(), '', '', '1', 'line'); + if (!empty($temps)) { + print '
'; + print $temps; + print '
'; } print ''; @@ -1581,13 +1579,11 @@ if ($action == 'create') { $extrafields->fetch_name_optionals_label($objectline->table_element); - if (!empty($extrafields)) { - $temps = $objectline->showOptionals($extrafields, 'edit', array(), '', '', 1, 'line'); - if (!empty($temps)) { - print '
'; - print $temps; - print '
'; - } + $temps = $objectline->showOptionals($extrafields, 'edit', array(), '', '', '1', 'line'); + if (!empty($temps)) { + print '
'; + print $temps; + print '
'; } print ''; @@ -1663,7 +1659,7 @@ if ($action == 'create') { $extrafields->fetch_name_optionals_label($objectline->table_element); if (is_object($objectline)) { - $temps = $objectline->showOptionals($extrafields, 'create', array(), '', '', 1, 'line'); + $temps = $objectline->showOptionals($extrafields, 'create', array(), '', '', '1', 'line'); if (!empty($temps)) { print '
'; diff --git a/htdocs/fichinter/class/api_interventions.class.php b/htdocs/fichinter/class/api_interventions.class.php index 08697cc34c2..57699f6f593 100644 --- a/htdocs/fichinter/class/api_interventions.class.php +++ b/htdocs/fichinter/class/api_interventions.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2016 Laurent Destailleur + * 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 @@ -35,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; class Interventions extends DolibarrApi { /** - * @var array $FIELDS Mandatory fields, checked when create and update object + * @var array Mandatory fields, checked when create and update object */ public static $FIELDS = array( 'socid', @@ -44,7 +45,7 @@ class Interventions extends DolibarrApi ); /** - * @var array $FIELDS Mandatory fields, checked when create and update object + * @var array Mandatory fields, checked when create and update object */ public static $FIELDSLINE = array( 'description', @@ -53,7 +54,7 @@ class Interventions extends DolibarrApi ); /** - * @var Fichinter $fichinter {@type fichinter} + * @var Fichinter {@type fichinter} */ public $fichinter; @@ -287,7 +288,7 @@ class Interventions extends DolibarrApi $id, $this->fichinter->description, $this->fichinter->date, - $this->fichinter->duree + $this->fichinter->duration ); if ($updateRes > 0) { diff --git a/htdocs/fichinter/class/fichinterrec.class.php b/htdocs/fichinter/class/fichinterrec.class.php index a623c2d7237..bcd1916c744 100644 --- a/htdocs/fichinter/class/fichinterrec.class.php +++ b/htdocs/fichinter/class/fichinterrec.class.php @@ -9,7 +9,7 @@ * Copyright (C) 2016-2018 Charlie Benke * Copyright (C) 2024 William Mead * 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 @@ -91,7 +91,7 @@ class FichinterRec extends Fichinter public $date_last_gen; /** - * @var datetime|string + * @var int|string */ public $date_when; @@ -255,7 +255,7 @@ class FichinterRec extends Fichinter $fichintsrc->lines[$i]->product_type, $fichintsrc->lines[$i]->special_code, !empty($fichintsrc->lines[$i]->label) ? $fichintsrc->lines[$i]->label : "", - $fichintsrc->lines[$i]->fk_unit + (string) $fichintsrc->lines[$i]->fk_unit ); if ($result_insert < 0) { @@ -527,7 +527,7 @@ class FichinterRec extends Fichinter // qty, pu, remise_percent et txtva // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. - $tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, 0, 0, 0, $price_base_type, $info_bits, $type, $mysoc); + $tabprice = calcul_price_total($qty, (float) $pu, (float) $remise_percent, $txtva, 0, 0, 0, $price_base_type, $info_bits, $type, $mysoc); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; @@ -609,7 +609,7 @@ class FichinterRec extends Fichinter // phpcs:enable if ($user->hasRight('fichinter', 'creer')) { $sql = "UPDATE ".MAIN_DB_PREFIX."fichinter_rec "; - $sql .= " SET frequency='".$this->db->escape($freq)."'"; + $sql .= " SET frequency='".$this->db->escape((string) $freq)."'"; $sql .= ", date_last_gen='".$this->db->escape($courant)."'"; $sql .= " WHERE rowid = ".((int) $this->id); @@ -749,7 +749,7 @@ class FichinterRec extends Fichinter } $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; - $sql .= ' SET frequency = '.($frequency ? $this->db->escape($frequency) : 'null'); + $sql .= ' SET frequency = '.($frequency ? $this->db->escape((string) $frequency) : 'null'); if (!empty($unit)) { $sql .= ', unit_frequency = "'.$this->db->escape($unit).'"'; } @@ -771,8 +771,8 @@ class FichinterRec extends Fichinter /** * Update the next date of execution * - * @param datetime $date date of execution - * @param int $increment_nb_gen_done 0 do nothing more, >0 increment nb_gen_done + * @param int $date date of execution + * @param int<0,max> $increment_nb_gen_done 0 do nothing more, >0 increment nb_gen_done * @return int Return integer <0 if KO, >0 if OK */ public function setNextDate($date, $increment_nb_gen_done = 0) diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index a2270349bab..308af88fce9 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -9,7 +9,7 @@ * Copyright (C) 2021-2024 Frédéric France * Copyright (C) 2022 Charlène Benke * Copyright (C) 2024 William Mead - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Benjamin Falière * * This program is free software; you can redistribute it and/or modify @@ -139,29 +139,29 @@ if (getDolGlobalString('FICHINTER_DISABLE_DETAILS')) { // Definition of fields for list $arrayfields = array( - 'f.ref' => array('label' => 'Ref', 'checked' => 1), - 'f.ref_client' => array('label' => 'RefCustomer', 'checked' => 1), - 's.nom' => array('label' => 'ThirdParty', 'checked' => 1), - 'pr.ref' => array('label' => 'Project', 'checked' => 1, 'enabled' => (!isModEnabled('project') ? 0 : 1)), - 'c.ref' => array('label' => 'Contract', 'checked' => 1, 'enabled' => (empty($conf->contrat->enabled) ? 0 : 1)), - 'f.description' => array('label' => 'Description', 'checked' => 1), - 'f.datec' => array('label' => 'DateCreation', 'checked' => 0, 'position' => 500), - 'f.tms' => array('label' => 'DateModificationShort', 'checked' => 0, 'position' => 500), - 'f.note_public' => array('label' => 'NotePublic', 'checked' => 0, 'position' => 510, 'enabled' => (!getDolGlobalInt('MAIN_LIST_HIDE_PUBLIC_NOTES'))), - 'f.note_private' => array('label' => 'NotePrivate', 'checked' => 0, 'position' => 511, 'enabled' => (!getDolGlobalInt('MAIN_LIST_HIDE_PRIVATE_NOTES'))), - 'f.fk_statut' => array('label' => 'Status', 'checked' => 1, 'position' => 1000), - 'f.signed_status' => array('label' => 'SignedStatus', 'checked' => 0, 'position' => 1001), - 'fd.description' => array('label' => "DescriptionOfLine", 'checked' => 1, 'enabled' => getDolGlobalString('FICHINTER_DISABLE_DETAILS') != '1' ? 1 : 0), - 'fd.date' => array('label' => 'DateOfLine', 'checked' => 1, 'enabled' => getDolGlobalString('FICHINTER_DISABLE_DETAILS') != '1' ? 1 : 0), - 'fd.duree' => array('label' => 'DurationOfLine', 'type' => 'duration', 'checked' => 1, 'enabled' => !getDolGlobalString('FICHINTER_DISABLE_DETAILS') ? 1 : 0), //type duration is here because in database, column 'duree' is double + 'f.ref' => array('label' => 'Ref', 'checked' => '1'), + 'f.ref_client' => array('label' => 'RefCustomer', 'checked' => '1'), + 's.nom' => array('label' => 'ThirdParty', 'checked' => '1'), + 'pr.ref' => array('label' => 'Project', 'checked' => '1', 'enabled' => (!isModEnabled('project') ? '0' : '1')), + 'c.ref' => array('label' => 'Contract', 'checked' => '1', 'enabled' => (empty($conf->contrat->enabled) ? '0' : '1')), + 'f.description' => array('label' => 'Description', 'checked' => '1'), + 'f.datec' => array('label' => 'DateCreation', 'checked' => '0', 'position' => 500), + 'f.tms' => array('label' => 'DateModificationShort', 'checked' => '0', 'position' => 500), + 'f.note_public' => array('label' => 'NotePublic', 'checked' => '0', 'position' => 510, 'enabled' => (string) (!getDolGlobalInt('MAIN_LIST_HIDE_PUBLIC_NOTES'))), + 'f.note_private' => array('label' => 'NotePrivate', 'checked' => '0', 'position' => 511, 'enabled' => (string) (!getDolGlobalInt('MAIN_LIST_HIDE_PRIVATE_NOTES'))), + 'f.fk_statut' => array('label' => 'Status', 'checked' => '1', 'position' => 1000), + 'f.signed_status' => array('label' => 'SignedStatus', 'checked' => '0', 'position' => 1001), + 'fd.description' => array('label' => "DescriptionOfLine", 'checked' => '1', 'enabled' => getDolGlobalString('FICHINTER_DISABLE_DETAILS') != '1' ? '1' : '0'), + 'fd.date' => array('label' => 'DateOfLine', 'checked' => '1', 'enabled' => getDolGlobalString('FICHINTER_DISABLE_DETAILS') != '1' ? '1' : '0'), + 'fd.duree' => array('label' => 'DurationOfLine', 'type' => 'duration', 'checked' => '1', 'enabled' => !getDolGlobalString('FICHINTER_DISABLE_DETAILS') ? '1' : '0'), //type duration is here because in database, column 'duree' is double ); -'@phan-var-force array{label:string,type?:string,checked:int,position?:int,enabled?:int,langfile?:string,help:string} $arrayfields'; +'@phan-var-force array{label:string,type?:string,checked:string,position?:int,enabled?:string,langfile?:string,help:string} $arrayfields'; // 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 +'@phan-var-force array{label:string,type?:string,checked:string,position?:int,enabled?:string,langfile?:string,help:string} $arrayfields'; // dol_sort_array looses type for Phan // Security check $id = GETPOSTINT('id'); @@ -237,6 +237,8 @@ $form = new Form($db); $formfile = new FormFile($db); $objectstatic = new Fichinter($db); $companystatic = new Societe($db); +$projetstatic = null; +$contratstatic = null; if (isModEnabled('project')) { $projetstatic = new Project($db); } @@ -921,7 +923,7 @@ while ($i < $imaxinloop) { } } // Project ref - if (!empty($arrayfields['pr.ref']['checked'])) { + if (!empty($arrayfields['pr.ref']['checked']) && $projetstatic !== null) { print ''; $projetstatic->id = $obj->projet_id; $projetstatic->ref = $obj->projet_ref; @@ -935,14 +937,14 @@ while ($i < $imaxinloop) { } } // Contract - if (!empty($arrayfields['c.ref']['checked'])) { + if (!empty($arrayfields['c.ref']['checked']) && $contratstatic !== null) { print ''; $contratstatic->id = $obj->contrat_id; $contratstatic->ref = $obj->contrat_ref; $contratstatic->ref_customer = $obj->contrat_ref_customer; $contratstatic->ref_supplier = $obj->contrat_ref_supplier; if ($contratstatic->id > 0) { - print $contratstatic->getNomUrl(1, ''); + print $contratstatic->getNomUrl(1, 0); print ''; } if (!$i) { diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index 026901afa32..b42f5a557ef 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -8,7 +8,7 @@ * Copyright (C) 2015 Marcos García * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2021-2024 Frédéric France - * 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 @@ -363,9 +363,9 @@ if ($object->id > 0) { print ''; print ''; if ($action == 'editconditions') { - $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->cond_reglement_supplier_id, 'cond_reglement_supplier_id', 1); + $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, (string) $object->cond_reglement_supplier_id, 'cond_reglement_supplier_id', 1); } else { - $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->cond_reglement_supplier_id, 'none'); + $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, (string) $object->cond_reglement_supplier_id, 'none'); } print ""; print ''; @@ -381,9 +381,9 @@ if ($object->id > 0) { print ''; print ''; if ($action == 'editmode') { - $form->form_modes_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->mode_reglement_supplier_id, 'mode_reglement_supplier_id', 'DBIT', 1, 1); + $form->form_modes_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, (string) $object->mode_reglement_supplier_id, 'mode_reglement_supplier_id', 'DBIT', 1, 1); } else { - $form->form_modes_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->mode_reglement_supplier_id, 'none'); + $form->form_modes_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, (string) $object->mode_reglement_supplier_id, 'none'); } print ""; print ''; @@ -400,9 +400,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 ''; @@ -432,7 +432,7 @@ if ($object->id > 0) { print ''; print ''; print ''; - $amount_discount = $object->getAvailableDiscounts('', '', 0, 1); + $amount_discount = $object->getAvailableDiscounts(null, '', 0, 1); if ($amount_discount < 0) { dol_print_error($db, $object->error); } @@ -474,7 +474,7 @@ if ($object->id > 0) { print ''.$langs->trans("LinkedToDolibarrMember").''; print ''; $adh = new Adherent($db); - $result = $adh->fetch('', '', $object->id); + $result = $adh->fetch(0, '', $object->id); if ($result > 0) { $adh->ref = $adh->getFullName($langs); print $adh->getNomUrl(1); @@ -493,7 +493,7 @@ if ($object->id > 0) { $boxstat = ''; // Nbre max d'elements des petites listes - $MAXLIST = getDolGlobalString('MAIN_SIZE_SHORTLIST_LIMIT'); + $MAXLIST = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT'); print '
'; print '
'; @@ -614,7 +614,7 @@ if ($object->id > 0) { print $boxstat; - $MAXLIST = getDolGlobalString('MAIN_SIZE_SHORTLIST_LIMIT'); + $MAXLIST = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT'); /* @@ -762,6 +762,7 @@ if ($object->id > 0) { * Latest supplier orders */ $orderstatic = new CommandeFournisseur($db); + $orders2invoice = 0; if ($user->hasRight("fournisseur", "commande", "lire")) { // TODO move to DAO class @@ -775,7 +776,7 @@ if ($object->id > 0) { $sql2 .= ' AND s.rowid = '.((int) $object->id); // Show orders we can bill if (!getDolGlobalString('SUPPLIER_ORDER_TO_INVOICE_STATUS')) { - $sql2 .= " AND c.fk_statut IN (".$db->sanitize(CommandeFournisseur::STATUS_RECEIVED_COMPLETELY).")"; // Must match filter in htdocs/fourn/commande/list.php + $sql2 .= " AND c.fk_statut IN (".$db->sanitize((string) CommandeFournisseur::STATUS_RECEIVED_COMPLETELY).")"; // Must match filter in htdocs/fourn/commande/list.php } else { // CommandeFournisseur::STATUS_ORDERSENT.", ".CommandeFournisseur::STATUS_RECEIVED_PARTIALLY.", ".CommandeFournisseur::STATUS_RECEIVED_COMPLETELY $sql2 .= " AND c.fk_statut IN (".$db->sanitize(getDolGlobalString('SUPPLIER_ORDER_TO_INVOICE_STATUS')).")"; diff --git a/htdocs/public/payment/paymentko.php b/htdocs/public/payment/paymentko.php index 5f833ed119d..74fd7762873 100644 --- a/htdocs/public/payment/paymentko.php +++ b/htdocs/public/payment/paymentko.php @@ -3,7 +3,7 @@ * Copyright (C) 2006-2013 Laurent Destailleur * Copyright (C) 2012 Regis Houssin * Copyright (C) 2024-2025 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -41,7 +41,7 @@ if (!defined('NOBROWSERNOTIF')) { } if (!defined('XFRAMEOPTIONS_ALLOWALL')) { - define('XFRAMEOPTIONS_ALLOWALL', '1'); + define('XFRAMEOPTIONS_ALLOWALL', '1'); } // For MultiCompany module. @@ -204,7 +204,7 @@ if (!empty($_SESSION['ipaddress'])) { // To avoid to make action twice // Send warning of error to administrator if ($sendemail) { // Get default language to use for the company for supervision emails - $myCompanyDefaultLang = $mysoc->default_lang; + $myCompanyDefaultLang = (string) $mysoc->default_lang; if (empty($myCompanyDefaultLang) || $myCompanyDefaultLang === 'auto') { // We must guess the language from the company country. We must not use the language of the visitor. This is a technical email for supervision // so it must always be into the same language. diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index 6d415d7820f..26b2db6e80b 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -589,7 +589,7 @@ if ($ispaymentok) { // Set output language $outputlangs = new Translate('', $conf); - $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang); + $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? (string) $mysoc->default_lang : (string) $object->thirdparty->default_lang); $paymentdate = $now; $amount = $FinalPaymentAmt; $formatteddate = dol_print_date($paymentdate, 'dayhour', 'auto', $outputlangs); @@ -1446,7 +1446,7 @@ if ($ispaymentok) { $formmail = new FormMail($db); // Set output language $outputlangs = new Translate('', $conf); - $outputlangs->setDefaultLang(empty($thirdparty->default_lang) ? $mysoc->default_lang : $thirdparty->default_lang); + $outputlangs->setDefaultLang(empty($thirdparty->default_lang) ? (string) $mysoc->default_lang : (string) $thirdparty->default_lang); // Load traductions files required by page $outputlangs->loadLangs(array("main", "members", "eventorganization")); // Get email content from template diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index 2a6d965b012..a84b221ab06 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -5,7 +5,7 @@ * Copyright (C) 2015 Marcos García * Copyright (C) 2015-2017 Ferran Marcet * Copyright (C) 2021-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 @@ -416,7 +416,7 @@ if (!empty($sql_select)) { $sql .= $where; $sql .= dolSqlDateFilter($dateprint, 0, $month, $year); if ($sref) { - $sql .= " AND ".$db->sanitize($doc_number)." LIKE '%".$db->escape($sref)."%'"; + $sql .= " AND ".$db->sanitize((string) $doc_number)." LIKE '%".$db->escape($sref)."%'"; } if ($sprod_fulldescr) { // We test both case description is correctly saved of was save after dol_escape_htmltag().