NEW: Add hidden option SUPPLIER_ORDER_CAN_UPDATE_BUYINGPRICE_DURING_RECEIPT for add possibility to update supplier buying price in the reception on a supplier order

This commit is contained in:
Juanjo Menent 2019-07-26 12:45:46 +02:00
parent 38bb046abb
commit f67f99099c

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2018 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2014-2016 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
@ -473,44 +473,20 @@ class BonPrelevement extends CommonObject
}
}
if (empty($conf->global->WITHDRAWAL_DISABLE_PAYMENT_PER_CUSTOMER)) {
// Make one payment per customer
foreach ($amountsperthirdparty as $thirdpartyid => $cursoramounts) {
$paiement = new Paiement($this->db);
$paiement->datepaye = $date;
$paiement->amounts = $cursoramounts; // Array with detail of dispatching of payments for each invoice
$paiement->paiementid = 3; //
$paiement->num_paiement = $this->ref; // Set ref of direct debit note
$paiement->id_prelevement = $this->id;
$paiement_id = $paiement->create($user);
if ($paiement_id < 0) {
dol_syslog(get_class($this) . "::set_infocredit AddPayment Error");
$error++;
} else {
$result = $paiement->addPaymentToBank($user, 'payment', '(WithdrawalPayment)', $bankaccount, '', '');
if ($result < 0) {
dol_syslog(get_class($this) . "::set_infocredit AddPaymentToBank Error");
$error++;
}
}
//var_dump($paiement->amounts);
//var_dump($thirdpartyid);
//var_dump($cursoramounts);
}
} else {
// Make one payment per customer
foreach ($amountsperthirdparty as $thirdpartyid => $cursoramounts)
{
$paiement = new Paiement($this->db);
$paiement->datepaye = $date ;
$paiement->amounts = $amounts;
$paiement->paiementid = 3; //
$paiement->num_paiement = $this->ref ;
$paiement->datepaye = $date;
$paiement->amounts = $cursoramounts; // Array with detail of dispatching of payments for each invoice
$paiement->paiementid = 3; //
$paiement->num_paiement = $this->ref; // Set ref of direct debit note
$paiement->id_prelevement = $this->id;
$paiement_id = $paiement->create($user);
if ($paiement_id < 0)
{
dol_syslog("BonPrelevement::set_credite AddPayment Error");
dol_syslog(get_class($this)."::set_infocredit AddPayment Error");
$error++;
}
else
@ -518,12 +494,15 @@ class BonPrelevement extends CommonObject
$result=$paiement->addPaymentToBank($user, 'payment', '(WithdrawalPayment)', $bankaccount, '', '');
if ($result < 0)
{
dol_syslog("BonPrelevement::set_credite AddPaymentToBank Error");
dol_syslog(get_class($this)."::set_infocredit AddPaymentToBank Error");
$error++;
}
}
//var_dump($paiement->amounts);
//var_dump($thirdpartyid);
//var_dump($cursoramounts);
}
// Update withdrawal line
// TODO: Translate to ligneprelevement.class.php
$sql = " UPDATE ".MAIN_DB_PREFIX."prelevement_lignes";