Skip to content

Commit

Permalink
Fix 0 is also a valid Qty
Browse files Browse the repository at this point in the history
Fix error handling
  • Loading branch information
fappels committed Mar 4, 2018
1 parent 7262f89 commit 1a7c09b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions htdocs/expedition/class/expedition.class.php
Expand Up @@ -398,7 +398,7 @@ function create_line($entrepot_id, $origin_line_id, $qty,$array_options=0)

if (($lineId = $expeditionline->insert()) < 0)
{
$this->error[]=$expeditionline->error;
$this->errors[]=$expeditionline->error;
}
return $lineId;
}
Expand Down Expand Up @@ -2386,9 +2386,9 @@ function insert($user=null, $notrigger=0)
$error=0;

// 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;
}
// Clean parameters
Expand Down Expand Up @@ -2418,6 +2418,7 @@ function insert($user=null, $notrigger=0)
$result=$this->insertExtraFields();
if ($result < 0)
{
$this->errors[]=$this->error;
$error++;
}
}
Expand Down

0 comments on commit 1a7c09b

Please sign in to comment.