Bugzilla – Attachment 107753 Details for
Bug 5428
Back to results after deleting a record
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 5428: Jump back to the search result after deleting a record
Bug-5428-Jump-back-to-the-search-result-after-dele.patch (text/plain), 5.92 KB, created by
Jonathan Druart
on 2020-08-04 12:41:13 UTC
(
hide
)
Description:
Bug 5428: Jump back to the search result after deleting a record
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-08-04 12:41:13 UTC
Size:
5.92 KB
patch
obsolete
>From 490dc16ea1e9cddb9b714406f4feddce55befe0d Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 4 Aug 2020 14:36:38 +0200 >Subject: [PATCH] Bug 5428: Jump back to the search result after deleting a > record > >This patch adds the ability to jump back to the search result after a >record has been deleted. >Also it keeps the "browser" when all items are deleted from a >bibliographic record > >Test plan: >- Start a new search >- Select a record with items >- Delete all the items >=> You still see the browser >- Delete the record >=> You are back to the adv search form but we new link "Go back to the >results" is present at the top of the page > >Limitation: As we delete the record we do not longer know the offset, >we are back to the first page of the result list >--- > catalogue/search.pl | 4 ++-- > koha-tmpl/intranet-tmpl/js/browser.js | 10 ++++++++++ > .../prog/en/modules/catalogue/advsearch.tt | 10 ++++++++++ > .../intranet-tmpl/prog/en/modules/catalogue/detail.tt | 1 + > koha-tmpl/intranet-tmpl/prog/js/catalog.js | 4 ++-- > 5 files changed, 25 insertions(+), 4 deletions(-) > >diff --git a/catalogue/search.pl b/catalogue/search.pl >index 6e5d929413..ccbfe7c3fa 100755 >--- a/catalogue/search.pl >+++ b/catalogue/search.pl >@@ -287,6 +287,8 @@ my $types = C4::Context->preference("AdvancedSearchTypes") || "itemtypes"; > my $advancedsearchesloop = prepare_adv_search_types($types); > $template->param(advancedsearchesloop => $advancedsearchesloop); > >+$template->param( searchid => scalar $cgi->param('searchid'), ); >+ > # The following should only be loaded if we're bringing up the advanced search template > if ( $template_type eq 'advsearch' ) { > >@@ -737,8 +739,6 @@ for (my $i=0;$i<@servers;$i++) { > } #/end of the for loop > #$template->param(FEDERATED_RESULTS => \@results_array); > >-$template->{'VARS'}->{'searchid'} = $cgi->param('searchid'); >- > my $gotonumber = $cgi->param('gotoNumber'); > if ( $gotonumber && ( $gotonumber eq 'last' || $gotonumber eq 'first' ) ) { > $template->{'VARS'}->{'gotoNumber'} = $gotonumber; >diff --git a/koha-tmpl/intranet-tmpl/js/browser.js b/koha-tmpl/intranet-tmpl/js/browser.js >index 120d710a2c..66a15d1e70 100644 >--- a/koha-tmpl/intranet-tmpl/js/browser.js >+++ b/koha-tmpl/intranet-tmpl/js/browser.js >@@ -109,5 +109,15 @@ KOHA.browser = function (searchid, biblionumber) { > } > }; > >+ me.show_back_link = function () { >+ if (current_search) { >+ $(document).ready(function () { >+ var searchURL = '/cgi-bin/koha/catalogue/search.pl?' + decodeURIComponent(current_search.query) + '&limit=' + decodeURIComponent(current_search.limit) + '&sort_by=' + current_search.sort + '&searchid=' + me.searchid; >+ $('#previous_search_link').replaceWith('<div><div class="browse-label"><a href="' + searchURL + '"><i class="fa fa-list"></i> ' + __("Go back to the results") + '</a></div></div>'); >+ }); >+ } >+ }; >+ >+ > return me; > }; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt >index 9eb252d68b..8c555441e1 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt >@@ -40,6 +40,9 @@ > <h1>Advanced search</h1> > <p> > <a href="/cgi-bin/koha/catalogue/itemsearch.pl">Go to item search</a> >+ [% IF searchid %] >+ <div id="previous_search_link"></div> >+ [% END %] > </p> > > <!-- SEARCH BUTTONS --> >@@ -296,6 +299,7 @@ > > [% MACRO jsinclude BLOCK %] > [% Asset.js("lib/hc-sticky.js") | $raw %] >+ [% Asset.js("js/browser.js") | $raw %] > <script> > /** > * Function add_field(); >@@ -324,6 +328,12 @@ > document.getElementById("categoryloop").disabled=false; > } > }); >+ >+ [% IF searchid %] >+ browser = KOHA.browser('[% searchid | html %]'); >+ browser.show_back_link(); >+ [% END %] >+ > }); > </script> > [% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >index 8903ec5b66..2caade090a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >@@ -1217,6 +1217,7 @@ Note that permanent location is a code, and location may be an authval. > [% Asset.js("js/browser.js") | $raw %] > [% Asset.js("js/table_filters.js") | $raw %] > <script> >+ var searchid = '[% searchid | html %]'; > var browser; > browser = KOHA.browser('[% searchid | html %]', parseInt(biblionumber, 10)); > browser.show(); >diff --git a/koha-tmpl/intranet-tmpl/prog/js/catalog.js b/koha-tmpl/intranet-tmpl/prog/js/catalog.js >index 8aeafc27f5..96adfbe93b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/catalog.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/catalog.js >@@ -44,7 +44,7 @@ function confirm_deletion(link) { > } > if (is_confirmed) { > $("#deletebiblio").unbind('click'); >- window.location="/cgi-bin/koha/cataloguing/addbiblio.pl?op=delete&biblionumber=" + biblionumber; >+ window.location="/cgi-bin/koha/cataloguing/addbiblio.pl?op=delete&biblionumber=" + biblionumber + (searchid ? "&searchid="+searchid : ""); > } else { > return false; > } >@@ -59,7 +59,7 @@ function confirm_items_deletion() { > alert( MSG_DELETE_ALL_HOLDS.format(holdcount) ); > } else if ( count > 0 ) { > if( confirm( CONFIRM_DELETE_ITEMS.format(count) ) ) { >- window.location="/cgi-bin/koha/cataloguing/additem.pl?op=delallitems&biblionumber=" + biblionumber; >+ window.location="/cgi-bin/koha/cataloguing/additem.pl?op=delallitems&biblionumber=" + biblionumber + (searchid ? "&searchid="+searchid : ""); > } else { > return false; > } >-- >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 5428
:
107753
|
107866
|
107868
|
107933
|
107934
|
108096
|
108099