Created
July 4, 2011 13:01
-
-
Save DriesS/1063314 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def ship_mondial_relay_orders | |
tracking_numbers = [] | |
Order.transaction do | |
Order.processing.mondial_relay.each do |order| | |
tracking_number = MondialRelay.create_mondial_relais_expedition(order) | |
order.shipments.create( {:tracking_number => tracking_number, :author => @current_user} ) | |
tracking_numbers << tracking_number | |
if order.processing? | |
order.ship_order! | |
begin | |
Notifier.deliver_order_shipped_notification(order) | |
rescue Exception | |
logger.error "Could not send confirmation email to order #{order.id}" | |
order.comments.create(:content => "N'a pas pu envoyer l'email de confirmation d'envoi de commande") | |
end | |
end | |
end | |
end | |
respond_to do |accepts| | |
accepts.html { | |
url_tickets = MondialRelay.get_mondial_relay_labels(tracking_numbers) | |
redirect_to "http://www.mondialrelay.fr#{url_tickets}" | |
} | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment