From 0b08db16a10aa4e178b412dc56f80c5b346b34e1 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Thu, 13 Oct 2016 06:31:09 +0200 Subject: [PATCH 1/8] Fix: Missing language key --- htdocs/langs/en_US/main.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 150abc1b4b8..c61cc235b25 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -505,6 +505,7 @@ ReportPeriod=Report period ReportDescription=Description Report=Report Keyword=Keyword +Origin=Origin Legend=Legend Fill=Fill Reset=Reset From 63a7b506b1991e4c8f4f03eb4770912d4f217706 Mon Sep 17 00:00:00 2001 From: Sergio Sanchis Date: Fri, 14 Oct 2016 10:55:54 +0200 Subject: [PATCH 2/8] Fix: Error if exist extrafield --- htdocs/compta/facture/list.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 796b0730c89..ce2843837df 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -767,6 +767,11 @@ if (! $sall) $sql.= ' f.datec, f.tms,'; $sql.= ' s.rowid, s.nom, s.town, s.zip, s.fk_pays, s.code_client, s.client, typent.code'; $sql.= ' ,state.code_departement, state.nom'; + + foreach ($extrafields->attribute_label as $key => $val) //prevent error with sql_mode=only_full_group_by + { + $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key : ''); + } } else { From 49e2b1ffdb215d22cff7e3e1a1e2e508b5c9edb2 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sat, 15 Oct 2016 06:56:38 +0200 Subject: [PATCH 3/8] Fix: Error with language key --- htdocs/langs/en_US/loan.lang | 2 +- htdocs/loan/payment/card.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/loan.lang b/htdocs/langs/en_US/loan.lang index de0d5a0525f..37832bc94d1 100644 --- a/htdocs/langs/en_US/loan.lang +++ b/htdocs/langs/en_US/loan.lang @@ -3,7 +3,7 @@ Loan=Loan Loans=Loans NewLoan=New Loan ShowLoan=Show Loan -PaymentLoan=Loan payment +LoanPayment=Loan payment ShowLoanPayment=Show Loan Payment LoanCapital=Capital Insurance=Insurance diff --git a/htdocs/loan/payment/card.php b/htdocs/loan/payment/card.php index 9c1e938c3ed..342bfd04a7a 100644 --- a/htdocs/loan/payment/card.php +++ b/htdocs/loan/payment/card.php @@ -125,7 +125,7 @@ $head[$h][1] = $langs->trans("Card"); $hselected = $h; $h++; -dol_fiche_head($head, $hselected, $langs->trans("PaymentLoan"), 0, 'payment'); +dol_fiche_head($head, $hselected, $langs->trans("LoanPayment"), 0, 'payment'); /* * Confirm deletion of the payment From 380ab8bfa55d6b4291c721229d0496ca6c23db7a Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sat, 15 Oct 2016 07:05:53 +0200 Subject: [PATCH 4/8] Fix: Show Ref/rowid of loan --- htdocs/compta/bank/account.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php index 10c52e657ab..99f7a224a3e 100644 --- a/htdocs/compta/bank/account.php +++ b/htdocs/compta/bank/account.php @@ -833,7 +833,7 @@ if ($id > 0 || ! empty($ref)) { $loanstatic->label=$links[$key]['label']; } - $loanstatic->ref=$loanstatic->label; + $loanstatic->ref=$links[$key]['url_id']; print $loanstatic->getLinkUrl(1,16); } else if ($links[$key]['type']=='member') From 1beaf003f055aec5427c8303e4ee90734fe45e26 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sat, 15 Oct 2016 07:45:10 +0200 Subject: [PATCH 5/8] Fix #5875: Links to loans are incorrect in the bank account transactions tab --- htdocs/loan/class/paymentloan.class.php | 10 +++++----- htdocs/loan/payment/payment.php | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/loan/class/paymentloan.class.php b/htdocs/loan/class/paymentloan.class.php index 09c3e0b4fbc..5a0ad6b14fd 100644 --- a/htdocs/loan/class/paymentloan.class.php +++ b/htdocs/loan/class/paymentloan.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2014-2016 Alexandre Spangaro * Copyright (C) 2015 Frederic France * * This program is free software; you can redistribute it and/or modify @@ -385,6 +385,7 @@ class PaymentLoan extends CommonObject * All payment properties must have been set first like after a call to create(). * * @param User $user Object of user making payment + * @param int $fk_loan Id of fk_loan to do link with this payment * @param string $mode 'payment_loan' * @param string $label Label to use in bank record * @param int $accountid Id of bank account to do link with @@ -392,7 +393,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, $fk_loan, $mode, $label, $accountid, $emetteur_nom, $emetteur_banque) { global $conf; @@ -445,11 +446,10 @@ class PaymentLoan extends CommonObject } } - // Add link 'company' in bank_url between invoice and bank transaction (for each invoice concerned by payment) - //$linkaddedforthirdparty=array(); + // Add link 'loan' in bank_url between invoice and bank transaction (for each invoice concerned by payment) if ($mode == 'payment_loan') { - $result=$acc->add_url_line($bank_line_id, $this->id, DOL_URL_ROOT.'/loan/card.php?id=', ($this->label?$this->label:''),'loan'); + $result=$acc->add_url_line($bank_line_id, $fk_loan, 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 91c71e95e5a..f01eae369be 100644 --- a/htdocs/loan/payment/payment.php +++ b/htdocs/loan/payment/payment.php @@ -116,7 +116,7 @@ if ($action == 'add_payment') if (! $error) { - $result = $payment->addPaymentToBank($user, 'payment_loan', '(LoanPayment)', GETPOST('accountid', 'int'), '', ''); + $result = $payment->addPaymentToBank($user, $chid, 'payment_loan', '(LoanPayment)', GETPOST('accountid', 'int'), '', ''); if (! $result > 0) { setEventMessages($payment->error, $payment->errors, 'errors'); From 25ba5074a7648605181d88f22cdded5d46351fe6 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sat, 15 Oct 2016 08:00:31 +0200 Subject: [PATCH 6/8] Fix: Problem of presentation --- htdocs/loan/card.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php index 63b62a3d156..0894447d485 100644 --- a/htdocs/loan/card.php +++ b/htdocs/loan/card.php @@ -491,7 +491,6 @@ if ($id > 0) print ''.$langs->trans("Insurance").''; print ''.$langs->trans("Interest").''; print ''.$langs->trans("LoanCapital").''; - print ' '; print ''; $var=True; From df581d89739cbf6793fbcb16b6eed946ac6baeb7 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sat, 15 Oct 2016 08:07:01 +0200 Subject: [PATCH 7/8] Fix: In payment card, only the capital is considered as a payment, interest and insurance are tax --- htdocs/loan/payment/payment.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/loan/payment/payment.php b/htdocs/loan/payment/payment.php index f01eae369be..ead01e9c6d7 100644 --- a/htdocs/loan/payment/payment.php +++ b/htdocs/loan/payment/payment.php @@ -175,7 +175,7 @@ if ($action == 'create') print ''.$langs->trans("Label").''.$loan->label."\n"; print ''.$langs->trans("Amount").''.price($loan->capital,0,$outputlangs,1,-1,-1,$conf->currency).''; - $sql = "SELECT SUM(amount_capital + amount_insurance + amount_interest) as total"; + $sql = "SELECT SUM(amount_capital) as total"; $sql.= " FROM ".MAIN_DB_PREFIX."payment_loan"; $sql.= " WHERE fk_loan = ".$chid; $resql = $db->query($sql); From 9ab0bfe905708775e182d68ff1cd492bd2f015bb Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sun, 16 Oct 2016 06:50:13 +0200 Subject: [PATCH 8/8] Fix: Add another key for bank rather than to modify one --- htdocs/langs/en_US/loan.lang | 1 + htdocs/loan/payment/card.php | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/loan.lang b/htdocs/langs/en_US/loan.lang index 37832bc94d1..8c70dfc6fd2 100644 --- a/htdocs/langs/en_US/loan.lang +++ b/htdocs/langs/en_US/loan.lang @@ -3,6 +3,7 @@ Loan=Loan Loans=Loans NewLoan=New Loan ShowLoan=Show Loan +PaymentLoan=Loan payment LoanPayment=Loan payment ShowLoanPayment=Show Loan Payment LoanCapital=Capital diff --git a/htdocs/loan/payment/card.php b/htdocs/loan/payment/card.php index 342bfd04a7a..cd98bb75b5b 100644 --- a/htdocs/loan/payment/card.php +++ b/htdocs/loan/payment/card.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2014-2016 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -125,7 +125,7 @@ $head[$h][1] = $langs->trans("Card"); $hselected = $h; $h++; -dol_fiche_head($head, $hselected, $langs->trans("LoanPayment"), 0, 'payment'); +dol_fiche_head($head, $hselected, $langs->trans("PaymentLoan"), 0, 'payment'); /* * Confirm deletion of the payment