return cp_list;
}
+ function gatherSelectedEmptyVolumeIds () {
+ var cn_id_list = [];
+ angular.forEach(
+ $scope.holdingsGridControls.selectedItems(),
+ function (item) {
+ if (item.copy_count == 0)
+ cn_id_list.push(item.call_number.id)
+ }
+ );
+ return cn_id_list;
+ }
+
function gatherSelectedVolumeIds () {
var cn_id_list = [];
angular.forEach(
null, 'edit-these-copies', {
record_id: $scope.record_id,
copies: gatherSelectedHoldingsIds(),
+ raw: gatherSelectedEmptyVolumeIds().map(
+ function(v){ return { callnumber : v } }
+ ),
hide_vols : hide_vols,
hide_copies : hide_copies
}
svc.copies = svc.copies.concat(flat);
} else if (empty) {
svc.copies.push({
+ id_list : [],
owner_id : owner_id,
owner_list : owner_name_list,
call_number: egCore.idl.toHash(cn),
$scope.record_id = data.record_id;
- if (data.copies && data.copies.length)
- return itemSvc.fetchIds(data.copies);
-
- if (data.raw && data.raw.length) {
- $scope.dirty = true;
+ function fetchRaw () {
+ if (!$scope.only_vols) $scope.dirty = true;
$scope.add_vols_copies = true;
/* data.raw data structure looks like this:
var cp = new egCore.idl.acp();
cp.call_number( cn );
cp.id( --itemSvc.new_cp_id );
- cp.isnew( true );
+ if (!$scope.only_vols) cp.isnew( true );
cp.circ_lib( proto.owner || egCore.auth.user().ws_ou() );
cp.deposit(0);
return itemSvc.copies;
}
+
+ if (data.copies && data.copies.length)
+ return itemSvc.fetchIds(data.copies).then(fetchRaw);
+
+ return fetchRaw();
+
}
}).then( function() {