Qual: Fix phan notices (#31372)

* fix llx_webhook_target-webhook.sql

* Fix commande/list & facture-rec.class

* Fix bonprelevement

* Qual: Fix prelevement/create notices

* Qual: fix quadridetail notices & update baseline

* Qual: Fix CommonDocGenerator notices

* Qual: Fix commoninvoice and commonobjectline notices (phan/phpstan)

---------

Co-authored-by: Frédéric FRANCE <frederic34@users.noreply.github.com>
This commit is contained in:
MDW 2024-10-13 16:45:42 +02:00 committed by GitHub
parent 6b7d601d49
commit d7b2f95baf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
29 changed files with 596 additions and 158 deletions

View File

@ -130,7 +130,7 @@ return [
'htdocs/commande/class/commande.class.php' => ['PhanUndeclaredProperty'],
'htdocs/commande/class/commandestats.class.php' => ['PhanPluginUnknownArrayMethodReturnType'],
'htdocs/commande/customer.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/commande/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeInvalidDimOffset', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/commande/list.php' => ['PhanUndeclaredProperty'],
'htdocs/commande/list_det.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeInvalidDimOffset', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/commande/stats/index.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/commande/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'],
@ -159,10 +159,9 @@ return [
'htdocs/compta/deplacement/class/deplacementstats.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'],
'htdocs/compta/deplacement/stats/index.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/compta/facture/agenda-rec.php' => ['PhanPluginEmptyStatementIf'],
'htdocs/compta/facture/card-rec.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/compta/facture/card.php' => ['PhanUndeclaredProperty'],
'htdocs/compta/facture/class/api_invoices.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeComparisonFromArray', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/compta/facture/class/facture-rec.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
'htdocs/compta/facture/class/facture-rec.class.php' => ['PhanUndeclaredProperty'],
'htdocs/compta/facture/class/facture.class.php' => ['PhanUndeclaredProperty'],
'htdocs/compta/facture/class/facturestats.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'],
'htdocs/compta/facture/class/paymentterm.class.php' => ['PhanPluginUnknownPropertyType'],
@ -193,9 +192,7 @@ return [
'htdocs/compta/paiement_vat.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/compta/payment_vat/card.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/compta/prelevement/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/compta/prelevement/class/bonprelevement.class.php' => ['PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchProperty'],
'htdocs/compta/prelevement/class/rejetprelevement.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchProperty'],
'htdocs/compta/prelevement/create.php' => ['PhanPluginSuspiciousParamPosition', 'PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/compta/prelevement/demandes.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/compta/prelevement/factures.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/compta/prelevement/line.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
@ -223,7 +220,6 @@ return [
'htdocs/compta/tva/clients.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchDimFetchNullable', 'PhanUndeclaredGlobalVariable'],
'htdocs/compta/tva/index.php' => ['PhanRedefineFunction', 'PhanUndeclaredGlobalVariable'],
'htdocs/compta/tva/payments.php' => ['PhanTypeMismatchArgumentNullableInternal'],
'htdocs/compta/tva/quadri_detail.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/contact/canvas/actions_contactcard_common.class.php' => ['PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchProperty', 'PhanTypeSuspiciousNonTraversableForeach'],
'htdocs/contact/card.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty'],
'htdocs/contact/class/contact.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType', 'PhanPluginUnknownPropertyType'],
@ -276,11 +272,8 @@ return [
'htdocs/core/class/canvas.class.php' => ['PhanParamTooMany', 'PhanUndeclaredMethod'],
'htdocs/core/class/ccountry.class.php' => ['PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'],
'htdocs/core/class/cgenericdic.class.php' => ['PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'],
'htdocs/core/class/commondocgenerator.class.php' => ['PhanPluginUnknownArrayPropertyType', 'PhanPluginUnknownPropertyType', 'PhanTypeSuspiciousNonTraversableForeach', 'PhanUndeclaredProperty'],
'htdocs/core/class/commonhookactions.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayPropertyType'],
'htdocs/core/class/commoninvoice.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable'],
'htdocs/core/class/commonobject.class.php' => ['PhanParamTooMany', 'PhanUndeclaredProperty'],
'htdocs/core/class/commonobjectline.class.php' => ['PhanPluginUnknownPropertyType'],
'htdocs/core/class/commonorder.class.php' => ['PhanPluginUnknownPropertyType'],
'htdocs/core/class/commonpeople.class.php' => ['PhanUndeclaredProperty'],
'htdocs/core/class/commonsocialnetworks.class.php' => ['PhanUndeclaredProperty'],
@ -650,7 +643,7 @@ return [
'htdocs/install/fileconf.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal'],
'htdocs/install/inc.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanRedefineFunction'],
'htdocs/install/index.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/install/repair.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal'],
'htdocs/install/repair.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/install/step2.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredProperty'],
'htdocs/install/step5.php' => ['PhanPluginUndeclaredVariableIsset'],
'htdocs/install/upgrade.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal'],
@ -830,7 +823,7 @@ return [
'htdocs/recruitment/admin/setup_candidatures.php' => ['PhanEmptyForeach', 'PhanPluginUnknownObjectMethodCall'],
'htdocs/recruitment/class/recruitmentcandidature.class.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredProperty'],
'htdocs/recruitment/class/recruitmentjobposition.class.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredProperty'],
'htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php' => ['PhanPluginUnknownArrayPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
'htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
'htdocs/recruitment/core/modules/recruitment/mod_recruitmentcandidature_advanced.php' => ['PhanUndeclaredProperty'],
'htdocs/recruitment/core/modules/recruitment/mod_recruitmentjobposition_advanced.php' => ['PhanUndeclaredProperty'],
'htdocs/recruitment/index.php' => ['PhanUndeclaredGlobalVariable'],

View File

@ -973,7 +973,8 @@ class Calendar extends CommonObject
return $result;
} else {
$this->lines = $result;
return $this->lines;
// @phpstan-ignore-next-line
return $result; // @phan-suppress-current-line PhanTypeMismatchReturn
}
}

View File

@ -1171,12 +1171,12 @@ class Categorie extends CommonObject
* fullpath = Full path built with the id's
*
* @param string $type Type of categories ('customer', 'supplier', 'contact', 'product', 'member', ...)
* @param int|string|array $fromid Keep only or Exclude (depending on $include parameter) all categories (including the leaf $fromid) into the tree after this id $fromid.
* @param int|string|int[] $fromid Keep only or Exclude (depending on $include parameter) all categories (including the leaf $fromid) into the tree after this id $fromid.
* $fromid can be an :
* - int (id of category)
* - string (categories ids separated by comma)
* - array (list of categories ids)
* @param int $include [=0] Removed or 1=Keep only
* @param int<0,1> $include [=0] Removed or 1=Keep only
* @return int<-1,-1>|array<int,array{rowid:int,id:int,fk_parent:int,label:string,description:string,color:string,position:string,visible:int,ref_ext:string,picto:string,fullpath:string,fulllabel:string,level:?int}> Array of categories. this->cats and this->motherof are set, -1 on error
*/
public function get_full_arbo($type, $fromid = 0, $include = 0)

View File

@ -132,7 +132,7 @@ class PropaleLigne extends CommonObjectLine
public $subprice;
/**
* @var int|string|float
* @var float|string
*/
public $remise_percent;

View File

@ -70,6 +70,8 @@ $mode = GETPOST('mode', 'alpha');
if (getDolGlobalInt('MAIN_SEE_SUBORDINATES')) {
$userschilds = $user->getAllChildIds();
} else {
$userschilds = array();
}
// Search Parameters
@ -131,6 +133,12 @@ $search_option = GETPOST('search_option', 'alpha');
if ($search_option == 'late') {
$search_status = '-2';
}
$search_orderday = '';
$search_ordermonth = '';
$search_orderyear = '';
$search_deliveryday = '';
$search_deliverymonth = '';
$search_deliveryyear = '';
$diroutputmassaction = $conf->commande->multidir_output[$conf->entity].'/temp/massgeneration/'.$user->id;
@ -249,6 +257,12 @@ if ($user->socid) {
}
$permissiontoreadallthirdparty = $user->hasRight('societe', 'client', 'voir');
$permissiontoread = false;
$permissiontovalidate = false;
$permissiontoclose = false;
$permissiontocancel = false;
$permissiontosendbymail = false;
$objectclass = null;
$result = restrictedArea($user, 'commande', $id, '');
@ -447,6 +461,7 @@ if (empty($reshook)) {
$fk_parent_line = 0;
$num = count($lines);
$array_options = array();
for ($i = 0; $i < $num; $i++) {
$desc = ($lines[$i]->desc ? $lines[$i]->desc : '');
@ -732,7 +747,7 @@ if (empty($reshook)) {
}
}
}
if ($action == 'validate' && $permissiontoadd) {
if ($action == 'validate' && $permissiontoadd && $objectclass !== null) {
if (GETPOST('confirm') == 'yes') {
$objecttmp = new $objectclass($db);
$db->begin();
@ -768,7 +783,7 @@ if ($action == 'validate' && $permissiontoadd) {
}
}
}
if ($action == 'shipped' && $permissiontoadd) {
if ($action == 'shipped' && $permissiontoadd && $objectclass !== null) {
if (GETPOST('confirm') == 'yes') {
$objecttmp = new $objectclass($db);
$db->begin();
@ -801,7 +816,7 @@ if ($action == 'shipped' && $permissiontoadd) {
}
// Closed records
if (!$error && $massaction === 'setbilled' && $permissiontoclose) {
if (!$error && $massaction === 'setbilled' && $permissiontoclose && $objectclass !== null) {
$db->begin();
$objecttmp = new $objectclass($db);
@ -1535,7 +1550,7 @@ 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);
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, '', 'parent', 0, array(), 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);
$moreforfilter .= '</div>';
}
@ -2435,7 +2450,7 @@ while ($i < $imaxinloop) {
// Channel
if (!empty($arrayfields['c.fk_input_reason']['checked'])) {
print '<td>';
$form->formInputReason($_SERVER['PHP_SELF'], $obj->fk_input_reason, 'none', '');
$form->formInputReason($_SERVER['PHP_SELF'], $obj->fk_input_reason, 'none', 0);
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
@ -2710,6 +2725,7 @@ while ($i < $imaxinloop) {
if (!empty($arrayfields['shippable']['checked'])) {
print '<td class="center">';
if (!empty($show_shippable_command) && isModEnabled('stock')) {
$text_icon = '';
if (($obj->fk_statut > $generic_commande::STATUS_DRAFT) && ($obj->fk_statut < $generic_commande::STATUS_CLOSED)) {
$generic_commande->getLinesArray(); // Load array ->lines
$generic_commande->loadExpeditions(); // Load array ->expeditions
@ -2757,6 +2773,7 @@ while ($i < $imaxinloop) {
$generic_product->load_stats_commande(0, '1,2');
$productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_customer'] = $generic_product->stats_commande['qty'];
} else {
// @phan-suppress-next-line PhanTypeInvalidDimOffset
$generic_product->stats_commande['qty'] = $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_customer'];
}
$stock_order = $generic_product->stats_commande['qty'];
@ -2766,6 +2783,7 @@ while ($i < $imaxinloop) {
$generic_product->load_stats_commande_fournisseur(0, '3');
$productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_supplier'] = $generic_product->stats_commande_fournisseur['qty'];
} else {
// @phan-suppress-next-line PhanTypeInvalidDimOffset
$generic_product->stats_commande_fournisseur['qty'] = $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_supplier'];
}
$stock_order_supplier = $generic_product->stats_commande_fournisseur['qty'];

View File

@ -235,7 +235,7 @@ if (empty($reshook)) {
$object->note_private = GETPOST('note_private', 'restricthtml');
$object->note_public = GETPOST('note_public', 'restricthtml');
$object->model_pdf = GETPOST('modelpdf', 'alphanohtml');
$object->usenewprice = GETPOST('usenewprice', 'alphanohtml');
$object->usenewprice = GETPOSTINT('usenewprice');
$object->mode_reglement_id = GETPOSTINT('mode_reglement_id');
$object->cond_reglement_id = GETPOSTINT('cond_reglement_id');
@ -691,7 +691,7 @@ if (empty($reshook)) {
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, '', $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, $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);
if ($result > 0) {
// Define output language and generate document
@ -985,6 +985,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 FactureRec($db);
@ -1101,7 +1103,7 @@ if ($action == 'create') {
print $object->showOptionals($extrafields, 'create', $parameters);
// Project
if (isModEnabled('project') && is_object($object->thirdparty) && $object->thirdparty->id > 0) {
if (isModEnabled('project') && is_object($object->thirdparty) && $object->thirdparty->id > 0 && is_object($formproject)) {
$projectid = GETPOST('projectid') ? GETPOST('projectid') : $object->fk_project;
$langs->load('projects');
print '<tr><td>'.$langs->trans('Project').'</td><td>';

View File

@ -1480,7 +1480,7 @@ if (empty($reshook)) {
$object->model_pdf = GETPOST('model');
$object->fk_project = GETPOSTINT('projectid');
$object->cond_reglement_id = (GETPOSTINT('type') == 3 ? 1 : GETPOST('cond_reglement_id'));
$object->mode_reglement_id = GETPOST('mode_reglement_id');
$object->mode_reglement_id = GETPOSTINT('mode_reglement_id');
$object->fk_account = GETPOSTINT('fk_account');
$object->amount = price2num(GETPOST('amount'));
//$object->remise_absolue = price2num(GETPOST('remise_absolue'), 'MU');
@ -1826,7 +1826,7 @@ if (empty($reshook)) {
}
$tva_tx = $lines[$i]->tva_tx;
if (!empty($lines[$i]->vat_src_code) && !preg_match('/\(/', $tva_tx)) {
if (!empty($lines[$i]->vat_src_code) && !preg_match('/\(/', (string) $tva_tx)) {
$tva_tx .= ' ('.$lines[$i]->vat_src_code.')';
}

View File

@ -91,33 +91,59 @@ class FactureRec extends CommonInvoice
public $titre;
/**
* @var double
* @var float
*/
public $multicurrency_subprice;
/**
* @var int
*/
public $socid;
/**
* @var int
*/
public $number;
/**
* @var int
*/
public $date;
//public $remise;
//public $remise_absolue;
//public $remise_percent;
/**
* @deprecated
* @deprecated Use $total_ht
* @see $total_ht
* @var float
*/
public $total;
/**
* @deprecated
* @deprecated Use $total_tva
* @see $total_tva
* @var float
*/
public $tva;
/**
* @var int|string
*/
public $date_last_gen;
/**
* @var int|string|null
*/
public $date_when;
/**
* @var int
*/
public $nb_gen_done;
/**
* @var int
*/
public $nb_gen_max;
/**
* @var User
*/
public $user_author;
/**
@ -130,6 +156,9 @@ class FactureRec extends CommonInvoice
*/
public $unit_frequency;
/**
* @var int
*/
public $rang;
/**
@ -137,18 +166,36 @@ class FactureRec extends CommonInvoice
*/
public $special_code;
/**
* @var int<0,1>
*/
public $usenewprice = 0;
/**
* @var int Deadline for payment
*/
public $date_lim_reglement;
/**
* @var string
*/
public $cond_reglement_code; // Code in llx_c_paiement
/**
* @var string
*/
public $mode_reglement_code; // Code in llx_c_paiement
/**
* @var int
*/
public $suspended; // status
/**
* @var int<0,1>
*/
public $auto_validate; // 0 to create in draft, 1 to create and validate the new invoice
/**
* @var int<0,1>
*/
public $generate_pdf; // 1 to generate PDF on invoice generation (default)
@ -241,11 +288,11 @@ class FactureRec extends CommonInvoice
/**
* Create a predefined invoice
*
* @param User $user User object
* @param int $facid Id of source invoice
* @param int $notrigger No trigger
* @param array $onlylines Only the lines of the array
* @return int Return integer <0 if KO, id of invoice created if OK
* @param User $user User object
* @param int $facid Id of source invoice
* @param int<0,1> $notrigger No trigger
* @param int[] $onlylines Only the lines of the array
* @return int Return integer <0 if KO, id of invoice created if OK
*/
public function create($user, $facid, $notrigger = 0, $onlylines = array())
{
@ -355,51 +402,53 @@ class FactureRec extends CommonInvoice
$num = count($facsrc->lines);
for ($i = 0; $i < $num; $i++) {
if (!empty($onlylines) && !in_array($facsrc->lines[$i]->id, $onlylines)) {
$facline = $facsrc->lines[$i];
'@phan-var-force FactureLigneRec $facline';
if (!empty($onlylines) && !in_array($facline->id, $onlylines)) {
continue; // Skip unselected lines
}
// Reset fk_parent_line for no child products and special product
if (($facsrc->lines[$i]->product_type != 9 && empty($facsrc->lines[$i]->fk_parent_line)) || $facsrc->lines[$i]->product_type == 9) {
if (($facline->product_type != 9 && empty($facline->fk_parent_line)) || $facline->product_type == 9) {
$fk_parent_line = 0;
}
$tva_tx = $facsrc->lines[$i]->tva_tx;
if (!empty($facsrc->lines[$i]->vat_src_code) && !preg_match('/\(/', (string) $tva_tx)) {
$tva_tx .= ' ('.$facsrc->lines[$i]->vat_src_code.')';
$tva_tx = $facline->tva_tx;
if (!empty($facline->vat_src_code) && !preg_match('/\(/', (string) $tva_tx)) {
$tva_tx .= ' ('.$facline->vat_src_code.')';
}
$default_start_fill = getDolGlobalInt('INVOICEREC_SET_AUTOFILL_DATE_START');
$default_end_fill = getDolGlobalInt('INVOICEREC_SET_AUTOFILL_DATE_END');
$result_insert = $this->addline(
$facsrc->lines[$i]->desc,
$facsrc->lines[$i]->subprice,
$facsrc->lines[$i]->qty,
$facline->desc,
$facline->subprice,
$facline->qty,
$tva_tx,
$facsrc->lines[$i]->localtax1_tx,
$facsrc->lines[$i]->localtax2_tx,
$facsrc->lines[$i]->fk_product,
$facsrc->lines[$i]->remise_percent,
$facline->localtax1_tx,
$facline->localtax2_tx,
$facline->fk_product,
$facline->remise_percent,
'HT',
$facsrc->lines[$i]->info_bits,
'',
$facline->info_bits,
0,
$facsrc->lines[$i]->product_type,
$facsrc->lines[$i]->rang,
$facsrc->lines[$i]->special_code,
$facsrc->lines[$i]->label,
$facsrc->lines[$i]->fk_unit,
$facsrc->lines[$i]->multicurrency_subprice,
0,
$facline->product_type,
$facline->rang,
$facline->special_code,
$facline->label,
$facline->fk_unit,
$facline->multicurrency_subprice,
$default_start_fill,
$default_end_fill,
null,
$facsrc->lines[$i]->pa_ht,
0,
$facline->pa_ht,
$fk_parent_line
);
// Defined the new fk_parent_line
if ($result_insert > 0 && $facsrc->lines[$i]->product_type == 9) {
if ($result_insert > 0 && $facline->product_type == 9) {
$fk_parent_line = $result_insert;
}
@ -411,9 +460,9 @@ class FactureRec extends CommonInvoice
$result2 = $objectline->fetch($result_insert);
if ($result2 > 0) {
// Extrafields
if (method_exists($facsrc->lines[$i], 'fetch_optionals')) {
$facsrc->lines[$i]->fetch_optionals($facsrc->lines[$i]->id);
$objectline->array_options = $facsrc->lines[$i]->array_options;
if (method_exists($facline, 'fetch_optionals')) {
$facline->fetch_optionals($facline->id);
$objectline->array_options = $facline->array_options;
}
$result = $objectline->insertExtraFields();
@ -1921,9 +1970,9 @@ class FactureRec extends CommonInvoice
/**
* Update the next date of execution
*
* @param datetime $date date of execution
* @param int $increment_nb_gen_done 0 do nothing more, >0 increment nb_gen_done
* @param int $notrigger Disable the trigger
* @param int $date date of execution
* @param int<0,max> $increment_nb_gen_done 0 do nothing more, >0 increment nb_gen_done
* @param int<0,1> $notrigger Disable the trigger
* @return int Return integer <0 if KO, >0 if OK
*/
public function setNextDate($date, $increment_nb_gen_done = 0, $notrigger = 0)
@ -2155,23 +2204,50 @@ class FactureLigneRec extends CommonInvoiceLine
*/
public $fk_parent_attribute = 'fk_facture';
//! From llx_facturedet_rec
//! Id facture
//!From llx_facturedet_rec
/**
* @var int Id facture
*/
public $fk_facture;
//! Id parent line
/**
* @var int Id parent line
*/
public $fk_parent_line;
/**
* @var int
*/
public $fk_product_fournisseur_price;
public $fk_fournprice; // For backward compatibility
/**
* @var int
* @deprecated For backward compatibility
*/
public $fk_fournprice;
/**
* @var int
*/
public $rang;
//public $situation_percent; // Not supported on recurring invoice line
/**
* @var string
*/
public $desc;
/**
* @var string
*/
public $description;
public $fk_product_type; // Use instead product_type
/**
* @var int
* @deprecated Use product_type / $product->type
*/
public $fk_product_type;
/**
* @var int
*/
public $fk_contract_line;

View File

@ -166,7 +166,7 @@ class Paiement extends CommonObject
public $ext_payment_id;
/**
* @var string Id of prelevement
* @var int Id of prelevement
*/
public $id_prelevement;

View File

@ -62,23 +62,68 @@ class BonPrelevement extends CommonObject
*/
public $picto = 'payment';
/**
* @var int|string
*/
public $date_echeance;
/**
* @var string
*/
public $raison_sociale;
/**
* @var string
*/
public $reference_remise;
/**
* @var string
*/
public $emetteur_code_guichet;
/**
* @var string
*/
public $emetteur_numero_compte;
/**
* @var string
*/
public $emetteur_code_banque;
/**
* @var string
*/
public $emetteur_number_key;
/**
* @var bool
*/
public $sepa_xml_pti_in_ctti;
/**
* @var string
*/
public $emetteur_iban;
/**
* @var string
*/
public $emetteur_bic;
/**
* @var string
*/
public $emetteur_ics;
/**
* @var int
*/
public $user_trans;
/**
* @var int
*/
public $user_credit;
/**
* @var float|int|string
*/
public $total;
/**
* @var int
*/
public $fetched;
public $labelStatus = array();
@ -167,14 +212,26 @@ class BonPrelevement extends CommonObject
'type' => array('type' => 'varchar(16)', 'label' => 'Type', 'enabled' => 1, 'position' => 75, 'notnull' => 0, 'visible' => -1,),
'fk_bank_account' => array('type' => 'integer', 'label' => 'Fkbankaccount', 'enabled' => 1, 'position' => 80, 'notnull' => 0, 'visible' => -1, 'css' => 'maxwidth500 widthcentpercentminusxx',),
);
/**
* @var int
*/
public $rowid;
/**
* @var string
*/
public $ref;
/**
* @var int|string
*/
public $datec;
/**
* @var float
*/
public $amount;
/**
* @var int Status
* @deprecated
* @deprecated Use $status
*/
public $statut;
/**
@ -182,17 +239,41 @@ class BonPrelevement extends CommonObject
*/
public $status;
/**
* @var int
*/
public $credite;
/**
* @var string
*/
public $note;
/**
* @var int|string
*/
public $date_trans;
/**
* @var int Current transport method, index to $methodes_trans
*/
public $method_trans;
/**
* @var int
*/
public $fk_user_trans;
/**
* @var int|string
*/
public $date_credit;
/**
* @var int
*/
public $fk_user_credit;
/**
* @var string
*/
public $type;
/**
* @var int
*/
public $fk_bank_account;
// END MODULEBUILDER PROPERTIES
@ -881,7 +962,7 @@ class BonPrelevement extends CommonObject
/**
* Get number of invoices waiting for payment
*
* @param string $mode 'direct-debit' or 'bank-transfer'
* @param 'direct-debit'|'bank-transfer' $mode 'direct-debit' or 'bank-transfer'
* @param string $type for salary invoice
* @return int Return integer <O if KO, number of invoices if OK
*/
@ -1775,6 +1856,7 @@ class BonPrelevement extends CommonObject
// Define $fileDebiteurSection. One section DrctDbtTxInf per invoice.
$resql = $this->db->query($sql);
$nbtotalDrctDbtTxInf = -1;
if ($resql) {
$cachearraytotestduplicate = array();
@ -1912,6 +1994,8 @@ class BonPrelevement extends CommonObject
$sql .= " AND rib.type = 'ban'";
}
// Define $fileCrediteurSection. One section DrctDbtTxInf per invoice.
$nbtotalDrctDbtTxInf = -1;
$resql = $this->db->query($sql);
if ($resql) {
$cachearraytotestduplicate = array();

View File

@ -245,11 +245,11 @@ if ($type) {
if ($sourcetype != 'salary') {
$nb = $bprev->nbOfInvoiceToPay($type);
$pricetowithdraw = $bprev->SommeAPrelever($type);
$nb = $bprev->nbOfInvoiceToPay($type); // @phan-suppress-current-line PhanPluginSuspiciousParamPosition
$pricetowithdraw = $bprev->SommeAPrelever($type); // @phan-suppress-current-line PhanPluginSuspiciousParamPosition
} else {
$nb = $bprev->nbOfInvoiceToPay($type, 'salary');
$pricetowithdraw = $bprev->SommeAPrelever($type, 'salary');
$nb = $bprev->nbOfInvoiceToPay($type, 'salary'); // @phan-suppress-current-line PhanPluginSuspiciousParamPosition
$pricetowithdraw = $bprev->SommeAPrelever($type, 'salary'); // @phan-suppress-current-line PhanPluginSuspiciousParamPosition
}
if ($nb < 0) {
dol_print_error($db, $bprev->error);
@ -558,6 +558,7 @@ if ($resql) {
if ($type == 'bank-transfer') {
$invoicestatic->ref_supplier = $obj->ref_supplier;
}
$salary = null;
} else {
$bac = new UserBankAccount($db);
$bac->fetch(0, '', $obj->uid);
@ -582,7 +583,7 @@ if ($resql) {
// Ref invoice
print '<td class="tdoverflowmax150">';
if ($sourcetype != 'salary') {
if ($sourcetype != 'salary' || $salary === null) {
print $invoicestatic->getNomUrl(1, 'withdraw');
} else {
print $salary->getNomUrl(1, 'withdraw');

View File

@ -52,6 +52,17 @@ $invoice_type = GETPOSTISSET('invoice_type') ? GETPOST('invoice_type', 'alpha')
$vat_rate_show = GETPOSTISSET('vat_rate_show') ? GETPOST('vat_rate_show', 'alphanohtml') : -1;
include DOL_DOCUMENT_ROOT . '/compta/tva/initdatesforvat.inc.php';
// Variables provided by include:
'
@phan-var-force int $date_start
@phan-var-force int $date_end
@phan-var-force string $date_start_month
@phan-var-force string $date_start_year
@phan-var-force string $date_start_day
@phan-var-force string $date_end_month
@phan-var-force string $date_end_year
@phan-var-force string $date_end_day
';
$min = price2num(GETPOST("min", "alpha"));
if (empty($min)) {

View File

@ -192,7 +192,7 @@ class ContratLigne extends CommonObjectLine
public $qty;
/**
* @var int|string
* @var float|string
*/
public $remise_percent;

View File

@ -84,7 +84,7 @@ abstract class CommonDocGenerator
public $description;
/**
* @var array
* @var array{0:float,1:float}
*/
public $format;
@ -131,20 +131,52 @@ abstract class CommonDocGenerator
/**
* @var int<0,1> option logo
*/
public $option_logo;
/**
* @var int<0,1>
*/
public $option_tva;
/**
* @var int<0,1>
*/
public $option_multilang;
/**
* @var int<0,1>
*/
public $option_freetext;
/**
* @var int<0,1>
*/
public $option_draft_watermark;
/**
* @var string
*/
public $watermark;
/**
* @var int<0,1>
*/
public $option_modereg;
/**
* @var int<0,1>
*/
public $option_condreg;
/**
* @var int<0,1>
*/
public $option_escompte;
/**
* @var int<0,1>
*/
public $option_credit_note;
/**
* @var array<string,float>
*/
public $tva;
/**
* @var array<string,array{amount:float}>
*/
public $tva_array;
/**
* Local tax rates Array[tax_type][tax_rate]
@ -166,12 +198,12 @@ abstract class CommonDocGenerator
public $tabTitleHeight;
/**
* @var array default title fields style
* @var array{align?:'R'|'C'|'L',padding?:array<float|int>} default title fields style
*/
public $defaultTitlesFieldsStyle;
/**
* @var array default content fields style
* @var array{align?:'R'|'C'|'L',padding?:array<float|int>} default content fields style
*/
public $defaultContentsFieldsStyle;
@ -196,23 +228,77 @@ abstract class CommonDocGenerator
*/
public $result;
/**
* @var float
*/
public $posxlabel;
/**
* @var float
*/
public $posxup;
/**
* @var float
*/
public $posxref;
/**
* @var float
*/
public $posxpicture; // For picture
/**
* @var float
*/
public $posxdesc; // For description
/**
* @var float
*/
public $posxqty;
/**
* @var float
*/
public $posxpuht;
/**
* @var float
*/
public $posxtva;
/**
* @var float|int
*/
public $posxtotalht;
/**
* @var float
*/
public $postotalht;
/**
* @var float
*/
public $posxunit;
/**
* @var float
*/
public $posxdiscount;
/**
* @var float
*/
public $posxworkload;
/**
* @var float
*/
public $posxtimespent;
/**
* @var float
*/
public $posxprogress;
/**
* @var bool
*/
public $atleastonephoto;
/**
* @var int<0,1>
*/
public $atleastoneratenotnull;
/**
* @var bool|int<0,1>
*/
public $atleastonediscount;
/**
@ -594,10 +680,10 @@ abstract class CommonDocGenerator
$resarray = array(
$array_key.'_id' => $object->id,
$array_key.'_ref' => (property_exists($object, 'ref') ? $object->ref : ''),
$array_key.'_label' => (property_exists($object, 'label') ? $object->label : ''),
$array_key.'_label' => (property_exists($object, 'label') ? $object->label : ''), // @phan-suppress-current-line PhanUndeclaredProperty
$array_key.'_ref_ext' => (property_exists($object, 'ref_ext') ? $object->ref_ext : ''),
$array_key.'_ref_customer' => (!empty($object->ref_client) ? $object->ref_client : (empty($object->ref_customer) ? '' : $object->ref_customer)),
$array_key.'_ref_supplier' => (!empty($object->ref_fournisseur) ? $object->ref_fournisseur : (empty($object->ref_supplier) ? '' : $object->ref_supplier)),
$array_key.'_ref_supplier' => (!empty($object->ref_fournisseur) ? $object->ref_fournisseur : (empty($object->ref_supplier) ? '' : $object->ref_supplier)), // @phan-suppress-current-line PhanUndeclaredProperty
$array_key.'_source_invoice_ref' => ((empty($invoice_source) || empty($invoice_source->ref)) ? '' : $invoice_source->ref),
// Dates
$array_key.'_hour' => dol_print_date($date, 'hour'),
@ -605,7 +691,7 @@ abstract class CommonDocGenerator
$array_key.'_date_rfc' => dol_print_date($date, 'dayrfc'),
$array_key.'_date_limit' => (!empty($object->date_lim_reglement) ? dol_print_date($object->date_lim_reglement, 'day') : ''),
$array_key.'_date_limit_rfc' => (!empty($object->date_lim_reglement) ? dol_print_date($object->date_lim_reglement, 'dayrfc') : ''),
$array_key.'_date_end' => (!empty($object->fin_validite) ? dol_print_date($object->fin_validite, 'day') : ''),
$array_key.'_date_end' => (!empty($object->fin_validite) ? dol_print_date($object->fin_validite, 'day') : ''), // @phan-suppress-current-line PhanUndeclaredProperty
$array_key.'_date_creation' => dol_print_date($object->date_creation, 'day'),
$array_key.'_date_modification' => (!empty($object->date_modification) ? dol_print_date($object->date_modification, 'day') : ''),
$array_key.'_date_validation' => (!empty($object->date_validation) ? dol_print_date($object->date_validation, 'dayhour') : ''),
@ -621,13 +707,13 @@ abstract class CommonDocGenerator
$array_key.'_incoterms' => (method_exists($object, 'display_incoterms') ? $object->display_incoterms() : ''),
$array_key.'_total_ht_locale' => price($object->total_ht, 0, $outputlangs),
$array_key.'_total_vat_locale' => (!empty($object->total_vat) ? price($object->total_vat, 0, $outputlangs) : price($object->total_tva, 0, $outputlangs)),
$array_key.'_total_vat_locale' => (!empty($object->total_vat) ? price($object->total_vat, 0, $outputlangs) : price($object->total_tva, 0, $outputlangs)), // @phan-suppress-current-line PhanUndeclaredProperty
$array_key.'_total_localtax1_locale' => price($object->total_localtax1, 0, $outputlangs),
$array_key.'_total_localtax2_locale' => price($object->total_localtax2, 0, $outputlangs),
$array_key.'_total_ttc_locale' => price($object->total_ttc, 0, $outputlangs),
$array_key.'_total_ht' => price2num($object->total_ht),
$array_key.'_total_vat' => (!empty($object->total_vat) ? price2num($object->total_vat) : price2num($object->total_tva)),
$array_key.'_total_vat' => (!empty($object->total_vat) ? price2num($object->total_vat) : price2num($object->total_tva)), // @phan-suppress-current-line PhanUndeclaredProperty
$array_key.'_total_localtax1' => price2num($object->total_localtax1),
$array_key.'_total_localtax2' => price2num($object->total_localtax2),
$array_key.'_total_ttc' => price2num($object->total_ttc),
@ -775,7 +861,6 @@ abstract class CommonDocGenerator
'line_fulldesc' => doc_getlinedesc($line, $outputlangs),
'line_product_ref' => (empty($line->product_ref) ? '' : $line->product_ref),
'line_product_ref_fourn' => (empty($line->ref_fourn) ? '' : $line->ref_fourn), // for supplier doc lines
'line_product_label' => (empty($line->product_label) ? '' : $line->product_label),
'line_product_type' => (empty($line->product_type) ? '' : $line->product_type),
'line_product_barcode' => (empty($line->product_barcode) ? '' : $line->product_barcode),
@ -783,8 +868,6 @@ abstract class CommonDocGenerator
'line_desc' => $line->desc,
'line_vatrate' => vatrate($line->tva_tx, true, $line->info_bits),
'line_localtax1_rate' => vatrate($line->localtax1_tx),
'line_localtax2_rate' => vatrate($line->localtax1_tx),
'line_up' => price2num($line->subprice),
'line_up_locale' => price($line->subprice, 0, $outputlangs),
'line_total_up' => price2num($line->subprice * (float) $line->qty),
@ -797,13 +880,6 @@ abstract class CommonDocGenerator
'line_price_ht_locale' => price($line->total_ht, 0, $outputlangs),
'line_price_ttc_locale' => price($line->total_ttc, 0, $outputlangs),
'line_price_vat_locale' => price($line->total_tva, 0, $outputlangs),
// Dates
'line_date_start' => dol_print_date($line->date_start, 'day'),
'line_date_start_locale' => dol_print_date($line->date_start, 'day', 'tzserver', $outputlangs),
'line_date_start_rfc' => dol_print_date($line->date_start, 'dayrfc'),
'line_date_end' => dol_print_date($line->date_end, 'day'),
'line_date_end_locale' => dol_print_date($line->date_end, 'day', 'tzserver', $outputlangs),
'line_date_end_rfc' => dol_print_date($line->date_end, 'dayrfc'),
'line_multicurrency_code' => price2num($line->multicurrency_code),
'line_multicurrency_subprice' => price2num($line->multicurrency_subprice),
@ -816,6 +892,36 @@ abstract class CommonDocGenerator
'line_multicurrency_total_ttc_locale' => price($line->multicurrency_total_ttc, 0, $outputlangs),
);
if (property_exists($line, 'ref_fourn')) {
$resarray['line_product_ref_fourn'] = $line->ref_fourn; // for supplier doc lines @phan-suppress-current-line PhanUndeclaredProperty
} else {
$resarray['line_product_ref_fourn'] = '';
}
$vat_specs = array(
'line_localtax1_rate' => 'localtax1_tx',
'line_localtax2_rate' => 'localtax2_tx',
);
foreach ($vat_specs as $vat_spec) {
if (property_exists($line, $vat_spec[1])) {
$resarray[$vat_spec[0]] = vatrate($line->${$vat_spec[1]});
}
}
// Dates (fields not available on all line classes)
$date_specs = array(
array('line_date_start', 'date_start', 'day', 'auto', null),
array('line_date_start_locale', 'date_start', 'day', 'tzserver', $outputlangs),
array('line_date_start_rfc', 'date_start', 'dayrfc', 'auto', null),
array('line_date_end', 'date_end', 'day', 'auto', null),
array('line_date_end_locale', 'date_end', 'day', 'tzserver', $outputlangs),
array('line_date_end_rfc', 'date_end', 'dayrfc', 'auto', null)
);
foreach ($date_specs as $date_spec) {
if (property_exists($line, $date_spec[1])) {
$resarray[$date_spec[0]] = dol_print_date($line->${$date_spec[1]}, $date_spec[2], $date_spec[3], $date_spec[4]);
}
}
// Units
if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
$resarray['line_unit'] = $outputlangs->trans($line->getLabelOfUnit('long'));
@ -957,16 +1063,16 @@ abstract class CommonDocGenerator
/**
* Define array with couple substitution key => substitution value
*
* @param array<string,mixed> $object Dolibarr Object
* @param array<string,CommonObject|float|int|string> $object Dolibarr Object
* @param Translate $outputlangs Language object for output
* @param boolean|int $recursive Want to fetch child array or child object.
* @return array<string,mixed> Array of substitution key->code
* @return array<string,mixed> Array of substitution key->code
*/
public function get_substitutionarray_each_var_object(&$object, $outputlangs, $recursive = 1)
{
// phpcs:enable
$array_other = array();
if (!empty($object)) {
if (is_array($object) && count($object)) {
foreach ($object as $key => $value) {
if (in_array($key, array('db', 'fields', 'lines', 'modelpdf', 'model_pdf'))) { // discard some properties
continue;

View File

@ -23,14 +23,14 @@
/**
* \file htdocs/core/class/commoninvoice.class.php
* \ingroup core
* \brief File of the superclass of invoices classes (customer and supplier)
* \brief File of the superclass of invoice classes (customer and supplier)
*/
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/commonincoterm.class.php';
/**
* Superclass for invoices classes
* Superclass for invoice classes
*/
abstract class CommonInvoice extends CommonObject
{
@ -53,7 +53,7 @@ abstract class CommonInvoice extends CommonObject
/**
* @var int Thirdparty ID
* @deprecated
* @deprecated Use $socid
* @see $socid
*/
public $fk_soc;
@ -62,12 +62,15 @@ abstract class CommonInvoice extends CommonObject
*/
public $socid;
/**
* @var int<0,1>
*/
public $paye;
/**
* Invoice date (date)
*
* @var integer
* @var int
*/
public $date;
@ -76,13 +79,31 @@ abstract class CommonInvoice extends CommonObject
*/
public $date_lim_reglement;
/**
* @var int
*/
public $cond_reglement_id; // Id in llx_c_paiement
/**
* @var string|int Code in llx_c_paiement
*/
public $cond_reglement_code; // Code in llx_c_paiement
/**
* @var string
*/
public $cond_reglement_label;
public $cond_reglement_doc; // Code in llx_c_paiement
/**
* @var string Code in llx_c_paiement
*/
public $cond_reglement_doc;
/**
* @var int
*/
public $mode_reglement_id;
public $mode_reglement_code; // Code in llx_c_paiement
/**
* @var string Code in llx_c_paiement
*/
public $mode_reglement_code;
/**
* @var string
@ -90,20 +111,50 @@ abstract class CommonInvoice extends CommonObject
public $mode_reglement;
/**
* @var double
* @var float
*/
public $revenuestamp;
/**
* @var float
*/
public $totalpaid; // duplicate with sumpayed
/**
* @var int|float
*/
public $totaldeposits; // duplicate with sumdeposit
/**
* @var int|float
*/
public $totalcreditnotes; // duplicate with sumcreditnote
/**
* @var int|float
*/
public $sumpayed;
/**
* @var int|float
*/
public $sumpayed_multicurrency;
/**
* @var int|float
*/
public $sumdeposit;
/**
* @var int|float
*/
public $sumdeposit_multicurrency;
/**
* @var int|float
*/
public $sumcreditnote;
/**
* @var int|float
*/
public $sumcreditnote_multicurrency;
/**
* @var string
*/
public $remaintopay;
/**
@ -221,7 +272,7 @@ abstract class CommonInvoice extends CommonObject
* This does not include open direct debit requests.
*
* @param int $multicurrency Return multicurrency_amount instead of amount
* @return float Remain of amount to pay
* @return float|string Remain of amount to pay
*/
public function getRemainToPay($multicurrency = 0)
{
@ -241,8 +292,8 @@ abstract class CommonInvoice extends CommonObject
* Return amount of payments already done. This must include ONLY the record into the payment table.
* Payments done using discounts, credit notes, etc are not included.
*
* @param int $multicurrency Return multicurrency_amount instead of amount. -1=Return both.
* @return float|int|array Amount of payment already done, <0 and set ->error if KO
* @param int<-1,1> $multicurrency Return multicurrency_amount instead of amount. -1=Return both.
* @return float|int|array{alreadypaid:float,alreadypaid_multicurrency:float} Amount of payment already done, <0 and set ->error if KO
* @see getSumDepositsUsed(), getSumCreditNotesUsed()
*/
public function getSommePaiement($multicurrency = 0)
@ -372,7 +423,7 @@ abstract class CommonInvoice extends CommonObject
/**
* Returns array of credit note ids from the invoice
*
* @return array Array of credit note ids
* @return int[] Array of credit note ids
*/
public function getListIdAvoirFromInvoice()
{
@ -681,6 +732,7 @@ abstract class CommonInvoice extends CommonObject
global $langs;
$labellong = "Unknown";
$labelshort = "Unknown";
if ($this->type == CommonInvoice::TYPE_STANDARD) {
$labellong = "InvoiceStandard";
$labelshort = "InvoiceStandardShort";
@ -749,8 +801,8 @@ abstract class CommonInvoice extends CommonObject
/**
* Retrieve a list of invoice subtype labels or codes.
*
* @param int $mode 0=Return id+label, 1=Return code+id
* @return array Array of subtypes
* @param int<0,1> $mode 0=Return id+label, 1=Return code+id
* @return array<int,string>|array<string,int> Array of subtypes
*/
public function getArrayOfInvoiceSubtypes($mode = 0)
{
@ -1268,6 +1320,7 @@ abstract class CommonInvoice extends CommonObject
}
}
$paymentintent = null;
if (!$error) {
if ($amountstripe > 0) {
try {
@ -1593,7 +1646,7 @@ abstract class CommonInvoice extends CommonObject
}
}
if (!$error && !$errorforinvoice) {
if (!$error && !$errorforinvoice && $paymentintent !== null) {
// Update the direct debit payment request of the processed invoice to save the id of the prelevement_bon
$sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_demande SET";
$sql .= " ext_payment_id = '".$this->db->escape($paymentintent->id)."',";
@ -1900,16 +1953,19 @@ abstract class CommonInvoiceLine extends CommonObjectLine
/**
* Custom label of line. Not used by default.
* @deprecated
* @var string
*/
public $label;
/**
* @deprecated
* @deprecated Use $product_ref
* @see $product_ref
* @var string
*/
public $ref; // Product ref (deprecated)
/**
* @deprecated
* @var string
* @deprecated Use $product_label
* @see $product_label
*/
public $libelle; // Product label (deprecated)
@ -1940,7 +1996,7 @@ abstract class CommonInvoiceLine extends CommonObjectLine
/**
* Quantity
* @var double
* @var float
*/
public $qty;
@ -1971,7 +2027,7 @@ abstract class CommonInvoiceLine extends CommonObjectLine
/**
* VAT % Vat rate can be like "21.30 (CODE)"
* @var string|float
* @var float|string
*/
public $tva_tx;
@ -2044,14 +2100,37 @@ abstract class CommonInvoiceLine extends CommonObjectLine
*/
public $total_ttc;
/**
* @var int<0,1>
*/
public $date_start_fill; // If set to 1, when invoice is created from a template invoice, it will also auto set the field date_start at creation
/**
* @var int<0,1>
*/
public $date_end_fill; // If set to 1, when invoice is created from a template invoice, it will also auto set the field date_end at creation
/**
* @var float
*/
public $buy_price_ht;
public $buyprice; // For backward compatibility
public $pa_ht; // For backward compatibility
/**
* @var float
* @deprecated For backward compatibility
*/
public $buyprice;
/**
* @var float|int|string
* @deprecated For backward compatibility
*/
public $pa_ht;
/**
* @var string
*/
public $marge_tx;
/**
* @var string
*/
public $marque_tx;
/**
@ -2073,14 +2152,19 @@ abstract class CommonInvoiceLine extends CommonObjectLine
public $special_code = 0;
/**
* @var int
* @deprecated Use user_creation_id
*/
public $fk_user_author;
/**
* @var int
* @deprecated Use user_modification_id
*/
public $fk_user_modif;
/**
* @var int
*/
public $fk_accounting_account;
}

View File

@ -5576,7 +5576,7 @@ abstract class CommonObject
if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
$this->tpl['unit'] = $langs->transnoentities($line->getLabelOfUnit('long'));
}
$this->tpl['remise_percent'] = (($line->info_bits & 2) != 2) ? vatrate($line->remise_percent, true) : '&nbsp;';
$this->tpl['remise_percent'] = (($line->info_bits & 2) != 2) ? vatrate((string) $line->remise_percent, true) : '&nbsp;';
// Is the line strike or not
$this->tpl['strike'] = 0;

View File

@ -63,30 +63,82 @@ abstract class CommonObjectLine extends CommonObject
public $picto = 'line';
/**
* @var int|null ID of the unit of measurement (rowid in llx_c_units table)
* @var ?int ID of the unit of measurement (rowid in llx_c_units table)
* @see measuringUnitString()
* @see getLabelOfUnit()
*/
public $fk_unit;
/**
* @var int|''
*/
public $date_debut_prevue;
/**
* @var int|''
*/
public $date_debut_reel;
/**
* @var int|''
*/
public $date_fin_prevue;
/**
* @var int|''
*/
public $date_fin_reel;
public $weight;
public $weight_units;
public $width;
public $width_units;
public $height;
public $height_units;
public $length;
public $length_units;
public $surface;
public $surface_units;
public $volume;
public $volume_units;
/**
* @var float|string
*/
public $weight;
/**
* @var int|string
*/
public $weight_units; // scale -3, 0, 3, 6
/**
* @var float|string
*/
public $length;
/**
* @var int|string
*/
public $length_units; // scale -3, 0, 3, 6
/**
* @var float|string
*/
public $width;
/**
* @var int|string
*/
public $width_units; // scale -3, 0, 3, 6
/**
* @var float|string|null
*/
public $height;
/**
* @var int|string|null
*/
public $height_units; // scale -3, 0, 3, 6
/**
* @var float|string|null
*/
public $surface;
/**
* @var int|string|null
*/
public $surface_units; // scale -3, 0, 3, 6
/**
* @var float|string|null
*/
public $volume;
/**
* @var int|string|null
*/
public $volume_units; // scale -3, 0, 3, 6
/**
* @var ?array<string,array<string,string>>
*/
public $multilangs;
/**
@ -147,7 +199,13 @@ abstract class CommonObjectLine extends CommonObject
* @var float Quantity
*/
public $qty;
/**
* @var int
*/
public $duree;
/**
* @var float|string
*/
public $remise_percent;
/**
@ -168,6 +226,9 @@ abstract class CommonObjectLine extends CommonObject
* @var float
*/
public $subprice;
/**
* @var float|string
*/
public $tva_tx;
/**
@ -216,7 +277,7 @@ abstract class CommonObjectLine extends CommonObject
* A langs->trans() must be called on result to get translated value.
*
* @param string $type Label type ('long', 'short' or 'code'). This can be a translation key.
* @return string|int Return integer <0 if KO, label if OK (Example: 'long', 'short' or 'unitCODE')
* @return string|int<-1,1> Return integer <0 if KO, label if OK (Example: 'long', 'short' or 'unitCODE')
*/
public function getLabelOfUnit($type = 'long')
{
@ -260,13 +321,13 @@ abstract class CommonObjectLine extends CommonObject
* @param string $sortfield Sort field
* @param int $limit Limit the number of lines returned
* @param int $offset Offset
* @param string|array $filter Filter as an Universal Search string.
* @param string|string[] $filter Filter as an Universal Search string.
* Example: '((client:=:1) OR ((client:>=:2) AND (client:<=:3))) AND (client:!=:8) AND (nom:like:'a%')'
* @param string $filtermode No more used
* @return array|int int <0 if KO, array of pages if OK
* @return self[]|int<-1,-1> int <0 if KO, array of pages if OK
*/
public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, $filter = '', $filtermode = 'AND')
{
return 0;
return -1; // NOK because nothing done.
}
}

View File

@ -5318,7 +5318,7 @@ class Form
* @param string $selected Id of category preselected or 'auto' (autoselect category if there is only one element). Not used if $outputmode = 1.
* @param string $htmlname HTML field name
* @param int $maxlength Maximum length for labels
* @param int|string|array $fromid Keep only or Exclude (depending on $include parameter) all categories (including the leaf $fromid) into the tree after this id $fromid.
* @param int|string|int[] $fromid Keep only or Exclude (depending on $include parameter) all categories (including the leaf $fromid) into the tree after this id $fromid.
* $fromid can be an :
* - int (id of category)
* - string (categories ids separated by comma)
@ -5326,7 +5326,7 @@ class Form
* @param int<0,3> $outputmode 0=HTML select string, 1=Array with full label only, 2=Array extended, 3=Array with full picto + label
* @param int<0,1> $include [=0] Removed or 1=Keep only
* @param string $morecss More CSS
* @param int<0,2> $useempty 0=No empty value, 1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries. Default is 1.
* @param int<0,2> $useempty 0=No empty value, 1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries. Default is 1.
* @return string|array<int,string>|array<int,array{id:int,fulllabel:string,color:string,picto:string}>|array<int,array{rowid:int,id:int,fk_parent:int,label:string,description:string,color:string,position:string,visible:int,ref_ext:string,picto:string,fullpath:string,fulllabel:string}> String list or Array of categories
* @see select_categories()
*/

View File

@ -3306,7 +3306,7 @@ function dol_strftime($fmt, $ts = false, $is_gmt = false)
* false or 'tzserver' => output string is for local PHP server TZ usage
* 'tzuser' => output string is for user TZ (current browser TZ with current dst) => In a future, we should have same behaviour than 'tzuserrel'
* 'tzuserrel' => output string is for user TZ (current browser TZ with dst or not, depending on date position)
* @param Translate $outputlangs Object lang that contains language for text translation.
* @param ?Translate $outputlangs Object lang that contains language for text translation.
* @param boolean $encodetooutput false=no convert into output pagecode
* @return string Formatted date or '' if time is null
*
@ -12512,7 +12512,7 @@ function dolGetButtonAction($label, $text = '', $actionType = 'default', $url =
if (!empty($subbutton['attr'])) {
$subbuttonparam['attr'] = $subbutton['attr'];
}
$subbuttonparam['isDropDown'] = (empty($params['isDropDown']) ? ($subbutton['isDropDown']??false) : $params['isDropDown']);
$subbuttonparam['isDropDown'] = (empty($params['isDropDown']) ? ($subbutton['isDropDown'] ?? false) : $params['isDropDown']);
$out .= dolGetButtonAction('', $langs->trans($subbutton['label']), 'default', $tmpurl, $subbutton['id'] ?? '', $subbutton['perm'], $subbuttonparam);
}
@ -12687,7 +12687,7 @@ function dolCompletUrlForDropdownButton(string $url, array $params, bool $addDol
// Use parse_str() function to parse the string passed via URL
parse_str($parsedUrl['query'], $urlQuery);
if (!isset($urlQuery['backtopage']) && isset($params['backtopage'])) {
$url.= '&amp;backtopage='.urlencode($params['backtopage']);
$url .= '&amp;backtopage='.urlencode($params['backtopage']);
}
}

View File

@ -6,11 +6,10 @@
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2018 Frédéric France <frederic.francenetlogic.fr>
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2023 Joachim Kueter <git-jk@bloxera.com>
* Copyright (C) 2023 Sylvain Legrand <technique@infras.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 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
@ -72,7 +71,7 @@ class PaiementFourn extends Paiement
public $type_code;
/**
* @var string Id of prelevement
* @var int Id of prelevement
*/
public $id_prelevement;

View File

@ -938,7 +938,7 @@ if (empty($reshook)) {
$line->fk_parent_line = $fk_parent_line;
$line->subprice = -$line->subprice; // invert price for object
$line->pa_ht = -$line->pa_ht;
$line->pa_ht = -((float) $line->pa_ht);
$line->total_ht = -$line->total_ht;
$line->total_tva = -$line->total_tva;
$line->total_ttc = -$line->total_ttc;

View File

@ -516,9 +516,8 @@ if (!getDolGlobalString('MAIN_DISABLE_GLOBAL_WORKBOARD') && getDolGlobalInt('MAI
// Show dashboard
$nbworkboardempty = 0;
$isIntopOpenedDashBoard = $globalStatInTopOpenedDashBoard = array();
$openedDashBoard = '';
if (!empty($valid_dashboardlines)) {
$openedDashBoard = '';
$boxwork .= '<tr class="nobottom nohover"><td class="tdboxstats nohover flexcontainer centpercent"><div style="display: flex: flex-wrap: wrap">';
foreach ($dashboardgroup as $groupKey => $groupElement) {

View File

@ -31,7 +31,7 @@ CREATE TABLE llx_webhook_target(
url varchar(255) NOT NULL,
connection_method varchar(255) NULL, -- to store the way to authenticate to the webhook
connection_data varchar(255) NULL, -- to store the data to use to authenticate to the webhook
trigger_codes text NULL -- list of selected trigger that must call the webhook
trigger_stack text, -- json object to store trigger to be send manually
trigger_codes text NULL , -- list of selected trigger that must call the webhook
trigger_stack text -- json object to store trigger to be send manually
-- END MODULEBUILDER FIELDS
) ENGINE=innodb;

View File

@ -919,7 +919,7 @@ if ($ok && GETPOST('clean_orphelin_dir', 'alpha')) {
$id = $reg[1];
}
if ($id || $ref) {
if (($id || $ref) && $object_instance !== null) {
//print 'Fetch '.$id.' or '.$ref.'<br>';
$result = $object_instance->fetch($id, $ref);
//print $result.'<br>';

View File

@ -1019,7 +1019,8 @@ class KnowledgeRecord extends CommonObject
return $result;
} else {
$this->lines = $result;
return $this->lines;
// @phpstan-ignore-next-line
return $result; // @phan-suppress-current-line PhanTypeMismatchReturn
}
}

View File

@ -1261,7 +1261,8 @@ class Partnership extends CommonObject
return $result;
} else {
$this->lines = $result;
return $this->lines;
// @phpstan-ignore-next-line
return $result; // @phan-suppress-current-line PhanTypeMismatchReturn
}
}

View File

@ -980,7 +980,8 @@ class RecruitmentCandidature extends CommonObject
return $result;
} else {
$this->lines = $result;
return $this->lines;
// @phpstan-ignore-next-line
return $result; // @phan-suppress-current-line PhanTypeMismatchReturn
}
}

View File

@ -98,12 +98,12 @@ class pdf_standard_recruitmentjobposition extends ModelePDFRecruitmentJobPositio
public $tabTitleHeight;
/**
* @var array defaultContentsFieldsStyle
* @var array{align?:'R'|'C'|'L',padding?:array<float|int>} defaultContentsFieldsStyle
*/
public $defaultContentsFieldsStyle = array();
/**
* @var array defaultTitlesFieldsStyle
* @var array{align?:'R'|'C'|'L',padding?:array<float|int>} defaultTitlesFieldsStyle
*/
public $defaultTitlesFieldsStyle = array();

View File

@ -3143,8 +3143,8 @@ class Ticket extends CommonObject
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)
*
* @param User $user Object user
* @param int $mode "opened" for askprice to close, "signed" for proposal to invoice
* @return WorkboardResponse|int Return integer <0 if KO, WorkboardResponse if OK
* @param 'opened'|'signed' $mode "opened" for askprice to close, "signed" for proposal to invoice
* @return WorkboardResponse|int<-1,-1> Return integer <0 if KO, WorkboardResponse if OK
*/
public function load_board($user, $mode)
{