From 16adb50472cf91dd380dc80f899e122e7af00691 Mon Sep 17 00:00:00 2001 From: erickson Date: Thu, 20 Apr 2006 16:31:05 +0000 Subject: [PATCH] now doing generic ident search showing dup data as well as showing count of dup hits to user git-svn-id: svn://svn.open-ils.org/ILS/trunk@3774 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/xul/staff_client/server/patron/ue.js | 71 +++++++++++++------ .../xul/staff_client/server/patron/ue.xhtml | 38 ++-------- 2 files changed, 57 insertions(+), 52 deletions(-) diff --git a/Open-ILS/xul/staff_client/server/patron/ue.js b/Open-ILS/xul/staff_client/server/patron/ue.js index b4b0338b42..4487b06125 100644 --- a/Open-ILS/xul/staff_client/server/patron/ue.js +++ b/Open-ILS/xul/staff_client/server/patron/ue.js @@ -333,43 +333,74 @@ function uEditSaveUser() { var uEditDupHashes = {}; +var uEditDupTemplate; + function uEditRunDupeSearch(type, search_hash) { if(!patron.isnew()) return; + _debug('dup search: ' + js2JSON(search_hash)); - var linkid = 'ue_dups_'+type; - var hitsid = linkid + '_hits'; var req = new Request(PATRON_SEARCH, SESSION, search_hash); - req.callback( + var container = $('dup_div_container'); + if(!uEditDupTemplate) + uEditDupTemplate = container.removeChild($('dup_div')); - function(r) { - var ids = r.getResultObject(); - _debug('dup search results: ' + js2JSON(ids)); - - if(!(ids && ids[0])) { - uEditDupHashes[type] = null; - hideMe($(linkid)); + /* clear any existing dups for this type */ + iterate( container.getElementsByTagName('div'), + function(d) { + if( d.getAttribute('type') == type ) { + container.removeChild(d) return; } + } + ); - unHideMe($(linkid)); - appendClear($(hitsid), text(ids.length)); - uEditDupHashes[type] = search_hash; - switch(type) { - case 'ident1' : - if(confirm($('ue_dup_ident1').innerHTML)) - uEditShowSearch(type); - break; - } + /*req.callback(uEditHandleDupResults);*/ + req.callback( + function(r) { + uEditHandleDupResults( r.getResultObject(), search_hash, type, container ); } ); req.send(); } -function uEditShowSearch(type) { +function uEditHandleDupResults(ids, search_hash, type, container) { + + _debug('dup search results: ' + js2JSON(ids)); + + if(!(ids && ids[0])) /* no results */ + return uEditDupHashes[type] = null; + + /* add a dup link to the UI and plug in the data */ + var node = uEditDupTemplate.cloneNode(true); + container.appendChild(node); + node.setAttribute('type', type); + + var link = $n(node, 'link'); + link.setAttribute('type', type); + unHideMe(link); + $n(node,'count').appendChild(text(ids.length)); + + for( var o in search_hash ) + $n(node, 'data').appendChild( + text(search_hash[o].value + ' ')); + + uEditDupHashes[type] = search_hash; + + switch(type) { + case 'ident1' : + if(confirm($('ue_dup_ident1').innerHTML)) + uEditShowSearch(type); + break; + } +} + + +function uEditShowSearch(link) { + var type = link.getAttribute('type'); if(window.xulG) window.xulG.spawn_search(uEditDupHashes[type]); else alert('Search would be:\n' + js2JSON(uEditDupHashes[type])); diff --git a/Open-ILS/xul/staff_client/server/patron/ue.xhtml b/Open-ILS/xul/staff_client/server/patron/ue.xhtml index fc80cabb59..419d271440 100644 --- a/Open-ILS/xul/staff_client/server/patron/ue.xhtml +++ b/Open-ILS/xul/staff_client/server/patron/ue.xhtml @@ -165,38 +165,12 @@ - - -
-
- - Show users in the the database with the same primary identification. - () - -
-
- - Show users in the the database with the same secondary identification. - () - -
-
- - Show users in the the database with a similar first and last name. - () - -
-
- - Show users in the the database with a matching email address. - () + -- 2.43.2