Qual: Fix phan notices

# Qual: Fix phan notices

Fix phan notices mostly in relation with supplier invoices,
Fix phan notices in relation with formquestion (phpdoc update, casts).
This commit is contained in:
MDW 2025-01-31 11:02:34 +01:00
parent f66e9553d5
commit 4af154c6d5
No known key found for this signature in database
25 changed files with 258 additions and 242 deletions

View File

@ -8,7 +8,7 @@
* Copyright (C) 2015-2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2021 Waël Almoman <info@almoman.com>
* 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
@ -1563,14 +1563,14 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$fullname = $object->getFullName($langs);
if ($object->morphy == 'mor') {
$companyname = $object->company;
$companyname = (string) $object->company;
if (!empty($fullname)) {
$companyalias = $fullname;
$companyalias = (string) $fullname;
}
} else {
$companyname = $fullname;
if (!empty($object->company)) {
$companyalias = $object->company;
$companyalias = (string) $object->company;
}
}

View File

@ -3,7 +3,7 @@
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2023 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2023 Joachim Kueter <git-jk@bloxera.com>
* 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
@ -597,7 +597,7 @@ if ($id) {
array('type' => 'date', 'name' => 'clone_date_value', 'label' => $langs->trans("DateValue"), 'value' => -1),
array('type' => 'other', 'tdclass' => 'fieldrequired', 'name' => 'clone_accountid', 'label' => $langs->trans("BankAccount"), 'value' => $form->select_comptes($object->fk_account, "accountid", 0, '', 1, '', 0, 'minwidth200', 1)),
array('type' => 'text', 'name' => 'clone_amount', 'label' => $langs->trans("Amount"), 'value' => price($object->amount)),
array('type' => 'select', 'name' => 'clone_sens', 'label' => $langs->trans("Sens").' '.$set_value_help, 'values' => $sensarray, 'default' => $object->sens),
array('type' => 'select', 'name' => 'clone_sens', 'label' => $langs->trans("Sens").' '.$set_value_help, 'values' => $sensarray, 'default' => (string) $object->sens),
);
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneVariousPayment', $object->ref), 'confirm_clone', $formquestion, 'yes', 1, 350);

View File

@ -148,7 +148,7 @@ class FactureRec extends CommonInvoice
public $user_author;
/**
* @var int Frequency
* @var ?int Frequency
*/
public $frequency;
@ -1945,10 +1945,10 @@ class FactureRec extends CommonInvoice
/**
* Update frequency and unit
*
* @param int $frequency value of frequency
* @param string $unit unit of frequency (d, m, y)
* @param int $notrigger Disable the trigger
* @return int Return integer <0 if KO, >0 if OK
* @param ?int $frequency value of frequency
* @param string $unit unit of frequency (d, m, y)
* @param int<0,1> $notrigger Disable the trigger
* @return int Return integer <0 if KO, >0 if OK
*/
public function setFrequencyAndUnit($frequency, $unit, $notrigger = 0)
{

View File

@ -4077,7 +4077,7 @@ class Form
$optstart .= ' data-qty="' . dol_escape_htmltag($objp->quantity) . '"';
$optstart .= ' data-up="' . dol_escape_htmltag(price2num($objp->unitprice)) . '"'; // the price with numeric international format
$optstart .= ' data-up-locale="' . dol_escape_htmltag(price($objp->unitprice)) . '"'; // the price formatted in user language
$optstart .= ' data-discount="' . dol_escape_htmltag($outdiscount) . '"';
$optstart .= ' data-discount="' . dol_escape_htmltag((string) $outdiscount) . '"';
$optstart .= ' data-tvatx="' . dol_escape_htmltag(price2num($objp->tva_tx)) . '"'; // the rate with numeric international format
$optstart .= ' data-tvatx-formated="' . dol_escape_htmltag(price($objp->tva_tx, 0, $langs, 1, -1, 2)) . '"'; // the rate formatted in user language
$optstart .= ' data-default-vat-code="' . dol_escape_htmltag($objp->default_vat_code) . '"';
@ -5274,7 +5274,7 @@ class Form
* @param int $showibanbic Show iban/bic in label
* @param string $morecss More CSS
* @param int<0,1> $nooutput 1=Return string, do not send to output
* @return int|string If noouput=0: Return integer <0 if error, Num of bank account found if OK (0, 1, 2, ...), If nooutput=1: Return a HTML select string.
* @return int|string If nooutput=0: Return integer <0 if error, Num of bank account found if OK (0, 1, 2, ...), If nooutput=1: Return a HTML select string.
*/
public function selectRib($selected = '', $htmlname = 'ribcompanyid', $filtre = '', $useempty = 0, $moreattrib = '', $showibanbic = 0, $morecss = '', $nooutput = 0)
{
@ -5615,11 +5615,11 @@ 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=...'))
* 'type' can be 'text', 'password', 'checkbox', 'radio', 'date', 'datetime', 'select', 'multiselect', 'morecss',
* 'other', 'onecolumn' or 'hidden'...
* @param array<array{name?:string,value?:string|float|bool,values?:string[],default?:string,label?:string,type:string,size?:int|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 string $selectedchoice "" or "no" or "yes"
* @param int|string $useajax 0=No, 1=Yes use Ajax to show the popup, 2=Yes and also submit page with &confirm=no if choice is No, 'xxx'=Yes and preoutput confirm box with div id=dialog-confirm-xxx
* @param int<0,2>|string $useajax 0=No, 1=Yes use Ajax to show the popup, 2=Yes and also submit page with &confirm=no if choice is No, 'xxx'=Yes and preoutput confirm box with div id=dialog-confirm-xxx
* @param int $height Force height of box
* @param int $width Force width of box
* @return void
@ -5648,9 +5648,9 @@ 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=...'))
* 'type' can be 'text', 'password', 'checkbox', 'radio', 'date', 'datetime', 'select', 'multiselect', 'morecss',
* 'other', 'onecolumn' or 'hidden'...
* @param null|string|array<array{name?:string,value?:string|float|bool,values?:string[],default?:string,label?:string,type:string,size?:int|string,morecss?:string,moreattr?:string,style?:string,inputko?:int<0,1>,tdclass?:string}>|array{text:string,0?:array{name:string,value?:string|float|bool,values?:string[],default?:string,label?:string,type:string,size?:int|string,morecss?:string,moreattr?:string,style?:string,inputko?:int<0,1>,tdclass?:string},1?:array{name:string,value?:string|float|bool,values?:string[],default?:string,label?:string,type:string,size?:int|string,morecss?:string,moreattr?:string,style?:string,inputko?:int<0,1>,tdclass?:string}} $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
* @param int<0,2>|string $useajax 0=No, 1=Yes use Ajax to show the popup, 2=Yes and also submit page with &confirm=no if choice is No, 'xxx'=Yes and preoutput confirm box with div id=dialog-confirm-xxx
* @param int|string $height Force height of box (0 = auto)
@ -7222,7 +7222,7 @@ class Form
* @param int<0,1> $disabled Disable input fields
* @param int|string $fullday When a checkbox with id #fullday is checked, hours are set with 00:00 (if value if 'fulldaystart') or 23:59 (if value is 'fulldayend')
* @param string $addplusone Add a link "+1 hour". Value must be name of another selectDate field.
* @param int|string|array<string,mixed> $adddateof Add a link "Date of ..." using the following date. Must be array(array('adddateof' => ..., 'labeladddateof' => ...))
* @param int|string|array<array{adddateof:int,labeladddateof?:string}> $adddateof Add a link "Date of ..." using the following date. Must be array(array('adddateof' => ..., 'labeladddateof' => ...))
* @param string $openinghours Specify hour start and hour end for the select ex 8,20
* @param int $stepminutes Specify step for minutes between 1 and 30
* @param string $labeladddateof Label to use for the $adddateof parameter. Deprecated. Used only when $adddateof is not an array.

View File

@ -3,7 +3,7 @@
* Copyright (C) 2006-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015-2018 Charlene BENKE <charlie@patas-monkey.com>
* Copyright (C) 2020 Maxime DEMAREST <maxime@indelog.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
@ -156,7 +156,7 @@ class pdf_paiement extends CommonDocGenerator
* @param string $_dir repertoire
* @param int $month mois du rapport
* @param int $year annee du rapport
* @param string $outputlangs Lang output object
* @param ?Translate $outputlangs Lang output object
* @return int Return integer <0 if KO, >0 if OK
*/
public function write_file($_dir, $month, $year, $outputlangs)

View File

@ -66,7 +66,7 @@ class FichinterRec extends Fichinter
public $auto_validate;
/**
* @var int Frequency
* @var ?int Frequency
*/
public $frequency;
@ -732,7 +732,7 @@ class FichinterRec extends Fichinter
/**
* Update frequency and unit
*
* @param int $frequency value of frequency
* @param ?int $frequency value of frequency
* @param string $unit unit of frequency (d, m, y)
* @return int Return integer <0 if KO, >0 if OK
*/

View File

@ -116,7 +116,7 @@ class FactureFournisseurRec extends CommonInvoice
public $label;
/**
* @var float $amount
* @var float
* @deprecated
*/
public $amount;
@ -183,7 +183,7 @@ class FactureFournisseurRec extends CommonInvoice
*/
public $usenewprice = 0;
/**
* @var int
* @var ?int
*/
public $frequency;
/**
@ -949,15 +949,15 @@ class FactureFournisseurRec extends CommonInvoice
* @param string $ref Ref
* @param string $label Label
* @param string $desc Description de la ligne
* @param double $pu_ht Unit price
* @param double $pu_ttc Unit price with tax
* @param double $qty Quantity
* @param int $remise_percent Percentage discount of the line
* @param double $txtva Taux de tva force, sinon -1
* @param float $pu_ht Unit price
* @param float $pu_ttc Unit price with tax
* @param float $qty Quantity
* @param float $remise_percent Percentage discount of the line
* @param float $txtva Taux de tva force, sinon -1
* @param int $txlocaltax1 Local tax 1 rate (deprecated)
* @param int $txlocaltax2 Local tax 2 rate (deprecated)
* @param string $price_base_type HT or TTC
* @param int $type Type of line (0=product, 1=service)
* @param int<0,1> $type Type of line (0=product, 1=service)
* @param int $date_start Date start
* @param int $date_end Date end
* @param int $info_bits VAT npr or not ?
@ -1142,10 +1142,10 @@ class FactureFournisseurRec extends CommonInvoice
* @param string $ref Ref
* @param string $label Label of the line
* @param string $desc Description de la ligne
* @param double $pu_ht Unit price HT (> 0 even for credit note)
* @param double $qty Quantity
* @param float $pu_ht Unit price HT (> 0 even for credit note)
* @param float $qty Quantity
* @param int $remise_percent Percentage discount of the line
* @param double $txtva VAT rate forced with format '5.0 (XXX)', or -1
* @param float $txtva VAT rate forced with format '5.0 (XXX)', or -1
* @param int $txlocaltax1 Local tax 1 rate (deprecated)
* @param int $txlocaltax2 Local tax 2 rate (deprecated)
* @param string $price_base_type HT or TTC
@ -1156,8 +1156,8 @@ class FactureFournisseurRec extends CommonInvoice
* @param int $special_code Special code
* @param int $rang Position of line
* @param string $fk_unit Unit
* @param double $pu_ht_devise Unit price in currency
* @param double $pu_ttc Unit price TTC (> 0 even for credit note)
* @param float $pu_ht_devise Unit price in currency
* @param float $pu_ttc Unit price TTC (> 0 even for credit note)
* @return int Return integer <0 if KO, Id of line if OK
* @throws Exception
*/
@ -1879,7 +1879,7 @@ class FactureFournisseurRec extends CommonInvoice
/**
* Update frequency and unit
*
* @param int $frequency value of frequency
* @param ?int $frequency value of frequency
* @param string $unit unit of frequency (d, m, y)
* @return int Return integer <0 if KO, >0 if OK
*/

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2023 Laurent Destailleur <eldy@users.sourceforge.net>
* 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
@ -167,7 +167,7 @@ if ($object->id > 0) {
$morehtmlref = '<div class="refidno">';
// Ref customer
$morehtmlref .= $form->editfieldkey("RefSupplierBill", 'ref_supplier', $object->ref_supplier, $object, $usercancreate, 'string', '', 0, 1);
$morehtmlref .= $form->editfieldkey("RefSupplierBill", 'ref_supplier', $object->ref_supplier, $object, (int) $usercancreate, 'string', '', 0, 1);
$morehtmlref .= $form->editfieldval("RefSupplierBill", 'ref_supplier', $object->ref_supplier, $object, $usercancreate, 'string', '', null, null, '', 1);
// Thirdparty
$morehtmlref .= '<br>'.$object->thirdparty->getNomUrl(1, 'supplier');
@ -183,7 +183,7 @@ if ($object->id > 0) {
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);

View File

@ -10,7 +10,7 @@
* Copyright (C) 2016 Meziane Sof <virtualsof@yahoo.fr>
* Copyright (C) 2017-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2023-2024 Nick Fragoulis
* 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
@ -140,6 +140,7 @@ $usercancreatewithdrarequest = $user->hasRight("prelevement", "bons", "creer");
$now = dol_now();
$error = 0;
$predef = ''; // Legacy? Used in several cards, always ''
$result = restrictedArea($user, 'supplier_invoicerec', $object->id, $objecttype);
@ -318,10 +319,10 @@ if (empty($reshook)) {
$result = $object->setBankAccount(GETPOSTINT('fk_account'));
} elseif ($action == 'setfrequency' && $permissiontoadd) {
// Set frequency and unit frequency
$object->setFrequencyAndUnit(GETPOST('frequency', 'int'), GETPOST('unit_frequency', 'alpha'));
$object->setFrequencyAndUnit((GETPOST('frequency') != '' ? GETPOSTINT('frequency') : null), GETPOST('unit_frequency', 'alpha'));
} elseif ($action == 'setdate_when' && $permissiontoadd) {
// Set next date of execution
$date = dol_mktime(GETPOST('date_whenhour'), GETPOST('date_whenmin'), 0, GETPOST('date_whenmonth'), GETPOST('date_whenday'), GETPOST('date_whenyear'));
$date = dol_mktime(GETPOSTINT('date_whenhour'), GETPOSTINT('date_whenmin'), 0, GETPOSTINT('date_whenmonth'), GETPOSTINT('date_whenday'), GETPOSTINT('date_whenyear'));
if (!empty($date)) {
$object->setNextDate($date);
}
@ -376,12 +377,12 @@ if (empty($reshook)) {
$result = $object->setMulticurrencyCode(GETPOST('multicurrency_code', 'alpha'));
} elseif ($action == 'setmulticurrencyrate' && $permissiontoadd) {
// Multicurrency rate
$result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx')), GETPOSTINT('calculation_mode'));
$result = $object->setMulticurrencyRate((float) price2num(GETPOST('multicurrency_tx')), GETPOSTINT('calculation_mode'));
} elseif ($action == 'setlibelle' && $permissiontoadd) {
// Set label
$object->fetch($id);
$object->libelle = GETPOST('libelle');
$object->label = GETPOST('libelle');
$object->libelle = $object->label;
$result = $object->update($user);
if ($result < 0) {
@ -446,14 +447,15 @@ if (empty($reshook)) {
$prod_entry_mode = GETPOST('prod_entry_mode', 'alpha');
if ($prod_entry_mode == 'free') {
$idprod = 0;
$tva_tx = (GETPOST('tva_tx', 'alpha') ? GETPOST('tva_tx', 'alpha') : 0);
$tva_tx = (GETPOST('tva_tx', 'alpha') ? (string) GETPOST('tva_tx', 'alpha') : 0);
$ref_fournisseur = (GETPOSTISSET('fourn_ref') ? GETPOST('fourn_ref', 'restricthtml') : '');
} else {
$idprod = GETPOSTINT('idprod');
$tva_tx = '';
}
$qty = price2num(GETPOST('qty' . $predef, 'alpha'), 'MS', 2);
$qty = GETPOST('qty' . $predef, 'alpha');
$qty = ($qty === '') ? '' : (float) price2num(GETPOST('qty' . $predef, 'alpha'), 'MS', 2);
$remise_percent = price2num(GETPOST('remise_percent' . $predef), '', 2);
// Extrafields
@ -467,7 +469,7 @@ if (empty($reshook)) {
}
}
if ((empty($idprod) || $idprod < 0) && ($price_ht < 0) && ($qty < 0)) {
if ((empty($idprod) || $idprod < 0) && ($price_ht < 0) && ((float) $qty < 0)) {
setEventMessages($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPriceHT'), $langs->transnoentitiesnoconv('Qty')), null, 'errors');
$error++;
}
@ -493,6 +495,7 @@ if (empty($reshook)) {
$error++;
}
$ref_fournisseur = null;
if ($prod_entry_mode != 'free' && empty($error)) { // With combolist mode idprodfournprice is > 0 or -1. With autocomplete, idprodfournprice is > 0 or ''
$productsupplier = new ProductFournisseur($db);
@ -516,9 +519,9 @@ if (empty($reshook)) {
$fksoctosearch = $object->thirdparty->id;
$productsupplier->get_buyprice(0, -1, $idprod, 'none', $fksoctosearch); // We force qty to -1 to be sure to find if a supplier price exist
}
} elseif (GETPOST('idprodfournprice', 'alpha') > 0) {
} elseif (GETPOSTINT('idprodfournprice') > 0) { // Not a string here
$qtytosearch = $qty; // Just to see if a price exists for the quantity. Not used to found vat.
$idprod = $productsupplier->get_buyprice(GETPOST('idprodfournprice', 'alpha'), $qtytosearch);
$idprod = $productsupplier->get_buyprice(GETPOSTINT('idprodfournprice'), $qtytosearch);
$res = $productsupplier->fetch($idprod);
$ref_fournisseur = $productsupplier->ref_supplier;
}
@ -533,12 +536,13 @@ if (empty($reshook)) {
$ret = $object->fetch_thirdparty();
// Clean parameters
$date_start = dol_mktime(GETPOST('date_start' . $predef . 'hour'), GETPOST('date_start' . $predef . 'min'), GETPOST('date_start' . $predef . 'sec'), GETPOST('date_start' . $predef . 'month'), GETPOST('date_start' . $predef . 'day'), GETPOST('date_start' . $predef . 'year'));
$date_end = dol_mktime(GETPOST('date_end' . $predef . 'hour'), GETPOST('date_end' . $predef . 'min'), GETPOST('date_end' . $predef . 'sec'), GETPOST('date_end' . $predef . 'month'), GETPOST('date_end' . $predef . 'day'), GETPOST('date_end' . $predef . 'year'));
$date_start = dol_mktime(GETPOSTINT('date_start' . $predef . 'hour'), GETPOSTINT('date_start' . $predef . 'min'), GETPOSTINT('date_start' . $predef . 'sec'), GETPOSTINT('date_start' . $predef . 'month'), GETPOSTINT('date_start' . $predef . 'day'), GETPOSTINT('date_start' . $predef . 'year'));
$date_end = dol_mktime(GETPOSTINT('date_end' . $predef . 'hour'), GETPOSTINT('date_end' . $predef . 'min'), GETPOSTINT('date_end' . $predef . 'sec'), GETPOSTINT('date_end' . $predef . 'month'), GETPOSTINT('date_end' . $predef . 'day'), GETPOSTINT('date_end' . $predef . 'year'));
$price_base_type = (GETPOST('price_base_type', 'alpha') ? GETPOST('price_base_type', 'alpha') : 'HT');
// Define special_code for special lines
$special_code = 0;
$price_min = 0;
// if (!GETPOST('qty')) $special_code=3; // Options should not exists on invoices
// Ecrase $pu par celui du produit
@ -666,7 +670,7 @@ if (empty($reshook)) {
}
$desc = $product_desc;
$type = GETPOST('type');
$fk_unit = GETPOST('units', 'alpha');
$fk_unit = GETPOST('units') ? GETPOSTINT('units') : null;
}
$date_start_fill = !empty(GETPOSTINT('date_start_fill')) ? GETPOSTINT('date_start_fill') : null;
@ -677,8 +681,8 @@ if (empty($reshook)) {
$buyingprice = price2num(GETPOST('buying_price' . $predef) != '' ? GETPOST('buying_price' . $predef) : ''); // If buying_price is '0', we must keep this value
// Local Taxes
$localtax1_tx = get_localtax($tva_tx, 1, $mysoc, $object->thirdparty, $tva_npr);
$localtax2_tx = get_localtax($tva_tx, 2, $mysoc, $object->thirdparty, $tva_npr);
$localtax1_tx = get_localtax((string) $tva_tx, 1, $mysoc, $object->thirdparty, $tva_npr);
$localtax2_tx = get_localtax((string) $tva_tx, 2, $mysoc, $object->thirdparty, $tva_npr);
$info_bits = 0;
if ($tva_npr) {
$info_bits |= 0x01;
@ -688,13 +692,13 @@ if (empty($reshook)) {
$pu_ht = (float) price2num($pu_ht);
$remise_percent = (float) price2num($remise_percent);
$price_min = (float) price2num($price_min);
$price_min = (float) price2num((float) $price_min);
if ($usercanproductignorepricemin && (!empty($price_min) && ($pu_ht * (1 - $remise_percent / 100) < $price_min))) {
$mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, -1, $conf->currency));
setEventMessages($mesg, null, 'errors');
} else {
// Insert line
$result = $object->addline($idprod, $ref_fournisseur, $label, $desc, $pu_ht, $pu_ttc, $qty, $remise_percent, $tva_tx, $localtax1_tx, $localtax2_tx, $price_base_type, $type, $date_start_fill, $date_end_fill, $info_bits, $special_code, -1, $fk_unit);
$result = $object->addline($idprod, (string) $ref_fournisseur, $label, $desc, $pu_ht, $pu_ttc, (float) $qty, $remise_percent, (float) $tva_tx, $localtax1_tx, $localtax2_tx, $price_base_type, $type, $date_start_fill, $date_end_fill, $info_bits, $special_code, -1, (string) $fk_unit);
if ($result > 0) {
$object->fetch($object->id); // Reload lines
@ -839,7 +843,7 @@ if (empty($reshook)) {
// Update line
if (! $error) {
$result = $object->updateline(GETPOSTINT('lineid'), GETPOSTINT('productid'), $ref_fourn, $label, $description, $pu_ht, $qty, $remise_percent, $vat_rate, $localtax1_rate, $localtax1_rate, 'HT', $type, $date_start_fill, $date_end_fill, $info_bits, $special_code, -1);
$result = $object->updateline(GETPOSTINT('lineid'), GETPOSTINT('productid'), $ref_fourn, $label, $description, (float) $pu_ht, (float) $qty, $remise_percent, (float) $vat_rate, $localtax1_rate, $localtax1_rate, 'HT', $type, $date_start_fill, $date_end_fill, $info_bits, $special_code, -1);
if ($result >= 0) {
$object->fetch($object->id); // Reload lines
@ -894,6 +898,8 @@ $form = new Form($db);
$formother = new FormOther($db);
if (isModEnabled('project')) {
$formproject = new FormProjets($db);
} else {
$formproject = null;
}
$companystatic = new Societe($db);
$invoicerectmp = new FactureFournisseurRec($db);
@ -999,7 +1005,7 @@ if ($action == 'create') {
print "</td></tr>";
// Project
if (isModEnabled('project') && is_object($object->thirdparty) && $object->thirdparty->id > 0) {
if (isModEnabled('project') && $formproject !== null && is_object($object->thirdparty) && $object->thirdparty->id > 0) {
$projectid = GETPOST('projectid') ? GETPOST('projectid') : $object->fk_project;
$langs->load('projects');
print '<tr><td>' . $langs->trans('Project') . '</td><td>';
@ -1011,13 +1017,13 @@ if ($action == 'create') {
// Bank account
if ($object->fk_account > 0) {
print "<tr><td>" . $langs->trans('BankAccount') . "</td><td>";
$form->formSelectAccount($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->fk_account, 'none');
$form->formSelectAccount($_SERVER['PHP_SELF'] . '?id=' . $object->id, (string) $object->fk_account, 'none');
print "</td></tr>";
}
//extrafields
$draft = new FactureFournisseur($db);
$draft->fetch(GETPOST('facid', 'int'));
$draft->fetch(GETPOSTINT('facid'));
$extralabels = new ExtraFields($db);
$extralabels = $extrafields->fetch_name_optionals_label($draft->table_element);
@ -1076,7 +1082,7 @@ if ($action == 'create') {
// Date next run
print "<tr><td>" . $langs->trans('NextDateToExecution') . "</td><td>";
$date_next_execution = isset($date_next_execution) ? $date_next_execution : (GETPOST('remonth') ? dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')) : -1);
$date_next_execution = isset($date_next_execution) ? $date_next_execution : (GETPOST('remonth') ? dol_mktime(12, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear')) : -1);
print $form->selectDate($date_next_execution, '', 1, 1, 0, "add", 1, 1);
print "</td></tr>";
@ -1171,19 +1177,19 @@ if ($action == 'create') {
$morehtmlref = '';
if ($action != 'edittitle') {
$morehtmlref .= $form->editfieldkey($object->title, 'title', $object->title, $object, $usercancreate, '', '', 0, 2);
$morehtmlref .= $form->editfieldkey($object->title, 'title', $object->title, $object, (int) $usercancreate, '', '', 0, 2);
} else {
$morehtmlref .= $form->editfieldval('', 'title', $object->title, $object, $usercancreate, 'string');
}
$morehtmlref .= '<div class="refidno">';
//Ref supplier
$morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $usercancreate, 'string', '', 0, 1);
$morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, (int) $usercancreate, 'string', '', 0, 1);
$morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $usercancreate, 'string', '', null, null, '', 1);
// Thirdparty
$morehtmlref .= '<br>' . $langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
// Project
if (isModEnabled('project')) {
if (isModEnabled('project') && $formproject !== null) {
$langs->load('projects');
$morehtmlref .= '<br>' . $langs->trans('Project') . ' ';
if ($usercancreate) {
@ -1194,11 +1200,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)) {
@ -1238,7 +1244,7 @@ if ($action == 'create') {
// Label
print '<tr>';
print '<td>' . $form->editfieldkey("Label", 'libelle', $object->libelle, $object, $usercancreate) . '</td>';
print '<td>' . $form->editfieldkey("Label", 'libelle', $object->libelle, $object, (int) $usercancreate) . '</td>';
print '<td>' . $form->editfieldval("Label", 'libelle', $object->libelle, $object, $usercancreate) . '</td>';
print '</tr>';
@ -1273,9 +1279,9 @@ if ($action == 'create') {
print '</tr></table>';
print '</td><td>';
if ($action == 'editconditions') {
$form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->cond_reglement_id, 'cond_reglement_id');
$form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?facid=' . $object->id, (string) $object->cond_reglement_id, 'cond_reglement_id');
} else {
$form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->cond_reglement_id, 'none');
$form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?facid=' . $object->id, (string) $object->cond_reglement_id, 'none');
}
print '</td></tr>';
@ -1291,9 +1297,9 @@ if ($action == 'create') {
print '</tr></table>';
print '</td><td>';
if ($action == 'editmode') {
$form->form_modes_reglement($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT', 1, 1);
$form->form_modes_reglement($_SERVER['PHP_SELF'] . '?facid=' . $object->id, (string) $object->mode_reglement_id, 'mode_reglement_id', 'CRDT', 1, 1);
} else {
$form->form_modes_reglement($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->mode_reglement_id, 'none');
$form->form_modes_reglement($_SERVER['PHP_SELF'] . '?facid=' . $object->id, (string) $object->mode_reglement_id, 'none');
}
print '</td></tr>';
@ -1308,9 +1314,9 @@ if ($action == 'create') {
print '</tr></table>';
print '</td><td>';
if ($action == 'editbankaccount') {
$form->formSelectAccount($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->fk_account, 'fk_account', 1);
$form->formSelectAccount($_SERVER['PHP_SELF'] . '?id=' . $object->id, (string) $object->fk_account, 'fk_account', 1);
} else {
$form->formSelectAccount($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->fk_account, 'none');
$form->formSelectAccount($_SERVER['PHP_SELF'] . '?id=' . $object->id, (string) $object->fk_account, 'none');
}
print "</td>";
print '</tr>';
@ -1397,7 +1403,7 @@ if ($action == 'create') {
// Date when (next invoice generation)
print '<tr><td>';
if ($action == 'date_when' || $object->frequency > 0) {
print $form->editfieldkey($langs->trans("NextDateToExecution"), 'date_when', $object->date_when, $object, $usercancreate, 'day');
print $form->editfieldkey($langs->trans("NextDateToExecution"), 'date_when', (string) $object->date_when, $object, (int) $usercancreate, 'day');
} else {
print $langs->trans("NextDateToExecution");
}
@ -1419,7 +1425,7 @@ if ($action == 'create') {
// Max period / Rest period
print '<tr><td>';
if ($action == 'nb_gen_max' || $object->frequency > 0) {
print $form->editfieldkey($langs->trans("MaxPeriodNumber"), 'nb_gen_max', $object->nb_gen_max, $object, $usercancreate);
print $form->editfieldkey($langs->trans("MaxPeriodNumber"), 'nb_gen_max', (string) $object->nb_gen_max, $object, (int) $usercancreate);
} else {
print $langs->trans("MaxPeriodNumber");
}
@ -1435,7 +1441,7 @@ if ($action == 'create') {
// Status of generated invoices
print '<tr><td>';
if ($action == 'auto_validate' || $object->frequency > 0) {
print $form->editfieldkey($langs->trans("StatusOfAutoGeneratedInvoices"), 'auto_validate', $object->auto_validate, $object, $usercancreate);
print $form->editfieldkey($langs->trans("StatusOfAutoGeneratedInvoices"), 'auto_validate', (string) $object->auto_validate, $object, (int) $usercancreate);
} else {
print $langs->trans("StatusOfAutoGeneratedInvoices");
}
@ -1450,7 +1456,7 @@ if ($action == 'create') {
print '<tr>';
print '<td>';
if ($action == 'generate_pdf' || $object->frequency > 0) {
print $form->editfieldkey($langs->trans("StatusOfGeneratedDocuments"), 'generate_pdf', $object->generate_pdf, $object, $usercancreate);
print $form->editfieldkey($langs->trans("StatusOfGeneratedDocuments"), 'generate_pdf', (string) $object->generate_pdf, $object, (int) $usercancreate);
} else {
print $langs->trans("StatusOfGeneratedDocuments");
}

View File

@ -13,7 +13,7 @@
* Copyright (C) 2019 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2022 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* Copyright (C) 2023 Nick Fragoulis
* 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
@ -193,7 +193,7 @@ if (empty($reshook)) {
if (GETPOST('linkedOrder') && empty($cancel) && $id > 0 && $permissiontoadd) {
$object->fetch($id);
$object->fetch_thirdparty();
$result = $object->add_object_linked('order_supplier', GETPOST('linkedOrder'));
$result = $object->add_object_linked('order_supplier', GETPOSTINT('linkedOrder'));
}
// Action clone object
@ -283,7 +283,7 @@ if (empty($reshook)) {
$revertstock = GETPOST('revertstock');
if ($revertstock) {
$idwarehouse = GETPOST('idwarehouse');
$idwarehouse = GETPOSTINT('idwarehouse');
$qualified_for_stock_change = 0;
if (!getDolGlobalString('STOCK_SUPPORTS_SERVICES')) {
@ -462,7 +462,7 @@ if (empty($reshook)) {
$result = $object->setMulticurrencyCode(GETPOST('multicurrency_code', 'alpha'));
} elseif ($action == 'setmulticurrencyrate' && $usercancreate) {
// Multicurrency rate
$result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx', 'alpha')), GETPOSTINT('calculation_mode'));
$result = $object->setMulticurrencyRate((float) price2num(GETPOST('multicurrency_tx', 'alpha')), GETPOSTINT('calculation_mode'));
} elseif ($action == 'setbankaccount' && $usercancreate) {
// bank account
$result = $object->setBankAccount(GETPOSTINT('fk_account'));
@ -762,7 +762,7 @@ if (empty($reshook)) {
$object->fetch($id);
if ($object->status == FactureFournisseur::STATUS_VALIDATED && $object->paid == 0) {
$paiementfourn = new PaiementFourn($db);
$result = $paiementfourn->fetch(GETPOST('paiement_id'));
$result = $paiementfourn->fetch(GETPOSTINT('paiement_id'));
if ($result > 0) {
$result = $paiementfourn->delete($user);
if ($result > 0) {
@ -910,8 +910,8 @@ if (empty($reshook)) {
$object->date_echeance = $datedue;
$object->note_public = GETPOST('note_public', 'restricthtml');
$object->note_private = GETPOST('note_private', 'restricthtml');
$object->cond_reglement_id = GETPOST('cond_reglement_id');
$object->mode_reglement_id = GETPOST('mode_reglement_id');
$object->cond_reglement_id = GETPOSTINT('cond_reglement_id');
$object->mode_reglement_id = GETPOSTINT('mode_reglement_id');
$object->fk_account = GETPOSTINT('fk_account');
$object->vat_reverse_charge = GETPOST('vat_reverse_charge') == 'on' ? 1 : 0;
$object->fk_project = ($tmpproject > 0) ? $tmpproject : null;
@ -1080,8 +1080,8 @@ if (empty($reshook)) {
$object->date_echeance = $datedue;
$object->note_public = GETPOST('note_public', 'restricthtml');
$object->note_private = GETPOST('note_private', 'restricthtml');
$object->cond_reglement_id = GETPOST('cond_reglement_id');
$object->mode_reglement_id = GETPOST('mode_reglement_id');
$object->cond_reglement_id = GETPOSTINT('cond_reglement_id');
$object->mode_reglement_id = GETPOSTINT('mode_reglement_id');
$object->fk_account = GETPOSTINT('fk_account');
$object->vat_reverse_charge = GETPOST('vat_reverse_charge') == 'on' ? 1 : 0;
$object->fk_project = ($tmpproject > 0) ? $tmpproject : null;
@ -1253,7 +1253,7 @@ if (empty($reshook)) {
$descline .= ' - '.$srcobject->ref;
$result = $object->addline(
$descline,
$amount, // subprice
(float) $amount, // subprice
$tva, // vat rate
0, // localtax1_tx
0, // localtax2_tx
@ -1273,7 +1273,7 @@ if (empty($reshook)) {
$object->origin,
0,
'',
'0', // special_code
0, // special_code
0,
0
//,$langs->trans('Deposit') //Deprecated
@ -1374,8 +1374,8 @@ if (empty($reshook)) {
$lines[$i]->qty,
$lines[$i]->fk_product,
$lines[$i]->remise_percent,
$date_start,
$date_end,
(int) $date_start,
(int) $date_end,
0,
$lines[$i]->info_bits,
'HT',
@ -1458,13 +1458,13 @@ if (empty($reshook)) {
if (GETPOST('productid') > 0) {
$productsupplier = new ProductFournisseur($db);
if (getDolGlobalInt('SUPPLIER_INVOICE_WITH_PREDEFINED_PRICES_ONLY') == 1) { // Not the common case
if (GETPOST('productid') > 0 && $productsupplier->get_buyprice(0, price2num(GETPOST('qty')), GETPOSTINT('productid'), 'restricthtml', GETPOSTINT('socid')) < 0) {
if (GETPOST('productid') > 0 && $productsupplier->get_buyprice(0, (float) price2num(GETPOST('qty')), GETPOSTINT('productid'), 'restricthtml', GETPOSTINT('socid')) < 0) {
setEventMessages($langs->trans("ErrorQtyTooLowForThisSupplier"), null, 'warnings');
}
}
$prod = new Product($db);
$prod->fetch(GETPOST('productid'));
$prod->fetch(GETPOSTINT('productid'));
$label = $prod->description;
if (trim(GETPOST('product_desc', 'restricthtml')) != trim($label)) {
$label = GETPOST('product_desc', 'restricthtml');
@ -1476,8 +1476,8 @@ if (empty($reshook)) {
$type = GETPOST("type") ? GETPOST("type") : 0;
}
$date_start = dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), GETPOST('date_startsec'), GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear'));
$date_end = dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), GETPOST('date_endsec'), GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear'));
$date_start = dol_mktime(GETPOSTINT('date_starthour'), GETPOSTINT('date_startmin'), GETPOSTINT('date_startsec'), GETPOSTINT('date_startmonth'), GETPOSTINT('date_startday'), GETPOSTINT('date_startyear'));
$date_end = dol_mktime(GETPOSTINT('date_endhour'), GETPOSTINT('date_endmin'), GETPOSTINT('date_endsec'), GETPOSTINT('date_endmonth'), GETPOSTINT('date_endday'), GETPOSTINT('date_endyear'));
// Define info_bits
$info_bits = 0;
@ -1506,22 +1506,22 @@ if (empty($reshook)) {
$result = $object->updateline(
GETPOSTINT('lineid'),
$label,
$up,
$tva_tx,
(float) $up,
(float) $tva_tx,
$localtax1_tx,
$localtax2_tx,
price2num(GETPOST('qty'), 'MS'),
(float) price2num(GETPOST('qty'), 'MS'),
GETPOSTINT('productid'),
$price_base_type,
$info_bits,
$type,
$remise_percent,
(float) $remise_percent,
0,
$date_start,
$date_end,
$array_options,
GETPOST('units', 'alpha'),
$pu_devise,
GETPOST('units') != '' ? GETPOSTINT('units') : null,
(float) $pu_devise,
GETPOST('fourn_ref', 'alpha')
);
if ($result >= 0) {
@ -1549,8 +1549,8 @@ if (empty($reshook)) {
}
} elseif ($action == 'addline' && GETPOST('submitforalllines', 'aZ09') && (GETPOST('alldate_start', 'alpha') || GETPOST('alldate_end', 'alpha')) && $usercancreate) {
// Define date start and date end for all line
$alldate_start = dol_mktime(GETPOST('alldate_starthour'), GETPOST('alldate_startmin'), 0, GETPOST('alldate_startmonth'), GETPOST('alldate_startday'), GETPOST('alldate_startyear'));
$alldate_end = dol_mktime(GETPOST('alldate_endhour'), GETPOST('alldate_endmin'), 0, GETPOST('alldate_endmonth'), GETPOST('alldate_endday'), GETPOST('alldate_endyear'));
$alldate_start = dol_mktime(GETPOSTINT('alldate_starthour'), GETPOSTINT('alldate_startmin'), 0, GETPOSTINT('alldate_startmonth'), GETPOSTINT('alldate_startday'), GETPOSTINT('alldate_startyear'));
$alldate_end = dol_mktime(GETPOSTINT('alldate_endhour'), GETPOSTINT('alldate_endmin'), 0, GETPOSTINT('alldate_endmonth'), GETPOSTINT('alldate_endday'), GETPOSTINT('alldate_endyear'));
foreach ($object->lines as $line) {
if ($line->product_type == 1) { // only service line
$result = $object->updateline($line->id, $line->desc, $line->subprice, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, $line->qty, $line->fk_product, 'HT', $line->info_bits, $line->product_type, $line->remise_percent, 0, $alldate_start, $alldate_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice, $line->ref_supplier, $line->rang);
@ -1563,7 +1563,7 @@ if (empty($reshook)) {
$localtax1_rate = get_localtax($vat_rate, 1, $object->thirdparty, $mysoc);
$localtax2_rate = get_localtax($vat_rate, 2, $object->thirdparty, $mysoc);
foreach ($object->lines as $line) {
$result = $object->updateline($line->id, $line->desc, $line->subprice, $vat_rate, $localtax1_rate, $localtax2_rate, $line->qty, $line->fk_product, 'HT', $line->info_bits, $line->product_type, $line->remise_percent, 0, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice, $line->ref_supplier, $line->rang);
$result = $object->updateline($line->id, $line->desc, $line->subprice, (float) $vat_rate, $localtax1_rate, $localtax2_rate, $line->qty, $line->fk_product, 'HT', $line->info_bits, $line->product_type, $line->remise_percent, 0, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice, $line->ref_supplier, $line->rang);
}
} elseif ($action == 'addline' && $usercancreate) {
// Add a product line
@ -1582,8 +1582,8 @@ if (empty($reshook)) {
// Set if we used free entry or predefined product
$predef = '';
$product_desc = (GETPOSTISSET('dp_desc') ? GETPOST('dp_desc', 'restricthtml') : '');
$date_start = dol_mktime(GETPOST('date_start'.$predef.'hour'), GETPOST('date_start'.$predef.'min'), GETPOST('date_start'.$predef.'sec'), GETPOST('date_start'.$predef.'month'), GETPOST('date_start'.$predef.'day'), GETPOST('date_start'.$predef.'year'));
$date_end = dol_mktime(GETPOST('date_end'.$predef.'hour'), GETPOST('date_end'.$predef.'min'), GETPOST('date_end'.$predef.'sec'), GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year'));
$date_start = dol_mktime(GETPOSTINT('date_start'.$predef.'hour'), GETPOSTINT('date_start'.$predef.'min'), GETPOSTINT('date_start'.$predef.'sec'), GETPOSTINT('date_start'.$predef.'month'), GETPOSTINT('date_start'.$predef.'day'), GETPOSTINT('date_start'.$predef.'year'));
$date_end = dol_mktime(GETPOSTINT('date_end'.$predef.'hour'), GETPOSTINT('date_end'.$predef.'min'), GETPOSTINT('date_end'.$predef.'sec'), GETPOSTINT('date_end'.$predef.'month'), GETPOSTINT('date_end'.$predef.'day'), GETPOSTINT('date_end'.$predef.'year'));
$prod_entry_mode = GETPOST('prod_entry_mode');
if ($prod_entry_mode == 'free') {
@ -1695,7 +1695,7 @@ if (empty($reshook)) {
$reg = array();
if (preg_match('/^idprod_([0-9]+)$/', GETPOST('idprodfournprice', 'alpha'), $reg)) {
$idprod = $reg[1];
$idprod = (int) $reg[1];
$res = $productsupplier->fetch($idprod); // Load product from its id
// Call to init some price properties of $productsupplier
// So if a supplier price already exists for another thirdparty (first one found), we use it as reference price
@ -1709,10 +1709,10 @@ if (empty($reshook)) {
$fksoctosearch = $object->thirdparty->id;
$productsupplier->get_buyprice(0, -1, $idprod, 'none', $fksoctosearch); // We force qty to -1 to be sure to find if a supplier price exist
}
} elseif (GETPOST('idprodfournprice', 'alpha') > 0) {
$qtytosearch = $qty; // Just to see if a price exists for the quantity. Not used to found vat.
} elseif (GETPOSTINT('idprodfournprice') > 0) { // Should be an int at this point
$qtytosearch = (float) $qty; // Just to see if a price exists for the quantity. Not used to found vat.
//$qtytosearch=-1; // We force qty to -1 to be sure to find if a supplier price exist
$idprod = $productsupplier->get_buyprice(GETPOST('idprodfournprice', 'alpha'), $qtytosearch);
$idprod = $productsupplier->get_buyprice(GETPOSTINT('idprodfournprice'), $qtytosearch);
$res = $productsupplier->fetch($idprod);
}
@ -1804,7 +1804,7 @@ if (empty($reshook)) {
$tva_tx,
$localtax1_tx,
$localtax2_tx,
$qty,
(float) $qty,
$idprod,
$remise_percent,
$date_start,
@ -1840,10 +1840,10 @@ if (empty($reshook)) {
$tva_tx = str_replace('*', '', $tva_tx);
$label = (GETPOST('product_label') ? GETPOST('product_label') : '');
$desc = $product_desc;
$type = GETPOST('type');
$type = GETPOSTINT('type');
$ref_supplier = GETPOST('fourn_ref', 'alpha');
$fk_unit = GETPOST('units', 'alpha');
$fk_unit = GETPOST('units') !== '' ? GETPOSTINT('units') : null;
if (!preg_match('/\((.*)\)/', $tva_tx)) {
$tva_tx = price2num($tva_tx); // $txtva can have format '5,1' or '5.1' or '5.1(XXX)', we must clean only if '5,1'
@ -1862,7 +1862,7 @@ if (empty($reshook)) {
$price_base_type = 'HT';
$pu_devise = price2num($price_ht_devise, 'CU');
$result = $object->addline($product_desc, $pu_ht, $tva_tx, $localtax1_tx, $localtax2_tx, $qty, 0, $remise_percent, $date_start, $date_end, 0, $tva_npr, $price_base_type, $type, -1, 0, $array_options, $fk_unit, 0, $pu_devise, $ref_supplier);
$result = $object->addline($product_desc, (float) $pu_ht, (float) $tva_tx, $localtax1_tx, $localtax2_tx, (float) $qty, 0, $remise_percent, $date_start, $date_end, 0, $tva_npr, $price_base_type, $type, -1, 0, $array_options, $fk_unit, 0, (float) $pu_devise, $ref_supplier);
}
//print "xx".$tva_tx; exit;
@ -2065,8 +2065,8 @@ if (empty($reshook)) {
$result = $object->fetch($id);
if ($result > 0 && $id > 0) {
$contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'));
$typeid = (GETPOST('typecontact') ? GETPOST('typecontact') : GETPOST('type'));
$contactid = (GETPOST('userid') ? GETPOSTINT('userid') : GETPOSTINT('contactid'));
$typeid = (GETPOST('typecontact') ? GETPOSTINT('typecontact') : GETPOSTINT('type'));
$result = $object->add_contact($contactid, $typeid, GETPOST("source", 'aZ09'));
}
@ -2135,6 +2135,7 @@ if ($action == 'create') {
dol_htmloutput_events();
$currency_code = $conf->currency;
$vat_reverse_charge = 0;
$societe = '';
if (GETPOSTINT('socid') > 0) {
@ -2695,7 +2696,7 @@ if ($action == 'create') {
// Invoice Subtype
if (getDolGlobalInt('INVOICE_SUBTYPE_ENABLED')) {
print '<tr><td class="fieldrequired">'.$langs->trans('InvoiceSubtype').'</td><td colspan="2">';
print $form->getSelectInvoiceSubtype(GETPOST('subtype'), 'subtype', 1, 0, '');
print $form->getSelectInvoiceSubtype(GETPOSTINT('subtype'), 'subtype', 1, 0, '');
print '</td></tr>';
}
@ -2717,7 +2718,7 @@ if ($action == 'create') {
// Date invoice
print '<tr><td class="fieldrequired">'.$langs->trans('DateInvoice').'</td><td>';
print img_picto('', 'action', 'class="pictofixedwidth"');
print $form->selectDate($dateinvoice, '', 0, 0, 0, "add", 1, 1);
print $form->selectDate((int) $dateinvoice, '', 0, 0, 0, "add", 1, 1);
print '</td></tr>';
// Payment term
@ -3271,7 +3272,7 @@ if ($action == 'create') {
$morehtmlref = '<div class="refidno">';
// Ref supplier
$morehtmlref .= $form->editfieldkey("RefSupplierBill", 'ref_supplier', $object->ref_supplier, $object, $usercancreate, 'string', '', 0, 1);
$morehtmlref .= $form->editfieldkey("RefSupplierBill", 'ref_supplier', $object->ref_supplier, $object, (int) $usercancreate, 'string', '', 0, 1);
$morehtmlref .= $form->editfieldval("RefSupplierBill", 'ref_supplier', $object->ref_supplier, $object, $usercancreate, 'string', '', null, null, '', 1);
// Thirdparty
$morehtmlref .= '<br>'.$object->thirdparty->getNomUrl(1, 'supplier');
@ -3287,7 +3288,7 @@ if ($action == 'create') {
if ($action != 'classify') {
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.((int) $object->id).'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> ';
}
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, (!getDolGlobalString('PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS') ? $object->socid : -1), $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, (!getDolGlobalString('PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS') ? $object->socid : -1), (string) $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
} else {
if (!empty($object->fk_project)) {
$proj = new Project($db);
@ -3400,7 +3401,7 @@ if ($action == 'create') {
// Label
print '<tr>';
print '<td>'.$form->editfieldkey("Label", 'label', $object->label, $object, $usercancreate).'</td>';
print '<td>'.$form->editfieldkey("Label", 'label', $object->label, $object, (int) $usercancreate).'</td>';
print '<td>'.$form->editfieldval("Label", 'label', $object->label, $object, $usercancreate).'</td>';
print '</tr>';
@ -3409,7 +3410,7 @@ if ($action == 'create') {
// Date
print '<tr><td>';
print $form->editfieldkey("DateInvoice", 'datef', $object->date, $object, $form_permission, 'datepicker');
print $form->editfieldkey("DateInvoice", 'datef', (string) $object->date, $object, (int) $form_permission, 'datepicker');
print '</td><td colspan="3">';
print $form->editfieldval("Date", 'datef', $object->date, $object, $form_permission, 'datepicker');
print '</td>';
@ -3426,16 +3427,16 @@ if ($action == 'create') {
print '</tr></table>';
print '</td><td>';
if ($action == 'editconditions') {
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'cond_reglement_id');
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->cond_reglement_id, 'cond_reglement_id');
} else {
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'none');
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->cond_reglement_id, 'none');
}
print "</td>";
print '</tr>';
// Due date
print '<tr><td>';
print $form->editfieldkey("DateMaxPayment", 'date_lim_reglement', $object->date_echeance, $object, $form_permission, 'datepicker');
print $form->editfieldkey("DateMaxPayment", 'date_lim_reglement', (string) $object->date_echeance, $object, (int) $form_permission, 'datepicker');
print '</td><td>';
print $form->editfieldval("DateMaxPayment", 'date_lim_reglement', $object->date_echeance, $object, $form_permission, 'datepicker');
if ($action != 'editdate_lim_reglement' && $object->hasDelay()) {
@ -3455,9 +3456,9 @@ if ($action == 'create') {
print '</tr></table>';
print '</td><td>';
if ($action == 'editmode') {
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', 'DBIT', 1, 1);
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->mode_reglement_id, 'mode_reglement_id', 'DBIT', 1, 1);
} else {
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'none');
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->mode_reglement_id, 'none');
}
print '</td></tr>';
@ -3473,9 +3474,9 @@ if ($action == 'create') {
print '</tr></table>';
print '</td><td>';
if ($action == 'editbankaccount') {
$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1);
$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->fk_account, 'fk_account', 1);
} else {
$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none');
$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->fk_account, 'none');
}
print "</td>";
print '</tr>';
@ -3544,9 +3545,9 @@ if ($action == 'create') {
print '</td>';
print '<td>';
if ($action == 'edittransportmode') {
$form->formSelectTransportMode($_SERVER['PHP_SELF'].'?id='.$object->id, $object->transport_mode_id, 'transport_mode_id', 1, 1);
$form->formSelectTransportMode($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->transport_mode_id, 'transport_mode_id', 1, 1);
} else {
$form->formSelectTransportMode($_SERVER['PHP_SELF'].'?id='.$object->id, $object->transport_mode_id, 'none');
$form->formSelectTransportMode($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->transport_mode_id, 'none');
}
print '</td></tr>';
}
@ -4194,7 +4195,7 @@ if ($action == 'create') {
$enableDelete = true;
$htmltooltip = '';
}
print dolGetButtonAction($htmltooltip, $langs->trans("Delete"), 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), $object->id, $enableDelete, $params);
print dolGetButtonAction($htmltooltip, $langs->trans("Delete"), 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), (string) $object->id, $enableDelete, $params);
}
print '</div>';
@ -4213,7 +4214,7 @@ if ($action == 'create') {
$modelpdf = (empty($object->model_pdf) ? getDolGlobalString('INVOICE_SUPPLIER_ADDON_PDF') : $object->model_pdf);
$genifempty = 0;
print $formfile->showdocuments('facture_fournisseur', $subdir, $filedir, $urlsource, $genallowed, $delallowed, $modelpdf, $genifempty, 0, 0, 40, 0, '', '', '', $societe->default_lang);
print $formfile->showdocuments('facture_fournisseur', $subdir, $filedir, $urlsource, (int) $genallowed, (int) $delallowed, $modelpdf, $genifempty, 0, 0, 40, 0, '', '', '', $societe->default_lang);
$somethingshown = $formfile->numoffiles;
// Show links to link elements

View File

@ -5,6 +5,7 @@
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2021-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2023 Christian Foellmann <christian@foellmann.de>
* 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
@ -68,7 +69,7 @@ $permissiontoadd = $usercancreate;
* Actions
*/
$parameters = array('id'=>$id);
$parameters = array('id' => $id);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action);
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
@ -83,8 +84,8 @@ if (empty($reshook)) {
$result = $object->fetch($id, $ref);
if ($result > 0 && $id > 0) {
$contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'));
$typeid = (GETPOST('typecontact') ? GETPOST('typecontact') : GETPOST('type'));
$contactid = (GETPOST('userid') ? GETPOSTINT('userid') : GETPOSTINT('contactid'));
$typeid = (GETPOST('typecontact') ? GETPOSTINT('typecontact') : GETPOSTINT('type'));
$result = $object->add_contact($contactid, $typeid, GETPOST("source", 'aZ09'));
}
@ -170,7 +171,7 @@ if ($id > 0 || !empty($ref)) {
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, (!getDolGlobalString('PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS') ? $object->socid : -1), $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, (!getDolGlobalString('PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS') ? $object->socid : -1), (string) $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
} else {
if (!empty($object->fk_project)) {
$proj = new Project($db);

View File

@ -7,6 +7,7 @@
* Copyright (C) 2016 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2021-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
@ -134,7 +135,7 @@ if ($object->id > 0) {
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, (!getDolGlobalString('PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS') ? $object->socid : -1), $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, (!getDolGlobalString('PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS') ? $object->socid : -1), (string) $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
} else {
if (!empty($object->fk_project)) {
$proj = new Project($db);

View File

@ -5,6 +5,7 @@
* Copyright (C) 2016 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
* 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
@ -100,7 +101,7 @@ if (isModEnabled('project')) {
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, (!getDolGlobalString('PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS') ? $object->socid : -1), $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, (!getDolGlobalString('PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS') ? $object->socid : -1), (string) $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
} else {
if (!empty($object->fk_project)) {
$proj = new Project($db);

View File

@ -8,7 +8,7 @@
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2015-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2016 Meziane Sof <virtualsof@yahoo.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Nick Fragoulis
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
@ -84,7 +84,7 @@ $search_montant_ht = GETPOST('search_montant_ht');
$search_montant_vat = GETPOST('search_montant_vat');
$search_montant_ttc = GETPOST('search_montant_ttc');
$search_payment_mode = GETPOST('search_payment_mode');
$search_payment_term = GETPOST('search_payment_term');
$search_payment_term = GETPOST('search_payment_term', 'int');
$search_date_startday = GETPOSTINT('search_date_startday');
$search_date_startmonth = GETPOSTINT('search_date_startmonth');
$search_date_startyear = GETPOSTINT('search_date_startyear');
@ -146,31 +146,31 @@ if (!$sortfield) {
$sortfield = 'f.titre';
}
$arrayfields = array(
'f.titre' => array('label' => 'Ref', 'checked' => 1),
's.nom' => array('label' => 'ThirdParty', 'checked' => 1),
'f.total_ht' => array('label' => 'AmountHT', 'checked' => 1),
'f.total_tva' => array('label' => 'AmountVAT', 'checked' => 1),
'f.total_ttc' => array('label' => 'AmountTTC', 'checked' => 1),
'f.fk_mode_reglement' => array('label' => 'PaymentMode', 'checked' => 0),
'f.fk_cond_reglement' => array('label' => 'PaymentTerm', 'checked' => 0),
'recurring' => array('label' => 'RecurringInvoice', 'checked' => 1),
'f.frequency' => array('label' => 'Frequency', 'checked' => 1),
'f.unit_frequency' => array('label' => 'FrequencyUnit', 'checked' => 1),
'f.nb_gen_done' => array('label' => 'NbOfGenerationDoneShort', 'checked' => 1),
'f.date_last_gen' => array('label' => 'DateLastGenerationShort', 'checked' => 1),
'f.date_when' => array('label' => 'NextDateToExecutionShort', 'checked' => 1),
'f.fk_user_author' => array('label' => 'UserCreation', 'checked' => 0, 'position' => 500),
'f.fk_user_modif' => array('label' => 'UserModification', 'checked' => 0, 'position' => 505),
'f.datec' => array('label' => 'DateCreation', 'checked' => 0, 'position' => 520),
'f.tms' => array('label' => 'DateModificationShort', 'checked' => 0, 'position' => 525),
'status' => array('label' => 'Status', 'checked' => 1, 'position' => 1000),
'f.titre' => array('label' => 'Ref', 'checked' => '1'),
's.nom' => array('label' => 'ThirdParty', 'checked' => '1'),
'f.total_ht' => array('label' => 'AmountHT', 'checked' => '1'),
'f.total_tva' => array('label' => 'AmountVAT', 'checked' => '1'),
'f.total_ttc' => array('label' => 'AmountTTC', 'checked' => '1'),
'f.fk_mode_reglement' => array('label' => 'PaymentMode', 'checked' => '0'),
'f.fk_cond_reglement' => array('label' => 'PaymentTerm', 'checked' => '0'),
'recurring' => array('label' => 'RecurringInvoice', 'checked' => '1'),
'f.frequency' => array('label' => 'Frequency', 'checked' => '1'),
'f.unit_frequency' => array('label' => 'FrequencyUnit', 'checked' => '1'),
'f.nb_gen_done' => array('label' => 'NbOfGenerationDoneShort', 'checked' => '1'),
'f.date_last_gen' => array('label' => 'DateLastGenerationShort', 'checked' => '1'),
'f.date_when' => array('label' => 'NextDateToExecutionShort', 'checked' => '1'),
'f.fk_user_author' => array('label' => 'UserCreation', 'checked' => '0', 'position' => 500),
'f.fk_user_modif' => array('label' => 'UserModification', 'checked' => '0', 'position' => 505),
'f.datec' => array('label' => 'DateCreation', 'checked' => '0', 'position' => 520),
'f.tms' => array('label' => 'DateModificationShort', 'checked' => '0', 'position' => 525),
'status' => 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<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan
'@phan-var-force array<string,array{label:string,checked?:string,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan
if ($socid > 0) {
$tmpthirdparty = new Societe($db);
@ -610,7 +610,7 @@ if (!empty($arrayfields['f.titre']['checked'])) {
}
// Thirdparty
if (!empty($arrayfields['s.nom']['checked'])) {
print '<td class="liste_titre left"><input class="flat" type="text" size="8" name="search_societe" value="'.dol_escape_htmltag($search_societe).'"></td>';
print '<td class="liste_titre left"><input class="flat" type="text" size="8" name="search_societe" value="'.dol_escape_htmltag((string) $search_societe).'"></td>';
}
if (!empty($arrayfields['f.total_ht']['checked'])) {
// Amount net
@ -633,7 +633,7 @@ if (!empty($arrayfields['f.total_ttc']['checked'])) {
if (!empty($arrayfields['f.fk_cond_reglement']['checked'])) {
// Payment term
print '<td class="liste_titre">';
print $form->getSelectConditionsPaiements($search_payment_term, 'search_payment_term', -1, 1, 1, 'maxwidth100');
print $form->getSelectConditionsPaiements((int) $search_payment_term, 'search_payment_term', -1, 1, 1, 'maxwidth100');
print "</td>";
}
if (!empty($arrayfields['f.fk_mode_reglement']['checked'])) {

View File

@ -15,7 +15,7 @@
* Copyright (C) 2019-2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
* Copyright (C) 2023 Nick Fragoulis
* Copyright (C) 2023 Joachim Kueter <git-jk@bloxera.com>
* 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
@ -95,7 +95,7 @@ $search_multicurrency_montant_vat = GETPOST('search_multicurrency_montant_vat',
$search_multicurrency_montant_ttc = GETPOST('search_multicurrency_montant_ttc', 'alpha');
$search_status = GETPOST('search_status', 'intcomma'); // Can be '' or a numeric
$search_paymentmode = GETPOST('search_paymentmode', 'intcomma');
$search_paymentcond = GETPOST('search_paymentcond', 'intcomma');
$search_paymentcond = GETPOST('search_paymentcond') ? GETPOSTINT('search_paymentcond') : '';
$search_town = GETPOST('search_town', 'alpha');
$search_zip = GETPOST('search_zip', 'alpha');
$search_state = GETPOST("search_state");
@ -179,42 +179,42 @@ if (empty($user->socid)) {
$checkedtypetiers = 0;
$arrayfields = array(
'f.ref' => array('label' => "Ref", 'checked' => 1, 'position' => 5),
'f.ref_supplier' => array('label' => "RefSupplier", 'checked' => 1, 'position' => 7),
'f.type' => array('label' => "Type", 'checked' => 0, 'position' => 15),
'f.subtype' => array('label' => "InvoiceSubtype", 'checked' => 0, 'position' => 17),
'f.label' => array('label' => "Label", 'checked' => 0, 'position' => 20),
'f.datef' => array('label' => "DateInvoice", 'checked' => 1, 'position' => 25),
'f.date_lim_reglement' => array('label' => "DateDue", 'checked' => 1, 'position' => 27),
'p.ref' => array('label' => "ProjectRef", 'checked' => 0, 'position' => 30),
's.nom' => array('label' => "ThirdParty", 'checked' => 1, 'position' => 41),
's.name_alias' => array('label' => "AliasNameShort", 'checked' => 0, 'position' => 42),
's.town' => array('label' => "Town", 'checked' => -1, 'position' => 43),
's.zip' => array('label' => "Zip", 'checked' => -1, 'position' => 44),
'state.nom' => array('label' => "StateShort", 'checked' => 0, 'position' => 45),
'country.code_iso' => array('label' => "Country", 'checked' => 0, 'position' => 46),
'f.ref' => array('label' => "Ref", 'checked' => '1', 'position' => 5),
'f.ref_supplier' => array('label' => "RefSupplier", 'checked' => '1', 'position' => 7),
'f.type' => array('label' => "Type", 'checked' => '0', 'position' => 15),
'f.subtype' => array('label' => "InvoiceSubtype", 'checked' => '0', 'position' => 17),
'f.label' => array('label' => "Label", 'checked' => '0', 'position' => 20),
'f.datef' => array('label' => "DateInvoice", 'checked' => '1', 'position' => 25),
'f.date_lim_reglement' => array('label' => "DateDue", 'checked' => '1', 'position' => 27),
'p.ref' => array('label' => "ProjectRef", 'checked' => '0', 'position' => 30),
's.nom' => array('label' => "ThirdParty", 'checked' => '1', 'position' => 41),
's.name_alias' => array('label' => "AliasNameShort", 'checked' => '0', 'position' => 42),
's.town' => array('label' => "Town", 'checked' => '-1', 'position' => 43),
's.zip' => array('label' => "Zip", 'checked' => '-1', 'position' => 44),
'state.nom' => array('label' => "StateShort", 'checked' => '0', 'position' => 45),
'country.code_iso' => array('label' => "Country", 'checked' => '0', 'position' => 46),
'typent.code' => array('label' => "ThirdPartyType", 'checked' => $checkedtypetiers, 'position' => 49),
'f.fk_mode_reglement' => array('label' => "PaymentMode", 'checked' => 1, 'position' => 52),
'f.fk_cond_reglement' => array('label' => "PaymentConditionsShort", 'checked' => 1, 'position' => 50),
'f.total_ht' => array('label' => "AmountHT", 'checked' => 1, 'position' => 105),
'f.total_vat' => array('label' => "AmountVAT", 'checked' => 0, 'position' => 110),
'f.total_localtax1' => array('label' => $langs->transcountry("AmountLT1", $mysoc->country_code), 'checked' => 0, 'enabled' => $mysoc->localtax1_assuj == "1", 'position' => 95),
'f.total_localtax2' => array('label' => $langs->transcountry("AmountLT2", $mysoc->country_code), 'checked' => 0, 'enabled' => $mysoc->localtax2_assuj == "1", 'position' => 100),
'f.total_ttc' => array('label' => "AmountTTC", 'checked' => 1, 'position' => 115),
'dynamount_payed' => array('label' => "Paid", 'checked' => 0, 'position' => 116),
'rtp' => array('label' => "Rest", 'checked' => 0, 'position' => 117),
'f.multicurrency_code' => array('label' => 'Currency', 'checked' => 0, 'position' => 205, 'enabled' => (!isModEnabled("multicurrency") ? 0 : 1)),
'f.multicurrency_tx' => array('label' => 'CurrencyRate', 'checked' => 0, 'position' => 206, 'enabled' => (!isModEnabled("multicurrency") ? 0 : 1)),
'f.multicurrency_total_ht' => array('label' => 'MulticurrencyAmountHT', 'position' => 207, 'checked' => 0, 'enabled' => (!isModEnabled("multicurrency") ? 0 : 1)),
'f.multicurrency_total_vat' => array('label' => 'MulticurrencyAmountVAT', 'position' => 208, 'checked' => 0, 'enabled' => (!isModEnabled("multicurrency") ? 0 : 1)),
'f.multicurrency_total_ttc' => array('label' => 'MulticurrencyAmountTTC', 'position' => 209, 'checked' => 0, 'enabled' => (!isModEnabled("multicurrency") ? 0 : 1)),
'multicurrency_dynamount_payed' => array('label' => 'MulticurrencyAlreadyPaid', 'position' => 210, 'checked' => 0, 'enabled' => (!isModEnabled("multicurrency") ? 0 : 1)),
'multicurrency_rtp' => array('label' => 'MulticurrencyRemainderToPay', 'checked' => 0, 'position' => 211, 'enabled' => (!isModEnabled("multicurrency") ? 0 : 1)), // Not enabled by default because slow
'u.login' => array('label' => "Author", 'checked' => -1, 'position' => 500),
'f.datec' => array('label' => "DateCreation", 'checked' => 0, 'position' => 501),
'f.tms' => array('label' => "DateModificationShort", 'checked' => 0, 'position' => 502),
'f.nb_docs' => array('label' => "Documents", 'checked' => -1, 'position' => 510),
'f.fk_statut' => array('label' => "Status", 'checked' => 1, 'position' => 1000),
'f.fk_mode_reglement' => array('label' => "PaymentMode", 'checked' => '1', 'position' => 52),
'f.fk_cond_reglement' => array('label' => "PaymentConditionsShort", 'checked' => '1', 'position' => 50),
'f.total_ht' => array('label' => "AmountHT", 'checked' => '1', 'position' => 105),
'f.total_vat' => array('label' => "AmountVAT", 'checked' => '0', 'position' => 110),
'f.total_localtax1' => array('label' => $langs->transcountry("AmountLT1", $mysoc->country_code), 'checked' => '0', 'enabled' => $mysoc->localtax1_assuj == "1", 'position' => 95),
'f.total_localtax2' => array('label' => $langs->transcountry("AmountLT2", $mysoc->country_code), 'checked' => '0', 'enabled' => $mysoc->localtax2_assuj == "1", 'position' => 100),
'f.total_ttc' => array('label' => "AmountTTC", 'checked' => '1', 'position' => 115),
'dynamount_payed' => array('label' => "Paid", 'checked' => '0', 'position' => 116),
'rtp' => array('label' => "Rest", 'checked' => '0', 'position' => 117),
'f.multicurrency_code' => array('label' => 'Currency', 'checked' => '0', 'position' => 205, 'enabled' => (!isModEnabled("multicurrency") ? 0 : 1)),
'f.multicurrency_tx' => array('label' => 'CurrencyRate', 'checked' => '0', 'position' => 206, 'enabled' => (!isModEnabled("multicurrency") ? 0 : 1)),
'f.multicurrency_total_ht' => array('label' => 'MulticurrencyAmountHT', 'position' => 207, 'checked' => '0', 'enabled' => (!isModEnabled("multicurrency") ? 0 : 1)),
'f.multicurrency_total_vat' => array('label' => 'MulticurrencyAmountVAT', 'position' => 208, 'checked' => '0', 'enabled' => (!isModEnabled("multicurrency") ? 0 : 1)),
'f.multicurrency_total_ttc' => array('label' => 'MulticurrencyAmountTTC', 'position' => 209, 'checked' => '0', 'enabled' => (!isModEnabled("multicurrency") ? 0 : 1)),
'multicurrency_dynamount_payed' => array('label' => 'MulticurrencyAlreadyPaid', 'position' => 210, 'checked' => '0', 'enabled' => (!isModEnabled("multicurrency") ? 0 : 1)),
'multicurrency_rtp' => array('label' => 'MulticurrencyRemainderToPay', 'checked' => '0', 'position' => 211, 'enabled' => (!isModEnabled("multicurrency") ? 0 : 1)), // Not enabled by default because slow
'u.login' => array('label' => "Author", 'checked' => '-1', 'position' => 500),
'f.datec' => array('label' => "DateCreation", 'checked' => '0', 'position' => 501),
'f.tms' => array('label' => "DateModificationShort", 'checked' => '0', 'position' => 502),
'f.nb_docs' => array('label' => "Documents", 'checked' => '-1', 'position' => 510),
'f.fk_statut' => array('label' => "Status", 'checked' => '1', 'position' => 1000),
);
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
@ -226,7 +226,7 @@ if (empty($subtypearray)) {
$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<string,array{label:string,checked?:string,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan
if (!isModEnabled('supplier_invoice')) {
accessforbidden();
@ -384,6 +384,7 @@ if (empty($reshook)) {
$rsql .= " AND pfd.traite = 0";
$rsql .= " ORDER BY pfd.date_demande DESC";
$numprlv = 0;
$result_sql = $db->query($rsql);
if ($result_sql) {
$numprlv = $db->num_rows($result_sql);
@ -439,6 +440,7 @@ $thirdparty = new Societe($db);
$subtypearray = $object->getArrayOfInvoiceSubtypes(0);
$now = dol_now();
$soc = null;
if ($socid > 0) {
$soc = new Societe($db);
$soc->fetch($socid);
@ -447,7 +449,7 @@ if ($socid > 0) {
}
}
$title = $langs->trans("BillsSuppliers").($socid ? ' - '.$soc->name : '');
$title = $langs->trans("BillsSuppliers").($socid && ($soc !== null) ? ' - '.$soc->name : '');
$help_url = 'EN:Suppliers_Invoices|FR:FactureFournisseur|ES:Facturas_de_proveedores';
// Build and execute select
@ -1064,7 +1066,7 @@ if ($user->hasRight("user", "user", "lire")) {
if ($user->hasRight("user", "user", "lire")) {
$moreforfilter .= '<div class="divsearchfield">';
$tmptitle = $langs->trans('LinkedToSpecificUsers');
$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_user, 'search_user', $tmptitle, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth200');
$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_user, 'search_user', $tmptitle, null, 0, '', '', '', 0, 0, '', 0, '', 'maxwidth200');
$moreforfilter .= '</div>';
}
// If the user can view prospects other than his'
@ -1072,8 +1074,8 @@ if (isModEnabled('category') && $user->hasRight('categorie', 'lire') && ($user->
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '<div class="divsearchfield">';
$tmptitle = $langs->trans('IncludingProductWithTag');
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1);
$moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$form->selectarray('search_product_category', $cate_arbo, $search_product_category, $tmptitle, 0, 0, '', 0, 0, 0, 0, 'maxwidth300 widthcentpercentminusx', 1);
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, '', 'parent', 0, 0, 1);
$moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$form->selectarray('search_product_category', $cate_arbo, $search_product_category, $tmptitle, 0, 0, '', 0, 0, 0, '', 'maxwidth300 widthcentpercentminusx', 1);
$moreforfilter .= '</div>';
}
@ -1185,7 +1187,7 @@ if (!empty($arrayfields['p.ref']['checked'])) {
}
// Thirpdarty
if (!empty($arrayfields['s.nom']['checked'])) {
print '<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_company" value="'.dol_escape_htmltag($search_company).'"'.($socid > 0 ? " disabled" : "").'></td>';
print '<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_company" value="'.dol_escape_htmltag((string) $search_company).'"'.($socid > 0 ? " disabled" : "").'></td>';
}
// Alias
if (!empty($arrayfields['s.name_alias']['checked'])) {
@ -1208,7 +1210,7 @@ if (!empty($arrayfields['state.nom']['checked'])) {
// Country
if (!empty($arrayfields['country.code_iso']['checked'])) {
print '<td class="liste_titre center">';
print $form->select_country($search_country, 'search_country', '', 0, 'minwidth150imp maxwidth150', 'code2', 1, 0, 1, null, 1);
print $form->select_country($search_country, 'search_country', '', 0, 'minwidth150imp maxwidth150', 'code2', 1, 0, 1, array(), 1);
print '</td>';
}
// Company type
@ -1619,10 +1621,10 @@ while ($i < $imaxinloop) {
$multicurrency_remaintopay = 0;
}
if ($facturestatic->type == FactureFournisseur::TYPE_CREDIT_NOTE && $obj->paye == 1) { // If credit note closed, we take into account the amount not yet consumed
$remaincreditnote = $discount->getAvailableDiscounts($thirdparty, '', 'rc.fk_facture_source='.$facturestatic->id);
$remaincreditnote = $discount->getAvailableDiscounts($thirdparty, null, 'rc.fk_facture_source='.$facturestatic->id);
$remaintopay = -$remaincreditnote;
$totalpay = price2num($facturestatic->total_ttc - $remaintopay);
$multicurrency_remaincreditnote = $discount->getAvailableDiscounts($thirdparty, '', 'rc.fk_facture_source='.$facturestatic->id, 0, 0, 1);
$multicurrency_remaincreditnote = $discount->getAvailableDiscounts($thirdparty, null, 'rc.fk_facture_source='.$facturestatic->id, 0, 0, 1);
$multicurrency_remaintopay = -$multicurrency_remaincreditnote;
$multicurrency_totalpay = price2num($facturestatic->multicurrency_total_ttc - $multicurrency_remaintopay);
}
@ -2126,7 +2128,7 @@ if (in_array('builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords
$delallowed = $permissiontoadd;
$title = '';
print $formfile->showdocuments('massfilesarea_supplier_invoice', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
print $formfile->showdocuments('massfilesarea_supplier_invoice', '', $filedir, $urlsource, 0, (int) $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
}
// End of page

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2023 Laurent Destailleur <eldy@users.sourceforge.net>
* 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
@ -169,7 +169,7 @@ if ($object->id > 0) {
$morehtmlref = '<div class="refidno">';
// Ref customer
$morehtmlref .= $form->editfieldkey("RefSupplierBill", 'ref_supplier', $object->ref_supplier, $object, $usercancreate, 'string', '', 0, 1);
$morehtmlref .= $form->editfieldkey("RefSupplierBill", 'ref_supplier', $object->ref_supplier, $object, (int) $usercancreate, 'string', '', 0, 1);
$morehtmlref .= $form->editfieldval("RefSupplierBill", 'ref_supplier', $object->ref_supplier, $object, $usercancreate, 'string', '', null, null, '', 1);
// Thirdparty
$morehtmlref .= '<br>'.$object->thirdparty->getNomUrl(1, 'supplier');
@ -185,7 +185,7 @@ if ($object->id > 0) {
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);

View File

@ -157,7 +157,7 @@ if ($id > 0) {
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);
@ -183,7 +183,7 @@ if ($id > 0) {
$dateexample = dol_now();
if (!empty($object->frequency) && !empty($object->date_when)) {
$dateexample = $object->date_when;
$dateexample = (int) $object->date_when;
}
$substitutionarray = getCommonSubstitutionArray($langs, 2, null, $object);

View File

@ -5,6 +5,7 @@
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2021-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
@ -130,7 +131,7 @@ if ($object->id > 0) {
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, (!getDolGlobalString('PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS') ? $object->socid : -1), $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, (!getDolGlobalString('PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS') ? $object->socid : -1), (string) $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
} else {
if (!empty($object->fk_project)) {
$proj = new Project($db);

View File

@ -13,7 +13,7 @@
* Copyright (C) 2021 Charlene Benke <charlene@patas-monkey.com>
* Copyright (C) 2022 Udo Tamm <dev@dolibit.de>
* Copyright (C) 2023 Sylvain Legrand <technique@infras.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
@ -171,7 +171,7 @@ if (empty($reshook)) {
$i = 0;
foreach ($_POST as $key => $value) {
if (substr($key, 0, 7) == 'amount_') {
$cursorfacid = substr($key, 7);
$cursorfacid = (int) substr($key, 7);
$amounts[$cursorfacid] = price2num(GETPOST($key));
if (!empty($amounts[$cursorfacid])) {
$atleastonepaymentnotnull++;
@ -202,7 +202,7 @@ if (empty($reshook)) {
$formquestion[$i++] = array('type' => 'hidden', 'name' => $key, 'value' => GETPOST($key));
} elseif (substr($key, 0, 21) == 'multicurrency_amount_') {
$cursorfacid = substr($key, 21);
$cursorfacid = (int) substr($key, 21);
$multicurrency_amounts[$cursorfacid] = (GETPOST($key) ? price2num(GETPOST($key)) : 0);
$multicurrency_totalpayment += $multicurrency_amounts[$cursorfacid];
if (!empty($multicurrency_amounts[$cursorfacid])) {

View File

@ -3,7 +3,7 @@
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2006-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* 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
@ -208,7 +208,7 @@ if ($result > 0) {
print '</td></tr>';*/
// Date of payment
print '<tr><td class="titlefield">'.$form->editfieldkey("Date", 'datep', $object->date, $object, $object->statut == 0 && ($user->hasRight("fournisseur", "facture", "creer") || $user->hasRight("supplier_invoice", "creer"))).'</td>';
print '<tr><td class="titlefield">'.$form->editfieldkey("Date", 'datep', $object->date, $object, (int) ($object->statut == 0 && ($user->hasRight("fournisseur", "facture", "creer") || $user->hasRight("supplier_invoice", "creer")))).'</td>';
print '<td>';
print $form->editfieldval("Date", 'datep', $object->date, $object, $object->statut == 0 && ($user->hasRight("fournisseur", "facture", "creer") || $user->hasRight("supplier_invoice", "creer")), 'datehourpicker', '', null, $langs->trans('PaymentDateUpdateSucceeded'));
print '</td></tr>';
@ -239,6 +239,7 @@ if ($result > 0) {
}
$allow_delete = 1;
$title_button = '';
// Bank account
if (isModEnabled("bank")) {
if ($object->fk_account) {
@ -268,7 +269,7 @@ if ($result > 0) {
}
// Note
print '<tr><td>'.$form->editfieldkey("Comments", 'note', $object->note_private, $object, ($user->hasRight("fournisseur", "facture", "creer") || $user->hasRight("supplier_invoice", "creer"))).'</td>';
print '<tr><td>'.$form->editfieldkey("Comments", 'note', $object->note_private, $object, (int) ($user->hasRight("fournisseur", "facture", "creer") || $user->hasRight("supplier_invoice", "creer"))).'</td>';
print '<td>';
print $form->editfieldval("Note", 'note', $object->note_private, $object, ($user->hasRight("fournisseur", "facture", "creer") || $user->hasRight("supplier_invoice", "creer")), 'textarea');
print '</td></tr>';
@ -409,7 +410,7 @@ if ($result > 0) {
$delallowed = ($user->hasRight("fournisseur", "facture", "creer") || $user->hasRight("supplier_invoice", "creer"));
$modelpdf = (!empty($object->model_pdf) ? $object->model_pdf : (!getDolGlobalString('SUPPLIER_PAYMENT_ADDON_PDF') ? '' : $conf->global->SUPPLIER_PAYMENT_ADDON_PDF));
print $formfile->showdocuments('supplier_payment', $ref, $filedir, $urlsource, $genallowed, $delallowed, $modelpdf, 1, 0, 0, 40, 0, '', '', '', $object->thirdparty->default_lang);
print $formfile->showdocuments('supplier_payment', $ref, $filedir, $urlsource, (int) $genallowed, (int) $delallowed, $modelpdf, 1, 0, 0, 40, 0, '', '', '', $object->thirdparty->default_lang);
$somethingshown = $formfile->numoffiles;
}

View File

@ -8,6 +8,7 @@
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2021 Jesus Jerez <jesusballesteros@protonmail.com>
* 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
@ -107,7 +108,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
* View
*/
$form = new Form($db);
$form = new Form($db);
$title = $langs->trans('Payment')." - ".$langs->trans('Documents');
llxHeader('', $title);
@ -122,7 +123,7 @@ if ($object->id > 0) {
$morehtmlref = '<div class="refidno">';
// Date of payment
$morehtmlref .= $form->editfieldkey("Date", 'datep', $object->date, $object, $object->statut == 0 && ($user->hasRight("fournisseur", "facture", "creer") || $user->hasRight("supplier_invoice", "creer")), 'datehourpicker', '', null, 3).': ';
$morehtmlref .= $form->editfieldkey("Date", 'datep', $object->date, $object, (int) ($object->statut == 0 && ($user->hasRight("fournisseur", "facture", "creer") || $user->hasRight("supplier_invoice", "creer"))), 'datehourpicker', '', 0, 3).': ';
$morehtmlref .= $form->editfieldval("Date", 'datep', $object->date, $object, $object->statut == 0 && ($user->hasRight("fournisseur", "facture", "creer") || $user->hasRight("supplier_invoice", "creer")), 'datehourpicker', '', null, $langs->trans('PaymentDateUpdateSucceeded'));
// Payment mode

View File

@ -12,7 +12,7 @@
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.com>
* Copyright (C) 2021 Ferran Marcet <fmarcet@2byte.es>
* 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
@ -30,7 +30,7 @@
/**
* \file htdocs/fourn/paiement/list.php
* \ingroup fournisseur,facture
* \ingroup fournisseur,facture
* \brief Payment list for supplier invoices
*/
@ -107,16 +107,16 @@ $fieldstosearchall = array(
);
$arrayfields = array(
'p.ref' => array('label' => "RefPayment", 'checked' => 1, 'position' => 10),
'p.datep' => array('label' => "Date", 'checked' => 1, 'position' => 20),
's.nom' => array('label' => "ThirdParty", 'checked' => 1, 'position' => 30),
'c.libelle' => array('label' => "Type", 'checked' => 1, 'position' => 40),
'p.num_paiement' => array('label' => "Numero", 'checked' => 1, 'position' => 50, 'tooltip' => "ChequeOrTransferNumber"),
'ba.label' => array('label' => "BankAccount", 'checked' => 1, 'position' => 60, 'enable' => (isModEnabled("bank"))),
'p.amount' => array('label' => "Amount", 'checked' => 1, 'position' => 70),
'p.ref' => array('label' => "RefPayment", 'checked' => '1', 'position' => 10),
'p.datep' => array('label' => "Date", 'checked' => '1', 'position' => 20),
's.nom' => array('label' => "ThirdParty", 'checked' => '1', 'position' => 30),
'c.libelle' => array('label' => "Type", 'checked' => '1', 'position' => 40),
'p.num_paiement' => array('label' => "Numero", 'checked' => '1', 'position' => 50, 'tooltip' => "ChequeOrTransferNumber"),
'ba.label' => array('label' => "BankAccount", 'checked' => '1', 'position' => 60, 'enable' => (isModEnabled("bank"))),
'p.amount' => array('label' => "Amount", 'checked' => '1', 'position' => 70),
);
$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<string,array{label:string,checked?:string,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan
// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
$hookmanager->initHooks(array('paymentsupplierlist'));

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2020 Laurent Destailleur <eldy@users.sourceforge.net>
* 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
@ -419,7 +419,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if ($action == 'close') {
$langs->load("propal");
$formquestion = array();
//Form to close proposal (signed or not)
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ConfirmClose'), $langs->trans('ConfirmCloseAsk'), 'confirm_close', $formquestion, '', 1, 250);
}

View File

@ -6,7 +6,7 @@
* Copyright (C) 2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2022-2023 Charlene Benke <charlene@patas-monkey.com>
* Copyright (C) 2023 Benjamin Falière <benjamin.faliere@altairis.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Irvine FLEITH <irvine.fleith@atm-consulting.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -787,7 +787,7 @@ if ($action == 'create' || $action == 'presend') {
}
// Default select all or no contact
$default = (getDolGlobalString('TICKET_NOTIFY_AT_CLOSING') ? -2 : -3);
$default = (getDolGlobalString('TICKET_NOTIFY_AT_CLOSING') ? '-2' : '-3');
$formquestion = array(
array(
'name' => 'contactid',
@ -987,7 +987,7 @@ if ($action == 'create' || $action == 'presend') {
}
$morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, $action == 'editcustomer' ? 'editcustomer' : 'none', '', 1, 0, 0, array(), 1);
if (!empty($object->socid)) {
$morehtmlref .= ' - <a href="'.DOL_URL_ROOT.'/ticket/list.php?socid='.$object->socid.'&sortfield=t.datec&sortorder=desc'.(getDolGlobalBool('TICKET_CLIENT_OTHER_TICKET_ONLY_OPEN')?'&search_fk_statut[]=openall':'').'">'.img_picto($langs->trans("Tickets"), 'ticket', 'class="pictofixedwidth"').' '.$langs->trans("TicketHistory").'</a>';
$morehtmlref .= ' - <a href="'.DOL_URL_ROOT.'/ticket/list.php?socid='.$object->socid.'&sortfield=t.datec&sortorder=desc'.(getDolGlobalBool('TICKET_CLIENT_OTHER_TICKET_ONLY_OPEN') ? '&search_fk_statut[]=openall' : '').'">'.img_picto($langs->trans("Tickets"), 'ticket', 'class="pictofixedwidth"').' '.$langs->trans("TicketHistory").'</a>';
}
}

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* 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
@ -327,10 +328,10 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if ($action == 'delete' || ($conf->use_javascript_ajax && empty($conf->dol_use_jmobile))) {
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteWorkstation'), $langs->trans('ConfirmDeleteObject'), 'confirm_delete', '', 0, 'action-delete');
}
$formquestion = array();
// Clone confirmation
if ($action == 'clone') {
// Create an array for form
$formquestion = array();
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneAsk', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
}