This commit is contained in:
2021-01-26 08:19:48 -08:00
parent d50f889099
commit c3bea47093
6 changed files with 19 additions and 11 deletions

View File

@@ -316,6 +316,10 @@
invoices-grouped-by-vendor (group-by (comp :db/id :invoice/vendor) invoices)
bank-account (d-bank-accounts/get-by-id bank-account-id)
_ (validate-belonging client-id invoices bank-account)
_ (when (nil? (:bank-account/check-number bank-account))
(let [message (str "The bank account " (:bank-account/name bank-account) " does not have a starting check number. Please ask the integreat staff to initialize it.")]
(throw (ex-info message
{:validation-error message}))))
_ (if (dollars-0? (reduce + 0.0 (filter
#(>= % 0.0)
(map :amount invoice-payments))))

View File

@@ -339,7 +339,7 @@
_ (assert-can-see-client (:id context) (:transaction/client transaction) )
db (d/db conn)
invoice-clients (set (map (comp :db/id :invoice/client #(d/entity db %)) unpaid_invoice_ids))
invoice-amount (reduce + 0.0 (map (comp :invoice/total #(d/entity db %)) unpaid_invoice_ids))]
invoice-amount (reduce + 0.0 (map (comp :invoice/outstanding-balance #(d/entity db %)) unpaid_invoice_ids))]
(when (or (> (count invoice-clients) 1)
(not= (:db/id (:transaction/client transaction))
(first invoice-clients)))