From 673003ea77ed9827e874b3c2b8e829bf5f515d15 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Fri, 9 May 2025 11:41:16 +0200 Subject: [PATCH] =?UTF-8?q?Correction=20erreur=20exercice=20dans=20s=C3=A9?= =?UTF-8?q?lecteur=20compte?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- save_amort.html | 66 +++++++++++++++++++++++++------------------------ scripts.js | 5 ++++ 2 files changed, 39 insertions(+), 32 deletions(-) diff --git a/save_amort.html b/save_amort.html index 5a203a5..241834f 100644 --- a/save_amort.html +++ b/save_amort.html @@ -114,23 +114,23 @@ {{:error message="Aucun exercice ouvert pour enregistrer un amortissement"}} {{/years}} - {{* Traiter l'envoi du formulaire *}} {{#form on="save"}} - {{* UTILE ? vérifier que la date est située dans un exercice compatible *}} - + {{* vérifier que la date est située dans un exercice compatible *}} {{:assign ts_date = $_POST.date_amort|parse_date|strtotime}} {{:assign ok=false}} {{#foreach from=$years}} - {{if $start_date|strtotime <= $ts_date && $ts_date <= $end_date|strtotime}} - {{:assign ok=true}} - {{:break}} + {{if $id == $_POST.id_year}} + {{:assign selected_chart=$id_chart}} + {{if $start_date|strtotime <= $ts_date && $ts_date <= $end_date|strtotime}} + {{:assign ok=true}} + {{:break}} + {{/if}} {{/if}} {{/foreach}} {{if ! $ok}} {{:error message="La date choisie n'est dans aucun exercice compatible !!\nExercices compatibles : %s"|args:$msg_years}} {{/if}} - {{* déterminer le numéro des comptes au cas où la clé serait un identifiant *}} {{:include file="_get_codes.html" @@ -160,9 +160,6 @@ }} {{:assign var="amort_array." value=$code_amort|intval}} {{/foreach}} - {{#years closed=false where="id = :year_id" :year_id=$_POST.id_year}} - {{:assign selected_chart=$id_chart}} - {{/years}} {{:include file="_check_account.html" @@ -252,7 +249,7 @@ name="debit_account" label="Compte de débit" required=true - target="!acc/charts/accounts/selector.php?codes=%s&id_year=%d"|args:"68*":$year.id + target="!acc/charts/accounts/selector.php?codes=%s&id_year=%d"|args:"68*":$selected_year default=$debit_account }} {{:input @@ -260,7 +257,7 @@ name="credit_account" label="Compte d'amortissement (280xx ou 281xx)" required=true - target="!acc/charts/accounts/selector.php?codes=%s&id_year=%d"|args:"28*":$year.id + target="!acc/charts/accounts/selector.php?codes=%s&id_year=%d"|args:"28*":$selected_year default=$credit_account }}