Work on payment loan

This commit is contained in:
frederic34 2015-03-29 17:53:36 +02:00
parent 7b9ba4bd26
commit b6b1617741
4 changed files with 20 additions and 6 deletions

View File

@ -33,6 +33,7 @@ $langs->load("categories");
$langs->load("compta");
$langs->load("bills");
if (! empty($conf->adherent->enabled)) $langs->load("members");
if (! empty($conf->loan->enabled)) $langs->load("loan");
$id = (GETPOST('id','int') ? GETPOST('id','int') : GETPOST('account','int'));
@ -345,6 +346,18 @@ if ($result)
print $langs->trans("SalaryPayment");
print '</a>';
}
else if ($links[$key]['type']=='payment_loan') {
print '<a href="'.DOL_URL_ROOT.'/loan/payment/card.php?id='.$links[$key]['url_id'].'">';
print img_object($langs->trans('ShowLoanPayment'),'payment').' ';
print $langs->trans("PaymentLoan");
print '</a>';
}
else if ($links[$key]['type']=='loan') {
print '<a href="'.DOL_URL_ROOT.'/loan/card.php?id='.$links[$key]['url_id'].'">';
print img_object($langs->trans('ShowLoan'),'bill').' ';
print $langs->trans("Loan");
print '</a>';
}
else if ($links[$key]['type']=='member') {
print '<a href="'.DOL_URL_ROOT.'/adherents/card.php?rowid='.$links[$key]['url_id'].'">';
print img_object($langs->trans('ShowMember'),'user').' ';

View File

@ -4,6 +4,7 @@ Loans=Loans
NewLoan=New Loan
ShowLoan=Show Loan
PaymentLoan=Loan payment
ShowLoanPayment=Show Loan Payment
Capital=Capital
Insurance=Insurance
Interest=Interest

View File

@ -391,7 +391,7 @@ class PaymentLoan extends CommonObject
* @param string $emetteur_banque Name of bank
* @return int <0 if KO, >0 if OK
*/
function addPaymentToBank($user,$mode,$label,$accountid,$emetteur_nom,$emetteur_banque)
function addPaymentToBank($user, $mode, $label, $accountid, $emetteur_nom, $emetteur_banque)
{
global $conf;
@ -448,7 +448,7 @@ class PaymentLoan extends CommonObject
//$linkaddedforthirdparty=array();
if ($mode == 'payment_loan')
{
$result=$acc->add_url_line($bank_line_id, $this->id, DOL_URL_ROOT.'/loan/card.php?id=', $this->type_libelle.(($this->label && $this->label!=$this->type_libelle)?' ('.$this->label.')':''),'loan');
$result=$acc->add_url_line($bank_line_id, $this->id, DOL_URL_ROOT.'/loan/card.php?id=', ($this->label?$this->label:''),'loan');
if ($result <= 0) dol_print_error($this->db);
}
}

View File

@ -41,6 +41,9 @@ if ($user->societe_id > 0)
$socid = $user->societe_id;
}
$loan = new Loan($db);
$loan->fetch($chid);
/*
* Actions
*/
@ -92,6 +95,7 @@ if ($action == 'add_payment')
$payment = new PaymentLoan($db);
$payment->chid = $chid;
$payment->datepaid = $datepaid;
$payment->label = $loan->label;
$payment->amount_capital = GETPOST('amount_capital');
$payment->amount_insurance = GETPOST('amount_insurance');
$payment->amount_interest = GETPOST('amount_interest');
@ -150,10 +154,6 @@ $form=new Form($db);
// Form to create loan's payment
if ($_GET["action"] == 'create')
{
$loan = new Loan($db);
$loan->fetch($chid);
$total = $loan->capital;
print_fiche_titre($langs->trans("DoPayment"));