From dcd3f85e79f0d82d261161a066aac18159626552 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 Sep 2021 17:32:08 +0200 Subject: [PATCH] Fix sql error --- htdocs/accountancy/class/bookkeeping.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index d47078af06c..c80e1088e14 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -888,9 +888,11 @@ class BookKeeping extends CommonObject // Affichage par compte comptable if (!empty($option)) { $sql .= ' AND t.subledger_account IS NOT NULL'; - $sql .= ' ORDER BY t.subledger_account ASC'; + $sortfield = 't.subledger_account'.($sortfield ? ','.$sortfield : ''); + $sortorder = 'ASC'.($sortfield ? ','.$sortfield : ''); } else { - $sql .= ' ORDER BY t.numero_compte ASC'; + $sortfield = 't.numero_compte'.($sortfield ? ','.$sortfield : ''); + $sortorder = 'ASC'.($sortorder ? ','.$sortorder : ''); } $sql .= $this->db->order($sortfield, $sortorder);