Overview
Comment: | Show all account types in favorite accounts list of a chart |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
34e1da64982141f083f380b301db083c |
User & Date: | bohwaz on 2021-01-05 13:03:10 |
Other Links: | manifest | tags |
Context
2021-01-05
| ||
13:14 | Add link to change favorite accounts check-in: a02f664811 user: bohwaz tags: trunk | |
13:03 | Show all account types in favorite accounts list of a chart check-in: 34e1da6498 user: bohwaz tags: trunk | |
13:02 | Fix cache update of account list when chart is modified check-in: 4bbae43922 user: bohwaz tags: trunk | |
Changes
Modified src/include/lib/Garradin/Accounting/Accounts.php from [84e205b743] to [afc9c5669e].
︙ | ︙ | |||
97 98 99 100 101 102 103 | $this->chart_id, Account::TYPE_VOLUNTEERING); } /** * List common accounts, grouped by type * @return array */ | | > > > > > > > > > > > > > > > | 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | $this->chart_id, Account::TYPE_VOLUNTEERING); } /** * List common accounts, grouped by type * @return array */ public function listCommonGrouped(array $types = null, bool $include_empty_types = false): array { if (null === $types) { $types = ''; } else { $types = array_map('intval', $types); $types = ' AND ' . $this->em->DB()->where('type', $types); } $out = []; if ($include_empty_types) { foreach (Account::TYPES_NAMES as $key => $label) { if (!$label) { continue; } $out[$key] = (object) [ 'label' => $label, 'type' => $key, 'accounts' => [], ]; } } $query = $this->em->iterate('SELECT * FROM @TABLE WHERE id_chart = ? AND type != 0 ' . $types . ' ORDER BY type, code COLLATE NOCASE;', $this->chart_id); foreach ($query as $row) { if (!isset($out[$row->type])) { $out[$row->type] = (object) [ 'label' => Account::TYPES_NAMES[$row->type], |
︙ | ︙ |
Modified src/www/admin/acc/charts/accounts/index.php from [5e00b51e32] to [bd5f5966a0].
︙ | ︙ | |||
18 19 20 21 22 23 24 | if (!$chart) { throw new UserException('Aucun plan comptable spécifié'); } $accounts = $chart->accounts(); $tpl->assign('chart', $chart); | | | 18 19 20 21 22 23 24 25 26 | if (!$chart) { throw new UserException('Aucun plan comptable spécifié'); } $accounts = $chart->accounts(); $tpl->assign('chart', $chart); $tpl->assign('accounts_grouped', $accounts->listCommonGrouped(null, true)); $tpl->display('acc/charts/accounts/index.tpl'); |