[Koha-patches] [PATCH] Bug 1607: Fixes the delete checkboxes in purchase suggestions.
Garry Collum
gcollum at gmail.com
Wed Jul 29 23:09:17 CEST 2009
If a user views suggestions of another user, syspref (OPACViewOthersSuggestions), a selection check box for deletion appeared next to all of the suggested titles whether the logged-in user owned them or not. - fixed
Also fixes the "Clear all" and "Select all" links which appeared for anonymouse users, if AnonSuggestions is turned on.
---
.../prog/en/modules/opac-suggestions.tmpl | 6 ++++--
opac/opac-suggestions.pl | 9 +++++++++
2 files changed, 13 insertions(+), 2 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 aafe3b8..addc4ec 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-suggestions.tmpl
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-suggestions.tmpl
@@ -101,8 +101,8 @@ $.tablesorter.addParser({
</form><!-- /TMPL_IF -->
<form action="/cgi-bin/koha/opac-suggestions.pl" method="post">
<input type="hidden" name="op" value="delete_confirm" />
- <div><span class="checkall"><a href="#" id="CheckAll">Select All</a></span>
- <span class="clearall"><a href="#" id="CheckNone">Clear All</a></span> | <!-- TMPL_IF NAME="loggedinusername" --><a class="new" href="/cgi-bin/koha/opac-suggestions.pl?op=add">New purchase suggestion</a><!-- TMPL_ELSE --><!-- TMPL_IF NAME="AnonSuggestions" --><a class="new" href="/cgi-bin/koha/opac-suggestions.pl?op=add">New purchase suggestion</a><!-- /TMPL_IF --><!-- /TMPL_IF -->
+ <div><!-- TMPL_IF NAME="loggedinusername" --><span class="checkall"><a href="#" id="CheckAll">Select All</a></span>
+ <span class="clearall"><a href="#" id="CheckNone">Clear All</a></span> | <a class="new" href="/cgi-bin/koha/opac-suggestions.pl?op=add">New purchase suggestion</a><!-- TMPL_ELSE --><!-- TMPL_IF NAME="AnonSuggestions" --><a class="new" href="/cgi-bin/koha/opac-suggestions.pl?op=add">New purchase suggestion</a><!-- /TMPL_IF --><!-- /TMPL_IF -->
</div>
<table id="suggestt" class="checkboxed">
<thead><tr>
@@ -116,7 +116,9 @@ $.tablesorter.addParser({
<tbody><!-- TMPL_LOOP NAME="suggestions_loop" -->
<!-- TMPL_IF name="even" --><tr><!-- TMPL_ELSE --><tr class="highlight"><!-- /TMPL_IF -->
<!-- TMPL_IF NAME="loggedinusername" --><td>
+ <!-- TMPL_IF NAME="showcheckbox" -->
<input type="checkbox" name="delete_field" value="<!--TMPL_VAR name="suggestionid" -->" />
+ <!-- /TMPL_IF -->
</td><!-- /TMPL_IF -->
<td>
<p><strong><!-- TMPL_VAR NAME="title" escape="html" --></strong></p>
diff --git a/opac/opac-suggestions.pl b/opac/opac-suggestions.pl
index b739817..838cd05 100755
--- a/opac/opac-suggestions.pl
+++ b/opac/opac-suggestions.pl
@@ -98,6 +98,15 @@ my $suggestions_loop =
&SearchSuggestion( $borrowernumber, $author, $title, $publishercode, $status,
$suggestedbyme );
map{ $_->{'branchcodesuggestedby'}=GetBranchInfo($_->{'branchcodesuggestedby'})->[0]->{'branchname'}} @$suggestions_loop;
+
+foreach my $suggestion(@$suggestions_loop) {
+ if($suggestion->{'suggestedby'} == $borrowernumber) {
+ $suggestion->{'showcheckbox'} = $borrowernumber;
+ } else {
+ $suggestion->{'showcheckbox'} = 0;
+ }
+}
+
$template->param(
suggestions_loop => $suggestions_loop,
title => $title,
--
1.5.6.5
More information about the Koha-patches
mailing list