Fix: erreur sql si pas d'entrepôt

This commit is contained in:
Regis Houssin 2006-03-07 09:54:08 +00:00
parent 73af29ffd7
commit fd8f8c63c5

View File

@ -1334,21 +1334,24 @@ class Product
if ($this->db->query($sql) ) if ($this->db->query($sql) )
{ {
$row = $this->db->fetch_row(0); $row = $this->db->fetch_row(0);
if ($row[0] > 0) if ($id_entrepot)
{ {
return $this->ajust_stock($user, $id_entrepot, $nbpiece, $mouvement); if ($row[0] > 0)
} {
else return $this->ajust_stock($user, $id_entrepot, $nbpiece, $mouvement);
{ }
return $this->create_stock($id_entrepot, $nbpiece); else
} {
return $this->create_stock($id_entrepot, $nbpiece);
}
}
} }
else else
{ {
dolibarr_print_error($this->db); dolibarr_print_error($this->db);
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} }
} }