fixing several issues.
This commit is contained in:
@@ -68,7 +68,7 @@
|
|||||||
(:sort-by args) (sort-by (sort-fn args))
|
(:sort-by args) (sort-by (sort-fn args))
|
||||||
(= (:asc args) false) (reverse)
|
(= (:asc args) false) (reverse)
|
||||||
true (drop (:start args 0))
|
true (drop (:start args 0))
|
||||||
true (take (:count args 20)))))
|
true (take (:count args 100)))))
|
||||||
|
|
||||||
(defn count-graphql [args]
|
(defn count-graphql [args]
|
||||||
(->> (raw-graphql args)
|
(->> (raw-graphql args)
|
||||||
|
|||||||
@@ -65,7 +65,7 @@
|
|||||||
(:sort-by args) (sort-by (sort-fn args))
|
(:sort-by args) (sort-by (sort-fn args))
|
||||||
(= (:asc args) false) (reverse)
|
(= (:asc args) false) (reverse)
|
||||||
true (drop (:start args 0))
|
true (drop (:start args 0))
|
||||||
true (take (:count args 20)))))
|
true (take (:count args 100)))))
|
||||||
|
|
||||||
(defn count-graphql [args]
|
(defn count-graphql [args]
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@
|
|||||||
(:sort-by args) (sort-by (sort-fn args))
|
(:sort-by args) (sort-by (sort-fn args))
|
||||||
(= (:asc args) false) (reverse)
|
(= (:asc args) false) (reverse)
|
||||||
true (drop (:start args 0))
|
true (drop (:start args 0))
|
||||||
true (take (:count args 20)))))
|
true (take (:count args 100)))))
|
||||||
|
|
||||||
(defn count-graphql [args]
|
(defn count-graphql [args]
|
||||||
|
|
||||||
|
|||||||
@@ -71,7 +71,7 @@
|
|||||||
(:sort-by args) (sort-by (sort-fn args))
|
(:sort-by args) (sort-by (sort-fn args))
|
||||||
(= (:asc args) false) (reverse)
|
(= (:asc args) false) (reverse)
|
||||||
true (drop (:start args 0))
|
true (drop (:start args 0))
|
||||||
true (take (:count args 20)))))
|
true (take (:count args 100)))))
|
||||||
|
|
||||||
(defn count-graphql [args]
|
(defn count-graphql [args]
|
||||||
|
|
||||||
|
|||||||
@@ -339,7 +339,8 @@
|
|||||||
(let [check (d-checks/get-by-id id)]
|
(let [check (d-checks/get-by-id id)]
|
||||||
(assert (or (= :payment-status/pending (:payment/status check))
|
(assert (or (= :payment-status/pending (:payment/status check))
|
||||||
(#{:payment-type/cash :payment-type/debit} (:payment/type check))))
|
(#{:payment-type/cash :payment-type/debit} (:payment/type check))))
|
||||||
(assert-can-see-client (:id context) (:client-id check))
|
(println "VOID CHECK" check)
|
||||||
|
(assert-can-see-client (:id context) (:db/id (:payment/client check)))
|
||||||
(let [removing-payments (mapcat (fn [x]
|
(let [removing-payments (mapcat (fn [x]
|
||||||
(let [invoice (:invoice-payment/invoice x)
|
(let [invoice (:invoice-payment/invoice x)
|
||||||
new-balance (+ (:invoice/outstanding-balance invoice)
|
new-balance (+ (:invoice/outstanding-balance invoice)
|
||||||
|
|||||||
@@ -82,7 +82,7 @@
|
|||||||
|
|
||||||
(defn void-invoice [context {id :invoice_id} value]
|
(defn void-invoice [context {id :invoice_id} value]
|
||||||
(let [invoice (d-invoices/get-by-id id)
|
(let [invoice (d-invoices/get-by-id id)
|
||||||
_ (assert-can-see-client (:id context) (:client-id invoice))
|
_ (assert-can-see-client (:id context) (:db/id (:invoice/client invoice)))
|
||||||
updated-invoice (d-invoices/update {:db/id id
|
updated-invoice (d-invoices/update {:db/id id
|
||||||
:invoice/total 0.0
|
:invoice/total 0.0
|
||||||
:invoice/outstanding-balance 0.0
|
:invoice/outstanding-balance 0.0
|
||||||
|
|||||||
@@ -48,6 +48,8 @@
|
|||||||
(throw-unauthorized)))
|
(throw-unauthorized)))
|
||||||
|
|
||||||
(defn can-see-client? [identity client]
|
(defn can-see-client? [identity client]
|
||||||
|
(when (not client)
|
||||||
|
(println "WARNING - permission checking for null client"))
|
||||||
(or (= "admin" (:user/role identity))
|
(or (= "admin" (:user/role identity))
|
||||||
((set (map :db/id (:user/clients identity))) (:db/id client))
|
((set (map :db/id (:user/clients identity))) (:db/id client))
|
||||||
((set (map :db/id (:user/clients identity))) client)))
|
((set (map :db/id (:user/clients identity))) client)))
|
||||||
|
|||||||
@@ -47,7 +47,7 @@
|
|||||||
[:expense_accounts [:amount :id :expense_account_id :location
|
[:expense_accounts [:amount :id :expense_account_id :location
|
||||||
[:expense_account [:id :name :location [:parent [:id :name]]]]]]
|
[:expense_account [:id :name :location [:parent [:id :name]]]]]]
|
||||||
[:client [:name :id :locations]]
|
[:client [:name :id :locations]]
|
||||||
[:payments [:amount [:payment [:amount :s3_url :check_number ]]]]
|
[:payments [:amount :id [:payment [:id :amount :s3_url :check_number ]]]]
|
||||||
]]
|
]]
|
||||||
:total
|
:total
|
||||||
:start
|
:start
|
||||||
|
|||||||
Reference in New Issue
Block a user