Comment: | Current year selector |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | dev |
Files: | files | file ages | folders |
SHA1: |
27040058bcfd1e88fcfeba29fe8a969b |
User & Date: | bohwaz on 2020-10-03 23:52:21 |
Other Links: | branch diff | manifest | tags |
2020-10-04
| ||
01:00 | Implement account journals check-in: b0ad011f2b user: bohwaz tags: dev | |
2020-10-03
| ||
23:52 | Current year selector check-in: 27040058bc user: bohwaz tags: dev | |
19:20 | Cleanup of old files check-in: e1381c5a2f user: bohwaz tags: dev | |
Modified src/include/lib/Garradin/Accounting/Years.php from [10f18aeacf] to [3aa7cf08fd].
︙ | ︙ | |||
27 28 29 30 31 32 33 | static public function listClosed() { $em = EntityManager::getInstance(Year::class); return $em->all('SELECT * FROM @TABLE WHERE closed = 1 ORDER BY end_date;'); } | | > | | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | static public function listClosed() { $em = EntityManager::getInstance(Year::class); return $em->all('SELECT * FROM @TABLE WHERE closed = 1 ORDER BY end_date;'); } static public function list(bool $reverse = false) { $desc = $reverse ? 'DESC' : ''; $em = EntityManager::getInstance(Year::class); return $em->all(sprintf('SELECT * FROM @TABLE ORDER BY end_date %s;', $desc)); } static public function getNewYearDates(): array { $last_year = EntityManager::findOne(Year::class, 'SELECT * FROM @TABLE ORDER BY end_date DESC LIMIT 1;'); if ($last_year) { |
︙ | ︙ |
Modified src/include/lib/Garradin/Template.php from [4596374ba8] to [d3412ca497].
︙ | ︙ | |||
37 38 39 40 41 42 43 | // pour les éléments statiques (genre /admin/static/admin.css?v0.9.0) // car cela dévoilerait la version de Garradin utilisée, posant un souci // en cas de faille, on cache donc la version utilisée, chaque instance // aura sa propre version $this->assign('version_hash', substr(sha1(garradin_version() . garradin_manifest() . ROOT . SECRET_KEY), 0, 10)); $this->assign('www_url', WWW_URL); | | | | 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | // pour les éléments statiques (genre /admin/static/admin.css?v0.9.0) // car cela dévoilerait la version de Garradin utilisée, posant un souci // en cas de faille, on cache donc la version utilisée, chaque instance // aura sa propre version $this->assign('version_hash', substr(sha1(garradin_version() . garradin_manifest() . ROOT . SECRET_KEY), 0, 10)); $this->assign('www_url', WWW_URL); $this->assign('self_url', Utils::getSelfURI()); $this->assign('self_url_no_qs', Utils::getSelfURI(false)); $this->assign('is_logged', false); $this->assign('password_pattern', sprintf('.{%d,}', Session::MINIMUM_PASSWORD_LENGTH)); $this->assign('password_length', Session::MINIMUM_PASSWORD_LENGTH); $this->register_compile_function('continue', function ($pos, $block, $name, $raw_args) { |
︙ | ︙ |
Modified src/include/lib/Garradin/Utils.php from [d1d3e6f4cb] to [086a9b64b2].
︙ | ︙ | |||
149 150 151 152 153 154 155 156 157 158 159 160 161 162 | if (is_array($qs)) { $uri .= '?' . http_build_query($qs); } return str_replace('/admin', '', ADMIN_URL) . $uri; } public static function redirect($destination=false, $exit=true) { if (empty($destination) || !preg_match('/^https?:\/\//', $destination)) { if (empty($destination)) $destination = WWW_URL; | > > > > > | 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | if (is_array($qs)) { $uri .= '?' . http_build_query($qs); } return str_replace('/admin', '', ADMIN_URL) . $uri; } static public function getSelfURI(bool $qs = true) { return str_replace(substr(WWW_URL, 0, -1), '', self::getSelfURL($qs)); } public static function redirect($destination=false, $exit=true) { if (empty($destination) || !preg_match('/^https?:\/\//', $destination)) { if (empty($destination)) $destination = WWW_URL; |
︙ | ︙ |
Modified src/templates/acc/_year_select.tpl from [13906d560b] to [8798948fc2].
1 | <nav class="acc-year"> | < < | < < < < | < | < < < < < < < < < | 1 2 3 4 5 | <nav class="acc-year"> <h4>Exercice sélectionné :</h4> <h3>{$current_year.label} — {$current_year.start_date|date_fr:'d/m/Y'} au {$current_year.end_date|date_fr:'d/m/Y'}</h3> <footer>{linkbutton label="Changer d'exercice" href="acc/years/select.php?from=%s"|args:$self_url shape="settings"}</footer> </nav> |
Modified src/templates/acc/accounts/index.tpl from [4a795a15be] to [fc4604d6f2].
︙ | ︙ | |||
18 19 20 21 22 23 24 | <h2 class="ruler">{$group_name}</h2> <dl class="list"> {foreach from=$accounts item="account"} <dt>{$account.label} <em>({$account.code})</em></dt> <dd class="desc">{$account.description}</dd> <dd class="actions"> | | | | | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | <h2 class="ruler">{$group_name}</h2> <dl class="list"> {foreach from=$accounts item="account"} <dt>{$account.label} <em>({$account.code})</em></dt> <dd class="desc">{$account.description}</dd> <dd class="actions"> {linkbutton shape="menu" label="Journal" href="acc/accounts/journal.php?id=%d"|args:$account.id} {if $session->canAccess('compta', Membres::DROIT_ADMIN)} {linkbutton shape="edit" label="Modifier" href="acc/accounts/edit.php?id=%d"|args:$account.id} {linkbutton shape="delete" label="Supprimer" href="acc/accounts/delete.php?id=%d"|args:$account.id} {/if} </dd> {/foreach} </dl> {/foreach} {include file="admin/_foot.tpl"} |
Modified src/templates/acc/transactions/new.tpl from [831a0f9d72] to [99610ea21f].
1 2 | {include file="admin/_head.tpl" title="Saisie d'une écriture" current="acc/new" js=1} | | | 1 2 3 4 5 6 7 8 9 10 | {include file="admin/_head.tpl" title="Saisie d'une écriture" current="acc/new" js=1} {include file="acc/_year_select.tpl"} <form method="post" action="{$self_url_no_qs}" enctype="multipart/form-data"> {form_errors} {if $ok} <p class="confirm"> L'opération numéro <a href="details.php?id={$ok}">{$ok}</a> a été ajoutée. |
︙ | ︙ |
Modified src/templates/acc/years/new.tpl from [21dceb0d83] to [b98b76fbf1].
1 2 3 4 5 6 7 8 | {include file="admin/_head.tpl" title="Commencer un exercice" current="acc/years" js=1} {form_errors} <form method="post" action="{$self_url}"> <fieldset> <legend>Commencer un nouvel exercice</legend> | > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | {include file="admin/_head.tpl" title="Commencer un exercice" current="acc/years" js=1} {if $_GET.msg == 'FIRST'} <p class="alert"> Merci de créer un premier exercice pour commencer. </p> {/if} {form_errors} <form method="post" action="{$self_url}"> <fieldset> <legend>Commencer un nouvel exercice</legend> |
︙ | ︙ |
Added src/templates/acc/years/select.tpl version [cff9ec5aab].
> > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | {include file="admin/_head.tpl" title="Changer d'exercice" current="acc/years"} <form method="post" action="{$self_url}"> <fieldset> <legend>Changer l'exercice de travail</legend> <dl> <dd> <select name="year"> {foreach from=$list item="year"} <option value="{$year.id}">{$year.label} — {$year.start_date|date_fr:'d/m/Y'} au {$year.end_date|date_fr:'d/m/Y'}</option> {/foreach} </select> </dd> </dl> </fieldset> <p class="submit"> {csrf_field key="acc_select_year"} <input type="hidden" name="from" value="{$from}" /> <input type="submit" name="change" value="Changer →" /> </p> </form> {include file="admin/_foot.tpl"} |
Modified src/www/admin/acc/_inc.php from [11d505fd00] to [107e998848].
1 2 3 4 5 6 7 8 9 10 | <?php namespace Garradin; use Garradin\Accounting\Years; require_once __DIR__ . '/../_inc.php'; $session->requireAccess('compta', Membres::DROIT_ACCES); | > | > > > > > > | | | < | | | > | > > | | 1 2 3 4 5 6 7 8 9 10 11 12 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 | <?php namespace Garradin; use Garradin\Accounting\Years; require_once __DIR__ . '/../_inc.php'; $session->requireAccess('compta', Membres::DROIT_ACCES); $current_year_id = $session->get('acc_year'); if ($current_year_id) { // Check that the year is still valid $current_year = Years::get($current_year_id); if ($current_year->closed) { $current_year_id = null; $session->set('acc_year', null); } } if (!$current_year_id) { $current_year = Years::getCurrentOpenYearIfSingle(); if (!$current_year) { Utils::redirect(ADMIN_URL . '/acc/years/new.php?msg=FIRST'); } $current_year_id = $current_year->id(); } if ($session->get('acc_year') != $current_year_id) { $session->set('acc_year', $current_year_id); } $tpl->assign('current_year', $current_year); |
Modified src/www/admin/acc/accounts/index.php from [3ec8fc3b98] to [f7dbdd330b].
1 2 3 4 5 6 7 8 9 10 | <?php namespace Garradin; use Garradin\Accounting\Accounts; use Garradin\Accounting\Charts; use Garradin\Accounting\Years; use Garradin\Entities\Accounting\Account; require_once __DIR__ . '/../_inc.php'; | < < | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | <?php namespace Garradin; use Garradin\Accounting\Accounts; use Garradin\Accounting\Charts; use Garradin\Accounting\Years; use Garradin\Entities\Accounting\Account; require_once __DIR__ . '/../_inc.php'; $chart = $current_year->chart(); $accounts = $chart->accounts(); $tpl->assign('chart', $chart); $tpl->assign('accounts_grouped', $accounts->listCommonGrouped()); $tpl->display('acc/accounts/index.tpl'); |
Modified src/www/admin/acc/transactions/new.php from [7159e64fc0] to [7b543b1ef8].
1 2 3 4 5 6 7 8 9 10 | <?php namespace Garradin; use Garradin\Entities\Accounting\Transaction; use Garradin\Accounting\Years; require_once __DIR__ . '/../_inc.php'; $session->requireAccess('compta', Membres::DROIT_ECRITURE); | < | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | <?php namespace Garradin; use Garradin\Entities\Accounting\Transaction; use Garradin\Accounting\Years; require_once __DIR__ . '/../_inc.php'; $session->requireAccess('compta', Membres::DROIT_ECRITURE); $chart = $current_year->chart(); $accounts = $chart->accounts(); $transaction = new Transaction; $lines = [[], []]; if (f('save') && $form->check('acc_transaction_new')) { try { $transaction->id_year = $current_year->id(); $transaction->importFromNewForm($chart->id()); $transaction->id_creator = $session->getUser()->id; $transaction->save(); // Append file if (!empty($_FILES['file']['name'])) { $file = Fichiers::upload($_FILES['file']); |
︙ | ︙ |
Modified src/www/admin/acc/years/index.php from [149f1d838f] to [cf4f0ea6a4].
1 2 3 4 5 6 7 8 9 | <?php namespace Garradin; use Garradin\Accounting\Years; require_once __DIR__ . '/../_inc.php'; $years = new Years; | | | 1 2 3 4 5 6 7 8 9 10 11 12 | <?php namespace Garradin; use Garradin\Accounting\Years; require_once __DIR__ . '/../_inc.php'; $years = new Years; $tpl->assign('list', $years->list(true)); $tpl->display('acc/years/index.tpl'); |
Added src/www/admin/acc/years/select.php version [5863923d36].
> > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | <?php namespace Garradin; use Garradin\Accounting\Years; require_once __DIR__ . '/../../_inc.php'; $years = new Years; if (f('change')) { $year = Years::get(f('year')); if (!$year) { throw new UserException('Exercice inconnu'); } $session->set('acc_year', $year->id()); Utils::redirect(f('from') ?: ADMIN_URL . 'acc/years/'); } $tpl->assign('list', $years->listOpen()); $tpl->assign('from', qg('from')); $tpl->display('acc/years/select.tpl'); |
Modified src/www/admin/static/admin.css from [96ce122570] to [6299f74d89].
︙ | ︙ | |||
829 830 831 832 833 834 835 | b.money { font-weight: inherit; white-space: pre; } nav.acc-year { | > > > > | > > | | | | | 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 | b.money { font-weight: inherit; white-space: pre; } nav.acc-year { background: white; text-align: center; border-radius: .5rem; border: .2rem solid rgba(var(--gMainColor), 0.5); display: flex; align-items: center; margin-bottom: .5rem; } nav.acc-year > * { padding: .2rem .5rem; } nav.acc-year h4 { font-weight: normal; } #rapport h3 { text-align: center; margin-bottom: .5em; } |
︙ | ︙ |