diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index b7b92eb997d6a..8231cc3b7636e 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3143,6 +3143,12 @@ function delete($user, $notrigger=0) // End call triggers } + if ($this->nb_expedition() != 0) + { + $this->errors[] = $langs->trans('SomeShipmentExists'); + $error++; + } + if (! $error) { // Delete order details diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 7a16015fff7b6..090afd3e93548 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -74,7 +74,9 @@ // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('thirdpartycard','globalcard')); -if ($action == 'view' && $object->fetch($socid)<=0) +if ($socid > 0) $object->fetch($socid); + +if (! ($object->id > 0) && $action == 'view') { $langs->load("errors"); print($langs->trans('ErrorRecordNotFound')); @@ -118,8 +120,6 @@ if ($action == 'confirm_merge' && $confirm == 'yes' && $user->rights->societe->creer) { - $object->fetch($socid); - $error = 0; $soc_origin_id = GETPOST('soc_origin', 'int'); $soc_origin = new Societe($db);