4 * currently, this app doesn't use routes for each sub-ui, because
5 * reloading the catalog each time is sloooow. better so far to
6 * swap out divs w/ ng-if / ng-show / ng-hide as needed.
10 angular.module('egCatalogApp', ['ui.bootstrap','ngRoute','ngLocationUpdate','egCoreMod','egGridMod', 'egMarcMod', 'egUserMod', 'egHoldingsMod', 'ngToast'])
12 .config(['ngToastProvider', function(ngToastProvider) {
13 ngToastProvider.configure({
14 verticalPosition: 'bottom',
19 .config(function($routeProvider, $locationProvider, $compileProvider) {
20 $locationProvider.html5Mode(true);
21 $compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|blob):/); // grid export
23 var resolver = {delay : ['egCore','egStartup','egUser', function(egCore, egStartup, egUser) {
24 egCore.env.classLoaders.aous = function() {
25 return egCore.org.settings([
26 'cat.marc_control_number_identifier'
27 ]).then(function(settings) {
28 // local settings are cached within egOrg. Caching them
29 // again in egEnv just simplifies the syntax for access.
30 egCore.env.aous = settings;
33 egCore.env.loadClasses.push('aous');
37 $routeProvider.when('/cat/catalog/index', {
38 templateUrl: './cat/catalog/t_catalog',
39 controller: 'CatalogCtrl',
43 // Jump directly to the results page. Any URL parameter
44 // supported by the embedded catalog is supported here.
45 $routeProvider.when('/cat/catalog/results', {
46 templateUrl: './cat/catalog/t_catalog',
47 controller: 'CatalogCtrl',
51 $routeProvider.when('/cat/catalog/retrieve_by_id', {
52 templateUrl: './cat/catalog/t_retrieve_by_id',
53 controller: 'CatalogRecordRetrieve',
57 $routeProvider.when('/cat/catalog/retrieve_by_tcn', {
58 templateUrl: './cat/catalog/t_retrieve_by_tcn',
59 controller: 'CatalogRecordRetrieve',
63 $routeProvider.when('/cat/catalog/new_bib', {
64 templateUrl: './cat/catalog/t_new_bib',
65 controller: 'NewBibCtrl',
69 // create some catalog page-specific mappings
70 $routeProvider.when('/cat/catalog/record/:record_id', {
71 templateUrl: './cat/catalog/t_catalog',
72 controller: 'CatalogCtrl',
76 // create some catalog page-specific mappings
77 $routeProvider.when('/cat/catalog/record/:record_id/:record_tab', {
78 templateUrl: './cat/catalog/t_catalog',
79 controller: 'CatalogCtrl',
83 $routeProvider.when('/cat/catalog/batchEdit', {
84 templateUrl: './cat/catalog/t_batchedit',
85 controller: 'BatchEditCtrl',
89 $routeProvider.when('/cat/catalog/batchEdit/:container_type/:container_id', {
90 templateUrl: './cat/catalog/t_batchedit',
91 controller: 'BatchEditCtrl',
95 $routeProvider.when('/cat/catalog/vandelay', {
96 templateUrl: './cat/catalog/t_vandelay',
97 controller: 'VandelayCtrl',
101 $routeProvider.when('/cat/catalog/verifyURLs', {
102 templateUrl: './cat/catalog/t_verifyurls',
103 controller: 'URLVerifyCtrl',
107 $routeProvider.when('/cat/catalog/manageAuthorities', {
108 templateUrl: './cat/catalog/t_manageauthorities',
109 controller: 'ManageAuthoritiesCtrl',
113 $routeProvider.when('/cat/catalog/authority/:authority_id/marc_edit', {
114 templateUrl: './cat/catalog/t_authority',
115 controller: 'AuthorityCtrl',
119 $routeProvider.otherwise({redirectTo : '/cat/catalog/index'});
125 .controller('CatalogRecordRetrieve',
126 ['$scope','$routeParams','$location','$q','egCore',
127 function($scope , $routeParams , $location , $q , egCore ) {
129 $scope.focusMe = true;
131 // jump to the patron checkout UI
132 function loadRecord(record_id) {
134 .path('/cat/catalog/record/' + record_id);
137 $scope.submitId = function(args) {
138 $scope.recordNotFound = null;
139 if (!args.record_id) return;
141 // blur so next time it's set to true it will re-apply select()
142 $scope.selectMe = false;
144 return loadRecord(args.record_id);
147 $scope.submitTCN = function(args) {
148 $scope.recordNotFound = null;
149 $scope.moreRecordsFound = null;
150 if (!args.record_tcn) return;
152 // blur so next time it's set to true it will re-apply select()
153 $scope.selectMe = false;
158 'open-ils.search.biblio.tcn',
161 .then(function(resp) { // get_barcodes
163 if (evt = egCore.evt.parse(resp)) {
169 $scope.recordNotFound = args.record_tcn;
170 $scope.selectMe = true;
174 if (resp.count > 1) {
175 $scope.moreRecordsFound = args.record_tcn;
176 $scope.selectMe = true;
180 var record_id = resp.ids[0];
181 return loadRecord(record_id);
187 .controller('NewBibCtrl',
188 ['$scope','$routeParams','$location','$window','$q','egCore',
189 'egGridDataProvider','egHoldGridActions','$timeout','holdingsSvc',
190 function($scope , $routeParams , $location , $window , $q , egCore) {
192 $scope.have_template = false;
193 $scope.marc_template = '';
194 $scope.stop_unload = false;
195 $scope.template_list = [];
196 $scope.template_name = '';
197 $scope.new_bib_id = 0;
201 'open-ils.cat.marc_template.types.retrieve'
202 ).then(function(resp) {
203 angular.forEach(resp, function(name) {
204 $scope.template_list.push(name);
206 $scope.template_list.sort();
208 $scope.template_name = egCore.hatch.getSessionItem('eg.cat.last_bib_marc_template');
209 if (!$scope.template_name) {
210 egCore.hatch.getItem('cat.default_bib_marc_template').then(function(template) {
211 $scope.template_name = template;
215 $scope.loadTemplate = function() {
216 if ($scope.template_name) {
219 'open-ils.cat.biblio.marc_template.retrieve',
221 ).then(function(template) {
222 $scope.marc_template = template;
223 $scope.have_template = true;
224 egCore.hatch.setSessionItem('eg.cat.last_bib_marc_template', $scope.template_name);
229 $scope.setDefaultTemplate = function() {
230 var hatch_key = "cat.default_bib_marc_template";
231 if ($scope.template_name) {
232 egCore.hatch.setItem(hatch_key, $scope.template_name);
234 egCore.hatch.removeItem(hatch_key);
238 $scope.$watch('new_bib_id', function(newVal, oldVal) {
240 $location.path('/cat/catalog/record/' + $scope.new_bib_id);
246 .controller('CatalogCtrl',
247 ['$scope','$routeParams','$location','$window','$q','egCore','egHolds','egCirc','egConfirmDialog','ngToast',
248 'egGridDataProvider','egHoldGridActions','egProgressDialog','$timeout','$uibModal','holdingsSvc','egUser','conjoinedSvc',
250 function($scope , $routeParams , $location , $window , $q , egCore , egHolds , egCirc , egConfirmDialog , ngToast ,
251 egGridDataProvider , egHoldGridActions , egProgressDialog , $timeout , $uibModal , holdingsSvc , egUser , conjoinedSvc,
255 var holdingsSvcInst = new holdingsSvc();
257 // set record ID on page load if available...
258 $scope.record_id = $routeParams.record_id;
259 $scope.summary_pane_record;
261 if ($routeParams.record_id) $scope.from_route = true;
262 else $scope.from_route = false;
264 // set search and preferred library cookies
265 egCore.hatch.getItem('eg.search.search_lib').then(function(val) {
266 $cookies.put('eg_search_lib', val, { path : '/' });
268 egCore.hatch.getItem('eg.search.pref_lib').then(function(val) {
269 $cookies.put('eg_pref_lib', val, { path : '/' });
272 // will hold a ref to the opac iframe
273 $scope.opac_iframe = null;
274 $scope.parts_iframe = null;
276 $scope.search_result_index = 1;
277 $scope.search_result_hit_count = 1;
280 'opac_iframe.dom.contentWindow.search_result_index',
282 if (!isNaN(parseInt(n)))
283 $scope.search_result_index = n + 1;
288 'opac_iframe.dom.contentWindow.search_result_hit_count',
290 if (!isNaN(parseInt(n)))
291 $scope.search_result_hit_count = n;
295 $scope.in_opac_call = false;
296 $scope.opac_call = function (opac_frame_function, force_opac_tab) {
297 if ($scope.opac_iframe) {
298 if (force_opac_tab) $scope.record_tab = 'catalog';
299 $scope.in_opac_call = true;
300 $scope.opac_iframe.dom.contentWindow[opac_frame_function]();
301 if (opac_frame_function == 'rdetailBackToResults') {
302 $location.update_path('/cat/catalog/index');
307 $scope.add_to_record_bucket = function() {
308 var recId = $scope.record_id;
309 return $uibModal.open({
310 templateUrl: './cat/catalog/t_add_to_bucket',
314 ['$scope','$uibModalInstance',
315 function($scope , $uibModalInstance) {
317 $scope.bucket_id = 0;
318 $scope.newBucketName = '';
319 $scope.allBuckets = [];
322 'open-ils.actor.container.retrieve_by_class.authoritative',
323 egCore.auth.token(), egCore.auth.user().id(),
324 'biblio', 'staff_client'
325 ).then(function(buckets) { $scope.allBuckets = buckets; });
327 $scope.add_to_bucket = function() {
328 var item = new egCore.idl.cbrebi();
329 item.bucket($scope.bucket_id);
330 item.target_biblio_record_entry(recId);
333 'open-ils.actor.container.item.create',
334 egCore.auth.token(), 'biblio', item
335 ).then(function(resp) {
336 $uibModalInstance.close();
340 $scope.add_to_new_bucket = function() {
341 var bucket = new egCore.idl.cbreb();
342 bucket.owner(egCore.auth.user().id());
343 bucket.name($scope.newBucketName);
344 bucket.description('');
345 bucket.btype('staff_client');
349 'open-ils.actor.container.create',
350 egCore.auth.token(), 'biblio', bucket
351 ).then(function(bucket) {
352 $scope.bucket_id = bucket;
353 $scope.add_to_bucket();
357 $scope.cancel = function() {
358 $uibModalInstance.dismiss();
364 $scope.current_overlay_target = egCore.hatch.getLocalItem('eg.cat.marked_overlay_record');
365 $scope.current_voltransfer_target = egCore.hatch.getLocalItem('eg.cat.marked_volume_transfer_record');
366 $scope.current_conjoined_target = egCore.hatch.getLocalItem('eg.cat.marked_conjoined_record');
368 $scope.markConjoined = function () {
369 $scope.current_conjoined_target = $scope.record_id;
370 egCore.hatch.setLocalItem('eg.cat.marked_conjoined_record',$scope.record_id);
371 ngToast.create(egCore.strings.MARK_CONJ_TARGET);
374 $scope.markVolTransfer = function () {
375 ngToast.create(egCore.strings.MARK_VOL_TARGET);
376 $scope.current_voltransfer_target = $scope.record_id;
377 egCore.hatch.setLocalItem('eg.cat.marked_volume_transfer_record',$scope.record_id);
380 $scope.markOverlay = function () {
381 $scope.current_overlay_target = $scope.record_id;
382 egCore.hatch.setLocalItem('eg.cat.marked_overlay_record',$scope.record_id);
383 ngToast.create(egCore.strings.MARK_OVERLAY_TARGET);
386 $scope.clearRecordMarks = function () {
387 $scope.current_overlay_target = null;
388 $scope.current_voltransfer_target = null;
389 $scope.current_conjoined_target = null;
390 $scope.current_hold_transfer_dest = null;
391 egCore.hatch.removeLocalItem('eg.cat.marked_volume_transfer_record');
392 egCore.hatch.removeLocalItem('eg.cat.marked_conjoined_record');
393 egCore.hatch.removeLocalItem('eg.cat.marked_overlay_record');
394 egCore.hatch.removeLocalItem('eg.circ.hold.title_transfer_target');
397 $scope.stop_unload = false;
398 $scope.$watch('stop_unload',
399 function(newVal, oldVal) {
400 if (newVal && newVal != oldVal && $scope.opac_iframe) {
401 $($scope.opac_iframe.dom.contentWindow).on('beforeunload', function(){
402 return 'There is unsaved data in this record.'
405 if ($scope.opac_iframe)
406 $($scope.opac_iframe.dom.contentWindow).off('beforeunload');
411 // Set the "last bib" cookie, if we have that
412 if ($scope.record_id)
413 egCore.hatch.setLocalItem("eg.cat.last_record_retrieved", $scope.record_id);
415 $scope.refresh_record_callback = function (record_id) {
416 egCore.pcrud.retrieve('bre', record_id, {
419 bre : ['simple_record','creator','editor']
421 }).then(function(rec) {
422 rec.owner(egCore.org.get(rec.owner()));
423 $scope.summary_pane_record = rec;
429 // also set it when the iframe changes to a new record
430 $scope.handle_page = function(url) {
432 if (!url || url == 'about:blank') {
433 // nothing loaded. If we already have a record ID, leave it.
437 var match = url.match(/\/+opac\/+record\/+(\d+)/);
439 $scope.record_id = match[1];
440 egCore.hatch.setLocalItem("eg.cat.last_record_retrieved", $scope.record_id);
441 $scope.holdings_record_id_changed($scope.record_id);
442 conjoinedSvc.fetch($scope.record_id).then(function(){
443 $scope.conjoinedGridDataProvider.refresh();
446 $location.update_path('/cat/catalog/record/' + $scope.record_id);
448 delete $scope.record_id;
449 $scope.from_route = false;
452 // child scope is executing this function, so our digest doesn't fire ... thus,
455 if (!$scope.in_opac_call) {
456 if ($scope.record_id) {
457 $scope.default_tab = egCore.hatch.getLocalItem( 'eg.cat.default_record_tab' );
458 tab = $routeParams.record_tab || $scope.default_tab || 'catalog';
460 tab = $routeParams.record_tab || 'catalog';
462 $scope.set_record_tab(tab);
464 $scope.in_opac_call = false;
468 // xulG catalog handlers
469 $scope.handlers = { }
471 // ------------------------------------------------------------------
474 $scope.conjoinedGridControls = {};
475 $scope.conjoinedGridDataProvider = egGridDataProvider.instance({
476 get : function(offset, count) {
477 return this.arrayNotifier(conjoinedSvc.items, offset, count);
481 $scope.changeConjoinedType = function () {
482 var peers = egCore.idl.Clone($scope.conjoinedGridControls.selectedItems());
483 angular.forEach(peers, function (p) {
484 p.target_copy(p.target_copy().id());
485 p.peer_type(p.peer_type().id());
488 var conjoinedGridDataProviderRef = $scope.conjoinedGridDataProvider;
490 return $uibModal.open({
491 templateUrl: './cat/catalog/t_conjoined_selector',
494 ['$scope','$uibModalInstance',
495 function($scope , $uibModalInstance) {
496 $scope.update = true;
498 $scope.peer_type = null;
499 $scope.peer_type_list = [];
500 conjoinedSvc.get_peer_types().then(function(list){
501 $scope.peer_type_list = list;
504 $scope.ok = function(type) {
507 angular.forEach(peers, function (p) {
510 promises.push(egCore.pcrud.update(p));
513 return $q.all(promises)
514 .then(function(){$uibModalInstance.close()})
515 .then(function(){return conjoinedSvc.fetch()})
516 .then(function(){conjoinedGridDataProviderRef.refresh()});
519 $scope.cancel = function($event) {
520 $uibModalInstance.dismiss();
521 $event.preventDefault();
528 $scope.refreshConjoined = function () {
529 conjoinedSvc.fetch($scope.record_id)
530 .then(function(){$scope.conjoinedGridDataProvider.refresh();});
533 $scope.deleteSelectedConjoined = function () {
534 var peers = $scope.conjoinedGridControls.selectedItems();
536 if (peers.length > 0) {
537 egConfirmDialog.open(
538 egCore.strings.CONFIRM_DELETE_PEERS,
539 egCore.strings.CONFIRM_DELETE_PEERS_MESSAGE,
540 {peers : peers.length}
541 ).result.then(function() {
542 angular.forEach(peers, function (p) {
546 egCore.pcrud.remove(peers).then(function() {
547 return conjoinedSvc.fetch();
549 $scope.conjoinedGridDataProvider.refresh();
554 if ($scope.record_id)
555 conjoinedSvc.fetch($scope.record_id);
557 // ------------------------------------------------------------------
560 $scope.holdingsGridControls = {
561 activateItem : function (item) {
562 $scope.selectedHoldingsVolCopyEdit();
565 $scope.holdingsGridDataProvider = egGridDataProvider.instance({
566 get : function(offset, count) {
567 return this.arrayNotifier(holdingsSvcInst.copies, offset, count);
571 $scope.add_copies_to_bucket = function() {
572 var copy_list = gatherSelectedHoldingsIds();
573 if (copy_list.length == 0) return;
575 return $uibModal.open({
576 templateUrl: './cat/catalog/t_add_to_bucket',
580 ['$scope','$uibModalInstance',
581 function($scope , $uibModalInstance) {
583 $scope.bucket_id = 0;
584 $scope.newBucketName = '';
585 $scope.allBuckets = [];
589 'open-ils.actor.container.retrieve_by_class.authoritative',
590 egCore.auth.token(), egCore.auth.user().id(),
591 'copy', 'staff_client'
592 ).then(function(buckets) { $scope.allBuckets = buckets; });
594 $scope.add_to_bucket = function() {
596 angular.forEach(copy_list, function (cp) {
597 var item = new egCore.idl.ccbi()
598 item.bucket($scope.bucket_id);
599 item.target_copy(cp);
603 'open-ils.actor.container.item.create',
604 egCore.auth.token(), 'copy', item
608 return $q.all(promises).then(function() {
609 $uibModalInstance.close();
614 $scope.add_to_new_bucket = function() {
615 var bucket = new egCore.idl.ccb();
616 bucket.owner(egCore.auth.user().id());
617 bucket.name($scope.newBucketName);
618 bucket.description('');
619 bucket.btype('staff_client');
621 return egCore.net.request(
623 'open-ils.actor.container.create',
624 egCore.auth.token(), 'copy', bucket
625 ).then(function(bucket) {
626 $scope.bucket_id = bucket;
627 $scope.add_to_bucket();
631 $scope.cancel = function() {
632 $uibModalInstance.dismiss();
638 // TODO: refactor common code between cat/catalog/app.js and cat/item/app.js
640 $scope.need_one_selected = function() {
641 var items = $scope.holdingsGridControls.selectedItems();
642 if (items.length == 1) return false;
646 $scope.make_copies_bookable = function() {
648 var copies_by_record = {};
649 var record_list = [];
651 $scope.holdingsGridControls.selectedItems(),
653 var record_id = item['call_number.record.id'];
654 if (typeof copies_by_record[ record_id ] == 'undefined') {
655 copies_by_record[ record_id ] = [];
656 record_list.push( record_id );
658 copies_by_record[ record_id ].push(item.id);
663 var combined_results = [];
664 angular.forEach(record_list, function(record_id) {
668 'open-ils.booking.resources.create_from_copies',
670 copies_by_record[record_id]
671 ).then(function(results) {
672 if (results && results['brsrc']) {
673 combined_results = combined_results.concat(results['brsrc']);
679 $q.all(promises).then(function() {
680 if (combined_results.length > 0) {
682 template: '<eg-embed-frame url="booking_admin_url" handlers="funcs"></eg-embed-frame>',
686 ['$scope','$location','egCore','$uibModalInstance',
687 function($scope , $location , egCore , $uibModalInstance) {
690 ses : egCore.auth.token(),
691 resultant_brsrc : combined_results.map(function(o) { return o[0]; })
694 var booking_path = '/eg/conify/global/booking/resource';
696 $scope.booking_admin_url =
697 $location.absUrl().replace(/\/eg\/staff.*/, booking_path);
704 $scope.book_copies_now = function() {
705 var copies_by_record = {};
706 var record_list = [];
708 $scope.holdingsGridControls.selectedItems(),
710 var record_id = item['call_number.record.id'];
711 if (typeof copies_by_record[ record_id ] == 'undefined') {
712 copies_by_record[ record_id ] = [];
713 record_list.push( record_id );
715 copies_by_record[ record_id ].push(item.id);
720 var combined_brt = [];
721 var combined_brsrc = [];
722 angular.forEach(record_list, function(record_id) {
726 'open-ils.booking.resources.create_from_copies',
728 copies_by_record[record_id]
729 ).then(function(results) {
730 if (results && results['brt']) {
731 combined_brt = combined_brt.concat(results['brt']);
733 if (results && results['brsrc']) {
734 combined_brsrc = combined_brsrc.concat(results['brsrc']);
740 $q.all(promises).then(function() {
741 if (combined_brt.length > 0 || combined_brsrc.length > 0) {
743 template: '<eg-embed-frame url="booking_admin_url" handlers="funcs"></eg-embed-frame>',
747 ['$scope','$location','egCore','$uibModalInstance',
748 function($scope , $location , egCore , $uibModalInstance) {
751 ses : egCore.auth.token(),
752 bresv_interface_opts : {
755 ,brsrc : combined_brsrc
760 var booking_path = '/eg/booking/reservation';
762 $scope.booking_admin_url =
763 $location.absUrl().replace(/\/eg\/staff.*/, booking_path);
772 $scope.requestItems = function() {
773 var copy_list = gatherSelectedHoldingsIds();
774 if (copy_list.length == 0) return;
776 return $uibModal.open({
777 templateUrl: './cat/catalog/t_request_items',
780 ['$scope','$uibModalInstance',
781 function($scope , $uibModalInstance) {
783 $scope.first_user_fetch = true;
787 copy_list : copy_list,
788 pickup_lib: egCore.org.get(egCore.auth.user().ws_ou()),
789 user : egCore.auth.user().id()
792 egUser.get( $scope.hold_data.user ).then(function(u) {
794 $scope.barcode = u.card().barcode();
795 $scope.user_name = egUser.format_name(u);
796 $scope.hold_data.user = u.id();
799 $scope.user_name = '';
801 $scope.$watch('barcode', function (n) {
802 if (!$scope.first_user_fetch) {
803 egUser.getByBarcode(n).then(function(u) {
805 $scope.user_name = egUser.format_name(u);
806 $scope.hold_data.user = u.id();
809 $scope.user_name = '';
810 delete $scope.hold_data.user;
813 $scope.first_user_fetch = false;
816 $scope.ok = function(h) {
819 hold_type : h.hold_type,
820 pickup_lib: h.pickup_lib.id(),
826 'open-ils.circ.holds.test_and_create.batch.override',
827 egCore.auth.token(), args, h.copy_list
830 $uibModalInstance.close();
833 $scope.cancel = function($event) {
834 $uibModalInstance.dismiss();
835 $event.preventDefault();
841 $scope.view_place_orders = function() {
842 if (!$scope.record_id) return;
843 var url = egCore.env.basePath + 'acq/legacy/lineitem/related/' + $scope.record_id + '?target=bib';
844 $timeout(function() { $window.open(url, '_blank') });
847 $scope.replaceBarcodes = function() {
848 var copy_list = gatherSelectedRawCopies();
849 if (copy_list.length == 0) return;
851 var holdingsGridDataProviderRef = $scope.holdingsGridDataProvider;
853 angular.forEach(copy_list, function (cp) {
855 templateUrl: './cat/share/t_replace_barcode',
858 ['$scope','$uibModalInstance',
859 function($scope , $uibModalInstance) {
860 $scope.isModal = true;
861 $scope.focusBarcode = false;
862 $scope.focusBarcode2 = true;
863 $scope.barcode1 = cp.barcode();
865 $scope.updateBarcode = function() {
866 $scope.copyNotFound = false;
867 $scope.updateOK = false;
869 egCore.pcrud.search('acp',
870 {deleted : 'f', barcode : $scope.barcode1})
871 .then(function(copy) {
874 $scope.focusBarcode = true;
875 $scope.copyNotFound = true;
879 $scope.copyId = copy.id();
880 copy.barcode($scope.barcode2);
882 egCore.pcrud.update(copy).then(function(stat) {
883 $scope.updateOK = stat;
884 $scope.focusBarcode = true;
885 holdingsSvc.fetchAgain().then(function (){
886 holdingsGridDataProviderRef.refresh();
891 $uibModalInstance.close();
894 $scope.cancel = function($event) {
895 $uibModalInstance.dismiss();
896 $event.preventDefault();
904 // refresh the list of holdings when the record_id is changed.
905 $scope.holdings_record_id_changed = function(id) {
906 if ($scope.record_id != id) $scope.record_id = id;
907 console.log('record id changed to ' + id + ', loading new holdings');
908 holdingsSvcInst.fetch({
909 rid : $scope.record_id,
910 org : $scope.holdings_ou,
911 copy: $scope.holdings_show_copies,
912 vol : $scope.holdings_show_vols,
913 empty: $scope.holdings_show_empty
915 $scope.holdingsGridDataProvider.refresh();
919 // refresh the list of holdings when the filter lib is changed.
920 $scope.holdings_ou = egCore.org.get(egCore.auth.user().ws_ou());
921 $scope.holdings_ou_changed = function(org) {
922 $scope.holdings_ou = org;
923 holdingsSvcInst.fetch({
924 rid : $scope.record_id,
925 org : $scope.holdings_ou,
926 copy: $scope.holdings_show_copies,
927 vol : $scope.holdings_show_vols,
928 empty: $scope.holdings_show_empty
930 $scope.holdingsGridDataProvider.refresh();
934 $scope.holdings_cb_changed = function(cb,newVal,norefresh) {
936 egCore.hatch.setItem('cat.' + cb, newVal);
937 if (!norefresh) holdingsSvcInst.fetch({
938 rid : $scope.record_id,
939 org : $scope.holdings_ou,
940 copy: $scope.holdings_show_copies,
941 vol : $scope.holdings_show_vols,
942 empty: $scope.holdings_show_empty
944 $scope.holdingsGridDataProvider.refresh();
948 egCore.hatch.getItem('cat.holdings_show_vols').then(function(x){
949 if (typeof x == 'undefined') x = true;
950 $scope.holdings_cb_changed('holdings_show_vols',x,true);
951 $('#holdings_show_vols').prop('checked', x);
953 egCore.hatch.getItem('cat.holdings_show_copies').then(function(x){
954 if (typeof x == 'undefined') x = true;
955 $scope.holdings_cb_changed('holdings_show_copies',x,true);
956 $('#holdings_show_copies').prop('checked', x);
958 egCore.hatch.getItem('cat.holdings_show_empty').then(function(x){
959 if (typeof x == 'undefined') x = true;
960 $scope.holdings_cb_changed('holdings_show_empty',x);
961 $('#holdings_show_empty').prop('checked', x);
966 $scope.vols_not_shown = function () {
967 return !$scope.holdings_show_vols;
970 $scope.copies_not_shown = function () {
971 return !$scope.holdings_show_copies;
974 $scope.holdings_checkbox_handler = function (item) {
975 $scope.holdings_cb_changed(item.checkbox,item.checked);
978 function gatherSelectedHoldingsIds () {
981 $scope.holdingsGridControls.selectedItems(),
982 function (item) { cp_id_list = cp_id_list.concat(item.id_list) }
987 function gatherSelectedRawCopies () {
990 $scope.holdingsGridControls.selectedItems(),
991 function (item) { if (item.raw) cp_list = cp_list.concat(item.raw) }
996 function gatherSelectedEmptyVolumeIds () {
999 $scope.holdingsGridControls.selectedItems(),
1001 if (item.copy_count == 0)
1002 cn_id_list.push(item.call_number.id)
1008 function gatherSelectedVolumeIds () {
1009 var cn_id_list = [];
1011 $scope.holdingsGridControls.selectedItems(),
1013 if (cn_id_list.indexOf(item.call_number.id) == -1)
1014 cn_id_list.push(item.call_number.id)
1020 $scope.selectedHoldingsDelete = function (vols, copies) {
1023 var perCnCopies = {};
1029 $scope.holdingsGridControls.selectedItems(),
1031 if (vols && item.raw_call_number) {
1032 cnHash[item.call_number.id] = egCore.idl.Clone(item.raw_call_number);
1033 cnHash[item.call_number.id].isdeleted(1);
1035 } else if (copies) {
1036 angular.forEach(egCore.idl.Clone(item.raw), function (cp) {
1039 var cn_id = cp.call_number().id();
1040 if (!cnHash[cn_id]) {
1041 cnHash[cn_id] = cp.call_number();
1042 perCnCopies[cn_id] = [cp];
1044 perCnCopies[cn_id].push(cp);
1046 cp.call_number(cn_id); // prevent loops in JSON-ification
1053 angular.forEach(perCnCopies, function (v, k) {
1055 cnHash[k].isdeleted(1);
1058 cnHash[k].copies(v);
1062 angular.forEach(cnHash, function (v, k) {
1066 if (cnList.length == 0) return;
1069 if (vols && copies) flags.force_delete_copies = 1;
1071 egConfirmDialog.open(
1072 egCore.strings.CONFIRM_DELETE_COPIES_VOLUMES,
1073 egCore.strings.CONFIRM_DELETE_COPIES_VOLUMES_MESSAGE,
1074 {copies : cp_count, volumes : cn_count}
1075 ).result.then(function() {
1078 'open-ils.cat.asset.volume.fleshed.batch.update.override',
1079 egCore.auth.token(), cnList, 1, flags
1080 ).then(function(update_count) {
1081 holdingsSvcInst.fetchAgain().then(function() {
1082 $scope.holdingsGridDataProvider.refresh();
1087 $scope.selectedHoldingsCopyDelete = function () { $scope.selectedHoldingsDelete(false,true) }
1088 $scope.selectedHoldingsVolCopyDelete = function () { $scope.selectedHoldingsDelete(true,true) }
1089 $scope.selectedHoldingsEmptyVolCopyDelete = function () { $scope.selectedHoldingsDelete(true,false) }
1091 spawnHoldingsAdd = function (vols,copies){
1093 if (copies) { // just a copy on existing volumes
1094 angular.forEach(gatherSelectedVolumeIds(), function (v) {
1095 raw.push( {callnumber : v} );
1098 if (typeof $scope.holdingsGridControls.selectedItems == "function" &&
1099 $scope.holdingsGridControls.selectedItems().length > 0) {
1100 angular.forEach($scope.holdingsGridControls.selectedItems(),
1103 owner : item.owner_id,
1104 label : item.call_number.label
1109 owner : egCore.auth.user().ws_ou()
1114 if (raw.length == 0) raw.push({});
1118 'open-ils.actor.anon_cache.set_value',
1119 null, 'edit-these-copies', {
1120 record_id: $scope.record_id,
1125 ).then(function(key) {
1127 var url = egCore.env.basePath + 'cat/volcopy/' + key;
1128 $timeout(function() { $window.open(url, '_blank') });
1130 alert('Could not create anonymous cache key!');
1134 $scope.selectedHoldingsVolCopyAdd = function () { spawnHoldingsAdd(true,false) }
1135 $scope.selectedHoldingsCopyAdd = function () { spawnHoldingsAdd(false,true) }
1137 spawnHoldingsEdit = function (hide_vols,hide_copies){
1140 'open-ils.actor.anon_cache.set_value',
1141 null, 'edit-these-copies', {
1142 record_id: $scope.record_id,
1143 copies: gatherSelectedHoldingsIds(),
1144 raw: gatherSelectedEmptyVolumeIds().map(
1145 function(v){ return { callnumber : v } }
1147 hide_vols : hide_vols,
1148 hide_copies : hide_copies
1150 ).then(function(key) {
1152 var url = egCore.env.basePath + 'cat/volcopy/' + key;
1153 $timeout(function() { $window.open(url, '_blank') });
1155 alert('Could not create anonymous cache key!');
1159 $scope.selectedHoldingsVolCopyEdit = function () { spawnHoldingsEdit(false,false) }
1160 $scope.selectedHoldingsVolEdit = function () { spawnHoldingsEdit(false,true) }
1161 $scope.selectedHoldingsCopyEdit = function () { spawnHoldingsEdit(true,false) }
1163 $scope.selectedHoldingsItemStatus = function (){
1164 var url = egCore.env.basePath + 'cat/item/search/' + gatherSelectedHoldingsIds().join(',')
1165 $timeout(function() { $window.open(url, '_blank') });
1168 $scope.markVolAsItemTarget = function() {
1169 if ($scope.holdingsGridControls.selectedItems()[0].call_number.id) { // cn.id missing when vols are collapsed
1170 egCore.hatch.setLocalItem(
1171 'eg.cat.item_transfer_target',
1172 $scope.holdingsGridControls.selectedItems()[0].call_number.id
1174 ngToast.create(egCore.strings.MARK_ITEM_TARGET);
1178 $scope.markLibAsVolTarget = function() {
1179 return $uibModal.open({
1180 templateUrl: './cat/catalog/t_choose_vol_target_lib',
1183 ['$scope','$uibModalInstance',
1184 function($scope , $uibModalInstance) {
1186 var orgId = egCore.hatch.getLocalItem('eg.cat.volume_transfer_target') || 1;
1187 $scope.org = egCore.org.get(orgId);
1188 $scope.cant_have_vols = function (id) { return !egCore.org.CanHaveVolumes(id); };
1189 $scope.ok = function(org) {
1190 egCore.hatch.setLocalItem(
1191 'eg.cat.volume_transfer_target',
1194 $uibModalInstance.close();
1196 $scope.cancel = function($event) {
1197 $uibModalInstance.dismiss();
1198 $event.preventDefault();
1203 $scope.markLibFromSelectedAsVolTarget = function() {
1204 egCore.hatch.setLocalItem(
1205 'eg.cat.volume_transfer_target',
1206 $scope.holdingsGridControls.selectedItems()[0].owner_id
1208 ngToast.create(egCore.strings.MARK_VOL_TARGET);
1211 $scope.selectedHoldingsItemStatusDetail = function (){
1213 gatherSelectedHoldingsIds(),
1215 var url = egCore.env.basePath +
1217 $timeout(function() { $window.open(url, '_blank') });
1222 $scope.transferVolumesToRecord = function (){
1223 var target_record = egCore.hatch.getLocalItem('eg.cat.marked_volume_transfer_record');
1224 if (!target_record) return;
1225 if ($scope.record_id == target_record) return;
1226 var items = $scope.holdingsGridControls.selectedItems();
1227 if (!items.length) return;
1229 var vols_to_move = {};
1230 angular.forEach(items, function(item) {
1231 if (!(item.call_number.owning_lib in vols_to_move)) {
1232 vols_to_move[item.call_number.owning_lib] = new Array;
1234 vols_to_move[item.call_number.owning_lib].push(item.call_number.id);
1238 angular.forEach(vols_to_move, function(vols, owning_lib) {
1239 promises.push(egCore.net.request(
1241 'open-ils.cat.asset.volume.batch.transfer.override',
1242 egCore.auth.token(), {
1243 docid : target_record,
1249 $q.all(promises).then(function(success) {
1251 ngToast.create(egCore.strings.VOLS_TRANSFERED);
1252 holdingsSvcInst.fetchAgain().then(function() {
1253 $scope.holdingsGridDataProvider.refresh();
1256 alert('Could not transfer volumes!');
1261 function transferVolumes(new_record){
1262 var xfer_target = egCore.hatch.getLocalItem('eg.cat.volume_transfer_target');
1267 'open-ils.cat.asset.volume.batch.transfer.override',
1268 egCore.auth.token(), {
1269 docid : (new_record ? new_record : $scope.record_id),
1271 volumes : gatherSelectedVolumeIds()
1273 ).then(function(success) {
1275 ngToast.create(egCore.strings.VOLS_TRANSFERED);
1276 holdingsSvcInst.fetchAgain().then(function() {
1277 $scope.holdingsGridDataProvider.refresh();
1280 alert('Could not transfer volumes!');
1287 $scope.transferVolumesToLibrary = function() {
1291 $scope.transferVolumesToRecordAndLibrary = function() {
1292 var target_record = egCore.hatch.getLocalItem('eg.cat.marked_volume_transfer_record');
1293 if (!target_record) return;
1294 transferVolumes(target_record);
1297 // this "transfers" selected copies to a new owning library,
1298 // auto-creating volumes and deleting unused volumes as required.
1299 $scope.changeItemOwningLib = function() {
1300 var xfer_target = egCore.hatch.getLocalItem('eg.cat.volume_transfer_target');
1301 var items = $scope.holdingsGridControls.selectedItems();
1302 if (!xfer_target || !items.length) {
1305 var vols_to_move = {};
1306 var copies_to_move = {};
1307 angular.forEach(items, function(item) {
1308 if (item.call_number.owning_lib != xfer_target) {
1309 if (item.call_number.id in vols_to_move) {
1310 copies_to_move[item.call_number.id].push(item.id);
1312 vols_to_move[item.call_number.id] = item.call_number;
1313 copies_to_move[item.call_number.id] = new Array;
1314 copies_to_move[item.call_number.id].push(item.id);
1320 angular.forEach(vols_to_move, function(vol) {
1321 promises.push(egCore.net.request(
1323 'open-ils.cat.call_number.find_or_create',
1324 egCore.auth.token(),
1331 ).then(function(resp) {
1332 var evt = egCore.evt.parse(resp);
1334 return egCore.net.request(
1336 'open-ils.cat.transfer_copies_to_volume',
1337 egCore.auth.token(),
1339 copies_to_move[vol.id]
1343 $q.all(promises).then(function() {
1344 ngToast.create(egCore.strings.ITEMS_TRANSFERED);
1345 holdingsSvcInst.fetchAgain().then(function() {
1346 $scope.holdingsGridDataProvider.refresh();
1351 $scope.transferItems = function (){
1352 var xfer_target = egCore.hatch.getLocalItem('eg.cat.item_transfer_target');
1353 var copy_ids = gatherSelectedHoldingsIds();
1354 if (xfer_target && copy_ids.length > 0) {
1357 'open-ils.cat.transfer_copies_to_volume',
1358 egCore.auth.token(),
1362 function(resp) { // oncomplete
1363 var evt = egCore.evt.parse(resp);
1365 egConfirmDialog.open(
1366 egCore.strings.OVERRIDE_TRANSFER_COPIES_TO_MARKED_VOLUME_TITLE,
1367 egCore.strings.OVERRIDE_TRANSFER_COPIES_TO_MARKED_VOLUME_BODY,
1368 {'evt_desc': evt.desc}
1369 ).result.then(function() {
1372 'open-ils.cat.transfer_copies_to_volume.override',
1373 egCore.auth.token(),
1376 { events: ['TITLE_LAST_COPY', 'COPY_DELETE_WARNING'] }
1377 ).then(function(resp) {
1378 holdingsSvcInst.fetchAgain().then(function() {
1379 $scope.holdingsGridDataProvider.refresh();
1384 ngToast.create(egCore.strings.ITEMS_TRANSFERED);
1385 holdingsSvcInst.fetchAgain().then(function() {
1386 $scope.holdingsGridDataProvider.refresh();
1396 $scope.selectedHoldingsItemStatusTgrEvt = function (){
1398 gatherSelectedHoldingsIds(),
1400 var url = egCore.env.basePath +
1401 'cat/item/' + cid + '/triggered_events';
1402 $timeout(function() { $window.open(url, '_blank') });
1407 $scope.selectedHoldingsItemStatusHolds = function (){
1409 gatherSelectedHoldingsIds(),
1411 var url = egCore.env.basePath +
1412 'cat/item/' + cid + '/holds';
1413 $timeout(function() { $window.open(url, '_blank') });
1418 $scope.selectedHoldingsDamaged = function () {
1419 egCirc.mark_damaged(gatherSelectedHoldingsIds()).then(function() {
1420 holdingsSvcInst.fetchAgain().then(function() {
1421 $scope.holdingsGridDataProvider.refresh();
1426 $scope.selectedHoldingsMissing = function () {
1427 egCirc.mark_missing(gatherSelectedHoldingsIds()).then(function() {
1428 holdingsSvcInst.fetchAgain().then(function() {
1429 $scope.holdingsGridDataProvider.refresh();
1434 $scope.attach_to_peer_bib = function() {
1435 var copy_list = gatherSelectedHoldingsIds();
1436 if (copy_list.length == 0) return;
1438 egCore.hatch.getItem('eg.cat.marked_conjoined_record').then(function(target_record) {
1439 if (!target_record) return;
1441 return $uibModal.open({
1442 templateUrl: './cat/catalog/t_conjoined_selector',
1445 ['$scope','$uibModalInstance',
1446 function($scope , $uibModalInstance) {
1447 $scope.update = false;
1449 $scope.peer_type = null;
1450 $scope.peer_type_list = [];
1451 conjoinedSvc.get_peer_types().then(function(list){
1452 $scope.peer_type_list = list;
1455 $scope.ok = function(type) {
1458 angular.forEach(copy_list, function (cp) {
1459 var n = new egCore.idl.bpbcm();
1461 n.peer_record(target_record);
1464 promises.push(egCore.pcrud.create(n));
1467 return $q.all(promises).then(function(){$uibModalInstance.close()});
1470 $scope.cancel = function($event) {
1471 $uibModalInstance.dismiss();
1472 $event.preventDefault();
1480 // ------------------------------------------------------------------
1482 var provider = egGridDataProvider.instance({});
1483 $scope.hold_grid_data_provider = provider;
1484 $scope.grid_actions = egHoldGridActions;
1485 $scope.grid_actions.refresh = function () { provider.refresh() };
1486 $scope.hold_grid_controls = {};
1488 var hold_ids = []; // current list of holds
1489 function fetchHolds(offset, count) {
1490 var ids = hold_ids.slice(offset, offset + count);
1492 return egHolds.fetch_holds(ids).then(null, null,
1493 function(hold_data) {
1499 provider.get = function(offset, count) {
1500 if ($scope.record_tab != 'holds') return $q.when();
1501 var deferred = $q.defer();
1502 hold_ids = []; // no caching ATM
1504 // open a determinate progress dialog, max value set below.
1505 egProgressDialog.open({max : 1, value : 0});
1510 'open-ils.circ.holds.retrieve_all_from_title',
1511 egCore.auth.token(), $scope.record_id,
1512 {pickup_lib : egCore.org.descendants($scope.pickup_ou.id(), true)}
1514 function(hold_data) {
1515 angular.forEach(hold_data, function(list, type) {
1516 hold_ids = hold_ids.concat(list);
1519 // Set the max value of the progress bar to the lesser of
1520 // the total number of holds to fetch or the page size
1522 egProgressDialog.update(
1523 {max : Math.min(hold_ids.length, count)});
1525 var holds_fetched = 0;
1526 fetchHolds(offset, count)
1527 .then(deferred.resolve, null,
1528 function(hold_data) {
1530 deferred.notify(hold_data);
1531 egProgressDialog.increment();
1533 )['finally'](egProgressDialog.close);
1537 return deferred.promise;
1540 $scope.detail_view = function(action, user_data, items) {
1542 $scope.detail_hold_id = h.hold.id();
1546 $scope.list_view = function(items) {
1547 $scope.detail_hold_id = null;
1550 // refresh the list of record holds when the pickup lib is changed.
1551 $scope.pickup_ou = egCore.org.get(egCore.auth.user().ws_ou());
1552 $scope.pickup_ou_changed = function(org) {
1553 $scope.pickup_ou = org;
1557 $scope.print_holds = function() {
1559 angular.forEach($scope.hold_grid_controls.allItems(), function(item) {
1561 hold : egCore.idl.toHash(item.hold),
1562 patron_last : item.patron_last,
1563 patron_alias : item.patron_alias,
1564 patron_barcode : item.patron_barcode,
1565 copy : egCore.idl.toHash(item.copy),
1566 volume : egCore.idl.toHash(item.volume),
1567 title : item.mvr.title(),
1568 author : item.mvr.author()
1572 egCore.print.print({
1573 context : 'receipt',
1574 template : 'holds_for_bib',
1575 scope : {holds : holds}
1579 $scope.current_hold_transfer_dest = egCore.hatch.getLocalItem ('eg.circ.hold.title_transfer_target');
1581 $scope.mark_hold_transfer_dest = function() {
1582 $scope.current_hold_transfer_dest = $scope.record_id;
1583 egCore.hatch.setLocalItem(
1584 'eg.circ.hold.title_transfer_target', $scope.record_id);
1585 ngToast.create(egCore.strings.HOLD_TRANSFER_DEST_MARKED);
1588 // UI presents this option as "all holds"
1589 $scope.transfer_holds_to_marked = function() {
1590 var hold_ids = $scope.hold_grid_controls.allItems().map(
1591 function(hold_data) {return hold_data.hold.id()});
1592 egHolds.transfer_to_marked_title(hold_ids);
1595 // ------------------------------------------------------------------
1596 // Initialize the selected tab
1598 function init_cat_url() {
1599 // Set the initial catalog URL. This only happens once.
1600 // The URL is otherwise generated through user navigation.
1601 if ($scope.catalog_url) return;
1603 var url = $location.absUrl().replace(/\/staff.*/, '/opac/advanced');
1605 // A record ID in the path indicates a request for the record-
1607 if ($routeParams.record_id) {
1608 url = url.replace(/advanced/, '/record/' + $scope.record_id);
1611 // Jumping directly to the results page by passing a search
1612 // query via the URL. Copy all URL params to the iframe url.
1613 if ($location.path().match(/catalog\/results/)) {
1614 url = url.replace(/advanced/, '/results?');
1616 angular.forEach($location.search(), function(val, key) {
1617 if (!first) url += '&';
1619 url += encodeURIComponent(key)
1620 + '=' + encodeURIComponent(val);
1624 // if we're displaying the advanced search form, select
1625 // whatever default pane the user has chosen via workstation
1627 if (url.match(/\/opac\/advanced$/)) {
1628 var adv_pane = egCore.hatch.getLocalItem('eg.search.adv_pane');
1630 url += '?pane=' + encodeURIComponent(adv_pane);
1634 $scope.catalog_url = url;
1637 function init_parts_url() {
1638 $scope.parts_url = $location
1642 '/conify/global/biblio/monograph_part?r='+$scope.record_id
1646 $scope.set_record_tab = function(tab) {
1647 $scope.record_tab = tab;
1660 $scope.detail_hold_record_id = $scope.record_id;
1661 // refresh the holds grid
1668 $scope.set_default_record_tab = function() {
1669 egCore.hatch.setLocalItem(
1670 'eg.cat.default_record_tab', $scope.record_tab);
1671 $timeout(function(){$scope.default_tab = $scope.record_tab});
1675 if ($scope.record_id) {
1676 $scope.default_tab = egCore.hatch.getLocalItem( 'eg.cat.default_record_tab' );
1677 tab = $routeParams.record_tab || $scope.default_tab || 'catalog';
1680 tab = $routeParams.record_tab || 'catalog';
1682 $scope.set_record_tab(tab);
1686 .controller('AuthorityCtrl',
1687 ['$scope','$routeParams','$location','$window','$q','egCore',
1688 function($scope , $routeParams , $location , $window , $q , egCore) {
1690 // set record ID on page load if available...
1691 $scope.authority_id = $routeParams.authority_id;
1693 if ($routeParams.authority_id) $scope.from_route = true;
1694 else $scope.from_route = false;
1696 $scope.stop_unload = false;
1699 .controller('URLVerifyCtrl',
1700 ['$scope','$location',
1701 function($scope , $location) {
1702 $scope.verifyurls_url = $location.absUrl().replace(/\/staff.*/, '/url_verify/sessions');
1705 .controller('VandelayCtrl',
1706 ['$scope','$location',
1707 function($scope , $location) {
1708 $scope.vandelay_url = $location.absUrl().replace(/\/staff\/cat\/catalog\/vandelay/, '/vandelay/vandelay');
1711 .controller('ManageAuthoritiesCtrl',
1712 ['$scope','$location',
1713 function($scope , $location) {
1714 $scope.manageauthorities_url = $location.absUrl().replace(/\/staff.*/, '/cat/authority/list');
1717 .controller('BatchEditCtrl',
1718 ['$scope','$location','$routeParams',
1719 function($scope , $location , $routeParams) {
1720 $scope.batchedit_url = $location.absUrl().replace(/\/eg.*/, '/opac/extras/merge_template');
1721 if ($routeParams.container_type) {
1722 switch ($routeParams.container_type) {
1724 $scope.batchedit_url += '?recordSource=b&containerid=' + $routeParams.container_id;
1727 $scope.batchedit_url += '?recordSource=r&recid=' + $routeParams.container_id;
1734 .filter('boolText', function(){
1735 return function (v) {
1740 .factory('conjoinedSvc',
1742 function(egCore , $q) {
1745 items : [], // record search results
1746 index : 0, // search grid index
1753 bpbcm : ['target_copy','peer_type'],
1754 acp : ['call_number'],
1756 bre : ['simple_record']
1758 // avoid fetching the MARC blob by specifying which
1759 // fields on the bre to select. More may be needed.
1760 // note that fleshed fields are explicitly selected.
1761 select : { bre : ['id'] },
1762 order_by : { bpbcm : ['id'] },
1765 // resolved with the last received copy
1766 service.fetch = function(rid) {
1767 if (!rid && !service.rid) return $q.when();
1769 if (rid) service.rid = rid;
1773 return egCore.pcrud.search(
1775 {peer_record : service.rid},
1778 ).then( function(list) { // finished
1779 service.items = list;
1780 return service.items;
1784 // returns a promise resolved with the list of peer bib types
1785 service.get_peer_types = function() {
1787 return $q.when(egCore.env.bpt.list);
1789 return egCore.pcrud.retrieveAll('bpt', null, {atomic : true})
1790 .then(function(list) {
1791 egCore.env.absorbList(list, 'bpt');