[Git][noosfero/noosfero][master] shopping_cart: fix regression on orders repetition
Bráulio Bhavamitra
gitlab at gitlab.com
Thu Oct 1 14:23:57 BRT 2015
Bráulio Bhavamitra pushed to branch master at Noosfero / noosfero
Commits:
f280b3ca by Braulio Bhavamitra at 2015-10-01T13:05:05Z
shopping_cart: fix regression on orders repetition
- - - - -
1 changed file:
- plugins/shopping_cart/controllers/shopping_cart_plugin_controller.rb
Changes:
=====================================
plugins/shopping_cart/controllers/shopping_cart_plugin_controller.rb
=====================================
--- a/plugins/shopping_cart/controllers/shopping_cart_plugin_controller.rb
+++ b/plugins/shopping_cart/controllers/shopping_cart_plugin_controller.rb
@@ -121,7 +121,8 @@ class ShoppingCartPluginController < OrdersPluginController
@profile = cart_profile
@order = profile.sales.build consumer: user
- @order.supplier_delivery = profile.delivery_methods.where(id: session[:cart][:last_delivery_option_id]).first
+ last_delivery_option_id = session[:cart][:last_delivery_option_id] if session[:cart]
+ @order.supplier_delivery = profile.delivery_methods.where(id: last_delivery_option_id).first if last_delivery_option_id
if repeat_order_id = self.cart[:repeat_order_id]
repeat_order = cart_profile.orders.where(id: repeat_order_id).first
@order.consumer_delivery_data = repeat_order.consumer_delivery_data if repeat_order
View it on GitLab: https://gitlab.com/noosfero/noosfero/commit/f280b3cabd855ed3daf87e5b2c39fe44b5fa9511
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20151001/c528cc98/attachment.html>
More information about the Noosfero-dev
mailing list