koha-cvs
[Top][All Lists]
Advanced

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

[Koha-cvs] koha/C4/Circulation Circ2.pm [rel_3_0]


From: Antoine Farnault
Subject: [Koha-cvs] koha/C4/Circulation Circ2.pm [rel_3_0]
Date: Mon, 13 Nov 2006 11:07:26 +0000

CVSROOT:        /sources/koha
Module name:    koha
Branch:         rel_3_0
Changes by:     Antoine Farnault <toins>        06/11/13 11:07:26

Modified files:
        C4/Circulation : Circ2.pm 

Log message:
        New Function : GetIssuesFromBiblio
        This function is used to get easyly the issue list for a book given by 
its biblionumber.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Circulation/Circ2.pm?cvsroot=koha&only_with_tag=rel_3_0&r1=1.114.2.12&r2=1.114.2.13

Patches:
Index: Circ2.pm
===================================================================
RCS file: /sources/koha/koha/C4/Circulation/Circ2.pm,v
retrieving revision 1.114.2.12
retrieving revision 1.114.2.13
diff -u -b -r1.114.2.12 -r1.114.2.13
--- Circ2.pm    10 Nov 2006 09:43:17 -0000      1.114.2.12
+++ Circ2.pm    13 Nov 2006 11:07:26 -0000      1.114.2.13
@@ -3,7 +3,7 @@
 
 package C4::Circulation::Circ2;
 
-# $Id: Circ2.pm,v 1.114.2.12 2006/11/10 09:43:17 btoumi Exp $
+# $Id: Circ2.pm,v 1.114.2.13 2006/11/13 11:07:26 toins Exp $
 
 #package to deal with Returns
 #written 3/11/99 by address@hidden
@@ -45,7 +45,7 @@
 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
 
 # set the version for version checking
-$VERSION = do { my @v = '$Revision: 1.114.2.12 $' =~ /\d+/g; shift(@v) . "." . 
join( "_", map { sprintf "%03d", $_ } @v ); };
+$VERSION = do { my @v = '$Revision: 1.114.2.13 $' =~ /\d+/g; shift(@v) . "." . 
join( "_", map { sprintf "%03d", $_ } @v ); };
 
 =head1 NAME
 
@@ -96,6 +96,7 @@
         &GetOverduesForBranch
         &AddNotifyLine
         &RemoveNotifyLine
+        &GetIssuesFromBiblio
         );
 # &GetBranches &getprinters &getbranch &getprinter => moved to C4::Koha.pm
 
@@ -1755,11 +1756,44 @@
             # they're there for.
     }
     $sth->finish;
-    use Data::Dumper;
-    warn "currentissues==>".Dumper(\%currentissues);
     return(\%currentissues);
 }
 
+=head2 GetIssuesFromBiblio
+
+$issues = GetIssuesFromBiblio($biblionumber);
+
+this function get all issues from a biblionumer.
+
+Return:
+C<$issues> is a reference to array which each value is ref-to-hash. This 
ref-to-hash containts all column from
+tables issues and the firstname,surname & cardnumber from borrowers.
+
+=cut
+
+sub GetIssuesFromBiblio {
+    my $biblionumber = shift;
+    return undef unless $biblionumber;
+    my $dbh = C4::Context->dbh;
+    my $query = "
+        SELECT issues.*,biblio.biblionumber,biblio.title, 
biblio.author,borrowers.cardnumber,borrowers.surname,borrowers.firstname
+        FROM issues
+            LEFT JOIN items ON issues.itemnumber = items.itemnumber
+            LEFT JOIN biblio ON biblio.biblionumber = items.itemnumber
+            LEFT JOIN borrowers ON borrowers.borrowernumber = 
issues.borrowernumber
+        WHERE biblio.biblionumber = ?
+        ORDER BY issues.timestamp
+    ";
+    my $sth = $dbh->prepare($query);
+    $sth->execute($biblionumber);
+    
+    my @issues;
+    while(my $data = $sth->fetchrow_hashref){
+        push @issues,$data;
+    }
+    return address@hidden;
+}
+
 =head2 renewstatus
 
 $ok = &renewstatus($env, $dbh, $borrowernumber, $itemnumber);
@@ -2177,13 +2211,16 @@
 }
 
 sub GetReservesForBranch {
-    my($frombranch) = @_;
+    my ($frombranch) = @_;
     my $dbh = C4::Context->dbh;
-        my $sth=$dbh->prepare("SELECT 
borrowernumber,reservedate,itemnumber,waitingdate FROM
-    reserves 
-    where priority='0' AND cancellationdate is null 
+    my $sth=$dbh->prepare("
+        SELECT borrowernumber,reservedate,itemnumber,waitingdate
+        FROM   reserves 
+        WHERE   priority='0'
+            AND cancellationdate IS NULL 
     AND found='W' 
-    AND branchcode=? order by reservedate");
+            AND branchcode=?
+        ORDER BY reservedate");
     $sth->execute($frombranch);
     my @transreserv;
     my $i=0;




reply via email to

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