From da4f3fab14098e10f9b5d1be36186100996402c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 27 Oct 2020 08:10:19 +0100 Subject: [PATCH 1/7] dol_print_date called with a bad value --- htdocs/core/boxes/box_task.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/boxes/box_task.php b/htdocs/core/boxes/box_task.php index 94983ef6bff..1daf8ea6222 100644 --- a/htdocs/core/boxes/box_task.php +++ b/htdocs/core/boxes/box_task.php @@ -1,6 +1,6 @@ - * Copyright (C) 2015-2019 Frederic France +/* Copyright (C) 2012-2018 Charlene BENKE + * Copyright (C) 2015-2020 Frederic France * * 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 @@ -184,7 +184,7 @@ class box_task extends ModeleBoxes $taskstatic->label = $objp->label; $taskstatic->progress = $objp->progress; $taskstatic->fk_statut = $objp->fk_statut; - $taskstatic->date_end = $objp->datee; + $taskstatic->date_end = $this->db->jdate($objp->datee); $taskstatic->planned_workload = $objp->planned_workload; $taskstatic->duration_effective = $objp->duration_effective; From a33d34a165203a290423fc2af798f2019cd7274e Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Tue, 27 Oct 2020 16:48:56 +0100 Subject: [PATCH 2/7] FIX: various payments: bad data handling for subledger account + useless db commit/rollback --- htdocs/compta/bank/various_payment/card.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php index 6573207a117..ae147635099 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 = GETPOST("subledger_account") > 0 ? GETPOST("subledger_account", "alpha") : ""; + $object->subledger_account = $subledger_account; $object->sens = GETPOST('sens'); $object->fk_project = GETPOST('fk_project', 'int'); @@ -221,13 +221,10 @@ if (empty($reshook)) if ($action == 'setsubledger_account') { $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) { - $db->commit(); - } else { - $db->rollback(); + if ($res < 0) { setEventMessages($object->error, $object->errors, 'errors'); } } From c3f0f3cc4ad4675499dae2285c8c4acf728a0604 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 29 Oct 2020 10:36:48 +0100 Subject: [PATCH 3/7] 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'); } } From b1b7a7c72548e424293bb41c5d70573f897e1e9f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 29 Oct 2020 10:40:50 +0100 Subject: [PATCH 4/7] Fix missing transaction --- htdocs/compta/bank/various_payment/card.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php index 6573207a117..c592ead835b 100644 --- a/htdocs/compta/bank/various_payment/card.php +++ b/htdocs/compta/bank/various_payment/card.php @@ -219,6 +219,8 @@ if (empty($reshook)) } if ($action == 'setsubledger_account') { + $db->begin(); + $result = $object->fetch($id); $object->subledger_account = (GETPOST("subledger_account") > 0 ? GETPOST("subledger_account", "alpha") : ""); From 980cb095da0629806131170bbd8aace826292bb6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 29 Oct 2020 11:05:43 +0100 Subject: [PATCH 5/7] Fix sort order use last sortorder if several fields. --- htdocs/core/db/DoliDB.class.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/core/db/DoliDB.class.php b/htdocs/core/db/DoliDB.class.php index 8ca84e0dd10..02864012dc3 100644 --- a/htdocs/core/db/DoliDB.class.php +++ b/htdocs/core/db/DoliDB.class.php @@ -229,6 +229,7 @@ abstract class DoliDB implements Database { if (! empty($sortfield)) { + $oldsortorder = ''; $return=''; $fields=explode(',', $sortfield); $orders=explode(',', $sortorder); @@ -238,15 +239,19 @@ abstract class DoliDB implements Database if (! $return) $return.=' ORDER BY '; else $return.=', '; - $return.=preg_replace('/[^0-9a-z_\.]/i', '', $val); + $return .= preg_replace('/[^0-9a-z_\.]/i', '', $val); // Add field $tmpsortorder = trim($orders[$i]); // Only ASC and DESC values are valid SQL if (strtoupper($tmpsortorder) === 'ASC') { + $oldsortorder = 'ASC'; $return .= ' ASC'; } elseif (strtoupper($tmpsortorder) === 'DESC') { + $oldsortorder = 'DESC'; $return .= ' DESC'; + } else { + $return .= ' '.($oldsortorder ? $oldsortorder : 'ASC'); } $i++; From 91cf5de54df20dad1fbdb6c91e66b908524e7dde Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 29 Oct 2020 11:06:18 +0100 Subject: [PATCH 6/7] Fix bad sort order --- htdocs/compta/bank/various_payment/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php index 95d84954490..3198b34a34d 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -58,7 +58,7 @@ $offset = $conf->liste_limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; if (! $sortfield) $sortfield="v.datep,v.rowid"; -if (! $sortorder) $sortorder="DESC"; +if (! $sortorder) $sortorder="DESC,DESC"; $filtre=GETPOST("filtre", 'alpha'); From 2a386b6feaa79f56ad5bff2e302319957925e951 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 29 Oct 2020 11:13:18 +0100 Subject: [PATCH 7/7] 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)) {