Merge pull request #8273 from fappels/7.0_fix_insert_expedition_line

Fix shipment line insert
This commit is contained in:
Laurent Destailleur 2018-03-05 20:47:03 +01:00 committed by GitHub
commit 5de43d6652
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -398,7 +398,7 @@ class Expedition extends CommonObject
if (($lineId = $expeditionline->insert()) < 0) if (($lineId = $expeditionline->insert()) < 0)
{ {
$this->error[]=$expeditionline->error; $this->errors[]=$expeditionline->error;
} }
return $lineId; return $lineId;
} }
@ -2386,9 +2386,9 @@ class ExpeditionLigne extends CommonObjectLine
$error=0; $error=0;
// Check parameters // Check parameters
if (empty($this->fk_expedition) || empty($this->fk_origin_line) || empty($this->qty)) if (empty($this->fk_expedition) || empty($this->fk_origin_line) || ! is_numeric($this->qty))
{ {
$this->errors[] = 'ErrorMandatoryParametersNotProvided'; $this->error = 'ErrorMandatoryParametersNotProvided';
return -1; return -1;
} }
// Clean parameters // Clean parameters
@ -2428,7 +2428,6 @@ class ExpeditionLigne extends CommonObjectLine
$result=$this->call_trigger('LINESHIPPING_INSERT',$user); $result=$this->call_trigger('LINESHIPPING_INSERT',$user);
if ($result < 0) if ($result < 0)
{ {
$this->errors[]=$this->error;
$error++; $error++;
} }
// End call triggers // End call triggers
@ -2444,6 +2443,7 @@ class ExpeditionLigne extends CommonObjectLine
dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR); dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
$this->error.=($this->error?', '.$errmsg:$errmsg); $this->error.=($this->error?', '.$errmsg:$errmsg);
} }
$this->db->rollback(); $this->db->rollback();
return -1*$error; return -1*$error;
} }