Advertisement
Guest User

Untitled

a guest
Sep 1st, 2015
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if (order.containsBackorderItems())
  2. {
  3.     //Fetch all items that has to be backordered from supplier
  4.     items = order.backorderItems();
  5.    
  6.     //Get the "slowest" item, based on delivery calculation of the (active) supplier
  7.     slowestItem = items.sortBy(function(item) {
  8.         return item.supplier.delivery_calculation_time;
  9.     }).first();
  10.  
  11.     //Set the order delivery date to the longest of the suppliers
  12.     order.deliveryDate = slowestItem.supplier.delivery_calculation_time;
  13. } else {
  14.     order.deliveryDate = "today+3D";
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement