initial support for approving pending addresses. still need to show which address...
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 15 Jan 2009 15:42:50 +0000 (15:42 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 15 Jan 2009 15:42:50 +0000 (15:42 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@11844 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/opac/locale/en-US/lang.dtd
Open-ILS/xul/staff_client/server/patron/ue.xhtml
Open-ILS/xul/staff_client/server/patron/ue_config.js

index c1aecac..2ee0ed9 100644 (file)
 <!ENTITY ev.staff.patron.ue_xhtml.profile_group.label "Profile Group">
 <!ENTITY ev.staff.patron.ue_xhtml.ue_addr_delete.label "Delete this Address">
 <!ENTITY ev.staff.patron.ue_xhtml.ue_addr_detach.label "Detach this Address">
+<!ENTITY ev.staff.patron.ue_xhtml.ue_addr_approve.label "Approve Pending Address">
+<!ENTITY ev.staff.patron.ue_xhtml.ue_addr_approve_confirm.label "Approve pending address?  This operation will be be instantenous.">
 <!ENTITY ev.staff.patron.ue_xhtml.primary_ident_ssn_help.label "(XXX-YY-ZZZZ)">
 <!ENTITY ev.staff.patron.ue_xhtml.primary_ident_dl_help.label "(GA-123456789)">
 <!ENTITY ev.staff.patron.ue_xhtml.edit.label "Edit">
index fe54be7..05e5454 100644 (file)
                                                                                                                                <span style='padding-left: 10px;'> </span>
                                                                                                                                <input type='submit' name='ue_addr_detach' 
                                                                                                                                        value='&ev.staff.patron.ue_xhtml.ue_addr_detach.label;' class='hide_me'/>
+                                                                                                                               <input type='submit' name='ue_addr_approve' 
+                                                                                                                                       value='&ev.staff.patron.ue_xhtml.ue_addr_approve.label;' class='hide_me'/>
                                                                                                                        </div>
                                                                                                                </td>
                                                                                                        </tr>
                <span class='hide_me' id='ue_claims_return_confirm'>&ev.staff.patron.ue_xhtml.claims_return_confirm.label;</span>
                <span class='hide_me' id='ue_unsaved_changes'>&ev.staff.patron.ue_xhtml.unsaved_changes.label;</span>
                <span class='hide_me' id='ue_xact_collision'>&ev.staff.patron.ue_xhtml.xact_collision.label;</span>
-
+               <span class='hide_me' id='ue_add_approve_confirm'>&ev.staff.patron.ue_xhtml.ue_addr_approve_confirm.label;</span>
        </div>
 
        </body>
index b4a6b01..ebfb3c2 100644 (file)
@@ -9,6 +9,7 @@ const FETCH_NET_LEVELS  = 'open-ils.actor:open-ils.actor.net_access_level.retriev
 const UPDATE_PATRON            = 'open-ils.actor:open-ils.actor.patron.update';
 const PATRON_SEARCH            = 'open-ils.actor:open-ils.actor.patron.search.advanced';
 const ZIP_SEARCH                       = 'open-ils.search:open-ils.search.zip';
+const APPROVE_ADDR             = 'open-ils.actor:open-ils.actor.user.pending_address.approve';
 const FETCH_ADDR_MEMS  = 'open-ils.actor:open-ils.actor.address.members';
 const FETCH_GRP_MEMS           = 'open-ils.actor:open-ils.actor.usergroup.members.retrieve';
 const CREATE_USER_NOTE = 'open-ils.actor:open-ils.actor.note.create';
@@ -624,6 +625,29 @@ function uEditDeleteAddr( tbody, row, address, detach ) {
 
 }
 
+function uEditApproveAddr( tbody, row, address ) {
+    if(!confirm($('ue_add_approve_confirm').innerHTML)) return;
+    var req = new Request(APPROVE_ADDR, SESSION, address.id());
+    req.callback(
+        function(r) {
+            var oldId = r.getResultObject();
+            if(oldId != null) {
+                // remove the replaced address 
+                       patron.addresses(
+                               grep( patron.addresses(), 
+                                       function(i) { return (i.id() != oldId); }
+                               )
+                       );
+                // update the ID on the new address
+                address.id(oldId);
+                removeChildren($('ue_address_tbody'));
+                   uEditBuildAddrs(patron);
+            }
+        }
+    );
+    req.send();
+}
+
 
 function uEditFindAddrInput(type, id) {
        var tbody = $('ue_address_tbody');
@@ -665,6 +689,15 @@ function uEditBuildAddrFields(patron, address) {
                uEditAddrTemplate.cloneNode(true));
 
        uEditCheckSharedAddr(patron, address, tbody, row);
+    
+    // see if this is a pending address
+    if( address.replaces() != null ) {
+        var button = $n(row, 'ue_addr_approve');
+        unHideMe(button);
+        button.onclick = 
+            function() { uEditApproveAddr( tbody, row, address ); }
+    }
+
 
        $n(row, 'ue_addr_delete').onclick = 
                function() {