Fix cancel button must be named "$cancel" everywhere.

This commit is contained in:
Laurent Destailleur 2021-09-01 18:46:06 +02:00
parent 270eede593
commit a7b0a837d4
3 changed files with 8 additions and 15 deletions

View File

@ -108,7 +108,7 @@ if (!$sortorder) {
if (!$sortfield) { if (!$sortfield) {
$sortfield = "nom"; $sortfield = "nom";
} }
$cancelbutton = GETPOST('cancel', 'alpha'); $cancel = GETPOST('cancel', 'alpha');
$object = new Client($db); $object = new Client($db);
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
@ -152,7 +152,7 @@ if ($reshook < 0) {
} }
if (empty($reshook)) { if (empty($reshook)) {
if ($cancelbutton) { if ($cancel) {
$action = ""; $action = "";
} }

View File

@ -806,8 +806,7 @@ if (empty($reshook)) {
$action = 'edit_extras'; $action = 'edit_extras';
} }
} elseif ($action == 'setref_supplier') { } elseif ($action == 'setref_supplier') {
$cancelbutton = GETPOST('cancel', 'alpha'); if (!$cancel) {
if (!$cancelbutton) {
$object->oldcopy = dol_clone($object); $object->oldcopy = dol_clone($object);
$result = $object->setValueFrom('ref_supplier', GETPOST('ref_supplier', 'alpha'), '', null, 'text', '', $user, 'CONTRACT_MODIFY'); $result = $object->setValueFrom('ref_supplier', GETPOST('ref_supplier', 'alpha'), '', null, 'text', '', $user, 'CONTRACT_MODIFY');
@ -823,9 +822,7 @@ if (empty($reshook)) {
exit; exit;
} }
} elseif ($action == 'setref_customer') { } elseif ($action == 'setref_customer') {
$cancelbutton = GETPOST('cancel', 'alpha'); if (!$cancel) {
if (!$cancelbutton) {
$object->oldcopy = dol_clone($object); $object->oldcopy = dol_clone($object);
$result = $object->setValueFrom('ref_customer', GETPOST('ref_customer', 'alpha'), '', null, 'text', '', $user, 'CONTRACT_MODIFY'); $result = $object->setValueFrom('ref_customer', GETPOST('ref_customer', 'alpha'), '', null, 'text', '', $user, 'CONTRACT_MODIFY');
@ -841,9 +838,7 @@ if (empty($reshook)) {
exit; exit;
} }
} elseif ($action == 'setref') { } elseif ($action == 'setref') {
$cancelbutton = GETPOST('cancel', 'alpha'); if (!$cancel) {
if (!$cancelbutton) {
$result = $object->fetch($id); $result = $object->fetch($id);
if ($result < 0) { if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
@ -878,9 +873,7 @@ if (empty($reshook)) {
exit; exit;
} }
} elseif ($action == 'setdate_contrat') { } elseif ($action == 'setdate_contrat') {
$cancelbutton = GETPOST('cancel', 'alpha'); if (!$cancel) {
if (!$cancelbutton) {
$result = $object->fetch($id); $result = $object->fetch($id);
if ($result < 0) { if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');

View File

@ -54,7 +54,7 @@ $langs->loadLangs(array(
)); ));
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$cancelbutton = GETPOST('cancel', 'alpha'); $cancel = GETPOST('cancel', 'alpha');
// Security check // Security check
$id = (GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int')); $id = (GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int'));
@ -93,7 +93,7 @@ if ($reshook < 0) {
} }
if (empty($reshook)) { if (empty($reshook)) {
if ($cancelbutton) { if ($cancel) {
$action = ""; $action = "";
} }