Like JSPac.
Signed-off-by: Thomas Berezansky <tsbere@mvlc.org>
Signed-off-by: Ben Shum <bshum@biblio.org>
[% l('Yes, by Phone') %]<br/>
<blockquote>
[% l('Phone Number:') %]<input type="text" name="phone_notify" [% setting = 'opac.default_phone';
- IF ctx.user_setting_map.$setting; %] value='[% ctx.user_setting_map.$setting | html %]' [% END %]/>
+ IF ctx.user_setting_map.$setting; %] value='[% ctx.user_setting_map.$setting | html %]'
+ [%- ELSIF ctx.user.day_phone; %] value='[% ctx.user.day_phone | html %]' [% END %]/>
</blockquote>
[% IF ctx.get_org_setting(ctx.search_ou, 'sms.enable') == 1 %]
<input type="checkbox" name="sms_notify_checkbox"
}
if(barcode == undefined || barcode == '' || barcode == cur_hold_barcode)
return;
- var load_info = xulG.get_barcode_and_settings(window, barcode, ['opac.hold_notify','opac.default_pickup_location','opac.default_sms_carrier','opac.default_sms_notify','opac.default_phone'], only_settings);
+ var load_info = xulG.get_barcode_and_settings(window, barcode, only_settings);
if(load_info == false || load_info == undefined)
return;
cur_hold_barcode = load_info.barcode;
if(!only_settings) document.getElementById('hold_usr_input').value = load_info.barcode; // Safe at this point as we already set cur_hold_barcode
if(load_info.settings['opac.default_pickup_location'])
document.getElementById('pickup_lib').value = load_info.settings['opac.default_pickup_location'];
+ if(!load_info.settings['opac.default_phone']) load_info.settings['opac.default_phone'] = '';
+ if(!load_info.settings['opac.default_sms_notify']) load_info.settings['opac.default_sms_notify'] = '';
+ if(!load_info.settings['opac.default_sms_carrier']) load_info.settings['opac.default_sms_carrier'] = '';
if(load_info.settings['opac.hold_notify']) {
var email = load_info.settings['opac.hold_notify'].indexOf('email') > -1;
var phone = load_info.settings['opac.hold_notify'].indexOf('phone') > -1;
return "user_false";
},
- 'get_barcode_and_settings' : function(window, barcode, settings, settings_only) {
+ 'get_barcode_and_settings' : function(window, barcode, settings_only) {
JSAN.use('util.network');
if(!settings_only) {
// We need to double-check the barcode for completion and such.
var network = new util.network();
// We have a barcode! Time to load settings.
// First, we need the user ID
- var user_id = network.simple_request('FM_AU_ID_RETRIEVE_VIA_BARCODE_OR_USERNAME', [ ses(), barcode ]);
- if(user_id.ilsevent != undefined || user_id.textcode != undefined)
+ var user = network.simple_request('FM_AU_RETRIEVE_VIA_BARCODE', [ ses(), barcode ]);
+ if(user.ilsevent != undefined || user.textcode != undefined)
return false;
- var settings = network.simple_request('FM_AUS_RETRIEVE', [ ses(), user_id, settings ]);
+ var settings = {};
+ for(var i = 0; i < user.settings().length; i++) {
+ settings[user.settings()[i].name()] = JSON2js(user.settings()[i].value());
+ }
+ if(!settings['opac.default_phone'] && user.day_phone()) settings['opac.default_phone'] = user.day_phone();
return {"barcode": barcode, "settings" : settings};
},
{},
{
'get_barcode' : function(a,b,c) { return xulG.get_barcode(a,b,c); },
- 'get_barcode_and_settings' : function(a,b,c,d) { return xulG.get_barcode_and_settings(a,b,c,d); }
+ 'get_barcode_and_settings' : function(a,b,c) { return xulG.get_barcode_and_settings(a,b,c); }
}
);
}