diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php index 8d7ab7e8ef8..b0bc197b5e0 100644 --- a/htdocs/expedition/fiche.php +++ b/htdocs/expedition/fiche.php @@ -101,12 +101,12 @@ if ($_POST["action"] == 'add') /* * Génère un bon de livraison */ -if ($_POST["action"] == 'create_delivery' && $conf->livraison->enabled && $user->rights->expedition->livraison->creer) +if ($_GET["action"] == 'create_delivery' && $conf->livraison->enabled && $user->rights->expedition->livraison->creer) { $expedition = new Expedition($db); $expedition->fetch($_GET["id"]); $result = $expedition->create_delivery($user); - Header("Location: ".DOL_URL_ROOT.'/livraison/fiche.php?id='.$result->id); + Header("Location: ".DOL_URL_ROOT.'/livraison/fiche.php?id='.$result); } if ($_POST["action"] == 'confirm_valid' && $_POST["confirm"] == 'yes' && $user->rights->expedition->valider) diff --git a/htdocs/livraison/livraison.class.php b/htdocs/livraison/livraison.class.php index 45d7f3313c0..790fb04af62 100644 --- a/htdocs/livraison/livraison.class.php +++ b/htdocs/livraison/livraison.class.php @@ -126,10 +126,13 @@ class Livraison /* * */ - $sql = "UPDATE ".MAIN_DB_PREFIX."commande SET fk_statut = 2 WHERE rowid=".$this->commande_id; - if (! $this->db->query($sql)) + if (!$conf->expedition->enabled) { + $sql = "UPDATE ".MAIN_DB_PREFIX."commande SET fk_statut = 2 WHERE rowid=".$this->commande_id; + if (! $this->db->query($sql)) + { $error++; + } } if ($error==0)