[open-ils-commits] r11839 - in trunk/Open-ILS/xul/staff_client: chrome/content/main server/locale/en-US server/patron
svn at svn.open-ils.org
svn at svn.open-ils.org
Thu Jan 15 02:37:50 EST 2009
Author: phasefx
Date: 2009-01-15 02:37:46 -0500 (Thu, 15 Jan 2009)
New Revision: 11839
Modified:
trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js
trunk/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties
trunk/Open-ILS/xul/staff_client/server/patron/display.js
trunk/Open-ILS/xul/staff_client/server/patron/display.xul
trunk/Open-ILS/xul/staff_client/server/patron/display_overlay.xul
trunk/Open-ILS/xul/staff_client/server/patron/info_group.xul
trunk/Open-ILS/xul/staff_client/server/patron/search_result.js
trunk/Open-ILS/xul/staff_client/server/patron/util.js
Log:
merge users from patron search and patron group interfaces. getting db error from middle layer method
Modified: trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js 2009-01-15 06:18:30 UTC (rev 11838)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js 2009-01-15 07:37:46 UTC (rev 11839)
@@ -126,6 +126,7 @@
'FM_AU_RETRIEVE_VIA_ID.authoritative' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.retrieve.authoritative', 'cacheable' : true, 'ttl' : 60000 },
'FM_AU_FLESHED_RETRIEVE_VIA_ID' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.fleshed.retrieve', 'cacheable' : true, 'ttl' : 60000 },
'FM_AU_FLESHED_RETRIEVE_VIA_ID.authoritative' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.fleshed.retrieve.authoritative', 'cacheable' : true, 'ttl' : 60000 },
+ 'FM_AU_MERGE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.merge' },
'FM_AU_NEW_USERGROUP' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.usergroup.new' },
'FM_AU_UPDATE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.patron.update' },
'FM_AUN_RETRIEVE_ALL' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.note.retrieve.all', 'cacheable' : false, 'ttl' : 60000 },
Modified: trunk/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties 2009-01-15 06:18:30 UTC (rev 11838)
+++ trunk/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties 2009-01-15 07:37:46 UTC (rev 11839)
@@ -140,6 +140,7 @@
staff.patron.info_group.retrieve_patron.tab_name=Retrieving Patron..
staff.patron.info_group.retrieve_patron.failed_retrieving_patron=Failed to retrieve patron.
staff.patron.info_group.retrieve_patron.failed_retrieving_patrons=Failed to retrieve patrons.
+staff.patron.info_group.merge_patrons.failed_merging_patrons=Failed merging patrons.
staff.patron.info_group.clone_patron.register_clone.tab_name=Register Patron Clone for Group
staff.patron.info_group.clone_patron.error_spawning_editors=error spawning user editors
staff.patron.info_group.spwan_editor.editing_patron=Editing Related Patron
@@ -262,5 +263,16 @@
staff.patron.cmd_verify_credentials.incorrect_credentials=Failure testing credentials!
staff.patron.cmd_verify_credentials.name_feedback=Username: <%1$s>
staff.patron.cmd_verify_credentials.barcode_feedback=Barcode: <%1$s>
+staff.patron.usr_buckets.merge_records.merge_lead=Merge these records? (Select the "lead" record first)
+staff.patron.usr_buckets.merge_records.button.label=Merge
+staff.patron.usr_buckets.merge_records.cancel_button.label=Cancel
+staff.patron.usr_buckets.merge_records.cancel_button.accesskey=C
+staff.patron.usr_buckets.merge_records.lead_record_number=Lead Record? # %1$s
+staff.patron.usr_buckets.merge_records.lead=Lead
+staff.patron.usr_buckets.merge_records.fancy_prompt_title=Record Merging
+staff.patron.usr_buckets.merge_records.fancy_prompt.alert=Merge Aborted
+staff.patron.usr_buckets.merge_records.success=Records were successfully merged.
+staff.patron.usr_buckets.merge_records.catch.std_unex_error=Records were not likely merged.
+
web.staff.patron.ue.session_no_defined=User session is not defined
web.staff.patron.ue.uedit_show_search.search_would_be=Search would be:\n%1$s
Modified: trunk/Open-ILS/xul/staff_client/server/patron/display.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/display.js 2009-01-15 06:18:30 UTC (rev 11838)
+++ trunk/Open-ILS/xul/staff_client/server/patron/display.js 2009-01-15 07:37:46 UTC (rev 11839)
@@ -98,6 +98,18 @@
}
}
],
+ 'cmd_patron_merge' : [
+ ['command'],
+ function(ev) {
+ JSAN.use('patron.util');
+ if (patron.util.merge( obj.retrieve_ids )) {
+ obj.controller.view.cmd_patron_retrieve.setAttribute('disabled','true');
+ obj.controller.view.cmd_patron_merge.setAttribute('disabled','true');
+ var sobj = obj.search_result.g.search_result;
+ if ( sobj.query ) { sobj.search( sobj.query ); }
+ }
+ }
+ ],
'cmd_search_form' : [
['command'],
function(ev) {
@@ -571,6 +583,7 @@
obj.controller.view.PatronNavBar.selectedIndex = 0;
obj.controller.view.cmd_patron_retrieve.setAttribute('disabled','true');
+ obj.controller.view.cmd_patron_merge.setAttribute('disabled','true');
obj.controller.view.cmd_search_form.setAttribute('disabled','true');
var loc = urls.XUL_PATRON_SEARCH_FORM;
@@ -583,6 +596,7 @@
},
'on_submit' : function(query) {
obj.controller.view.cmd_patron_retrieve.setAttribute('disabled','true');
+ obj.controller.view.cmd_patron_merge.setAttribute('disabled','true');
var list_frame = obj.right_deck.reset_iframe(
urls.XUL_PATRON_SEARCH_RESULT, // + '?' + query,
{},
@@ -592,6 +606,7 @@
if (!list) return;
if (list.length < 1) return;
obj.controller.view.cmd_patron_retrieve.setAttribute('disabled','false');
+ if (list.length > 1) obj.controller.view.cmd_patron_merge.setAttribute('disabled','false');
obj.controller.view.cmd_search_form.setAttribute('disabled','false');
obj.retrieve_ids = list;
obj.controller.view.patron_name.setAttribute('value',$("patronStrings").getString('staff.patron.display.init.retrieving'));
Modified: trunk/Open-ILS/xul/staff_client/server/patron/display.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/display.xul 2009-01-15 06:18:30 UTC (rev 11838)
+++ trunk/Open-ILS/xul/staff_client/server/patron/display.xul 2009-01-15 07:37:46 UTC (rev 11839)
@@ -98,6 +98,7 @@
<command id="cmd_patron_info" />
<command id="cmd_patron_exit" />
<command id="cmd_patron_retrieve" />
+ <command id="cmd_patron_merge" />
<command id="cmd_search_form" />
<command id="cmd_verify_credentials" />
<command id="cmd_perm_editor" />
Modified: trunk/Open-ILS/xul/staff_client/server/patron/display_overlay.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/display_overlay.xul 2009-01-15 06:18:30 UTC (rev 11838)
+++ trunk/Open-ILS/xul/staff_client/server/patron/display_overlay.xul 2009-01-15 07:37:46 UTC (rev 11839)
@@ -98,6 +98,7 @@
<vbox flex="1">
<hbox flex="1">
<spacer flex="1"/>
+ <button id="pnb1b2" label="&staff.patron.display_overlay.merge_patrons.label;" accesskey="&staff.patron.display_overlay.merge_patrons.accesskey;" command="cmd_patron_merge"/>
<button id="pnb1b0" label="&staff.patron.display_overlay.search_form.label;" accesskey="&staff.patron.display_overlay.search_form.accesskey;" command="cmd_search_form"/>
<button id="pnb1b1" label="&staff.patron.display_overlay.retrieve_patron.label;" accesskey="&staff.patron.display_overlay.retrieve_patron.accesskey;" command="cmd_patron_retrieve"/>
</hbox>
Modified: trunk/Open-ILS/xul/staff_client/server/patron/info_group.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/info_group.xul 2009-01-15 06:18:30 UTC (rev 11838)
+++ trunk/Open-ILS/xul/staff_client/server/patron/info_group.xul 2009-01-15 07:37:46 UTC (rev 11839)
@@ -105,6 +105,10 @@
if (g.sel_list.length > 0) {
$('retrieve_p').disabled = false;
$('retrieve_p').setAttribute('disabled','false');
+ if (g.sel_list.length > 1) {
+ $('merge_p').disabled = false;
+ $('merge_p').setAttribute('disabled','false');
+ }
$('clone').disabled = false;
$('clone').setAttribute('disabled','false');
$('remove').disabled = false;
@@ -114,6 +118,8 @@
} else {
$('retrieve_p').disabled = true;
$('retrieve_p').setAttribute('disabled','true');
+ $('merge_p').disabled = true;
+ $('merge_p').setAttribute('disabled','true');
$('clone').disabled = true;
$('clone').setAttribute('disabled','true');
$('remove').disabled = true;
@@ -126,6 +132,8 @@
);
$('retrieve_p').disabled = true;
$('retrieve_p').setAttribute('disabled','true');
+ $('merge_p').disabled = true;
+ $('merge_p').setAttribute('disabled','true');
$('clone').disabled = true;
$('clone').setAttribute('disabled','true');
$('remove').disabled = true;
@@ -188,6 +196,7 @@
'id' : g.sel_list[i],
'url_prefix' : xulG.url_prefix,
'new_tab' : xulG.new_tab,
+ 'set_tab' : xulG.set_tab
}
);
} catch(E) {
@@ -200,6 +209,32 @@
}
}
+ function merge_patrons() {
+ try {
+ if (! g.sel_list ) return;
+ JSAN.use('patron.util');
+ var result = patron.util.merge(g.sel_list);
+ if (result) {
+ if (result != g.patron_id && g.sel_list.indexOf( g.patron_id ) != -1) {
+ xulG.set_tab(
+ urls.XUL_PATRON_DISPLAY,
+ { 'tab_name' : $("patronStrings").getString('staff.patron.info_group.retrieve_patron.tab_name') },
+ {
+ 'id' : result,
+ 'url_prefix' : xulG.url_prefix,
+ 'new_tab' : xulG.new_tab,
+ 'set_tab' : xulG.set_tab
+ }
+ );
+ } else {
+ refresh();
+ }
+ }
+ } catch(E) {
+ g.error.standard_unexpected_error_alert($("patronStrings").getString('staff.patron.info_group.merge_patrons.failed_merging_patrons'),E);
+ }
+ }
+
function clone_patron() {
if (! g.sel_list ) return;
try {
@@ -420,6 +455,7 @@
<command id="move" accesskey="&staff.patron.info_group.move.accesskey;" label="&staff.patron.info_group.move.label;" oncommand="try{link_patron(true);}catch(E){alert('FIXME:'+E);}"/>
<command id="add" accesskey="&staff.patron.info_group.add.accesskey;" label="&staff.patron.info_group.add.label;" oncommand="try{link_patron(false);}catch(E){alert('FIXME:'+E);}"/>
<command id="retrieve_p" label="&staff.patron.info_group.retrieve_p.label;" accesskey="&staff.patron.info_group.retrieve_p.accesskey;" oncommand="try{retrieve_patron();}catch(E){alert(E);}"/>
+ <command id="merge_p" label="&staff.patron.info_group.merge_patrons.label;" accesskey="&staff.patron.info_group.merge_patrons.accesskey;" oncommand="try{merge_patrons();}catch(E){alert(E);}"/>
</commandset>
<popupset id="info_group_popupset">
@@ -429,6 +465,7 @@
<menuitem command="move" />
<menuitem command="add" />
<menuitem command="retrieve_p" />
+ <menuitem command="merge_p" />
</popup>
</popupset>
@@ -445,6 +482,7 @@
<menuitem command="move" />
<menuitem command="add" />
<menuitem command="retrieve_p" />
+ <menuitem command="merge_p" />
</menupopup>
</menu>
</menubar>
Modified: trunk/Open-ILS/xul/staff_client/server/patron/search_result.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/search_result.js 2009-01-15 06:18:30 UTC (rev 11838)
+++ trunk/Open-ILS/xul/staff_client/server/patron/search_result.js 2009-01-15 07:37:46 UTC (rev 11839)
@@ -211,6 +211,7 @@
return;
}
+ obj.list.clear();
//this.list.append( { 'retrieve_id' : results[i], 'row' : {} } );
var funcs = [];
Modified: trunk/Open-ILS/xul/staff_client/server/patron/util.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/util.js 2009-01-15 06:18:30 UTC (rev 11838)
+++ trunk/Open-ILS/xul/staff_client/server/patron/util.js 2009-01-15 07:37:46 UTC (rev 11839)
@@ -5,7 +5,8 @@
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'
+ 'retrieve_au_via_id', 'retrieve_fleshed_au_via_id', 'retrieve_fleshed_au_via_barcode', 'set_penalty_css', 'retrieve_name_via_id',
+ 'merge'
];
patron.util.EXPORT_TAGS = { ':all' : patron.util.EXPORT_OK };
@@ -737,5 +738,68 @@
}
}
+patron.util.merge = function(record_ids) {
+ var error;
+ try {
+ netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserWrite');
+ JSAN.use('util.error'); error = new util.error();
+ var top_xml = '<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" flex="1" >';
+ top_xml += '<description>' + $("patronStrings").getString('staff.patron.usr_buckets.merge_records.merge_lead') + '</description>';
+ top_xml += '<hbox>';
+ top_xml += '<button id="lead" disabled="true" label="'
+ + $("patronStrings").getString('staff.patron.usr_buckets.merge_records.button.label') + '" name="fancy_submit"/>';
+ top_xml += '<button label="' + $("patronStrings").getString('staff.patron.usr_buckets.merge_records.cancel_button.label') +'" accesskey="'
+ + $("patronStrings").getString('staff.patron.usr_buckets.merge_records.cancel_button.accesskey') +'" name="fancy_cancel"/></hbox></vbox>';
+ var xml = '<form xmlns="http://www.w3.org/1999/xhtml">';
+ xml += '<table><tr valign="top">';
+ for (var i = 0; i < record_ids.length; i++) {
+ xml += '<td><input value="' + $("patronStrings").getString('staff.patron.usr_buckets.merge_records.lead')
+ xml += '" id="record_' + record_ids[i] + '" type="radio" name="lead"';
+ xml += ' onclick="' + "try { var x = $('lead'); x.setAttribute('value',";
+ xml += record_ids[i] + '); x.disabled = false; } catch(E) { alert(E); }">';
+ xml += '</input>' + $("patronStrings").getFormattedString('staff.patron.usr_buckets.merge_records.lead_record_number',[record_ids[i]]) + '</td>';
+ }
+ xml += '</tr><tr valign="top">';
+ for (var i = 0; i < record_ids.length; i++) {
+ xml += '<td nowrap="nowrap"><iframe style="min-height: 1000px; min-width: 300px" flex="1" src="' + urls.XUL_PATRON_SUMMARY;
+ xml += '?id=' + record_ids[i] + '&show_name=1"/></td>';
+ }
+ xml += '</tr></table></form>';
+ JSAN.use('util.window'); var win = new util.window();
+ var fancy_prompt_data = win.open(
+ urls.XUL_FANCY_PROMPT,
+ 'fancy_prompt', 'chrome,resizable,modal,width=750,height=500',
+ {
+ 'top_xml' : top_xml, 'xml' : xml, 'title' : $("patronStrings").getString('staff.patron.usr_buckets.merge_records.fancy_prompt_title')
+ }
+ );
+
+ if (typeof fancy_prompt_data.fancy_status == 'undefined' || fancy_prompt_data.fancy_status == 'incomplete') {
+ alert($("patronStrings").getString('staff.patron.usr_buckets.merge_records.fancy_prompt.alert'));
+ return false;
+ }
+
+ JSAN.use('util.functional'); JSAN.use('util.network'); var network = new util.network();
+ var robj = network.simple_request('FM_AU_MERGE',
+ [
+ ses(),
+ fancy_prompt_data.lead,
+ {},
+ util.functional.filter_list( record_ids,
+ function(o) {
+ return o != fancy_prompt_data.lead;
+ }
+ )
+ ]
+ );
+ if (Number(robj) != 1) { throw(robj); }
+ return fancy_prompt_data.lead;
+ } catch(E) {
+ dump('patron.util.merge: ' + js2JSON(E) + '\n');
+ try { error.standard_unexpected_error_alert('Error in patron.util.merge',E); } catch(F) { alert('patron.util.merge: ' + E + '\n'); }
+ return false;
+ }
+}
+
dump('exiting patron/util.js\n');
More information about the open-ils-commits
mailing list