[Koha-cvs] CVS: koha/C4/Circulation Circ2.pm,1.46,1.47

Steve Tonnesen tonnesen at users.sourceforge.net
Thu Oct 24 20:30:20 CEST 2002


Update of /cvsroot/koha/koha/C4/Circulation
In directory usw-pr-cvs1:/tmp/cvs-serv2389/C4/Circulation

Modified Files:
	Circ2.pm 
Log Message:
Merging changes from rel-1-2 into trunk (circulation module only)


Index: Circ2.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Circulation/Circ2.pm,v
retrieving revision 1.46
retrieving revision 1.47
diff -C2 -r1.46 -r1.47
*** Circ2.pm	13 Oct 2002 11:36:46 -0000	1.46
--- Circ2.pm	24 Oct 2002 18:30:17 -0000	1.47
***************
*** 6,10 ****
  #written 3/11/99 by olwen at katipo.co.nz
  
- # $Id$
  
  # Copyright 2000-2002 Katipo Communications
--- 6,9 ----
***************
*** 248,255 ****
      $sth->execute;
      my $borrower = $sth->fetchrow_hashref;
      my $flags = patronflags($env, $borrower, $dbh);
      $sth->finish;
      $borrower->{'flags'}=$flags;
!     return($borrower, $flags);
  }
  
--- 247,265 ----
      $sth->execute;
      my $borrower = $sth->fetchrow_hashref;
+     my $amount = checkaccount($env, $borrowernumber, $dbh);
+     $borrower->{'amountoutstanding'} = $amount;
      my $flags = patronflags($env, $borrower, $dbh);
+     my $accessflagshash;
+ 
+     $sth=$dbh->prepare("select bit,flag from userflags");
+     $sth->execute;
+     while (my ($bit, $flag) = $sth->fetchrow) {
+ 	if ($borrower->{'flags'} & 2**$bit) {
+ 	    $accessflagshash->{$flag}=1;
+ 	}
+     }
      $sth->finish;
      $borrower->{'flags'}=$flags;
!     return ($borrower, $flags, $accessflagshash);
  }
  
***************
*** 724,728 ****
  	}
  	if ($iteminformation->{'notforloan'} == 1) {
! 	    $rejected="Reference item: not for loan.";
  	    last SWITCH;
  	}
--- 734,738 ----
  	}
  	if ($iteminformation->{'notforloan'} == 1) {
! 	    $rejected="Item not for loan.";
  	    last SWITCH;
  	}
***************
*** 735,740 ****
  	    last SWITCH;
  	}
! 
! 	# See who, if anyone, currently has this book.
  	my ($currentborrower) = currentborrower($iteminformation->{'itemnumber'});
  	if ($currentborrower eq $patroninformation->{'borrowernumber'}) {
--- 745,752 ----
  	    last SWITCH;
  	}
! 	if ($iteminformation->{'itemtype'} eq 'REF') {
! 	    $rejected="Reference item:  Not for loan.";
! 	    last SWITCH;
! 	}
  	my ($currentborrower) = currentborrower($iteminformation->{'itemnumber'});
  	if ($currentborrower eq $patroninformation->{'borrowernumber'}) {
***************
*** 1013,1016 ****
--- 1025,1029 ----
      my ($resfound, $resrec) = CheckReserves($iteminformation->{'itemnumber'});
      if ($resfound) {
+ 	my $tobrcd = ReserveWaiting($resrec->{'itemnumber'}, $resrec->{'borrowernumber'});
  	$resrec->{'ResFound'} = $resfound;
  	$messages->{'ResFound'} = $resrec;
***************
*** 1486,1504 ****
      my $dbh = C4::Context->dbh;
      my $borrowernumber = $borrower->{'borrowernumber'};
-     my $brn =$dbh->quote($borrowernumber);
      my %currentissues;
!     my $select = "select issues.timestamp, issues.date_due, items.biblionumber,
!                          items.barcode, biblio.title, biblio.author, biblioitems.dewey,
!                          biblioitems.subclass
!                     from issues,items,biblioitems,biblio
!                    where issues.borrowernumber = $brn
!                      and issues.itemnumber = items.itemnumber
!                      and items.biblionumber = biblio.biblionumber
!                      and items.biblioitemnumber = biblioitems.biblioitemnumber
!                      and issues.returndate is null
!                          order by issues.date_due";
! #    warn $select;
      my $sth=$dbh->prepare($select);
!     $sth->execute;
      my $counter = 0;
      while (my $data = $sth->fetchrow_hashref) {
--- 1499,1524 ----
      my $dbh = C4::Context->dbh;
      my $borrowernumber = $borrower->{'borrowernumber'};
      my %currentissues;
!     my $select = "SELECT issues.timestamp      AS timestamp, 
!                          issues.date_due       AS date_due, 
!                          items.biblionumber    AS biblionumber,
!                          items.itemnumber    AS itemnumber,
!                          items.barcode         AS barcode, 
!                          biblio.title          AS title, 
!                          biblio.author         AS author, 
!                          biblioitems.dewey     AS dewey, 
!                          itemtypes.description AS itemtype,
!                          biblioitems.subclass  AS subclass
!                     FROM issues,items,biblioitems,biblio, itemtypes
!                    WHERE issues.borrowernumber  = ?
!                      AND issues.itemnumber      = items.itemnumber 
!                      AND items.biblionumber     = biblio.biblionumber 
!                      AND items.biblioitemnumber = biblioitems.biblioitemnumber 
!                      AND itemtypes.itemtype     = biblioitems.itemtype
!                      AND issues.returndate      IS NULL
!                 ORDER BY issues.date_due";
! #    print $select;
      my $sth=$dbh->prepare($select);
!     $sth->execute($borrowernumber);
      my $counter = 0;
      while (my $data = $sth->fetchrow_hashref) {
***************
*** 1559,1574 ****
    #check accounts and list amounts owing
    my ($env,$bornumber,$dbh,$date)=@_;
!   my $select="Select sum(amountoutstanding) from accountlines where
!   borrowernumber=$bornumber and amountoutstanding<>0";
    if ($date ne ''){
!     $select.=" and date < '$date'";
    }
  #  print $select;
    my $sth=$dbh->prepare($select);
    $sth->execute;
!   my $total=0;
!   while (my $data=$sth->fetchrow_hashref){
!     $total += $data->{'sum(amountoutstanding)'};
!   }
    $sth->finish;
    # output(1,2,"borrower owes $total");
--- 1579,1594 ----
    #check accounts and list amounts owing
    my ($env,$bornumber,$dbh,$date)=@_;
!   my $select="SELECT SUM(amountoutstanding) AS total
!                 FROM accountlines 
!                WHERE borrowernumber = $bornumber 
!                  AND amountoutstanding<>0";
    if ($date ne ''){
!     $select.=" AND date < '$date'";
    }
  #  print $select;
    my $sth=$dbh->prepare($select);
    $sth->execute;
!   my $data=$sth->fetchrow_hashref;
!   my $total = $data->{'total'};
    $sth->finish;
    # output(1,2,"borrower owes $total");
***************
*** 1702,1706 ****
      $sth1->finish;
  #    close FILE;
!     return ($charge);
  }
  
--- 1722,1726 ----
      $sth1->finish;
  #    close FILE;
!     return ($charge, $itemtype);
  }
  





More information about the Koha-cvs mailing list