[Koha-patches] [PATCH] Fix for Bug 4138, Adding or deleting suggestions in the OPAC does not properly refresh the page
Owen Leonard
oleonard at myacpl.org
Mon Feb 8 18:35:26 CET 2010
- Using redirect() and adding URL parameter to enable the display of
messages on the screen confirming the action.
- Also correcting for JavaScript error in form validation routine.
---
.../prog/en/modules/opac-suggestions.tmpl | 6 +++++-
opac/opac-suggestions.pl | 9 +++++++--
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-suggestions.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-suggestions.tmpl
index 263e3ae..27019ea 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-suggestions.tmpl
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-suggestions.tmpl
@@ -52,7 +52,7 @@ $.tablesorter.addParser({
}
if (_alertString.length==0) {
- document.Aform.submit();
+ f.submit();
} else {
alertString2 = _("Form not submitted because of the following problem(s)\n");
alertString2 += "------------------------------------------------------------------------------------\n\n";
@@ -100,6 +100,10 @@ $.tablesorter.addParser({
<!-- TMPL_IF name="op_else" -->
<h1><!-- TMPL_UNLESS NAME="OPACViewOthersSuggestions" --><!-- TMPL_IF NAME="loggedinusername" -->My <!-- /TMPL_IF --><!-- /TMPL_UNLESS -->Purchase Suggestions</h1>
+
+ <!-- TMPL_IF NAME="deleted" --><div class="dialog message">The selected suggestions have been deleted.</div><!-- /TMPL_IF -->
+ <!-- TMPL_IF NAME="submitted" --><div class="dialog message">Your suggestion has been submitted.</div><!-- /TMPL_IF -->
+
<!-- TMPL_IF NAME="suggestions_loop" -->
<!-- TMPL_IF NAME="OPACViewOthersSuggestions" -->
<form action="/cgi-bin/koha/opac-suggestions.pl" method="get">
diff --git a/opac/opac-suggestions.pl b/opac/opac-suggestions.pl
index f22d06e..e11cd0b 100755
--- a/opac/opac-suggestions.pl
+++ b/opac/opac-suggestions.pl
@@ -35,7 +35,8 @@ delete $$suggestion{$_} foreach qw<op suggestedbyme>;
$op = 'else' unless $op;
my ( $template, $borrowernumber, $cookie );
-
+my $deleted = $input->param('deleted');
+my $submitted = $input->param('submitted');
if ( C4::Context->preference("AnonSuggestions") ) {
( $template, $borrowernumber, $cookie ) = get_template_and_user(
@@ -84,6 +85,8 @@ if ( $op eq "add_confirm" ) {
&SearchSuggestion( $suggestion );
}
$op = 'else';
+ print $input->redirect("/cgi-bin/koha/opac-suggestions.pl?op=else&submitted=1");
+ exit;
}
if ( $op eq "delete_confirm" ) {
@@ -92,6 +95,8 @@ if ( $op eq "delete_confirm" ) {
&DelSuggestion( $borrowernumber, $delete_field );
}
$op = 'else';
+ print $input->redirect("/cgi-bin/koha/opac-suggestions.pl?op=else&deleted=1");
+ exit;
}
map{ $_->{'branchcodesuggestedby'}=GetBranchInfo($_->{'branchcodesuggestedby'})->[0]->{'branchname'}} @$suggestions_loop;
my $supportlist=GetSupportList();
@@ -118,7 +123,7 @@ $template->param(
suggestions_loop => $suggestions_loop,
showall => $allsuggestions,
"op_$op" => 1,
- suggestionsview => 1
+ suggestionsview => 1,
);
--
1.6.3.3
More information about the Koha-patches
mailing list