2024-02-29 19:07:52 +01:00
|
|
|
{{* -*- brindille -*- *}}
|
|
|
|
|
|
|
|
{{*
|
2024-03-19 15:24:01 +01:00
|
|
|
Enregistrer la liaison entre une écriture d'amortissement et
|
2024-02-29 19:07:52 +01:00
|
|
|
l'écriture d'immobilisation correspondante
|
|
|
|
*}}
|
|
|
|
|
2024-03-19 15:24:01 +01:00
|
|
|
{{* chercher l'écriture d'immobilisation *}}
|
|
|
|
{{#select
|
|
|
|
id_transaction
|
|
|
|
FROM acc_transactions_lines
|
|
|
|
WHERE id = :line_id;
|
|
|
|
:line_id = $_GET.immo_id|intval
|
|
|
|
}}
|
|
|
|
{{:assign immo_id=$id_transaction}}
|
2024-02-29 19:07:52 +01:00
|
|
|
{{else}}
|
2024-03-19 15:24:01 +01:00
|
|
|
{{* TODO : améliorer le message d'erreur *}}
|
|
|
|
{{:assign message="Impossible de trouver l'écriture d'immobilisation de la ligne « %s »"|args:$_GET.immo_id}}
|
2024-02-29 19:07:52 +01:00
|
|
|
{{:error message=$message}}
|
2024-03-19 15:24:01 +01:00
|
|
|
{{/select}}
|
2024-02-29 19:07:52 +01:00
|
|
|
|
2024-03-19 15:24:01 +01:00
|
|
|
{{* chercher l'écriture d'amortissement *}}
|
|
|
|
{{#select
|
|
|
|
id_transaction
|
|
|
|
FROM acc_transactions_lines
|
|
|
|
WHERE id = :line_id;
|
|
|
|
:line_id = $_GET.amort_id|intval
|
|
|
|
}}
|
|
|
|
{{:assign amort_id=$id_transaction}}
|
|
|
|
{{else}}
|
|
|
|
{{* TODO : améliorer le message d'erreur *}}
|
|
|
|
{{:assign message="Impossible de trouver l'écriture d'amortissement de la ligne « %s »"|args:$_GET.amort_id}}
|
|
|
|
{{:error message=$message}}
|
|
|
|
{{/select}}
|
2024-02-29 19:07:52 +01:00
|
|
|
|
2024-03-19 15:24:01 +01:00
|
|
|
{{* checher les liaisons de l'écriture d'immobilisation *}}
|
|
|
|
{{#select
|
|
|
|
CASE links.id_related = :immo_id
|
|
|
|
WHEN true THEN links.id_transaction
|
|
|
|
WHEN false THEN links.id_related
|
|
|
|
END as linked_id
|
|
|
|
FROM acc_transactions_links as links
|
|
|
|
WHERE id_transaction = :immo_id or id_related = :immo_id;
|
|
|
|
:immo_id = $immo_id
|
|
|
|
}}
|
|
|
|
{{:assign var="linked_transactions." value=$linked_id}}
|
|
|
|
{{/select}}
|
2024-02-29 19:07:52 +01:00
|
|
|
|
2024-03-19 15:24:01 +01:00
|
|
|
{{* ajouter la nouvelle liaison *}}
|
|
|
|
{{:assign var="linked_transactions." value=$amort_id}}
|
2024-02-29 19:07:52 +01:00
|
|
|
|
2024-03-19 15:24:01 +01:00
|
|
|
{{* Enregistrer les liaisons *}}
|
|
|
|
{{:api
|
|
|
|
method="POST"
|
|
|
|
path="accounting/transaction/%s/transactions"|args:$immo_id
|
|
|
|
assign="result"
|
|
|
|
assign_code="result_code"
|
|
|
|
linked_transactions=$linked_transactions
|
2024-02-29 19:07:52 +01:00
|
|
|
}}
|
2024-03-19 15:24:01 +01:00
|
|
|
|
2024-03-14 11:03:54 +01:00
|
|
|
{{:redirect to="amortization.html?immo_id=%s&ok=1&msg=attach"|args:$_GET.immo_id}}
|