Bugzilla – Attachment 151217 Details for
Bug 29002
Add ability to book items ahead of time
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29002: Add bookings view
Bug-29002-Add-bookings-view.patch (text/plain), 8.68 KB, created by
Martin Renvoize (ashimema)
on 2023-05-15 18:05:46 UTC
(
hide
)
Description:
Bug 29002: Add bookings view
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2023-05-15 18:05:46 UTC
Size:
8.68 KB
patch
obsolete
>From 471923f3135a8fa836fb88ad79fbf9f9e178c437 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >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 <http://www.gnu.org/licenses>. >+ >+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 @@ > <a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% biblio_object_id | url %]">Items</a> > </li> > >+ [%- IF ( bookingsview ) -%] >+ <li class="active"> >+ [%- ELSE -%] >+ <li> >+ [%- END -%] >+ <a href="/cgi-bin/koha/bookings/list.pl?biblionumber=[% biblio_object_id | url %]">Bookings</a> >+ </li> >+ > [%- IF ( CAN_user_reserveforothers ) -%] > [%- IF ( holdsview ) -%] > <li class="active"> >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' %] >+<title>Bookings for [% INCLUDE 'biblio-title-head.inc' %] › Bookings › Circulation › Koha</title> >+[% INCLUDE 'doc-head-close.inc' %] >+</head> >+ >+<body id="circ_request" class="catalog"> >+ >+[% INCLUDE 'header.inc' %] >+[% INCLUDE 'circ-search.inc' %] >+ >+<nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb"> >+ <ol> >+ <li> >+ <a href="/cgi-bin/koha/mainpage.pl">Home</a> >+ </li> >+ <li> >+ <a href="/cgi-bin/koha/catalogue/search.pl">Catalog</a> >+ </li> >+ <li> >+ [% INCLUDE 'biblio-title.inc' link =1 %] >+ </li> >+ <li> >+ <a href="#" aria-current="page"> >+ Bookings >+ </a> >+ </li> >+ </ol> >+</nav> >+ >+<div class="main container-fluid"> >+ <div class="row"> >+ <div class="col-sm-10 col-sm-push-2"> >+ <main> >+ <div class="row"> >+ <div class="btn-toolbar"> >+ <div class="btn-group"> >+ <button id="placbooking" class="btn btn-default" data-toggle="modal" data-target="#placeBookingModal" data-biblionumber="[% biblionumber | html %]"><i class="fa fa-calendar"></i> Place booking</button> >+ </div> >+ </div> >+ <h1>Bookings for [% INCLUDE 'biblio-title-head.inc' %]</h1> >+ <div class="page-section"> >+ <table id="bookings_table"></table> >+ </div> >+ </div> >+ </main> >+ </div> <!-- /.col-sm-10.col-sm-push-2 --> >+ >+ <div class="col-sm-2 col-sm-pull-10"> >+ <aside> >+ [% INCLUDE 'biblio-view-menu.inc' %] >+ </aside> >+ </div> <!-- /.col-sm-2.col-sm-pull-10 --> >+ </div> <!-- /.row --> >+ >+ [% 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 %] >+<script> >+ var bookings_table; >+ $(document).ready(function(){ >+ var bookings_table_url = "/api/v1/biblios/[% biblionumber | uri %]/bookings"; >+ bookings_table = $('#bookings_table').kohaTable({ >+ "ajax": { >+ "url": bookings_table_url >+ }, >+ "embed": [ >+ "item", >+ "patron" >+ ], >+ "columns": [{ >+ "data": "booking_id", >+ "title": "Booking ID", >+ "visible": false, >+ "searchable": false, >+ "orderable": false >+ }, >+ { >+ "data": "item.external_id", >+ "title": "Item", >+ "searchable": true, >+ "orderable": true, >+ "defaultContent": "Any item", >+ "render": function(data,type,row,meta) { >+ if ( row.item ) { >+ return row.item.external_id; >+ } else { >+ return null; >+ } >+ } >+ }, >+ { >+ "data": "patron.firstname:patron.surname", >+ "title": "Patron", >+ "searchable": true, >+ "orderable": true, >+ "render": function(data, type, row, meta) { >+ var fullname; >+ if ( row.patron.firstname == null ) { >+ fullname = row.patron.surname; >+ } >+ else { >+ fullname = row.patron.firstname + " " + row.patron.surname; >+ } >+ return escape_str(fullname); >+ } >+ }, >+ { >+ "data": "start_date", >+ "title": "Start date", >+ "searchable": true, >+ "orderable": true, >+ "render": function(data, type, row, meta) { >+ return $date(row.start_date); >+ } >+ }, >+ { >+ "data": "end_date", >+ "title": "End date", >+ "searchable": true, >+ "orderable": true, >+ "render": function(data, type, row, meta) { >+ return $date(row.end_date); >+ } >+ }] >+ }, [], 1); >+ }); >+</script> >+ [% END %] >+ >+[% INCLUDE 'intranet-bottom.inc' %] >-- >2.40.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 29002
:
125456
|
125457
|
125458
|
125459
|
151209
|
151211
|
151213
|
151216
|
151217
|
151218
|
158357
|
158358
|
160831