diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php
index 88bf17d5e57..ef1022da306 100644
--- a/htdocs/loan/card.php
+++ b/htdocs/loan/card.php
@@ -405,6 +405,39 @@ if ($id > 0)
// Note Public
print '
| '.$langs->trans('NotePublic').' | '.nl2br($object->note_public).' |
';
+ // Accountancy account capital
+ print '| ';
+ print $langs->trans("LoanAccountancyCapitalCode");
+ print ' | ';
+ if (! empty($conf->accounting->enabled)) {
+ print length_accountg($object->account_capital);
+ } else {
+ print $object->account_capital;
+ }
+ print ' |
';
+
+ // Accountancy account insurance
+ print '| ';
+ print $langs->trans("LoanAccountancyInsuranceCode");
+ print ' | ';
+ if (! empty($conf->accounting->enabled)) {
+ print length_accountg($object->account_insurance);
+ } else {
+ print $object->account_insurance;
+ }
+ print ' |
';
+
+ // Accountancy account interest
+ print '| ';
+ print $langs->trans("LoanAccountancyInterestCode");
+ print ' | ';
+ if (! empty($conf->accounting->enabled)) {
+ print length_accountg($object->account_interest);
+ } else {
+ print $object->account_interest;
+ }
+ print ' |
';
+
// Status
print '| '.$langs->trans("Status").' | '.$object->getLibStatut(4, $totalpaye).' |
';
diff --git a/htdocs/loan/class/loan.class.php b/htdocs/loan/class/loan.class.php
index 66809b60720..60d4050148a 100644
--- a/htdocs/loan/class/loan.class.php
+++ b/htdocs/loan/class/loan.class.php
@@ -72,7 +72,7 @@ class Loan extends CommonObject
function fetch($id)
{
$sql = "SELECT l.rowid, l.label, l.capital, l.datestart, l.dateend, l.nbterm, l.rate, l.note_private, l.note_public,";
- $sql.= " l.paid";
+ $sql.= " l.paid, l.accountancy_account_capital, l.accountancy_account_insurance, l.accountancy_account_interest";
$sql.= " FROM ".MAIN_DB_PREFIX."loan as l";
$sql.= " WHERE l.rowid = ".$id;
@@ -84,17 +84,22 @@ class Loan extends CommonObject
{
$obj = $this->db->fetch_object($resql);
- $this->id = $obj->rowid;
- $this->ref = $obj->rowid;
- $this->datestart = $this->db->jdate($obj->datestart);
- $this->dateend = $this->db->jdate($obj->dateend);
- $this->label = $obj->label;
- $this->capital = $obj->capital;
- $this->nbterm = $obj->nbterm;
- $this->rate = $obj->rate;
- $this->note_private = $obj->note_private;
- $this->note_public = $obj->note_public;
- $this->paid = $obj->paid;
+ $this->id = $obj->rowid;
+ $this->ref = $obj->rowid;
+ $this->datestart = $this->db->jdate($obj->datestart);
+ $this->dateend = $this->db->jdate($obj->dateend);
+ $this->label = $obj->label;
+ $this->capital = $obj->capital;
+ $this->nbterm = $obj->nbterm;
+ $this->rate = $obj->rate;
+ $this->note_private = $obj->note_private;
+ $this->note_public = $obj->note_public;
+ $this->paid = $obj->paid;
+
+ $this->account_capital = $obj->accountancy_account_capital;
+ $this->account_insurance = $obj->accountancy_account_insurance;
+ $this->account_interest = $obj->accountancy_account_interest;
+
return 1;
}