Fix cancel button

This commit is contained in:
Laurent Destailleur 2021-09-01 20:10:56 +02:00
parent c38161374d
commit c207dde5e1
4 changed files with 45 additions and 7 deletions

View File

@ -111,10 +111,27 @@ if ($reshook < 0) {
}
if (empty($reshook)) {
// Cancel
if (GETPOST('cancel', 'alpha') && !empty($backtopage)) {
header("Location: ".$backtopage);
exit;
$backurlforlist = DOL_URL_ROOT.'/contact/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.'/contact/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 = '';
}
// Creation utilisateur depuis contact

View File

@ -123,8 +123,6 @@ ConferenceIsNotConfirmed=Subcription not available, conference is not confirmed
DateMustBeBeforeThan=%s must be before %s
DateMustBeAfterThan=%s must be after %s
NewSubscription=Registration
#
# Vote page
#

View File

@ -68,7 +68,7 @@ DeleteAMemberType=Delete a member type
ConfirmDeleteMemberType=Are you sure you want to delete this member type?
MemberTypeDeleted=Member type deleted
MemberTypeCanNotBeDeleted=Member type can not be deleted
NewSubscription=New subscription
NewSubscription=New contribution
NewSubscriptionDesc=This form allows you to record your subscription as a new member of the foundation. If you want to renew your subscription (if already a member), please contact foundation board instead by email %s.
Subscription=Contribution
Subscriptions=Contributions

View File

@ -201,6 +201,29 @@ if ($reshook < 0) {
}
if (empty($reshook)) {
$backurlforlist = DOL_URL_ROOT.'/product/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/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 = '';
}
// Type
if ($action == 'setfk_product_type' && $usercancreate) {
$result = $object->setValueFrom('fk_product_type', GETPOST('fk_product_type'), '', null, 'text', '', $user, 'PRODUCT_MODIFY');