diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index cb3c908138b..b8a17e35c5e 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -461,10 +461,9 @@ if (empty($reshook)) } } } - + elseif ($action == 'confirm_cancel' && $confirm == 'yes' && $user->rights->expedition->supprimer) { - $also_update_stock = (GETPOST('alsoUpdateStock', 'alpha') ? 1 : 0); $result = $object->cancel(0, $also_update_stock); if ($result > 0) @@ -475,9 +474,8 @@ if (empty($reshook)) { setEventMessages($object->error, $object->errors, 'errors'); } - } - + elseif ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->expedition->supprimer) { $also_update_stock = (GETPOST('alsoUpdateStock', 'alpha') ? 1 : 0); @@ -2592,15 +2590,15 @@ elseif ($id || $ref) } } - // Cancel + // Cancel if ($object->statut == Expedition::STATUS_VALIDATED) - { + { if ($user->rights->expedition->supprimer) { print ''.$langs->trans("Cancel").''; } } - + // Delete if ($user->rights->expedition->supprimer) { diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 92d2d146d58..1db01a61820 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -180,7 +180,7 @@ class Expedition extends CommonObject * Canceled status */ const STATUS_CANCELED = -1; - + /** * Constructor @@ -1170,7 +1170,7 @@ class Expedition extends CommonObject } } - + /** * Cancel shipment. * @@ -1291,7 +1291,7 @@ class Expedition extends CommonObject } } - + if (!$error) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."expeditiondet"; @@ -1388,9 +1388,8 @@ class Expedition extends CommonObject $this->db->rollback(); return -1; } - } - + /** * Delete shipment. * Warning, do not delete a shipment if a delivery is linked to (with table llx_element_element)