option to suspend hold
authorLlewellyn Marshall <llewellyn.marshall@ncdcr.gov>
Wed, 10 Aug 2022 13:33:17 +0000 (09:33 -0400)
committerLlewellyn Marshall <llewellyn.marshall@ncdcr.gov>
Wed, 10 Aug 2022 13:33:17 +0000 (09:33 -0400)
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm
Open-ILS/src/templates-bootstrap/opac/parts/place_hold.tt2
Open-ILS/src/templates/opac/parts/place_hold.tt2

index f77c1e0..25261eb 100644 (file)
@@ -1533,7 +1533,7 @@ sub load_place_hold {
     } else {
         $ctx->{default_sms_notify} = '';
     }
-    if ($cgi->param('hold_suspend')) {
+    if ($cgi->param('hold_suspend') =~ /t/) {
         $ctx->{frozen} = 1;
         # TODO: Make this support other date formats, not just mm/dd/yyyy.
         # We should use a date input type on the forms once it is supported by Firefox.
@@ -1548,6 +1548,23 @@ sub load_place_hold {
             }
         }
     }
+       elsif ($cgi->param('hold_suspend') =~ /p/) {
+            eval {
+                               my $next_open_time = $e->json_query({
+                                                       from => [
+                                                               'evergreen.find_next_open_time', 
+                                                               $cgi->param('pickup_lib') || $self->ctx->{search_ou},
+                                                               DateTime::Format::ISO8601->new()
+                                                       ]
+                                               })->[0];                                
+                my $dt = DateTime::Format::ISO8601->parse_datetime($next_open_time);
+                $ctx->{thaw_date} = $dt->ymd;
+                               $ctx->{frozen} = 1;
+            };
+            if ($@) {
+                $logger->warn("ignoring next_open_time when placing hold request");
+            }
+       }
 
 
     # If we have a default pickup location, grab it
index b4dc99b..8172036 100755 (executable)
@@ -278,7 +278,11 @@ function maybeToggleNumCopies(obj) {
 
              [% IF ctx.hold_data.size > 0; %]
             <div class="form-check m-2">
-                <input class="form-check-input" type="checkbox" value="t" id="hold_suspend" name="hold_suspend">
+                               <input class="form-check-input" type="radio" value="t" id="no_hold_suspend" name="hold_suspend" />
+                               <label class="form-check-label" for="no_hold_suspend">
+                                       [% l('Do not suspend this hold'); %]
+                               </label>
+                <input class="form-check-input" type="radio" value="t" id="hold_suspend" name="hold_suspend" />
                 <label class="form-check-label" for="hold_suspend">
                 [% IF ctx.hold_data.size == 1;
                     l('Suspend this hold?');
@@ -289,6 +293,10 @@ function maybeToggleNumCopies(obj) {
                     <i class="fas fa-question-circle" aria-hidden="true"></i>
                 </a>
                 </label>
+                               <input class="form-check-input" type="radio" value="p" id="auto_hold_suspend" name="hold_suspend" checked />
+                               <label class="form-check-label" for="auto_hold_suspend">
+                                       [% l('Suspend until Pickup Library Open'); %]
+                               </label>
             </div>
                 [% END %]
 
index 809def3..4628c70 100644 (file)
@@ -295,8 +295,12 @@ function maybeToggleNumCopies(obj) {
                      alt="[% l('Suspend Hold Help') %]"
                      title="[% l('A suspended hold will retain its place in the queue, but will not be fulfilled until it has been activated.') %]" />
                 <br/>
-                <input type="checkbox" name="hold_suspend" id="hold_suspend" value="t"/> [% l('Yes') %]
+                <input type="radio" name="hold_suspend" value="f"/> [% l('No') %]
+                               <br/>
+                <input type="radio" name="hold_suspend" value="t"/> [% l('Yes') %]
                 <a id="actDateToggle" href="#toggled-block-suspend" onclick="return toggleActivationDate();">[% l('Set activation date') %]</a>
+                               <br/>
+                               <input type="radio" name="hold_suspend" value="p" checked /> [% l('Suspend until Pickup Library Open') %]
             </blockquote>
             <blockquote id="toggled-block-suspend">
                 <label for="thaw_date">[% l('Activate on') %]</label>