Merge pull request #25950 from frederic34/patch-7

fix origin id of order_supplier when creating one invoice_supplier
This commit is contained in:
Laurent Destailleur 2023-09-19 23:35:48 +02:00 committed by GitHub
commit 579dabb909
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -362,6 +362,7 @@ if (empty($reshook)) {
$validate_invoices = GETPOST('validate_invoices', 'int');
$TFact = array();
/** @var FactureFournisseur[] $TFactThird */
$TFactThird = array();
$nb_bills_created = 0;
@ -380,7 +381,7 @@ if (empty($reshook)) {
$objecttmp = new FactureFournisseur($db);
if (!empty($createbills_onebythird) && !empty($TFactThird[$cmd->socid])) {
$objecttmp = $TFactThird[$cmd->socid]; // If option "one bill per third" is set, we use already created order.
$objecttmp = $TFactThird[$cmd->socid]; // If option "one bill per third" is set, we use already created supplier invoice.
} else {
$objecttmp->socid = $cmd->socid;
$objecttmp->type = $objecttmp::TYPE_STANDARD;
@ -505,7 +506,8 @@ if (empty($reshook)) {
false,
$lines[$i]->array_options,
$lines[$i]->fk_unit,
$objecttmp->origin_id,
// we use the id of each order, not the id of the first one stored in $objecttmp->origin_id
$lines[$i]->fk_commande,
$lines[$i]->pa_ht,
$lines[$i]->ref_supplier,
$lines[$i]->special_code,