Fix deletion of shipment when there is batch record
This commit is contained in:
parent
77247ec43a
commit
724badb522
@ -1455,11 +1455,9 @@ class Expedition extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
// delete batch expedition line
|
||||
if (!$error && $conf->productbatch->enabled)
|
||||
{
|
||||
if (ExpeditionLineBatch::deletefromexp($this->db, $this->id) < 0)
|
||||
{
|
||||
// delete batch expedition line (we try deletion even if module not enabled in case of the module were enabled and disabled previously)
|
||||
if (!$error) {
|
||||
if (ExpeditionLineBatch::deletefromexp($this->db, $this->id) < 0) {
|
||||
$error++; $this->errors[] = "Error ".$this->db->lasterror();
|
||||
}
|
||||
}
|
||||
|
||||
@ -153,10 +153,8 @@ class ExpeditionLineBatch extends CommonObject
|
||||
*/
|
||||
public static function deletefromexp($db, $id_expedition)
|
||||
{
|
||||
$id_expedition = (int) $id_expedition;
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX.self::$_table_element;
|
||||
$sql .= " WHERE fk_expeditiondet in (SELECT rowid FROM ".MAIN_DB_PREFIX."expeditiondet WHERE fk_expedition=".$id_expedition.")";
|
||||
$sql .= " WHERE fk_expeditiondet in (SELECT rowid FROM ".MAIN_DB_PREFIX."expeditiondet WHERE fk_expedition=".((int) $id_expedition).")";
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
if ($db->query($sql))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user