diff --git a/htdocs/admin/user.php b/htdocs/admin/user.php index 83649d46a28..6d8cfe21f00 100644 --- a/htdocs/admin/user.php +++ b/htdocs/admin/user.php @@ -109,6 +109,7 @@ if ($action == 'set_default') { } } + /* * View */ diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 44a712969c1..6e89abbf953 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -66,6 +66,11 @@ $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'alpha'); $confirm = GETPOST('confirm', 'alpha'); +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'purchaseordercard'; // To manage different context of search + +$backtopage = GETPOST('backtopage', 'alpha'); +$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); + $socid = GETPOST('socid', 'int'); $projectid = GETPOST('projectid', 'int'); $cancel = GETPOST('cancel', 'alpha'); @@ -151,12 +156,16 @@ if ($reshook < 0) { } if (empty($reshook)) { - if ($cancel) { - if (!empty($backtopage)) { - header("Location: ".$backtopage); - exit; + $backurlforlist = DOL_URL_ROOT.'/fourn/commande/list.php'.($socid > 0 ? '&socid='.((int) $socid) : ''); + + if (empty($backtopage) || ($cancel && empty($id))) { + if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) { + if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) { + $backtopage = $backurlforlist; + } else { + $backtopage = DOL_URL_ROOT.'/fourn/commande/card.php?id='.($id > 0 ? $id : '__ID__'); + } } - $action = ''; } include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once @@ -1573,10 +1582,16 @@ if ($action == 'create') { print '
'; print ''; print ''; - print ''."\n"; print ''; print ''; print ''; + if ($backtopage) { + print ''; + } + if ($backtopageforcancel) { + print ''; + } + if (!empty($currency_tx)) { print ''; } @@ -1592,9 +1607,9 @@ if ($action == 'create') { print ''.$langs->trans('Supplier').''; print ''; - if ($socid > 0) { + if ($societe->id > 0) { print $societe->getNomUrl(1); - print ''; + print ''; } else { print img_picto('', 'company').$form->select_company((empty($socid) ? '' : $socid), 'socid', 's.fournisseur=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300'); // reload page to retrieve customer informations diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 25f71f85eb4..c644f9e35a5 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -892,8 +892,9 @@ if ($resql) { $massactionbutton = $form->selectMassAction('', $arrayofmassactions); $url = DOL_URL_ROOT.'/fourn/commande/card.php?action=create'; - if (!empty($socid)) { - $url .= '&socid='.$socid; + if ($socid > 0) { + $url .= '&socid='.((int) $socid); + $url .= '&backtopage='.urlencode(DOL_URL_ROOT.'/fourn/commande/list.php?socid='.((int) $socid)); } $newcardbutton = dolGetButtonTitle($langs->trans('NewSupplierOrderShort'), '', 'fa fa-plus-circle', $url, '', ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer));