Fix [ bug #1778 ] Cancel button of edit ref. supplier contract card saves changes instead of cancelling

This commit is contained in:
Marcos García de La Fuente 2014-12-28 18:56:23 +01:00
parent de137dd012
commit 7670ae46a6

View File

@ -7,6 +7,7 @@
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es> * 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 * 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 * it under the terms of the GNU General Public License as published by
@ -718,6 +719,11 @@ else if ($action == 'confirm_move' && $confirm == 'yes' && $user->rights->contra
setEventMessage($object->error,'errors'); setEventMessage($object->error,'errors');
} }
} elseif ($action=='setref_supplier') { } elseif ($action=='setref_supplier') {
$cancelbutton = GETPOST('cancel');
if (!$cancelbutton) {
$result = $object->fetch($id); $result = $object->fetch($id);
if ($result < 0) { if ($result < 0) {
setEventMessage($object->errors, 'errors'); setEventMessage($object->errors, 'errors');
@ -732,6 +738,7 @@ else if ($action == 'confirm_move' && $confirm == 'yes' && $user->rights->contra
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit; exit;
} }
}
} elseif ($action=='setref') { } elseif ($action=='setref') {
$object->ref=GETPOST('ref','alpha'); $object->ref=GETPOST('ref','alpha');