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:
Rob Harrington
2016-04-01 19:42:09 +11:00
parent d8c17d160a
commit 6c5aaef86e
5 changed files with 15 additions and 19 deletions

View File

@@ -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' }
]

View File

@@ -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?

View File

@@ -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"

View File

@@ -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

View File

@@ -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"