From a3b1b44fce50557974386789a1222cf9d9c3554f Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Mon, 26 Oct 2026 12:15:26 +0100 Subject: [PATCH] =?UTF-8?q?Ajout=20mise=20=C3=A0=20jour=20des=20liens?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _remove_orphan_docs.tpl | 2 +- _upgrade.html | 15 +++++++++++++++ _upgrade_to042.tpl | 41 +++++++++++++++++++++++++++++++++++++++++ index.html | 2 +- link.schema.json | 2 +- module.ini | 2 +- 6 files changed, 60 insertions(+), 4 deletions(-) create mode 100644 _upgrade_to042.tpl diff --git a/_remove_orphan_docs.tpl b/_remove_orphan_docs.tpl index a2ba62a..2f08dc3 100644 --- a/_remove_orphan_docs.tpl +++ b/_remove_orphan_docs.tpl @@ -2,11 +2,11 @@ {{if $module.table}} {{* supprimer les documents sans écriture associée *}} + {{:assign var="docs." type="immo" field="line"}} {{:assign var="docs." type="amort_link" field="line_id"}} {{:assign var="docs." type="credit_link" field="line_id"}} {{:assign var="docs." type="cession_link" field="line_id"}} {{:assign var="docs." type="exit_link" field="line_id"}} - {{:assign var="docs." type="immo" field="line"}} {{#foreach from=$docs}} diff --git a/_upgrade.html b/_upgrade.html index 54429ca..bec8d40 100644 --- a/_upgrade.html +++ b/_upgrade.html @@ -34,6 +34,21 @@

Mise à jour vers version {{$tag}} terminée

{{/if}} +{{* version 0.42 *}} +{{:assign tag="0.42"}} + +{{:include file="_compare_version.tpl" nv1=$module_version nv2=$tag keep="comp"}} +{{:assign module_comp=$comp}} +{{:include file="_compare_version.tpl" nv1=$module.config.version nv2=$tag keep="comp"}} +{{:assign config_comp=$comp}} + +{{if $module_comp >= 0 && $config_comp < 0}} +{{* $module_version >= '0.42' && $module.config.version < '0.42' *}} + + {{:include file="_upgrade_to042.tpl"}} +

Mise à jour vers version {{$tag}} terminée

+{{/if}} + {{* enregistrer le nouveau numéro de version dans la config du module *}} {{:include file="_compare_version.tpl" nv1=$module_version nv2=$module.config.version keep="comp"}} {{if $comp > 0}} diff --git a/_upgrade_to042.tpl b/_upgrade_to042.tpl new file mode 100644 index 0000000..437f223 --- /dev/null +++ b/_upgrade_to042.tpl @@ -0,0 +1,41 @@ +{{* -*- brindille -*- *}} + +{{* remplacer xxx_line_id par line_id pour simplifier et mutualiser le code *}} + +{{:assign var="link_types." type="amort"}} +{{:assign var="link_types." type="credit"}} +{{:assign var="link_types." type="cession"}} +{{:assign var="link_types." type="exit"}} + +{{* lister les liens actuels *}} +{{#foreach from=$link_types}} + {{:assign link_type=$type|cat:"_link"}} + {{:assign line_id=$type|cat:"_line_id"}} + {{#load type=$link_type assign="link"}} + {{:assign new_link=null}} + {{:assign var="new_link.key value=$link.key}} + {{:assign var="new_link.type" value=$link.type}} + {{:assign var="new_link.immo_doc_id" value=$link.immo_doc_id}} + {{:assign var="new_link.line_id" from="link.%s"|args:$line_id}} + {{:assign var="new_link.amount" value=$link.amount}} + {{:assign var="new_link.created" value=$link.created}} + {{* mémoriser les infos des docs *}} + {{:assign var="new_links." value=$new_link}} + {{/load}} + {{:delete type=$link_type}} +{{/foreach}} + +{{* créer les nouveaux documents de liaisons *}} +{{:assign nb_links=0}} +{{#foreach from=$new_links item="link"}} + {{:save + key=$link.key + type=$link.type + immo_doc_id=$link.immo_doc_id + line_id=$link.line_id + amount=$link.amount + created=$link.created + }} + {{:assign nb_links="%d+1"|math:$nb_links}} +{{/foreach}} +

Nombre de liens modifiés : {{$nb_links}}

diff --git a/index.html b/index.html index 0bdbff8..06ab7e4 100644 --- a/index.html +++ b/index.html @@ -21,7 +21,7 @@ {{:include file="_nav.html" current=$type_immo}} {{* Mise à niveau *}} -{{:assign module_version="0.41"}} +{{:assign module_version="0.42"}} {{:include file="_upgrade.html" module_version=$module_version}} {{* supprimer les documents sans écriture associée *}} diff --git a/link.schema.json b/link.schema.json index 048e9d8..f9f21f6 100644 --- a/link.schema.json +++ b/link.schema.json @@ -13,7 +13,7 @@ "exclusiveMinimum": 0 }, "line_id" : { - "description": "ligne associée à l'immobilisation", + "description": "ligne d'écriture associée à l'immobilisation", "type": "integer", "exclusiveMinimum": 0 }, diff --git a/module.ini b/module.ini index d6cad20..73633af 100644 --- a/module.ini +++ b/module.ini @@ -1,5 +1,5 @@ name="Amortissements" -description="Immobilisations et amortissements\nversion 0.41.3" +description="Immobilisations et amortissements\nversion 0.42" author="Jean-Christophe Engel" author_url="https://gitea.zaclys.com/lesanges" home_button=false