Fix phpcs
This commit is contained in:
parent
63aa7ac1ec
commit
8b0919d7e4
@ -63,7 +63,7 @@ if($last)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($line_id))
|
if (!empty($line_id))
|
||||||
@ -77,9 +77,11 @@ if (!empty($line_id))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($action == 'add_payment')
|
if ($action == 'add_payment')
|
||||||
{
|
{
|
||||||
$error=0;
|
$error=0;
|
||||||
@ -103,78 +105,77 @@ if ($action == 'add_payment')
|
|||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Date")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Date")), null, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
if (! empty($conf->banque->enabled) && ! GETPOST('accountid', 'int') > 0)
|
if (! empty($conf->banque->enabled) && ! GETPOST('accountid', 'int') > 0)
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("AccountToCredit")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("AccountToCredit")), null, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$paymentid = 0;
|
$paymentid = 0;
|
||||||
|
|
||||||
$amount = GETPOST('amount_capital') + GETPOST('amount_insurance') + GETPOST('amount_interest');
|
$amount = GETPOST('amount_capital') + GETPOST('amount_insurance') + GETPOST('amount_interest');
|
||||||
if ($amount == 0)
|
if ($amount == 0)
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans('ErrorNoPaymentDefined'), null, 'errors');
|
setEventMessages($langs->trans('ErrorNoPaymentDefined'), null, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
// Create a line of payments
|
// Create a line of payments
|
||||||
$payment = new PaymentLoan($db);
|
$payment = new PaymentLoan($db);
|
||||||
$payment->chid = $chid;
|
$payment->chid = $chid;
|
||||||
$payment->datep = $datepaid;
|
$payment->datep = $datepaid;
|
||||||
$payment->label = $loan->label;
|
$payment->label = $loan->label;
|
||||||
$payment->amount_capital = GETPOST('amount_capital');
|
$payment->amount_capital = GETPOST('amount_capital');
|
||||||
$payment->amount_insurance = GETPOST('amount_insurance');
|
$payment->amount_insurance = GETPOST('amount_insurance');
|
||||||
$payment->amount_interest = GETPOST('amount_interest');
|
$payment->amount_interest = GETPOST('amount_interest');
|
||||||
$payment->paymenttype = GETPOST('paymenttype', 'int');
|
$payment->paymenttype = GETPOST('paymenttype', 'int');
|
||||||
$payment->num_payment = GETPOST('num_payment');
|
$payment->num_payment = GETPOST('num_payment');
|
||||||
$payment->note_private = GETPOST('note_private','none');
|
$payment->note_private = GETPOST('note_private','none');
|
||||||
$payment->note_public = GETPOST('note_public','none');
|
$payment->note_public = GETPOST('note_public','none');
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$paymentid = $payment->create($user);
|
$paymentid = $payment->create($user);
|
||||||
if ($paymentid < 0)
|
if ($paymentid < 0)
|
||||||
{
|
{
|
||||||
setEventMessages($payment->error, $payment->errors, 'errors');
|
setEventMessages($payment->error, $payment->errors, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$result = $payment->addPaymentToBank($user, $chid, 'payment_loan', '(LoanPayment)', GETPOST('accountid', 'int'), '', '');
|
$result = $payment->addPaymentToBank($user, $chid, 'payment_loan', '(LoanPayment)', GETPOST('accountid', 'int'), '', '');
|
||||||
if (! $result > 0)
|
if (! $result > 0)
|
||||||
{
|
{
|
||||||
setEventMessages($payment->error, $payment->errors, 'errors');
|
setEventMessages($payment->error, $payment->errors, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
elseif(isset($line))
|
elseif(isset($line))
|
||||||
{
|
{
|
||||||
$line->fk_bank = $payment->fk_bank;
|
$line->fk_bank = $payment->fk_bank;
|
||||||
$line->update($user);
|
$line->update($user);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$db->commit();
|
$db->commit();
|
||||||
$loc = DOL_URL_ROOT.'/loan/card.php?id='.$chid;
|
$loc = DOL_URL_ROOT.'/loan/card.php?id='.$chid;
|
||||||
header('Location: '.$loc);
|
header('Location: '.$loc);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$action = 'create';
|
$action = 'create';
|
||||||
@ -274,7 +275,7 @@ if ($action == 'create')
|
|||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user