Overview
Comment: | Allow to see all accounts from simple transactions as well |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
f4c592e20322922a6fa69bf43eadf615 |
User & Date: | bohwaz on 2022-07-30 14:28:15 |
Other Links: | manifest | tags |
Context
2022-07-30
| ||
15:14 | Refactor transactioncreate from services check-in: a561edb031 user: bohwaz tags: trunk | |
14:28 | Allow to see all accounts from simple transactions as well check-in: f4c592e203 user: bohwaz tags: trunk | |
13:42 | Don't intercept home/end inside text input in account selector check-in: 5e415ca27b user: bohwaz tags: trunk | |
Changes
Modified src/include/lib/Garradin/Accounting/Accounts.php from [fe703b65c6] to [af4b257ad1].
︙ | ︙ | |||
57 58 59 60 61 62 63 | return $this->em->all('SELECT * FROM @TABLE WHERE id_chart = ? AND type != 0 AND type NOT IN (?) ORDER BY code COLLATE U_NOCASE;', $this->chart_id, Account::TYPE_ANALYTICAL); } /** * Return all accounts from current chart */ | | > > > > > > > > > > > > > > > > > | | 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | return $this->em->all('SELECT * FROM @TABLE WHERE id_chart = ? AND type != 0 AND type NOT IN (?) ORDER BY code COLLATE U_NOCASE;', $this->chart_id, Account::TYPE_ANALYTICAL); } /** * Return all accounts from current chart */ public function listAll(?array $targets = null): array { $where = ''; if (!empty($targets)) { $position = null; if (in_array(Account::TYPE_EXPENSE, $targets)) { $position = Account::EXPENSE; } elseif (in_array(Account::TYPE_REVENUE, $targets)) { $position = Account::REVENUE; } if ($position) { $where = sprintf('AND position = %d', $position); } } return $this->em->all(sprintf('SELECT * FROM @TABLE WHERE id_chart = ? %s ORDER BY code COLLATE U_NOCASE;', $where), $this->chart_id); } public function listForCodes(array $codes): array { return DB::getInstance()->getGrouped('SELECT code, id, label FROM acc_accounts WHERE id_chart = ?;', $this->chart_id); } |
︙ | ︙ |
Modified src/www/admin/acc/charts/accounts/selector.php from [0b96176cb9] to [7a48c2d2f1].
︙ | ︙ | |||
13 14 15 16 17 18 19 20 21 | $targets = qg('targets'); $targets = $targets ? explode(':', $targets) : []; $chart = (int) qg('chart') ?: null; $targets = array_map('intval', $targets); $targets_str = implode(':', $targets); // Cache the page until the charts have changed $last_change = Config::getInstance()->get('last_chart_change') ?: time(); | > > > > > > > > | | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | $targets = qg('targets'); $targets = $targets ? explode(':', $targets) : []; $chart = (int) qg('chart') ?: null; $targets = array_map('intval', $targets); $targets_str = implode(':', $targets); $all = qg('all'); if (null !== $all) { $session->set('account_selector_all', (bool) $all); } $all = (bool) $session->get('account_selector_all'); // Cache the page until the charts have changed $last_change = Config::getInstance()->get('last_chart_change') ?: time(); $hash = sha1($targets_str . $chart . $last_change . '=' . $all); // Exit if there's no need to reload Utils::HTTPCache($hash, null, 10); if ($chart) { $chart = Charts::get($chart); } |
︙ | ︙ | |||
42 43 44 45 46 47 48 | throw new UserException('Aucun exercice ouvert disponible'); } $accounts = $chart->accounts(); $tpl->assign(compact('chart', 'targets', 'targets_str')); | < < < < < < < < > > > | 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | throw new UserException('Aucun exercice ouvert disponible'); } $accounts = $chart->accounts(); $tpl->assign(compact('chart', 'targets', 'targets_str')); if (!count($targets)) { $tpl->assign('accounts', !$all ? $accounts->listCommonTypes() : $accounts->listAll()); } elseif ($all) { $tpl->assign('accounts', $accounts->listAll($targets)); } else { $tpl->assign('grouped_accounts', $accounts->listCommonGrouped($targets)); } $tpl->assign('all', $all); $tpl->display('acc/charts/accounts/selector.tpl'); |
Modified src/www/admin/static/scripts/selector.js from [bdc04e542b] to [5c426733c3].
︙ | ︙ | |||
53 54 55 56 57 58 59 60 61 62 63 64 65 66 | idx = available.length - 1; } } if (!available.length) { return false; } if (evt.key == 'Home') { idx = 0; } else if (evt.key == 'End') { idx = available.length; } | > > > > > > > < < < < < < < < | 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | idx = available.length - 1; } } if (!available.length) { return false; } // Do not intercept home/end inside text input if ((evt.key == 'Home' || evt.key == 'End') && document.activeElement instanceof HTMLInputElement && document.activeElement.type == 'text') { return; } if (evt.key == 'Home') { idx = 0; } else if (evt.key == 'End') { idx = available.length; } else if (evt.key == 'ArrowUp') { // Previous item idx--; } else if (evt.key == 'ArrowDown') { idx++; } else if (evt.key == 'PageUp') { |
︙ | ︙ |
Modified src/www/admin/static/styles/03-forms.css from [b01f09fb90] to [da6a895d27].
︙ | ︙ | |||
697 698 699 700 701 702 703 704 705 706 707 708 709 710 | width: 100%; height: 1em; filter: none !important; color: #000; } @keyframes spin { to { transform: rotate(360deg); } } @media screen and (max-width: 1279px) { #queryBuilder table tr { display: flex; flex-wrap: wrap; padding: .5em 0; margin-left: 6rem; | > > > > > > > > > > > > > | 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 | width: 100%; height: 1em; filter: none !important; color: #000; } @keyframes spin { to { transform: rotate(360deg); } } .selector header { margin-bottom: 2em; } .selector header p.edit { float: right; margin: 0; } .selector header h2 input { width: calc(100% - 1em); } @media screen and (max-width: 1279px) { #queryBuilder table tr { display: flex; flex-wrap: wrap; padding: .5em 0; margin-left: 6rem; |
︙ | ︙ |