Prepare code to fix too many sql error
This commit is contained in:
parent
2dec660763
commit
212f24ac9e
@ -1863,11 +1863,14 @@ if ($resql) {
|
|||||||
$paiement = $facturestatic->getSommePaiement();
|
$paiement = $facturestatic->getSommePaiement();
|
||||||
$totalcreditnotes = $facturestatic->getSumCreditNotesUsed();
|
$totalcreditnotes = $facturestatic->getSumCreditNotesUsed();
|
||||||
$totaldeposits = $facturestatic->getSumDepositsUsed();
|
$totaldeposits = $facturestatic->getSumDepositsUsed();
|
||||||
$totalpay = $paiement + $totalcreditnotes + $totaldeposits;
|
|
||||||
$remaintopay = price2num($facturestatic->total_ttc - $totalpay);
|
|
||||||
$multicurrency_paiement = $facturestatic->getSommePaiement(1);
|
$multicurrency_paiement = $facturestatic->getSommePaiement(1);
|
||||||
$multicurrency_totalcreditnotes = $facturestatic->getSumCreditNotesUsed(1);
|
$multicurrency_totalcreditnotes = $facturestatic->getSumCreditNotesUsed(1);
|
||||||
$multicurrency_totaldeposits = $facturestatic->getSumDepositsUsed(1);
|
$multicurrency_totaldeposits = $facturestatic->getSumDepositsUsed(1);
|
||||||
|
|
||||||
|
$totalpay = $paiement + $totalcreditnotes + $totaldeposits;
|
||||||
|
$remaintopay = price2num($facturestatic->total_ttc - $totalpay);
|
||||||
|
|
||||||
$multicurrency_totalpay = $multicurrency_paiement + $multicurrency_totalcreditnotes + $multicurrency_totaldeposits;
|
$multicurrency_totalpay = $multicurrency_paiement + $multicurrency_totalcreditnotes + $multicurrency_totaldeposits;
|
||||||
$multicurrency_remaintopay = price2num($facturestatic->multicurrency_total_ttc - $multicurrency_totalpay);
|
$multicurrency_remaintopay = price2num($facturestatic->multicurrency_total_ttc - $multicurrency_totalpay);
|
||||||
|
|
||||||
|
|||||||
@ -131,8 +131,8 @@ abstract class CommonInvoice extends CommonObject
|
|||||||
* Return amount of payments already done. This must include ONLY the record into the payment table.
|
* Return amount of payments already done. This must include ONLY the record into the payment table.
|
||||||
* Payments dones using discounts, credit notes, etc are not included.
|
* Payments dones using discounts, credit notes, etc are not included.
|
||||||
*
|
*
|
||||||
* @param int $multicurrency Return multicurrency_amount instead of amount
|
* @param int $multicurrency Return multicurrency_amount instead of amount. -1=Return both.
|
||||||
* @return float|int Amount of payment already done, <0 and set ->error if KO
|
* @return float|int|array Amount of payment already done, <0 and set ->error if KO
|
||||||
*/
|
*/
|
||||||
public function getSommePaiement($multicurrency = 0)
|
public function getSommePaiement($multicurrency = 0)
|
||||||
{
|
{
|
||||||
@ -156,7 +156,11 @@ abstract class CommonInvoice extends CommonObject
|
|||||||
$this->db->free($resql);
|
$this->db->free($resql);
|
||||||
|
|
||||||
if ($obj) {
|
if ($obj) {
|
||||||
if ($multicurrency) {
|
if ($multicurrency < 0) {
|
||||||
|
$this->sumpayed = $obj->amount;
|
||||||
|
$this->sumpayed_multicurrency = $obj->multicurrency_amount;
|
||||||
|
return array('alreadypaid'=>(float) $obj->amount, 'alreadypaid_multicurrency'=>(float) $obj->multicurrency_amount);
|
||||||
|
} elseif ($multicurrency) {
|
||||||
$this->sumpayed_multicurrency = $obj->multicurrency_amount;
|
$this->sumpayed_multicurrency = $obj->multicurrency_amount;
|
||||||
return (float) $obj->multicurrency_amount;
|
return (float) $obj->multicurrency_amount;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user