scrubbed all reference to datomic.api
This commit is contained in:
@@ -99,10 +99,12 @@
|
||||
due (or (and (:vendor/terms vendor)
|
||||
(coerce/to-date
|
||||
(time/plus date (time/days (d-vendors/terms-for-client-id vendor client_id)))))
|
||||
due)
|
||||
due
|
||||
nil)
|
||||
scheduled_payment (or scheduled_payment
|
||||
(and (d-vendors/automatically-paid-for-client-id? vendor client_id)
|
||||
due))
|
||||
due)
|
||||
nil)
|
||||
_ (when-not (:db/id account)
|
||||
(throw (ex-info (str "Vendor '" (:vendor/name vendor) "' does not have a default expense acount.") {:vendor-id vendor_id})))]
|
||||
|
||||
@@ -123,7 +125,9 @@
|
||||
(defn assert-valid-expense-accounts [expense_accounts vendor_id]
|
||||
(doseq [expense-account expense_accounts
|
||||
:let [account (dc/pull (dc/db conn)
|
||||
[:account/location]
|
||||
[:db/id
|
||||
:account/location
|
||||
{:account/invoice-allowance [:db/ident]}]
|
||||
(:account_id expense-account))]]
|
||||
(when (empty? (:location expense-account))
|
||||
(throw (ex-info "Expense account is missing location" {:validation-error "Expense account is missing location"})))
|
||||
@@ -136,8 +140,8 @@
|
||||
{:validation-error err}))))
|
||||
|
||||
(when (and (= :allowance/denied
|
||||
(:account/invoice-allowance account))
|
||||
(not= (pull-ref (dc/db conn) vendor_id :vendor/default-account)
|
||||
(:db/ident (:account/invoice-allowance account)))
|
||||
(not= (pull-ref (dc/db conn) :vendor/default-account vendor_id )
|
||||
(:db/id account)))
|
||||
(let [err (str "Account isn't allowed for invoice use.")]
|
||||
(throw (ex-info err
|
||||
@@ -171,7 +175,7 @@
|
||||
(assert-valid-expense-accounts expense_accounts vendor_id)
|
||||
(assert-invoice-amounts-add-up in)
|
||||
|
||||
(let [transaction-result (transact-with-ledger (add-invoice-transaction in) (:id context))]
|
||||
(let [transaction-result (transact-with-ledger [(add-invoice-transaction in)] (:id context))]
|
||||
(-> (d-invoices/get-by-id (get-in transaction-result [:tempids "invoice"]))
|
||||
(->graphql (:id context)))))
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
(ns auto-ap.graphql.transaction-rules
|
||||
(:require
|
||||
[auto-ap.datomic :refer [audit-transact conn merge-query upsert-entity]]
|
||||
[auto-ap.datomic :refer [audit-transact conn merge-query upsert-entity random-tempid]]
|
||||
[auto-ap.datomic.transaction-rules :as tr]
|
||||
[auto-ap.datomic.transactions :as d-transactions]
|
||||
[auto-ap.graphql.utils
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
(defn transaction-rule-account->entity [{:keys [id account_id percentage location]}]
|
||||
#:transaction-rule-account {:percentage percentage
|
||||
:db/id id
|
||||
:db/id (or id (random-tempid))
|
||||
:account account_id
|
||||
:location location})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user