From b01a9d6cc307911886869ba8a4aeffee205d4b48 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 16 Dec 2020 05:32:36 +0100 Subject: [PATCH] FIX: Accountancy - Reconciled options not working on ledger et subaccount ledger --- .../accountancy/bookkeeping/listbyaccount.php | 26 +++++++++++++---- .../bookkeeping/listbysubaccount.php | 28 ++++++++++++++----- .../accountancy/class/bookkeeping.class.php | 4 +++ 3 files changed, 45 insertions(+), 13 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 7b8467f60bd..52bedeb73f2 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -543,8 +543,15 @@ while ($i < min($num, $limit)) // Is it a break ? if ($accountg != $displayed_account_number || !isset($displayed_account_number)) { - $colspan = $totalarray['nbfield'] - 3; - $colspanend = $totalarray['nbfield'] - 7; + if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) { + $colnumber = 3; + $colnumberend = 7; + } else { + $colnumber = 4; + $colnumberend = 7; + } + $colspan = $totalarray['nbfield'] - $colnumber; + $colspanend = $totalarray['nbfield'] - $colnumberend; // Show a subtotal by accounting account if (isset($displayed_account_number)) { print ''; @@ -665,11 +672,11 @@ while ($i < min($num, $limit)) // Other type } - print ''; + print ''; print ''; // Picto + Ref - print ''; print ''; print ''; diff --git a/htdocs/accountancy/bookkeeping/listbysubaccount.php b/htdocs/accountancy/bookkeeping/listbysubaccount.php index 48c449df43e..2bdf5e11d09 100644 --- a/htdocs/accountancy/bookkeeping/listbysubaccount.php +++ b/htdocs/accountancy/bookkeeping/listbysubaccount.php @@ -410,7 +410,7 @@ if (empty($reshook)) { if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); -print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $result, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit); +print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $result, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1); print info_admin($langs->trans("WarningRecordWithoutSubledgerAreExcluded")); @@ -546,8 +546,15 @@ while ($i < min($num, $limit)) // Is it a break ? if ($accountg != $displayed_account_number || !isset($displayed_account_number)) { - $colspan = $totalarray['nbfield'] - 3; - $colspanend = $totalarray['nbfield'] - 7; + if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) { + $colnumber = 3; + $colnumberend = 7; + } else { + $colnumber = 4; + $colnumberend = 7; + } + $colspan = $totalarray['nbfield'] - $colnumber; + $colspanend = $totalarray['nbfield'] - $colnumberend; // Show a subtotal by accounting account if (isset($displayed_account_number)) { print ''; @@ -676,11 +683,11 @@ while ($i < min($num, $limit)) // Other type } - print '
'; + print ''; if ($line->doc_type == 'customer_invoice' || $line->doc_type == 'supplier_invoice' || $line->doc_type == 'expense_report') { @@ -744,8 +751,15 @@ while ($i < min($num, $limit)) } // Show sub-total of last shown account -$colspan = $totalarray['nbfield'] - 3; -$colspanend = $totalarray['nbfield'] - 8; +if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) { + $colnumber = 3; + $colnumberend = 7; +} else { + $colnumber = 4; + $colnumberend = 7; +} +$colspan = $totalarray['nbfield'] - $colnumber; +$colspanend = $totalarray['nbfield'] - $colnumberend; print '
'.$langs->trans("TotalForAccount").' '.$accountg.':'.price($sous_total_debit).'
'; + print ''; print ''; // Picto + Ref - print ''; print ''; print ''; diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 8312b155b8b..72428762459 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -825,6 +825,10 @@ class BookKeeping extends CommonObject $sqlwhere[] = $key.'\''.$this->db->idate($value).'\''; } elseif ($key == 't.credit' || $key == 't.debit') { $sqlwhere[] = natural_search($key, $value, 1, 1); + } elseif ($key == 't.reconciled_option') { + $sqlwhere[] = 't.lettering_code IS NULL'; + } elseif ($key == 't.code_journal' && !empty($value)) { + $sqlwhere[] = natural_search("t.code_journal", join(',', $value), 3, 1); } else { $sqlwhere[] = natural_search($key, $value, 0, 1); }
'; + print ''; if ($line->doc_type == 'customer_invoice' || $line->doc_type == 'supplier_invoice' || $line->doc_type == 'expense_report') { @@ -755,8 +762,15 @@ while ($i < min($num, $limit)) } // Show sub-total of last shown account -$colspan = $totalarray['nbfield'] - 3; -$colspanend = $totalarray['nbfield'] - 8; +if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) { + $colnumber = 3; + $colnumberend = 7; +} else { + $colnumber = 4; + $colnumberend = 7; +} +$colspan = $totalarray['nbfield'] - $colnumber; +$colspanend = $totalarray['nbfield'] - $colnumberend; print '
'.$langs->trans("TotalForAccount").' '.$accountg.':'.price($sous_total_debit).'