Fix error output

This commit is contained in:
Laurent Destailleur 2017-09-03 17:47:45 +02:00
parent 084ea049d8
commit 75b8462c03

View File

@ -95,6 +95,7 @@ $result = restrictedArea($user, 'societe', $socid, '&societe', '', 'fk_soc', 'ro
/* /*
* Actions * Actions
*/ */
@ -310,19 +311,19 @@ if (empty($reshook))
{ {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ThirdPartyName")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ThirdPartyName")), null, 'errors');
$error++; $error++;
$action='create'; $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='create'; $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='create'; $action=($action=='add'?'create':'edit');
} }
if ($action == 'update') if ($action == 'update')
@ -653,7 +654,7 @@ if (empty($reshook))
} }
} }
else else
{ {
switch($_FILES['photo']['error']) switch($_FILES['photo']['error'])
{ {
case 1: //uploaded file exceeds the upload_max_filesize directive in php.ini case 1: //uploaded file exceeds the upload_max_filesize directive in php.ini
@ -683,7 +684,7 @@ if (empty($reshook))
if (! $error && ! count($errors)) if (! $error && ! count($errors))
{ {
if (! empty($backtopage)) if (! empty($backtopage))
{ {
header("Location: ".$backtopage); header("Location: ".$backtopage);
exit; exit;
@ -703,7 +704,7 @@ if (empty($reshook))
} }
else else
{ {
$action='create'; $action = ($action=='add'?'create':'edit');
} }
} }
@ -756,7 +757,6 @@ if (empty($reshook))
} }
/* /*
* View * View
*/ */
@ -1356,11 +1356,12 @@ else
* Edition * Edition
*/ */
//print load_fiche_titre($langs->trans("EditCompany")); //print load_fiche_titre($langs->trans("EditCompany"));
if ($socid) if ($socid)
{ {
$res=$object->fetch_optionals($object->id,$extralabels); $res=$object->fetch_optionals($object->id,$extralabels);
//if ($res < 0) { dol_print_error($db); exit; } //if ($res < 0) { dol_print_error($db); exit; }
$head = societe_prepare_head($object); $head = societe_prepare_head($object);
@ -1466,8 +1467,6 @@ else
} }
} }
dol_htmloutput_errors($error,$errors);
if($object->localtax1_assuj==0){ if($object->localtax1_assuj==0){
$sub=0; $sub=0;
}else{$sub=1;} }else{$sub=1;}
@ -1475,7 +1474,6 @@ else
$sub2=0; $sub2=0;
}else{$sub2=1;} }else{$sub2=1;}
print "\n".'<script type="text/javascript">'; print "\n".'<script type="text/javascript">';
print '$(document).ready(function () { print '$(document).ready(function () {
var val='.$sub.'; var val='.$sub.';
@ -1942,7 +1940,7 @@ else
} }
else else
{ {
/* /*
* View * View
*/ */