itemSvc.add_copies_to_bucket([$scope.args.copyId]);
}
+ $scope.add_records_to_bucket = function() {
+ itemSvc.add_records_to_bucket([$scope.args.recordId], 'biblio');
+ }
+
$scope.show_in_catalog = function() {
- window.open('/eg/staff/cat/catalog/record/' + $scope.args.recordId + '/catalog', '_blank');
+ window.open('/eg2/staff/catalog/record/' + $scope.args.recordId, '_blank');
}
$scope.print_labels = function() {
itemSvc.manage_reservations([$scope.args.copyBarcode]);
}
- $scope.findAcquisition = function() {
- var acqData;
- var promises = [];
- $scope.openAcquisitionLineItem([$scope.args.copyId]);
- }
-
- $scope.openAcquisitionLineItem = function (cp_list) {
- var hasResults = false;
- var promises = [];
-
- angular.forEach(cp_list, function (copyId) {
- promises.push(
- egNet.request(
- 'open-ils.acq',
- 'open-ils.acq.lineitem.retrieve.by_copy_id',
- egCore.auth.token(),
- copyId
- ).then(function (acqData) {
- if (acqData) {
- if (acqData.a) {
- acqData = egCore.idl.toHash(acqData);
- var url = '/eg/acq/po/view/' + acqData.purchase_order + '/' + acqData.id;
- $timeout(function () { $window.open(url, '_blank') });
- hasResults = true;
- }
- }
- })
- )
- });
-
- $q.all(promises).then(function () {
- !hasResults ? alert('There is no corresponding purchase order for this item.') : false;
- });
- }
-
$scope.requestItems = function() {
itemSvc.requestItems([$scope.args.copyId],[$scope.args.recordId]);
}
}
$scope.show_record_holds = function() {
- window.open('/eg/staff/cat/catalog/record/' + $scope.args.recordId + '/holds', '_blank');
+ window.open('/eg2/staff/catalog/record/' + $scope.args.recordId + '/holds', '_blank');
}
$scope.add_item_alerts = function() {
};
$scope.$watch('barcodesFromFile', function(newVal, oldVal) {
+ $scope.context.itemsNotFound = [];
+ $scope.context.fileDoneLoading = false;
+ $scope.context.numBarcodesInFile = 0;
if (newVal && newVal != oldVal) {
$scope.args.barcode = '';
var barcodes = [];
if(itemSvc.copies[0]){ // Were any copies actually retrieved
copyGrid.selectItems([itemSvc.copies[0].index]);
}
+ $scope.context.fileDoneLoading = true;
return;
}
- itemSvc.fetch(barcode).then(fetch_next_copy);
+ itemSvc.fetch(barcode).then(function(item) {
+ if (!item) {
+ $scope.context.itemsNotFound.push(barcode);
+ }
+ fetch_next_copy();
+ })
}
if (barcodes.length) {
+ $scope.context.numBarcodesInFile = barcodes.length;
egProgressDialog.open({value: 0, max: barcodes.length});
fetch_next_copy();
}
$scope.context.search = function(args, noGridRefresh) {
if (!args.barcode) return $q.when();
$scope.context.itemNotFound = false;
- itemSvc.fetch(args.barcode).then(function(res) {
- if (res) {
- copyGrid.refresh();
- copyGrid.selectItems([res.index]);
- $scope.args.barcode = '';
- } else {
- $scope.context.itemNotFound = true;
- egCore.audio.play('warning.item_status.itemNotFound');
- }
- $scope.context.selectBarcode = true;
- })
+
+ //check to see if there are multiple barcodes in CSV format
+ var barcodes = [];
+ //split on commas and clean up barcodes
+ angular.forEach(args.barcode.split(/,/), function(line) {
+ //remove all whitespace and commas
+ line = line.replace(/[\s,]+/g,'');
+
+ //Or remove leading/trailing whitespace
+ //line = line.replace(/(^[\s,]+|[\s,]+$/g,'');
+
+ if (!line) return;
+ barcodes.push(line);
+ });
+
+ if(barcodes.length > 1){
+ //convert to newline seperated list and send to barcodesFromFile processor
+ $scope.barcodesFromFile = barcodes.join('\n');
+ //console.log('Barcodes: ',barcodes);
+ return $q.when();
+
+ } else {
+ //Single Barcode
+ return itemSvc.fetch(args.barcode).then(function(res) {
+ if (res) {
+ if (!noGridRefresh) {
+ copyGrid.refresh();
+ }
+ copyGrid.selectItems([res.index]);
+ $scope.args.barcode = '';
+ } else {
+ $scope.context.itemNotFound = true;
+ egCore.audio.play('warning.item_status.itemNotFound');
+ }
+ $scope.context.selectBarcode = true;
+ })
+ }
}
var add_barcode_to_list = function (b, noGridRefresh) {
return cp_id_list;
}
+ function gatherSelectedHoldingsRecords() {
+ var record_id_list = [];
+ angular.forEach(
+ copyGrid.selectedItems(),
+ function (item) {
+ record_id_list.push(item['call_number.record.id']);
+ }
+ )
+ return record_id_list;
+ }
+
$scope.refreshGridData = function() {
var chain = $q.when();
var all_items = itemSvc.copies.map(function(item) {
itemSvc.add_copies_to_bucket(copy_list);
}
+ $scope.add_records_to_bucket = function() {
+ var record_list = gatherSelectedHoldingsRecords();
+ itemSvc.add_copies_to_bucket(record_list, 'biblio');
+ }
+
$scope.locateAcquisition = function() {
if (gatherSelectedHoldingsIds) {
var cp_list = gatherSelectedHoldingsIds();
}
$scope.selectedHoldingsMissing = function () {
+ egProgressDialog.open();
itemSvc.selectedHoldingsMissing(copyGrid.selectedItems())
.then(function() {
+ egProgressDialog.close();
console.debug('Marking missing complete, refreshing grid');
copyGrid.refresh();
});
$scope.showBibHolds = function () {
angular.forEach(gatherSelectedRecordIds(), function (r) {
- var url = egCore.env.basePath + 'cat/catalog/record/' + r + '/holds';
+ var url = '/eg2/staff/catalog/record/' + r + '/holds';
$timeout(function() { $window.open(url, '_blank') });
});
}