logging updates, makes invoice voiding trigger refresh of running balances.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
(ns iol-ion.tx.upsert-invoice
|
||||
(:import [java.util Date])
|
||||
(:require [datomic.api :as dc]))
|
||||
|
||||
(defn -remove-nils [m]
|
||||
@@ -74,8 +75,15 @@
|
||||
(:db/id invoice))
|
||||
journal-entry (invoice->journal-entry (:db-after with-invoice)
|
||||
invoice-id
|
||||
(:db/id invoice))]
|
||||
(:db/id invoice))
|
||||
client-id (-> (dc/pull (:db-after with-invoice)
|
||||
[{:invoice/client [:db/id]}]
|
||||
invoice-id)
|
||||
:invoice/client
|
||||
:db/id)]
|
||||
(into upserted-entity
|
||||
(if journal-entry
|
||||
[[:upsert-ledger journal-entry]]
|
||||
[[:db/retractEntity [:journal-entry/original-entity (:db/id invoice)]]]))))
|
||||
[[:db/retractEntity [:journal-entry/original-entity (:db/id invoice)]]
|
||||
{:db/id client-id
|
||||
:client/ledger-last-change (Date.)}]))))
|
||||
|
||||
Reference in New Issue
Block a user