mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-17 04:34:24 +00:00
Removing ability to create order discount rules
Issue with application of tax to discounted items is yet to be resolved
This commit is contained in:
@@ -6,7 +6,7 @@ angular.module("admin.tagRules").directive 'newTagRuleDialog', ($compile, $templ
|
||||
template = $compile($templateCache.get('admin/new_tag_rule_dialog.html'))(scope)
|
||||
|
||||
scope.ruleTypes = [
|
||||
{ id: "DiscountOrder", name: 'Apply a discount to orders' }
|
||||
# { id: "DiscountOrder", name: 'Apply a discount to orders' }
|
||||
{ id: "FilterShippingMethods", name: 'Show/Hide shipping methods' }
|
||||
]
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ class TagRule::DiscountOrder < TagRule
|
||||
|
||||
# Warning: this should only EVER be called via TagRule#apply
|
||||
def apply!
|
||||
create_adjustment(I18n.t("tag_rules.discount_order.discount"), subject, subject)
|
||||
create_adjustment(I18n.t("discount"), subject, subject)
|
||||
end
|
||||
|
||||
def subject_class_matches?
|
||||
|
||||
@@ -137,11 +137,6 @@ en:
|
||||
invoice_column_tax: "GST"
|
||||
invoice_column_price: "Price"
|
||||
|
||||
# Tag Rules
|
||||
tag_rules:
|
||||
discount_order:
|
||||
discount: "Discount"
|
||||
|
||||
logo: "Logo (640x130)" #FIXME
|
||||
logo_mobile: "Mobile logo (75x26)" #FIXME
|
||||
logo_mobile_svg: "Mobile logo (SVG)" #FIXME
|
||||
@@ -973,6 +968,7 @@ Please follow the instructions there to make your enterprise visible on the Open
|
||||
account_code: "Account code:"
|
||||
equals: "Equals"
|
||||
contains: "contains"
|
||||
discount: "Discount"
|
||||
filter_products: "Filter Products"
|
||||
delete_product_variant: "The last variant cannot be deleted!"
|
||||
progress: "progress"
|
||||
|
||||
@@ -683,9 +683,9 @@ ActiveRecord::Schema.define(:version => 20160401043927) do
|
||||
t.string "email"
|
||||
t.text "special_instructions"
|
||||
t.integer "distributor_id"
|
||||
t.integer "order_cycle_id"
|
||||
t.string "currency"
|
||||
t.string "last_ip_address"
|
||||
t.integer "order_cycle_id"
|
||||
t.integer "cart_id"
|
||||
t.integer "customer_id"
|
||||
end
|
||||
|
||||
@@ -21,24 +21,24 @@ feature 'Tag Rules', js: true do
|
||||
click_button '+ Add A New Tag'
|
||||
find(:css, "tags-input .tags input").set "volunteer\n"
|
||||
|
||||
# New DiscountOrder Rule
|
||||
expect(page).to have_content 'No rules apply to this tag yet'
|
||||
click_button '+ Add A New Rule'
|
||||
select2_select 'Apply a discount to orders', from: 'rule_type_selector'
|
||||
click_button "Add Rule"
|
||||
fill_in "enterprise_tag_rules_attributes_0_calculator_attributes_preferred_flat_percent", with: 22
|
||||
|
||||
# New FilterShippingMethods Rule
|
||||
click_button '+ Add A New Rule'
|
||||
select2_select 'Show/Hide shipping methods', from: 'rule_type_selector'
|
||||
click_button "Add Rule"
|
||||
select2_select "NOT VISIBLE", from: "enterprise_tag_rules_attributes_1_preferred_matched_shipping_methods_visibility"
|
||||
select2_select "NOT VISIBLE", from: "enterprise_tag_rules_attributes_0_preferred_matched_shipping_methods_visibility"
|
||||
|
||||
# New DiscountOrder Rule
|
||||
# expect(page).to have_content 'No rules apply to this tag yet'
|
||||
# click_button '+ Add A New Rule'
|
||||
# select2_select 'Apply a discount to orders', from: 'rule_type_selector'
|
||||
# click_button "Add Rule"
|
||||
# fill_in "enterprise_tag_rules_attributes_1_calculator_attributes_preferred_flat_percent", with: 22
|
||||
|
||||
click_button 'Update'
|
||||
|
||||
tag_rule = TagRule::DiscountOrder.last
|
||||
expect(tag_rule.preferred_customer_tags).to eq "volunteer"
|
||||
expect(tag_rule.calculator.preferred_flat_percent).to eq -22
|
||||
# tag_rule = TagRule::DiscountOrder.last
|
||||
# expect(tag_rule.preferred_customer_tags).to eq "volunteer"
|
||||
# expect(tag_rule.calculator.preferred_flat_percent).to eq -22
|
||||
|
||||
tag_rule = TagRule::FilterShippingMethods.last
|
||||
expect(tag_rule.preferred_customer_tags).to eq "volunteer"
|
||||
|
||||
Reference in New Issue
Block a user