diff --git a/src/clj/auto_ap/ssr/invoice/new_invoice_wizard.clj b/src/clj/auto_ap/ssr/invoice/new_invoice_wizard.clj index ce1c7af3..d7062aef 100644 --- a/src/clj/auto_ap/ssr/invoice/new_invoice_wizard.clj +++ b/src/clj/auto_ap/ssr/invoice/new_invoice_wizard.clj @@ -290,7 +290,7 @@ :errors (fc/field-errors)} [:div {:class "w-24"} (com/text-input {:value (-> (fc/field-value)) - :disabled (boolean (-> request :multi-form-state :snapshot :db/id)) + #_#_:disabled (boolean (-> request :multi-form-state :snapshot :db/id)) :name (fc/field-name) :error? (fc/field-errors) :placeholder "HA-123"})])) @@ -572,10 +572,11 @@ :validation-route ::route/new-wizard-navigate))) -(defn assert-no-conflicting [{:invoice/keys [invoice-number client vendor]}] +(defn assert-no-conflicting [{:invoice/keys [invoice-number client vendor] :db/keys [id]}] (when (seq (d-invoices/find-conflicting {:invoice/invoice-number invoice-number :invoice/vendor (->db-id vendor) - :invoice/client (->db-id client)})) + :invoice/client (->db-id client) + :db/id id})) (form-validation-error (str "Invoice '" invoice-number "' already exists.")))) @@ -724,8 +725,7 @@ (update :invoice/due coerce/to-date) (update :invoice/scheduled-payment coerce/to-date))]] (assert-invoice-amounts-add-up (second transaction)) - (when-not extant? - (assert-no-conflicting invoice)) + (assert-no-conflicting invoice) (exception->4xx #(assert-can-see-client (:identity request) client-id)) (exception->4xx #(assert-not-locked client-id (:invoice/date invoice)))