'MERGE_RECORDS' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.biblio.records.merge' },
'PATRON_BARCODE_EXISTS' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.barcode.exists' },
'RECALCULATE_STANDING_PENALTIES' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.penalties.update' },
+ 'USER_ORG_UNIT_OPT_IN_FEATURE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.org_unit_opt_in.enabled' },
+ 'USER_ORG_UNIT_OPT_IN_CHECK' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.org_unit_opt_in.check' },
+ 'USER_ORG_UNIT_OPT_IN_CREATE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.org_unit_opt_in.create' },
}
const urls = {
<?xul-overlay href="/xul/server/OpenILS/util_overlay.xul"?>
<window id="gen_offline_menus_win"
- onload="try { gen_offline_menus_init(); } catch(E) { alert(E); }"
+ onload="try { my_init(); } catch(E) { alert(E); }"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script>
<![CDATA[
- function gen_offline_menus_init() {
-
- netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+ function my_init() {
+ netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
if (typeof JSAN == 'undefined') {
throw(
JSAN.use('util.error'); g.error = new util.error();
JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'});
JSAN.use('util.network'); g.network = new util.network();
+
+ gen_offline_menus_init();
+
+ var r = g.network.simple_request('USER_ORG_UNIT_OPT_IN_FEATURE',[]);
+ g.data.user_org_unit_opt_in_enabled = (r == "1" || r == 1);
+ g.data.stash('user_org_unit_opt_in_enabled');
+ }
+
+ function gen_offline_menus_init() {
+
+ netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+
JSAN.use('util.functional');
save_object('offline_ou_list', build_ou_list());
JSAN.use('util.error'); g.error = new util.error();
g.error.sdump('D_TRACE','my_init() for patron/barcode_entry.xul');
+ JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'});
+
var tb = document.getElementById('barcode_tb');
tb.addEventListener(
'keypress',
return;
}
- sound.good();
-
- spawn(barcode);
+ if (g.data.user_org_unit_opt_in_enabled) {
+ var r = net.simple_request('USER_ORG_UNIT_OPT_IN_CHECK',[ ses(), robj ]);
+ if (typeof r.ilsevent != 'undefined') {
+ throw(r);
+ } else {
+
+ if (r == 0) {
+
+ JSAN.use('patron.util');
+ var parts = patron.util.retrieve_name_via_id( ses(), robj );
+
+ if (0 != g.error.yns_alert(
+ 'Does patron ' + parts[0] + ', ' + parts[1] + (parts[2] ? ' ' + parts[2] : '') + ' from ' + g.data.hash.aou[ parts[3] ].shortname() + ' consent to having their personal information shared with your library?',
+ 'Patron/Library Opt-In Confirmation',
+ 'Accept', 'Deny', null, 'Check here to confirm this message'
+ )
+ ) {
+ tb.select(); tb.focus();
+ return;
+ } else {
+ var c = net.simple_request('USER_ORG_UNIT_OPT_IN_CREATE',[ ses(), robj ]);
+ if (typeof c.ilsevent != 'undefined') throw(r);
+ }
+ }
+
+ sound.good();
+ spawn(barcode);
+ }
+ } else {
+ sound.good();
+ spawn(barcode);
+ }
}
);
} catch(E) {