[open-ils-commits] r14411 - in trunk/Open-ILS/xul/staff_client/server: cat circ patron (phasefx)
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Oct 14 01:06:19 EDT 2009
Author: phasefx
Date: 2009-10-14 01:06:16 -0400 (Wed, 14 Oct 2009)
New Revision: 14411
Modified:
trunk/Open-ILS/xul/staff_client/server/cat/util.js
trunk/Open-ILS/xul/staff_client/server/circ/circ_brief.xul
trunk/Open-ILS/xul/staff_client/server/patron/bill_details.js
trunk/Open-ILS/xul/staff_client/server/patron/bill_wizard.js
trunk/Open-ILS/xul/staff_client/server/patron/display.js
trunk/Open-ILS/xul/staff_client/server/patron/hold_details.js
trunk/Open-ILS/xul/staff_client/server/patron/info_notes.xul
trunk/Open-ILS/xul/staff_client/server/patron/summary.js
trunk/Open-ILS/xul/staff_client/server/patron/util.js
Log:
Add a patron.util.format_name() function and have every XUL interface which shows the patron's name make use of it.
Add .alias to the name thus rendered in parenthesis.
Modified: trunk/Open-ILS/xul/staff_client/server/cat/util.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/cat/util.js 2009-10-14 05:03:20 UTC (rev 14410)
+++ trunk/Open-ILS/xul/staff_client/server/cat/util.js 2009-10-14 05:06:16 UTC (rev 14411)
@@ -321,12 +321,7 @@
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_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 patron_name = patron.util.format_name( patron_obj ) + ' : ' + patron_obj.card().barcode();
var msg = $("catStrings").getFormattedString('staff.cat.util.mark_item_damaged.item_circulating_to_patron', [
copies[i].barcode(),
patron_name,
@@ -360,12 +355,8 @@
JSAN.use('util.money');
var circ_obj = robj.payload.circ;
var patron_obj = circ_obj.usr();
- 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()
+ JSAN.use('patron.util');
+ var patron_name = patron.util.format_name( patron_obj ) + ' : ' + patron_obj.card().barcode();
var r1 = error.yns_alert(
$("catStrings").getFormattedString('staff.cat.util.mark_item_damaged.charge_patron_prompt.message', [
Modified: trunk/Open-ILS/xul/staff_client/server/circ/circ_brief.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/circ/circ_brief.xul 2009-10-14 05:03:20 UTC (rev 14410)
+++ trunk/Open-ILS/xul/staff_client/server/circ/circ_brief.xul 2009-10-14 05:06:16 UTC (rev 14411)
@@ -72,8 +72,9 @@
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();
- $('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);
+ JSAN.use('patron.util');
+ $('patron_name').value = patron.util.format_name( r_au ) + ' : ' + r_au.card().barcode();
+ patron.util.set_penalty_css(r_au);
});
} catch(E) {
Modified: trunk/Open-ILS/xul/staff_client/server/patron/bill_details.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/bill_details.js 2009-10-14 05:03:20 UTC (rev 14410)
+++ trunk/Open-ILS/xul/staff_client/server/patron/bill_details.js 2009-10-14 05:06:16 UTC (rev 14411)
@@ -8,12 +8,7 @@
g.au_obj = patron.util.retrieve_fleshed_au_via_id( ses(), g.patron_id );
$('patron_name').setAttribute('value',
- ( 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()
+ patron.util.format_name( g.au_obj ) + ' : ' + g.au_obj.card().barcode()
);
}
Modified: trunk/Open-ILS/xul/staff_client/server/patron/bill_wizard.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/bill_wizard.js 2009-10-14 05:03:20 UTC (rev 14410)
+++ trunk/Open-ILS/xul/staff_client/server/patron/bill_wizard.js 2009-10-14 05:06:16 UTC (rev 14411)
@@ -72,12 +72,7 @@
g.au_obj = patron.util.retrieve_fleshed_au_via_id( ses(), g.patron_id );
$('patron_name').setAttribute('value',
- ( 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()
+ patron.util.format_name( g.au_obj ) + ' : ' + g.au_obj.card().barcode()
);
}
Modified: trunk/Open-ILS/xul/staff_client/server/patron/display.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/display.js 2009-10-14 05:03:20 UTC (rev 14410)
+++ trunk/Open-ILS/xul/staff_client/server/patron/display.js 2009-10-14 05:06:16 UTC (rev 14411)
@@ -428,14 +428,11 @@
['render'],
function(e) {
return function() {
+ JSAN.use('patron.util');
e.setAttribute('value',
- ( 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.format_name( obj.patron )
);
- JSAN.use('patron.util'); patron.util.set_penalty_css(obj.patron);
+ patron.util.set_penalty_css(obj.patron);
};
}
],
Modified: trunk/Open-ILS/xul/staff_client/server/patron/hold_details.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/hold_details.js 2009-10-14 05:03:20 UTC (rev 14410)
+++ trunk/Open-ILS/xul/staff_client/server/patron/hold_details.js 2009-10-14 05:06:16 UTC (rev 14411)
@@ -83,12 +83,7 @@
var au_obj = patron.util.retrieve_fleshed_au_via_id( ses(), g.ahr.usr() );
$('patron_name').setAttribute('value',
- ( 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()
+ patron.util.format_name( au_obj ) + ' : ' + au_obj.card().barcode()
);
}
}
Modified: trunk/Open-ILS/xul/staff_client/server/patron/info_notes.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/info_notes.xul 2009-10-14 05:03:20 UTC (rev 14410)
+++ trunk/Open-ILS/xul/staff_client/server/patron/info_notes.xul 2009-10-14 05:06:16 UTC (rev 14411)
@@ -166,12 +166,7 @@
p.simple(
'<hr/>'
+ '<p>'+ $("patronStrings").getString('staff.patron.info_notes.render_notes.pertaining_to') + ' ' +
- ( 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.util.format_name( patron_obj ) + ' : '
+ 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()])
Modified: trunk/Open-ILS/xul/staff_client/server/patron/summary.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/summary.js 2009-10-14 05:03:20 UTC (rev 14410)
+++ trunk/Open-ILS/xul/staff_client/server/patron/summary.js 2009-10-14 05:06:16 UTC (rev 14411)
@@ -638,11 +638,7 @@
obj.patron = robj;
JSAN.use('patron.util');
util.widgets.set_text('patron_name',
- ( 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.format_name( obj.patron )
);
patron.util.set_penalty_css(obj.patron);
JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
Modified: trunk/Open-ILS/xul/staff_client/server/patron/util.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/util.js 2009-10-14 05:03:20 UTC (rev 14410)
+++ trunk/Open-ILS/xul/staff_client/server/patron/util.js 2009-10-14 05:06:16 UTC (rev 14411)
@@ -6,7 +6,7 @@
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'
+ 'merge', 'ausp_columns', 'format_name'
];
patron.util.EXPORT_TAGS = { ':all' : patron.util.EXPORT_OK };
@@ -808,4 +808,14 @@
}
}
+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');
More information about the open-ils-commits
mailing list