"[% l('Updated most recent inventory data for selected items.') %]";
s.FAIL_UPDATE_INVENTORY =
"[% l('Failed to update recent inventory data for selected items.')%]";
+ s.SUCCESS_UPDATE_INVENTORY_SINGLE =
+ "[% l('Updated most recent inventory data for this item.') %]";
+ s.FAIL_UPDATE_INVENTORY_SINGLE =
+ "[% l('Failed to update recent inventory data for this item.')%]";
s.ITEM_SUCCESSFULLY_MODIFIED =
"[% l('Item successfully modified') %]";
s.ITEMS_SUCCESSFULLY_MODIFIED =
* Parent scope for list and detail views
*/
.controller('SearchCtrl',
- ['$scope','$q','$window','$location','$timeout','egCore','egNet','egGridDataProvider','egItem', 'egCirc',
-function($scope , $q , $window , $location , $timeout , egCore , egNet , egGridDataProvider , itemSvc , egCirc) {
+ ['$scope','$q','$window','$location','$timeout','egCore','egNet','egGridDataProvider','egItem', 'egCirc', 'ngToast',
+function($scope , $q , $window , $location , $timeout , egCore , egNet , egGridDataProvider , itemSvc , egCirc, ngToast) {
$scope.args = {}; // search args
// sub-scopes (search / detail-view) apply their version
$scope.update_inventory = function() {
itemSvc.updateInventory([$scope.args.copyId], null)
.then(function(res) {
- $timeout(function() { location.href = location.href; }, 1000);
+ if (res[0]) {
+ ngToast.create(egCore.strings.SUCCESS_UPDATE_INVENTORY_SINGLE);
+ } else {
+ ngToast.warning(egCore.strings.FAIL_UPDATE_INVENTORY_SINGLE);
+ }
+ $timeout(function() { location.href = location.href; }, 1500);
});
}
$scope.update_inventory = function() {
var copy_list = gatherSelectedHoldingsIds();
itemSvc.updateInventory(copy_list, $scope.gridControls.allItems()).then(function(res) {
- if (res) {
- $scope.gridControls.allItems(res);
+ if (res[0]) {
ngToast.create(egCore.strings.SUCCESS_UPDATE_INVENTORY);
} else {
ngToast.warning(egCore.strings.FAIL_UPDATE_INVENTORY);
data.record = payload.record;
data.acp = payload.copy;
data.acn = payload.volume ? payload.volume : payload.copy ? payload.copy.call_number() : null;
- data.alci = egCore.idl.toHash(payload.latest_inventory, true);
data.au = payload.patron;
data.transit = payload.transit;
data.status = payload.status;
if (payload.circ) data.duration = payload.circ.duration();
if (payload.circ) data.circ_lib = payload.circ.circ_lib();
- if (payload.do_inventory_update) {
- if (payload.latest_inventory.id()) {
- egCore.pcrud.update(payload.latest_inventory);
- } else {
- egCore.pcrud.create(payload.latest_inventory);
- }
- }
// for checkin, the mbts lives on the main circ
if (payload.circ && payload.circ.billable_transaction())
var final_resp = {evt : evt, params : params, options : options};
- var copy, hold, transit, latest_inventory;
+ var copy, hold, transit;
if (evt[0].payload) {
copy = evt[0].payload.copy;
hold = evt[0].payload.hold;
transit = evt[0].payload.transit;
- latest_inventory = evt[0].payload.latest_inventory;
}
// track the barcode regardless of whether it's valid
if (copy_list.length == 0) return;
return egCore.net.request(
'open-ils.circ',
- 'open-ils.circ.circulation.update_latest_inventory',
+ 'open-ils.circ.circulation.update_copy_inventory',
egCore.auth.token(), {copy_list: copy_list}
).then(function(res) {
if (res) {
{alci: ['inventory_workstation']}
}).then(function(alci) {
//update existing grid rows
- item["latest_inventory.inventory_date"] = alci.inventory_date();
- item["latest_inventory.inventory_workstation.name"] =
- alci.inventory_workstation().name();
+ if (alci) {
+ item["latest_inventory.inventory_date"] = alci.inventory_date();
+ item["latest_inventory.inventory_workstation.name"] =
+ alci.inventory_workstation().name();
+ }
});
}
});
});
- return all_items || res;
+ return res;
}
});
}