2 angular.module('egCoreMod')
3 // toss tihs onto egCoreMod since the page app may vary
5 .factory('patronRegSvc', ['$q', 'egCore', function($q, egCore) {
8 field_doc : {}, // config.idl_field_doc
9 profiles : [], // permission groups
11 user_settings : {}, // applied user settings
12 user_setting_types : {}, // config.usr_setting_type
13 opt_in_setting_types : {}, // config.usr_setting_type for event-def opt-in
14 survey_questions : {},
16 survey_responses : {}, // survey.responses for loaded patron in progress
17 orig_survey_responses : {},// survey.responses for loaded patron
18 virt_id : -1 // virtual ID for new objects
21 // launch a series of parallel data retrieval calls
22 service.init = function(scope) {
24 service.get_field_doc(),
25 service.get_perm_groups(),
26 service.get_ident_types(),
27 service.get_user_settings(),
28 service.get_org_settings(),
29 service.get_stat_cats(),
30 service.get_surveys(),
31 service.get_net_access_levels()
35 service.get_surveys = function() {
36 var org_ids = egCore.org.ancestors(egCore.auth.user().ws_ou(), true);
38 return egCore.pcrud.search('asv',
47 ).then(function(surveys) {
48 service.surveys = surveys;
50 angular.forEach(surveys, function(survey) {
51 angular.forEach(survey.questions(), function(question) {
52 service.survey_questions[question.id()] = question;
53 angular.forEach(question.answers(), function(answer) {
54 service.survey_answers[answer.id()] = answer;
59 if (!service.patron_id) return;
61 // existing survey responses.
62 service.orig_survey_responses = [];
64 // when building responses in via the form, we track
65 // question ID's to answer objects. these are later turned
66 // into survey_response's during save time.
67 return egCore.pcrud.search('asvr', {usr : service.patron_id})
68 .then(null, null, function(resp) {
69 service.orig_survey_responses.push(resp);
70 service.survey_responses[resp.question()] =
71 service.survey_answers[resp.answer()];
76 service.get_stat_cats = function() {
77 return egCore.net.request(
79 'open-ils.circ.stat_cat.actor.retrieve.all',
80 egCore.auth.token(), egCore.auth.user().ws_ou()
81 ).then(function(cats) {
82 service.stat_cats = cats;
86 service.get_org_settings = function() {
87 return egCore.org.settings([
88 'global.password_regex',
89 'global.juvenile_age_threshold',
90 'patron.password.use_phone',
91 'ui.patron.default_inet_access_level',
92 'ui.patron.default_ident_type',
93 'ui.patron.default_country',
94 'ui.patron.registration.require_address',
95 'circ.holds.behind_desk_pickup_supported',
96 'circ.patron_edit.clone.copy_address',
97 'ui.patron.edit.au.prefix.require',
98 'ui.patron.edit.au.prefix.show',
99 'ui.patron.edit.au.prefix.suggest',
100 'ui.patron.edit.ac.barcode.regex',
101 'ui.patron.edit.au.second_given_name.show',
102 'ui.patron.edit.au.second_given_name.suggest',
103 'ui.patron.edit.au.suffix.show',
104 'ui.patron.edit.au.suffix.suggest',
105 'ui.patron.edit.au.alias.show',
106 'ui.patron.edit.au.alias.suggest',
107 'ui.patron.edit.au.dob.require',
108 'ui.patron.edit.au.dob.show',
109 'ui.patron.edit.au.dob.suggest',
110 'ui.patron.edit.au.dob.calendar',
111 'ui.patron.edit.au.juvenile.show',
112 'ui.patron.edit.au.juvenile.suggest',
113 'ui.patron.edit.au.ident_value.show',
114 'ui.patron.edit.au.ident_value.suggest',
115 'ui.patron.edit.au.ident_value2.show',
116 'ui.patron.edit.au.ident_value2.suggest',
117 'ui.patron.edit.au.email.require',
118 'ui.patron.edit.au.email.show',
119 'ui.patron.edit.au.email.suggest',
120 'ui.patron.edit.au.email.regex',
121 'ui.patron.edit.au.email.example',
122 'ui.patron.edit.au.day_phone.require',
123 'ui.patron.edit.au.day_phone.show',
124 'ui.patron.edit.au.day_phone.suggest',
125 'ui.patron.edit.au.day_phone.regex',
126 'ui.patron.edit.au.day_phone.example',
127 'ui.patron.edit.au.evening_phone.require',
128 'ui.patron.edit.au.evening_phone.show',
129 'ui.patron.edit.au.evening_phone.suggest',
130 'ui.patron.edit.au.evening_phone.regex',
131 'ui.patron.edit.au.evening_phone.example',
132 'ui.patron.edit.au.other_phone.require',
133 'ui.patron.edit.au.other_phone.show',
134 'ui.patron.edit.au.other_phone.suggest',
135 'ui.patron.edit.au.other_phone.regex',
136 'ui.patron.edit.au.other_phone.example',
137 'ui.patron.edit.phone.regex',
138 'ui.patron.edit.phone.example',
139 'ui.patron.edit.au.active.show',
140 'ui.patron.edit.au.active.suggest',
141 'ui.patron.edit.au.barred.show',
142 'ui.patron.edit.au.barred.suggest',
143 'ui.patron.edit.au.master_account.show',
144 'ui.patron.edit.au.master_account.suggest',
145 'ui.patron.edit.au.claims_returned_count.show',
146 'ui.patron.edit.au.claims_returned_count.suggest',
147 'ui.patron.edit.au.claims_never_checked_out_count.show',
148 'ui.patron.edit.au.claims_never_checked_out_count.suggest',
149 'ui.patron.edit.au.alert_message.show',
150 'ui.patron.edit.au.alert_message.suggest',
151 'ui.patron.edit.aua.post_code.regex',
152 'ui.patron.edit.aua.post_code.example',
153 'ui.patron.edit.aua.county.require',
155 'ui.patron.edit.default_suggested',
156 'opac.barcode_regex',
157 'opac.username_regex',
159 'ui.patron.edit.aua.state.require',
160 'ui.patron.edit.aua.state.suggest',
161 'ui.patron.edit.aua.state.show'
162 ]).then(function(settings) {
163 service.org_settings = settings;
164 return service.process_org_settings(settings);
168 // some org settings require the retrieval of additional data
169 service.process_org_settings = function(settings) {
173 if (settings['sms.enable']) {
174 // fetch SMS carriers
176 egCore.pcrud.search('csc',
179 {'class':'csc', 'field':'name'},
180 {'class':'csc', 'field':'region'}
182 ).then(function(carriers) {
183 service.sms_carriers = carriers;
187 // if other promises are added below, this is not necessary.
188 promises.push($q.when());
191 // other post-org-settings processing goes here,
192 // adding to promises as needed.
194 return $q.all(promises);
197 service.get_ident_types = function() {
198 return egCore.pcrud.retrieveAll('cit', {}, {atomic : true})
199 .then(function(types) { service.ident_types = types });
202 service.get_net_access_levels = function() {
203 return egCore.pcrud.retrieveAll('cnal', {}, {atomic : true})
204 .then(function(levels) { service.net_access_levels = levels });
207 service.get_perm_groups = function() {
208 if (egCore.env.pgt) {
209 service.profiles = egCore.env.pgt.list;
212 return egCore.pcrud.search('pgt', {parent : null},
213 {flesh : -1, flesh_fields : {pgt : ['children']}}
216 egCore.env.absorbTree(tree, 'pgt')
217 service.profiles = egCore.env.pgt.list;
223 service.get_field_doc = function() {
225 return egCore.pcrud.search('fdoc', {
226 fm_class: ['au', 'ac', 'aua', 'actsc', 'asv', 'asvq', 'asva']})
227 .then(null, null, function(doc) {
228 if (!service.field_doc[doc.fm_class()]) {
229 service.field_doc[doc.fm_class()] = {};
231 service.field_doc[doc.fm_class()][doc.field()] = doc;
235 service.get_user_settings = function() {
236 var org_ids = egCore.org.ancestors(egCore.auth.user().ws_ou(), true);
239 'circ.holds_behind_desk',
240 'circ.collections.exempt',
242 'opac.default_phone',
243 'opac.default_pickup_location',
244 'opac.default_sms_carrier',
245 'opac.default_sms_notify'];
247 return egCore.pcrud.search('cust', {
249 {name : static_types}, // common user settings
250 {name : { // opt-in notification user settings
252 select : {atevdef : ['opt_in_setting']},
254 // we only care about opt-in settings for
255 // event_defs our users encounter
256 where : {'+atevdef' : {owner : org_ids}}
260 }, {}, {atomic : true}).then(function(setting_types) {
262 angular.forEach(setting_types, function(stype) {
263 service.user_setting_types[stype.name()] = stype;
264 if (static_types.indexOf(stype.name()) == -1) {
265 service.opt_in_setting_types[stype.name()] = stype;
269 if (service.patron_id) {
270 // retrieve applied values for the current user
271 // for the setting types we care about.
274 setting_types.map(function(obj) { return obj.name() });
276 return egCore.net.request(
278 'open-ils.actor.patron.settings.retrieve.authoritative',
282 ).then(function(settings) {
283 service.user_settings = settings;
287 // apply default user setting values
288 angular.forEach(setting_types, function(stype, index) {
289 if (stype.reg_default() != undefined) {
290 service.user_settings[setting.name()] =
291 setting.reg_default();
298 service.init_patron = function(current) {
301 return service.init_new_patron();
303 service.patron = current;
304 return service.init_existing_patron(current)
307 service.ingest_address = function(patron, addr) {
308 addr.valid = addr.valid == 't';
309 addr.within_city_limits = addr.within_city_limits == 't';
310 addr._is_mailing = (patron.mailing_address &&
311 addr.id == patron.mailing_address.id);
312 addr._is_billing = (patron.billing_address &&
313 addr.id == patron.billing_address.id);
317 * Existing patron objects reqire some data munging before insertion
320 * 1. Turn everything into a hash
321 * 2. ... Except certain fields (selectors) whose widgets require objects
322 * 3. Bools must be Boolean, not t/f.
324 service.init_existing_patron = function(current) {
326 var patron = egCore.idl.toHash(current);
328 patron.home_ou = egCore.org.get(patron.home_ou.id);
329 patron.expire_date = new Date(Date.parse(patron.expire_date));
330 patron.dob = new Date(Date.parse(patron.dob));
331 patron.profile = current.profile(); // pre-hash version
332 patron.net_access_level = current.net_access_level();
333 patron.ident_type = current.ident_type();
334 patron.survey_responses = service.orig_survey_responses;
337 ['juvenile', 'barred', 'active', 'master_account'],
338 function(field) { patron[field] = patron[field] == 't'; }
341 angular.forEach(patron.cards, function(card) {
342 card.active = card.active == 't';
343 if (card.id == patron.card.id) {
345 card._primary = 'on';
349 angular.forEach(patron.addresses,
350 function(addr) { service.ingest_address(patron, addr) });
355 service.init_new_patron = function() {
357 id : service.virt_id--,
360 address_type : egCore.strings.REG_ADDR_TYPE,
363 within_city_limits : false
367 id : service.virt_id--,
378 home_ou : egCore.org.get(egCore.auth.user().ws_ou()),
380 // TODO default profile group?
385 // translate the patron back into IDL form
386 service.save_user = function(phash) {
388 var patron = egCore.idl.fromHash('au', phash);
390 patron.home_ou(patron.home_ou().id());
392 patron.expire_date().toISOString().replace(/T.*/,''));
393 patron.profile(patron.profile().id());
395 patron.dob(patron.dob().toISOString().replace(/T.*/,''));
396 if (patron.ident_type())
397 patron.ident_type(patron.ident_type().id());
398 if (patron.net_access_level())
399 patron.net_access_level(patron.net_access_level().id());
402 ['juvenile', 'barred', 'active', 'master_account'],
403 function(field) { patron[field](phash[field] ? 't' : 'f'); }
406 var card_hashes = patron.cards();
408 angular.forEach(card_hashes, function(chash) {
409 var card = egCore.idl.fromHash('ac', chash)
410 card.usr(patron.id());
411 card.active(chash.active ? 't' : 'f');
412 patron.cards().push(card);
413 if (chash._primary) {
418 var addr_hashes = patron.addresses();
419 patron.addresses([]);
420 angular.forEach(addr_hashes, function(addr_hash) {
421 if (!addr_hash.isnew && !addr_hash.isdeleted)
422 addr_hash.ischanged = true;
423 var addr = egCore.idl.fromHash('aua', addr_hash);
424 patron.addresses().push(addr);
425 addr.valid(addr.valid() ? 't' : 'f');
426 addr.within_city_limits(addr.within_city_limits() ? 't' : 'f');
427 if (addr_hash._is_mailing) patron.mailing_address(addr);
428 if (addr_hash._is_billing) patron.billing_address(addr);
431 angular.forEach(service.survey_responses, function(answer) {
433 var existing = patron.survey_responses().filter(
435 return resp.question() == answer.question();
439 if (existing.answer() != answer.id()) {
441 existing.answer(answer.id());
442 existing.answer_date('now');
443 existing.ischanged(true);
444 existing.isnew(false);
445 patron.survey_responses().push(existing);
448 // first-time answering this question
450 // find the question object linked to this answer
451 var question = service.survey_questions[answer.question()];
452 var resp = new egCore.idl.asvr();
454 resp.survey(question.survey());
455 resp.question(question.id());
456 resp.answer(answer.id());
457 resp.usr(patron.id());
458 resp.answer_date('now');
459 patron.survey_responses().push(resp);
463 if (!patron.isnew()) patron.ischanged(true);
465 return egCore.net.request(
467 'open-ils.actor.patron.update',
468 egCore.auth.token(), patron);
471 service.save_user_settings = function(new_user, user_settings) {
472 // user_settings contains the values from the scope/form.
473 // service.user_settings contain the values from page load time.
476 if (service.patron_id) {
477 // only update modified settings for existing patrons
478 angular.forEach(user_settings, function(val, key) {
479 if (val !== service.user_settings[key])
484 // all non-null setting values are updated for new patrons
485 angular.forEach(user_settings, function(val, key) {
486 if (val !== null) settings[key] = val;
490 if (Object.keys(settings).length == 0) return $q.when();
492 return egCore.net.request(
494 'open-ils.actor.patron.settings.update',
495 egCore.auth.token(), new_user.id(), settings
496 ).then(function(resp) {
497 console.log('settings returned ' + resp);
506 function PatronRegCtrl($scope, $routeParams,
507 $q, $modal, $window, egCore, patronSvc, patronRegSvc) {
509 $scope.clone_id = $routeParams.clone_id;
510 $scope.stage_username = $routeParams.stage_username;
512 patronRegSvc.patron_id = $routeParams.edit_id || $routeParams.id;
514 // for existing patrons, disable barcode input by default
515 $scope.disable_bc = $scope.focus_usrname = Boolean($scope.patron_id);
516 $scope.focus_bc = !Boolean($scope.patron_id);
518 if (!$scope.edit_passthru) {
519 // in edit more, scope.edit_passthru is delivered to us by
520 // the enclosing controller. In register mode, there is
521 // no enclosing controller, so we create our own.
522 $scope.edit_passthru = {};
525 // 0=all, 1=suggested, 2=all
526 $scope.edit_passthru.vis_level = 0;
527 // TODO: add save/clone handlers here
531 $scope.initTab ? // initTab comes from patron app
532 $scope.initTab('edit', $routeParams.id) : $q.when(),
537 // called after initTab and patronRegSvc.init have completed
539 var prs = patronRegSvc; // brevity
540 // in standalone mode, we have no patronSvc
541 $scope.patron = prs.init_patron(patronSvc ? patronSvc.current : null);
542 $scope.field_doc = prs.field_doc;
543 $scope.profiles = prs.profiles;
544 $scope.ident_types = prs.ident_types;
545 $scope.net_access_levels = prs.net_access_levels;
546 $scope.user_setting_types = prs.user_setting_types;
547 $scope.opt_in_setting_types = prs.opt_in_setting_types;
548 $scope.org_settings = prs.org_settings;
549 $scope.sms_carriers = prs.sms_carriers;
550 $scope.stat_cats = prs.stat_cats;
551 $scope.surveys = prs.surveys;
552 $scope.survey_responses = prs.survey_responses;
554 $scope.user_settings = prs.user_settings;
555 // clone the user settings back into the patronRegSvc so
556 // we have a copy of the original state of the settings.
557 prs.user_settings = {};
558 angular.forEach($scope.user_settings, function(val, key) {
559 prs.user_settings[key] = val;
562 extract_hold_notify();
564 if ($scope.org_settings['ui.patron.edit.default_suggested'])
565 $scope.edit_passthru.vis_level = 1;
567 if ($scope.patron.isnew) {
568 $scope.generate_password();
569 $scope.hold_notify_phone = true;
570 $scope.hold_notify_email = true;
572 if (prs.org_settings['ui.patron.default_ident_type']) {
573 // $scope.patron needs this field to be an object
574 var id = prs.org_settings['ui.patron.default_ident_type'];
575 var ident_type = $scope.ident_types.filter(
576 function(type) { return type.id() == id })[0];
577 $scope.patron.ident_type = ident_type;
579 if (prs.org_settings['ui.patron.default_inet_access_level']) {
580 // $scope.patron needs this field to be an object
581 var id = prs.org_settings['ui.patron.default_inet_access_level'];
582 var level = $scope.net_access_levels.filter(
583 function(lvl) { return lvl.id() == id })[0];
584 $scope.patron.net_access_level = level;
586 if (prs.org_settings['ui.patron.default_country']) {
587 $scope.patron.addresses[0].country =
588 prs.org_settings['ui.patron.default_country'];
594 // returns the tree depth of the selected profile group tree node.
595 $scope.pgt_depth = function(grp) {
597 while (grp = egCore.env.pgt.map[grp.parent()]) d++;
601 // IDL fields used for labels in the UI.
602 $scope.idl_fields = {
603 au : egCore.idl.classes.au.field_map,
604 ac : egCore.idl.classes.ac.field_map,
605 aua : egCore.idl.classes.aua.field_map
608 // field visibility cache. Some fields are universally required.
609 var field_visibility = {
614 'au.first_given_name' : 2,
615 'au.family_name' : 2,
619 'au.expire_date' : 2,
620 'au.net_access_level' : 2,
621 'aua.address_type' : 2,
630 'aua.within_city_limits' : 2,
635 // returns true if the selected field should be visible
636 // given the current required/suggested/all setting.
637 $scope.show_field = function(field_key) {
639 if (field_visibility[field_key] == undefined) {
640 // compile and cache the visibility for the selected field
642 // org settings have not been received yet.
643 if (!$scope.org_settings) return false;
645 var req_set = 'ui.patron.edit.' + field_key + '.require';
646 var sho_set = 'ui.patron.edit.' + field_key + '.show';
647 var sug_set = 'ui.patron.edit.' + field_key + '.suggest';
649 if ($scope.org_settings[req_set]) {
650 field_visibility[field_key] = 2;
651 } else if ($scope.org_settings[sho_set]) {
652 field_visibility[field_key] = 2;
653 } else if ($scope.org_settings[sug_set]) {
654 field_visibility[field_key] = 1;
656 field_visibility[field_key] = 0;
660 return field_visibility[field_key] >= $scope.edit_passthru.vis_level;
663 // generates a random 4-digit password
664 $scope.generate_password = function() {
665 $scope.patron.passwd = Math.floor(Math.random()*9000) + 1000;
668 $scope.set_expire_date = function() {
669 if (!$scope.patron.profile) return;
670 var seconds = egCore.date.intervalToSeconds(
671 $scope.patron.profile.perm_interval());
672 var now_epoch = new Date().getTime();
673 $scope.patron.expire_date = new Date(
674 now_epoch + (seconds * 1000 /* milliseconds */))
677 // grp is the pgt object
678 $scope.set_profile = function(grp) {
679 $scope.patron.profile = grp;
680 $scope.set_expire_date();
683 $scope.new_address = function() {
684 var addr = egCore.idl.toHash(new egCore.idl.aua());
685 patronRegSvc.ingest_address($scope.patron, addr);
686 addr.id = patronRegSvc.virt_id--;
689 addr.within_city_limits = true;
690 $scope.patron.addresses.push(addr);
693 // keep deleted addresses out of the patron object so
694 // they won't appear in the UI. They'll be re-inserted
695 // when the patron is updated.
696 deleted_addresses = [];
697 $scope.delete_address = function(id) {
699 angular.forEach($scope.patron.addresses, function(addr) {
702 addr.isdeleted = true;
703 deleted_addresses.push(addr);
706 addresses.push(addr);
709 $scope.patron.addresses = addresses;
712 $scope.post_code_changed = function(addr) {
714 'open-ils.search', 'open-ils.search.zip', addr.post_code)
715 .then(function(resp) {
717 if (resp.city) addr.city = resp.city;
718 if (resp.state) addr.state = resp.state;
719 if (resp.county) addr.county = resp.county;
720 if (resp.alert) alert(resp.alert);
724 $scope.replace_card = function() {
725 $scope.patron.card.active = false;
726 $scope.patron.card.ischanged = true;
727 $scope.disable_bc = false;
729 var new_card = egCore.idl.toHash(new egCore.idl.ac());
730 new_card.id = patronRegSvc.virt_id--;
731 new_card.isnew = true;
732 new_card.active = true;
733 new_card._primary = 'on';
734 $scope.patron.card = new_card;
735 $scope.patron.cards.push(new_card);
738 $scope.day_phone_changed = function(phone) {
739 if (phone && $scope.org_settings['patron.password.use_phone']) {
740 $scope.patron.passwd = phone.substr(-4);
744 $scope.barcode_changed = function(bc) {
748 'open-ils.actor.barcode.exists',
749 egCore.auth.token(), bc
750 ).then(function(resp) {
752 console.log('duplicate barcode detected: ' + bc);
755 if (!$scope.patron.usrname)
756 $scope.patron.usrname = bc;
762 $scope.cards_dialog = function() {
764 templateUrl: './circ/patron/t_patron_cards_dialog',
766 ['$scope','$modalInstance','cards',
767 function($scope , $modalInstance , cards) {
768 // scope here is the modal-level scope
769 $scope.args = {cards : cards};
770 $scope.ok = function() { $modalInstance.close($scope.args) }
771 $scope.cancel = function () { $modalInstance.dismiss() }
775 // scope here is the controller-level scope
776 return $scope.patron.cards;
781 angular.forEach(args.cards, function(card) {
782 card.ischanged = true; // assume cards need updating, OK?
783 if (card._primary == 'on' &&
784 card.id != $scope.patron.card.id) {
785 $scope.patron.card = card;
792 $scope.set_addr_type = function(addr, type) {
793 var addrs = $scope.patron.addresses;
794 if (addr['_is_'+type]) {
795 angular.forEach(addrs, function(a) {
796 if (a.id != addr.id) a['_is_'+type] = false;
799 // unchecking mailing/billing means we have to randomly
800 // select another address to fill that role. Select the
801 // first address in the list (that does not match the
803 for (var i = 0; i < addrs.length; i++) {
804 if (addrs[i].id != addr.id) {
805 addrs[i]['_is_' + type] = true;
813 // Translate hold notify preferences from the form/scope back into a
814 // single user setting value for opac.hold_notify.
815 function compress_hold_notify() {
816 var hold_notify = '';
818 if ($scope.hold_notify_phone) {
819 hold_notify = 'phone';
822 if ($scope.hold_notify_email) {
823 hold_notify = splitter + 'email';
826 if ($scope.hold_notify_sms) {
827 hold_notify = splitter + 'sms';
830 $scope.user_settings['opac.hold_notify'] = hold_notify;
833 function extract_hold_notify() {
834 notify = $scope.user_settings['opac.hold_notify'];
836 $scope.hold_notify_phone = Boolean(notify.match(/phone/));
837 $scope.hold_notify_email = Boolean(notify.match(/email/));
838 $scope.hold_notify_sms = Boolean(notify.match(/sms/));
841 $scope.edit_passthru.save = function() {
843 // toss the deleted addresses back into the patron's list of
844 // addresses so it's included in the update
845 $scope.patron.addresses =
846 $scope.patron.addresses.concat(deleted_addresses);
848 compress_hold_notify();
850 patronRegSvc.save_user($scope.patron)
851 .then(function(new_user) {
852 if (new_user && new_user.classname) {
853 return patronRegSvc.save_user_settings(
854 new_user, $scope.user_settings);
856 alert('Patron update failed. \n\n' + js2JSON(new_user));
857 return true; // ensure page reloads to reset
859 }).then(function(keep_going) {
860 // reloading the page means potentially losing some information
861 // (e.g. last patron search), but is the only way to ensure all
862 // components are properly updated to reflect the modified patron.
863 $window.location.href = location.href;
868 // This controller may be loaded from different modules (patron edit vs.
869 // register new patron), so we have to inject the controller params manually.
870 PatronRegCtrl.$inject = ['$scope', '$routeParams', '$q', '$modal',
871 '$window', 'egCore', 'patronSvc', 'patronRegSvc'];