clean loan code

This commit is contained in:
Frédéric FRANCE 2018-10-15 20:40:59 +02:00
parent 7ea4f7ea0b
commit 2e6f0d3d19
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1

View File

@ -513,7 +513,7 @@ class LoanSchedule extends CommonObject
if($resql){ if($resql){
while($obj = $this->db->fetch_object($resql)){ while($obj = $this->db->fetch_object($resql)){
$lastrecorded = $this->lastpaiment($obj->rowid); $lastrecorded = $this->lastPayment($obj->rowid);
$toinsert = $this->paimenttorecord($obj->rowid, $lastrecorded); $toinsert = $this->paimenttorecord($obj->rowid, $lastrecorded);
if(count($toinsert)>0){ if(count($toinsert)>0){
foreach ($toinsert as $echid){ foreach ($toinsert as $echid){
@ -535,12 +535,12 @@ class LoanSchedule extends CommonObject
/** /**
* transPayment * lastpayment
* *
* @param int $loanid Loan id * @param int $loanid Loan id
* @return int < 0 if KO, Date > 0 if OK * @return int < 0 if KO, Date > 0 if OK
*/ */
public function lastpaiment($loanid) private function lastPayment($loanid)
{ {
$sql = "SELECT p.datep"; $sql = "SELECT p.datep";
$sql.= " FROM ".MAIN_DB_PREFIX."payment_loan as p "; $sql.= " FROM ".MAIN_DB_PREFIX."payment_loan as p ";