diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 2350c570fbb..2a20981a423 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -1490,7 +1490,7 @@ class Expedition extends CommonObject // Add a protection to refuse deleting if shipment has at least one delivery $this->fetchObjectLinked($this->id, 'shipping', 0, 'delivery'); // Get deliveries linked to this shipment - if (count($this->linkedObjectsIds) > 0) { + if (isset($this->linkedObjectsIds['delivery']) && count($this->linkedObjectsIds['delivery']) > 0) { $this->error = 'ErrorThereIsSomeDeliveries'; $error++; } @@ -1700,7 +1700,7 @@ class Expedition extends CommonObject // Add a protection to refuse deleting if shipment has at least one delivery $this->fetchObjectLinked($this->id, 'shipping', 0, 'delivery'); // Get deliveries linked to this shipment - if (count($this->linkedObjectsIds) > 0) { + if (isset($this->linkedObjectsIds['delivery']) && count($this->linkedObjectsIds['delivery']) > 0) { $this->error = 'ErrorThereIsSomeDeliveries'; $error++; }