Validate date ranges in Close Dates editor
authorPasi Kallinen <pasi.kallinen@pttk.fi>
Wed, 17 Jul 2013 17:24:26 +0000 (20:24 +0300)
committerBen Shum <bshum@biblio.org>
Wed, 7 Aug 2013 02:23:25 +0000 (22:23 -0400)
Complain in Closed Dates Editor when ending date is earlier than starting date.

Signed-off-by: Pasi Kallinen <pasi.kallinen@pttk.fi>
Signed-off-by: Remington Steed <rjs7@calvin.edu>
Signed-off-by: Ben Shum <bshum@biblio.org>
Open-ILS/web/opac/locale/en-US/lang.dtd
Open-ILS/xul/staff_client/server/admin/closed_dates.js
Open-ILS/xul/staff_client/server/admin/closed_dates.xhtml

index e9f9f1c..b72b300 100644 (file)
 <!ENTITY staff.server.admin.closed_dates.confirm_delete "Are you sure you wish to delete the selected close date?">
 <!ENTITY staff.server.admin.closed_dates.date.invalid "Invalid date format">
 <!ENTITY staff.server.admin.closed_dates.time.invalid "Invalid time format">
+<!ENTITY staff.server.admin.closed_dates.date_span.invalid "Ending date is earlier than starting date">
 <!ENTITY staff.server.admin.closed_dates.success "Closed date successfully updated">
 <!ENTITY staff.server.admin.copy_locations.title "Evergreen: Copy Locations Editor">
 <!ENTITY staff.server.admin.copy_locations.editor " Copy Locations Editor ">
index 09c78bb..d784ff6 100644 (file)
@@ -357,6 +357,11 @@ function cdNew() {
         end = cdDateStrToDate(edate + ' ' + etime);
     }
 
+    if (end.getTime() < start.getTime()) {
+        alertId('cd_invalid_date_span');
+        return;
+    }
+
     cdCreate(start, end, $('cd_edit_note').value);
 }
 
index 23299c1..c831f7d 100644 (file)
             <span class='hide_me' id='cd_invalid_date'>&staff.server.admin.closed_dates.date.invalid;</span>
             <span class='hide_me' id='cd_invalid_time'>&staff.server.admin.closed_dates.time.invalid;</span>
             <span class='hide_me' id='cd_update_success'>&staff.server.admin.closed_dates.success;</span>
+            <span class='hide_me' id='cd_invalid_date_span'>&staff.server.admin.closed_dates.date_span.invalid;</span>
         
         </center>
     </body>