Bugzilla – Attachment 166513 Details for
Bug 33737
Add bookings to patron details
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33737: Add bookings tab to patron details
Bug-33737-Add-bookings-tab-to-patron-details.patch (text/plain), 8.34 KB, created by
Marcel de Rooy
on 2024-05-10 09:18:45 UTC
(
hide
)
Description:
Bug 33737: Add bookings tab to patron details
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2024-05-10 09:18:45 UTC
Size:
8.34 KB
patch
obsolete
>From 5bbecdd7684eb5b2db16697904d8a359009ccc75 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Tue, 7 Dec 2021 14:38:06 +0000 >Subject: [PATCH] Bug 33737: Add bookings tab to patron details >Content-Type: text/plain; charset=utf-8 > >This patch adds a new 'bookings' tab to the bottom of the members >details pages. When a patron has any future or current bookings against >their record the tab will display the number of bookings in the tab name >and on clicking the tab a bookings table will display the current and >upcoming bookings. > >Signed-off-by: Esther Melander <esther@bywatersolutions.com> > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > Koha/Bookings.pm | 4 - > Koha/Patron.pm | 14 +++ > .../prog/en/includes/patron-detail-tabs.inc | 12 +++ > .../prog/en/modules/members/moremember.tt | 85 ++++++++++++++++++- > 4 files changed, 110 insertions(+), 5 deletions(-) > >diff --git a/Koha/Bookings.pm b/Koha/Bookings.pm >index 7f73a73ed3..b9bea5072c 100644 >--- a/Koha/Bookings.pm >+++ b/Koha/Bookings.pm >@@ -32,8 +32,6 @@ Koha::Bookings - Koha Booking object set class > > =head2 Class Methods > >-=cut >- > =head3 filter_by_future > > $bookings->filter_by_future; >@@ -49,8 +47,6 @@ sub filter_by_future { > > =head2 Internal Methods > >-=cut >- > =head3 _type > > =cut >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index d4b848db56..1524419a7d 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -1594,6 +1594,20 @@ sub curbside_pickups { > return Koha::CurbsidePickups->_new_from_dbic($curbside_pickups_rs); > } > >+=head3 bookings >+ >+ my $bookings = $item->bookings(); >+ >+Returns the bookings for this patron. >+ >+=cut >+ >+sub bookings { >+ my ( $self, $params ) = @_; >+ my $bookings_rs = $self->_result->bookings->search($params); >+ return Koha::Bookings->_new_from_dbic( $bookings_rs ); >+} >+ > =head3 return_claims > > my $return_claims = $patron->return_claims >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-detail-tabs.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-detail-tabs.inc >index b8ad2eb3b7..17f68d2ae0 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-detail-tabs.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-detail-tabs.inc >@@ -29,6 +29,10 @@ > [% WRAPPER tab_item tabname= "holds" %] > <span>Holds ([% holds_count || 0 | html %])</span> > [% END %] >+ [% WRAPPER tab_item tabname="bookings" %] >+ [% SET bookings_count = patron.bookings.filter_by_future.count %] >+ <span>Bookings ([% bookings_count || 0 | html %])</span> >+ [% END %] > [% END %] > > [% IF Koha.Preference('UseRecalls') %] >@@ -221,6 +225,14 @@ > <p>Patron has nothing on hold.</p> > [% END %] > [% END # /tab_panel#holds %] >+ >+ [% WRAPPER tab_panel tabname="bookings" %] >+ [% IF ( bookings_count ) %] >+ <table id="bookings-table" style="width: 100% !Important;"></table> >+ [% ELSE %] >+ <p>Patron has nothing booked.</p> >+ [% END %] >+ [% END %] > [% END %] > > [% IF Koha.Preference('UseRecalls') %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >index cd209c43cc..44098addba 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >@@ -696,7 +696,6 @@ > </div> <!-- /div.row --> > > [% INCLUDE 'patron-detail-tabs.inc' patronpage = "borrower" %] >- > </main> > </div> <!-- /.col-sm-10.col-sm-push-2 --> > >@@ -711,6 +710,8 @@ > [% INCLUDE 'modals/resolve_return_claim.inc' %] > [% END %] > >+ [% INCLUDE modals/cancel_booking.inc %] >+ > [% MACRO jsinclude BLOCK %] > [% INCLUDE 'datatables.inc' %] > [% Asset.js("lib/jquery/plugins/rowGroup/dataTables.rowGroup.min.js") | $raw %] >@@ -746,6 +747,8 @@ > [% END %] > [% Asset.js("js/holds.js") | $raw %] > [% INCLUDE 'calendar.inc' %] >+ [% Asset.js("js/bookings.js") | $raw %] >+ [% Asset.js("js/cancel_booking_modal.js") | $raw %] > [% INCLUDE 'str/members-menu.inc' %] > [% Asset.js("js/members-menu.js") | $raw %] > [% Asset.js("js/recalls.js") | $raw %] >@@ -774,7 +777,87 @@ > $('#guarantees_finesandcharges-tab').click(); > }); > >+ // Bookings >+ var bookings_table; >+ // Load bookings table on tab selection >+ $("#bookings-tab").on( "click", function(){ >+ if ( !bookings_table ) { >+ var today = new Date(); >+ var bookings_table_url = "/api/v1/bookings"; >+ bookings_table = $('#bookings-table').kohaTable({ >+ "ajax": { >+ "url": bookings_table_url >+ }, >+ "embed": [ >+ "biblio", >+ "item", >+ "patron" >+ ], >+ "columns": [{ >+ "data": "booking_id", >+ "title": "Booking ID", >+ "visible": false, >+ "searchable": false, >+ "orderable": false >+ }, >+ { >+ "data": "biblio.title", >+ "title": "Title", >+ "searchable": true, >+ "orderable": true, >+ "render": function(data,type,row,meta) { >+ return row.biblio.title; >+ } >+ }, >+ { >+ "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": "start_date", >+ "title": "Start date", >+ "searchable": true, >+ "orderable": true, >+ "render": function(data, type, row, meta) { >+ return $datetime(row.start_date); >+ } >+ }, >+ { >+ "data": "end_date", >+ "title": "End date", >+ "searchable": true, >+ "orderable": true, >+ "render": function(data, type, row, meta) { >+ return $datetime(row.end_date); >+ } >+ }, >+ { >+ "data": "", >+ "title": "Actions", >+ "searchable": false, >+ "orderable": false, >+ "render": function(data, type, row, meta) { >+ var result = '<button type="button" class="btn btn-default btn-xs cancel-action" data-toggle="modal" data-target="#cancelBookingModal" data-booking="'+row.booking_id+'"><i class="fa fa-trash" aria-hidden="true"></i> '+_("Cancel")+'</button>'; >+ return result; >+ } >+ }] >+ }, [], 1, { patron_id: "[% patron.borrowernumber | html %]", end_date: { ">=": today.toISOString() } }); >+ }; >+ }); >+ // Bookings >+ > }); >+ > function uncheck_sibling(me){ > nodename=me.getAttribute("name"); > if (nodename =="barcodes[]"){ >-- >2.30.2
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 33737
:
161045
|
161046
|
161047
|
162253
|
162254
|
162255
|
162256
|
163557
|
164994
|
164995
|
164996
|
164997
|
166513
|
166514
|
166515
|
166516
|
166565
|
166566
|
166567
|
166568
|
166570
|
166573
|
166577