Fix stay on create form if creation fails
This commit is contained in:
parent
fa6c3eff80
commit
9ba8b9bf7e
@ -310,21 +310,21 @@ if (empty($reshook))
|
|||||||
{
|
{
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ThirdPartyName")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ThirdPartyName")), null, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
$action=($action=='add'?'create':'edit');
|
|
||||||
}
|
}
|
||||||
if (GETPOST('client') < 0)
|
if (GETPOST('client') < 0)
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ProspectCustomer")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ProspectCustomer")), null, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
$action=($action=='add'?'create':'edit');
|
|
||||||
}
|
}
|
||||||
if (GETPOST('fournisseur') < 0)
|
if (GETPOST('fournisseur') < 0)
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Supplier")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Supplier")), null, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
$action=($action=='add'?'create':'edit');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($error)
|
||||||
|
{
|
||||||
if ($action == 'update')
|
if ($action == 'update')
|
||||||
{
|
{
|
||||||
$ret=$object->fetch($socid);
|
$ret=$object->fetch($socid);
|
||||||
@ -414,7 +414,6 @@ if (empty($reshook))
|
|||||||
if ($ret < 0)
|
if ($ret < 0)
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$action = ($action=='add'?'create':'edit');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GETPOST('deletephoto')) $object->logo = '';
|
if (GETPOST('deletephoto')) $object->logo = '';
|
||||||
@ -428,19 +427,16 @@ if (empty($reshook))
|
|||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages('', $langs->trans("ErrorBadEMail",$object->email), 'errors');
|
setEventMessages('', $langs->trans("ErrorBadEMail",$object->email), 'errors');
|
||||||
$action = ($action=='add'?'create':'edit');
|
|
||||||
}
|
}
|
||||||
if (! empty($object->url) && ! isValidUrl($object->url))
|
if (! empty($object->url) && ! isValidUrl($object->url))
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
setEventMessages('', $langs->trans("ErrorBadUrl",$object->url), 'errors');
|
setEventMessages('', $langs->trans("ErrorBadUrl",$object->url), 'errors');
|
||||||
$action = ($action=='add'?'create':'edit');
|
|
||||||
}
|
}
|
||||||
if ($object->fournisseur && ! $conf->fournisseur->enabled)
|
if ($object->fournisseur && ! $conf->fournisseur->enabled)
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
setEventMessages('', $langs->trans("ErrorSupplierModuleNotEnabled"), 'errors');
|
setEventMessages('', $langs->trans("ErrorSupplierModuleNotEnabled"), 'errors');
|
||||||
$action = ($action=='add'?'create':'edit');
|
|
||||||
}
|
}
|
||||||
if (! empty($object->webservices_url)) {
|
if (! empty($object->webservices_url)) {
|
||||||
//Check if has transport, without any the soap client will give error
|
//Check if has transport, without any the soap client will give error
|
||||||
@ -451,7 +447,6 @@ if (empty($reshook))
|
|||||||
if (! isValidUrl($object->webservices_url)) {
|
if (! isValidUrl($object->webservices_url)) {
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$error++; $errors[] = $langs->trans("ErrorBadUrl",$object->webservices_url);
|
$error++; $errors[] = $langs->trans("ErrorBadUrl",$object->webservices_url);
|
||||||
$action = ($action=='add'?'create':'edit');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -464,6 +459,7 @@ if (empty($reshook))
|
|||||||
$object->country=$tmparray['label'];
|
$object->country=$tmparray['label'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user