From 2a386b6feaa79f56ad5bff2e302319957925e951 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 29 Oct 2020 11:13:18 +0100 Subject: [PATCH] Fix set subledger account --- htdocs/compta/bank/various_payment/card.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php index c592ead835b..cc2a5bd5283 100644 --- a/htdocs/compta/bank/various_payment/card.php +++ b/htdocs/compta/bank/various_payment/card.php @@ -51,8 +51,12 @@ $sens = GETPOST("sens", "int"); $amount = price2num(GETPOST("amount", "alpha")); $paymenttype = GETPOST("paymenttype", "int"); $accountancy_code = GETPOST("accountancy_code", "alpha"); -$subledger_account = GETPOST("subledger_account", "alpha"); $projectid = (GETPOST('projectid', 'int') ? GETPOST('projectid', 'int') : GETPOST('fk_project', 'int')); +if (!empty($conf->accounting->enabled) && !empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) { + $subledger_account = GETPOST("subledger_account", "alpha") > 0 ? GETPOST("subledger_account", "alpha") : ''; +} else { + $subledger_account = GETPOST("subledger_account", "alpha"); +} // Security check $socid = GETPOST("socid", "int"); @@ -115,7 +119,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 = GETPOST("subledger_account") > 0 ? GETPOST("subledger_account", "alpha") : ""; + $object->subledger_account = $subledger_account; $object->sens = GETPOST('sens'); $object->fk_project = GETPOST('fk_project', 'int'); @@ -223,7 +227,7 @@ if (empty($reshook)) $result = $object->fetch($id); - $object->subledger_account = (GETPOST("subledger_account") > 0 ? GETPOST("subledger_account", "alpha") : ""); + $object->subledger_account = $subledger_account; $res = $object->update($user); if ($res > 0) { @@ -388,7 +392,7 @@ if ($action == 'create') // Subledger account if (!empty($conf->accounting->enabled)) { - print ''.$langs->trans("SubledgerAccount").''; + print ''.$langs->trans("SubledgerAccount").'aaaa'; print ''; if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) {