Bug 1607: Fixes the delete checkboxes in purchase suggestions.
authorGarry Collum <gcollum@gmail.com>
Wed, 29 Jul 2009 21:09:17 +0000 (17:09 -0400)
committerGalen Charlton <galen.charlton@liblime.com>
Thu, 30 Jul 2009 02:34:26 +0000 (22:34 -0400)
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>
koha-tmpl/opac-tmpl/prog/en/modules/opac-suggestions.tmpl
opac/opac-suggestions.pl

index aafe3b8..addc4ec 100644 (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>
index b739817..838cd05 100755 (executable)
@@ -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,