Configuration : traitement cas particuliers exercices

This commit is contained in:
Jean-Christophe Engel 2025-11-03 13:44:41 +01:00
parent ab8f695e31
commit 4b504f6eb9
2 changed files with 87 additions and 74 deletions

View file

@ -13,6 +13,8 @@
{{if $ts_debut <= $now && $now <= $ts_fin}}
{{:assign selected_year=$id}}
{{/if}}
{{else}}
{{:error message="Aucun exercice ouvert"}}
{{/years}}
{{* Traiter l'envoi du formulaire *}}

View file

@ -3,6 +3,7 @@
{{:admin_header title="Configuration" custom_css="./style.css" current="module_amortissement"}}
{{* barre de navigation *}}
{{:include file="_nav.html" current="config"}}
{{if $_GET.ok == 1}}
<p class="block confirm">Configuration enregistrée.</p>
{{/if}}
@ -39,19 +40,29 @@
{{:redirect to="./config.html?ok=%d"|args:$ok}}
{{/form}}
{{* récupérer l'exercice courant *}}
{{* récupérer l'exercice courant ou sinon le plus récent *}}
{{:assign var="selected_year" from="logged_user.preferences.accounting_year}}
{{if $selected_year == null}}
{{* sélectionner l'exercice le plus probable *}}
{{#years closed=false order="start_date"}}
{{:assign var="open_years.%d"|args:$id value=$label}}
{{#years}}
{{if $start_date|strtotime <= $now && $end_date|strtotime >= $now}}
{{:assign selected_year=$id}}
{{:break}}
{{/if}}
{{:assign last_year=$id}}
{{/years}}
{{/if}}
{{if $selected_year == null}}
{{if $last_year == null}}
<p class="block alert">Aucun exercice</p>
{{else}}
{{:assign selected_year=$last_year}}
{{/if}}
{{/if}}
{{if $selected_year != null}}
{{* libellés des comptes d'immobilisation *}}
{{:assign condition="("}}
{{#foreach from=$config.prefixes item="code"}}
@ -98,7 +109,6 @@
<td>
{{:assign var="immo_account.%s.%s"|args:$code:$code value="%s — "|args:$code|cat:$elem.label}}
{{:assign var="current_account" from="immo_account.%s"|args:$code}}
{{*:debug immo_account=$immo_account current_account=$current_account*}}
{{:input
type="list"
name="immo_accounts[]"
@ -130,6 +140,7 @@
{{:button type="submit" name="save" label="Enregistrer" shape="right" class="main"}}
</p>
</form>
{{/if}}
<script type="text/javascript" src="scripts.js"></script>
<script type="text/javascript">