Fixes issue where the db/id of a temporary id is different from the real one.

Cash payments always match invoices.
This commit is contained in:
2022-09-30 05:49:43 -07:00
parent d6d1dfaf22
commit a206116ba8
2 changed files with 10 additions and 6 deletions

View File

@@ -425,7 +425,7 @@
(defn transact-with-ledger [transaction id]
(let [db (d/db conn)
tx (d/with db transaction)
tx (audit-transact transaction id)
affected-entities (->> (:tx-data tx)
(map (fn [^datomic.db.Datum x]
{:e (:e x)
@@ -439,9 +439,11 @@
(map #(entity-change->ledger (:db-after tx) %))
(filter seq))
retractions (map (fn [[_ e]] [:db/retractEntity [:journal-entry/original-entity e]]) affected-entities)]
(audit-transact retractions id)
(audit-transact (into transaction ledger-txs) id)))
(when (seq retractions)
(audit-transact retractions id))
(when (seq ledger-txs)
(audit-transact ledger-txs id))
tx))
(defn transact-batch-with-ledger [txes id]
(let [batch-id (.toString (java.util.UUID/randomUUID))]