Bugzilla – Attachment 125062 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.30 KB, created by
Andrew Fuerste-Henry
on 2021-09-20 13:47:29 UTC
(
hide
)
Description:
Bug 29058: Add 'Always show holds' checkbox to request.pl
Filename:
MIME Type:
Creator:
Andrew Fuerste-Henry
Created:
2021-09-20 13:47:29 UTC
Size:
10.30 KB
patch
obsolete
>From 81a948c3470ca28bfd1fd38f7349b2060790c54c 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> >--- > .../prog/en/modules/reserve/request.tt | 16 ++- > reserve/request.pl | 127 +++++++++--------- > 2 files changed, 81 insertions(+), 62 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 f54ac0d32a..4d36b6cb78 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >@@ -881,12 +881,19 @@ > [% END %] > > [% UNLESS ( patron ) %] >+ >+ <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</a> >+ [% ELSE %] >+ <input type="checkbox" name="always_show_holds" value="DO" id="always_show_holds" checked="checked"> >+ [% END %] > [% IF ( reserveloop ) %] > <form id="existing_holds" name="T[% time | html %]" action="modrequest.pl" method="post" style="display:block"> > [% IF ( multi_hold ) %] > <input type = "hidden" name="biblionumbers" value="[% biblionumbers | html %]"/> > [% END %] >- > <h2>Existing holds</h2> > <div id="toolbar" class="btn-toolbar"> > <input type="submit" name="submit" value="Update hold(s)" /> >@@ -1460,6 +1467,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 6ab8ba7ac5..0dadec6ce6 100755 >--- a/reserve/request.pl >+++ b/reserve/request.pl >@@ -648,70 +648,75 @@ foreach my $biblionumber (@biblionumbers) { > > # 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 $priority = $res->priority(); >- my %reserve; >- my @optionloop; >- for ( my $i = 1 ; $i <= $totalcount ; $i++ ) { >- push( >- @optionloop, >- { >- num => $i, >- selected => ( $i == $priority ), >- } >- ); >- } >+ 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 $priority = $res->priority(); >+ my %reserve; >+ my @optionloop; >+ for ( my $i = 1 ; $i <= $totalcount ; $i++ ) { >+ push( >+ @optionloop, >+ { >+ num => $i, >+ selected => ( $i == $priority ), >+ } >+ ); >+ } > >- 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; >+ 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{'optionloop'} = \@optionloop; >- $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{'optionloop'} = \@optionloop; >+ $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.20.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