From 00b4510a08023479dd07b8a1829a67031d7d7d75 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 Makes clicking a Delete link refresh the search that was performed so that the results are still on the screen. --- authorities/authorities-home.pl | 44 +++++++++++++------- .../en/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 d687c78..02684b3 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 038959f..ed841f6 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() { -- 1.7.2.5