FIX: various payments: bad data handling for subledger account + useless db commit/rollback

This commit is contained in:
Marc de Lima Lucio 2020-10-27 16:48:56 +01:00
parent 027c5582c3
commit a33d34a165

View File

@ -115,7 +115,7 @@ if (empty($reshook))
$object->category_transaction = GETPOST("category_transaction", 'alpha'); $object->category_transaction = GETPOST("category_transaction", 'alpha');
$object->accountancy_code = GETPOST("accountancy_code") > 0 ? GETPOST("accountancy_code", "alpha") : ""; $object->accountancy_code = GETPOST("accountancy_code") > 0 ? GETPOST("accountancy_code", "alpha") : "";
$object->subledger_account = GETPOST("subledger_account") > 0 ? GETPOST("subledger_account", "alpha") : ""; $object->subledger_account = $subledger_account;
$object->sens = GETPOST('sens'); $object->sens = GETPOST('sens');
$object->fk_project = GETPOST('fk_project', 'int'); $object->fk_project = GETPOST('fk_project', 'int');
@ -221,13 +221,10 @@ if (empty($reshook))
if ($action == 'setsubledger_account') { if ($action == 'setsubledger_account') {
$result = $object->fetch($id); $result = $object->fetch($id);
$object->subledger_account = (GETPOST("subledger_account") > 0 ? GETPOST("subledger_account", "alpha") : ""); $object->subledger_account = $subledger_account;
$res = $object->update($user); $res = $object->update($user);
if ($res > 0) { if ($res < 0) {
$db->commit();
} else {
$db->rollback();
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} }