Overview
Comment: | Make sure accounts selected match the chart of the selected year |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk | stable |
Files: | files | file ages | folders |
SHA1: |
dae1fdf49affe4b12abb32238835cd65 |
User & Date: | bohwaz on 2021-01-05 16:32:09 |
Other Links: | manifest | tags |
Context
2021-01-05
| ||
16:44 | Show lines in error check-in: a352ab24d9 user: bohwaz tags: trunk, stable | |
16:32 | Make sure accounts selected match the chart of the selected year check-in: dae1fdf49a user: bohwaz tags: trunk, stable | |
15:22 | Use DynamicList for members list check-in: fb64391972 user: bohwaz tags: trunk, stable | |
Changes
Modified src/include/lib/Garradin/Entities/Services/Fee.php from [2da418402e] to [ae99771fc3].
︙ | ︙ | |||
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 91 92 93 94 95 96 97 | $source['amount'] = $source['formula'] = null; } } if (empty($source['accounting'])) { $source['id_account'] = $source['id_year'] = null; } return parent::importForm($source); } public function selfCheck(): void { $db = DB::getInstance(); parent::selfCheck(); $this->assert(trim($this->label) !== '', 'Le libellé doit être renseigné'); $this->assert(strlen($this->label) <= 200, 'Le libellé doit faire moins de 200 caractères'); $this->assert(strlen($this->description) <= 2000, 'La description doit faire moins de 2000 caractères'); $this->assert(null === $this->amount || $this->amount > 0, 'Le montant est invalide : ' . $this->amount); $this->assert($this->id_service, 'Aucun service n\'a été indiqué pour ce tarif.'); $this->assert((null === $this->id_account && null === $this->id_year) || (null !== $this->id_account && null !== $this->id_year), 'Le compte doit être indiqué avec l\'exercice'); $this->assert(null === $this->id_account || $db->test(Account::TABLE, 'id = ?', $this->id_account), 'Le compte indiqué n\'existe pas'); $this->assert(null === $this->id_year || $db->test(Year::TABLE, 'id = ?', $this->id_year), 'L\'exercice indiqué n\'existe pas'); $this->assert(null === $this->formula || $this->checkFormula(), 'Formule de calcul invalide'); $this->assert(null === $this->amount || null === $this->formula, 'Il n\'est pas possible de spécifier à la fois une formule et un montant'); } public function getAmountForUser(int $user_id): ?int { if ($this->amount) { | > > > > | 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 91 92 93 94 95 96 97 98 99 100 101 | $source['amount'] = $source['formula'] = null; } } if (empty($source['accounting'])) { $source['id_account'] = $source['id_year'] = null; } elseif (!empty($source['accounting']) && empty($source['id_account'])) { $source['id_account'] = null; } return parent::importForm($source); } public function selfCheck(): void { $db = DB::getInstance(); parent::selfCheck(); $this->assert(trim($this->label) !== '', 'Le libellé doit être renseigné'); $this->assert(strlen($this->label) <= 200, 'Le libellé doit faire moins de 200 caractères'); $this->assert(strlen($this->description) <= 2000, 'La description doit faire moins de 2000 caractères'); $this->assert(null === $this->amount || $this->amount > 0, 'Le montant est invalide : ' . $this->amount); $this->assert($this->id_service, 'Aucun service n\'a été indiqué pour ce tarif.'); $this->assert((null === $this->id_account && null === $this->id_year) || (null !== $this->id_account && null !== $this->id_year), 'Le compte doit être indiqué avec l\'exercice'); $this->assert(null === $this->id_account || $db->test(Account::TABLE, 'id = ?', $this->id_account), 'Le compte indiqué n\'existe pas'); $this->assert(null === $this->id_year || $db->test(Year::TABLE, 'id = ?', $this->id_year), 'L\'exercice indiqué n\'existe pas'); $this->assert(null === $this->id_account || $db->test(Account::TABLE, 'id = ? AND id_chart = (SELECT id_chart FROM acc_years WHERE id = ?)', $this->id_account, $this->id_year), 'Le compte sélectionné ne correspond pas à l\'exercice'); $this->assert(null === $this->formula || $this->checkFormula(), 'Formule de calcul invalide'); $this->assert(null === $this->amount || null === $this->formula, 'Il n\'est pas possible de spécifier à la fois une formule et un montant'); } public function getAmountForUser(int $user_id): ?int { if ($this->amount) { |
︙ | ︙ |
Modified src/templates/acc/transactions/details.tpl from [5397a0b0cf] to [64092a38a7].
︙ | ︙ | |||
23 24 25 26 27 28 29 | {csrf_field key=$csrf_key} </form> </div> {/if} {if $transaction.status & $transaction::STATUS_ERROR} <p class="error block"> | | | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | {csrf_field key=$csrf_key} </form> </div> {/if} {if $transaction.status & $transaction::STATUS_ERROR} <p class="error block"> Cette écriture est erronée suite à un bug. Il est conseillé de la modifier pour remettre les comptes manquants, ou la supprimer et la re-créer. Voir <a href="https://fossil.kd2.org/garradin/wiki?name=Changelog#1_0_1" target="_blank">cette page pour plus d'explications</a> </p> {/if} <dl class="describe"> {if $transaction.id_related} <dt>Écriture liée à</dt> |
︙ | ︙ |
Modified src/templates/services/fees/_fee_form.tpl from [9191e678a6] to [d8e5596d6c].
︙ | ︙ | |||
45 46 47 48 49 50 51 | <p class="error block">Il n'y a aucun exercice ouvert dans la comptabilité, il n'est donc pas possible d'enregistrer les activités dans la comptabilité. Merci de commencer par <a href="{$admin_url}acc/years/new.php">créer un exercice</a>.</p> {else} <dl> <dt><label for="f_id_year">Exercice</label> <b>(obligatoire)</b></dt> <dd> <select id="f_id_year" name="id_year"> {foreach from=$years item="year"} | | | 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | <p class="error block">Il n'y a aucun exercice ouvert dans la comptabilité, il n'est donc pas possible d'enregistrer les activités dans la comptabilité. Merci de commencer par <a href="{$admin_url}acc/years/new.php">créer un exercice</a>.</p> {else} <dl> <dt><label for="f_id_year">Exercice</label> <b>(obligatoire)</b></dt> <dd> <select id="f_id_year" name="id_year"> {foreach from=$years item="year"} <option value="{$year.id}"{if $year.id == $fee.id_year} selected="selected"{/if}>{$year.label} — {$year.start_date|date_short} au {$year.end_date|date_short}</option> {/foreach} </select> </dd> {input type="list" target="acc/charts/accounts/selector.php?targets=%s&year=%d"|args:$targets,$fee.id_year name="account" label="Compte à utiliser" default=$account required=1} </dl> {/if} </fieldset> |
︙ | ︙ | |||
93 94 95 96 97 98 99 100 101 102 103 104 | $('#f_amount_type_2').onchange = togglePeriod; $('#f_accounting_1').onchange = () => { g.toggle('.accounting', $('#f_accounting_1').checked); }; function toggleYearForSelector() { var btn = document.querySelector('#f_account_container button'); btn.value = btn.value.replace(/year=\d+/, 'year=' + y.value); } var y = $('#f_id_year') y.onchange = toggleYearForSelector; | > > > > > < | 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | $('#f_amount_type_2').onchange = togglePeriod; $('#f_accounting_1').onchange = () => { g.toggle('.accounting', $('#f_accounting_1').checked); }; function toggleYearForSelector() { var btn = document.querySelector('#f_account_container button'); btn.value = btn.value.replace(/year=\d+/, 'year=' + y.value); let v = btn.parentNode.querySelector('span'); if (v) { v.parentNode.removeChild(v); } } var y = $('#f_id_year') y.onchange = toggleYearForSelector; })(); {/literal} </script> |