Bug 1607: Fixes the delete checkboxes in purchase suggestions.

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.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
This commit is contained in:
Garry Collum 2009-07-29 17:09:17 -04:00 committed by Galen Charlton
parent b36269ea85
commit 3a058fcc9d
2 changed files with 13 additions and 2 deletions

View file

@ -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>

View file

@ -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,