From f4205b372ae0c58e6d87e3d1f5d42b4f5793a487 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Fri, 12 Jun 2026 10:02:57 +0200 Subject: [PATCH 1/8] =?UTF-8?q?Am=C3=A9lioration=20suppression=20documents?= =?UTF-8?q?=20orphelins?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _remove_orphan_docs.tpl | 63 ++++++++++++++++++++++++++--------------- 1 file changed, 40 insertions(+), 23 deletions(-) diff --git a/_remove_orphan_docs.tpl b/_remove_orphan_docs.tpl index 4799e33..2514171 100644 --- a/_remove_orphan_docs.tpl +++ b/_remove_orphan_docs.tpl @@ -1,28 +1,45 @@ {{* -*- brindille -*- *}} -{{* supprimer les documents sans écriture associée *}} -{{:assign var="docs." type="amort_link" field="amort_line_id"}} -{{:assign var="docs." type="credit_link" field="credit_line_id"}} -{{:assign var="docs." type="cession_link" field="cession_line_id"}} -{{:assign var="docs." type="exit_link" field="exit_line_id"}} -{{:assign var="docs." type="immo" field="line"}} +{{if $module.table}} + {{* supprimer les documents sans écriture associée *}} + {{:assign var="docs." type="amort_link" field="amort_line_id"}} + {{:assign var="docs." type="credit_link" field="credit_line_id"}} + {{:assign var="docs." type="cession_link" field="cession_line_id"}} + {{:assign var="docs." type="exit_link" field="exit_line_id"}} + {{:assign var="docs." type="immo" field="line"}} -{{#foreach from=$docs}} + {{#foreach from=$docs}} - {{:assign join_field="$$."|cat:$field}} - {{:assign type_name=$type|quote_sql}} - {{:assign type_cond="$$.type"|cat:" = "|cat:$type_name}} + {{:assign join_field="$$."|cat:$field}} + {{:assign type_name=$type|quote_sql}} + {{:assign type_cond="$$.type"|cat:" = "|cat:$type_name}} - {{#select - info.id - FROM !table AS info - LEFT JOIN acc_transactions_lines as line ON !join_field = line.id - WHERE !type_cond AND line.id IS NULL - ; - !table=$module.table - !type_cond = $type_cond - !join_field = $join_field - }} - {{:delete id=$id}} - {{/select}} -{{/foreach}} + {{* vérifier existence écriture associée au doc *}} + {{#select + info.id as info_id, + $$.immo_doc_id as immo_doc_id, + line.id as line_id + FROM !table AS info + LEFT JOIN acc_transactions_lines as line ON !join_field = line.id + WHERE !type_cond + ; + !table=$module.table + !type_cond = $type_cond + !join_field = $join_field + assign="line" + }} + {{if $line.line_id == null}} + {{:delete id=$line.info_id}} + {{/if}} + + {{* vérifier existence doc immo *}} + {{if $type != "immo"}} + {{#load id=$immo_doc_id assign="immo_doc"}} + {{else}} + {{:delete id=$line.info_id}} + {{/load}} + {{/if}} + {{/select}} + + {{/foreach}} +{{/if}} From a69737c42968099c80ce8ddefede5fc16615be7a Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Fri, 12 Jun 2026 10:12:42 +0200 Subject: [PATCH 2/8] Harmonisation affichage --- modify_infos.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modify_infos.html b/modify_infos.html index f430bbd..5b89e91 100644 --- a/modify_infos.html +++ b/modify_infos.html @@ -188,14 +188,14 @@
Paramètres de l'amortissement
- {{:input type="number" name="duree" label="Durée d'amortissement" min=1 default=$info_immo.duration}} - {{:input type="text" name="libelle" label="Libellé" default=$info_immo.label}} + {{:input type="number" name="duree" label="Durée d'amortissement" min=1 default=$info_immo.duration suffix="année(s)"}} {{if $info_immo.amount != null}} {{:assign max_aff="%f"|math:$max_disponible|money_currency:false}} {{:input type="money" name="montant" label="Montant de l'immobilisation" default=$montant_immo help="Montant maximum : %s"|args:$max_aff}} {{/if}} - {{:input type="date" name="date_achat" label="Date d'acquisition" default=$info_immo.date_achat}} - {{:input type="date" name="date_mes" label="Date de mise en service" default=$info_immo.date_mes}} + {{:input type="date" name="date_achat" label="Date d'acquisition" default=$info_immo.date_achat help="si différente de la date de l'écriture d'immobilisation"}} + {{:input type="date" name="date_mes" label="Date de mise en service" default=$info_immo.date_mes help="si différente de la date d'acquisition"}} + {{:input type="text" name="libelle" label="Libellé" default=$info_immo.label help="si différent du libellé de l'écriture d'immobilisation"}}

From f69b5a0ee87bc93c3f47d6596cd994f9eac5a58c Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Fri, 12 Jun 2026 10:24:35 +0200 Subject: [PATCH 3/8] =?UTF-8?q?Am=C3=A9lioration=20pr=C3=A9sentation=20pag?= =?UTF-8?q?e=20amortissements?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _immobilisations.html | 2 +- amortization.html | 78 +++++++++++++++++++++---------------------- 2 files changed, 40 insertions(+), 40 deletions(-) diff --git a/_immobilisations.html b/_immobilisations.html index 8e56aef..ab4d4d6 100644 --- a/_immobilisations.html +++ b/_immobilisations.html @@ -124,7 +124,7 @@ {{$account_code}} {{:linkbutton - label="Voir" + label="Détails" href="amortization.html?immo_doc_id=%s&type_immo=%s"|args:$immo_doc_id:$type_immo shape="eye" }} diff --git a/amortization.html b/amortization.html index f7c9d43..5f70eb1 100644 --- a/amortization.html +++ b/amortization.html @@ -113,14 +113,14 @@

Immobilisation

-

+

@@ -156,8 +156,43 @@
+

Avoirs

+ + +{{if $linked_immos != null}} + + + + + + + + + + {{#foreach from=$linked_immos item="line"}} + {{:assign url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$line.trans_id}} + + + + + + + + {{/foreach}} + +
DateLibelléMontant
#{{$line.trans_id}}{{$line.date|date_short}}{{$line.label}}{{"%f"|math:$line.amount|money_currency_html:false|raw}} + {{if $total_amort == 0}} + {{:linkbutton label="Détacher" href="detach_credit.html?immo_doc_id=%s&credit_line_id=%s"|args:$_GET.immo_doc_id:$line.credit_line_id shape="minus"}} + {{/if}} +
+{{/if}} +

Amortissements

-

+

{{if $linked_amort != null}}
@@ -231,40 +266,5 @@

Aucun amortissement enregistré pour cette immobilisation ; utilisez le bouton « Enregistrer un amortissement » pour enregistrer un nouvel amortissement

{{/if}} -

Avoirs

-

- {{if $total_amort == 0}} - {{:linkbutton label="Attacher une écriture d'avoir" href="link_immo.html?immo_doc_id=%s"|args:$_GET.immo_doc_id shape="link" target="_dialog"}} - {{/if}} -

- -{{if $linked_immos != null}} - - - - - - - - - - {{#foreach from=$linked_immos item="line"}} - {{:assign url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$line.trans_id}} - - - - - - - - {{/foreach}} - -
DateLibelléMontant
#{{$line.trans_id}}{{$line.date|date_short}}{{$line.label}}{{"%f"|math:$line.amount|money_currency_html:false|raw}} - {{if $total_amort == 0}} - {{:linkbutton label="Détacher" href="detach_credit.html?immo_doc_id=%s&credit_line_id=%s"|args:$_GET.immo_doc_id:$line.credit_line_id shape="minus"}} - {{/if}} -
-{{/if}} - {{:form_errors}} {{:admin_footer}} From 4ec6c5b5b3f58fee4b5ac4f8881ddad047f0dbe7 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Fri, 12 Jun 2026 10:32:49 +0200 Subject: [PATCH 4/8] =?UTF-8?q?=C3=80=20classer=20:=20correction=20afficha?= =?UTF-8?q?ge=20lignes=20filtr=C3=A9es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _immobilisations_autres.html | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/_immobilisations_autres.html b/_immobilisations_autres.html index bacef59..0401feb 100644 --- a/_immobilisations_autres.html +++ b/_immobilisations_autres.html @@ -114,7 +114,6 @@ {{:assign var="immo_lines." value=$immo_line}} {{/select}} -{{*:debug lines=$immo_lines nb_lines=$immo_lines|count nb_null=$nb_null nb_managed=$nb_managed nb_ignored=$nb_ignored nb_other=$nb_other unhide=$unhide*}}
@@ -148,7 +147,7 @@ {{else}} {{* vérifier si le libellé aurait pu être filtré *}} {{#foreach from=$module.config.filters item="filter"}} - {{if $filter|strpos:$trans_label !== false}} + {{if $trans_label|strpos:$filter !== false}} {{:assign status="ignored"}} {{/if}} {{/foreach}} From 83c9fcb7cd4acbf7b413eb97eafd382a6d06fc42 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Fri, 12 Jun 2026 11:12:53 +0200 Subject: [PATCH 5/8] Correction erreur message fin attachement avoir --- attach_credit.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/attach_credit.html b/attach_credit.html index 721278d..6e8d22a 100644 --- a/attach_credit.html +++ b/attach_credit.html @@ -107,7 +107,7 @@ {{if $_GET.from == "exit"}} {{:redirect force="exit_step1.html?immo_doc_id=%s&ok=1&msg=attach_avoir"|args:$_GET.immo_doc_id}} {{else}} - {{:redirect force="amortization.html?immo_doc_id=%s&ok=1&msg=attach_credit"|args:$_GET.immo_doc_id}} + {{:redirect force="amortization.html?immo_doc_id=%s&ok=1&msg=attach_avoir"|args:$_GET.immo_doc_id}} {{/if}} {{/form}} From dde5240860a0a065a441c20f3ebdc7c49fd0ad16 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Fri, 12 Jun 2026 11:48:53 +0200 Subject: [PATCH 6/8] =?UTF-8?q?Simplification=20traitement=20immo=20amorti?= =?UTF-8?q?e=20pour=20cas=20suppression=20=C3=A9criture=20amortissement?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- amortization.html | 11 ++--------- save_amort.html | 8 +++----- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/amortization.html b/amortization.html index 5f70eb1..1bb78db 100644 --- a/amortization.html +++ b/amortization.html @@ -29,13 +29,7 @@ {{* déduire le montant des écritures liées à l'immo courante au crédit du même compte *}} {{:include file="_get_credit_lines.html" immo_doc_id=$_GET.immo_doc_id keep="linked_immos, total_credits"}} {{:assign solde="%d-%d"|math:$ligne_immo.amount:$total_credits}} - -{{if $info_immo.status == "amortized"}} - {{:assign amort_amount=$solde}} - {{:assign valeur_residuelle=0}} -{{else}} - {{:assign valeur_residuelle=$solde}} -{{/if}} +{{:assign valeur_residuelle=$solde}} {{* lister les amortissements liés à l'immobilisation *}} {{:include file="./_get_amort_lines.html" immo_doc_id=$_GET.immo_doc_id keep="linked_amort, total_amort, created_amort"}} @@ -122,7 +116,6 @@ {{/if}} -
Immobilisation
@@ -145,7 +138,7 @@ {{/if}} {{if $valeur_residuelle > 0}}
Montant des amortissements
-
{{"%d-%d"|math:$solde:$valeur_residuelle|money_currency_html:false|raw}}
+
{{$total_amort|money_currency_html:false|raw}}
Valeur nette résiduelle
{{$valeur_residuelle|money_currency_html:false|raw}}
{{/if}} diff --git a/save_amort.html b/save_amort.html index c5c8c7b..1705579 100644 --- a/save_amort.html +++ b/save_amort.html @@ -22,10 +22,6 @@ {{/if}} {{:assign var="amort_label" value="Amortissement %s"|args:$amort_label}} -{{if $info_immo.status == "amortized" || $info_immo.status == "archived"}} - {{:error message="Cette immobilisation est complètement amortie ; il est impossible d'ajouter une écriture d'amortissement"}} -{{/if}} - {{* déduire le montant des écritures liées à l'immo courante au crédit du même compte *}} {{:include file="_get_credit_lines.html" immo_doc_id=$_GET.immo_doc_id keep="total_credits"}} {{:assign var="ligne_immo.amount" value="%d-%d"|math:$ligne_immo.amount:$total_credits}} @@ -82,7 +78,9 @@ {{:assign var="years_data.%d"|args:$id value=$ts_debut|cat:" "|cat:$ts_fin}} {{:assign msg_years=$msg_years|cat:"\n"|cat:" - "|cat:$label|cat:" : "|cat:$debut|cat:" à "|cat:$fin}} {{else}} - {{:error message="Aucun exercice ouvert pour enregistrer un amortissement"}} + {{:assign date_debut=$date_debut|date_short}} + {{:assign msg="Pas d'exercice ouvert pour enregistrer un amortissement à partir du %s"|args:$date_debut}} + {{:error message=$msg}} {{/years}} {{* Traiter l'envoi du formulaire *}} From 2b61fba8c16abee594ac2a60dd5822c06bd7205a Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Fri, 12 Jun 2026 12:08:16 +0200 Subject: [PATCH 7/8] =?UTF-8?q?Autres=20amortissements=20:=20afficher=20mo?= =?UTF-8?q?ntant=20non=20affect=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _get_free_amort.html | 1 + 1 file changed, 1 insertion(+) diff --git a/_get_free_amort.html b/_get_free_amort.html index 1e9809e..8a2649b 100644 --- a/_get_free_amort.html +++ b/_get_free_amort.html @@ -41,6 +41,7 @@ {{* pas de ligne d'immo liée à cette ligne d'amort => garder cette ligne d'amortissement *}} {{/load}} {{if $keep_amort && $amort_amount < $amort_line.amount}} + {{:assign var="amort_line.amount" value="%d-%d"|math:$amort_line.amount:$amort_amount}} {{:assign var="free_amort_lines." value=$amort_line}} {{/if}} {{/select}} From d6bcaedd0514ea98e2e1e810befe8aa48f9478fc Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Fri, 12 Jun 2026 12:08:46 +0200 Subject: [PATCH 8/8] =?UTF-8?q?Autres=20amortissements=20:=20filtrer=20uni?= =?UTF-8?q?quement=20sur=20num=C3=A9ro=20compte?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- other_amortizations.html | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/other_amortizations.html b/other_amortizations.html index febaefa..bc5b2c5 100644 --- a/other_amortizations.html +++ b/other_amortizations.html @@ -23,14 +23,7 @@ code_immo=$ligne_immo.account_code keep="code_amort" }} - {{:include file="_get_config.html" keep="module.config"}} - {{:assign account_condition="account.code = "|cat:$code_amort}} - {{:assign filter_condition=$account_condition|cat:" AND NOT ("}} - {{#foreach from=$module.config.filters item="filter"}} - {{:assign filter="%"|cat:$filter|cat:"%"|quote_sql}} - {{:assign filter_condition=$filter_condition|cat:" trans.label LIKE "|cat:$filter|cat:" OR "}} - {{/foreach}} - {{:assign filter_condition=$filter_condition|cat:"0)"}} + {{:assign filter_condition="account.code = "|cat:$code_amort}} {{else}} {{:assign account_filter="28%"|quote_sql}} {{:assign filter_condition="account.code LIKE "|cat:$account_filter}}