FIX add TODO

This commit is contained in:
Regis Houssin 2025-01-22 22:26:05 +01:00
parent 8be6642289
commit 1589d5f9fc
2 changed files with 5 additions and 4 deletions

View File

@ -778,6 +778,7 @@ if ($id > 0) {
}
// Emit payment
// TODO check if loan schedule is created ($echeances->lines > 0)
if (($object->paid == 0 || $object->paid == 2) && ((price2num($object->capital) > 0 && round($staytopay) < 0) || (price2num($object->capital) > 0 && round($staytopay) > 0)) && $user->hasRight('loan', 'write')) {
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/loan/payment/payment.php?id='.$object->id.'&action=create&token='.newToken().'">'.$langs->trans("DoPayment").'</a></div>';
}

View File

@ -62,7 +62,7 @@ if (!$user->hasRight('loan', 'write')) {
$loan = new Loan($db);
$loan->fetch($chid);
//$line_id = 0; // TODO $line_id is never defined !!
$line_id = 0;
$echance = 0;
$amount_capital = 0;
$amount_insurance = 0;
@ -75,8 +75,8 @@ if ($res > 0) {
foreach ($ls->lines as $l) {
$echance++; // Count term pos
// last unpaid term
if (empty($l->fk_bank)) { // TODO fk_bank is never empty !
$line_id = $l->id; // TODO $line_id is never defined (fk_bank is never empty)
if (empty($l->fk_bank)) {
$line_id = $l->id;
break;
} elseif ($line_id == $l->id) {
// If line_id provided, only count temp pos
@ -86,7 +86,7 @@ if ($res > 0) {
}
// Set current line with last unpaid line (only if schedule is used)
if (!empty($line_id)) { // TODO $line_id is never defined and already empty !
if (!empty($line_id)) {
$line = new LoanSchedule($db);
$res = $line->fetch($line_id);
if ($res > 0) {