Fix [ bug #1778 ] Cancel button of edit ref. supplier contract card saves changes instead of cancelling
This commit is contained in:
parent
de137dd012
commit
7670ae46a6
@ -7,6 +7,7 @@
|
||||
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -718,19 +719,25 @@ else if ($action == 'confirm_move' && $confirm == 'yes' && $user->rights->contra
|
||||
setEventMessage($object->error,'errors');
|
||||
}
|
||||
} elseif ($action=='setref_supplier') {
|
||||
$result = $object->fetch($id);
|
||||
if ($result < 0) {
|
||||
setEventMessage($object->errors,'errors');
|
||||
}
|
||||
$object->ref_supplier=GETPOST('ref_supplier','alpha');
|
||||
|
||||
$result = $object->update($user);
|
||||
if ($result < 0) {
|
||||
setEventMessage($object->errors,'errors');
|
||||
$action='editref_supplier';
|
||||
} else {
|
||||
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
$cancelbutton = GETPOST('cancel');
|
||||
|
||||
if (!$cancelbutton) {
|
||||
|
||||
$result = $object->fetch($id);
|
||||
if ($result < 0) {
|
||||
setEventMessage($object->errors, 'errors');
|
||||
}
|
||||
$object->ref_supplier = GETPOST('ref_supplier', 'alpha');
|
||||
|
||||
$result = $object->update($user);
|
||||
if ($result < 0) {
|
||||
setEventMessage($object->errors, 'errors');
|
||||
$action = 'editref_supplier';
|
||||
} else {
|
||||
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
} elseif ($action=='setref') {
|
||||
$object->ref=GETPOST('ref','alpha');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user