[Koha-cvs] koha/C4 Suggestions.pm [rel_3_0]

paul poulain paul at koha-fr.org
Wed Jan 24 14:52:38 CET 2007


CVSROOT:	/sources/koha
Module name:	koha
Branch:		rel_3_0
Changes by:	paul poulain <tipaul>	07/01/24 13:52:38

Modified files:
	C4             : Suggestions.pm 

Log message:
	bugfixes for suggestion management : handling suggestedbyme option as in 2.2 branch
	+ improving a SQL query, to return more useful infos

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Suggestions.pm?cvsroot=koha&only_with_tag=rel_3_0&r1=1.12.2.4&r2=1.12.2.5

Patches:
Index: Suggestions.pm
===================================================================
RCS file: /sources/koha/koha/C4/Suggestions.pm,v
retrieving revision 1.12.2.4
retrieving revision 1.12.2.5
diff -u -b -r1.12.2.4 -r1.12.2.5
--- Suggestions.pm	22 Dec 2006 17:07:44 -0000	1.12.2.4
+++ Suggestions.pm	24 Jan 2007 13:52:38 -0000	1.12.2.5
@@ -17,17 +17,18 @@
 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
 # Suite 330, Boston, MA  02111-1307 USA
 
-# $Id: Suggestions.pm,v 1.12.2.4 2006/12/22 17:07:44 hdl Exp $
+# $Id: Suggestions.pm,v 1.12.2.5 2007/01/24 13:52:38 tipaul Exp $
 
 use strict;
 require Exporter;
 use C4::Context;
 use C4::Output;
+use C4::Date;
 use Mail::Sendmail;
 use vars qw($VERSION @ISA @EXPORT);
 
 # set the version for version checking
-$VERSION = do { my @v = '$Revision: 1.12.2.4 $' =~ /\d+/g;
+$VERSION = do { my @v = '$Revision: 1.12.2.5 $' =~ /\d+/g;
   shift(@v) . "." . join("_", map {sprintf "%03d", $_ } @v); };
 
 =head1 NAME
@@ -111,11 +112,6 @@
         push @sql_params,"%".$publishercode."%";
         $query .= " and publishercode like ?";
     }
-    if ($status) {
-        push @sql_params,$status;
-        $query .= " and status=?";
-    }
-
     if (C4::Context->preference("IndependantBranches")) {
         my $userenv = C4::Context->userenv;
         if ($userenv) {
@@ -212,9 +208,14 @@
 sub GetSuggestionByStatus {
     my $status = shift;
     my $dbh = C4::Context->dbh;
-    my $query = "
-        SELECT *
+    my $query = "SELECT suggestions.*,
+                        U1.surname   AS surnamesuggestedby,
+                        U1.firstname AS firstnamesuggestedby,
+                        U2.surname   AS surnamemanagedby,
+                        U2.firstname AS firstnamemanagedby
         FROM suggestions
+                        LEFT JOIN borrowers AS U1 ON suggestedby=U1.borrowernumber
+                        LEFT JOIN borrowers AS U2 ON managedby=U2.borrowernumber
         WHERE status = ?
     ";
     my $sth = $dbh->prepare($query);
@@ -222,6 +223,7 @@
     
     my @results;
     while(my $data = $sth->fetchrow_hashref){
+        $data->{date} = format_date($data->{date});
         push @results,$data;
     }
     return \@results;





More information about the Koha-cvs mailing list