5 angular.module('egVolCopy',
6 ['ngRoute', 'ui.bootstrap', 'egCoreMod', 'egUiMod', 'egGridMod'])
8 .filter('boolText', function(){
14 .config(function($routeProvider, $locationProvider, $compileProvider) {
15 $locationProvider.html5Mode(true);
16 $compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|blob):/); // grid export
19 delay : ['egStartup', function(egStartup) { return egStartup.go(); }]
22 $routeProvider.when('/cat/volcopy/:dataKey', {
23 templateUrl: './cat/volcopy/t_view',
24 controller: 'EditCtrl',
28 $routeProvider.when('/cat/volcopy/:dataKey/:mode', {
29 templateUrl: './cat/volcopy/t_view',
30 controller: 'EditCtrl',
37 function(egCore , $q) {
40 currently_generating : false,
41 auto_gen_barcode : false,
42 barcode_checkdigit : false,
45 tree : {}, // holds lib->cn->copy hash stack
46 copies : [] // raw copy list
49 service.nextBarcode = function(bc) {
50 service.currently_generating = true;
51 return egCore.net.request(
53 'open-ils.cat.item.barcode.autogen',
55 bc, 1, { checkdigit: service.barcode_checkdigit }
56 ).then(function(resp) { // get_barcodes
57 var evt = egCore.evt.parse(resp);
58 if (!evt) return resp[0];
63 service.checkBarcode = function(bc) {
64 if (!service.barcode_checkdigit) return true;
65 if (bc != Number(bc)) return false;
67 // "16.00" == Number("16.00"), but the . is bad.
68 // Throw out any barcode that isn't just digits
69 if (bc.search(/\D/) != -1) return false;
70 var last_digit = bc.substr(bc.length-1);
71 var stripped_barcode = bc.substr(0,bc.length-1);
72 return service.barcodeCheckdigit(stripped_barcode).toString() == last_digit;
75 service.barcodeCheckdigit = function(bc) {
76 var reverse_barcode = bc.toString().split('').reverse();
77 var check_sum = 0; var multiplier = 2;
78 for (var i = 0; i < reverse_barcode.length; i++) {
79 var digit = reverse_barcode[i];
80 var product = digit * multiplier; product = product.toString();
82 for (var j = 0; j < product.length; j++) {
83 temp_sum += Number( product[j] );
85 check_sum += Number( temp_sum );
86 multiplier = ( multiplier == 2 ? 1 : 2 );
88 check_sum = check_sum.toString();
89 var next_multiple_of_10 = (check_sum.match(/(\d*)\d$/)[1] * 10) + 10;
90 var check_digit = next_multiple_of_10 - Number(check_sum); if (check_digit == 10) check_digit = 0;
94 // returns a promise resolved with the list of circ mods
95 service.get_classifications = function() {
97 return $q.when(egCore.env.acnc.list);
99 return egCore.pcrud.retrieveAll('acnc', null, {atomic : true})
100 .then(function(list) {
101 egCore.env.absorbList(list, 'acnc');
106 service.get_prefixes = function(org) {
107 return egCore.pcrud.search('acnp',
108 {owning_lib : egCore.org.fullPath(org, true)},
109 {order_by : { acnp : 'label_sortkey' }}, {atomic : true}
114 service.get_statcats = function(orgs) {
115 return egCore.pcrud.search('asc',
119 asc : ['owner','entries']
126 service.get_locations = function(orgs) {
127 return egCore.pcrud.search('acpl',
129 {order_by : { acpl : 'name' }}, {atomic : true}
133 service.get_suffixes = function(org) {
134 return egCore.pcrud.search('acns',
135 {owning_lib : egCore.org.fullPath(org, true)},
136 {order_by : { acns : 'label_sortkey' }}, {atomic : true}
141 service.get_statuses = function() {
143 return $q.when(egCore.env.ccs.list);
145 return egCore.pcrud.retrieveAll('ccs', {order_by : { ccs : 'name' }}, {atomic : true}).then(
147 egCore.env.absorbList(list, 'ccs');
154 service.get_circ_mods = function() {
156 return $q.when(egCore.env.ccm.list);
158 return egCore.pcrud.retrieveAll('ccm', {}, {atomic : true}).then(
160 egCore.env.absorbList(list, 'ccm');
167 service.get_circ_types = function() {
169 return $q.when(egCore.env.citm.list);
171 return egCore.pcrud.retrieveAll('citm', {}, {atomic : true}).then(
173 egCore.env.absorbList(list, 'citm');
180 service.get_age_protects = function() {
181 if (egCore.env.crahp)
182 return $q.when(egCore.env.crahp.list);
184 return egCore.pcrud.retrieveAll('crahp', {}, {atomic : true}).then(
186 egCore.env.absorbList(list, 'crahp');
193 service.get_floating_groups = function() {
195 return $q.when(egCore.env.cfg.list);
197 return egCore.pcrud.retrieveAll('cfg', {}, {atomic : true}).then(
199 egCore.env.absorbList(list, 'cfg');
206 service.bmp_parts = {};
207 service.get_parts = function(rec) {
208 if (service.bmp_parts[rec])
209 return $q.when(service.bmp_parts[rec]);
211 return egCore.pcrud.search('bmp',
212 {record : rec, deleted : 'f'},
213 null, {atomic : true}
214 ).then(function(list) {
215 service.bmp_parts[rec] = list;
224 acp : ['call_number','parts','stat_cat_entries', 'notes'],
225 acn : ['label_class','prefix','suffix']
229 service.addCopy = function (cp) {
231 if (!cp.parts()) cp.parts([]); // just in case...
233 var lib = cp.call_number().owning_lib();
234 var cn = cp.call_number().id();
236 if (!service.tree[lib]) service.tree[lib] = {};
237 if (!service.tree[lib][cn]) service.tree[lib][cn] = [];
239 service.tree[lib][cn].push(cp);
240 service.copies.push(cp);
243 service.fetchIds = function(idList) {
244 service.tree = {}; // clear the tree on fetch
245 service.copies = []; // clear the copy list on fetch
246 return egCore.pcrud.search('acp', { 'id' : idList }, service.flesh).then(null,null,
248 service.addCopy(copy);
256 .directive("egVolCopyEdit", function () {
262 '<div class="col-xs-5" ng-class="{'+"'has-error'"+':barcode_has_error}">'+
263 '<input id="{{callNumber.id()}}_{{copy.id()}}"'+
264 ' eg-enter="nextBarcode(copy.id())" class="form-control"'+
265 ' type="text" ng-model="barcode" ng-change="updateBarcode()"/>'+
267 '<div class="col-xs-3"><input class="form-control" type="number" ng-model="copy_number" ng-change="updateCopyNo()"/></div>'+
268 '<div class="col-xs-4"><eg-basic-combo-box eg-disabled="record == 0" list="parts" selected="part"></eg-basic-combo-box></div>'+
271 scope: { focusNext: "=", copy: "=", callNumber: "=", index: "@", record: "@" },
272 controller : ['$scope','itemSvc','egCore',
273 function ( $scope , itemSvc , egCore ) {
274 $scope.new_part_id = 0;
275 $scope.barcode_has_error = false;
277 $scope.nextBarcode = function (i) {
278 $scope.focusNext(i, $scope.barcode);
281 $scope.updateBarcode = function () {
282 if ($scope.barcode != '')
283 $scope.barcode_has_error = !Boolean(itemSvc.checkBarcode($scope.barcode));
284 $scope.copy.barcode($scope.barcode);
285 $scope.copy.ischanged(1);
286 if (itemSvc.currently_generating)
287 $scope.focusNext($scope.copy.id(), $scope.barcode);
290 $scope.updateCopyNo = function () { $scope.copy.copy_number($scope.copy_number); $scope.copy.ischanged(1); };
291 $scope.updatePart = function () {
293 var p = $scope.part_list.filter(function (x) {
294 return x.label() == $scope.part
296 if (p.length > 0) { // preexisting part
298 } else { // create one...
299 var part = new egCore.idl.bmp();
300 part.id( --$scope.new_part_id );
302 part.label( $scope.part );
303 part.record( $scope.callNumber.record() );
304 $scope.copy.parts([part]);
305 $scope.copy.ischanged(1);
308 $scope.copy.parts([]);
311 $scope.$watch('part', $scope.updatePart);
313 $scope.barcode = $scope.copy.barcode();
314 $scope.copy_number = $scope.copy.copy_number();
316 if ($scope.copy.parts()) {
317 $scope.part = $scope.copy.parts()[0];
318 if ($scope.part) $scope.part = $scope.part.label();
322 $scope.part_list = [];
324 itemSvc.get_parts($scope.callNumber.record()).then(function(list){
325 $scope.part_list = list;
326 angular.forEach(list, function(p){ $scope.parts.push(p.label()) });
327 $scope.parts = angular.copy($scope.parts);
336 .directive("egVolRow", function () {
343 '<div class="col-xs-2">'+
344 '<select ng-disabled="record == 0" class="form-control" ng-model="classification" ng-change="updateClassification()" ng-options="cl.name() for cl in classification_list"/>'+
346 '<div class="col-xs-1">'+
347 '<select ng-disabled="record == 0" class="form-control" ng-model="prefix" ng-change="updatePrefix()" ng-options="p.label() for p in prefix_list"/>'+
349 '<div class="col-xs-2"><input ng-disabled="record == 0" class="form-control" type="text" ng-change="updateLabel()" ng-model="label"/></div>'+
350 '<div class="col-xs-1">'+
351 '<select ng-disabled="record == 0" class="form-control" ng-model="suffix" ng-change="updateSuffix()" ng-options="s.label() for s in suffix_list"/>'+
353 '<div ng-hide="onlyVols" class="col-xs-1"><input ng-disabled="record == 0" class="form-control" type="number" ng-model="copy_count" min="{{orig_copy_count}}" ng-change="changeCPCount()"></div>'+
354 '<div ng-hide="onlyVols" class="col-xs-5">'+
355 '<eg-vol-copy-edit record="{{record}}" ng-repeat="cp in copies track by idTracker(cp)" focus-next="focusNextBarcode" copy="cp" call-number="callNumber"></eg-vol-copy-edit>'+
359 scope: {focusNext: "=", allcopies: "=", copies: "=", onlyVols: "=", record: "@" },
360 controller : ['$scope','itemSvc','egCore',
361 function ( $scope , itemSvc , egCore ) {
362 $scope.callNumber = $scope.copies[0].call_number();
364 $scope.idTracker = function (x) { if (x && x.id) return x.id() };
366 // XXX $() is not working! arg
367 $scope.focusNextBarcode = function (i, prev_bc) {
370 angular.forEach($scope.copies, function (cp) {
378 if (yep) n = cp.id();
382 var next = '#' + $scope.callNumber.id() + '_' + n;
385 if (!itemSvc.currently_generating) el.focus();
386 if (prev_bc && itemSvc.auto_gen_barcode && el.val() == "") {
387 itemSvc.nextBarcode(prev_bc).then(function(bc){
390 el.trigger('change');
393 itemSvc.currently_generating = false;
397 $scope.focusNext($scope.callNumber.id(),prev_bc)
401 $scope.suffix_list = [];
402 itemSvc.get_suffixes($scope.callNumber.owning_lib()).then(function(list){
403 $scope.suffix_list = list;
404 $scope.$watch('callNumber.suffix()', function (v) {
405 if (angular.isObject(v)) v = v.id();
406 $scope.suffix = $scope.suffix_list.filter( function (s) {
412 $scope.updateSuffix = function () {
413 angular.forEach($scope.copies, function(cp) {
414 cp.call_number().suffix($scope.suffix);
415 cp.call_number().ischanged(1);
419 $scope.prefix_list = [];
420 itemSvc.get_prefixes($scope.callNumber.owning_lib()).then(function(list){
421 $scope.prefix_list = list;
422 $scope.$watch('callNumber.prefix()', function (v) {
423 if (angular.isObject(v)) v = v.id();
424 $scope.prefix = $scope.prefix_list.filter(function (p) {
430 $scope.updatePrefix = function () {
431 angular.forEach($scope.copies, function(cp) {
432 cp.call_number().prefix($scope.prefix);
433 cp.call_number().ischanged(1);
436 $scope.$watch('callNumber.owning_lib()', function(oldLib, newLib) {
437 if (oldLib == newLib) return;
438 var currentPrefix = $scope.callNumber.prefix();
439 if (angular.isObject(currentPrefix)) currentPrefix = currentPrefix.id();
440 itemSvc.get_prefixes($scope.callNumber.owning_lib()).then(function(list){
441 $scope.prefix_list = list;
442 var newPrefixId = $scope.prefix_list.filter(function (p) {
443 return p.id() == currentPrefix;
445 if (newPrefixId.id) newPrefixId = newPrefixId.id();
446 $scope.prefix = $scope.prefix_list.filter(function (p) {
447 return p.id() == newPrefixId;
449 if ($scope.newPrefixId != currentPrefix) {
450 $scope.callNumber.prefix($scope.prefix);
453 var currentSuffix = $scope.callNumber.suffix();
454 if (angular.isObject(currentSuffix)) currentSuffix = currentSuffix.id();
455 itemSvc.get_suffixes($scope.callNumber.owning_lib()).then(function(list){
456 $scope.suffix_list = list;
457 var newSuffixId = $scope.suffix_list.filter(function (s) {
458 return s.id() == currentSuffix;
460 if (newSuffixId.id) newSuffixId = newSuffixId.id();
461 $scope.suffix = $scope.suffix_list.filter(function (s) {
462 return s.id() == newSuffixId;
464 if ($scope.newSuffixId != currentSuffix) {
465 $scope.callNumber.suffix($scope.suffix);
470 $scope.classification_list = [];
471 itemSvc.get_classifications().then(function(list){
472 $scope.classification_list = list;
473 $scope.$watch('callNumber.label_class()', function (v) {
474 if (angular.isObject(v)) v = v.id();
475 $scope.classification = $scope.classification_list.filter(function (c) {
481 $scope.updateClassification = function () {
482 angular.forEach($scope.copies, function(cp) {
483 cp.call_number().label_class($scope.classification);
484 cp.call_number().ischanged(1);
488 $scope.updateLabel = function () {
489 angular.forEach($scope.copies, function(cp) {
490 cp.call_number().label($scope.label);
491 cp.call_number().ischanged(1);
495 $scope.$watch('callNumber.label()', function (v) {
499 $scope.prefix = $scope.callNumber.prefix();
500 $scope.suffix = $scope.callNumber.suffix();
501 $scope.classification = $scope.callNumber.label_class();
502 $scope.label = $scope.callNumber.label();
504 $scope.copy_count = $scope.copies.length;
505 $scope.orig_copy_count = $scope.copy_count;
507 $scope.changeCPCount = function () {
508 while ($scope.copy_count > $scope.copies.length) {
509 var cp = new egCore.idl.acp();
510 cp.id( --itemSvc.new_cp_id );
512 cp.circ_lib( $scope.callNumber.owning_lib() );
513 cp.call_number( $scope.callNumber );
516 cp.deposit_amount(0);
517 cp.fine_level(2); // Normal
518 cp.loan_duration(2); // Normal
519 cp.location(1); // Stacks
522 cp.opac_visible('t');
524 cp.mint_condition('t');
525 $scope.copies.push( cp );
526 $scope.allcopies.push( cp );
530 if ($scope.copy_count >= $scope.orig_copy_count) {
531 var how_many = $scope.copies.length - $scope.copy_count;
533 var dead = $scope.copies.splice($scope.copy_count,how_many);
534 $scope.callNumber.copies($scope.copies);
536 // Trimming the global list is a bit more tricky
537 angular.forEach( dead, function (d) {
538 angular.forEach( $scope.allcopies, function (l, i) {
539 if (l === d) $scope.allcopies.splice(i,1);
552 .directive("egVolEdit", function () {
558 '<div class="col-xs-1"><eg-org-selector alldisabled="{{record == 0}}" selected="owning_lib" disable-test="cant_have_vols"></eg-org-selector></div>'+
559 '<div class="col-xs-1"><input ng-disabled="record == 0" class="form-control" type="number" min="{{orig_cn_count}}" ng-model="cn_count" ng-change="changeCNCount()"/></div>'+
560 '<div class="col-xs-10">'+
561 '<eg-vol-row only-vols="onlyVols" record="{{record}}"'+
562 'ng-repeat="(cn,copies) in struct | orderBy:cn track by cn" '+
563 'focus-next="focusNextFirst" copies="copies" allcopies="allcopies">'+
568 scope: { focusNext: "=", allcopies: "=", struct: "=", lib: "@", record: "@", onlyVols: "=" },
569 controller : ['$scope','itemSvc','egCore',
570 function ( $scope , itemSvc , egCore ) {
571 $scope.first_cn = Object.keys($scope.struct)[0];
572 $scope.full_cn = $scope.struct[$scope.first_cn][0].call_number();
574 $scope.defaults = {};
575 egCore.hatch.getItem('cat.copy.defaults').then(function(t) {
581 $scope.focusNextFirst = function(prev_cn,prev_bc) {
584 angular.forEach(Object.keys($scope.struct).sort(), function (cn) {
596 var next = '#' + n + '_' + $scope.struct[n][0].id();
599 if (!itemSvc.currently_generating) el.focus();
600 if (prev_bc && itemSvc.auto_gen_barcode && el.val() == "") {
601 itemSvc.nextBarcode(prev_bc).then(function(bc){
604 el.trigger('change');
607 itemSvc.currently_generating = false;
611 $scope.focusNext($scope.lib, prev_bc);
615 $scope.cn_count = Object.keys($scope.struct).length;
616 $scope.orig_cn_count = $scope.cn_count;
618 $scope.owning_lib = egCore.org.get($scope.lib);
619 $scope.$watch('owning_lib', function (oldLib, newLib) {
620 if (oldLib == newLib) return;
621 angular.forEach( Object.keys($scope.struct), function (cn) {
622 $scope.struct[cn][0].call_number().owning_lib( $scope.owning_lib.id() );
623 $scope.struct[cn][0].call_number().ischanged(1);
627 $scope.cant_have_vols = function (id) { return !egCore.org.CanHaveVolumes(id); };
629 $scope.$watch('cn_count', function (n) {
630 var o = Object.keys($scope.struct).length;
631 if (n > o) { // adding
632 for (var i = o; o < n; o++) {
633 var cn = new egCore.idl.acn();
634 cn.id( --itemSvc.new_cn_id );
636 cn.prefix( $scope.defaults.prefix || -1 );
637 cn.suffix( $scope.defaults.suffix || -1 );
638 cn.label_class( $scope.defaults.classification || 1 );
639 cn.owning_lib( $scope.owning_lib.id() );
640 cn.record( $scope.full_cn.record() );
642 var cp = new egCore.idl.acp();
643 cp.call_number( cn );
644 cp.id( --itemSvc.new_cp_id );
649 cp.deposit_amount(0);
650 cp.fine_level(2); // Normal
651 cp.loan_duration(2); // Normal
652 cp.location(1); // Stacks
655 cp.opac_visible('t');
657 cp.mint_condition('t');
659 cp.circ_lib( $scope.owning_lib.id() );
660 cp.call_number( cn );
662 $scope.struct[cn.id()] = [cp];
663 $scope.allcopies.push(cp);
664 if (!scope.defaults.classification) {
666 ['cat.default_classification_scheme'],
668 ).then(function (val) {
669 cn.label_class(val['cat.default_classification_scheme']);
673 } else if (n < o && n >= $scope.orig_cn_count) { // removing
674 var how_many = o - n;
677 .sort(function(a, b){return parseInt(a)-parseInt(b)})
678 .filter(function(x){ return parseInt(x) <= 0 });
679 for (var i = 0; i < how_many; i++) {
680 // Trimming the global list is a bit more tricky
681 angular.forEach($scope.struct[list[i]], function (d) {
682 angular.forEach( $scope.allcopies, function (l, j) {
683 if (l === d) $scope.allcopies.splice(j,1);
686 delete $scope.struct[list[i]];
699 .controller('EditCtrl',
700 ['$scope','$q','$window','$routeParams','$location','$timeout','egCore','egNet','egGridDataProvider','itemSvc','$modal',
701 function($scope , $q , $window , $routeParams , $location , $timeout , egCore , egNet , egGridDataProvider , itemSvc , $modal) {
703 $scope.defaults = { // If defaults are not set at all, allow everything
704 barcode_checkdigit : false,
705 auto_gen_barcode : false,
710 loan_duration : true,
715 deposit_amount : true,
719 mint_condition : true,
722 circ_modifier : true,
731 $scope.embedded = ($routeParams.mode && $routeParams.mode == 'embedded') ? true : false;
733 $scope.saveDefaults = function () {
734 egCore.hatch.setItem('cat.copy.defaults', $scope.defaults);
737 $scope.fetchDefaults = function () {
738 egCore.hatch.getItem('cat.copy.defaults').then(function(t) {
741 if (!$scope.batch) $scope.batch = {};
742 $scope.batch.classification = $scope.defaults.classification;
743 $scope.batch.prefix = $scope.defaults.prefix;
744 $scope.batch.suffix = $scope.defaults.suffix;
745 $scope.working.statcat_filter = $scope.defaults.statcat_filter;
746 if ($scope.defaults.always_volumes) $scope.show_vols = true;
747 if ($scope.defaults.barcode_checkdigit) itemSvc.barcode_checkdigit = true;
748 if ($scope.defaults.auto_gen_barcode) itemSvc.auto_gen_barcode = true;
752 $scope.fetchDefaults();
754 $scope.$watch('defaults.auto_gen_barcode', function (n,o) {
755 itemSvc.auto_gen_barcode = n
758 $scope.$watch('defaults.barcode_checkdigit', function (n,o) {
759 itemSvc.barcode_checkdigit = n
762 $scope.dirty = false;
763 $scope.$watch('dirty',
764 function(newVal, oldVal) {
765 if (newVal && newVal != oldVal) {
766 $($window).on('beforeunload.edit', function(){
767 return 'There is unsaved data!'
770 $($window).off('beforeunload.edit');
775 $scope.only_vols = false;
776 $scope.show_vols = true;
777 $scope.show_copies = true;
779 $scope.tracker = function (x,f) { if (x) return x[f]() };
780 $scope.idTracker = function (x) { if (x) return $scope.tracker(x,'id') };
781 $scope.cant_have_vols = function (id) { return !egCore.org.CanHaveVolumes(id); };
783 $scope.orgById = function (id) { return egCore.org.get(id) }
784 $scope.statusById = function (id) {
785 return $scope.status_list.filter( function (s) { return s.id() == id } )[0];
787 $scope.locationById = function (id) {
788 return $scope.location_cache[''+id];
791 $scope.workingToComplete = function () {
792 angular.forEach( $scope.workingGridControls.selectedItems(), function (c) {
793 angular.forEach( itemSvc.copies, function (w, i) {
795 $scope.completed_copies = $scope.completed_copies.concat(itemSvc.copies.splice(i,1));
802 $scope.completeToWorking = function () {
803 angular.forEach( $scope.completedGridControls.selectedItems(), function (c) {
804 angular.forEach( $scope.completed_copies, function (w, i) {
806 itemSvc.copies = itemSvc.copies.concat($scope.completed_copies.splice(i,1));
813 createSimpleUpdateWatcher = function (field) {
814 return $scope.$watch('working.' + field, function () {
815 var newval = $scope.working[field];
817 if (typeof newval != 'undefined') {
818 if (angular.isObject(newval)) { // we'll use the pkey
819 if (newval.id) newval = newval.id();
820 else if (newval.code) newval = newval.code();
823 if (""+newval == "" || newval == null) {
824 $scope.working[field] = undefined;
828 if ($scope.workingGridControls && $scope.workingGridControls.selectedItems) {
830 $scope.workingGridControls.selectedItems(),
832 if (cp[field]() !== newval) {
846 statcat_filter: undefined
849 $scope.statcatUpdate = function (id) {
850 var newval = $scope.working.statcats[id];
852 if (typeof newval != 'undefined') {
853 if (angular.isObject(newval)) { // we'll use the pkey
854 newval = newval.id();
857 if (""+newval == "" || newval == null) {
858 $scope.working.statcats[id] = undefined;
862 if (!$scope.in_item_select && $scope.workingGridControls && $scope.workingGridControls.selectedItems) {
864 $scope.workingGridControls.selectedItems(),
869 angular.forEach( cp.stat_cat_entries(), function (e) {
870 if (e.stat_cat() == id) { // mark deleted
877 var e = new egCore.idl.ascecm();
879 e.owning_copy( cp.id() );
881 e.stat_cat_entry( newval );
884 cp.stat_cat_entries().concat([ e ])
889 cp.stat_cat_entries( // trim out ephemeral deleted ones
890 cp.stat_cat_entries().filter(function (e) {
891 if (Boolean(e.isnew())) {
892 if (Boolean(e.isdeleted())) {
907 var dataKey = $routeParams.dataKey;
908 console.debug('dataKey: ' + dataKey);
910 if (dataKey && dataKey.length > 0) {
912 $scope.templates = {};
913 $scope.template_name = '';
914 $scope.template_name_list = [];
916 $scope.fetchTemplates = function () {
917 egCore.hatch.getItem('cat.copy.templates').then(function(t) {
919 $scope.templates = t;
920 $scope.template_name_list = Object.keys(t);
923 egCore.hatch.getItem('cat.copy.last_template').then(function(t) {
924 if (t) $scope.template_name = t;
927 $scope.fetchTemplates();
929 $scope.applyTemplate = function (n) {
930 angular.forEach($scope.templates[n], function (v,k) {
931 if (k == 'circ_lib') {
932 $scope.working[k] = egCore.org.get(v);
933 } else if (!angular.isObject(v)) {
934 $scope.working[k] = angular.copy(v);
936 angular.forEach(v, function (sv,sk) {
937 if (k == 'callnumber') {
938 angular.forEach(v, function (cnv,cnk) {
939 $scope.batch[cnk] = cnv;
941 $scope.applyBatchCNValues();
943 $scope.working[k][sk] = angular.copy(sv);
944 if (k == 'statcats') $scope.statcatUpdate(sk);
949 egCore.hatch.setItem('cat.copy.last_template', n);
952 $scope.copytab = 'working';
954 $scope.summaryRecord = null;
955 $scope.record_id = null;
957 $scope.completed_copies = [];
958 $scope.location_orgs = [];
959 $scope.location_cache = {};
960 $scope.statcats = [];
961 if (!$scope.batch) $scope.batch = {};
963 $scope.applyBatchCNValues = function () {
964 if ($scope.data.tree) {
965 angular.forEach($scope.data.tree, function(cn_hash) {
966 angular.forEach(cn_hash, function(copies) {
967 angular.forEach(copies, function(cp) {
968 if (typeof $scope.batch.classification != 'undefined' && $scope.batch.classification != '') {
969 var label_class = $scope.classification_list.filter(function(p){ return p.id() == $scope.batch.classification })[0];
970 cp.call_number().label_class(label_class);
971 cp.call_number().ischanged(1);
974 if (typeof $scope.batch.prefix != 'undefined' && $scope.batch.prefix != '') {
975 var prefix = $scope.prefix_list.filter(function(p){ return p.id() == $scope.batch.prefix })[0];
976 cp.call_number().prefix(prefix);
977 cp.call_number().ischanged(1);
980 if (typeof $scope.batch.label != 'undefined' && $scope.batch.label != '') {
981 cp.call_number().label($scope.batch.label);
982 cp.call_number().ischanged(1);
985 if (typeof $scope.batch.suffix != 'undefined' && $scope.batch.suffix != '') {
986 var suffix = $scope.suffix_list.filter(function(p){ return p.id() == $scope.batch.suffix })[0];
987 cp.call_number().suffix(suffix);
988 cp.call_number().ischanged(1);
997 $scope.clearWorking = function () {
998 angular.forEach($scope.working, function (v,k,o) {
999 if (!angular.isObject(v)) {
1000 if (typeof v != 'undefined')
1001 $scope.working[k] = undefined;
1002 } else if (k != 'circ_lib') {
1003 angular.forEach(v, function (sv,sk) {
1004 if (typeof v != 'undefined')
1005 $scope.working[k][sk] = undefined;
1009 $scope.working.circ_lib = undefined; // special
1012 $scope.completedGridDataProvider = egGridDataProvider.instance({
1013 get : function(offset, count) {
1014 //return provider.arrayNotifier(itemSvc.copies, offset, count);
1015 return this.arrayNotifier($scope.completed_copies, offset, count);
1019 $scope.completedGridControls = {};
1021 $scope.workingGridDataProvider = egGridDataProvider.instance({
1022 get : function(offset, count) {
1023 //return provider.arrayNotifier(itemSvc.copies, offset, count);
1024 return this.arrayNotifier(itemSvc.copies, offset, count);
1028 $scope.workingGridControls = {};
1029 $scope.add_vols_copies = false;
1030 $scope.is_fast_add = false;
1034 'open-ils.actor.anon_cache.get_value',
1035 dataKey, 'edit-these-copies'
1036 ).then(function (data) {
1039 if (data.hide_vols && !$scope.defaults.always_volumes) $scope.show_vols = false;
1040 if (data.hide_copies) {
1041 $scope.show_copies = false;
1042 $scope.only_vols = true;
1045 $scope.record_id = data.record_id;
1047 function fetchRaw () {
1048 if (!$scope.only_vols) $scope.dirty = true;
1049 $scope.add_vols_copies = true;
1051 /* data.raw data structure looks like this:
1053 * callnumber : $cn_id, // optional, to add a copy to a cn
1054 * owner : $org, // optional, defaults to ws_ou
1055 * label : $cn_label, // optional, to supply a label on a new cn
1056 * barcode : $cp_barcode // optional, to supply a barcode on a new cp
1057 * fast_add : boolean // optional, to specify whether this came
1061 * All can be left out and a completely empty vol/copy combo will be vivicated.
1067 if (proto.fast_add) $scope.is_fast_add = true;
1068 if (proto.callnumber) {
1069 return egCore.pcrud.retrieve('acn', proto.callnumber)
1070 .then(function(cn) {
1071 var cp = new egCore.idl.acp();
1072 cp.call_number( cn );
1073 cp.id( --itemSvc.new_cp_id );
1074 if (!$scope.only_vols) cp.isnew( true );
1075 cp.circ_lib( proto.owner || egCore.auth.user().ws_ou() );
1079 cp.deposit_amount(0);
1080 cp.fine_level(2); // Normal
1081 cp.loan_duration(2); // Normal
1082 cp.location(1); // Stacks
1085 cp.opac_visible('t');
1087 cp.mint_condition('t');
1089 if (proto.barcode) cp.barcode( proto.barcode );
1094 var cn = new egCore.idl.acn();
1095 cn.id( --itemSvc.new_cn_id );
1097 cn.prefix( $scope.defaults.prefix || -1 );
1098 cn.suffix( $scope.defaults.suffix || -1 );
1099 cn.owning_lib( proto.owner || egCore.auth.user().ws_ou() );
1100 cn.record( $scope.record_id );
1101 egCore.org.settings(
1102 ['cat.default_classification_scheme'],
1104 ).then(function (val) {
1106 $scope.defaults.classification ||
1107 val['cat.default_classification_scheme'] ||
1111 cn.label( proto.label );
1115 'open-ils.cat.biblio.record.marc_cn.retrieve',
1118 ).then(function(cn_array) {
1119 if (cn_array.length > 0) {
1120 for (var field in cn_array[0]) {
1121 cn.label( cn_array[0][field] );
1129 var cp = new egCore.idl.acp();
1130 cp.call_number( cn );
1131 cp.id( --itemSvc.new_cp_id );
1136 cp.deposit_amount(0);
1137 cp.fine_level(2); // Normal
1138 cp.loan_duration(2); // Normal
1139 cp.location(1); // Stacks
1142 cp.opac_visible('t');
1144 cp.mint_condition('t');
1146 cp.circ_lib( proto.owner || egCore.auth.user().ws_ou() );
1147 if (proto.barcode) cp.barcode( proto.barcode );
1155 return itemSvc.copies;
1158 if (data.copies && data.copies.length)
1159 return itemSvc.fetchIds(data.copies).then(fetchRaw);
1165 }).then( function() {
1166 $scope.data = itemSvc;
1167 if ($scope.add_vols_copies) {
1168 var status_setting = $scope.is_fast_add ?
1169 'cat.default_copy_status_fast' :
1170 'cat.default_copy_status_normal';
1171 egCore.org.settings([
1173 ]).then(function(set) {
1174 $scope.default_ccs = set[status_setting] ||
1175 ($scope.is_fast_add ? 0 : 5); // 0 is Available, 5 is In Process
1176 angular.forEach($scope.data.copies, function (cp) {
1177 cp.status($scope.default_ccs);
1179 $scope.workingGridDataProvider.refresh();
1184 $scope.focusNextFirst = function(prev_lib,prev_bc) {
1187 angular.forEach(Object.keys($scope.data.tree).sort(), function (lib) {
1190 if (lib == prev_lib) {
1199 var first_cn = Object.keys($scope.data.tree[n])[0];
1200 var next = '#' + first_cn + '_' + $scope.data.tree[n][first_cn][0].id();
1203 if (!itemSvc.currently_generating) el.focus();
1204 if (prev_bc && itemSvc.auto_gen_barcode && el.val() == "") {
1205 itemSvc.nextBarcode(prev_bc).then(function(bc){
1208 el.trigger('change');
1211 itemSvc.currently_generating = false;
1217 $scope.in_item_select = false;
1218 $scope.afterItemSelect = function() { $scope.in_item_select = false };
1219 $scope.handleItemSelect = function (item_list) {
1220 if (item_list && item_list.length > 0) {
1221 $scope.in_item_select = true;
1223 angular.forEach(Object.keys($scope.defaults.attributes), function (attr) {
1225 var value_hash = {};
1226 angular.forEach(item_list, function (item) {
1228 var v = item[attr]()
1229 if (angular.isObject(v)) {
1230 if (v.id) v = v.id();
1231 else if (v.code) v = v.code();
1237 if (Object.keys(value_hash).length == 1) {
1238 if (attr == 'circ_lib') {
1239 $scope.working[attr] = egCore.org.get(item_list[0][attr]());
1241 $scope.working[attr] = item_list[0][attr]();
1244 $scope.working[attr] = undefined;
1248 angular.forEach($scope.statcats, function (sc) {
1251 var value_hash = {};
1253 angular.forEach(item_list, function (item) {
1254 if (item.stat_cat_entries()) {
1255 if (item.stat_cat_entries().length > 0) {
1256 var right_sc = item.stat_cat_entries().filter(function (e) {
1257 return e.stat_cat() == sc.id() && !Boolean(e.isdeleted());
1260 if (right_sc.length > 0) {
1261 value_hash[right_sc[0].stat_cat_entry()] = right_sc[0].stat_cat_entry();
1271 if (!none && Object.keys(value_hash).length == 1) {
1272 $scope.working.statcats[sc.id()] = value_hash[Object.keys(value_hash)[0]];
1274 $scope.working.statcats[sc.id()] = undefined;
1279 $scope.clearWorking();
1284 $scope.$watch('data.copies.length', function () {
1285 if ($scope.data.copies) {
1286 var base_orgs = $scope.data.copies.map(function(cp){
1287 return cp.circ_lib()
1289 $scope.data.copies.map(function(cp){
1290 return cp.call_number().owning_lib()
1293 [egCore.auth.user().ws_ou()]
1294 ).filter(function(e,i,a){
1295 return a.lastIndexOf(e) === i;
1299 angular.forEach(base_orgs, function(o) {
1300 all_orgs = all_orgs.concat( egCore.org.fullPath(o, true) );
1303 var final_orgs = all_orgs.filter(function(e,i,a){
1304 return a.lastIndexOf(e) === i;
1305 }).sort(function(a, b){return parseInt(a)-parseInt(b)});
1307 if ($scope.location_orgs.toString() != final_orgs.toString()) {
1308 $scope.location_orgs = final_orgs;
1309 if ($scope.location_orgs.length) {
1310 itemSvc.get_locations($scope.location_orgs).then(function(list){
1311 angular.forEach(list, function(l) {
1312 $scope.location_cache[ ''+l.id() ] = l;
1314 $scope.location_list = list;
1317 $scope.statcat_filter_list = [];
1318 angular.forEach($scope.location_orgs, function (o) {
1319 $scope.statcat_filter_list.push(egCore.org.get(o));
1322 itemSvc.get_statcats($scope.location_orgs).then(function(list){
1323 $scope.statcats = list;
1324 angular.forEach($scope.statcats, function (s) {
1326 if (!$scope.working)
1327 $scope.working = { statcats: {}, statcat_filter: undefined};
1328 if (!$scope.working.statcats)
1329 $scope.working.statcats = {};
1331 if (!$scope.in_item_select) {
1332 $scope.working.statcats[s.id()] = undefined;
1334 createStatcatUpdateWatcher(s.id());
1336 $scope.in_item_select = false;
1342 $scope.workingGridDataProvider.refresh();
1345 $scope.statcat_visible = function (sc_owner) {
1346 var visible = typeof $scope.working.statcat_filter === 'undefined' || !$scope.working.statcat_filter;
1347 angular.forEach(egCore.org.ancestors(sc_owner), function (anscestor_org) {
1348 if ($scope.working.statcat_filter == anscestor_org.id())
1354 $scope.suffix_list = [];
1355 itemSvc.get_suffixes(egCore.auth.user().ws_ou()).then(function(list){
1356 $scope.suffix_list = list;
1359 $scope.prefix_list = [];
1360 itemSvc.get_prefixes(egCore.auth.user().ws_ou()).then(function(list){
1361 $scope.prefix_list = list;
1364 $scope.classification_list = [];
1365 itemSvc.get_classifications().then(function(list){
1366 $scope.classification_list = list;
1369 $scope.$watch('completed_copies.length', function () {
1370 $scope.completedGridDataProvider.refresh();
1373 $scope.location_list = [];
1374 itemSvc.get_locations().then(function(list){
1375 $scope.location_list = list;
1377 createSimpleUpdateWatcher('location');
1379 $scope.status_list = [];
1380 itemSvc.get_statuses().then(function(list){
1381 $scope.status_list = list;
1383 createSimpleUpdateWatcher('status');
1385 $scope.circ_modifier_list = [];
1386 itemSvc.get_circ_mods().then(function(list){
1387 $scope.circ_modifier_list = list;
1389 createSimpleUpdateWatcher('circ_modifier');
1391 $scope.circ_type_list = [];
1392 itemSvc.get_circ_types().then(function(list){
1393 $scope.circ_type_list = list;
1395 createSimpleUpdateWatcher('circ_as_type');
1397 $scope.age_protect_list = [];
1398 itemSvc.get_age_protects().then(function(list){
1399 $scope.age_protect_list = list;
1401 createSimpleUpdateWatcher('age_protect');
1403 $scope.floating_list = [];
1404 itemSvc.get_floating_groups().then(function(list){
1405 $scope.floating_list = list;
1407 createSimpleUpdateWatcher('floating');
1409 createSimpleUpdateWatcher('circ_lib');
1410 createSimpleUpdateWatcher('circulate');
1411 createSimpleUpdateWatcher('holdable');
1412 createSimpleUpdateWatcher('fine_level');
1413 createSimpleUpdateWatcher('loan_duration');
1414 createSimpleUpdateWatcher('price');
1415 createSimpleUpdateWatcher('cost');
1416 createSimpleUpdateWatcher('deposit');
1417 createSimpleUpdateWatcher('deposit_amount');
1418 createSimpleUpdateWatcher('mint_condition');
1419 createSimpleUpdateWatcher('opac_visible');
1420 createSimpleUpdateWatcher('ref');
1422 $scope.saveCompletedCopies = function (and_exit) {
1424 var perCnCopies = {};
1425 angular.forEach( $scope.completed_copies, function (cp) {
1426 var cn = cp.call_number();
1427 var cn_cps = cp.call_number().copies();
1428 cp.call_number().copies([]);
1429 var cn_id = cp.call_number().id();
1430 cp.call_number(cn_id); // prevent loops in JSON-ification
1431 if (!cnHash[cn_id]) {
1432 cnHash[cn_id] = egCore.idl.Clone(cn);
1433 perCnCopies[cn_id] = [egCore.idl.Clone(cp)];
1435 perCnCopies[cn_id].push(egCore.idl.Clone(cp));
1437 cp.call_number(cn); // put the data back
1438 cp.call_number().copies(cn_cps);
1439 if (typeof cnHash[cn_id].prefix() == 'object')
1440 cnHash[cn_id].prefix(cnHash[cn_id].prefix().id()); // un-object-ize some fields
1441 if (typeof cnHash[cn_id].suffix() == 'object')
1442 cnHash[cn_id].suffix(cnHash[cn_id].suffix().id()); // un-object-ize some fields
1445 angular.forEach(perCnCopies, function (v, k) {
1446 cnHash[k].copies(v);
1450 angular.forEach(cnHash, function (v, k) {
1456 'open-ils.cat.asset.volume.fleshed.batch.update.override',
1457 egCore.auth.token(), cnList, 1, { auto_merge_vols : 1, create_parts : 1 }
1458 ).then(function(update_count) {
1460 $scope.dirty = false;
1461 $timeout(function(){$window.close()});
1466 $scope.saveAndContinue = function () {
1467 $scope.saveCompletedCopies(false);
1470 $scope.workingSaveAndExit = function () {
1471 $scope.workingToComplete();
1472 $scope.saveAndExit();
1475 $scope.saveAndExit = function () {
1476 $scope.saveCompletedCopies(true);
1481 $scope.copy_notes_dialog = function(copy_list) {
1482 var default_pub = Boolean($scope.defaults.copy_notes_pub);
1483 if (!angular.isArray(copy_list)) copy_list = [copy_list];
1485 return $modal.open({
1486 templateUrl: './cat/volcopy/t_copy_notes',
1489 ['$scope','$modalInstance',
1490 function($scope , $modalInstance) {
1491 $scope.focusNote = true;
1493 creator : egCore.auth.user().id(),
1499 $scope.require_initials = false;
1500 egCore.org.settings([
1501 'ui.staff.require_initials.copy_notes'
1502 ]).then(function(set) {
1503 $scope.require_initials = Boolean(set['ui.staff.require_initials.copy_notes']);
1506 $scope.note_list = [];
1507 if (copy_list.length == 1) {
1508 $scope.note_list = copy_list[0].notes();
1511 $scope.ok = function(note) {
1513 if (note.initials) note.value += ' [' + note.initials + ']';
1514 angular.forEach(copy_list, function (cp) {
1515 if (!angular.isArray(cp.notes())) cp.notes([]);
1516 var n = new egCore.idl.acpn();
1518 n.creator(note.creator);
1520 n.title(note.title);
1521 n.value(note.value);
1522 n.owning_copy(cp.id());
1523 cp.notes().push( n );
1526 $modalInstance.close();
1529 $scope.cancel = function($event) {
1530 $modalInstance.dismiss();
1531 $event.preventDefault();
1539 .directive("egVolTemplate", function () {
1543 template: '<div ng-include="'+"'/eg/staff/cat/volcopy/t_attr_edit'"+'"></div>',
1545 controller : ['$scope','$window','itemSvc','egCore',
1546 function ( $scope , $window , itemSvc , egCore ) {
1548 $scope.defaults = { // If defaults are not set at all, allow everything
1549 barcode_checkdigit : false,
1550 auto_gen_barcode : false,
1555 loan_duration : true,
1560 deposit_amount : true,
1561 opac_visible : true,
1564 mint_condition : true,
1567 circ_modifier : true,
1568 circ_as_type : true,
1576 $scope.fetchDefaults = function () {
1577 egCore.hatch.getItem('cat.copy.defaults').then(function(t) {
1579 $scope.defaults = t;
1580 $scope.working.statcat_filter = $scope.defaults.statcat_filter;
1584 $scope.fetchDefaults();
1586 $scope.dirty = false;
1587 $scope.$watch('dirty',
1588 function(newVal, oldVal) {
1589 if (newVal && newVal != oldVal) {
1590 $($window).on('beforeunload.template', function(){
1591 return 'There is unsaved template data!'
1594 $($window).off('beforeunload.template');
1599 $scope.template_controls = true;
1601 $scope.fetchTemplates = function () {
1602 egCore.hatch.getItem('cat.copy.templates').then(function(t) {
1604 $scope.templates = t;
1605 $scope.template_name_list = Object.keys(t);
1609 $scope.fetchTemplates();
1611 $scope.applyTemplate = function (n) {
1612 angular.forEach($scope.templates[n], function (v,k) {
1613 if (k == 'circ_lib') {
1614 $scope.working[k] = egCore.org.get(v);
1615 } else if (!angular.isObject(v)) {
1616 $scope.working[k] = angular.copy(v);
1618 angular.forEach(v, function (sv,sk) {
1619 $scope.working[k][sk] = angular.copy(sv);
1623 $scope.template_name = '';
1626 $scope.deleteTemplate = function (n) {
1628 delete $scope.templates[n]
1629 $scope.template_name_list = Object.keys($scope.templates);
1630 $scope.template_name = '';
1631 egCore.hatch.setItem('cat.copy.templates', $scope.templates);
1632 $scope.$parent.fetchTemplates();
1636 $scope.saveTemplate = function (n) {
1640 angular.forEach($scope.working, function (v,k) {
1641 if (angular.isObject(v)) { // we'll use the pkey
1642 if (v.id) v = v.id();
1643 else if (v.code) v = v.code();
1649 $scope.templates[n] = tmpl;
1650 $scope.template_name_list = Object.keys($scope.templates);
1652 egCore.hatch.setItem('cat.copy.templates', $scope.templates);
1653 $scope.$parent.fetchTemplates();
1655 $scope.dirty = false;
1657 // save all templates, as we might do after an import
1658 egCore.hatch.setItem('cat.copy.templates', $scope.templates);
1659 $scope.$parent.fetchTemplates();
1663 $scope.templates = {};
1664 $scope.imported_templates = { data : '' };
1665 $scope.template_name = '';
1666 $scope.template_name_list = [];
1668 $scope.$watch('imported_templates.data', function(newVal, oldVal) {
1669 if (newVal && newVal != oldVal) {
1671 var newTemplates = JSON.parse(newVal);
1672 if (!Object.keys(newTemplates).length) return;
1673 $scope.templates = newTemplates;
1674 $scope.template_name_list = Object.keys(newTemplates);
1675 $scope.template_name = '';
1677 console.log('tried to import an invalid copy template file');
1682 $scope.tracker = function (x,f) { if (x) return x[f]() };
1683 $scope.idTracker = function (x) { if (x) return $scope.tracker(x,'id') };
1684 $scope.cant_have_vols = function (id) { return !egCore.org.CanHaveVolumes(id); };
1686 $scope.orgById = function (id) { return egCore.org.get(id) }
1687 $scope.statusById = function (id) {
1688 return $scope.status_list.filter( function (s) { return s.id() == id } )[0];
1690 $scope.locationById = function (id) {
1691 return $scope.location_cache[''+id];
1694 createSimpleUpdateWatcher = function (field) {
1695 $scope.$watch('working.' + field, function () {
1696 var newval = $scope.working[field];
1698 if (typeof newval != 'undefined') {
1699 $scope.dirty = true;
1700 if (angular.isObject(newval)) { // we'll use the pkey
1701 if (newval.id) $scope.working[field] = newval.id();
1702 else if (newval.code) $scope.working[field] = newval.code();
1705 if (""+newval == "" || newval == null) {
1706 $scope.working[field] = undefined;
1715 statcat_filter: undefined
1718 createStatcatUpdateWatcher = function (id) {
1719 return $scope.$watch('working.statcats[' + id + ']', function () {
1720 if ($scope.working.statcats) {
1721 var newval = $scope.working.statcats[id];
1723 if (typeof newval != 'undefined') {
1724 $scope.dirty = true;
1725 if (angular.isObject(newval)) { // we'll use the pkey
1726 newval = newval.id();
1729 if (""+newval == "" || newval == null) {
1730 $scope.working.statcats[id] = undefined;
1739 $scope.clearWorking = function () {
1740 angular.forEach($scope.working, function (v,k,o) {
1741 if (!angular.isObject(v)) {
1742 if (typeof v != 'undefined')
1743 $scope.working[k] = undefined;
1744 } else if (k != 'circ_lib') {
1745 angular.forEach(v, function (sv,sk) {
1746 $scope.working[k][sk] = undefined;
1750 $scope.working.circ_lib = undefined; // special
1751 $scope.dirty = false;
1754 $scope.working = {};
1755 $scope.location_orgs = [];
1756 $scope.location_cache = {};
1758 $scope.location_list = [];
1759 itemSvc.get_locations(
1760 egCore.org.fullPath( egCore.auth.user().ws_ou(), true )
1761 ).then(function(list){
1762 $scope.location_list = list;
1764 createSimpleUpdateWatcher('location');
1766 $scope.statcat_filter_list = egCore.org.fullPath( egCore.auth.user().ws_ou() );
1768 $scope.statcats = [];
1769 itemSvc.get_statcats(
1770 egCore.org.fullPath( egCore.auth.user().ws_ou(), true )
1771 ).then(function(list){
1772 $scope.statcats = list;
1773 angular.forEach($scope.statcats, function (s) {
1775 if (!$scope.working)
1776 $scope.working = { statcats: {}, statcat_filter: undefined};
1777 if (!$scope.working.statcats)
1778 $scope.working.statcats = {};
1780 $scope.working.statcats[s.id()] = undefined;
1781 createStatcatUpdateWatcher(s.id());
1785 $scope.status_list = [];
1786 itemSvc.get_statuses().then(function(list){
1787 $scope.status_list = list;
1789 createSimpleUpdateWatcher('status');
1791 $scope.circ_modifier_list = [];
1792 itemSvc.get_circ_mods().then(function(list){
1793 $scope.circ_modifier_list = list;
1795 createSimpleUpdateWatcher('circ_modifier');
1797 $scope.circ_type_list = [];
1798 itemSvc.get_circ_types().then(function(list){
1799 $scope.circ_type_list = list;
1801 createSimpleUpdateWatcher('circ_as_type');
1803 $scope.age_protect_list = [];
1804 itemSvc.get_age_protects().then(function(list){
1805 $scope.age_protect_list = list;
1807 createSimpleUpdateWatcher('age_protect');
1809 createSimpleUpdateWatcher('circulate');
1810 createSimpleUpdateWatcher('holdable');
1811 createSimpleUpdateWatcher('fine_level');
1812 createSimpleUpdateWatcher('loan_duration');
1813 createSimpleUpdateWatcher('cost');
1814 createSimpleUpdateWatcher('deposit');
1815 createSimpleUpdateWatcher('deposit_amount');
1816 createSimpleUpdateWatcher('mint_condition');
1817 createSimpleUpdateWatcher('opac_visible');
1818 createSimpleUpdateWatcher('ref');
1820 $scope.suffix_list = [];
1821 itemSvc.get_suffixes(egCore.auth.user().ws_ou()).then(function(list){
1822 $scope.suffix_list = list;
1825 $scope.prefix_list = [];
1826 itemSvc.get_prefixes(egCore.auth.user().ws_ou()).then(function(list){
1827 $scope.prefix_list = list;
1830 $scope.classification_list = [];
1831 itemSvc.get_classifications().then(function(list){
1832 $scope.classification_list = list;
1835 createSimpleUpdateWatcher('working.callnumber.classification');
1836 createSimpleUpdateWatcher('working.callnumber.prefix');
1837 createSimpleUpdateWatcher('working.callnumber.suffix');