[open-ils-commits] r9177 - trunk/Open-ILS/web/opac/skin/default/js

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Apr 1 12:05:56 EDT 2008


Author: erickson
Date: 2008-04-01 11:29:45 -0400 (Tue, 01 Apr 2008)
New Revision: 9177

Modified:
   trunk/Open-ILS/web/opac/skin/default/js/holds.js
   trunk/Open-ILS/web/opac/skin/default/js/myopac.js
Log:
no longer allowing hold updates when date is invalid or <= today

Modified: trunk/Open-ILS/web/opac/skin/default/js/holds.js
===================================================================
--- trunk/Open-ILS/web/opac/skin/default/js/holds.js	2008-04-01 15:29:21 UTC (rev 9176)
+++ trunk/Open-ILS/web/opac/skin/default/js/holds.js	2008-04-01 15:29:45 UTC (rev 9177)
@@ -27,6 +27,8 @@
     };
 }
 
+$('holds_frozen_thaw_input').onchange = 
+        function(){holdsVerifyThawDateUI('holds_frozen_thaw_input');}
 $('holds_frozen_thaw_input').onkeyup = 
         function(){holdsVerifyThawDateUI('holds_frozen_thaw_input');}
 
@@ -467,6 +469,10 @@
 	if(holdArgs.type == 'M') hideMe($('hold_physical_desc_row'));
 
 	holdsSetFormatSelector();
+
+    $('holds_frozen_chkbox').checked = false;
+    hideMe($('hold_frozen_thaw_row'));
+
 }
 
 function holdsParseMRFormats(str) {
@@ -711,11 +717,10 @@
         unHideMe($('hold_frozen_thaw_row'));
         thawDate = $('holds_frozen_thaw_input').value;
         if(thawDate) {
-            if(holdsVerifyThawDate(thawDate)) {
+            if(holdsVerifyThawDate(thawDate)) 
                 hold.thaw_date(thawDate);
-            } else {
-                /* XXX */
-            }
+            else
+                return;
         } else {
             hold.thaw_date(null);
         }
@@ -824,18 +829,21 @@
 
 
 /* verify that the thaw date is valid and after today */
-function holdsVerifyThawDate(thawDate) {
-    thawDate = Date.parseIso8601(thawDate);
-    if(thawDate) {
-        var today = new Date();
-        today = new Date(today.getFullYear(), today.getMonth(), today.getDate())
-        if(thawDate > today) 
-            return thawDate.iso8601Format('YMD', false, false, true);
-    }
+function holdsVerifyThawDate(dateString) {
+    if(Date.parseIso8601(dateString) && 
+            holdGreaterThanToday(dateString)) 
+        return dateString;
     return null;
 }
 
+function holdGreaterThanToday(dateString) {
+    thawDate = Date.parseIso8601(dateString);
+    var today = new Date();
+    today = new Date(today.getFullYear(), today.getMonth(), today.getDate())
+    return thawDate > today;
+}
 
+
 function holdsVerifyThawDateUI(element) {
     value = $(element).value;
 

Modified: trunk/Open-ILS/web/opac/skin/default/js/myopac.js
===================================================================
--- trunk/Open-ILS/web/opac/skin/default/js/myopac.js	2008-04-01 15:29:21 UTC (rev 9176)
+++ trunk/Open-ILS/web/opac/skin/default/js/myopac.js	2008-04-01 15:29:45 UTC (rev 9177)
@@ -22,6 +22,8 @@
 
     $('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() {
@@ -1440,12 +1442,11 @@
 
 function myopacApplyThawDate() {
     var dateString = $('myopac_holds_thaw_date_input').value;
-    if(dateString) {
+    if(dateString) 
         dateString = holdsVerifyThawDate(dateString);
         if(!dateString) return;
-    } else {
+    else
         dateString = null;
-    }
     myopacProcessHolds('freeze', dateString);
 }
 



More information about the open-ils-commits mailing list