NEW Add cancel button on thirdparty create page

This commit is contained in:
Laurent Destailleur 2015-09-29 14:31:55 +02:00
parent 60c6510fc1
commit 1851310bbe

View File

@ -56,6 +56,7 @@ if (! empty($conf->notification->enabled)) $langs->load("mails");
$mesg=''; $error=0; $errors=array(); $mesg=''; $error=0; $errors=array();
$action = (GETPOST('action') ? GETPOST('action') : 'view'); $action = (GETPOST('action') ? GETPOST('action') : 'view');
$cancel = GETPOST('cancel');
$backtopage = GETPOST('backtopage','alpha'); $backtopage = GETPOST('backtopage','alpha');
$confirm = GETPOST('confirm'); $confirm = GETPOST('confirm');
$socid = GETPOST('socid','int'); $socid = GETPOST('socid','int');
@ -98,6 +99,16 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
if (empty($reshook)) if (empty($reshook))
{ {
if ($cancel)
{
$action='';
if (! empty($backtopage))
{
header("Location: ".$backtopage);
exit;
}
}
if ($action == 'confirm_merge' && $confirm == 'yes') if ($action == 'confirm_merge' && $confirm == 'yes')
{ {
$object->fetch($socid); $object->fetch($socid);
@ -1273,7 +1284,12 @@ else
dol_fiche_end(); dol_fiche_end();
print '<div class="center">'; print '<div class="center">';
print '<input type="submit" class="button" value="'.$langs->trans('AddThirdParty').'">'; print '<input type="submit" class="button" name="submit" value="'.$langs->trans('AddThirdParty').'">';
if ($backtopage)
{
print ' &nbsp; ';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans('Cancel').'">';
}
print '</div>'."\n"; print '</div>'."\n";
print '</form>'."\n"; print '</form>'."\n";