Correction erreur conversion montant saisi
This commit is contained in:
parent
d6fd5b4047
commit
b74ef8ae9c
3 changed files with 19 additions and 12 deletions
|
|
@ -77,15 +77,14 @@
|
|||
{{:assign libelle=$_POST.libelle}}
|
||||
{{/if}}
|
||||
|
||||
{{if $_POST.montant == null || $_POST.montant|intval == 0 }}
|
||||
{{if $_POST.montant == null || $_POST.montant|money_int == 0 }}
|
||||
{{if $montant_affecte > 0}}
|
||||
{{:assign montant=$reste}}
|
||||
{{else}}
|
||||
{{:assign montant=null}}
|
||||
{{/if}}
|
||||
{{else}}
|
||||
{{:assign montant=$_POST.montant|intval}}
|
||||
{{:assign montant="%d*100"|math:$montant}}
|
||||
{{:assign montant=$_POST.montant|money_int}}
|
||||
{{if $montant == $reste}}
|
||||
{{:assign montant=null}}
|
||||
{{/if}}
|
||||
|
|
|
|||
|
|
@ -76,8 +76,7 @@
|
|||
{{:assign saved_amount=$reste}}
|
||||
{{/if}}
|
||||
{{else}}
|
||||
{{:assign montant_amort=$_POST.montant|floatval}}
|
||||
{{:assign montant_amort="%f*100"|math:$montant_amort}}
|
||||
{{:assign montant_amort=$_POST.montant|money_int}}
|
||||
{{if $montant_amort > $reste}}
|
||||
{{:assign reste_nb="%f"|math:$reste|money_currency:false}}
|
||||
{{:error message="Le montant de l'amortissement ne peut être supérieur au reste (%s)"|args:$reste_nb}}
|
||||
|
|
@ -85,7 +84,7 @@
|
|||
{{if $montant_amort == $amort_line.amount}}
|
||||
{{:assign saved_amount=null}}
|
||||
{{else}}
|
||||
{{:assign saved_amount=$montant_amort|intval}}
|
||||
{{:assign saved_amount=$montant_amort}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@
|
|||
{{/select}}
|
||||
{{:assign credit_trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$credit_line.credit_trans_id}}
|
||||
|
||||
{{* montant de l'écriture de crédit déjà affecté *}}
|
||||
{{:assign montant_affecte=0}}
|
||||
{{#load type="immo_link" assign="linked_immo."
|
||||
where="$$.credit_line_id = :credit_line_id"
|
||||
|
|
@ -61,16 +62,24 @@
|
|||
|
||||
{{* Traiter l'envoi du formulaire *}}
|
||||
{{#form on="save"}}
|
||||
{{* vérifier que le montant est inférieur au reste *}}
|
||||
{{* vérifier que le montant saisi est inférieur au reste *}}
|
||||
{{if $_POST.montant == null}}
|
||||
{{:assign montant_credit=null}}
|
||||
{{if $montant_affecte == 0}}
|
||||
{{:assign saved_credit=null}}
|
||||
{{else}}
|
||||
{{:assign saved_credit=$reste}}
|
||||
{{/if}}
|
||||
{{else}}
|
||||
{{:assign montant_credit=$_POST.montant|floatval}}
|
||||
{{:assign montant_credit="%f*100"|math:$montant_credit}}
|
||||
{{:assign montant_credit=$_POST.montant|money_int}}
|
||||
{{if $montant_credit > $reste}}
|
||||
{{:assign reste_nb="%f"|math:$reste|money_currency:false}}
|
||||
{{:error message="Le montant de l'avoir ne peut être supérieur au reste (%s)"|args:$reste_nb}}
|
||||
{{/if}}
|
||||
{{if $montant_credit == $credit_line.amount}}
|
||||
{{:assign saved_credit=null}}
|
||||
{{else}}
|
||||
{{:assign saved_credit=$montant_credit}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
{{* chercher les liaisons de l'écriture d'immobilisation *}}
|
||||
|
|
@ -108,7 +117,7 @@
|
|||
type="immo_link"
|
||||
immo_doc_id=$_GET.immo_doc_id|intval
|
||||
credit_line_id=$_GET.credit_line_id|intval
|
||||
amount=$montant_credit|intval
|
||||
amount=$saved_credit
|
||||
}}
|
||||
|
||||
{{:redirect force="details_immo.html?immo_doc_id=%s&ok=1&msg=attach_immo"|args:$_GET.immo_doc_id}}
|
||||
|
|
@ -143,7 +152,7 @@
|
|||
<form method="post" action="" data-focus="1">
|
||||
<fieldset>
|
||||
<dl>
|
||||
{{:input type="money" name="montant" label="Montant" help="Montant de l'avoir ; à renseigner uniquement si différent du montant de l'écriture"}}
|
||||
{{:input type="money" name="montant" label="Montant" default=$reste help="Montant de l'avoir"}}
|
||||
</dl>
|
||||
</fieldset>
|
||||
<p class="submit">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue