Load current user roles on api requests

Conflicts:
	api/app/views/spree/api/variants/small.v1.rabl
Admin users should be able to set any param via api importer
Add items before creating shipments on importer

Otherwise order.contents.add would wipe out shipments every time
Try to set inventory_unit.line_item on Importer

To avoid exception when users want to display those imported orders in
admin
Fix shipment persistence on order importer

Besides selecting the shipment rate we also need to assign the cost in
the shipment itself.

We cant only rely on order.update_shipment_state to actually well update
the order shipment_state (:O) because shipment states might not be sync
with the latest payment changes which influence on the result so
Shipment#determine_state needs to run to make sure we keep those
accurate
Calculate tax total correctly which depends on the item that could be an Order or a LineItem. Tax adjustments are stored differently in these two cases.

Fixes #4830
Fixes #4829
Speed up rename_adjustment_fields migration

I went to perform this migration on our production db while our store was in maintenance mode and realized it was going to take many hours -- it was loading some million or so Order objects, one at a time.

The first change is that we go from loading all Adjustments and asking whether their adjustable is an Order to just scoping the Adjustment call to only ask for the ones that are. That saved us about one million `if` statements.

The second change is to simply copy the `adjustable_id` over to `order_id` without ever fetching the Order -- who needs it? This saved us about one million ActiveRecord queries.

Happy to pass the fruits along to others on the 2.1--2.2 upgrade path!

Fixes #5121
remove preference "shipment_inc_vat" and corresponding controller, view, route, translations
Fixes #5127
Associate default user address in pre-transition callback

Two advantages:

1) Centralizes this logic, as we want this to happen whether you create
an order from frontend, backend or API.

2) Waits until the last possible moment to assign an address and will
thus get the most recent default address, rather than the one at the
time the cart was created.

Make default address association safer

It turns out that the state transition itself calls a save, so there is
no need to add one more here. To make this even safer, we refuse to
associate default addresses that are not valid.

Save two queries by checking _id instead of the association

Convert to new hash syntax

Fixes #5108

Conflicts:
	core/app/models/spree/order/checkout.rb
Make Shipment.cost default to 0

Since upgrading to Spree 2.2, I've noticed exceptions getting thrown by, for instance [`cost + promo_cost`](https://github.com/spree/spree/blob/2-2-stable/core/app/models/spree/shipment.rb#L151) throwing `NoMethodError: undefined method `+' for nil:NilClass`.

Looking into my db schema, I see that virtually all decimal figures in Spree default to 0, but it looks like for some reason `spree_shipments.cost` didn't get that default. This migration helps ensure a smooth upgrade path from earlier Spree releases to 2.2.

Fixes #5128
Add completed back as default state.
Add missing translation

Specs were complaining like this: https://gist.github.com/jordan-brough/336daa1b1648dd8609e8
Fixes #5135

Conflicts:
	core/config/locales/en.yml
Don't crash if there is no address to associate

Rather, just do nothing. This prevents a crash we've seen in production at
Bonobos.

Fixes #5137
Allow assigning shipped_at to shipments.
Merge pull request #5101 from themetric/fix-api-custom-template

add missing respond_with to some API controllers and add tests
Merge pull request #4844 from woboinc/bugfix/avoid_name_clashing

Avoid name clashing when including modules
Conflicts:
	core/app/models/spree/order.rb
add validation to verify that count_on_hand of backorderable should not go negative if it is not backorderable

Fixes #3808
add a before_transition to verify if order is resumed only if there are no insufficient stock lines
Fixes #3819

Conflicts:
	core/app/models/spree/order/checkout.rb
Fix API::Orders#create  for admins.
Added payment source import from Order hash.

Fixes #5145
Fixes #5147