The hook "moreFamily" must return payment into var "totalpayment" and no

more "paiement" (english replace french).
This commit is contained in:
Laurent Destailleur 2019-09-03 17:39:19 +02:00
parent bd3971f0bd
commit 481a25cb8f
2 changed files with 10 additions and 10 deletions

View File

@ -18,7 +18,7 @@ Following changes may create regressions for some external modules, but were nec
* The function show_theme() hase been renamed into showSkins()
* Rename 'module_part' parameter into 'modulepart' into document APIs, for consistency.
* The deprecated method get_OutstandingBill has been removed. You can use getOutstandingBills() instead.
* The hook "moreFamily" must return payment into var "payment" and no more "paiement".
* The hook "moreFamily" must return payment into var "totalpayment" and no more "paiement" (english replace french).

View File

@ -213,9 +213,9 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
$i = 0;
while ($i < $num)
{
$paiement = '';
$ref = '';
$refcomp = '';
$totalpayment = '';
$obj = array_shift($tab_sqlobj);
@ -236,7 +236,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
$societestatic->name = $obj->name;
$refcomp=$societestatic->getNomUrl(1, '', 24);
$paiement = -1*$facturefournstatic->getSommePaiement(); // Payment already done
$totalpayment = -1*$facturefournstatic->getSommePaiement(); // Payment already done
}
}
if ($obj->family == 'invoice')
@ -250,9 +250,9 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
$societestatic->name = $obj->name;
$refcomp=$societestatic->getNomUrl(1, '', 24);
$paiement = $facturestatic->getSommePaiement(); // Payment already done
$paiement+= $facturestatic->getSumDepositsUsed();
$paiement+= $facturestatic->getSumCreditNotesUsed();
$totalpayment = $facturestatic->getSommePaiement(); // Payment already done
$totalpayment+= $facturestatic->getSumDepositsUsed();
$totalpayment+= $facturestatic->getSumCreditNotesUsed();
}
if ($obj->family == 'social_contribution')
{
@ -261,19 +261,19 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
$socialcontribstatic->lib=$obj->type;
$ref = $socialcontribstatic->getNomUrl(1, 24);
$paiement = -1*$socialcontribstatic->getSommePaiement(); // Payment already done
$totalpayment = -1*$socialcontribstatic->getSommePaiement(); // Payment already done
}
$parameters = array('obj' => $obj, 'ref' => $ref, 'refcomp' => $refcomp, 'payment' => $paiement);
$parameters = array('obj' => $obj, 'ref' => $ref, 'refcomp' => $refcomp, 'totalpayment' => $totalpayment);
$reshook = $hookmanager->executeHooks('moreFamily', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if(empty($reshook)){
$ref = isset($hookmanager->resArray['ref']) ? $hookmanager->resArray['ref'] : $ref;
$refcomp = isset($hookmanager->resArray['refcomp']) ? $hookmanager->resArray['refcomp'] : $refcomp;
$paiement = isset($hookmanager->resArray['paiement']) ? $hookmanager->resArray['paiement'] : $paiement;
$totalpayment = isset($hookmanager->resArray['totalpayment']) ? $hookmanager->resArray['totalpayment'] : $totalpayment;
}
$total_ttc = $obj->total_ttc;
if ($paiement) $total_ttc = $obj->total_ttc - $paiement;
if ($totalpayment) $total_ttc = $obj->total_ttc - $totalpayment;
$solde += $total_ttc;
// We discard lines with a remainder to pay to 0