Skip to content

Commit

Permalink
factor merge errors into locales file for further edits; fixes 186107419
Browse files Browse the repository at this point in the history
  • Loading branch information
armandofox committed Dec 20, 2023
1 parent 416c136 commit 552af09
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/models/customer/merge.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ def merge_automatically!(c1)

def mergeable_with?(other)
if other.special_customer? || self.is_admin || other.is_admin
self.errors.add :base,"Special customers and super admins cannot be merged"
self.errors.add :base, I18n.translate('customers.errors.merge.admin')
elsif (self.special_customer? && self != Customer.anonymous_customer)
self.errors.add :base,"Merges disallowed into all special customers except Anonymous customer"
self.errors.add :base, I18n.translate('customers.errors.merge.special')
end
self.errors.empty?
end
Expand Down
2 changes: 1 addition & 1 deletion app/views/vouchertypes/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
.col-md-2= select_tag 'season', options_for_seasons(3.years.ago.year,2.years.from_now.year,@season), :onchange => 'this.form.submit();', :class => 'form-control'

- if @vouchertypes.empty?
.alert.alert-secondary.text-center= t('season_setup.errors.no_vouchertypes_exist', :season => @season)
.alert.alert-secondary.text-center= t('season_setup.errors.no_vouchertypes_exist', :season => Option.humanize_season(@season))
- else
.row
.col-md-4.form-group
Expand Down
5 changes: 5 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,11 @@ en:
customers:

errors:
merge:
admin: Special customers and super admins cannot be merged
special: Merges disallowed into all special customers except Anonymous Customer

confirm_delete: >
Selected customer(s) will be PERMANENTLY deleted, and their transactions will be linked
to the Anonymous Customer. This action CANNOT BE UNDONE. OK to proceed?
Expand Down

0 comments on commit 552af09

Please sign in to comment.