Removed broken and unused Spree.uri
Refactor not query.

Previously there was a hack in place to deal with attributes not in an
empty list of attributes. Rails 4 has a helpful .not method which lets
us do this a little bit better.

I was in the area, so I figured I'd clean it up.
Fixes #5004
Introduce refund and return authorization reason.

Fixes #5003
Make it possible to select a default stock location

When creating returns, the stock locations are currently shown in
whatever order the database returns. This allows designating a default
stock location, which will always show up first. That makes setting up
an RMA easier as we don't have to remember to choose the right location
every time.

Fixes #5006
Change price * quantity to amount.

This is defined within line_item. It simplifies the code a little bit,
plus now it has API compatibility with orders. This should hopefully
allow us to remove some of the 3 percent off calculators that do almost
exactly the same thing...

Re-factor flat_percent_item_total.

The data here is now always a BigDecimal.

- The preference returned is a BigDecimal so it doesn't need to be
  converted to a string, and then back to BigDecimal
- Big Decimal provides round, so we don't need to convert to a float,
  round and then go back.

Extract quantity to it's own function.

Quantity is used by some of the calculators, and this will maintain
compatibility between calculators for use on both LineItems and Orders.

It also simplifies some of the code!

Add calcuators to LineItem adjustments.

With some minor modifications these calculators now work with line items
as well as whole orders.  This will allow store owners to set up
discounts of a specified amount on a product or set of products, rather
than only percentage discounts.

Fixes #5007
Improvements to API performance.

Refactor BaseController#product_scope to allow subclasses
to override the associations that are eager-loaded from a product.
In doing so, removed two associations that were eager-loaded
but never referenced (product.properties, variant.prices).

In Product#total_on_hand, don't load and instantiate all the
variants if all we need to know is whether any of them
track inventory. And don't load all the stock_items to sum their
counts on hand.  (Fix to 368b89786).

Fixes #5008
More code coverage.
Adding micro data to breadcrumbs. Fixes #4505
Reduce the number of cascading touches.

For better performance when saving a product with many variants,
don't call `touch` when not necessary.

* After saving a product, but neither the product nor its
  default price changed, don't touch it.
* After saving a stock item, only touch the variants if the stock
  item changed.

Background: in ActiveRecord, if a product has not changed,
product.save will not write to the DB--but it *will* fire
the `after_save` callback. In that case there is no need to
touch anything.

Also factored out a method in variant.rb.

Fixes #5009
Fix simple_current_order to not conflict with order.
Fixes #4611
call credit with amount and make sure we update the order after cancel.

Fixes #4504
Closes #5005
Merge pull request #5001 from callumacrae/js-uri-removal

Removed broken and unused Spree.uri.