Merge pull request #33346 from mdeweerd/fix/facture
Qual: Fix phan notices (mostly facture)
This commit is contained in:
commit
bf554f8a11
18 changed files with 198 additions and 202 deletions
|
|
@ -9,10 +9,10 @@
|
|||
*/
|
||||
return [
|
||||
// # Issue statistics:
|
||||
// PhanTypeMismatchArgument : 1110+ occurrences
|
||||
// PhanTypeMismatchArgument : 1000+ occurrences
|
||||
// PhanUndeclaredProperty : 470+ occurrences
|
||||
// PhanTypeMismatchArgumentNullable : 270+ occurrences
|
||||
// PhanTypeMismatchProperty : 150+ occurrences
|
||||
// PhanTypeMismatchArgumentNullable : 260+ occurrences
|
||||
// PhanTypeMismatchProperty : 140+ occurrences
|
||||
// PhanUndeclaredGlobalVariable : 100+ occurrences
|
||||
// PhanTypeExpectedObjectPropAccess : 20+ occurrences
|
||||
// PhanTypeInvalidDimOffset : 20+ occurrences
|
||||
|
|
@ -205,22 +205,15 @@ return [
|
|||
'htdocs/compta/deplacement/class/deplacement.class.php' => ['PhanTypeMismatchArgument'],
|
||||
'htdocs/compta/deplacement/class/deplacementstats.class.php' => ['PhanTypeMismatchArgument'],
|
||||
'htdocs/compta/deplacement/stats/index.php' => ['PhanTypeMismatchArgument'],
|
||||
'htdocs/compta/facture/agenda-rec.php' => ['PhanTypeMismatchArgument'],
|
||||
'htdocs/compta/facture/agenda.php' => ['PhanTypeMismatchArgument'],
|
||||
'htdocs/compta/facture/card-rec.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchProperty'],
|
||||
'htdocs/compta/facture/card.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'],
|
||||
'htdocs/compta/facture/card-rec.php' => ['PhanTypeMismatchArgument'],
|
||||
'htdocs/compta/facture/card.php' => ['PhanUndeclaredProperty'],
|
||||
'htdocs/compta/facture/class/api_invoices.class.php' => ['PhanTypeMismatchArgumentProbablyReal'],
|
||||
'htdocs/compta/facture/class/facture-rec.class.php' => ['PhanTypeMismatchArgument', 'PhanUndeclaredProperty'],
|
||||
'htdocs/compta/facture/class/facture-rec.class.php' => ['PhanUndeclaredProperty'],
|
||||
'htdocs/compta/facture/class/facture.class.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable', 'PhanUndeclaredProperty'],
|
||||
'htdocs/compta/facture/class/factureligne.class.php' => ['PhanTypeMismatchArgument'],
|
||||
'htdocs/compta/facture/class/paymentterm.class.php' => ['PhanTypeMismatchArgument'],
|
||||
'htdocs/compta/facture/contact.php' => ['PhanTypeMismatchArgument'],
|
||||
'htdocs/compta/facture/document.php' => ['PhanTypeMismatchArgument'],
|
||||
'htdocs/compta/facture/invoicetemplate_list.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable'],
|
||||
'htdocs/compta/facture/list.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable'],
|
||||
'htdocs/compta/facture/messaging.php' => ['PhanTypeMismatchArgument'],
|
||||
'htdocs/compta/facture/note.php' => ['PhanTypeMismatchArgument'],
|
||||
'htdocs/compta/facture/prelevement.php' => ['PhanTypeMismatchArgument'],
|
||||
'htdocs/compta/facture/stats/index.php' => ['PhanTypeMismatchArgument'],
|
||||
'htdocs/compta/facture/tpl/linkedobjectblock.tpl.php' => ['PhanEmptyFQSENInClasslike', 'PhanInvalidFQSENInClasslike', 'PhanTypeMismatchArgumentNullableInternal'],
|
||||
'htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php' => ['PhanUndeclaredProperty'],
|
||||
|
|
@ -365,7 +358,7 @@ return [
|
|||
'htdocs/core/modules/expedition/doc/pdf_rouget.modules.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable'],
|
||||
'htdocs/core/modules/expensereport/doc/pdf_standard_expensereport.modules.php' => ['PhanTypeMismatchArgument', 'PhanUndeclaredProperty'],
|
||||
'htdocs/core/modules/expensereport/mod_expensereport_jade.php' => ['PhanTypeMismatchArgument'],
|
||||
'htdocs/core/modules/facture/doc/pdf_crabe.modules.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable', 'PhanUndeclaredProperty'],
|
||||
'htdocs/core/modules/facture/doc/pdf_crabe.modules.php' => ['PhanTypeMismatchArgumentNullable', 'PhanUndeclaredProperty'],
|
||||
'htdocs/core/modules/facture/doc/pdf_octopus.modules.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable', 'PhanUndeclaredProperty'],
|
||||
'htdocs/core/modules/facture/doc/pdf_sponge.modules.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable', 'PhanUndeclaredProperty'],
|
||||
'htdocs/core/modules/facture/modules_facture.php' => ['PhanTypeMismatchArgument'],
|
||||
|
|
|
|||
|
|
@ -16,7 +16,8 @@ $config = include __DIR__.DIRECTORY_SEPARATOR."config.php";
|
|||
//require_once __DIR__.'/plugins/SelectDateFixer.php';
|
||||
//require_once __DIR__.'/plugins/setPageOrientationFixer.php';
|
||||
//require_once __DIR__.'/plugins/textwithpictoFixer.php';
|
||||
require_once __DIR__.'/plugins/ifsqlFixer.php';
|
||||
//require_once __DIR__.'/plugins/ifsqlFixer.php';
|
||||
require_once __DIR__.'/plugins/writeHTMLCellFixer.php';
|
||||
//require_once __DIR__.'/plugins/MultiCellFixer.php';
|
||||
//require_once __DIR__.'/plugins/setAutoPageBreakFixer.php';
|
||||
//require_once __DIR__.'/plugins/CellFixer.php';
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
/* Copyright (C) 2023 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -171,7 +171,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);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
/* Copyright (C) 2023 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
|
||||
|
|
@ -165,7 +166,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);
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
* Copyright (C) 2016 Meziane Sof <virtualsof@yahoo.fr>
|
||||
* Copyright (C) 2017-2025 Frédéric France <frederic.france@free.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
|
||||
|
|
@ -473,7 +473,7 @@ if (empty($reshook)) {
|
|||
setEventMessages($line->error, $line->errors, 'errors');
|
||||
}
|
||||
} elseif ($action == 'update_extras' && $usercancreate) {
|
||||
$object->oldcopy = dol_clone($object, 2);
|
||||
$object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty
|
||||
|
||||
// Fill array 'array_options' with data from update form
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml'));
|
||||
|
|
@ -719,14 +719,14 @@ if (empty($reshook)) {
|
|||
$info_bits |= 0x01;
|
||||
}
|
||||
|
||||
$fk_parent_line = GETPOST('fk_parent_line', 'int');
|
||||
$fk_parent_line = GETPOSTINT('fk_parent_line');
|
||||
|
||||
if ($usercanproductignorepricemin && (!empty($price_min) && ((float) price2num($pu_ht) * (1 - (float) price2num($remise_percent) / 100) < (float) price2num($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($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $info_bits, 0, $pu_ttc, $type, -1, $special_code, $label, $fk_unit, 0, $date_start_fill, $date_end_fill, $fournprice, $buyingprice, $fk_parent_line);
|
||||
$result = $object->addline($desc, $pu_ht, (float) $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $info_bits, 0, $pu_ttc, $type, -1, $special_code, $label, (int) $fk_unit, 0, $date_start_fill, $date_end_fill, (int) $fournprice, (int) $buyingprice, $fk_parent_line);
|
||||
|
||||
if ($result > 0) {
|
||||
// Define output language and generate document
|
||||
|
|
@ -919,9 +919,9 @@ if (empty($reshook)) {
|
|||
$result = $object->updateline(
|
||||
GETPOSTINT('lineid'),
|
||||
$description,
|
||||
$pu_ht,
|
||||
$qty,
|
||||
$vat_rate,
|
||||
(float) $pu_ht,
|
||||
(float) $qty,
|
||||
(float) $vat_rate,
|
||||
$localtax1_rate,
|
||||
$localtax1_rate,
|
||||
GETPOSTINT('productid'),
|
||||
|
|
@ -934,14 +934,14 @@ if (empty($reshook)) {
|
|||
$position,
|
||||
$special_code,
|
||||
$label,
|
||||
GETPOST('units'),
|
||||
$pu_ht_devise,
|
||||
GETPOSTINT('units'),
|
||||
(float) $pu_ht_devise,
|
||||
0,
|
||||
$date_start_fill,
|
||||
$date_end_fill,
|
||||
$fournprice,
|
||||
$buyingprice,
|
||||
$fk_parent_line
|
||||
(int) $fournprice,
|
||||
(int) $buyingprice,
|
||||
(int) $fk_parent_line
|
||||
);
|
||||
|
||||
if ($result >= 0) {
|
||||
|
|
@ -1116,7 +1116,7 @@ if ($action == 'create') {
|
|||
// Payment mode
|
||||
print "<tr><td>".$langs->trans("PaymentMode")."</td><td>";
|
||||
print img_picto('', 'payment', 'class="pictofixedwidth"');
|
||||
print $form->select_types_paiements(GETPOSTISSET('mode_reglement_id') ? GETPOSTINT('mode_reglement_id') : $object->mode_reglement_id, 'mode_reglement_id', '', 0, 1, 0, 0, 1, '', 1);
|
||||
print $form->select_types_paiements((string) (GETPOSTISSET('mode_reglement_id') ? GETPOSTINT('mode_reglement_id') : $object->mode_reglement_id), 'mode_reglement_id', '', 0, 1, 0, 0, 1, '', 1);
|
||||
//$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', '', 1);
|
||||
print "</td></tr>";
|
||||
|
||||
|
|
@ -1155,7 +1155,7 @@ 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>";
|
||||
}
|
||||
|
||||
|
|
@ -1368,7 +1368,7 @@ if ($action == 'create') {
|
|||
if ($action != 'classify') {
|
||||
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> ';
|
||||
}
|
||||
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
|
||||
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, (string) $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
|
||||
} else {
|
||||
if (!empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
|
|
@ -1442,9 +1442,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>';
|
||||
|
||||
|
|
@ -1459,9 +1459,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>';
|
||||
|
||||
|
|
@ -1480,9 +1480,9 @@ if ($action == 'create') {
|
|||
print '</td><td>';
|
||||
|
||||
if ($action == 'editbankaccountcustomer') {
|
||||
$form->formRib($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->fk_societe_rib, 'accountcustomerid', 'fk_soc='.$object->socid, 1, 1);
|
||||
$form->formRib($_SERVER['PHP_SELF'] . '?id=' . $object->id, (string) $object->fk_societe_rib, 'accountcustomerid', 'fk_soc='.$object->socid, 1, 1);
|
||||
} else {
|
||||
$form->formRib($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->fk_societe_rib, 'none', '', 0, 1);
|
||||
$form->formRib($_SERVER['PHP_SELF'] . '?id=' . $object->id, (string) $object->fk_societe_rib, 'none', '', 0, 1);
|
||||
}
|
||||
print "</td>";
|
||||
print '</tr>';
|
||||
|
|
@ -1499,9 +1499,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>';
|
||||
|
|
@ -1614,7 +1614,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, $user->hasRight('facture', 'creer'));
|
||||
print $form->editfieldkey($langs->trans("MaxPeriodNumber"), 'nb_gen_max', (string) $object->nb_gen_max, $object, $user->hasRight('facture', 'creer'));
|
||||
} else {
|
||||
print $langs->trans("MaxPeriodNumber");
|
||||
}
|
||||
|
|
@ -1630,7 +1630,7 @@ if ($action == 'create') {
|
|||
// Status of auto generated invoices
|
||||
print '<tr><td>';
|
||||
if ($action == 'auto_validate' || $object->frequency > 0) {
|
||||
print $form->editfieldkey($langs->trans("StatusOfAutoGeneratedInvoices"), 'auto_validate', $object->auto_validate, $object, $user->hasRight('facture', 'creer'));
|
||||
print $form->editfieldkey($langs->trans("StatusOfAutoGeneratedInvoices"), 'auto_validate', (string) $object->auto_validate, $object, $user->hasRight('facture', 'creer'));
|
||||
} else {
|
||||
print $langs->trans("StatusOfAutoGeneratedInvoices");
|
||||
}
|
||||
|
|
@ -1645,7 +1645,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, $user->hasRight('facture', 'creer'));
|
||||
print $form->editfieldkey($langs->trans("StatusOfGeneratedDocuments"), 'generate_pdf', (string) $object->generate_pdf, $object, $user->hasRight('facture', 'creer'));
|
||||
} else {
|
||||
print $langs->trans("StatusOfGeneratedDocuments");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -305,7 +305,7 @@ if (empty($reshook)) {
|
|||
|
||||
if (($usercandelete && $isErasable > 0)
|
||||
|| ($usercancreate && $isErasable == 1)) {
|
||||
$result = $object->delete($user, 0, $idwarehouse);
|
||||
$result = $object->delete($user, 0, (int) $idwarehouse);
|
||||
if ($result > 0) {
|
||||
header('Location: '.DOL_URL_ROOT.'/compta/facture/list.php?restore_lastsearch_values=1');
|
||||
exit();
|
||||
|
|
@ -427,7 +427,7 @@ if (empty($reshook)) {
|
|||
|
||||
if ($tmpvatratetoshow[0] != 0) {
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans("ErrorLinesCantBeNegativeForOneVATRate", $tmpvatratetoshow[0]), null, 'errors');
|
||||
setEventMessages($langs->trans("ErrorLinesCantBeNegativeForOneVATRate", (string) $tmpvatratetoshow[0]), null, 'errors');
|
||||
$error++;
|
||||
$action = '';
|
||||
}
|
||||
|
|
@ -472,7 +472,7 @@ if (empty($reshook)) {
|
|||
}
|
||||
} elseif ($action == 'setretainedwarrantydatelimit' && $usercancreate) {
|
||||
$object->fetch($id);
|
||||
$result = $object->setRetainedWarrantyDateLimit(GETPOSTFLOAT('retained_warranty_date_limit'));
|
||||
$result = $object->setRetainedWarrantyDateLimit(GETPOSTINT('retained_warranty_date_limit'));
|
||||
if ($result < 0) {
|
||||
dol_print_error($db, $object->error);
|
||||
}
|
||||
|
|
@ -607,7 +607,7 @@ if (empty($reshook)) {
|
|||
$result = $object->setBankAccount(GETPOSTINT('fk_account'));
|
||||
} elseif ($action == 'setremisepercent' && $usercancreate) {
|
||||
$object->fetch($id);
|
||||
$result = $object->setDiscount($user, price2num(GETPOST('remise_percent'), '', 2));
|
||||
$result = $object->setDiscount($user, (float) price2num(GETPOST('remise_percent'), '', 2));
|
||||
} elseif ($action == "setabsolutediscount" && $usercancreate) {
|
||||
// We have POST[remise_id] or POST[remise_id_for_payment]
|
||||
$db->begin();
|
||||
|
|
@ -1691,7 +1691,7 @@ if (empty($reshook)) {
|
|||
$descline .= ' - '.$srcobject->ref;
|
||||
$result = $object->addline(
|
||||
$descline,
|
||||
$amount, // subprice
|
||||
(float) $amount, // subprice
|
||||
1, // quantity
|
||||
$tva, // vat rate
|
||||
0, // localtax1_tx
|
||||
|
|
@ -1749,7 +1749,7 @@ if (empty($reshook)) {
|
|||
if (is_array($lines)) {
|
||||
foreach ($lines as $line) {
|
||||
// We keep ->subprice and ->pa_ht, but we change the qty
|
||||
$line->qty = price2num((float) $line->qty * (float) $valuestandardinvoice / 100, 'MS');
|
||||
$line->qty = (float) price2num((float) $line->qty * (float) $valuestandardinvoice / 100, 'MS');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1758,7 +1758,7 @@ if (empty($reshook)) {
|
|||
if (is_array($lines)) {
|
||||
foreach ($lines as $line) {
|
||||
// We keep ->subprice and ->pa_ht, but we change the qty
|
||||
$line->qty = price2num((float) $line->qty * (float) $valuedeposit / 100, 'MS');
|
||||
$line->qty = (float) price2num((float) $line->qty * (float) $valuedeposit / 100, 'MS');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1971,7 +1971,7 @@ if (empty($reshook)) {
|
|||
$product->fetch(GETPOSTINT('idprod'.$i));
|
||||
$startday = dol_mktime(12, 0, 0, GETPOSTINT('date_start'.$i.'month'), GETPOSTINT('date_start'.$i.'day'), GETPOSTINT('date_start'.$i.'year'));
|
||||
$endday = dol_mktime(12, 0, 0, GETPOSTINT('date_end'.$i.'month'), GETPOSTINT('date_end'.$i.'day'), GETPOSTINT('date_end'.$i.'year'));
|
||||
$result = $object->addline($product->description, $product->price, price2num(GETPOST('qty'.$i), 'MS'), $product->tva_tx, $product->localtax1_tx, $product->localtax2_tx, GETPOSTINT('idprod'.$i), price2num(GETPOST('remise_percent'.$i), '', 2), $startday, $endday, 0, 0, 0, $product->price_base_type, $product->price_ttc, $product->type, -1, 0, '', 0, 0, 0, 0, '', array(), 100, 0, $product->fk_unit, 0, '', 1);
|
||||
$result = $object->addline($product->description, $product->price, (float) price2num(GETPOST('qty'.$i), 'MS'), $product->tva_tx, $product->localtax1_tx, $product->localtax2_tx, GETPOSTINT('idprod'.$i), (float) price2num(GETPOST('remise_percent'.$i), '', 2), $startday, $endday, 0, 0, 0, $product->price_base_type, $product->price_ttc, $product->type, -1, 0, '', 0, 0, 0, 0, '', array(), 100, 0, $product->fk_unit, 0, '', 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2181,7 +2181,7 @@ if (empty($reshook)) {
|
|||
if (!empty($line->vat_src_code)) {
|
||||
$tvatx .= ' ('.$line->vat_src_code.')';
|
||||
}
|
||||
$result = $object->updateline($line->id, $line->desc, $line->subprice, $line->qty, $remise_percent, $line->date_start, $line->date_end, $tvatx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit, $line->multicurrency_subprice);
|
||||
$result = $object->updateline($line->id, $line->desc, $line->subprice, $line->qty, (float) $remise_percent, $line->date_start, $line->date_end, $tvatx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit, $line->multicurrency_subprice);
|
||||
}
|
||||
} elseif ($action == 'addline' && !GETPOST('submitforalllines', 'alpha') && !GETPOST('submitforallmargins', 'alpha') && $usercancreate) { // Add a new line
|
||||
$langs->load('errors');
|
||||
|
|
@ -2564,7 +2564,7 @@ if (empty($reshook)) {
|
|||
}
|
||||
|
||||
// Insert line
|
||||
$result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $date_start, $date_end, 0, $info_bits, 0, $price_base_type, $pu_ttc, $type, min($rank, count($object->lines) + 1), $special_code, '', 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $array_options, GETPOST('progress'), 0, $fk_unit, $pu_ht_devise);
|
||||
$result = $object->addline($desc, $pu_ht, (float) $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $date_start, $date_end, 0, $info_bits, 0, $price_base_type, $pu_ttc, $type, min($rank, count($object->lines) + 1), $special_code, '', 0, GETPOSTINT('fk_parent_line'), (int) $fournprice, $buyingprice, $label, $array_options, GETPOSTINT('progress'), 0, $fk_unit, (float) $pu_ht_devise);
|
||||
|
||||
if ($result > 0) {
|
||||
// Define output language and generate document
|
||||
|
|
@ -2843,9 +2843,9 @@ if (empty($reshook)) {
|
|||
$result = $object->updateline(
|
||||
GETPOSTINT('lineid'),
|
||||
$description,
|
||||
$pu,
|
||||
$qty,
|
||||
$remise_percent,
|
||||
(float) $pu,
|
||||
(float) $qty,
|
||||
(float) $remise_percent,
|
||||
$date_start,
|
||||
$date_end,
|
||||
$vat_rate,
|
||||
|
|
@ -2862,8 +2862,8 @@ if (empty($reshook)) {
|
|||
$special_code,
|
||||
$array_options,
|
||||
$addprogress,
|
||||
GETPOST('units', 'alpha'),
|
||||
$pu_ht_devise
|
||||
GETPOSTINT('units'),
|
||||
(float) $pu_ht_devise
|
||||
);
|
||||
|
||||
if ($result >= 0) {
|
||||
|
|
@ -2940,7 +2940,7 @@ if (empty($reshook)) {
|
|||
setEventMessages($mesg, null, 'warnings');
|
||||
$result = -1;
|
||||
} else {
|
||||
$object->update_percent($line, GETPOST('all_progress'), false);
|
||||
$object->update_percent($line, GETPOSTINT('all_progress'), false);
|
||||
}
|
||||
}
|
||||
$object->update_price(1);
|
||||
|
|
@ -3155,7 +3155,7 @@ if (empty($reshook)) {
|
|||
|
||||
|
||||
if ($action == 'update_extras' && $usercancreate) {
|
||||
$object->oldcopy = dol_clone($object, 2);
|
||||
$object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty
|
||||
$attribute_name = GETPOST('attribute', 'restricthtml');
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
|
|
@ -3183,7 +3183,7 @@ if (empty($reshook)) {
|
|||
$result = $object->fetch($id);
|
||||
|
||||
if ($result > 0 && $id > 0) {
|
||||
$contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'));
|
||||
$contactid = (GETPOST('userid') ? GETPOSTINT('userid') : GETPOSTINT('contactid'));
|
||||
$typeid = (GETPOST('typecontact') ? GETPOST('typecontact') : GETPOST('type'));
|
||||
$result = $object->add_contact($contactid, $typeid, GETPOST("source", 'aZ09'));
|
||||
}
|
||||
|
|
@ -3734,7 +3734,7 @@ if ($action == 'create') {
|
|||
print '</div></div>';
|
||||
|
||||
// Next situation invoice
|
||||
$opt = $form->selectSituationInvoices(GETPOSTINT('originid'), $socid);
|
||||
$opt = $form->selectSituationInvoices((string) GETPOSTINT('originid'), $socid);
|
||||
|
||||
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
||||
$tmp = '<input id="radio_situation_bis" type="radio" name="type" value="5"'.(GETPOST('type') == 5 && GETPOSTINT('originid') ? ' checked' : '');
|
||||
|
|
@ -3974,7 +3974,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>';
|
||||
}
|
||||
|
||||
|
|
@ -4068,7 +4068,7 @@ if ($action == 'create') {
|
|||
// Payment mode
|
||||
print '<tr><td>'.$langs->trans('PaymentMode').'</td><td colspan="2">';
|
||||
print img_picto('', 'bank', 'class="pictofixedwidth"');
|
||||
print $form->select_types_paiements($mode_reglement_id, 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth250 widthcentpercentminusx', 1);
|
||||
print $form->select_types_paiements((string) $mode_reglement_id, 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth250 widthcentpercentminusx', 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Bank Account
|
||||
|
|
@ -4194,7 +4194,7 @@ if ($action == 'create') {
|
|||
print $form->textwithpicto($langs->trans('NotePublic'), $htmltext);
|
||||
print '</td>';
|
||||
print '<td valign="top" colspan="2">';
|
||||
$doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', false, false, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3, '90%');
|
||||
$doleditor = new DolEditor('note_public', (string) $note_public, '', 80, 'dolibarr_notes', 'In', false, false, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3, '90%');
|
||||
print $doleditor->Create(1);
|
||||
|
||||
// Private note
|
||||
|
|
@ -4204,7 +4204,7 @@ if ($action == 'create') {
|
|||
print $form->textwithpicto($langs->trans('NotePrivate'), $htmltext);
|
||||
print '</td>';
|
||||
print '<td valign="top" colspan="2">';
|
||||
$doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', false, false, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3, '90%');
|
||||
$doleditor = new DolEditor('note_private', (string) $note_private, '', 80, 'dolibarr_notes', 'In', false, false, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3, '90%');
|
||||
print $doleditor->Create(1);
|
||||
// print '<textarea name="note_private" wrap="soft" cols="70" rows="'.ROWS_3.'">'.$note_private.'.</textarea>
|
||||
print '</td></tr>';
|
||||
|
|
@ -4721,13 +4721,13 @@ if ($action == 'create') {
|
|||
$morehtmlref = '<div class="refidno">';
|
||||
// Ref invoice
|
||||
if ($object->status == $object::STATUS_DRAFT && !$mysoc->isInEEC() && getDolGlobalString('INVOICE_ALLOW_FREE_REF')) {
|
||||
$morehtmlref .= $form->editfieldkey("Ref", 'ref', $object->ref, $object, $usercancreate, 'string', '', 0, 1);
|
||||
$morehtmlref .= $form->editfieldval("Ref", 'ref', $object->ref, $object, $usercancreate, 'string', '', null, null, '', 1);
|
||||
$morehtmlref .= $form->editfieldkey("Ref", 'ref', $object->ref, $object, (int) $usercancreate, 'string', '', 0, 1);
|
||||
$morehtmlref .= $form->editfieldval("Ref", 'ref', $object->ref, $object, (int) $usercancreate, 'string', '', null, null, '', 1);
|
||||
$morehtmlref .= '<br>';
|
||||
}
|
||||
// Ref customer
|
||||
$morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_customer, $object, $usercancreate, 'string', '', 0, 1);
|
||||
$morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_customer, $object, $usercancreate, 'string'.(getDolGlobalString('THIRDPARTY_REF_INPUT_SIZE') ? ':' . getDolGlobalString('THIRDPARTY_REF_INPUT_SIZE') : ''), '', null, null, '', 1);
|
||||
$morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_customer, $object, (int) $usercancreate, 'string', '', 0, 1);
|
||||
$morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_customer, $object, (int) $usercancreate, 'string'.(getDolGlobalString('THIRDPARTY_REF_INPUT_SIZE') ? ':' . getDolGlobalString('THIRDPARTY_REF_INPUT_SIZE') : ''), '', null, null, '', 1);
|
||||
// Thirdparty
|
||||
$morehtmlref .= '<br>'.$object->thirdparty->getNomUrl(1, 'customer');
|
||||
if (!getDolGlobalString('MAIN_DISABLE_OTHER_LINK') && $object->thirdparty->id > 0) {
|
||||
|
|
@ -4742,7 +4742,7 @@ if ($action == 'create') {
|
|||
if ($action != 'classify') {
|
||||
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> ';
|
||||
}
|
||||
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
|
||||
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, (string) $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
|
||||
} else {
|
||||
if (!empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
|
|
@ -4903,9 +4903,9 @@ if ($action == 'create') {
|
|||
print '</td><td>';
|
||||
if ($object->type != Facture::TYPE_CREDIT_NOTE) {
|
||||
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');
|
||||
}
|
||||
} else {
|
||||
print ' ';
|
||||
|
|
@ -4947,9 +4947,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', 'CRDT');
|
||||
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, (string) $object->mode_reglement_id, 'none', 'CRDT');
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
|
|
@ -4965,9 +4965,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>';
|
||||
|
|
@ -5016,7 +5016,7 @@ if ($action == 'create') {
|
|||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$c = new Categorie($db);
|
||||
$cats = $c->containing($object->id, Categorie::TYPE_INVOICE);
|
||||
$arrayselected=[];
|
||||
$arrayselected = [];
|
||||
foreach ($cats as $cat) {
|
||||
$arrayselected[] = $cat->id;
|
||||
}
|
||||
|
|
@ -5091,7 +5091,7 @@ if ($action == 'create') {
|
|||
print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
} else {
|
||||
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->retained_warranty_fk_cond_reglement, 'none');
|
||||
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, (string) $object->retained_warranty_fk_cond_reglement, 'none');
|
||||
if (!$displayWarranty) {
|
||||
print img_picto($langs->trans('RetainedWarrantyNeed100Percent'), 'warning.png', 'class="pictowarning valignmiddle" ');
|
||||
}
|
||||
|
|
@ -6190,7 +6190,7 @@ if ($action == 'create') {
|
|||
$filedir,
|
||||
$urlsource,
|
||||
$genallowed,
|
||||
$delallowed,
|
||||
(int) $delallowed,
|
||||
$object->model_pdf,
|
||||
1,
|
||||
0,
|
||||
|
|
|
|||
|
|
@ -373,7 +373,7 @@ class FactureRec extends CommonInvoice
|
|||
$sql .= ") VALUES (";
|
||||
$sql .= "'".$this->db->escape($this->titre ? $this->titre : $this->title)."'";
|
||||
$sql .= ", ".((int) $this->socid);
|
||||
$sql .= ", ".($this->subtype ? "'".$this->db->escape($this->subtype)."'" : "null");
|
||||
$sql .= ", ".($this->subtype ? "'".$this->db->escape((string) $this->subtype)."'" : "null");
|
||||
$sql .= ", ".((int) $conf->entity);
|
||||
$sql .= ", '".$this->db->idate($now)."'";
|
||||
$sql .= ", ".(!empty($facsrc->total_ttc) ? ((float) $facsrc->total_ttc) : '0');
|
||||
|
|
@ -554,9 +554,9 @@ class FactureRec extends CommonInvoice
|
|||
/**
|
||||
* Update a line invoice_rec.
|
||||
*
|
||||
* @param User $user User
|
||||
* @param int $notrigger No trigger
|
||||
* @return int Return integer <0 if KO, Id of line if OK
|
||||
* @param User $user User
|
||||
* @param int<0,1> $notrigger No trigger
|
||||
* @return int Return integer <0 if KO, Id of line if OK
|
||||
*/
|
||||
public function update(User $user, $notrigger = 0)
|
||||
{
|
||||
|
|
@ -611,12 +611,12 @@ class FactureRec extends CommonInvoice
|
|||
/**
|
||||
* Load object and lines
|
||||
*
|
||||
* @param int $rowid Id of object to load
|
||||
* @param string $ref Reference of recurring invoice
|
||||
* @param string $ref_ext External reference of invoice
|
||||
* @param int $noextrafields 0=Default to load extrafields, 1=No extrafields
|
||||
* @param int $nolines 0=Default to load lines, 1=No lines
|
||||
* @return int >0 if OK, <0 if KO, 0 if not found
|
||||
* @param int $rowid Id of object to load
|
||||
* @param string $ref Reference of recurring invoice
|
||||
* @param string $ref_ext External reference of invoice
|
||||
* @param int<0,1> $noextrafields 0=Default to load extrafields, 1=No extrafields
|
||||
* @param int<0,1> $nolines 0=Default to load lines, 1=No lines
|
||||
* @return int If OK >0, <0 if KO, 0 if not found
|
||||
*/
|
||||
public function fetch($rowid, $ref = '', $ref_ext = '', $noextrafields = 0, $nolines = 0)
|
||||
{
|
||||
|
|
@ -859,10 +859,10 @@ class FactureRec extends CommonInvoice
|
|||
/**
|
||||
* Delete template invoice
|
||||
*
|
||||
* @param User $user User that delete.
|
||||
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||
* @param int $idwarehouse Id warehouse to use for stock change.
|
||||
* @return int Return integer <0 if KO, >0 if OK
|
||||
* @param User $user User that delete.
|
||||
* @param int<0,1> $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||
* @param int $idwarehouse Id warehouse to use for stock change.
|
||||
* @return int Return integer <0 if KO, >0 if OK
|
||||
*/
|
||||
public function delete(User $user, $notrigger = 0, $idwarehouse = -1)
|
||||
{
|
||||
|
|
@ -923,27 +923,27 @@ class FactureRec extends CommonInvoice
|
|||
* Add a line to invoice
|
||||
*
|
||||
* @param string $desc Description de la ligne
|
||||
* @param double $pu_ht Prix unitaire HT (> 0 even for credit note)
|
||||
* @param double $qty Quantite
|
||||
* @param double $txtva Taux de tva force, sinon -1
|
||||
* @param double $txlocaltax1 Local tax 1 rate (deprecated)
|
||||
* @param double $txlocaltax2 Local tax 2 rate (deprecated)
|
||||
* @param float $pu_ht Prix unitaire HT (> 0 even for credit note)
|
||||
* @param float $qty Quantite
|
||||
* @param float $txtva Taux de tva force, sinon -1
|
||||
* @param float $txlocaltax1 Local tax 1 rate (deprecated)
|
||||
* @param float $txlocaltax2 Local tax 2 rate (deprecated)
|
||||
* @param int $fk_product Product/Service ID predefined
|
||||
* @param double $remise_percent Percentage discount of the line
|
||||
* @param float $remise_percent Percentage discount of the line
|
||||
* @param string $price_base_type HT or TTC
|
||||
* @param int $info_bits VAT npr or not ?
|
||||
* @param int $fk_remise_except Id remise
|
||||
* @param double $pu_ttc Prix unitaire TTC (> 0 even for credit note)
|
||||
* @param float $pu_ttc Prix unitaire TTC (> 0 even for credit note)
|
||||
* @param int $type Type of line (0=product, 1=service)
|
||||
* @param int $rang Position of line
|
||||
* @param int $special_code Special code
|
||||
* @param string $label Label of the line
|
||||
* @param string $fk_unit Unit
|
||||
* @param double $pu_ht_devise Unit price in currency
|
||||
* @param ?int $fk_unit Unit
|
||||
* @param float $pu_ht_devise Unit price in currency
|
||||
* @param int $date_start_fill 1=Flag to fill start date when generating invoice
|
||||
* @param int $date_end_fill 1=Flag to fill end date when generating invoice
|
||||
* @param int $fk_fournprice Supplier price id (to calculate margin) or ''
|
||||
* @param int $pa_ht Buying price of line (to calculate margin) or ''
|
||||
* @param ?int $fk_fournprice Supplier price id (to calculate margin) or ''
|
||||
* @param float $pa_ht Buying price of line (to calculate margin) or ''
|
||||
* @param int $fk_parent_line Id of parent line
|
||||
* @return int Return integer <0 if KO, Id of line if OK
|
||||
*/
|
||||
|
|
@ -961,7 +961,7 @@ class FactureRec extends CommonInvoice
|
|||
return -1;
|
||||
}
|
||||
|
||||
$localtaxes_type = getLocalTaxesFromRate($txtva, 0, $this->thirdparty, $mysoc);
|
||||
$localtaxes_type = getLocalTaxesFromRate((float) $txtva, 0, $this->thirdparty, $mysoc);
|
||||
|
||||
// Clean vat code
|
||||
$reg = array();
|
||||
|
|
@ -1086,7 +1086,7 @@ class FactureRec extends CommonInvoice
|
|||
$sql .= ", '".$this->db->escape(isset($localtaxes_type[0]) ? $localtaxes_type[0] : '')."'";
|
||||
$sql .= ", ".price2num($txlocaltax2);
|
||||
$sql .= ", '".$this->db->escape(isset($localtaxes_type[2]) ? $localtaxes_type[2] : '')."'";
|
||||
$sql .= ", ".(!empty($fk_product) ? "'".$this->db->escape($fk_product)."'" : "null");
|
||||
$sql .= ", ".(!empty($fk_product) ? "'".$this->db->escape((string) $fk_product)."'" : "null");
|
||||
$sql .= ", ".((int) $product_type);
|
||||
$sql .= ", ".price2num($remise_percent);
|
||||
$sql .= ", ".price2num($pu_ht);
|
||||
|
|
@ -1129,28 +1129,28 @@ class FactureRec extends CommonInvoice
|
|||
*
|
||||
* @param int $rowid Id of line to update
|
||||
* @param string $desc Description de la ligne
|
||||
* @param double $pu_ht Prix unitaire HT (> 0 even for credit note)
|
||||
* @param double $qty Quantite
|
||||
* @param double $txtva Taux de tva force, sinon -1
|
||||
* @param double $txlocaltax1 Local tax 1 rate (deprecated)
|
||||
* @param double $txlocaltax2 Local tax 2 rate (deprecated)
|
||||
* @param float $pu_ht Prix unitaire HT (> 0 even for credit note)
|
||||
* @param float $qty Quantite
|
||||
* @param float $txtva Taux de tva force, sinon -1
|
||||
* @param float $txlocaltax1 Local tax 1 rate (deprecated)
|
||||
* @param float $txlocaltax2 Local tax 2 rate (deprecated)
|
||||
* @param int $fk_product Product/Service ID predefined
|
||||
* @param double $remise_percent Percentage discount of the line
|
||||
* @param float $remise_percent Percentage discount of the line
|
||||
* @param string $price_base_type HT or TTC
|
||||
* @param int $info_bits Bits of type of lines
|
||||
* @param int $fk_remise_except Id remise
|
||||
* @param double $pu_ttc Prix unitaire TTC (> 0 even for credit note)
|
||||
* @param float $pu_ttc Prix unitaire TTC (> 0 even for credit note)
|
||||
* @param int $type Type of line (0=product, 1=service)
|
||||
* @param int $rang Position of line
|
||||
* @param int $special_code Special code
|
||||
* @param string $label Label of the line
|
||||
* @param string $fk_unit Unit
|
||||
* @param double $pu_ht_devise Unit price in currency
|
||||
* @param int $notrigger disable line update trigger
|
||||
* @param ?int $fk_unit Unit
|
||||
* @param float $pu_ht_devise Unit price in currency
|
||||
* @param int<0,1> $notrigger disable line update trigger
|
||||
* @param int $date_start_fill 1=Flag to fill start date when generating invoice
|
||||
* @param int $date_end_fill 1=Flag to fill end date when generating invoice
|
||||
* @param int $fk_fournprice Id of origin supplier price
|
||||
* @param int $pa_ht Price (without tax) of product for margin calculation
|
||||
* @param ?int $fk_fournprice Id of origin supplier price
|
||||
* @param float $pa_ht Price (without tax) of product for margin calculation
|
||||
* @param int $fk_parent_line Id of parent line
|
||||
* @return int Return integer <0 if KO, Id of line if OK
|
||||
*/
|
||||
|
|
@ -1268,7 +1268,7 @@ class FactureRec extends CommonInvoice
|
|||
$sql .= ", localtax1_type='".$this->db->escape($localtaxes_type[0])."'";
|
||||
$sql .= ", localtax2_tx=".((float) $txlocaltax2);
|
||||
$sql .= ", localtax2_type='".$this->db->escape($localtaxes_type[2])."'";
|
||||
$sql .= ", fk_product=".(!empty($fk_product) ? "'".$this->db->escape($fk_product)."'" : "null");
|
||||
$sql .= ", fk_product=".(!empty($fk_product) ? "'".$this->db->escape((string) $fk_product)."'" : "null");
|
||||
$sql .= ", product_type=".((int) $product_type);
|
||||
$sql .= ", remise_percent='".price2num($remise_percent)."'";
|
||||
$sql .= ", subprice='".price2num($pu_ht)."'";
|
||||
|
|
@ -1284,7 +1284,7 @@ class FactureRec extends CommonInvoice
|
|||
$sql .= ", info_bits=".((int) $info_bits);
|
||||
$sql .= ", rang=".((int) $rang);
|
||||
$sql .= ", special_code=".((int) $special_code);
|
||||
$sql .= ", fk_unit=".($fk_unit ? "'".$this->db->escape($fk_unit)."'" : "null");
|
||||
$sql .= ", fk_unit=".($fk_unit ? "'".$this->db->escape((string) $fk_unit)."'" : "null");
|
||||
$sql .= ', multicurrency_subprice = '.price2num($pu_ht_devise);
|
||||
$sql .= ', multicurrency_total_ht = '.price2num($multicurrency_total_ht);
|
||||
$sql .= ', multicurrency_total_tva = '.price2num($multicurrency_total_tva);
|
||||
|
|
@ -1319,7 +1319,7 @@ class FactureRec extends CommonInvoice
|
|||
/**
|
||||
* Return if maximum number of generation is reached
|
||||
*
|
||||
* @return boolean False by default, True if maximum number of generation is reached
|
||||
* @return bool False by default, True if maximum number of generation is reached
|
||||
*/
|
||||
public function isMaxNbGenReached()
|
||||
{
|
||||
|
|
@ -1331,7 +1331,7 @@ class FactureRec extends CommonInvoice
|
|||
}
|
||||
|
||||
/**
|
||||
* Format string to output with by striking the string if max number of generation was reached
|
||||
* Format string to output with by striking the string if max number of generations was reached
|
||||
*
|
||||
* @param string $ret Default value to output
|
||||
* @return string html formatted string
|
||||
|
|
@ -1347,10 +1347,10 @@ class FactureRec extends CommonInvoice
|
|||
*
|
||||
* WARNING: This method change temporarily context $conf->entity to be in correct context for each recurring invoice found.
|
||||
*
|
||||
* @param int $restrictioninvoiceid 0=All qualified template invoices found. > 0 = restrict action on invoice ID
|
||||
* @param int $forcevalidation 1=Force validation of invoice whatever is template auto_validate flag.
|
||||
* @param int $notrigger Disable the trigger
|
||||
* @return int 0 if OK, < 0 if KO (this function is used also by cron so only 0 is OK)
|
||||
* @param int<0,max> $restrictioninvoiceid 0=All qualified template invoices found. > 0 = restrict action on invoice ID
|
||||
* @param int<0,1> $forcevalidation 1=Force validation of invoice whatever is template auto_validate flag.
|
||||
* @param int<0,1> $notrigger Disable the trigger
|
||||
* @return int 0 if OK, < 0 if KO (this function is used also by cron so only 0 is OK)
|
||||
*/
|
||||
public function createRecurringInvoices($restrictioninvoiceid = 0, $forcevalidation = 0, $notrigger = 0)
|
||||
{
|
||||
|
|
@ -1511,13 +1511,13 @@ class FactureRec extends CommonInvoice
|
|||
/**
|
||||
* Return clickable name (with picto eventually)
|
||||
*
|
||||
* @param int $withpicto Add picto into link
|
||||
* @param string $option Where point the link
|
||||
* @param int $max Maxlength of ref
|
||||
* @param int $short 1=Return just URL
|
||||
* @param string $moretitle Add more text to title tooltip
|
||||
* @param int $notooltip 1=Disable tooltip
|
||||
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
|
||||
* @param int $withpicto Add picto into link
|
||||
* @param string $option Where point the link
|
||||
* @param int $max Maxlength of ref
|
||||
* @param int<0,1> $short 1=Return just URL
|
||||
* @param string $moretitle Add more text to title tooltip
|
||||
* @param int<0,1> $notooltip 1=Disable tooltip
|
||||
* @param int<-1,1> $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
|
||||
* @return string String with URL
|
||||
*/
|
||||
public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $moretitle = '', $notooltip = 0, $save_lastsearch_value = -1)
|
||||
|
|
@ -1589,9 +1589,9 @@ class FactureRec extends CommonInvoice
|
|||
/**
|
||||
* Return label of object status
|
||||
*
|
||||
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=Long label + picto
|
||||
* @param integer $alreadypaid Not used on recurring invoices
|
||||
* @return string Label of status
|
||||
* @param int<0,6> $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=Long label + picto
|
||||
* @param int<-1,1> $alreadypaid Not used on recurring invoices
|
||||
* @return string Label of status
|
||||
*/
|
||||
public function getLibStatut($mode = 0, $alreadypaid = -1)
|
||||
{
|
||||
|
|
@ -1602,10 +1602,10 @@ class FactureRec extends CommonInvoice
|
|||
/**
|
||||
* Return label of a status
|
||||
*
|
||||
* @param int $recur Is it a recurring invoice ?
|
||||
* @param int<0,1> $recur Is it a recurring invoice ?
|
||||
* @param int $status Id status (suspended or not)
|
||||
* @param int<0,6> $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=long label + picto
|
||||
* @param int $alreadypaid Not used for recurring invoices
|
||||
* @param int<-1,1> $alreadypaid Not used for recurring invoices
|
||||
* @param int $type Type invoice
|
||||
* @param int $nbofopendirectdebitorcredittransfer @unused-param Nb of open direct debit or credit transfer
|
||||
* @return string Label of status
|
||||
|
|
@ -1737,9 +1737,9 @@ class FactureRec extends CommonInvoice
|
|||
/**
|
||||
* Return next reference of invoice not already used (or last reference)
|
||||
*
|
||||
* @param Societe $soc Thirdparty object
|
||||
* @param string $mode 'next' for next value or 'last' for last value
|
||||
* @return string free ref or last ref
|
||||
* @param Societe $soc Thirdparty object
|
||||
* @param 'next'|'last' $mode 'next' for next value or 'last' for last value
|
||||
* @return string free ref or last ref
|
||||
*/
|
||||
public function getNextNumRef($soc, $mode = 'next')
|
||||
{
|
||||
|
|
@ -1965,7 +1965,7 @@ class FactureRec extends CommonInvoice
|
|||
}
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql .= ' SET frequency = '.($frequency ? $this->db->escape($frequency) : 'null');
|
||||
$sql .= ' SET frequency = '.($frequency ? $this->db->escape((string) $frequency) : 'null');
|
||||
if (!empty($unit)) {
|
||||
$sql .= ', unit_frequency = \''.$this->db->escape($unit).'\'';
|
||||
}
|
||||
|
|
@ -2051,9 +2051,9 @@ class FactureRec extends CommonInvoice
|
|||
/**
|
||||
* Update the maximum period
|
||||
*
|
||||
* @param int $nb number of maximum period
|
||||
* @param int $notrigger Disable the trigger
|
||||
* @return int Return integer <0 if KO, >0 if OK
|
||||
* @param int $nb number of maximum period
|
||||
* @param int<0,1> $notrigger Disable the trigger
|
||||
* @return int Return integer <0 if KO, >0 if OK
|
||||
*/
|
||||
public function setMaxPeriod($nb, $notrigger = 0)
|
||||
{
|
||||
|
|
@ -2095,9 +2095,9 @@ class FactureRec extends CommonInvoice
|
|||
/**
|
||||
* Update the auto validate flag of invoice
|
||||
*
|
||||
* @param int $validate 0 to create in draft, 1 to create and validate invoice
|
||||
* @param int $notrigger Disable the trigger
|
||||
* @return int Return integer <0 if KO, >0 if OK
|
||||
* @param int<0,1> $validate 0 to create in draft, 1 to create and validate invoice
|
||||
* @param int<0,1> $notrigger Disable the trigger
|
||||
* @return int Return integer <0 if KO, >0 if OK
|
||||
*/
|
||||
public function setAutoValidate($validate, $notrigger = 0)
|
||||
{
|
||||
|
|
@ -2135,9 +2135,9 @@ class FactureRec extends CommonInvoice
|
|||
/**
|
||||
* Update the auto generate documents
|
||||
*
|
||||
* @param int $validate 0 no document, 1 to generate document
|
||||
* @param int $notrigger Disable the trigger
|
||||
* @return int Return integer <0 if KO, >0 if OK
|
||||
* @param int<0,1> $validate 0 no document, 1 to generate document
|
||||
* @param int<0,1> $notrigger Disable the trigger
|
||||
* @return int Return integer <0 if KO, >0 if OK
|
||||
*/
|
||||
public function setGeneratePdf($validate, $notrigger = 0)
|
||||
{
|
||||
|
|
@ -2176,7 +2176,7 @@ class FactureRec extends CommonInvoice
|
|||
* Update the model for documents
|
||||
*
|
||||
* @param string $model model of document generator
|
||||
* @param int $notrigger Disable the trigger
|
||||
* @param int<0,1> $notrigger Disable the trigger
|
||||
* @return int Return integer <0 if KO, >0 if OK
|
||||
*/
|
||||
public function setModelPdf($model, $notrigger = 0)
|
||||
|
|
@ -2429,8 +2429,8 @@ class FactureLigneRec extends CommonInvoiceLine
|
|||
/**
|
||||
* Update a line to invoice_rec.
|
||||
*
|
||||
* @param User $user User
|
||||
* @param int $notrigger No trigger
|
||||
* @param User $user User
|
||||
* @param int<0,1> $notrigger No trigger
|
||||
* @return int Return integer <0 if KO, Id of line if OK
|
||||
*/
|
||||
public function update(User $user, $notrigger = 0)
|
||||
|
|
@ -2456,9 +2456,9 @@ class FactureLigneRec extends CommonInvoiceLine
|
|||
$sql .= ", tva_tx=".price2num($this->tva_tx);
|
||||
$sql .= ", vat_src_code='".$this->db->escape($this->vat_src_code)."'";
|
||||
$sql .= ", localtax1_tx=".price2num($this->localtax1_tx);
|
||||
$sql .= ", localtax1_type='".$this->db->escape($this->localtax1_type)."'";
|
||||
$sql .= ", localtax1_type='".$this->db->escape((string) $this->localtax1_type)."'";
|
||||
$sql .= ", localtax2_tx=".price2num($this->localtax2_tx);
|
||||
$sql .= ", localtax2_type='".$this->db->escape($this->localtax2_type)."'";
|
||||
$sql .= ", localtax2_type='".$this->db->escape((string) $this->localtax2_type)."'";
|
||||
$sql .= ", fk_product=".($this->fk_product > 0 ? $this->fk_product : "null");
|
||||
$sql .= ", product_type=".((int) $this->product_type);
|
||||
$sql .= ", remise_percent=".price2num($this->remise_percent);
|
||||
|
|
@ -2475,7 +2475,7 @@ class FactureLigneRec extends CommonInvoiceLine
|
|||
}
|
||||
$sql .= ", rang=".((int) $this->rang);
|
||||
$sql .= ", special_code=".((int) $this->special_code);
|
||||
$sql .= ", fk_unit=".($this->fk_unit ? "'".$this->db->escape($this->fk_unit)."'" : "null");
|
||||
$sql .= ", fk_unit=".($this->fk_unit ? "'".$this->db->escape((string) $this->fk_unit)."'" : "null");
|
||||
$sql .= ", fk_contract_line=".($this->fk_contract_line ? $this->fk_contract_line : "null");
|
||||
$sql .= " WHERE rowid = ".((int) $this->id);
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
* Copyright (C) 2022 Sylvain Legrand <contact@infras.fr>
|
||||
* Copyright (C) 2023 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>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
|
@ -430,8 +430,8 @@ class FactureLigne extends CommonInvoiceLine
|
|||
$sql .= " ".price2num($this->tva_tx).",";
|
||||
$sql .= " ".price2num($this->localtax1_tx).",";
|
||||
$sql .= " ".price2num($this->localtax2_tx).",";
|
||||
$sql .= " '".$this->db->escape($this->localtax1_type)."',";
|
||||
$sql .= " '".$this->db->escape($this->localtax2_type)."',";
|
||||
$sql .= " '".$this->db->escape((string) $this->localtax1_type)."',";
|
||||
$sql .= " '".$this->db->escape((string) $this->localtax2_type)."',";
|
||||
$sql .= ' '.((!empty($this->fk_product) && $this->fk_product > 0) ? $this->fk_product : "null").',';
|
||||
$sql .= " ".((int) $this->product_type).",";
|
||||
$sql .= " ".price2num($this->remise_percent).",";
|
||||
|
|
@ -445,7 +445,7 @@ class FactureLigne extends CommonInvoiceLine
|
|||
$sql .= ' '.((int) $this->special_code).',';
|
||||
$sql .= ' '.(!empty($this->fk_fournprice) ? $this->fk_fournprice : "null").',';
|
||||
$sql .= ' '.price2num($this->pa_ht).',';
|
||||
$sql .= " '".$this->db->escape($this->info_bits)."',";
|
||||
$sql .= " '".$this->db->escape((string) $this->info_bits)."',";
|
||||
$sql .= " ".price2num($this->total_ht).",";
|
||||
$sql .= " ".price2num($this->total_tva).",";
|
||||
$sql .= " ".price2num($this->total_ttc).",";
|
||||
|
|
@ -647,13 +647,13 @@ class FactureLigne extends CommonInvoiceLine
|
|||
$sql .= ", tva_tx=".price2num($this->tva_tx);
|
||||
$sql .= ", localtax1_tx=".price2num($this->localtax1_tx);
|
||||
$sql .= ", localtax2_tx=".price2num($this->localtax2_tx);
|
||||
$sql .= ", localtax1_type='".$this->db->escape($this->localtax1_type)."'";
|
||||
$sql .= ", localtax2_type='".$this->db->escape($this->localtax2_type)."'";
|
||||
$sql .= ", localtax1_type='".$this->db->escape((string) $this->localtax1_type)."'";
|
||||
$sql .= ", localtax2_type='".$this->db->escape((string) $this->localtax2_type)."'";
|
||||
$sql .= ", qty=".price2num($this->qty);
|
||||
$sql .= ", date_start=".(!empty($this->date_start) ? "'".$this->db->idate($this->date_start)."'" : "null");
|
||||
$sql .= ", date_end=".(!empty($this->date_end) ? "'".$this->db->idate($this->date_end)."'" : "null");
|
||||
$sql .= ", product_type=".$this->product_type;
|
||||
$sql .= ", info_bits='".$this->db->escape($this->info_bits)."'";
|
||||
$sql .= ", info_bits='".$this->db->escape((string) $this->info_bits)."'";
|
||||
$sql .= ", special_code=" . (int) $this->special_code;
|
||||
if (empty($this->skip_update_total)) {
|
||||
$sql .= ", total_ht=".price2num($this->total_ht);
|
||||
|
|
@ -662,7 +662,7 @@ class FactureLigne extends CommonInvoiceLine
|
|||
$sql .= ", total_localtax1=".price2num($this->total_localtax1);
|
||||
$sql .= ", total_localtax2=".price2num($this->total_localtax2);
|
||||
}
|
||||
$sql .= ", fk_product_fournisseur_price=".(!empty($this->fk_fournprice) ? "'".$this->db->escape($this->fk_fournprice)."'" : "null");
|
||||
$sql .= ", fk_product_fournisseur_price=".(!empty($this->fk_fournprice) ? "'".$this->db->escape((string) $this->fk_fournprice)."'" : "null");
|
||||
$sql .= ", buy_price_ht=".(($this->pa_ht || (string) $this->pa_ht === '0') ? price2num($this->pa_ht) : "null"); // $this->pa_ht should always be defined (set to 0 or to sell price depending on option)
|
||||
$sql .= ", fk_parent_line=".($this->fk_parent_line > 0 ? $this->fk_parent_line : "null");
|
||||
if (!empty($this->rang)) {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -164,7 +164,7 @@ class PaymentTerm // extends CommonObject
|
|||
$sql .= "nbjour,";
|
||||
$sql .= "decalage";
|
||||
$sql .= ") VALUES (";
|
||||
$sql .= " ".(!isset($this->entity) ? getEntity('c_payment_term') : "'".$this->db->escape($this->entity)."'").",";
|
||||
$sql .= " ".(!isset($this->entity) ? getEntity('c_payment_term') : "'".$this->db->escape((string) $this->entity)."'").",";
|
||||
$sql .= " ".(!isset($this->code) ? 'NULL' : "'".$this->db->escape($this->code)."'").",";
|
||||
$sql .= " ".(!isset($this->sortorder) ? 'NULL' : "'".$this->db->escape($this->sortorder)."'").",";
|
||||
$sql .= " ".(!isset($this->active) ? 'NULL' : "'".$this->db->escape($this->active)."'").",";
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2023 Christian Foellmann <christian@foellmann.de>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -64,7 +64,7 @@ if ($user->socid) {
|
|||
$object = new Facture($db);
|
||||
// Load object
|
||||
if ($id > 0 || !empty($ref)) {
|
||||
$ret = $object->fetch($id, $ref, '', 0, getDolGlobalInt('INVOICE_USE_SITUATION'));
|
||||
$ret = $object->fetch($id, $ref, '', 0, getDolGlobalBool('INVOICE_USE_SITUATION'));
|
||||
}
|
||||
// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
|
||||
$hookmanager->initHooks(array('invoicecontactcard', 'globalcard'));
|
||||
|
|
@ -169,7 +169,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, $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);
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2017-2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2025 Alexandre Spangaro <alexandre@inovea-conseil.com>
|
||||
* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -169,7 +170,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, $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);
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ if (empty($reshook)) {
|
|||
// Get chosen iban id
|
||||
$iban = GETPOSTINT('accountcustomerid');
|
||||
$amount = GETPOST('withdraw_request_amount', 'alpha');
|
||||
$result = $object->demande_prelevement($user, price2num($amount), $newtype, $sourcetype, 0, $iban ?? 0);
|
||||
$result = $object->demande_prelevement($user, (float) price2num($amount), $newtype, $sourcetype, 0, $iban ?? 0);
|
||||
|
||||
if ($result > 0) {
|
||||
$db->commit();
|
||||
|
|
@ -389,7 +389,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);
|
||||
|
|
@ -529,9 +529,9 @@ if ($object->id > 0) {
|
|||
print '</td><td colspan="3">';
|
||||
if ($object->type != $object::TYPE_CREDIT_NOTE) {
|
||||
if ($action == 'editconditions') {
|
||||
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'cond_reglement_id', 0, $type);
|
||||
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->cond_reglement_id, 'cond_reglement_id', 0, $type);
|
||||
} 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');
|
||||
}
|
||||
} else {
|
||||
print ' ';
|
||||
|
|
@ -582,9 +582,9 @@ if ($object->id > 0) {
|
|||
$filtertype = 'DBIT';
|
||||
}
|
||||
if ($action == 'editmode') {
|
||||
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', $filtertype, 1, 0, $type);
|
||||
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->mode_reglement_id, 'mode_reglement_id', $filtertype, 1, 0, $type);
|
||||
} 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>';
|
||||
|
||||
|
|
@ -599,9 +599,9 @@ if ($object->id > 0) {
|
|||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
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>';
|
||||
|
|
|
|||
|
|
@ -6278,7 +6278,7 @@ class Form
|
|||
* Show a form + html select a date
|
||||
*
|
||||
* @param string $page Page
|
||||
* @param string $selected Date preselected
|
||||
* @param int|'' $selected Date preselected
|
||||
* @param string $htmlname Html name of date input fields or 'none'
|
||||
* @param int $displayhour Display hour selector
|
||||
* @param int $displaymin Display minutes selector
|
||||
|
|
@ -7215,10 +7215,10 @@ class Form
|
|||
* - local date in user area, if set_time is '' (so if set_time is '', output may differs when done from two different location)
|
||||
* - Empty (fields empty), if set_time is -1 (in this case, parameter empty must also have value 1)
|
||||
*
|
||||
* @param integer|string $set_time Pre-selected date (must be a local PHP server timestamp), -1 to keep date not preselected, '' to use current date with 00:00 hour (Parameter 'empty' must be 0 or 2).
|
||||
* @param int|'' $set_time Pre-selected date (must be a local PHP server timestamp), -1 to keep date not preselected, '' to use current date with 00:00 hour (Parameter 'empty' must be 0 or 2).
|
||||
* @param integer|string $set_time_end Pre-selected date (must be a local PHP server timestamp), -1 to keep date not preselected, '' to use current date with 00:00 hour (Parameter 'empty' must be 0 or 2).
|
||||
* @param string $prefix Prefix for fields name
|
||||
* @param int $empty 0=Fields required, 1=Empty inputs are allowed, 2=Empty inputs are allowed for hours only
|
||||
* @param int<0,2> $empty 0=Fields required, 1=Empty inputs are allowed, 2=Empty inputs are allowed for hours only
|
||||
* @param int $forcenewline Force new line between the 2 dates.
|
||||
* @return string Html for selectDate
|
||||
* @see form_date(), select_month(), select_year(), select_dayofweek()
|
||||
|
|
@ -7242,7 +7242,7 @@ class Form
|
|||
* - local date in user area, if set_time is '' (so if set_time is '', output may differs when done from two different location)
|
||||
* - Empty (fields empty), if set_time is -1 (in this case, parameter empty must also have value 1)
|
||||
*
|
||||
* @param integer|string $set_time Pre-selected date (must be a local PHP server timestamp), -1 to keep date not preselected, '' to use current date with 00:00 hour (Parameter 'empty' must be 0 or 2).
|
||||
* @param int|'' $set_time Pre-selected date (must be a local PHP server timestamp), -1 to keep date not preselected, '' to use current date with 00:00 hour (Parameter 'empty' must be 0 or 2). Using a "string date" is deprecated and excluded from the param type.
|
||||
* @param string $prefix Prefix for fields name
|
||||
* @param int $h 1 or 2=Show also hours (2=hours on a new line), -1 has same effect but hour and minutes are prefilled with 23:59 if date is empty, 3 or 4 (4=hours on a new line)=Show hour always empty
|
||||
* @param int $m 1=Show also minutes, -1 has same effect but hour and minutes are prefilled with 23:59 if date is empty, 3 show minutes always empty
|
||||
|
|
@ -7311,7 +7311,7 @@ class Form
|
|||
$shour = '';
|
||||
$smin = '';
|
||||
$ssec = '';
|
||||
if (!empty($set_time) && preg_match('/^([0-9]+)\-([0-9]+)\-([0-9]+)\s?([0-9]+)?:?([0-9]+)?/', $set_time, $reg)) { // deprecated usage
|
||||
if (!empty($set_time) && preg_match('/^([0-9]+)\-([0-9]+)\-([0-9]+)\s?([0-9]+)?:?([0-9]+)?/', (string) $set_time, $reg)) { // deprecated usage
|
||||
// Date format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS'
|
||||
$syear = (!empty($reg[1]) ? $reg[1] : '');
|
||||
$smonth = (!empty($reg[2]) ? $reg[2] : '');
|
||||
|
|
|
|||
|
|
@ -7380,10 +7380,10 @@ function get_localtax_by_third($local)
|
|||
* Get tax (VAT) main information from Id.
|
||||
* You can also call getLocalTaxesFromRate() after to get only localtax fields.
|
||||
*
|
||||
* @param int|string $vatrate VAT ID or Rate. Value can be value or the string with code into parenthesis or rowid if $firstparamisid is 1. Example: '8.5' or '8.5 (8.5NPR)' or 123.
|
||||
* @param Societe $buyer Company object
|
||||
* @param Societe $seller Company object
|
||||
* @param int<0,1> $firstparamisid 1 if first param is id into table (use this if you can)
|
||||
* @param float|string $vatrate VAT ID or Rate. Value can be value or the string with code into parenthesis or rowid if $firstparamisid is 1. Example: '8.5' or '8.5 (8.5NPR)' or 123.
|
||||
* @param ?Societe $buyer Company object
|
||||
* @param ?Societe $seller Company object
|
||||
* @param int<0,1> $firstparamisid 1 if first param is id into table (use this if you can)
|
||||
* @return array{}|array{rowid:int,code:string,rate:float,localtax1:float,localtax1_type:string,localtax2:float,localtax2_type:string,npr:float,accountancy_code_sell:string,accountancy_code_buy:string} array('rowid'=> , 'code'=> ...)
|
||||
* @see getLocalTaxesFromRate()
|
||||
*/
|
||||
|
|
@ -7458,7 +7458,7 @@ function getTaxesFromId($vatrate, $buyer = null, $seller = null, $firstparamisid
|
|||
* Instead this function must be called when adding a line to get the array of possible values for localtax and type, and then
|
||||
* provide the selected value to the function calcul_price_total.
|
||||
*
|
||||
* @param int|string $vatrate VAT ID or Rate+Code. Value can be value or the string with code into parenthesis or rowid if $firstparamisid is 1. Example: '8.5' or '8.5 (8.5NPR)' or 123.
|
||||
* @param float|string $vatrate VAT ID or Rate+Code. Value can be value or the string with code into parenthesis or rowid if $firstparamisid is 1. Example: '8.5' or '8.5 (8.5NPR)' or 123.
|
||||
* @param int<0,2> $local Number of localtax (1 or 2, or 0 to return 1 & 2)
|
||||
* @param ?Societe $buyer Company object
|
||||
* @param ?Societe $seller Company object
|
||||
|
|
|
|||
|
|
@ -633,7 +633,7 @@ class pdf_merou extends ModelePdfExpedition
|
|||
$label .= $object->tracking_url;
|
||||
}
|
||||
$pdf->SetFont('', 'B', $default_font_size - 3);
|
||||
$pdf->writeHTMLCell(50, 8, '', '', $label, 0, 1, false, true, 'L');
|
||||
$pdf->writeHTMLCell(50, 8, null, null, $label, 0, 1, false, true, 'L');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -1156,7 +1156,7 @@ class pdf_crabe extends ModelePDFFactures
|
|||
* @param Facture $object Object to show
|
||||
* @param float $posy Y
|
||||
* @param Translate $outputlangs Langs object
|
||||
* @param Translate $outputlangsbis Object lang for output bis
|
||||
* @param ?Translate $outputlangsbis Object lang for output bis
|
||||
* @return float Pos y
|
||||
*/
|
||||
protected function _tableau_info(&$pdf, $object, $posy, $outputlangs, $outputlangsbis)
|
||||
|
|
@ -1336,7 +1336,7 @@ class pdf_crabe extends ModelePDFFactures
|
|||
if ($this->emetteur->country_code == 'FR') {
|
||||
if (getDolGlobalInt('TAX_MODE') == 1) {
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
$pdf->writeHTMLCell(80, 5, '', '', $outputlangs->transnoentities("MentionVATDebitOptionIsOn"), 0, 1);
|
||||
$pdf->writeHTMLCell(80, 5, null, null, $outputlangs->transnoentities("MentionVATDebitOptionIsOn"), 0, 1);
|
||||
|
||||
$posy = $pdf->GetY() + 1;
|
||||
}
|
||||
|
|
@ -1364,7 +1364,7 @@ class pdf_crabe extends ModelePDFFactures
|
|||
$linktopay = $langs->trans("ToOfferALinkForOnlinePayment", $servicename).' <a href="'.$paiement_url.'">'.$outputlangs->transnoentities("ClickHere").'</a>';
|
||||
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
$pdf->writeHTMLCell(80, 5, '', '', dol_htmlentitiesbr($linktopay), 0, 1);
|
||||
$pdf->writeHTMLCell(80, 5, null, null, dol_htmlentitiesbr($linktopay), 0, 1);
|
||||
|
||||
$posy = $pdf->GetY() + 1;
|
||||
}
|
||||
|
|
@ -1449,7 +1449,7 @@ class pdf_crabe extends ModelePDFFactures
|
|||
* @param float $deja_regle Amount already paid (in the currency of invoice)
|
||||
* @param float $posy Position depart
|
||||
* @param Translate $outputlangs Object langs
|
||||
* @param Translate $outputlangsbis Object lang for output bis
|
||||
* @param ?Translate $outputlangsbis Object lang for output bis
|
||||
* @return float Position pour suite
|
||||
*/
|
||||
protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs, $outputlangsbis)
|
||||
|
|
@ -1642,13 +1642,13 @@ class pdf_crabe extends ModelePDFFactures
|
|||
$totalvat = $outputlangs->transcountrynoentities("TotalVAT", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalVAT", $mysoc->country_code) : '');
|
||||
$totalvat .= ' ';
|
||||
if (getDolGlobalString('PDF_VAT_LABEL_IS_CODE_OR_RATE') == 'rateonly') {
|
||||
$totalvat .= vatrate($tvaval['vatrate'], true).$tvacompl;
|
||||
$totalvat .= vatrate((string) $tvaval['vatrate'], true).$tvacompl;
|
||||
} elseif (getDolGlobalString('PDF_VAT_LABEL_IS_CODE_OR_RATE') == 'codeonly') {
|
||||
$totalvat .= $tvaval['vatcode'].$tvacompl;
|
||||
} elseif (getDolGlobalString('PDF_VAT_LABEL_IS_CODE_OR_RATE') == 'nocodenorate') {
|
||||
$totalvat .= $tvacompl;
|
||||
} else {
|
||||
$totalvat .= vatrate($tvaval['vatrate'], true).($tvaval['vatcode'] ? ' ('.$tvaval['vatcode'].')' : '').$tvacompl;
|
||||
$totalvat .= vatrate((string) $tvaval['vatrate'], true).($tvaval['vatcode'] ? ' ('.$tvaval['vatcode'].')' : '').$tvacompl;
|
||||
}
|
||||
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', true);
|
||||
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
|
||||
|
|
|
|||
|
|
@ -1508,7 +1508,7 @@ class pdf_octopus extends ModelePDFFactures
|
|||
if ($this->emetteur->country_code == 'FR') {
|
||||
if (getDolGlobalInt('TAX_MODE') == 1) {
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
$pdf->writeHTMLCell(80, 5, '', '', $outputlangs->transnoentities("MentionVATDebitOptionIsOn"), 0, 1);
|
||||
$pdf->writeHTMLCell(80, 5, null, null, $outputlangs->transnoentities("MentionVATDebitOptionIsOn"), 0, 1);
|
||||
|
||||
$posy = $pdf->GetY() + 1;
|
||||
}
|
||||
|
|
@ -1548,7 +1548,7 @@ class pdf_octopus extends ModelePDFFactures
|
|||
$linktopay = $langs->trans("ToOfferALinkForOnlinePayment", $servicename).' <a href="'.$paiement_url.'">'.$outputlangs->transnoentities("ClickHere").'</a>';
|
||||
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
$pdf->writeHTMLCell($posxend - $this->marge_gauche, 5, '', '', dol_htmlentitiesbr($linktopay), 0, 1);
|
||||
$pdf->writeHTMLCell($posxend - $this->marge_gauche, 5, null, null, dol_htmlentitiesbr($linktopay), 0, 1);
|
||||
|
||||
$posy = $pdf->GetY() + 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1438,7 +1438,7 @@ class pdf_sponge extends ModelePDFFactures
|
|||
if ($this->emetteur->country_code == 'FR') {
|
||||
if (getDolGlobalInt('TAX_MODE') == 1) {
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
$pdf->writeHTMLCell(80, 5, '', '', $outputlangs->transnoentities("MentionVATDebitOptionIsOn"), 0, 1);
|
||||
$pdf->writeHTMLCell(80, 5, null, null, $outputlangs->transnoentities("MentionVATDebitOptionIsOn"), 0, 1);
|
||||
|
||||
$posy = $pdf->GetY() + 1;
|
||||
}
|
||||
|
|
@ -1466,7 +1466,7 @@ class pdf_sponge extends ModelePDFFactures
|
|||
$linktopay = $langs->trans("ToOfferALinkForOnlinePayment", $servicename).' <a href="'.$paiement_url.'">'.$outputlangs->transnoentities("ClickHere").'</a>';
|
||||
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
$pdf->writeHTMLCell($posxend - $this->marge_gauche, 5, '', '', dol_htmlentitiesbr($linktopay), 0, 1);
|
||||
$pdf->writeHTMLCell($posxend - $this->marge_gauche, 5, null, null, dol_htmlentitiesbr($linktopay), 0, 1);
|
||||
|
||||
$posy = $pdf->GetY() + 1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue