forked from Wavyzz/dolibarr
Try to fix error on pgsql
This commit is contained in:
@@ -229,7 +229,11 @@ class ExpenseReport extends CommonObject
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element." SET ref='".$this->db->escape($this->ref)."' WHERE rowid=".$this->id;
|
||||
$resql=$this->db->query($sql);
|
||||
if (!$resql) $error++;
|
||||
if (!$resql)
|
||||
{
|
||||
$this->error = $this->db->lasterror();
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (is_array($this->lines) && count($this->lines)>0)
|
||||
{
|
||||
@@ -238,7 +242,7 @@ class ExpenseReport extends CommonObject
|
||||
$newndfline=new ExpenseReportLine($this->db);
|
||||
$newndfline=$this->lines[$i];
|
||||
$newndfline->fk_expensereport=$this->id;
|
||||
if ($result >= 0)
|
||||
if (! $error)
|
||||
{
|
||||
$result=$newndfline->insert();
|
||||
}
|
||||
@@ -2560,7 +2564,7 @@ class ExpenseReportLine
|
||||
*/
|
||||
public function insert($notrigger = 0, $fromaddline = false)
|
||||
{
|
||||
global $langs,$user,$conf;
|
||||
global $langs, $user, $conf;
|
||||
|
||||
$error=0;
|
||||
|
||||
|
||||
@@ -136,7 +136,7 @@ class ExpenseReportTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
// Create supplier order with a too low quantity
|
||||
$localobject=new ExpenseReport($db);
|
||||
$localobject->initAsSpecimen(); // Init a speciment with lines
|
||||
$localobject->initAsSpecimen(); // Init a specimen with lines
|
||||
$localobject->status = 0;
|
||||
$localobject->fk_statut = 0;
|
||||
$localobject->date_fin = null; // Force bad value
|
||||
@@ -150,13 +150,13 @@ class ExpenseReportTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
// Create supplier order
|
||||
$localobject2=new ExpenseReport($db);
|
||||
$localobject2->initAsSpecimen(); // Init a speciment with lines
|
||||
$localobject2->initAsSpecimen(); // Init a specimen with lines
|
||||
$localobject2->status = 0;
|
||||
$localobject2->fk_statut = 0;
|
||||
|
||||
$result=$localobject2->create($user);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertGreaterThanOrEqual(0, $result);
|
||||
$this->assertGreaterThanOrEqual(0, $result, "Error: ".$localobject2->error);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user