FIX Sql error
This commit is contained in:
parent
526235d020
commit
f6305bf551
@ -4396,12 +4396,8 @@ class Societe extends CommonObject
|
|||||||
$alreadypayed=price2num($paiement + $creditnotes + $deposits,'MT');
|
$alreadypayed=price2num($paiement + $creditnotes + $deposits,'MT');
|
||||||
$remaintopay=price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits,'MT');
|
$remaintopay=price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits,'MT');
|
||||||
*/
|
*/
|
||||||
if ($mode == 'supplier') {
|
$sql = "SELECT rowid, total_ht, total_ttc, paye, type, fk_statut as status, close_code FROM ".MAIN_DB_PREFIX.$table." as f";
|
||||||
$sql = "SELECT rowid, total_ht as total_ht, total_ttc, paye, type, fk_statut as status, close_code FROM ".MAIN_DB_PREFIX.$table." as f";
|
$sql .= " WHERE fk_soc = ".((int) $this->id);
|
||||||
} else {
|
|
||||||
$sql = "SELECT rowid, total as total_ht, total_ttc, paye, fk_statut as status, close_code FROM ".MAIN_DB_PREFIX.$table." as f";
|
|
||||||
}
|
|
||||||
$sql .= " WHERE fk_soc = ".$this->id;
|
|
||||||
if (!empty($late)) {
|
if (!empty($late)) {
|
||||||
$sql .= " AND date_lim_reglement < '".$this->db->idate(dol_now())."'";
|
$sql .= " AND date_lim_reglement < '".$this->db->idate(dol_now())."'";
|
||||||
}
|
}
|
||||||
@ -4453,6 +4449,7 @@ class Societe extends CommonObject
|
|||||||
}
|
}
|
||||||
return array('opened'=>$outstandingOpened, 'total_ht'=>$outstandingTotal, 'total_ttc'=>$outstandingTotalIncTax); // 'opened' is 'incl taxes'
|
return array('opened'=>$outstandingOpened, 'total_ht'=>$outstandingTotal, 'total_ttc'=>$outstandingTotalIncTax); // 'opened' is 'incl taxes'
|
||||||
} else {
|
} else {
|
||||||
|
dol_syslog("Sql error ".$this->db->lasterror, LOG_ERR);
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -387,6 +387,35 @@ class SocieteTest extends PHPUnit\Framework\TestCase
|
|||||||
* @depends testSocieteOther
|
* @depends testSocieteOther
|
||||||
* The depends says test is run only if previous is ok
|
* The depends says test is run only if previous is ok
|
||||||
*/
|
*/
|
||||||
|
public function testGetOutstandingBills($id)
|
||||||
|
{
|
||||||
|
global $conf,$user,$langs,$db;
|
||||||
|
$conf=$this->savconf;
|
||||||
|
$user=$this->savuser;
|
||||||
|
$langs=$this->savlangs;
|
||||||
|
$db=$this->savdb;
|
||||||
|
|
||||||
|
$localobject=new Societe($this->savdb);
|
||||||
|
$localobject->fetch($id);
|
||||||
|
|
||||||
|
$result=$localobject->getOutstandingBills();
|
||||||
|
|
||||||
|
print __METHOD__." id=".$id." result=".var_export($result, true)."\n";
|
||||||
|
$this->assertLessThan($result, 0);
|
||||||
|
|
||||||
|
return $id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* testSocieteDelete
|
||||||
|
*
|
||||||
|
* @param int $id Id of company
|
||||||
|
* @return int
|
||||||
|
*
|
||||||
|
* @depends testGetOutstandingBills
|
||||||
|
* The depends says test is run only if previous is ok
|
||||||
|
*/
|
||||||
public function testSocieteDelete($id)
|
public function testSocieteDelete($id)
|
||||||
{
|
{
|
||||||
global $conf,$user,$langs,$db;
|
global $conf,$user,$langs,$db;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user