Bugzilla – Attachment 129924 Details for
Bug 29058
Add option to not load existing holds table automatically
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29058: Add 'Always show holds' checkbox to request.pl
Bug-29058-Add-Always-show-holds-checkbox-to-reques.patch (text/plain), 10.05 KB, created by
Jonathan Druart
on 2022-01-28 12:07:21 UTC
(
hide
)
Description:
Bug 29058: Add 'Always show holds' checkbox to request.pl
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2022-01-28 12:07:21 UTC
Size:
10.05 KB
patch
obsolete
>From 18c66195d94398d393a09ac8f9fc69b760f8850d Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Mon, 20 Sep 2021 11:17:50 +0000 >Subject: [PATCH] Bug 29058: Add 'Always show holds' checkbox to request.pl > >This patch adds a new cookie 'awalys_show_holds' and utlises it on request.pl >to determine if the existing holds table should be loaded. > >If the cookie does not exist, the table is loaded to preserve exiting behaviour. >If the cookie exists and is set to 'DONT' a new button 'Show holds' is added to >the page to allow force loading the table > >To test: >1 - Place some holds on a record >2 - Click 'Holds' tab or 'Place a hold' from details page >3 - Note search box to place hold and table of existing holds >4 - Apply patch >5 - Reload the holds page and note new checkbox 'Always show holds' >6 - Confirm the box is checked >7 - Uncheck it >8 - Reload the page and confirm holds do not automatically load >9 - Click the new 'Show holds' button >10 - Confirm the existing holds load, and that 'Always show holds' is unchecked >11 - Check 'Always show holds' >12 - Reload page and confirm holds don't show >13 - Uncheck the box, load holds for another record, confirm it remains unchecked >14 - Bring up browser console (F12) >15 - In 'Storage' tab, under 'Cookies', delete the cookie for 'always_show_holds' >16 - Reload holds page, confirm holds load and check box is checked > >Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> > >Bug 29058: (follow-up) Add hold count and don't display show options if no holds > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > .../prog/en/modules/reserve/request.tt | 18 +++ > reserve/request.pl | 103 +++++++++--------- > 2 files changed, 72 insertions(+), 49 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >index 7d89d9f5241..e9488ea1826 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >@@ -3,6 +3,7 @@ > [% USE Asset %] > [% USE JSON.Escape %] > [% USE Koha %] >+[% USE Biblio %] > [% USE KohaDates %] > [% USE Branches %] > [% USE Categories %] >@@ -904,6 +905,16 @@ > [% END %] > > [% UNLESS ( patron ) %] >+ [% SET hold_count = Biblio.HoldsCount( biblio.biblionumber ) | html %] >+ [% IF hold_count %] >+ <label for ="always_show_holds">Always show holds</label> >+ [% IF always_show_holds == 'DONT' %] >+ <input type="checkbox" name="always_show_holds" id="always_show_holds" value="DO"> >+ <a class="btn btn-default" value="Show holds" id="show_holds_now" href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% biblio.biblionumber %]&show_holds_now=1">Show holds ([% hold_count %])</a> >+ [% ELSE %] >+ <input type="checkbox" name="always_show_holds" value="DO" id="always_show_holds" checked="checked"> >+ [% END %] >+ [% END %] > [% IF ( reserveloop ) %] > <form id="existing_holds" name="T[% time | html %]" action="modrequest.pl" method="post" style="display:block"> > [% IF ( multi_hold ) %] >@@ -1399,6 +1410,13 @@ > } > > $(document).ready(function() { >+ $("#always_show_holds").change(function(){ >+ if( $(this).prop('checked') ){ >+ document.cookie = 'always_show_holds=DO'; >+ } else { >+ document.cookie = 'always_show_holds=DONT'; >+ } >+ }); > $("input.needsoverride").click(function() { // This must be before the radio button/checkbox switch logic > var itemnumber = this.value; > var msg = ''; >diff --git a/reserve/request.pl b/reserve/request.pl >index ebc578ee74a..9bad2e8faa6 100755 >--- a/reserve/request.pl >+++ b/reserve/request.pl >@@ -678,57 +678,62 @@ if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold ) > > # existingreserves building > my @reserveloop; >- my @reserves = Koha::Holds->search( { biblionumber => $biblionumber }, { order_by => 'priority' } ); >- foreach my $res ( >- sort { >- my $a_found = $a->found() || ''; >- my $b_found = $a->found() || ''; >- $a_found cmp $b_found; >- } @reserves >- ) >- { >- my %reserve; >- if ( $res->is_found() ) { >- $reserve{'holdingbranch'} = $res->item()->holdingbranch(); >- $reserve{'biblionumber'} = $res->item()->biblionumber(); >- $reserve{'barcodenumber'} = $res->item()->barcode(); >- $reserve{'wbrcode'} = $res->branchcode(); >- $reserve{'itemnumber'} = $res->itemnumber(); >- $reserve{'wbrname'} = $res->branch()->branchname(); >- $reserve{'atdestination'} = $res->is_at_destination(); >- $reserve{'desk_name'} = ( $res->desk() ) ? $res->desk()->desk_name() : '' ; >- $reserve{'found'} = $res->is_found(); >- $reserve{'inprocessing'} = $res->is_in_processing(); >- $reserve{'intransit'} = $res->is_in_transit(); >- } >- elsif ( $res->priority() > 0 ) { >- if ( my $item = $res->item() ) { >- $reserve{'itemnumber'} = $item->id(); >- $reserve{'barcodenumber'} = $item->barcode(); >- $reserve{'item_level_hold'} = 1; >+ my $always_show_holds = $input->cookie('always_show_holds'); >+ $template->param( always_show_holds => $always_show_holds ); >+ my $show_holds_now = $input->param('show_holds_now'); >+ unless( (defined $always_show_holds && $always_show_holds eq 'DONT') && !$show_holds_now ){ >+ my @reserves = Koha::Holds->search( { biblionumber => $biblionumber }, { order_by => 'priority' } ); >+ foreach my $res ( >+ sort { >+ my $a_found = $a->found() || ''; >+ my $b_found = $a->found() || ''; >+ $a_found cmp $b_found; >+ } @reserves >+ ) >+ { >+ my %reserve; >+ if ( $res->is_found() ) { >+ $reserve{'holdingbranch'} = $res->item()->holdingbranch(); >+ $reserve{'biblionumber'} = $res->item()->biblionumber(); >+ $reserve{'barcodenumber'} = $res->item()->barcode(); >+ $reserve{'wbrcode'} = $res->branchcode(); >+ $reserve{'itemnumber'} = $res->itemnumber(); >+ $reserve{'wbrname'} = $res->branch()->branchname(); >+ $reserve{'atdestination'} = $res->is_at_destination(); >+ $reserve{'desk_name'} = ( $res->desk() ) ? $res->desk()->desk_name() : '' ; >+ $reserve{'found'} = $res->is_found(); >+ $reserve{'inprocessing'} = $res->is_in_processing(); >+ $reserve{'intransit'} = $res->is_in_transit(); >+ } >+ elsif ( $res->priority() > 0 ) { >+ if ( my $item = $res->item() ) { >+ $reserve{'itemnumber'} = $item->id(); >+ $reserve{'barcodenumber'} = $item->barcode(); >+ $reserve{'item_level_hold'} = 1; >+ } > } >- } > >- $reserve{'expirationdate'} = $res->expirationdate; >- $reserve{'date'} = $res->reservedate; >- $reserve{'borrowernumber'} = $res->borrowernumber(); >- $reserve{'biblionumber'} = $res->biblionumber(); >- $reserve{'patron'} = $res->borrower; >- $reserve{'notes'} = $res->reservenotes(); >- $reserve{'waiting_date'} = $res->waitingdate(); >- $reserve{'ccode'} = $res->item() ? $res->item()->ccode() : undef; >- $reserve{'barcode'} = $res->item() ? $res->item()->barcode() : undef; >- $reserve{'priority'} = $res->priority(); >- $reserve{'lowestPriority'} = $res->lowestPriority(); >- $reserve{'suspend'} = $res->suspend(); >- $reserve{'suspend_until'} = $res->suspend_until(); >- $reserve{'reserve_id'} = $res->reserve_id(); >- $reserve{itemtype} = $res->itemtype(); >- $reserve{branchcode} = $res->branchcode(); >- $reserve{non_priority} = $res->non_priority(); >- $reserve{object} = $res; >- >- push( @reserveloop, \%reserve ); >+ $reserve{'expirationdate'} = $res->expirationdate; >+ $reserve{'date'} = $res->reservedate; >+ $reserve{'borrowernumber'} = $res->borrowernumber(); >+ $reserve{'biblionumber'} = $res->biblionumber(); >+ $reserve{'patron'} = $res->borrower; >+ $reserve{'notes'} = $res->reservenotes(); >+ $reserve{'waiting_date'} = $res->waitingdate(); >+ $reserve{'ccode'} = $res->item() ? $res->item()->ccode() : undef; >+ $reserve{'barcode'} = $res->item() ? $res->item()->barcode() : undef; >+ $reserve{'priority'} = $res->priority(); >+ $reserve{'lowestPriority'} = $res->lowestPriority(); >+ $reserve{'suspend'} = $res->suspend(); >+ $reserve{'suspend_until'} = $res->suspend_until(); >+ $reserve{'reserve_id'} = $res->reserve_id(); >+ $reserve{itemtype} = $res->itemtype(); >+ $reserve{branchcode} = $res->branchcode(); >+ $reserve{non_priority} = $res->non_priority(); >+ $reserve{object} = $res; >+ >+ push( @reserveloop, \%reserve ); >+ } > } > > # get the time for the form name... >-- >2.25.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 29058
:
125054
|
125062
|
125091
|
125487
|
125488
|
126995
| 129924 |
129925
|
129930
|
129931
|
129932
|
129933