Qual: Fix phan notices

This commit is contained in:
MDW 2025-01-21 00:33:58 +01:00
parent 8a5c5ac09f
commit bea27b0be4
No known key found for this signature in database
21 changed files with 129 additions and 104 deletions

View File

@ -5648,7 +5648,7 @@ class Form
* @param string $title Title
* @param string $question Question
* @param string $action Action
* @param array<array{name:string,value:string,values?:string[],default?:string,label:string,type:string,size?:string,morecss?:string,moreattr?:string,style?:string,inputko?:int<0,1>}>|string|null $formquestion An array with complementary inputs to add into forms: array(array('label'=> ,'type'=> , 'size'=>, 'morecss'=>, 'moreattr'=>'autofocus' or 'style=...'))
* @param array<array{name:string,value?:string,values?:string[],default?:string,label:string,type:string,size?:string,morecss?:string,moreattr?:string,style?:string,inputko?:int<0,1>}>|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

View File

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2012-2018 Charlene BENKE <charlie@patas-monkey.com>
* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -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 .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
$ret .= '</form>';
if ($noouput) {
if ($nooutput) {
return $ret;
}

View File

@ -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;

View File

@ -365,13 +365,13 @@ if (!empty($withproject)) {
print '<tr><td class="valuefield">';
print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid');
print '</td><td class="valuefield">';
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 "</td></tr>";
print '<tr><td class="valuefield">';
print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid');
print '</td><td class="valuefield">';
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 "</td></tr>";
print '<tr><td class="titlefield">';

View File

@ -373,7 +373,7 @@ if (!empty($withproject)) {
print '<tr><td>';
print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid');
print '</td><td>';
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 "</td></tr>";
print '<tr><td>';

View File

@ -734,7 +734,7 @@ if ($id > 0 || !empty($ref)) {
$text .= ' - '.$label;
$description = (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE') ? '' : dol_htmlentitiesbr($objp->description)).'<br>';
$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));

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2015-2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -130,6 +130,7 @@ print '<tr><td>'.$langs->trans('Amount').'</td><td>'.price($object->amount, 0, $
print '<tr><td class="tdtop">'.$langs->trans('Note').'</td><td class="valeur sensiblehtmlcontent">'.dol_string_onlythesehtmltags(dol_htmlentitiesbr($object->note_public)).'</td></tr>';
$disable_delete = 0;
$title_button = '';
// Bank account
if (isModEnabled("bank")) {
if ($object->bank_account) {

View File

@ -4,6 +4,7 @@
* Copyright (C) 2013 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -42,7 +43,7 @@ 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');

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2015 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -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);

View File

@ -2,8 +2,8 @@
/* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (c) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -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 '</td></tr>';
// Status
print '<tr><td class="left">'.$langs->trans("Status").'</td><td class="left">';

View File

@ -1,4 +1,13 @@
<?php
/* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
*/
/**
* @var int $colspan
*/
'
@phan-var-force int $colspan
';
// Add line to upload new file
print '<!-- expensereport_addfile.tpl.php -->'."\n";

View File

@ -1,6 +1,12 @@
<?php
/* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
/* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
*/
/**
* @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 '<div class="photoref backgroundblank">';
// 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 '</div>';

View File

@ -10,7 +10,7 @@
* Copyright (C) 2016-2018 Charlie Benke <charlie@patas-monkey.com>
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 William Mead <william.mead@manchenumerique.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -121,7 +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 .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref .= '<input type="hidden" name="action" value="classin">';
$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
$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 .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref .= '</form>';
} 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 '<tr><td>'.$langs->trans("Description").'</td><td colspan="3">'.nl2br($object->description)."</td></tr>";
// Contract
if (isModEnabled('contract')) {
if (isModEnabled('contract') && $contratstatic !== null) {
$langs->load('contracts');
print '<tr>';
print '<td>';
@ -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 "&nbsp;";
}
@ -666,7 +668,7 @@ if ($action == 'create') {
// Max period / Rest period
print '<tr><td>';
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 '<td>'.$langs->trans("None").'</td>';
}
if (isModEnabled('contract')) {
if (isModEnabled('contract') && $contratstatic !== null) {
print '<td>';
if ($objp->fk_contrat > 0) {
$contratstatic->fetch($objp->fk_contrat);
@ -879,7 +882,7 @@ if ($action == 'create') {
}
print '</td>';
}
if (isModEnabled('project')) {
if (isModEnabled('project') && $projectstatic !== null) {
print '<td>';
if ($objp->fk_project > 0) {
$projectstatic->fetch($objp->fk_project);

View File

@ -11,7 +11,7 @@
* Copyright (C) 2020-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2023 Benjamin Grembi <benjamin@oarces.fr>
* Copyright (C) 2023-2024 William Mead <william.mead@manchenumerique.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
*
* 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 '<tr>';
print '<td class="tdtop">'.$langs->trans('NotePublic').'</td>';
print '<td>';
$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 '<textarea name="note_public" cols="80" rows="'.ROWS_3.'">'.$note_public.'</textarea>';
print '</td></tr>';
@ -1058,7 +1058,7 @@ if ($action == 'create') {
print '<tr>';
print '<td class="tdtop">'.$langs->trans('NotePrivate').'</td>';
print '<td>';
$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 '<textarea name="note_private" cols="80" rows="'.ROWS_3.'">'.$note_private.'</textarea>';
print '</td></tr>';
@ -1316,7 +1316,7 @@ if ($action == 'create') {
if ($action != 'classify') {
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> ';
}
$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 '<div style="padding-top: 10px" id="extrafield_lines_area_'.$line->id.'" name="extrafield_lines_area_'.$line->id.'">';
print $temps;
print '</div>';
}
$temps = $objectline->showOptionals($extrafields, 'view', array(), '', '', '1', 'line');
if (!empty($temps)) {
print '<div style="padding-top: 10px" id="extrafield_lines_area_'.$line->id.'" name="extrafield_lines_area_'.$line->id.'">';
print $temps;
print '</div>';
}
print '</td>';
@ -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 '<div style="padding-top: 10px" id="extrafield_lines_area_'.$line->id.'" name="extrafield_lines_area_'.$line->id.'">';
print $temps;
print '</div>';
}
$temps = $objectline->showOptionals($extrafields, 'edit', array(), '', '', '1', 'line');
if (!empty($temps)) {
print '<div style="padding-top: 10px" id="extrafield_lines_area_'.$line->id.'" name="extrafield_lines_area_'.$line->id.'">';
print $temps;
print '</div>';
}
print '</td>';
@ -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 '<div style="padding-top: 10px" id="extrafield_lines_area_create" name="extrafield_lines_area_create">';

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -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) {

View File

@ -9,7 +9,7 @@
* Copyright (C) 2016-2018 Charlie Benke <charlie@patas-monkey.com>
* Copyright (C) 2024 William Mead <william.mead@manchenumerique.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -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)

View File

@ -9,7 +9,7 @@
* Copyright (C) 2021-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2022 Charlène Benke <charlene@patas-monkey.com>
* Copyright (C) 2024 William Mead <william.mead@manchenumerique.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Benjamin Falière <benjamin.faliere@altairis.fr>
*
* 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<string,array{label:string,checked?:int<0,1>,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 '<td class="tdoverflowmax150">';
$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 '<td class="tdoverflowmax150">';
$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 '</td>';
}
if (!$i) {

View File

@ -8,7 +8,7 @@
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2021-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
*
* This program is free software; you can redistribute it and/or modify
@ -363,9 +363,9 @@ if ($object->id > 0) {
print '</tr></table>';
print '</td><td>';
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 "</td>";
print '</tr>';
@ -381,9 +381,9 @@ if ($object->id > 0) {
print '</tr></table>';
print '</td><td>';
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 "</td>";
print '</tr>';
@ -400,9 +400,9 @@ if ($object->id > 0) {
print '</tr></table>';
print '</td><td>';
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 "</td>";
print '</tr>';
@ -432,7 +432,7 @@ if ($object->id > 0) {
print '</td></tr></table>';
print '</td>';
print '<td>';
$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 '<tr><td>'.$langs->trans("LinkedToDolibarrMember").'</td>';
print '<td>';
$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 '<div class="underbanner underbanner-before-box clearboth"></div>';
print '<br>';
@ -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')).")";

View File

@ -3,7 +3,7 @@
* Copyright (C) 2006-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -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.

View File

@ -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

View File

@ -5,7 +5,7 @@
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015-2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2021-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -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().