Browse Source

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>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
20.11.x
Jonathan Druart 4 years ago
parent
commit
2bb09975bc
  1. 4
      catalogue/search.pl
  2. 2
      cataloguing/addbiblio.pl
  3. 10
      koha-tmpl/intranet-tmpl/js/browser.js
  4. 10
      koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt
  5. 1
      koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt
  6. 4
      koha-tmpl/intranet-tmpl/prog/js/catalog.js

4
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;

2
cataloguing/addbiblio.pl

@ -927,7 +927,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 {

10
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;
};

10
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 %]

1
koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt

@ -1219,6 +1219,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();

4
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&amp;biblionumber=" + biblionumber;
window.location="/cgi-bin/koha/cataloguing/addbiblio.pl?op=delete&amp;biblionumber=" + biblionumber + (searchid ? "&amp;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&amp;biblionumber=" + biblionumber;
window.location="/cgi-bin/koha/cataloguing/additem.pl?op=delallitems&amp;biblionumber=" + biblionumber + (searchid ? "&amp;searchid="+searchid : "");
} else {
return false;
}

Loading…
Cancel
Save