Bugzilla – Attachment 171841 Details for
Bug 33738
Add bookings to the OPAC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33738: Add bookings to the OPAC
Bug-33738-Add-bookings-to-the-OPAC.patch (text/plain), 28.20 KB, created by
Paul Derscheid
on 2024-09-20 19:18:48 UTC
(
hide
)
Description:
Bug 33738: Add bookings to the OPAC
Filename:
MIME Type:
Creator:
Paul Derscheid
Created:
2024-09-20 19:18:48 UTC
Size:
28.20 KB
patch
obsolete
>From 848e5c76e705628ced099564b0ee9cd5ecd8497f Mon Sep 17 00:00:00 2001 >From: Paul Derscheid <paul.derscheid@lmscloud.de> >Date: Fri, 20 Sep 2024 19:08:26 +0000 >Subject: [PATCH] Bug 33738: Add bookings to the OPAC > >This is a rough draft of an OPAC integration. >- The display of bookings already works more or less fine > - In the patron's summary table > - In the new bookings tab that doubles as the base for the placement modal >- The placement of new bookings is still more of a demo, because >we still need to integrate all of the logic in modals/place_booking.js >for flatpickr > => To try it out anyway: > 1) Make an item bookable > 2) Open the OPAC > 3) Login > 4) Go to opac-detail.pl for that item's biblio > 5) Note the 'Place Booking' entry in opac-detail-sidebar.inc and click > 6) Hit '+ New booking' (this is going to change of course) > 7) Fill in some details and pick a start date (for demo purposes it just adds a week) > >I'd be very interested in opinions, feedback, or follow-up patches (on vacation next week). >--- > .../bootstrap/en/includes/bookings-table.inc | 75 +++++++++ > .../bootstrap/en/includes/modals/bookings.inc | 93 +++++++++++ > .../en/includes/opac-detail-sidebar.inc | 4 + > .../bootstrap/en/includes/usermenu.inc | 9 ++ > .../bootstrap/en/modules/opac-bookings.tt | 147 ++++++++++++++++++ > .../bootstrap/en/modules/opac-user.tt | 13 +- > opac/opac-bookings.pl | 130 ++++++++++++++++ > opac/opac-detail.pl | 3 + > opac/opac-user.pl | 6 + > 9 files changed, 479 insertions(+), 1 deletion(-) > create mode 100644 koha-tmpl/opac-tmpl/bootstrap/en/includes/bookings-table.inc > create mode 100644 koha-tmpl/opac-tmpl/bootstrap/en/includes/modals/bookings.inc > create mode 100644 koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-bookings.tt > create mode 100755 opac/opac-bookings.pl > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/bookings-table.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/bookings-table.inc >new file mode 100644 >index 0000000000..6afe5c67cf >--- /dev/null >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/bookings-table.inc >@@ -0,0 +1,75 @@ >+[% USE Branches %] >+[% USE ItemTypes %] >+[% USE KohaDates %] >+[% PROCESS 'i18n.inc' %] >+ >+<table id="opac-user-bookings-table" class="table table-bordered table-striped"> >+ <caption>Bookings <span class="count">([% BOOKINGS.count | html %] total)</span></caption> >+ <thead> >+ <tr> >+ <th class="all anti-the">Title</th> >+ <th class="psort">Placed on</th> >+ <th class="psort">Pickup location</th> >+ <th class="psort">Start date</th> >+ <th class="psort">End date</th> >+ <th class="psort">Item type</th> >+ <th class="psort">Barcode</th> >+ <th class="psort">Provided by</th> >+ <th class="nosort">Modify</th> >+ <th></th> >+ </tr> >+ </thead> >+ <tbody> >+ [% FOREACH BOOKING IN BOOKINGS %] >+ <tr> >+ <td class="title"> >+ [% INCLUDE 'biblio-title.inc' biblio=BOOKING.biblio link => 1 %] >+ [% BOOKING.item.enumchron | html %] >+ [% BOOKING.biblio.author | html %] >+ </td> >+ <td class="creation-date"> >+ [% BOOKING.creation_date | $KohaDates %] >+ </td> >+ <td class="pickup-library"> >+ [% BOOKING.pickup_library.branchname | html %] >+ <button type="button" class="btn btn-sm btn-link" data-bs-toggle="modal" data-bs-target="#change-pickup-location-[% BOOKING.booking_id | html %]"> >+ <i class="fa fa-pencil-alt" aria-hidden="true"></i> Change >+ </button> >+ [% PROCESS 'modals/bookings.inc' action = 'change-pickup-location' %] >+ </td> >+ <td class="start-date"> >+ [% BOOKING.start_date | $KohaDates %] >+ </td> >+ <td class="end-date"> >+ [% BOOKING.end_date | $KohaDates %] >+ </td> >+ [% IF BOOKING.item %] >+ <td class="item-type"> >+ [% BOOKING.item.itemtype.description %] >+ </td> >+ <td class="barcode"> >+ [% BOOKING.item.barcode %] >+ </td> >+ [% ELSE %] >+ <td>–</td> >+ <td>–</td> >+ [% END %] >+ <td class="branch"> >+ [% Branches.GetName(BOOKING.item.homebranch) | html %] >+ </td> >+ <td class="modify"> >+ <button >+ type="button" >+ class="btn btn-sm btn-danger btn-delete-booking" >+ data-bs-toggle="modal" >+ data-bs-target="#cancel-[% BOOKING.booking_id | html %]" >+ > >+ <i class="fa fa-times" aria-hidden="true"></i> [% tp('Cancel booking button', 'Cancel') | html %] >+ </button> >+ [% PROCESS 'modals/bookings.inc' action = 'cancel' %] >+ </td> >+ <td></td> >+ </tr> >+ [% END # /FOREACH HOLDS %] >+ </tbody> >+</table> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/modals/bookings.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/modals/bookings.inc >new file mode 100644 >index 0000000000..a146d7a408 >--- /dev/null >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/modals/bookings.inc >@@ -0,0 +1,93 @@ >+[% USE Branches %] >+[% SET booking_id = BOOKING.booking_id | html %] >+ >+<div class="modal" id="[% action %]-[% booking_id %]" tabindex="-1" aria-labelledby="[% action %]-[% booking_id %]-label" aria-hidden="true"> >+ <div class="modal-dialog"> >+ <form id="[% action %]-form-[% booking_id %]" action="/cgi-bin/koha/opac-bookings.pl" method="post"> >+ [% INCLUDE 'csrf-token.inc' %] >+ <input type="hidden" name="op" value="cud-[% action.replace('-', '_') %]"> >+ <div class="modal-content"> >+ <div class="modal-header"> >+ <h1 class="modal-title" id="[% action %]-[% booking_id %]-label"> >+ [% SWITCH action %] >+ [% CASE 'change-pickup-location' %] >+ Change pickup location for booking of <em>[% INCLUDE 'biblio-title.inc' biblio=BOOKING.item.biblio %]</em> >+ [% CASE 'cancel' %] >+ Cancel booking of <em>[% INCLUDE 'biblio-title.inc' biblio=BOOKING.item.biblio %]</em> >+ [% CASE 'add' %] >+ Place a booking >+ [% CASE %] >+ [% END %] >+ </h1> >+ <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> >+ </div> >+ <div class="modal-body"> >+ [% SWITCH action %] >+ [% CASE 'change-pickup-location' %] >+ <div class="form-group"> >+ <label for="new-pickup-location-[% booking_id %]">New pickup location:</label> >+ <select name="new_pickup_location" id="new-pickup-location-[% booking_id %]" class="form-select"> >+ [% PROCESS options_for_libraries libraries = Branches.pickup_locations({ search_params => { biblio => BOOKING.item.biblio, patron => BOOKING.patron_id }, selected => BOOKING.pickup_library_id }) %] >+ </select> >+ </div> >+ [% CASE 'cancel' %] >+ <span>Are you sure you want to cancel your booking of <em>[% INCLUDE 'biblio-title.inc' biblio=BOOKING.item.biblio %]</em>?</span> >+ [% CASE 'add' %] >+ <!-- >+ <input name="biblio_id"> >+ <input name="item_id"> >+ <input name="pickup_library_id"> >+ <input name="start_date"> >+ <input name="end_date"> >+ --> >+ <fieldset class="brief"> >+ <input type="hidden" name="biblio_id" id="biblio-id" value="[% biblio.biblionumber %]"> >+ <ol> >+ <li> >+ <label class="required" for="pickup-library-id">Pickup at:</label> >+ <select name="pickup_library_id" id="pickup-library-id" required> >+ <option selected>Please select a pickup location</option> >+ [% PROCESS options_for_libraries libraries = Branches.pickup_locations({ search_params => { biblio => biblio.biblionumber, patron => logged_in_user.borrowernumber } }) %] >+ </select> >+ <span class="required">Required</span> >+ </li> >+ <label for="booking-item-id">Item: </label> >+ <select name="item_id" id="booking-item-id"> >+ <option value="0">Any item</option> >+ [% FOR item IN biblio.bookable_items %] >+ <option value="[% item.itemnumber %]">[% item.barcode %]</option> >+ [% END %] >+ </select> >+ </li> >+ <li> >+ <div id="period_fields"> >+ <label class="required" for="period">Booking dates: </label> >+ <input type="text" id="period" name="period" class="flatpickr" data-flatpickr-futuredate="true" data-flatpickr-disable-shortcuts="true" required autocomplete="off"> >+ <span class="required">Required</span> >+ </div> >+ <div class="hint">Select the booking start date (and end date in the next patch)</div> >+ </li> >+ </ol> >+ </fieldset> >+ [% CASE %] >+ [% END %] >+ <input type="hidden" name="booking_id" value="[% booking_id %]" /> >+ </div> >+ <div class="modal-footer"> >+ <button type="submit" name="[% action.replace('-', '_') %]" value="1" class="btn btn-primary"> >+ <i class="fa fa-check" aria-hidden="true"></i> >+ [% SWITCH action %] >+ [% CASE 'cancel' %] >+ <span>Confirm</span> >+ [% CASE %] >+ Save >+ [% END %] >+ </button> >+ <button type="button" class="btn btn-secondary" data-bs-dismiss="modal"> >+ <i class="fa fa-times" aria-hidden="true"></i> Cancel >+ </button> >+ </div> >+ </div> <!-- /.modal-content --> >+ </form> >+ </div> <!-- /.modal-dialog --> >+</div> <!-- /.modal --> >\ No newline at end of file >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-detail-sidebar.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-detail-sidebar.inc >index 211f6d6169..410320ffd4 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-detail-sidebar.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-detail-sidebar.inc >@@ -7,6 +7,10 @@ > <li><a class="reserve btn btn-link btn-lg" href="/cgi-bin/koha/opac-reserve.pl?biblionumber=[% biblio.biblionumber | html %]"><i class="fa fa-fw fa-bookmark" aria-hidden="true"></i> Place hold</a></li> > [% END %] > [% END %] >+ >+ [% IF ( BookableItems ) %] >+ <li><a class="booking btn btn-link btn-lg" href="/cgi-bin/koha/opac-bookings.pl?biblio_id=[% biblio.biblionumber | html %]"><i class="fa fa-fw fa-calendar" aria-hidden="true"></i> Place booking</a></li> >+ [% END %] > [% END %] > > [% IF Koha.Preference('UseRecalls') %] >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc >index d088f48ab7..9fa70b3d57 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc >@@ -122,6 +122,15 @@ > <a href="/cgi-bin/koha/opac-shelves.pl?op=list">Lists</a></li> > [% END %] > >+ [% IF logged_in_user.bookings.count %] >+ [% IF ( bookingsview ) %] >+ <li class="active"> >+ [% ELSE %] >+ <li> >+ [% END %] >+ <a href="/cgi-bin/koha/opac-bookings.pl">Bookings ([% logged_in_user.bookings.count | html %])</a></li> >+ [% END %] >+ > [% IF Koha.Preference( 'RoutingSerials' ) && logged_in_user && logged_in_user.get_routing_lists.count %] > [% IF ( routinglistsview ) %] > <li class="active"> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-bookings.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-bookings.tt >new file mode 100644 >index 0000000000..c498bf4c4a >--- /dev/null >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-bookings.tt >@@ -0,0 +1,147 @@ >+[% USE raw %] >+[% USE Asset %] >+[% USE Koha %] >+[% USE KohaDates %] >+[% USE Branches %] >+[% USE ItemTypes %] >+[% USE Price %] >+[% USE AuthorisedValues %] >+[% USE AdditionalContents %] >+[% SET OpacNav = AdditionalContents.get( location => "OpacNav", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %] >+[% SET OpacNavBottom = AdditionalContents.get( location => "OpacNavBottom", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %] >+[% SET OpacMySummaryNote = AdditionalContents.get( location => "OpacMySummaryNote", lang => lang, library => branchcode ) %] >+ >+[% SET borrower_club_enrollments = logged_in_user.get_club_enrollments %] >+[% SET borrower_enrollable_clubs = logged_in_user.get_enrollable_clubs(1) %] <!-- 1 => OPAC --> >+ >+[% INCLUDE 'doc-head-open.inc' %] >+<title>Your library home › [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</title> >+[% INCLUDE 'doc-head-close.inc' %] >+[% Asset.css("css/overdrive.css") | $raw %] >+[% BLOCK cssinclude %][% END %] >+</head> >+[% INCLUDE 'bodytag.inc' bodyid='opac-user' bodyclass='scrollto' %] >+[% INCLUDE 'masthead.inc' %] >+ >+<div class="main"> >+ [% WRAPPER breadcrumbs %] >+ [% WRAPPER breadcrumb_item %] >+ <a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a> >+ [% END %] >+ [% WRAPPER breadcrumb_item bc_active= 1 %] >+ <span>Your bookings</span> >+ [% END %] >+ [% END #/ WRAPPER breadcrumbs %] >+ >+ <div class="container-fluid"> >+ <div class="row"> >+ <div class="col col-lg-2 order-2 order-lg-1"> >+ <div id="navigation"> >+ [% INCLUDE 'navigation.inc' IsPatronPage=1 %] >+ </div> >+ </div> >+ <div class="col-md-12 col-lg-10 order-1 order-lg-2"> >+ <div id="userbookings" class="maincontent"> >+ <h1>Your bookings</h1> >+ >+ [% IF op == 'list' %] >+ <div class="toptabs"> >+ <ul class="nav nav-tabs" id="list-tabs"> >+ <li id="user-bookings-tab" class="nav-item"> >+ <a class="nav-link active" id="your-bookings" href="/cgi-bin/koha/opac-bookings.pl?op=list">Your bookings</a> >+ </li> >+ </ul> >+ </div> <!-- /.toptabs --> >+ <div class="tab-content"> >+ <div id="toolbar" class="toolbar clearfix"> >+ <div class="list-actions"> >+ <button >+ type="button" >+ class="btn btn-sm btn-link" >+ data-bs-toggle="modal" >+ data-bs-target="#add-[% BOOKING.booking_id | html %]" >+ > >+ <i class="fa fa-fw fa-plus" aria-hidden="true"></i> New booking >+ </button> >+ [% PROCESS 'modals/bookings.inc' action = 'add' %] >+ </div> <!-- / .list-actions --> >+ </div> <!-- / #toolbar --> >+ [% PROCESS 'bookings-table.inc' %] >+ </div> >+ [% END %] >+ </div> <!-- /#userdetails --> >+ </div> <!-- /.col-10 --> >+ </div> <!-- /.row --> >+ </div> <!-- /.container-fluid --> >+</div> <!-- /#main --> >+ >+[% INCLUDE 'opac-bottom.inc' %] >+[% BLOCK jsinclude %] >+ [% Asset.js("js/form-submit.js") | $raw %] >+ [% Asset.js("lib/vis-timeline/vis-timeline-graph2d.min.js") | $raw %] >+ [% INCLUDE 'calendar.inc' %] >+ [% INCLUDE 'datatables.inc' %] >+ >+ <script> >+ $(document).ready(() => { >+ const dataTable = $("#opac-user-bookings-table"); >+ const thIndex = $(dataTable).find("th.psort").index(); >+ $(dataTable) >+ .dataTable($.extend(true, {}, dataTablesDefaults, { >+ "sorting": [ >+ [thIndex, 'asc'] >+ ], >+ "dom": '<"top"<"table_entries"><"table_controls"fB>>t', >+ "columnDefs": [{ >+ "targets": ["nosort"], >+ "sortable": false, >+ "searchable": false >+ }, >+ { >+ "type": "anti-the", >+ "targets": ["anti-the"] >+ }, >+ { >+ "visible": false, >+ "targets": ["hidden"] >+ }, >+ { >+ "className": 'dtr-control', >+ "orderable": false, >+ "targets": -1 >+ } >+ ], >+ "language": { >+ "search": "_INPUT_", >+ "searchPlaceholder": _("Search") >+ }, >+ "autoWidth": false, >+ "responsive": { >+ details: { >+ type: 'column', >+ target: -1 >+ } >+ }, >+ buttons: [ >+ /* Override default button set so that we can extend the options of print and csv */ >+ 'clearFilter', 'copy', >+ { >+ extend: "print", >+ exportOptions: { >+ /* Print view should show all columns (even invisible ones) unless they are .noExport */ >+ columns: ":not(.noExport)" >+ } >+ }, >+ { >+ extend: "csv", >+ exportOptions: { >+ /* CSV export should include all columns (even invisible ones) unless they are .noExport */ >+ columns: ":not(.noExport)" >+ } >+ } >+ ] >+ })); >+ }); >+ </script> >+ >+[% END %] >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >index 89e2b1dd0a..6229ddd340 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >@@ -298,6 +298,11 @@ > <span>Holds ([% RESERVES.count | html %])</span> > [% END %] > [% END %] >+ [% IF ( BOOKINGS.count ) %] >+ [% WRAPPER tab_item tabname= "opac-user-bookings" %] >+ <span>Bookings ([% BOOKINGS.count | html %])</span> >+ [% END %] >+ [% END %] > [% IF Koha.Preference('UseRecalls') && RECALLS.count %] > [% WRAPPER tab_item tabname= "opac-user-recalls" %] > <span>Recalls ([% RECALLS.count | html %])</span> >@@ -843,6 +848,12 @@ > [% END # /tab_panel#opac-user-holds %] > [% END # / #RESERVES.count %] > >+ [% IF ( BOOKINGS.count ) %] >+ [% WRAPPER tab_panel tabname="opac-user-bookings" %] >+ [% PROCESS 'bookings-table.inc' %] >+ [% END # /tab_panel#opac-user-bookings %] >+ [% END # / #BOOKINGS.count %] >+ > [% IF Koha.Preference('UseRecalls') && RECALLS.count %] > [% WRAPPER tab_panel tabname="opac-user-recalls" %] > <table id="recalls-table" class="table table-bordered table-striped"> >@@ -1217,7 +1228,7 @@ > ); > }); > >- var dTables = $("#checkoutst,#holdst,#overduest,#opac-user-relative-issues-table"); >+ var dTables = $("#checkoutst,#holdst,#overduest,#opac-user-relative-issues-table,#opac-user-bookings-table"); > dTables.each(function(){ > var thIndex = $(this).find("th.psort").index(); > $(this).on("init.dt", function() { >diff --git a/opac/opac-bookings.pl b/opac/opac-bookings.pl >new file mode 100755 >index 0000000000..7b19823854 >--- /dev/null >+++ b/opac/opac-bookings.pl >@@ -0,0 +1,130 @@ >+#!/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 <http://www.gnu.org/licenses>. >+ >+use Modern::Perl; >+ >+use C4::Members (); >+use C4::Auth qw( get_template_and_user ); >+use C4::Output qw( output_html_with_http_headers ); >+ >+use Koha::Biblios (); >+use Koha::Booking (); >+use Koha::Bookings (); >+use Koha::DateUtils qw(dt_from_string); >+use Koha::Patrons (); >+ >+use CGI qw( -utf8 ); >+use Carp qw( croak ); >+use Digest::SHA qw( sha1_base64 ); >+use Time::HiRes qw( time ); >+ >+my $query = CGI->new; >+ >+my ( $template, $borrowernumber, $cookie ) = get_template_and_user( >+ { >+ template_name => 'opac-bookings.tt', >+ query => $query, >+ type => 'opac', >+ } >+); >+ >+my $patron = Koha::Patrons->find($borrowernumber); >+ >+my $op = $query->param('op') // 'list'; >+if ( $op eq 'list' ) { >+ my $bookings = Koha::Bookings->search( { patron_id => $patron->borrowernumber } )->filter_by_active; >+ my $hash = sha1_base64( join q{}, time, rand ); >+ >+ my $biblio; >+ my $biblio_id = $query->param('biblio_id'); >+ if ($biblio_id) { >+ $biblio = Koha::Biblios->find($biblio_id); >+ } >+ >+ $template->param( >+ op => 'list', BOOKINGS => $bookings, >+ BOOKING => { booking_id => $hash }, >+ biblio => $biblio, >+ ); >+} >+ >+if ( $op eq 'cud-add' ) { >+ my $booking = Koha::Booking->new( >+ { >+ patron_id => $patron->borrowernumber, >+ biblio_id => $query->param('biblio_id'), >+ item_id => $query->param('item_id'), >+ pickup_library_id => $query->param('pickup_library_id'), >+ start_date => dt_from_string( $query->param('period') ), >+ end_date => dt_from_string( $query->param('period') )->add( days => 7 )->truncate( to => 'day' ), >+ } >+ )->store; >+ >+ print $query->redirect('/cgi-bin/koha/opac-bookings.pl?op=list') or croak; >+} >+ >+if ( $op eq 'cud-cancel' ) { >+ my $booking_id = $query->param('booking_id'); >+ my $booking = Koha::Bookings->find($booking_id); >+ if ( !$booking ) { >+ print $query->redirect('/cgi-bin/koha/errors/404.pl') or croak; >+ exit; >+ } >+ >+ if ( $booking->patron_id ne $patron->borrowernumber ) { >+ print $query->redirect('/cgi-bin/koha/errors/403.pl') or croak; >+ exit; >+ } >+ >+ my $is_deleted = $booking->delete; >+ if ( !$is_deleted ) { >+ print $query->redirect('/cgi-bin/koha/errors/500.pl') or croak; >+ exit; >+ } >+ >+ print $query->redirect('/cgi-bin/koha/opac-user.pl?tab=opac-user-bookings') or croak; >+} >+ >+if ( $op eq 'cud-change_pickup_location' ) { >+ my $booking_id = $query->param('booking_id'); >+ my $new_pickup_location = $query->param('new_pickup_location'); >+ my $booking = Koha::Bookings->find($booking_id); >+ >+ if ( !$booking ) { >+ print $query->redirect('/cgi-bin/koha/errors/404.pl') or croak; >+ exit; >+ } >+ >+ if ( $booking->patron_id ne $patron->borrowernumber ) { >+ print $query->redirect('/cgi-bin/koha/errors/403.pl') or croak; >+ exit; >+ } >+ >+ my $is_updated = $booking->update( { pickup_library_id => $new_pickup_location } ); >+ if ( !$is_updated ) { >+ print $query->redirect('/cgi-bin/koha/errors/500.pl') or croak; >+ exit; >+ } >+ >+ print $query->redirect('/cgi-bin/koha/opac-user.pl?tab=opac-user-bookings') or croak; >+} >+ >+$template->param( >+ bookingsview => 1, >+); >+ >+output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 }; >diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl >index e9f188da2b..dd22d0aa27 100755 >--- a/opac/opac-detail.pl >+++ b/opac/opac-detail.pl >@@ -670,6 +670,8 @@ my $holdable_items = $biblio->items->filter_by_for_hold->count; > # If we don't have a patron, then holdable items determines holdability > my $can_holds_be_placed = $patron ? 0 : $holdable_items; > >+my $can_bookings_be_placed = $patron ? $biblio->bookable_items->count : 0; >+ > my ( $itemloop_has_images, $otheritemloop_has_images ); > my $item_level_holds; > my $item_checkouts; >@@ -780,6 +782,7 @@ $template->param( > item_checkouts => $item_checkouts, > item_level_holds => $item_level_holds, > ReservableItems => $can_holds_be_placed, >+ BookableItems => $can_bookings_be_placed, > itemloop_has_images => $itemloop_has_images, > otheritemloop_has_images => $otheritemloop_has_images, > ); >diff --git a/opac/opac-user.pl b/opac/opac-user.pl >index a1b8b9f910..3a523c6745 100755 >--- a/opac/opac-user.pl >+++ b/opac/opac-user.pl >@@ -334,6 +334,12 @@ $template->param( > showpriority => $show_priority, > ); > >+my $bookings = $patron->bookings->filter_by_active; >+ >+$template->param( >+ BOOKINGS => $bookings, >+); >+ > if ( C4::Context->preference('UseRecalls') ) { > my $recalls = Koha::Recalls->search( { patron_id => $borrowernumber, completed => 0 } ); > $template->param( RECALLS => $recalls ); >-- >2.46.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 33738
:
171841
|
176235
|
176548