From 471923f3135a8fa836fb88ad79fbf9f9e178c437 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Mon, 15 May 2023 16:30:26 +0100 Subject: [PATCH] Bug 29002: Add bookings view This patch adds a new view to the biblio details page to display any bookings that may have been made. Test plan 1) Run through the steps from the previous patch 2) Note the appearance of a new 'Bookings' option in the left menu 3) Click the bookings option to load the new bookings page for the biblio 4) See that the booking from the previous patch appears on the page. --- api/v1/swagger/paths/biblios.yaml | 3 + bookings/list.pl | 46 ++++++ .../prog/en/includes/biblio-view-menu.inc | 8 + .../prog/en/modules/bookings/list.tt | 141 ++++++++++++++++++ 4 files changed, 198 insertions(+) create mode 100755 bookings/list.pl create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/bookings/list.tt diff --git a/api/v1/swagger/paths/biblios.yaml b/api/v1/swagger/paths/biblios.yaml index aba96c7f8d..b0c15c632d 100644 --- a/api/v1/swagger/paths/biblios.yaml +++ b/api/v1/swagger/paths/biblios.yaml @@ -343,6 +343,9 @@ x-koha-authorization: permissions: circulation: "1" + x-koha-embed: + - item + - patron "/biblios/{biblio_id}/checkouts": get: x-mojo-to: Biblios#get_checkouts diff --git a/bookings/list.pl b/bookings/list.pl new file mode 100755 index 0000000000..35979fdb33 --- /dev/null +++ b/bookings/list.pl @@ -0,0 +1,46 @@ +#!/usr/bin/perl + +# Copyright PTFS Europe 2021 +# +# 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::Output qw( output_html_with_http_headers ); +use C4::Auth qw( get_template_and_user ); + +my $input = CGI->new; +my ( $template, $borrowernumber, $cookie, $flags ) = get_template_and_user( + { + template_name => "bookings/list.tt", + query => $input, + type => "intranet", + flagsrequired => { circulation => 1 }, + } +); + +my $biblionumber = $input->param('biblionumber'); +my $biblio = Koha::Biblios->find($biblionumber); + +$template->param( + biblionumber => $biblionumber, + biblio => $biblio, + bookingsview => 1, +); + +output_html_with_http_headers $input, $cookie, $template->output; diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/biblio-view-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/biblio-view-menu.inc index 90b3287f1b..60ce97db40 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/biblio-view-menu.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/biblio-view-menu.inc @@ -50,6 +50,14 @@ Items + [%- IF ( bookingsview ) -%] +
  • + [%- ELSE -%] +
  • + [%- END -%] + Bookings +
  • + [%- IF ( CAN_user_reserveforothers ) -%] [%- IF ( holdsview ) -%]
  • diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/bookings/list.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/bookings/list.tt new file mode 100644 index 0000000000..52834a6aab --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/bookings/list.tt @@ -0,0 +1,141 @@ +[% USE raw %] +[% USE Asset %] +[% USE KohaDates %] +[% SET footerjs = 1 %] +[% INCLUDE 'doc-head-open.inc' %] +Bookings for [% INCLUDE 'biblio-title-head.inc' %] › Bookings › Circulation › Koha +[% INCLUDE 'doc-head-close.inc' %] + + + + +[% INCLUDE 'header.inc' %] +[% INCLUDE 'circ-search.inc' %] + + + +
    +
    +
    +
    +
    +
    +
    + +
    +
    +

    Bookings for [% INCLUDE 'biblio-title-head.inc' %]

    +
    +
    +
    +
    +
    +
    + +
    + +
    +
    + + [% INCLUDE modals/place_booking.inc %] + + [% MACRO jsinclude BLOCK %] + [% Asset.js("lib/dayjs/dayjs.min.js") | $raw %] + [% INCLUDE 'datatables.inc' %] + [% INCLUDE 'columns_settings.inc' %] + [% INCLUDE 'calendar.inc' %] + [% INCLUDE 'select2.inc' %] + [% INCLUDE 'js-date-format.inc' %] + [% Asset.js("js/place_booking_modal.js") | $raw %] + + [% END %] + +[% INCLUDE 'intranet-bottom.inc' %] -- 2.40.1