Displays the Branch name and Category description along with their codes in 
Suggestion Management.

Also since I joined to the branches table the 'map' function in 
opac-suggestions.pl to retrieve the branchname was no longer necessary.
---
 C4/Suggestions.pm                                  |   14 ++++++++++++--
 .../prog/en/modules/suggestion/acceptorreject.tmpl |    7 +++----
 .../prog/en/modules/opac-suggestions.tmpl          |    2 +-
 opac/opac-suggestions.pl                           |    1 -
 4 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/C4/Suggestions.pm b/C4/Suggestions.pm
index dceea5c..491739c 100644
--- a/C4/Suggestions.pm
+++ b/C4/Suggestions.pm
@@ -90,17 +90,23 @@ sub SearchSuggestion  {
     my $query = "
     SELECT suggestions.*,
         U1.branchcode   AS branchcodesuggestedby,
+        B1.branchname AS branchnamesuggestedby,
         U1.surname   AS surnamesuggestedby,
         U1.firstname AS firstnamesuggestedby,
         U1.borrowernumber AS borrnumsuggestedby,
         U1.categorycode AS categorycodesuggestedby,
+        C1.description AS categorydescriptionsuggestedby,
         U2.branchcode AS branchcodemanagedby,
+        B2.branchname AS branchnamemanagedby,
         U2.surname   AS surnamemanagedby,
         U2.firstname AS firstnamemanagedby,
         U2.borrowernumber AS borrnummanagedby
     FROM suggestions
     LEFT JOIN borrowers AS U1 ON suggestedby=U1.borrowernumber
     LEFT JOIN borrowers AS U2 ON managedby=U2.borrowernumber
+    LEFT JOIN categories AS C1 ON C1.categorycode = U1.categorycode
+    LEFT JOIN branches AS B1 ON B1.branchcode = U1.branchcode
+    LEFT JOIN branches AS B2 ON B2.branchcode = U2.branchcode
     WHERE 1=1 ";
 
     my @sql_params;
@@ -226,15 +232,19 @@ sub GetSuggestionByStatus {
     my $query = qq(SELECT suggestions.*,
                         U1.surname   AS surnamesuggestedby,
                         U1.firstname AS firstnamesuggestedby,
-            U1.branchcode AS branchcodesuggestedby,
+                        U1.branchcode AS branchcodesuggestedby,
+                        B1.branchname AS branchnamesuggestedby,
                        U1.borrowernumber AS borrnumsuggestedby,
                        U1.categorycode AS categorycodesuggestedby,
+                        C1.description AS categorydescriptionsuggestedby,
                         U2.surname   AS surnamemanagedby,
                         U2.firstname AS firstnamemanagedby,
-                                               U2.borrowernumber AS 
borrnummanagedby
+                        U2.borrowernumber AS borrnummanagedby
                         FROM suggestions
                         LEFT JOIN borrowers AS U1 ON 
suggestedby=U1.borrowernumber
                         LEFT JOIN borrowers AS U2 ON 
managedby=U2.borrowernumber
+                        LEFT JOIN categories AS C1 ON 
C1.categorycode=U1.categorycode
+                        LEFT JOIN branches AS B1 on B1.branchcode = 
U1.branchcode
                         WHERE status = ?);
     if (C4::Context->preference("IndependantBranches") || $branchcode) {
         my $userenv = C4::Context->userenv;
diff --git 
a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/acceptorreject.tmpl 
b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/acceptorreject.tmpl
index c3aa93d..6cc5cbe 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/acceptorreject.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/acceptorreject.tmpl
@@ -153,11 +153,10 @@
                         <!-- TMPL_IF name="isbn" -->; ISBN :<i><!-- TMPL_VAR 
name="isbn" --></i> <!-- /TMPL_IF --><!-- TMPL_IF name="publishercode" -->; 
Published by <!-- TMPL_VAR name="publishercode" --> <!-- /TMPL_IF --><!-- 
TMPL_IF name="publicationyear" --> in <i><!-- TMPL_VAR name="publicationyear" 
--></i> <!-- /TMPL_IF --><!-- TMPL_IF name="place" --> in <i><!-- TMPL_VAR 
name="place" --></i> <!-- /TMPL_IF --><br /></td>
                        <td><!-- TMPL_VAR NAME="note" --></td>
                 <td>
-                    <a 
href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR 
NAME="borrnumsuggestedby" -->"><!-- TMPL_VAR name="surnamesuggestedby" -->
-                    <!-- TMPL_IF name="firstnamesuggestedby" -->,<!-- /TMPL_IF 
-->
+                    <a 
href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR 
NAME="borrnumsuggestedby" -->"><!-- TMPL_VAR name="surnamesuggestedby" --><!-- 
TMPL_IF name="firstnamesuggestedby" -->,<!-- /TMPL_IF -->
                     <!-- TMPL_VAR name="firstnamesuggestedby" --></a><br />
-                    Branch: <!-- TMPL_VAR name="branchcodesuggestedby" --><br 
/>
-                    Category: <!-- TMPL_VAR name="categorycodesuggestedby" -->
+                    <!-- TMPL_VAR name="categorydescriptionsuggestedby" --> 
(<!-- TMPL_VAR name="categorycodesuggestedby" -->)<br />
+                    <!-- TMPL_VAR name="branchnamesuggestedby" --> (<!-- 
TMPL_VAR name="branchcodesuggestedby" -->)
                 </td>
                 <td>
                     <!-- TMPL_VAR name="date" -->
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 addc4ec..aaba1eb 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-suggestions.tmpl
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-suggestions.tmpl
@@ -131,7 +131,7 @@ $.tablesorter.addParser({
                     <!-- TMPL_VAR name="note" -->
                 </td>
                 <!-- TMPL_IF NAME="OPACViewOthersSuggestions" --><td>
-                    <!-- TMPL_IF NAME="branchcodesuggestedby" --><!-- TMPL_VAR 
name="branchcodesuggestedby" --><!-- TMPL_ELSE -->&nbsp;<!-- /TMPL_IF -->
+                    <!-- TMPL_IF NAME="branchnamesuggestedby" --><!-- TMPL_VAR 
name="branchnamesuggestedby" --><!-- TMPL_ELSE -->&nbsp;<!-- /TMPL_IF -->
                 </td><!-- /TMPL_IF -->
                 <td>
                                        <!-- TMPL_IF NAME="surnamemanagedby" 
--><!-- TMPL_VAR name="surnamemanagedby" --><!-- TMPL_IF 
name="firstnamemanagedby" -->,<!-- /TMPL_IF --> <!-- TMPL_VAR 
name="firstnamemanagedby" --><!-- TMPL_ELSE -->&nbsp;<!-- /TMPL_IF -->
diff --git a/opac/opac-suggestions.pl b/opac/opac-suggestions.pl
index 838cd05..a12826a 100755
--- a/opac/opac-suggestions.pl
+++ b/opac/opac-suggestions.pl
@@ -97,7 +97,6 @@ if ( $op eq "delete_confirm" ) {
 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) {
-- 
1.5.6.5

_______________________________________________
Koha-patches mailing list
[email protected]
http://lists.koha.org/mailman/listinfo/koha-patches

Reply via email to