This commit is contained in:
Nicolas Bally 2019-06-24 16:21:27 +02:00
parent 05ed715d34
commit f5aa994832
2 changed files with 2 additions and 3 deletions

View File

@ -30,10 +30,10 @@ class PPaymentDocument < ActiveRecord::Base
if self.p_document
sum = self.siblings_payments_total + self.amount.to_f
sum = self.siblings_payments_total.to_f + self.amount.to_f
if sum > self.p_document.totals[:total_ttc].to_f
if sum.round(2) > self.p_document.totals[:total_ttc].to_f.round(2)
errors.add(:amount, "Ne doit pas dépasser le montant de la somme restant dues (#{self.p_document.totals[:total_ttc].to_f - siblings_payments_total})")
end

View File

@ -1,7 +1,6 @@
#p_payment_form_wrapper
.content
=debug @p_payment.errors.messages
=semantic_form_for [:admin, @p_payment], :remote => true, :html => {:id => "p_payment_general_form",:onsubmit => "$this = $(this); if ($this.data().isSubmitted) { alert('La sauvegarde est en cours, merci de patienter.');return false; } $this.data().isSubmitted = true; return true;"} do |f|
-@p_customer = @p_payment.p_customer if @p_payment.p_customer