imports invoices one at a time to avoid duplicating them
This commit is contained in:
@@ -4,6 +4,9 @@
|
||||
(:import [java.util UUID]))
|
||||
|
||||
(def random-tempid iol-ion.utils/random-tempid)
|
||||
(defn composite-tempid [& pieces]
|
||||
(format "hashed-%d" (.hashCode (set pieces))))
|
||||
|
||||
(def by iol-ion.utils/by)
|
||||
(def pull-many iol-ion.utils/pull-many)
|
||||
(def remove-nils iol-ion.utils/remove-nils)
|
||||
|
||||
@@ -168,7 +168,7 @@
|
||||
:content
|
||||
first
|
||||
Double/parseDouble)
|
||||
invoice {:db/id (random-tempid)
|
||||
invoice {:db/id (random-tempid )
|
||||
:invoice/vendor :vendor/cintas
|
||||
:invoice/import-status :import-status/imported
|
||||
:invoice/status :invoice-status/unpaid
|
||||
@@ -268,7 +268,8 @@
|
||||
(mark-error k)
|
||||
[]))))
|
||||
(into []))]
|
||||
(audit-transact transaction {:user/name "sysco importer" :user/role "admin"})
|
||||
(doseq [t transaction]
|
||||
(audit-transact [t] {:user/name "sysco importer" :user/role "admin"}))
|
||||
(log/info ::success
|
||||
:count (count transaction)
|
||||
:sample (take 3 transaction)))
|
||||
|
||||
@@ -136,8 +136,8 @@
|
||||
|
||||
(defn import->invoice [{:keys [invoice-number source-url customer-identifier account-number total date vendor-code text full-text client-override vendor-override location-override import-status]}]
|
||||
(let [matching-client (cond
|
||||
account-number (d-clients/exact-match account-number)
|
||||
customer-identifier (d-clients/best-match customer-identifier)
|
||||
account-number (:db/id (d-clients/exact-match account-number))
|
||||
customer-identifier (:db/id (d-clients/best-match customer-identifier))
|
||||
client-override (Long/parseLong client-override))
|
||||
|
||||
matching-vendor (match-vendor vendor-code vendor-override)
|
||||
|
||||
Reference in New Issue
Block a user