From 1000599eaa8c3b3ec17af6e406be34d1430242c0 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Thu, 5 Jul 2012 10:33:40 -0400 Subject: [PATCH] Bug 4198 - deleting an authority refreshes the page MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Makes clicking a Delete link refresh the search that was performed so that the results are still on the screen. Signed-off-by: Frédéric Demians Works as advertised. Very usefull. Still the issue that indexing being not in real time, the search result displays the just deleted authority. But there is no way to do better. --- authorities/authorities-home.pl | 44 ++++++++++++------- .../modules/authorities/searchresultlist.tt | 4 +- 2 files changed, 32 insertions(+), 16 deletions(-) diff --git a/authorities/authorities-home.pl b/authorities/authorities-home.pl index d687c78033..fde4bf9ad5 100755 --- a/authorities/authorities-home.pl +++ b/authorities/authorities-home.pl @@ -54,6 +54,21 @@ foreach my $thisauthtype ( sort { $authtypes->{$a}{'authtypetext'} cmp $authtype push @authtypesloop, \%row; } +if ( $op eq "delete" ) { + ( $template, $loggedinuser, $cookie ) = get_template_and_user( + { + template_name => "authorities/authorities-home.tmpl", + query => $query, + type => 'intranet', + authnotrequired => 0, + flagsrequired => { catalogue => 1 }, + debug => 1, + } + ); + &DelAuthority( $authid, 1 ); + + $op = "do_search"; +} if ( $op eq "do_search" ) { my @marclist = $query->param('marclist'); my @and_or = $query->param('and_or'); @@ -69,7 +84,7 @@ if ( $op eq "do_search" ) { SearchAuthorities( \@marclist, \@and_or, \@excluding, \@operator, \@value, ( $startfrom - 1 ) * $resultsperpage, $resultsperpage, $authtypecode, $orderby ); -# use Data::Dumper; warn Data::Dumper::Dumper(@$results); + ( $template, $loggedinuser, $cookie ) = get_template_and_user( { template_name => "authorities/searchresultlist.tmpl", @@ -81,6 +96,18 @@ if ( $op eq "do_search" ) { } ); + $template->param( + marclist => $query->param('marclist'), + and_or => $query->param('and_or'), + excluding => $query->param('excluding'), + operator => $query->param('operator'), + orderby => $query->param('orderby'), + value => $query->param('value'), + authtypecode => $query->param('authtypecode'), + startfrom => $startfrom, + resultsperpage => $resultsperpage, + ); + my @field_data = (); # we must get parameters once again. Because if there is a mainentry, it @@ -146,20 +173,7 @@ if ( $op eq "do_search" ) { ); } -elsif ( $op eq "delete" ) { - ( $template, $loggedinuser, $cookie ) = get_template_and_user( - { - template_name => "authorities/authorities-home.tmpl", - query => $query, - type => 'intranet', - authnotrequired => 0, - flagsrequired => { catalogue => 1 }, - debug => 1, - } - ); - &DelAuthority( $authid, 1 ); -} -else { +if ( $op eq '' ) { ( $template, $loggedinuser, $cookie ) = get_template_and_user( { template_name => "authorities/authorities-home.tmpl", diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist.tt index 038959fec9..6ac139aa4d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist.tt @@ -8,7 +8,9 @@ function confirm_deletion(id) { var is_confirmed = confirm('Are you sure you want to delete this authority?'); if (is_confirmed) { - window.location="authorities-home.pl?op=delete&authid="+id; + window.location="authorities-home.pl?op=delete&authid=" + + id + + "&marclist=[% marclist %]&and_or=[% and_or %]&excluding=[% excluding %]&operator=[%operator%]&orderby=[% orderby %]&value=[% value %]&startfrom=[% startfrom %]&resultsperpage=[% resultsperpage %]"; } } function Help() { -- 2.39.5