Merge pull request #3886 from GPCsolutions/dolibarr-3805
Fix #3805 Enhanced Facture::is_last_in_cycle()
This commit is contained in:
commit
14ec86047f
@ -3672,11 +3672,16 @@ class Facture extends CommonInvoice
|
||||
/**
|
||||
* Checks if the invoice is the last in its cycle
|
||||
*
|
||||
* @return int 0 or 1 if OK, -1 if error
|
||||
* @return bool Last of the cycle status
|
||||
*
|
||||
*/
|
||||
function is_last_in_cycle()
|
||||
{
|
||||
if (empty($this->situation_cycle_ref)) {
|
||||
// No point in testing anything if we're not inside a cycle
|
||||
return false;
|
||||
}
|
||||
|
||||
$sql = 'SELECT max(situation_counter) FROM ' . MAIN_DB_PREFIX . 'facture WHERE situation_cycle_ref = ' . $this->situation_cycle_ref;
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
@ -3687,8 +3692,7 @@ class Facture extends CommonInvoice
|
||||
} else {
|
||||
$this->error = $this->db->lasterror();
|
||||
dol_syslog(get_class($this) . "::select Error " . $this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user