mirror of
https://github.com/we-promise/sure.git
synced 2026-05-09 21:54:58 +00:00
feat(entries): Add amount validation and robustify monetizable concern (#1680)
* feat(entries): Add amount validation and robustify monetizable concern * fix(valuations): localize blank amount errors --------- Co-authored-by: sentry[bot] <39604003+sentry[bot]@users.noreply.github.com> Co-authored-by: SureBot <sure-bot@we-promise.com>
This commit is contained in:
@@ -7,6 +7,12 @@ class ValuationsController < ApplicationController
|
||||
|
||||
@entry = @account.entries.build(entry_params.merge(currency: @account.currency))
|
||||
|
||||
if entry_params[:amount].blank?
|
||||
@error_message = t("valuations.errors.amount_required")
|
||||
render :new, status: :unprocessable_entity
|
||||
return
|
||||
end
|
||||
|
||||
@reconciliation_dry_run = @entry.account.create_reconciliation(
|
||||
balance: entry_params[:amount],
|
||||
date: entry_params[:date],
|
||||
@@ -21,6 +27,13 @@ class ValuationsController < ApplicationController
|
||||
return unless require_account_permission!(@entry.account)
|
||||
|
||||
@account = @entry.account
|
||||
|
||||
if entry_params[:amount].blank?
|
||||
@error_message = t("valuations.errors.amount_required")
|
||||
render :show, status: :unprocessable_entity
|
||||
return
|
||||
end
|
||||
|
||||
@entry.assign_attributes(entry_params.merge(currency: @account.currency))
|
||||
|
||||
@reconciliation_dry_run = @entry.account.update_reconciliation(
|
||||
|
||||
Reference in New Issue
Block a user