Fix: bug if error

This commit is contained in:
Regis Houssin 2009-11-14 20:53:44 +00:00
parent f06aca3e9e
commit 339489587d

View File

@ -35,7 +35,7 @@ $langs->load("commercial");
$id = isset($_GET["id"])?$_GET["id"]:''; $id = isset($_GET["id"])?$_GET["id"]:'';
$origin = isset($_GET["origin"])?$_GET["origin"]:''; $origin = isset($_GET["origin"])?$_GET["origin"]:'';
$originid = isset($_GET["originid"])?$_GET["originid"]:''; $originid = isset($_GET["originid"])?$_GET["originid"]:'';
$socid = isset($_GET["socid"])?$_GET["socid"]:''; $socid = isset($_REQUEST["socid"])?$_REQUEST["socid"]:'';
if (! $socid && ($_REQUEST["action"] != 'create' && $_REQUEST["action"] != 'add' && $_REQUEST["action"] != 'update')) accessforbidden(); if (! $socid && ($_REQUEST["action"] != 'create' && $_REQUEST["action"] != 'add' && $_REQUEST["action"] != 'update')) accessforbidden();
// Security check // Security check
@ -83,13 +83,13 @@ if ($_POST["action"] == 'add' || $_POST["action"] == 'update')
} }
else else
{ {
Header("Location: adresse_livraison.php?socid=".$socid); Header("Location: adresse_livraison.php?socid=".$socid);
exit; exit;
} }
} }
else else
{ {
$mesg=$livraison->error; $mesg = $livraison->error;
$_GET["action"]='create'; $_GET["action"]='create';
} }
} }
@ -136,18 +136,18 @@ if ($_POST["action"] == 'add' || $_POST["action"] == 'update')
if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == 'yes' && $user->rights->societe->supprimer) if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == 'yes' && $user->rights->societe->supprimer)
{ {
$livraison = new AdresseLivraison($db); $livraison = new AdresseLivraison($db);
$result = $livraison->delete($_GET["id"], $socid); $result = $livraison->delete($_GET["id"], $socid);
if ($result == 0) if ($result == 0)
{ {
Header("Location: adresse_livraison.php?socid=".$socid); Header("Location: adresse_livraison.php?socid=".$socid);
exit ; exit ;
} }
else else
{ {
$reload = 0; $reload = 0;
$_GET["action"]=''; $_GET["action"]='';
} }
} }
@ -161,6 +161,7 @@ llxHeader();
$form = new Form($db); $form = new Form($db);
$countrynotdefined=$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')'; $countrynotdefined=$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')';
if (!empty($mesg)) print '<div class="error">'.$mesg.'</div>';
if ($_GET["action"] == 'create' || $_POST["action"] == 'create') if ($_GET["action"] == 'create' || $_POST["action"] == 'create')
{ {
@ -173,7 +174,7 @@ if ($_GET["action"] == 'create' || $_POST["action"] == 'create')
$livraison = new AdresseLivraison($db); $livraison = new AdresseLivraison($db);
$societe=new Societe($db); $societe=new Societe($db);
$societe->fetch($_GET["socid"]); $societe->fetch($socid);
$head = societe_prepare_head($societe); $head = societe_prepare_head($societe);
dol_fiche_head($head, 'customer', $societe->nom); dol_fiche_head($head, 'customer', $societe->nom);