diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 45e8c6aee70..a46a12625fa 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -1,7 +1,7 @@ * Copyright (C) 2013-2016 Olivier Geffroy - * Copyright (C) 2013-2016 Florian Henry + * Copyright (C) 2013-2020 Florian Henry * Copyright (C) 2013-2020 Alexandre Spangaro * Copyright (C) 2018 Frédéric France * @@ -22,7 +22,7 @@ /** * \file htdocs/accountancy/bookkeeping/listbyaccount.php * \ingroup Accountancy (Double entries) - * \brief List operation of book keeping ordered by account number + * \brief List operation of ledger ordered by account number */ require '../../main.inc.php'; @@ -56,7 +56,7 @@ $search_doc_ref = GETPOST('search_doc_ref', 'alpha'); $search_label_operation = GETPOST('search_label_operation', 'alpha'); $search_mvt_num = GETPOST('search_mvt_num', 'int'); $search_direction = GETPOST('search_direction', 'alpha'); -$search_ledger_code = GETPOST('search_ledger_code', 'alpha'); +$search_ledger_code = GETPOST('search_ledger_code', 'array'); $search_debit = GETPOST('search_debit', 'alpha'); $search_credit = GETPOST('search_credit', 'alpha'); $search_lettering_code = GETPOST('search_lettering_code', 'alpha'); @@ -151,7 +151,7 @@ if (empty($reshook)) $search_label_operation = ''; $search_mvt_num = ''; $search_direction = ''; - $search_ledger_code = ''; + $search_ledger_code = array(); $search_date_start = ''; $search_date_end = ''; $search_date_startyear = ''; @@ -212,7 +212,9 @@ if (empty($reshook)) } if (!empty($search_ledger_code)) { $filter['t.code_journal'] = $search_ledger_code; - $param .= '&search_ledger_code='.urlencode($search_ledger_code); + foreach ($search_ledger_code as $code) { + $param .= '&search_ledger_code[]='.urlencode($code); + } } if (!empty($search_debit)) { $filter['t.debit'] = $search_debit; @@ -426,7 +428,9 @@ print ''; // Code journal if (!empty($arrayfields['t.code_journal']['checked'])) { - print ''; + print ''; + print $formaccounting->multi_select_journal($search_ledger_code, 'search_ledger_code', 0, 1, 1, 1); + print ''; } // Date document if (!empty($arrayfields['t.doc_date']['checked'])) { diff --git a/htdocs/accountancy/bookkeeping/listbysubaccount.php b/htdocs/accountancy/bookkeeping/listbysubaccount.php index c286780e572..a7ceeaa2114 100644 --- a/htdocs/accountancy/bookkeeping/listbysubaccount.php +++ b/htdocs/accountancy/bookkeeping/listbysubaccount.php @@ -1,7 +1,7 @@ * Copyright (C) 2013-2016 Olivier Geffroy - * Copyright (C) 2013-2016 Florian Henry + * Copyright (C) 2013-2020 Florian Henry * Copyright (C) 2013-2020 Alexandre Spangaro * Copyright (C) 2018 Frédéric France * @@ -56,7 +56,7 @@ $search_doc_ref = GETPOST('search_doc_ref', 'alpha'); $search_label_operation = GETPOST('search_label_operation', 'alpha'); $search_mvt_num = GETPOST('search_mvt_num', 'int'); $search_direction = GETPOST('search_direction', 'alpha'); -$search_ledger_code = GETPOST('search_ledger_code', 'alpha'); +$search_ledger_code = GETPOST('search_ledger_code', 'array'); $search_debit = GETPOST('search_debit', 'alpha'); $search_credit = GETPOST('search_credit', 'alpha'); $search_lettering_code = GETPOST('search_lettering_code', 'alpha'); @@ -151,7 +151,7 @@ if (empty($reshook)) $search_label_operation = ''; $search_mvt_num = ''; $search_direction = ''; - $search_ledger_code = ''; + $search_ledger_code = array(); $search_date_start = ''; $search_date_end = ''; $search_date_startyear = ''; @@ -212,7 +212,9 @@ if (empty($reshook)) } if (!empty($search_ledger_code)) { $filter['t.code_journal'] = $search_ledger_code; - $param .= '&search_ledger_code='.urlencode($search_ledger_code); + foreach ($search_ledger_code as $code) { + $param .= '&search_ledger_code[]='.urlencode($code); + } } if (!empty($search_debit)) { $filter['t.debit'] = $search_debit; @@ -423,7 +425,9 @@ print ''; // Code journal if (!empty($arrayfields['t.code_journal']['checked'])) { - print ''; + print ''; + print $formaccounting->multi_select_journal($search_ledger_code, 'search_ledger_code', 0, 1, 1, 1); + print ''; } // Date document if (!empty($arrayfields['t.doc_date']['checked'])) { diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 505c51d27fe..fa5df691fdc 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2015-2017 Alexandre Spangaro - * Copyright (C) 2015-2017 Florian Henry + * Copyright (C) 2015-2020 Florian Henry * Copyright (C) 2018-2020 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -825,6 +825,8 @@ 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.code_journal' && !empty($value)) { + $sqlwhere[] = natural_search("t.code_journal", join(',', $value), 3, 1); } else { $sqlwhere[] = natural_search($key, $value, 0, 1); }