no need for ledger automation.
This commit is contained in:
@@ -1,28 +1,31 @@
|
||||
(ns auto-ap.routes.invoices
|
||||
(:require [auto-ap.datomic :refer [remove-nils uri conn]]
|
||||
[auto-ap.datomic.clients :as d-clients]
|
||||
[auto-ap.datomic.invoices :as d-invoices]
|
||||
[auto-ap.datomic.accounts :as a]
|
||||
[auto-ap.datomic.vendors :as d-vendors]
|
||||
[auto-ap.graphql.utils :refer [assert-admin assert-can-see-client]]
|
||||
[auto-ap.import.manual :as manual]
|
||||
[auto-ap.import.manual.common :as c]
|
||||
[auto-ap.parse :as parse]
|
||||
[auto-ap.routes.utils :refer [wrap-secure]]
|
||||
[auto-ap.utils :refer [by]]
|
||||
[clj-time.coerce :as coerce :refer [to-date]]
|
||||
[clojure.data.csv :as csv]
|
||||
[clojure.java.io :as io]
|
||||
[clojure.string :as str]
|
||||
[clojure.tools.logging :as log]
|
||||
[compojure.core :refer [context defroutes POST wrap-routes]]
|
||||
[datomic.api :as d]
|
||||
[ring.middleware.json :refer [wrap-json-response]]
|
||||
[unilog.context :as lc]
|
||||
[amazonica.aws.s3 :as s3]
|
||||
[config.core :refer [env]]
|
||||
[digest])
|
||||
(:import java.util.UUID))
|
||||
(:require
|
||||
[amazonica.aws.s3 :as s3]
|
||||
[auto-ap.datomic :refer [conn remove-nils uri]]
|
||||
[auto-ap.datomic.accounts :as a]
|
||||
[auto-ap.datomic.clients :as d-clients]
|
||||
[auto-ap.datomic.invoices :as d-invoices]
|
||||
[auto-ap.datomic.vendors :as d-vendors]
|
||||
[auto-ap.graphql.utils :refer [assert-admin assert-can-see-client]]
|
||||
[auto-ap.import.manual :as manual]
|
||||
[auto-ap.import.manual.common :as c]
|
||||
[auto-ap.ledger :refer [transact-with-ledger]]
|
||||
[auto-ap.parse :as parse]
|
||||
[auto-ap.routes.utils :refer [wrap-secure]]
|
||||
[auto-ap.utils :refer [by]]
|
||||
[clj-time.coerce :as coerce :refer [to-date]]
|
||||
[clojure.data.csv :as csv]
|
||||
[clojure.java.io :as io]
|
||||
[clojure.string :as str]
|
||||
[clojure.tools.logging :as log]
|
||||
[compojure.core :refer [context defroutes POST wrap-routes]]
|
||||
[config.core :refer [env]]
|
||||
[datomic.api :as d]
|
||||
[digest]
|
||||
[ring.middleware.json :refer [wrap-json-response]]
|
||||
[unilog.context :as lc])
|
||||
(:import
|
||||
(java.util UUID)))
|
||||
|
||||
(defn reset-id [i]
|
||||
(update i :invoice-number
|
||||
@@ -270,7 +273,7 @@
|
||||
(throw (ex-info "No new invoices found."
|
||||
{})))
|
||||
(log/info "creating invoice" potential-invoices)
|
||||
@(d/transact (d/connect uri) potential-invoices))))
|
||||
(transact-with-ledger potential-invoices user))))
|
||||
|
||||
(defn validate-account-rows [rows code->existing-account]
|
||||
(when-let [bad-types (seq (->> rows
|
||||
@@ -380,7 +383,7 @@
|
||||
conj
|
||||
[]
|
||||
rows)]
|
||||
@(d/transact (d/connect uri) txes)))
|
||||
(transact-with-ledger txes nil)))
|
||||
|
||||
(defroutes routes
|
||||
(wrap-routes
|
||||
@@ -472,8 +475,9 @@
|
||||
(not= "Cash" (:check %))))
|
||||
(map :vendor-name)
|
||||
set)
|
||||
_ @(d/transact (d/connect uri) (invoice-rows->transaction (:new grouped-rows)
|
||||
user))]
|
||||
_ (transact-with-ledger (invoice-rows->transaction (:new grouped-rows)
|
||||
user)
|
||||
user)]
|
||||
{:status 200
|
||||
:body (pr-str {:imported (count (:new grouped-rows))
|
||||
:already-imported (count (:exists grouped-rows))
|
||||
|
||||
Reference in New Issue
Block a user