Overview
Comment: | A better error message when nothing is checked |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | dev |
Files: | files | file ages | folders |
SHA1: |
6dad4a9dda951042a47781b6ec8c40dd |
User & Date: | bohwaz on 2021-01-14 14:49:14 |
Other Links: | branch diff | manifest | tags |
Context
2021-01-14
| ||
14:57 | Backport: Add alert message if there is nothing to deposit check-in: 0a1806f465 user: bohwaz tags: trunk | |
14:55 | Add alert message if there is nothing to deposit check-in: 1e30d5d453 user: bohwaz tags: dev | |
14:49 | A better error message when nothing is checked check-in: 6dad4a9dda user: bohwaz tags: dev | |
14:27 | Add count parameter to SQL check-in: 9ef32e84c5 user: bohwaz tags: dev | |
Changes
Modified src/www/admin/acc/accounts/deposit.php from [07c8f2aab9] to [73f47982d1].
︙ | ︙ | |||
22 23 24 25 26 27 28 | $checked = f('deposit') ?: []; $journal = $account->getDepositJournal(CURRENT_YEAR_ID, $checked); $transaction = new Transaction; $transaction->id_year = CURRENT_YEAR_ID; $transaction->id_creator = $session->getUser()->id; | | | < > | < < | < | | > | > | < > | < < | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | $checked = f('deposit') ?: []; $journal = $account->getDepositJournal(CURRENT_YEAR_ID, $checked); $transaction = new Transaction; $transaction->id_year = CURRENT_YEAR_ID; $transaction->id_creator = $session->getUser()->id; $form->runIf('save', function () use ($account, $checked, $transaction, $journal) { if (!count($checked)) { throw new UserException('Aucune ligne n\'a été cochée, impossible de créer un dépôt. Peut-être vouliez-vous saisir un virement ?'); } $transaction->importFromDepositForm(); Transactions::saveDeposit($transaction, $journal, $checked); Utils::redirect(ADMIN_URL . 'acc/transactions/details.php?id=' . $transaction->id()); }, 'acc_deposit_' . $account->id()); if ($form->hasErrors()) { $journal = $account->getDepositJournal(CURRENT_YEAR_ID); } $date = new \DateTime; if ($date > $current_year->end_date) { $date = $current_year->end_date; } |
︙ | ︙ |