Bugzilla – Attachment 107933 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), 6.58 KB, created by
Nick Clemens (kidclamp)
on 2020-08-07 00:43:55 UTC
(
hide
)
Description:
Bug 5428: Jump back to the search result after deleting a record
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2020-08-07 00:43:55 UTC
Size:
6.58 KB
patch
obsolete
>From 94505756f3c57dfab4ac2818989b89902fe4a88a 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 > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > catalogue/search.pl | 4 ++-- > cataloguing/addbiblio.pl | 2 +- > koha-tmpl/intranet-tmpl/js/browser.js | 10 ++++++++++ > koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt | 10 ++++++++++ > koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt | 1 + > koha-tmpl/intranet-tmpl/prog/js/catalog.js | 4 ++-- > 6 files changed, 26 insertions(+), 5 deletions(-) > >diff --git a/catalogue/search.pl b/catalogue/search.pl >index 1fd012d8df..6876499fc8 100755 >--- a/catalogue/search.pl >+++ b/catalogue/search.pl >@@ -241,6 +241,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' ) { > >@@ -691,8 +693,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/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl >index 7d48842c6a..ab101a4208 100755 >--- a/cataloguing/addbiblio.pl >+++ b/cataloguing/addbiblio.pl >@@ -925,7 +925,7 @@ elsif ( $op eq "delete" ) { > exit; > } > >- print $input->redirect('/cgi-bin/koha/catalogue/search.pl'); >+ print $input->redirect('/cgi-bin/koha/catalogue/search.pl' . ($searchid ? "?searchid=$searchid" : "")); > exit; > > } else { >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.11.0
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