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
@ -89,7 +89,7 @@ if ($_POST["action"] == 'add' || $_POST["action"] == 'update')
} }
else else
{ {
$mesg=$livraison->error; $mesg = $livraison->error;
$_GET["action"]='create'; $_GET["action"]='create';
} }
} }
@ -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);