From e9cb5e8da7f16a25cb9d1cfcade62bec1992ea2e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 8 May 2009 15:30:47 +0000 Subject: [PATCH] Fix: Cancel button was broken --- htdocs/soc.php | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/htdocs/soc.php b/htdocs/soc.php index 0eadd668c37..cb4fed84cbc 100644 --- a/htdocs/soc.php +++ b/htdocs/soc.php @@ -124,17 +124,20 @@ if ((! $_POST["getcustomercode"] && ! $_POST["getsuppliercode"]) $soc->commercial_id = $_POST["commercial_id"]; // Check parameters - if (! empty($soc->email) && ! isValidEMail($soc->email)) + if (empty($_POST["cancel"])) { - $error = 1; - $soc->error = $langs->trans("ErrorBadEMail",$soc->email); - $_GET["action"]= $_POST["action"]=='add'?'add':'edit'; - } - if ($soc->fournisseur && ! $conf->fournisseur->enabled) - { - $error = 1; - $soc->error = $langs->trans("ErrorSupplierModuleNotEnabled"); - $_GET["action"]= $_POST["action"]=='add'?'add':'edit'; + if (! empty($soc->email) && ! isValidEMail($soc->email)) + { + $error = 1; + $soc->error = $langs->trans("ErrorBadEMail",$soc->email); + $_GET["action"]= $_POST["action"]=='add'?'add':'edit'; + } + if ($soc->fournisseur && ! $conf->fournisseur->enabled) + { + $error = 1; + $soc->error = $langs->trans("ErrorSupplierModuleNotEnabled"); + $_GET["action"]= $_POST["action"]=='add'?'add':'edit'; + } } if (! $error)