Improved update_shipment_state code

* added check for unassigned inventory for order shipment status
* rewrote the code to make less DB requests

Fixes #2246
Fix properties population when prototype selected and order them by position rather then alphabetically.

Fixes #2389