Fixes invoice uploads
This commit is contained in:
@@ -297,8 +297,10 @@
|
||||
(mu/log ::trying-to-code-invoice
|
||||
:invoice invoice)
|
||||
(let [db (dc/db auto-ap.datomic/conn)
|
||||
client-id (:invoice/client invoice)
|
||||
vendor-id (:invoice/vendor invoice)
|
||||
client-id (or (:db/id (:invoice/client invoice))
|
||||
(:invoice/client invoice))
|
||||
vendor-id (or (:db/id (:invoice/vendor invoice))
|
||||
(:invoice/vendor invoice))
|
||||
date (:invoice/date invoice)
|
||||
vendor (dc/pull db '[*] vendor-id)
|
||||
due (when (:vendor/terms vendor)
|
||||
|
||||
@@ -184,14 +184,16 @@
|
||||
matches))
|
||||
|
||||
(defn search [context args _]
|
||||
(let [search-query (str "name:(" (cleanse-query (:query args)) ")")]
|
||||
|
||||
(if-let [query (not-empty (cleanse-query (:query args)))]
|
||||
(let [search-query (str "name:(" query ")")]
|
||||
|
||||
|
||||
(for [{:keys [id name]} (solr/query solr/impl "vendors" {"query" (cond-> search-query
|
||||
(not (is-admin? (:id context))) (str " hidden:false"))
|
||||
"fields" "id, name"})]
|
||||
{:id (Long/parseLong id)
|
||||
:name (first name)})))
|
||||
(for [{:keys [id name]} (solr/query solr/impl "vendors" {"query" (cond-> search-query
|
||||
(not (is-admin? (:id context))) (str " hidden:false"))
|
||||
"fields" "id, name"})]
|
||||
{:id (Long/parseLong id)
|
||||
:name (first name)}))
|
||||
[]))
|
||||
|
||||
(def single-thread (ex/fixed-thread-executor 1))
|
||||
|
||||
|
||||
@@ -96,6 +96,7 @@
|
||||
(-> vendor :vendor/default-account :db/id)
|
||||
:invoice-expense-account/location location
|
||||
:invoice-expense-account/amount (Math/abs (Double/parseDouble invoice-total))
|
||||
:db/id (random-tempid)
|
||||
}]})))
|
||||
(filter :invoice/client)
|
||||
(into []))
|
||||
|
||||
Reference in New Issue
Block a user