Class: Spree::Admin::CancellationsController
Instance Method Summary
collapse
#set_user_language_locale_key
Instance Method Details
#index ⇒ Object
8
9
10
|
# File 'app/controllers/spree/admin/cancellations_controller.rb', line 8
def index
@inventory_units = @order.inventory_units.cancelable
end
|
#short_ship ⇒ Object
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'app/controllers/spree/admin/cancellations_controller.rb', line 12
def short_ship
inventory_unit_ids = params[:inventory_unit_ids] || []
inventory_units = Spree::InventoryUnit.where(id: inventory_unit_ids)
if inventory_units.size != inventory_unit_ids.size
flash[:error] = t('spree.unable_to_find_all_inventory_units')
redirect_to admin_order_cancellations_path(@order)
elsif inventory_units.empty?
flash[:error] = t('spree.no_inventory_selected')
redirect_to admin_order_cancellations_path(@order)
else
@order.cancellations.short_ship(inventory_units, created_by:)
flash[:success] = t('spree.inventory_canceled')
redirect_to edit_admin_order_url(@order)
end
end
|