Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

close #2198 fix could not create new promotion #2199

Merged
merged 1 commit into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion app/models/spree_cm_commissioner/promotion_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ def setup_auto_apply_promotion
end

def auto_apply?
auto_apply.in?([true, 'true', '1'])
if auto_apply.present?
auto_apply.in?([true, 'true', '1'])
else
code.nil? && path.nil?
end
end

def date_eligible?(date)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<%= f.field_container :auto_apply, class: ['checkbox'] do %>
<%= f.label :auto_apply do %>
<%= f.check_box :auto_apply, checked: f.object.code.nil? && f.object.path.nil? %>
<%= f.check_box :auto_apply, checked: f.object&.auto_apply? %>
<%= Spree.t(:auto_apply) %>
<small class="form-text text-muted">
<%= raw Spree.t('auto_apply_info') %>
Expand Down
Loading