Add a patron.util.format_name() function and have every XUL interface which shows...
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 14 Oct 2009 05:03:20 +0000 (05:03 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 14 Oct 2009 05:03:20 +0000 (05:03 +0000)
Add .alias to the name thus rendered in parenthesis.

git-svn-id: svn://svn.open-ils.org/ILS/trunk@14410 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/server/cat/util.js
Open-ILS/xul/staff_client/server/circ/circ_brief.xul
Open-ILS/xul/staff_client/server/patron/bill_details.js
Open-ILS/xul/staff_client/server/patron/bill_wizard.js
Open-ILS/xul/staff_client/server/patron/display.js
Open-ILS/xul/staff_client/server/patron/hold_details.js
Open-ILS/xul/staff_client/server/patron/info_notes.xul
Open-ILS/xul/staff_client/server/patron/summary.js
Open-ILS/xul/staff_client/server/patron/util.js

index 2797678..8a1b977 100644 (file)
@@ -321,7 +321,12 @@ cat.util.mark_item_damaged = function(copy_ids) {
                                     auto_checkin = true; 
                                     JSAN.use('patron.util');
                                     var patron_obj = patron.util.retrieve_fleshed_au_via_id( ses(), my_circ.usr() );
-                                    var patron_name = patron.util.format_name( patron_obj ) + ' : ' + patron_obj.card().barcode();
+                                    var patron_name = ( patron_obj.prefix() ? patron_obj.prefix() + ' ' : '') +
+                                        patron_obj.family_name() + ', ' +
+                                        patron_obj.first_given_name() + ' ' +
+                                        ( patron_obj.second_given_name() ? patron_obj.second_given_name() + ' ' : '' ) +
+                                        ( patron_obj.suffix() ? patron_obj.suffix() : '')
+                                        + ' : ' + patron_obj.card().barcode()
                                     var msg = $("catStrings").getFormattedString('staff.cat.util.mark_item_damaged.item_circulating_to_patron', [ 
                                         copies[i].barcode(),
                                         patron_name,
@@ -355,8 +360,12 @@ cat.util.mark_item_damaged = function(copy_ids) {
                                     JSAN.use('util.money');
                                     var circ_obj = robj.payload.circ;
                                     var patron_obj = circ_obj.usr();
-                                    JSAN.use('patron.util');
-                                    var patron_name = patron.util.format_name( patron_obj ) + ' : ' + patron_obj.card().barcode();
+                                    var patron_name = ( patron_obj.prefix() ? patron_obj.prefix() + ' ' : '') +
+                                        patron_obj.family_name() + ', ' +
+                                        patron_obj.first_given_name() + ' ' +
+                                        ( patron_obj.second_given_name() ? patron_obj.second_given_name() + ' ' : '' ) +
+                                        ( patron_obj.suffix() ? patron_obj.suffix() : '')
+                                        + ' : ' + patron_obj.card().barcode()
 
                                     var r1 = error.yns_alert(
                                         $("catStrings").getFormattedString('staff.cat.util.mark_item_damaged.charge_patron_prompt.message', [ 
index c95ecb4..7589b02 100644 (file)
@@ -72,9 +72,8 @@
                                                g.patron_id = r_circ.usr(); $('add_billing').disabled = false;
                                                g.network.simple_request('FM_AU_FLESHED_RETRIEVE_VIA_ID',[ ses(), r_circ.usr() ], function(preq) {
                                                        var r_au = preq.getResultObject();
-                                                       JSAN.use('patron.util'); 
-                                                       $('patron_name').value = patron.util.format_name( r_au ) + ' : ' + r_au.card().barcode();
-                            patron.util.set_penalty_css(r_au);
+                                                       $('patron_name').value = r_au.family_name() + ', ' + r_au.first_given_name() + ' ' + (r_au.second_given_name() ? r_au.second_given_name() + ' : ' + r_au.card().barcode() : '');
+                                                       JSAN.use('patron.util'); patron.util.set_penalty_css(r_au);
                                                });
 
                                        } catch(E) {
index f479c4d..92ed9ca 100644 (file)
@@ -8,7 +8,12 @@ function retrieve_patron() {
         g.au_obj = patron.util.retrieve_fleshed_au_via_id( ses(), g.patron_id );
         
         $('patron_name').setAttribute('value', 
-            patron.util.format_name( g.au_obj ) + ' : ' + g.au_obj.card().barcode() 
+            ( g.au_obj.prefix() ? g.au_obj.prefix() + ' ' : '') + 
+            g.au_obj.family_name() + ', ' + 
+            g.au_obj.first_given_name() + ' ' +
+            ( g.au_obj.second_given_name() ? g.au_obj.second_given_name() + ' ': '' ) +
+            ( g.au_obj.suffix() ? g.au_obj.suffix() : '')
+            + ' : ' + g.au_obj.card().barcode() 
         );
     }
 
index 9d15e55..21a28e5 100644 (file)
@@ -72,7 +72,12 @@ function retrieve_patron() {
         g.au_obj = patron.util.retrieve_fleshed_au_via_id( ses(), g.patron_id );
         
         $('patron_name').setAttribute('value', 
-            patron.util.format_name( g.au_obj ) + ' : ' + g.au_obj.card().barcode() 
+            ( g.au_obj.prefix() ? g.au_obj.prefix() + ' ' : '') + 
+            g.au_obj.family_name() + ', ' + 
+            g.au_obj.first_given_name() + ' ' +
+            ( g.au_obj.second_given_name() ? g.au_obj.second_given_name() + ' ' : '' ) +
+            ( g.au_obj.suffix() ? g.au_obj.suffix() : '')
+            + ' : ' + g.au_obj.card().barcode() 
         );
     }
 
index 884cbe3..975d5b7 100644 (file)
@@ -428,11 +428,14 @@ patron.display.prototype = {
                                                ['render'],
                                                function(e) {
                                                        return function() { 
-                                                               JSAN.use('patron.util'); 
                                                                e.setAttribute('value',
-                                    patron.util.format_name( obj.patron )
+                                                                       ( obj.patron.prefix() ? obj.patron.prefix() + ' ' : '') + 
+                                                                       obj.patron.family_name() + ', ' + 
+                                                                       obj.patron.first_given_name() + ' ' +
+                                                                       ( obj.patron.second_given_name() ? obj.patron.second_given_name() + ' ' : '' ) +
+                                                                       ( obj.patron.suffix() ? obj.patron.suffix() : '')
                                                                );
-                                patron.util.set_penalty_css(obj.patron);
+                                                               JSAN.use('patron.util'); patron.util.set_penalty_css(obj.patron);
                                                        };
                                                }
                                        ],
index 7f321d2..96f3ea3 100644 (file)
@@ -83,7 +83,12 @@ function render_patron() {
         var au_obj = patron.util.retrieve_fleshed_au_via_id( ses(), g.ahr.usr() );
         
         $('patron_name').setAttribute('value', 
-            patron.util.format_name( au_obj ) + ' : ' + au_obj.card().barcode() 
+            ( au_obj.prefix() ? au_obj.prefix() + ' ' : '') + 
+            au_obj.family_name() + ', ' + 
+            au_obj.first_given_name() + ' ' +
+            ( au_obj.second_given_name() ? au_obj.second_given_name() + ' ' : '' ) +
+            ( au_obj.suffix() ? au_obj.suffix() : '')
+            + ' : ' + au_obj.card().barcode() 
         );
     }
 }
index cc0ddf4..f62f0dc 100644 (file)
                                                                p.simple(
                                                                        '<hr/>'
                                                                        + '<p>'+ $("patronStrings").getString('staff.patron.info_notes.render_notes.pertaining_to') + ' ' + 
-                                                                               patron.util.format_name( patron_obj ) + ' : ' 
+                                                                               ( patron_obj.prefix() ? patron_obj.prefix() + ' ' : '') + 
+                                                                               patron_obj.family_name() + ', ' + 
+                                                                               patron_obj.first_given_name() + ' ' +
+                                                                               ( patron_obj.second_given_name() ? patron_obj.second_given_name() + ' ' : '' ) +
+                                                                               ( patron_obj.suffix() ? patron_obj.suffix() : '')
+                                                                               + ' : ' 
                                                                        + patron_obj.card().barcode() + '</p>'
                                                                        + '<p><b>"' + g.notes[id].title() + '"</b>'
                                                                        + $("patronStrings").getFormattedString('staff.patron.info_notes.render_notes.created_on', [g.notes[id].create_date().toString().substr(0,10), staff_obj[0], g.data.hash.aou[ staff_obj[3] ].shortname()]) 
index 2e4e351..0181e09 100644 (file)
@@ -638,7 +638,11 @@ patron.summary.prototype = {
                                                                obj.patron = robj;
                                                                JSAN.use('patron.util');
                                                                util.widgets.set_text('patron_name',
-                                    patron.util.format_name( obj.patron )
+                                                                       ( obj.patron.prefix() ? obj.patron.prefix() + ' ' : '') + 
+                                                                       obj.patron.family_name() + ', ' + 
+                                                                       obj.patron.first_given_name() + ' ' +
+                                                                       ( obj.patron.second_given_name() ? obj.patron.second_given_name() + ' ' : '' ) +
+                                                                       ( obj.patron.suffix() ? obj.patron.suffix() : '')
                                                                );
                                                                patron.util.set_penalty_css(obj.patron);
                                                                JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
index e690cb6..1cca1d9 100644 (file)
@@ -6,7 +6,7 @@ patron.util = {};
 patron.util.EXPORT_OK  = [ 
        'columns', 'mbts_columns', 'mb_columns', 'mp_columns', /*'std_map_row_to_column',*/ 'std_map_row_to_columns',
        'retrieve_au_via_id', 'retrieve_fleshed_au_via_id', 'retrieve_fleshed_au_via_barcode', 'set_penalty_css', 'retrieve_name_via_id',
-    'merge', 'ausp_columns', 'format_name'
+    'merge', 'ausp_columns'
 ];
 patron.util.EXPORT_TAGS        = { ':all' : patron.util.EXPORT_OK };
 
@@ -808,14 +808,4 @@ patron.util.merge = function(record_ids) {
     }
 }
 
-patron.util.format_name = function(patron_obj) {
-    var patron_name = ( patron_obj.prefix() ? patron_obj.prefix() + ' ' : '') +
-        patron_obj.family_name() + ', ' +
-        patron_obj.first_given_name() + ' ' +
-        ( patron_obj.second_given_name() ? patron_obj.second_given_name() + ' ' : '' ) +
-        ( patron_obj.suffix() ? patron_obj.suffix() : '') +
-        ( patron_obj.alias() ? ' (' + patron_obj.alias() + ')' : '');
-    return patron_name;
-}
-
 dump('exiting patron/util.js\n');