created setting to enable the creation of pending addresses
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 5 Jun 2009 14:11:31 +0000 (14:11 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 5 Jun 2009 14:11:31 +0000 (14:11 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@13324 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/opac/locale/en-US/lang.dtd
Open-ILS/web/opac/skin/default/js/myopac.js
Open-ILS/web/opac/skin/default/xml/myopac/myopac_summary.xml
Open-ILS/xul/staff_client/server/admin/org_unit_settings.xhtml

index bc2d4f7..905d94b 100644 (file)
 <!ENTITY staff.server.admin.org_settings.circ.restore_overdue_on_lost_return.desc "Restore overdue fines on lost item return">
 <!ENTITY staff.server.admin.org_settings.circ.lost_immediately_available "Circ: Lost items usable on checkin">
 <!ENTITY staff.server.admin.org_settings.circ.lost_immediately_available.desc "Lost items are usable on checkin instead of going \'home\' first">
+<!ENTITY staff.server.admin.org_settings.opac.allow_pending_address "OPAC: Allow pending addresses">
+<!ENTITY staff.server.admin.org_settings.opac.allow_pending_address.desc "If enabled, patrons can create and edit existing addresses.  Addresses are kept in a pending state until staff approves the changes">
 
 
 <!ENTITY staff.server.admin.stat_cat.title "Evergreen: Statistical Category Editor">
index f3294d2..b987f28 100644 (file)
@@ -7,6 +7,7 @@ var fleshedUser = null;
 var fleshedContainers = {};
 var holdCache = {};
 var holdStatusCache = {};
+var allowPendingAddr = false;
 
 
 function clearNodes( node, keepArray ) {
@@ -17,13 +18,23 @@ function clearNodes( node, keepArray ) {
 }
 
 function myOPACInit() {
-       if(!(G.user && G.user.session)) initLogin();
-       else myOPACChangePage( "summary" );
+
+       if(!(G.user && G.user.session)) {
+        initLogin();
+
+    } else {
+
+        allowPendingAddr = fetchOrgSettingDefault(G.user.home_ou(), 'opac.allow_pending_address');
+        if(allowPendingAddr)
+            unHideMe($('myopac_pending_addr_td'));
+           myOPACChangePage( "summary" );
+    }
 
     $('myopac_holds_thaw_date_input').onkeyup = 
         function(){holdsVerifyThawDateUI('myopac_holds_thaw_date_input'); }
     $('myopac_holds_thaw_date_input').onchange = 
         function(){holdsVerifyThawDateUI('myopac_holds_thaw_date_input'); }
+
 }
 
 function myopacReload() {
@@ -838,6 +849,8 @@ function _myOPACSummaryShowUer(r) {
     var addrs = user.addresses();
        for( var a in addrs ) {
         var addr = addrs[a];
+        if(!allowPendingAddr && isTrue(addr.pending()))
+            continue;
         if(addr.replaces() != null) continue;
                var row = template.cloneNode(true);
                myOPACDrawAddr(row, addr, addrs);
@@ -875,7 +888,11 @@ function myOPACDrawAddr(row, addr, addrs) {
     appendClear($n(row, 'myopac_addr_state'),text(addr.state()));
     appendClear($n(row, 'myopac_addr_country'),text(addr.country()));
     appendClear($n(row, 'myopac_addr_zip'),text(addr.post_code()));
+
+    if(!allowPendingAddr) return;
+
     $n(row, 'myopac_addr_edit_link').onclick = function(){myopacEditAddress(addr)};
+    unHideMe($n(row, 'myopac_addr_edit_td'));
 
     /* if we have a replacement address, plop it into the table next to this addr */
     var repl = grep(addrs,
@@ -972,8 +989,7 @@ function myopacSaveAddress(row, addr, deleteMe) {
                     fleshedUser.addresses(addrs);
                 }
             }
-
-           alert('done');
+           alertId('myopac_addr_changes_saved');
         }
     );
     req.send();
index de11076..0ff10f0 100644 (file)
         <thead>
             <tr>
                 <td>&myopac.summary.addresses;</td>
-                <td>&myopac.summary.addresses.pending;</td>
+                <td id='myopac_pending_addr_td' class='hide_me'>&myopac.summary.addresses.pending;</td>
             </tr>
         </thead>
                <tbody id='myopac_addr_tbody'>
                             <td name='myopac_addr_zip'> </td>
                         </tr>
                         <tr>
-                            <td name='myopac_addr_edit_td' colspan='2'>
+                            <td name='myopac_addr_edit_td' colspan='2' class='hide_me'>
                                 <a class='classic_link' name='myopac_addr_edit_link' href='javascript:void(0);'>Edit Address</a>
                             </td>
                         </tr>
        <div class='hide_me' id='myopac_password_success'>&myopac.summary.password.success;</div>
        <div class='hide_me' id='myopac_password_failure'>&myopac.summary.password.failure;</div>
        <span class='hide_me' id='myopac_invalid_username'>&myopac.summary.username.invalid;</span>
+       <span class='hide_me' id='myopac_addr_changes_saved'>Address Saved</span>
 </div>
 
 
index 50c57b7..f6411c7 100644 (file)
                     label : '&staff.server.admin.org_settings.circ.lost_immediately_available;',
                     desc : '&staff.server.admin.org_settings.circ.lost_immediately_available.desc;',
                     type : 'bool'
+                },
+                'opac.allow_pending_address' : {
+                    label : '&staff.server.admin.org_settings.opac.allow_pending_address;',
+                    desc : '&staff.server.admin.org_settings.opac.allow_pending_address.desc;',
+                    type : 'bool'
                 }
             };
         </script>