From 4c0b083f45c14cc88a84c39f97d4f64a9c14233e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 31 Aug 2018 22:11:52 +0200 Subject: [PATCH] function Comment Missing --- htdocs/loan/class/loanschedule.class.php | 67 +++++++++++++----------- 1 file changed, 36 insertions(+), 31 deletions(-) diff --git a/htdocs/loan/class/loanschedule.class.php b/htdocs/loan/class/loanschedule.class.php index 326f5df2e9b..e2fd9937e78 100644 --- a/htdocs/loan/class/loanschedule.class.php +++ b/htdocs/loan/class/loanschedule.class.php @@ -190,37 +190,35 @@ class LoanSchedule extends CommonObject dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); - if ($resql) - { - if ($this->db->num_rows($resql)) - { - $obj = $this->db->fetch_object($resql); + if ($resql) { + if ($this->db->num_rows($resql)) { + $obj = $this->db->fetch_object($resql); - $this->id = $obj->rowid; - $this->ref = $obj->rowid; + $this->id = $obj->rowid; + $this->ref = $obj->rowid; - $this->fk_loan = $obj->fk_loan; - $this->datec = $this->db->jdate($obj->datec); - $this->tms = $this->db->jdate($obj->tms); - $this->datep = $this->db->jdate($obj->datep); - $this->amount_capital = $obj->amount_capital; - $this->amount_insurance = $obj->amount_insurance; - $this->amount_interest = $obj->amount_interest; - $this->fk_typepayment = $obj->fk_typepayment; - $this->num_payment = $obj->num_payment; - $this->note_private = $obj->note_private; - $this->note_public = $obj->note_public; - $this->fk_bank = $obj->fk_bank; - $this->fk_user_creat = $obj->fk_user_creat; - $this->fk_user_modif = $obj->fk_user_modif; + $this->fk_loan = $obj->fk_loan; + $this->datec = $this->db->jdate($obj->datec); + $this->tms = $this->db->jdate($obj->tms); + $this->datep = $this->db->jdate($obj->datep); + $this->amount_capital = $obj->amount_capital; + $this->amount_insurance = $obj->amount_insurance; + $this->amount_interest = $obj->amount_interest; + $this->fk_typepayment = $obj->fk_typepayment; + $this->num_payment = $obj->num_payment; + $this->note_private = $obj->note_private; + $this->note_public = $obj->note_public; + $this->fk_bank = $obj->fk_bank; + $this->fk_user_creat = $obj->fk_user_creat; + $this->fk_user_modif = $obj->fk_user_modif; - $this->type_code = $obj->type_code; - $this->type_libelle = $obj->type_libelle; + $this->type_code = $obj->type_code; + $this->type_libelle = $obj->type_libelle; - $this->bank_account = $obj->fk_account; - $this->bank_line = $obj->fk_bank; - } - $this->db->free($resql); + $this->bank_account = $obj->fk_account; + $this->bank_line = $obj->fk_bank; + } + $this->db->free($resql); return 1; } @@ -374,13 +372,20 @@ class LoanSchedule extends CommonObject } } - function calc_mens($capital,$rate,$nbterm) + /** + * Calculate mensuality + * + * @param double $capital Capital + * @param double $rate rate + * @param int $nbterm nb term + * @return double mensuality + */ + function calc_mens($capital, $rate, $nbterm) { $result=''; - if (!empty($capital)&&!empty($rate)&&!empty($nbterm)) - { - $result=($capital*($rate/12))/(1-pow((1+($rate/12)),($nbterm*-1))); + if (!empty($capital) && !empty($rate) && !empty($nbterm)) { + $result = ($capital*($rate/12))/(1-pow((1+($rate/12)),($nbterm*-1))); } return $result;