diff --git a/htdocs/comm/adresse_livraison.php b/htdocs/comm/adresse_livraison.php index a3688ded340..16aec42a13c 100644 --- a/htdocs/comm/adresse_livraison.php +++ b/htdocs/comm/adresse_livraison.php @@ -122,11 +122,23 @@ if ($_POST["action"] == 'add' || $_POST["action"] == 'update') if ($_POST["action"] == 'update') { + $socid = $_POST["socid"]; + $origin = $_POST["origin"]; + $orignid = $_POST["originid"]; $result = $livraison->update($_POST["idl"], $socid, $user); + if ($result >= 0) { + if ($origin == commande) + { + Header("Location: ../commande/fiche.php?&id=".$originid); + exit; + } + else + { Header("Location: adresse_livraison.php?socid=".$socid); exit; + } } else { diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 1d5c06ac180..10f1bcbc129 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -738,17 +738,13 @@ else print ''; print ''; - //permet de revenir à la fiche commande une fois l'adresse de livraison modifiée - $origin = commande; - $originid = $commande->id; - if ($_GET['action'] == 'editdelivery_adress') { $html->form_adresse_livraison($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->adresse_livraison_id,$_GET['socid'],'adresse_livraison_id','commande',$commande->id); } else { - $html->form_adresse_livraison($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->adresse_livraison_id,$_GET['socid'],'none','',''); + $html->form_adresse_livraison($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->adresse_livraison_id,$_GET['socid'],'none','commande',$commande->id); } print ''; diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php index 5680c2c027f..0f42e08bfc6 100644 --- a/htdocs/html.form.class.php +++ b/htdocs/html.form.class.php @@ -1585,9 +1585,9 @@ class Form * \param selected Id condition présélectionnée * \param htmlname Nom du formulaire select * \param origin origine de l'appel pour pouvoir créer un retour - * \param id id de l'origine + * \param originid id de l'origine */ - function form_adresse_livraison($page, $selected='', $socid, $htmlname='adresse_livraison_id', $origin='', $id) + function form_adresse_livraison($page, $selected='', $socid, $htmlname='adresse_livraison_id', $origin='', $originid='') { global $langs,$conf; if ($htmlname != "none") @@ -1603,7 +1603,7 @@ class Form if ($numaddress==0) { $langs->load("companies"); - print '   '.$langs->trans("AddAddress").''; + print '   '.$langs->trans("AddAddress").''; } print ''; }