fixed bug in user editor which prevented the expire_date from getting set properly...
[Evergreen.git] / Evergreen / xul / staff_client / server / patron / ue_config.js
index b582e85..a071339 100644 (file)
@@ -47,7 +47,7 @@ const dlRegex         = /^[a-zA-Z]{2}-\w+/; /* driver's license */
 const phoneRegex       = /^\d{3}-\d{3}-\d{4}(| ex\d+)$/i;
 const nonumRegex       = /^[a-zA-Z]\D*$/; /* no numbers, no beginning whitespace */
 const dateRegex        = /^\d{4}-\d{2}-\d{2}/;
-const zipRegex         = /^\d{5}(-\d{4}|$)/; /* 12345 or 12345-6789 */
+const zipRegex         = /^\d{5}(-\d{4}|-?$)/; /* 12345 or 12345-6789 */
 
 var barredAlerted = false;
 
@@ -398,6 +398,8 @@ function uEditDefineData(patron) {
                                        exptime                 += intsecs * 1000;
                                        expdate.setTime(exptime);
 
+                                       _debug("profile change (interval= '"+interval+"', seconds="+intsecs+")\n\tgenerated a date of " + expdate);
+
                                        var year                        = expdate.getYear() + 1900;
                                        var month               = (expdate.getMonth() + 1) + '';
                                        var day                 = (expdate.getDate()) + '';
@@ -405,8 +407,12 @@ function uEditDefineData(patron) {
                                        if(!month.match(/\d{2}/)) month = '0' + month;
                                        if(!day.match(/\d{2}/)) day = '0' + day;
 
+
                                        var node = $('ue_expire');
                                        node.value = year+'-'+month+'-'+day;
+
+                                       _debug("profile change formatted date to "+ node.value);
+                                       node.onchange();
                                }
                        }
                },