TPac: Include day phone default_phone backup
authorThomas Berezansky <tsbere@mvlc.org>
Fri, 16 Mar 2012 18:46:19 +0000 (14:46 -0400)
committerThomas Berezansky <tsbere@mvlc.org>
Fri, 30 Mar 2012 17:53:19 +0000 (13:53 -0400)
Like JSPac.

Signed-off-by: Thomas Berezansky <tsbere@mvlc.org>
Signed-off-by: Ben Shum <bshum@biblio.org>
Open-ILS/src/templates/opac/parts/place_hold.tt2
Open-ILS/web/js/ui/default/opac/staff.js
Open-ILS/xul/staff_client/chrome/content/main/menu.js
Open-ILS/xul/staff_client/server/patron/display.js

index dca48f2..71c9bde 100644 (file)
@@ -82,7 +82,8 @@
                     [% 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"
index 7ab5150..e72f77c 100644 (file)
@@ -32,13 +32,16 @@ function staff_hold_usr_barcode_changed() {
         }
         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;
index c6d9755..4ca96d8 100644 (file)
@@ -2530,7 +2530,7 @@ commands:
             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.
@@ -2546,10 +2546,14 @@ commands:
         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};
     },
 
index d3a4587..7100484 100644 (file)
@@ -392,7 +392,7 @@ patron.display.prototype = {
                                 {},
                                 {
                                     '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); }
                                 }
                             );
                         }