From c3f0f3cc4ad4675499dae2285c8c4acf728a0604 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 29 Oct 2020 10:36:48 +0100 Subject: [PATCH] Revert "FIX: various payments: bad data handling for subledger account + useless db commit/rollback" --- htdocs/compta/bank/various_payment/card.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php index ae147635099..6573207a117 100644 --- a/htdocs/compta/bank/various_payment/card.php +++ b/htdocs/compta/bank/various_payment/card.php @@ -115,7 +115,7 @@ if (empty($reshook)) $object->category_transaction = GETPOST("category_transaction", 'alpha'); $object->accountancy_code = GETPOST("accountancy_code") > 0 ? GETPOST("accountancy_code", "alpha") : ""; - $object->subledger_account = $subledger_account; + $object->subledger_account = GETPOST("subledger_account") > 0 ? GETPOST("subledger_account", "alpha") : ""; $object->sens = GETPOST('sens'); $object->fk_project = GETPOST('fk_project', 'int'); @@ -221,10 +221,13 @@ if (empty($reshook)) if ($action == 'setsubledger_account') { $result = $object->fetch($id); - $object->subledger_account = $subledger_account; + $object->subledger_account = (GETPOST("subledger_account") > 0 ? GETPOST("subledger_account", "alpha") : ""); $res = $object->update($user); - if ($res < 0) { + if ($res > 0) { + $db->commit(); + } else { + $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); } }