fix cancel redirects on product,warehouse cards

This commit is contained in:
Christian Foellmann 2021-09-14 08:46:07 +02:00
parent 283f37a364
commit c967c5c6d4
2 changed files with 24 additions and 1 deletions

View File

@ -201,7 +201,7 @@ if ($reshook < 0) {
}
if (empty($reshook)) {
$backurlforlist = DOL_URL_ROOT.'/product/list.php';
$backurlforlist = DOL_URL_ROOT.'/product/list.php?type='.$type;
if (empty($backtopage) || ($cancel && empty($id))) {
if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {

View File

@ -104,6 +104,29 @@ if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
if (empty($reshook)) {
$backurlforlist = DOL_URL_ROOT.'/product/stock/list.php';
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.'/product/stock/card.php?id='.((!empty($id) && $id > 0) ? $id : '__ID__');
}
}
}
if ($cancel) {
if (!empty($backtopageforcancel)) {
header("Location: ".$backtopageforcancel);
exit;
} elseif (!empty($backtopage)) {
header("Location: ".$backtopage);
exit;
}
$action = '';
}
// Ajout entrepot
if ($action == 'add' && $user->rights->stock->creer) {
$object->ref = (string) GETPOST("ref", "alpha");