Correction problème sécurité CSRF

This commit is contained in:
Jean-Christophe Engel 2026-09-24 13:28:48 +02:00
parent 8667a3643d
commit 20033aaa36
14 changed files with 417 additions and 364 deletions

View file

@ -12,6 +12,24 @@
{{:error message=$message}}
{{/if}}
{{*
Supprimer l'association entre une écriture d'immobilisation et
une écriture au crédit du compte d'immobilisation
*}}
{{#form on="detach_credit"}}
{{:include file="_detach_credit.html" immo_doc_id=$_POST.immo_doc_id credit_line_id=$_POST.detach_credit}}
{{:redirect to="?immo_doc_id=%s&ok=1&msg=detach_avoir"|args:$_POST.immo_doc_id}}
{{/form}}
{{*
Supprimer l'association entre une écriture d'amortissement et
une écriture d'immobilisation
*}}
{{#form on="detach_amort"}}
{{:include file="_detach_amort.html" immo_doc_id=$_POST.immo_doc_id amort_line_id=$_POST.detach_amort}}
{{:redirect to="?immo_doc_id=%s&ok=1&msg=detach_amort"|args:$_POST.immo_doc_id:}}
{{/form}}
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$ligne_immo.trans_id}}
{{:assign date_debut=$info_immo.date_mes|or:$info_immo.date_achat|or:$ligne_immo.date_achat}}
{{:assign label_immo=$info_immo.label|or:$ligne_immo.trans_label}}
@ -169,31 +187,34 @@
{{/if}}
{{if $linked_immos != null}}
<table class="list">
<thead>
<th class="num">N°</th>
<th>Date</th>
<th>Libellé</th>
<th class="nombre">Montant</th>
<th class="actions"></th>
</thead>
<tbody>
{{#foreach from=$linked_immos item="line"}}
{{:assign url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$line.trans_id}}
<tr>
<td class="num"><a href="{{$url}}">#{{$line.trans_id}}</a></td>
<td>{{$line.date|date_short}}</td>
<td>{{$line.label}}</td>
<td class="money">{{"%f"|math:$line.amount|money_currency_html:false|raw}}</td>
<td class="actions">
{{if ! $created_amort}}
{{: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}}
</td>
</tr>
{{/foreach}}
</tbody>
</table>
<form method="post" action="">
<table class="list">
<thead>
<th class="num">N°</th>
<th>Date</th>
<th>Libellé</th>
<th class="nombre">Montant</th>
<th class="actions"></th>
</thead>
<tbody>
{{#foreach from=$linked_immos item="line"}}
{{:assign url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$line.trans_id}}
<tr>
<td class="num"><a href="{{$url}}">#{{$line.trans_id}}</a></td>
<td>{{$line.date|date_short}}</td>
<td>{{$line.label}}</td>
<td class="money">{{"%f"|math:$line.amount|money_currency_html:false|raw}}</td>
<td class="actions">
{{if ! $created_amort}}
{{:button type="submit" name="detach_credit" label="Détacher" shape="minus" value=$line.credit_line_id}}
{{/if}}
</td>
</tr>
{{/foreach}}
</tbody>
</table>
<input type="hidden" id="immo_doc_id" name="immo_doc_id" value="{{$_GET.immo_doc_id}}">
</form>
{{/if}}
<h3 class="ruler">Amortissements</h3>
@ -218,47 +239,50 @@
{{if $linked_amort != null}}
<section class="amortissement">
<table class="list">
<thead>
<tr>
<th class="num">N°</th>
<th>Date</th>
<th>Libellé</th>
<th class="nombre">Montant</th>
<th class="nombre">Valeur nette</th>
<th>N° compte</th>
<th>Compte</th>
<th class="actions"></th>
</tr>
</thead>
<tbody>
{{#foreach from=$linked_amort|ksort item="line"}}
{{* données de l'écriture *}}
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$line.trans_id}}
{{:assign compte_url="%s/acc/accounts/journal.php?id=%s&year=%s"|args:$admin_url:$line.account_id:$line.year}}
{{:assign solde="%f-%d"|math:$solde:$line.amount}}
<form method="post" action="">
<table class="list">
<thead>
<tr>
<td class="num"><a href="{{$trans_url}}">#{{$line.trans_id}}</a></td>
<td>{{$line.date|date_short}}</td>
<td>
{{$line.trans_label}}
{{if $line.line_label != null && $line.line_label != $line.trans_label}}
— {{$line.line_label}}
{{/if}}
</td>
<td class="money">{{"%f"|math:$line.amount|money_html:false|raw}}</td>
<td class="money">{{"%f"|math:$solde|money_html:false|raw}}</td>
<td><a href="{{$compte_url}}">{{$line.account_code}}</a></td>
<td>{{$line.account_label}}</td>
<td class="actions">
{{if ! $created_amort}}
{{:linkbutton label="Détacher" href="detach_amort.html?immo_doc_id=%s&amort_line_id=%s"|args:$_GET.immo_doc_id:$line.line_id shape="minus"}}
{{/if}}
</td>
<th class="num">N°</th>
<th>Date</th>
<th>Libellé</th>
<th class="nombre">Montant</th>
<th class="nombre">Valeur nette</th>
<th>N° compte</th>
<th>Compte</th>
<th class="actions"></th>
</tr>
{{/foreach}}
</tbody>
</table>
</thead>
<tbody>
{{#foreach from=$linked_amort|ksort item="line"}}
{{* données de l'écriture *}}
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$line.trans_id}}
{{:assign compte_url="%s/acc/accounts/journal.php?id=%s&year=%s"|args:$admin_url:$line.account_id:$line.year}}
{{:assign solde="%f-%d"|math:$solde:$line.amount}}
<tr>
<td class="num"><a href="{{$trans_url}}">#{{$line.trans_id}}</a></td>
<td>{{$line.date|date_short}}</td>
<td>
{{$line.trans_label}}
{{if $line.line_label != null && $line.line_label != $line.trans_label}}
— {{$line.line_label}}
{{/if}}
</td>
<td class="money">{{"%f"|math:$line.amount|money_html:false|raw}}</td>
<td class="money">{{"%f"|math:$solde|money_html:false|raw}}</td>
<td><a href="{{$compte_url}}">{{$line.account_code}}</a></td>
<td>{{$line.account_label}}</td>
<td class="actions">
{{if ! $created_amort}}
{{:button type="submit" name="detach_amort" label="Détacher" shape="minus" value=$line.line_id}}
{{/if}}
</td>
</tr>
{{/foreach}}
</tbody>
</table>
<input type="hidden" id="immo_doc_id" name="immo_doc_id" value="{{$_GET.immo_doc_id}}">
</form>
</section>
{{/if}}