Adding Spree::Order#reset_digital_links! to ease in handling customer support

Hope to add this as a button to the admin soon.
This commit is contained in:
Michael Bianco
2012-09-18 17:07:19 -04:00
parent fdd8536b5b
commit 446a23ce3a

View File

@@ -10,9 +10,14 @@ Spree::Order.class_eval do
false
end
# UPGRADE_CHECK this works as of spree 1.2.0
# check function for changes on upgrade
def reset_digital_links!
line_items.select(&:digital?).map(&:digital_links).flatten.each do |digital_link|
digital_link.update_column :access_counter, 0
digital_link.update_column :created_at, Time.now
end
end
# UPGRADE_CHECK this works as of spree 1.2.0. check function for changes on upgrade
def available_shipping_methods(display_on = nil)
return [] unless ship_address
all_methods = Spree::ShippingMethod.all_available(self, display_on)