koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] CVS: koha/reports borrowers_out.pl,1.1.2.2,1.1.2.3


From: Henri-Damien LAURENT
Subject: [Koha-cvs] CVS: koha/reports borrowers_out.pl,1.1.2.2,1.1.2.3
Date: Mon, 30 May 2005 01:15:56 -0700

Update of /cvsroot/koha/koha/reports
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19944/reports

Modified Files:
      Tag: rel_2_2
        borrowers_out.pl 
Log Message:
FIXING : Splitting nested queries for Mysql4.0 compliance.

Index: borrowers_out.pl
===================================================================
RCS file: /cvsroot/koha/koha/reports/borrowers_out.pl,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -r1.1.2.2 -r1.1.2.3
*** borrowers_out.pl    26 May 2005 10:27:08 -0000      1.1.2.2
--- borrowers_out.pl    30 May 2005 08:15:52 -0000      1.1.2.3
***************
*** 230,245 ****
        my $strcalc ;
        
! # Processing average loanperiods
        $strcalc .= "SELECT CONCAT( borrowers.surname , 
\"\\t\",borrowers.firstname, \"\\t\", borrowers.cardnumber)";
        $strcalc .= " , $colfield " if ($colfield);
!       $strcalc .= " FROM borrowers LEFT JOIN ";
!       if (@$filters[1]){
!               $strcalc .= " (SELECT * FROM issues where issues.timestamp>" . 
$dbh->quote(@$filters[1]).")" ;
!       } else {
!               $strcalc .= "issues";
!       } 
!       $strcalc .= " AS filtered_issues ON  
filtered_issues.borrowernumber=borrowers.borrowernumber WHERE 
filtered_issues.borrowernumber is null";
        @$filters[0]=~ s/\*/%/g if (@$filters[0]);
        $strcalc .= " AND borrowers.categorycode like '" . @$filters[0] ."'" if 
( @$filters[0] );
        $strcalc .= " group by borrowers.borrowernumber";
        $strcalc .= ", $colfield" if ($column);
--- 230,253 ----
        my $strcalc ;
        
! # Processing calculation
        $strcalc .= "SELECT CONCAT( borrowers.surname , 
\"\\t\",borrowers.firstname, \"\\t\", borrowers.cardnumber)";
        $strcalc .= " , $colfield " if ($colfield);
!       $strcalc .= " FROM borrowers ";
!       $strcalc .= "WHERE 1 ";
        @$filters[0]=~ s/\*/%/g if (@$filters[0]);
        $strcalc .= " AND borrowers.categorycode like '" . @$filters[0] ."'" if 
( @$filters[0] );
+       if (@$filters[1]){
+               my $queryfilter = $dbh->prepare("SELECT DISTINCT borrowernumber 
FROM issues where issues.timestamp>?");
+               $queryfilter->execute(@$filters[1]);
+               while (my ($bornum)=$queryfilter->fetchrow){
+                       $strcalc .= " AND borrowers.borrowernumber <> $bornum ";
+               }
+       } else {
+               my $queryfilter = $dbh->prepare("SELECT DISTINCT borrowernumber 
FROM issues ");
+               $queryfilter->execute;
+               while (my ($bornum)=$queryfilter->fetchrow){
+                       $strcalc .= " AND borrowers.borrowernumber <> $bornum ";
+               }
+       }
        $strcalc .= " group by borrowers.borrowernumber";
        $strcalc .= ", $colfield" if ($column);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]