@@ -, +, @@ a. You must define a "pickup interval" and a "maximum patrons per interval" b. If "Patron-scheduled pickup" is enabled, patrons will be able to c. If "Enable for waiting holds only" is enabled, only patron with waiting d. In the bottom part of the form you can define the slots available for e. Save --- admin/curbside_pickup.pl | 95 ++++++ .../prog/en/modules/admin/curbside_pickup.tt | 316 ++++++++++++++++++ 2 files changed, 411 insertions(+) create mode 100755 admin/curbside_pickup.pl create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/admin/curbside_pickup.tt --- a/admin/curbside_pickup.pl +++ a/admin/curbside_pickup.pl @@ -0,0 +1,95 @@ +#! /usr/bin/perl + +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# Koha is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Koha; if not, see . + +use Modern::Perl; +use CGI qw ( -utf8 ); +use C4::Context; +use C4::Auth qw( get_template_and_user ); +use C4::Output qw( output_html_with_http_headers ); + +use Koha::CurbsidePickupPolicies; +use Koha::Libraries; + +my $input = CGI->new; +my $op = $input->param('op') || 'list'; +my @messages; + +my ( $template, $loggedinuser, $cookie ) = get_template_and_user( + { + template_name => "admin/curbside_pickup.tt", + query => $input, + type => "intranet", + flagsrequired => { parameters => 'manage_curbside_pickups' }, + } +); + +my $libraries = Koha::Libraries->search( {}, { order_by => ['branchname'] } ); +if ( $op eq 'save' ) { + foreach my $library ( $libraries->as_list ) { + my $branchcode = $library->branchcode; + + my $params = { + + branchcode => $branchcode, + enabled => scalar $input->param("enable-$branchcode") || 0, + pickup_interval => scalar $input->param("interval-$branchcode"), + patrons_per_interval => scalar $input->param("max-per-interval-$branchcode"), + patron_scheduled_pickup => scalar $input->param("patron-scheduled-$branchcode") || 0, + }; + + for my $day ( + qw( sunday monday tuesday wednesday thursday friday saturday )) + { + for my $start_end (qw( start end )) { + for my $hour_min (qw( hour minute )) { + + my $value = $input->param( + "pickup-$start_end-$hour_min-$day-$branchcode"); + $value = undef if $value eq q{}; + + my $key = $day . '_' . $start_end . '_' . $hour_min; + + $params->{$key} = $value; + } + } + } + + my $CurbsidePickupPolicy = + Koha::CurbsidePickupPolicies->find( { branchcode => $branchcode } ); + $CurbsidePickupPolicy->delete if $CurbsidePickupPolicy; + + Koha::CurbsidePickupPolicy->new($params)->store(); + } + $op = 'list'; +} + +if ( $op eq 'list' ) { + $template->param( + policies => { + map { $_->branchcode => $_ } + Koha::CurbsidePickupPolicies->search->as_list + }, + libraries => $libraries, + ); +} + +$template->param( + messages => \@messages, + op => $op, +); + +output_html_with_http_headers $input, $cookie, $template->output; --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/curbside_pickup.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/curbside_pickup.tt @@ -0,0 +1,316 @@ +[% USE raw %] +[% USE Asset %] +[% SET footerjs = 1 %] +[% USE TablesSettings %] +[% INCLUDE 'doc-head-open.inc' %] + + Curbside pickup › Administration › Koha + +[% INCLUDE 'doc-head-close.inc' %] + + + + +[% INCLUDE 'header.inc' %] +[% INCLUDE 'cities-admin-search.inc' %] + +[% USE format_minutes = format('%02d') %] +[% MACRO minutes_format BLOCK %][% IF m != "" %][% format_minutes(m) | html %][% END %][% END %] + + +
+
+
+
+ +[% FOR m IN messages %] +
+ [% SWITCH m.code %] + [% CASE %] + [% m.code | html %] + [% END %] +
+[% END %] + +[% IF op == 'list' %] + +

Curbside pickup configuration

+ +
+
+ + +
+ [% FOREACH l IN libraries %] + [% SET branchcode = l.branchcode %] + [% IF loop.first %] +
+ [% ELSE %] +
+ [% END %] +
+
    +
  1. + + [% IF policies.$branchcode.enabled %] + + [% ELSE %] + + [% END %] + Enable curbside pickup. +
  2. + +
  3. + + + Number of minutes each curbside pickup interaction will take. +
  4. + +
  5. + + + Maximum number of simultaneus pickups per interval. +
  6. + +
  7. + + [% IF policies.$branchcode.patron_scheduled_pickup %] + + [% ELSE %] + + [% END %] + Enable patrons to schedule their own curbside pickups. +
  8. +
+
+ +
+ Curbside pickup hours + + Times should be in 24-hour format ( 00:00 to 23:59 ). + +
    + [% BLOCK pickup_hours_day %] + [% SET day_start_hour = d _ '_start_hour' %] + [% SET day_start_minute = d _ '_start_minute' %] + [% SET day_end_hour = d _ '_end_hour' %] + [% SET day_end_minute = d _ '_end_minute' %] + [% SET p = policies.$branchcode %] + [% IF p.$day_start_hour && p.$day_start_minute && p.$day_end_hour && p.$day_end_minute %] +
  1. + + + +
  2. + [% END %] + [% END %] + [% PROCESS pickup_hours_day d => 'sunday' %] + [% PROCESS pickup_hours_day d => 'monday' %] + [% PROCESS pickup_hours_day d => 'tuesday' %] + [% PROCESS pickup_hours_day d => 'wednesday' %] + [% PROCESS pickup_hours_day d => 'thursday' %] + [% PROCESS pickup_hours_day d => 'friday' %] + [% PROCESS pickup_hours_day d => 'saturday' %] +
+ +
    +
  1. + +
    + + to + + + +
    +
  2. + +
+
+
+ [% END %] +
+
+ + + +
+ +
+ +[% END %] + +
+
+ +
+ +
+
+ +[% MACRO jsinclude BLOCK %] + [% Asset.js("js/admin-menu.js") | $raw %] + +[% END %] +[% INCLUDE 'intranet-bottom.inc' %] --