From b6b161774122623c73645d38d584027f6b395f11 Mon Sep 17 00:00:00 2001 From: frederic34 Date: Sun, 29 Mar 2015 17:53:36 +0200 Subject: [PATCH] Work on payment loan --- htdocs/compta/bank/ligne.php | 13 +++++++++++++ htdocs/langs/en_US/loan.lang | 1 + htdocs/loan/class/paymentloan.class.php | 4 ++-- htdocs/loan/payment/payment.php | 8 ++++---- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/bank/ligne.php b/htdocs/compta/bank/ligne.php index ac9fa10ff12..978681d348b 100644 --- a/htdocs/compta/bank/ligne.php +++ b/htdocs/compta/bank/ligne.php @@ -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 ''; } + else if ($links[$key]['type']=='payment_loan') { + print ''; + print img_object($langs->trans('ShowLoanPayment'),'payment').' '; + print $langs->trans("PaymentLoan"); + print ''; + } + else if ($links[$key]['type']=='loan') { + print ''; + print img_object($langs->trans('ShowLoan'),'bill').' '; + print $langs->trans("Loan"); + print ''; + } else if ($links[$key]['type']=='member') { print ''; print img_object($langs->trans('ShowMember'),'user').' '; diff --git a/htdocs/langs/en_US/loan.lang b/htdocs/langs/en_US/loan.lang index 4aba2de625c..e082f166959 100644 --- a/htdocs/langs/en_US/loan.lang +++ b/htdocs/langs/en_US/loan.lang @@ -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 diff --git a/htdocs/loan/class/paymentloan.class.php b/htdocs/loan/class/paymentloan.class.php index 5c24621d802..51961e37e6e 100644 --- a/htdocs/loan/class/paymentloan.class.php +++ b/htdocs/loan/class/paymentloan.class.php @@ -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); } } diff --git a/htdocs/loan/payment/payment.php b/htdocs/loan/payment/payment.php index ece4a5e0271..32e6ed57d2d 100644 --- a/htdocs/loan/payment/payment.php +++ b/htdocs/loan/payment/payment.php @@ -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"));