CAT-56 Offline Circ Loan Duration Mods
authorKyle Huckins <khuckins@catalystdevworks.com>
Fri, 8 Apr 2016 18:38:57 +0000 (11:38 -0700)
committerBill Erickson <berickxx@gmail.com>
Thu, 21 Mar 2019 19:46:23 +0000 (15:46 -0400)
Remove options for 3 and 30 days.

Add options for same day, 42 days, and full year.

Merge in year handling from dev/berick/cat-56-offline-due-date-experiment.
Change ev.target.value handling for the non-option to allow for same-day
handling.

Signed-off-by: Kyle Huckins <khuckins@catalystdevworks.com>
 Changes to be committed:
modified:   Open-ILS/web/opac/locale/en-US/lang.dtd
modified:   Open-ILS/xul/staff_client/chrome/content/circ/offline_checkout.js
modified:   Open-ILS/xul/staff_client/chrome/content/circ/offline_checkout.xul

Open-ILS/web/opac/locale/en-US/lang.dtd
Open-ILS/xul/staff_client/chrome/content/circ/offline_checkout.js
Open-ILS/xul/staff_client/chrome/content/circ/offline_checkout.xul

index b5ad9c5..6610dbb 100644 (file)
@@ -6,12 +6,15 @@
 <!ENTITY common.check_barcode.description "Check barcode?">
 <!ENTITY common.date_helper 'or choose one of these'>
 <!ENTITY common.date_helper.normal 'Normal'>
+<!ENTITY common.date_helper.same_day 'Today'>
 <!ENTITY common.date_helper.3_days 'Today + 3 days'>
 <!ENTITY common.date_helper.7_days 'Today + 7 days'>
 <!ENTITY common.date_helper.14_days 'Today + 14 days'>
 <!ENTITY common.date_helper.21_days 'Today + 21 days'>
 <!ENTITY common.date_helper.28_days 'Today + 28 days'>
 <!ENTITY common.date_helper.30_days 'Today + 30 days'>
+<!ENTITY common.date_helper.42_days 'Today + 42 days'>
+<!ENTITY common.date_helper.1_year 'Today + 1 year'>
 <!ENTITY common.due_date.description 'Enter the item due date:'>
 <!ENTITY common.enter.label "Enter">
 <!ENTITY common.enter.accesskey "E">
index 3190b3a..cb1fc0a 100644 (file)
@@ -184,11 +184,21 @@ function handle_enter(ev) {
 }
 
 function handle_duedate_menu(ev) {
-    if (ev.target.value=='0') return; 
+    var duration = ev.target.value;
+    if (duration=='none') return; 
     JSAN.use('util.date'); 
     var today = new Date(); 
     var todayPlus = new Date(); 
-    todayPlus.setTime( today.getTime() + 24*60*60*1000*ev.target.value ); 
+    if (duration == '0') {
+        todayPlus.setTime(today.getTime());
+    } else if (duration.match(/year/)) {
+        // duration is represented in years
+        var count = duration.split(/ /)[0];
+        todayPlus.setFullYear(todayPlus.getFullYear() + parseInt(count));
+    } else {
+        // assume the duration is counted in days
+        todayPlus.setTime( today.getTime() + 24*60*60*1000*ev.target.value ); 
+    }
     todayPlus = util.date.formatted_date(todayPlus,'%F'); 
     $('duedate').setAttribute('value',todayPlus); 
     $('duedate').value = todayPlus;
index a66f3df..2bea215 100644 (file)
                     <spacer flex="1"/>
                     <menulist id="duedate_menu">
                         <menupopup>
-                            <menuitem label="&common.date_helper;" value="0"/>
-                            <menuitem label="&common.date_helper.3_days;" value="3"/>
+                            <menuitem label="&common.date_helper;" value="none"/>
+                            <menuitem label="&common.date_helper.same_day;" value="0"/>
                             <menuitem label="&common.date_helper.7_days;" value="7"/>
                             <menuitem label="&common.date_helper.14_days;" value="14"/>
                             <menuitem label="&common.date_helper.21_days;" value="21"/>
                             <menuitem label="&common.date_helper.28_days;" value="28"/>
-                            <menuitem label="&common.date_helper.30_days;" value="30"/>
+                            <menuitem label="&common.date_helper.42_days;" value="42"/>
+                            <menuitem label="&common.date_helper.1_year;" value="1 year"/>
                         </menupopup>
                     </menulist>
                 </hbox>