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
|
|
|
|
}}
|
2024-12-17 10:15:30 +01:00
|
|
|
{{:assign immo_trans_id=$id_transaction}}
|
2024-02-29 19:07:52 +01:00
|
|
|
{{else}}
|
2024-12-17 10:15:30 +01:00
|
|
|
{{:error message="Impossible de trouver l'écriture d'immobilisation de la ligne « %s »"|args:$_GET.immo_id}}
|
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}}
|
2024-12-17 10:15:30 +01:00
|
|
|
{{:error message="Impossible de trouver l'écriture d'amortissement de la ligne « %s »"|args:$_GET.amort_id}}
|
2024-03-19 15:24:01 +01:00
|
|
|
{{/select}}
|
2024-02-29 19:07:52 +01:00
|
|
|
|
2024-03-21 09:30:01 +01:00
|
|
|
{{* chercher les liaisons de l'écriture d'immobilisation *}}
|
2024-03-19 15:24:01 +01:00
|
|
|
{{#select
|
2024-12-17 10:15:30 +01:00
|
|
|
CASE links.id_related = :immo_trans_id
|
2024-03-19 15:24:01 +01:00
|
|
|
WHEN true THEN links.id_transaction
|
|
|
|
WHEN false THEN links.id_related
|
|
|
|
END as linked_id
|
|
|
|
FROM acc_transactions_links as links
|
2024-12-17 10:15:30 +01:00
|
|
|
WHERE id_transaction = :immo_trans_id or id_related = :immo_trans_id;
|
|
|
|
:immo_trans_id = $immo_trans_id
|
2024-03-19 15:24:01 +01:00
|
|
|
}}
|
|
|
|
{{: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"
|
2024-12-17 10:15:30 +01:00
|
|
|
path="accounting/transaction/%s/transactions"|args:$immo_trans_id
|
2024-03-19 15:24:01 +01:00
|
|
|
assign="result"
|
|
|
|
assign_code="result_code"
|
2024-03-21 09:30:01 +01:00
|
|
|
transactions=$linked_transactions
|
2024-02-29 19:07:52 +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}}
|