LP#1879983: Allow different granularities for the same date
authorMike Rylander <mrylander@gmail.com>
Thu, 25 Jun 2020 16:45:15 +0000 (12:45 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Tue, 15 Sep 2020 20:20:49 +0000 (16:20 -0400)
The times available for each date were unintentionally limited to just
one org unit.  This commit removes that restriction by storing the times
available for a date as passed to the template separately for each org
unit that has a curbside object, or is now requesting one.

Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Michele Morgan <mmorgan@noblenet.org>
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm
Open-ILS/src/templates/opac/myopac/holds_curbside.tt2

index 201d1f4..b3e6672 100644 (file)
@@ -1355,8 +1355,8 @@ sub handle_hold_update {
             );
         }
 
-        if ($date and $org and !$ctx->{cs_times}{$date}) {
-            $ctx->{cs_times}{$date} = $circ->request(
+        if ($date and $org and !$ctx->{cs_times}{$org}{$date}) {
+            $ctx->{cs_times}{$org}{$date} = $circ->request(
                 'open-ils.curbside.times_for_date.atomic',
                 $e->authtoken, $date, $org
             )->gather(1);
@@ -1398,7 +1398,7 @@ sub load_myopac_holds {
         for my $cs (@{$holds_object->{curbsides}}) {
             if ($cs->slot) {
                 my $dt = DateTime::Format::ISO8601->new->parse_datetime(clean_ISO8601($cs->slot))->strftime('%F');
-                $ctx->{cs_times}{$dt} = $U->simplereq(
+                $ctx->{cs_times}{$cs->org}{$dt} = $U->simplereq(
                     'open-ils.curbside', 'open-ils.curbside.times_for_date.atomic',
                     $e->authtoken, $dt, $cs->org
                 );
index cf6b0f5..1f8a24c 100644 (file)
                 [% IF appointment || cs_date; # checking times %]
                   [% current_date = cs_date %]
                   [% IF date_started_null && no_patron_input %]&nbsp;
-                  [% ELSIF appointment || ctx.cs_times.$current_date.size; # show a select %]
+                  [% ELSIF appointment || ctx.cs_times.$lib.$current_date.size; # show a select %]
                     <select name="cs_time" [% IF disable_me || no_patron_input %]disabled="disabled"[% END %]>
                       [% found_time = 0 %]
-                      [% FOR t IN ctx.cs_times.$current_date %]
+                      [% FOR t IN ctx.cs_times.$lib.$current_date %]
                         <option value="[% t.0 | html %]"
                           [% IF cs_time == t.0; found_time=1 %] selected="selected"[% END %]
                           [% IF t.1 <= 0 && cs_time != t.0 %] disabled="disabled"[% END %]>