LP#1777675: Fix code to update Item Status grid
authorRemington Steed <rjs7@calvin.edu>
Wed, 22 Aug 2018 18:19:19 +0000 (14:19 -0400)
committerKathy Lussier <klussier@masslnc.org>
Tue, 4 Sep 2018 18:49:57 +0000 (14:49 -0400)
Testing revealed that the grid rows use a different data structure, and
the object member names include dots (periods). Thus, bracket notation
is required to access those members.

This commit also makes a few smaller changes:
  - Prevents an error in the Check-in app when a last_copy_inventory
    doesn't exist yet.
  - Removes the "refresh" parameter from the updateInventory() function,
    which is never supplied when called, nor used by the function.
  - Adds some brief code comments.

Signed-off-by: Remington Steed <rjs7@calvin.edu>
Signed-off-by: Dan Wells <dbw2@calvin.edu>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Open-ILS/web/js/ui/default/staff/circ/checkin/app.js
Open-ILS/web/js/ui/default/staff/circ/services/item.js

index b1e0aed..8d9eec4 100644 (file)
@@ -210,7 +210,7 @@ function($scope , $q , $window , $location , $timeout , egCore , checkinSvc , eg
             
             row_item['copy_barcode'] = row_item.acp.barcode();
 
-            if (row_item.acp.last_copy_inventory().inventory_date() == "now")
+            if (row_item.acp.last_copy_inventory() && row_item.acp.last_copy_inventory().inventory_date() == "now")
                 row_item.acp.last_copy_inventory().inventory_date(Date.now());
 
             if (row_item.mbts) {
index 79d099f..99f260c 100644 (file)
@@ -195,7 +195,8 @@ function(egCore , egCirc , $uibModal , $q , $timeout , $window , egConfirmDialog
 
     }
 
-    service.updateInventory = function(copy_list, all_items, refresh) {
+    //all_items = selected grid rows, to be updated in place
+    service.updateInventory = function(copy_list, all_items) {
         if (copy_list.length == 0) return;
         return egCore.net.request(
             'open-ils.circ',
@@ -210,8 +211,9 @@ function(egCore , egCirc , $uibModal , $q , $timeout , $window , egConfirmDialog
                               {flesh: 1, flesh_fields:
                                 {alci: ['inventory_workstation']}
                             }).then(function(alci) {
-                                item._last_copy_inventory.inventory_date = alci.inventory_date();
-                                item._last_copy_inventory._inventory_workstation_name =
+                                //update existing grid rows
+                                item["last_copy_inventory.inventory_date"] = alci.inventory_date();
+                                item["last_copy_inventory.inventory_workstation.name"] =
                                     alci.inventory_workstation().name();
                             });
                         }