[Koha-cvs] CVS: koha/C4/Circulation Circ2.pm,1.50,1.51

Paul POULAIN tipaul at users.sourceforge.net
Mon Mar 10 16:19:37 CET 2003


Update of /cvsroot/koha/koha/C4/Circulation
In directory sc8-pr-cvs1:/tmp/cvs-serv16934/C4/Circulation

Modified Files:
	Circ2.pm 
Log Message:


Index: Circ2.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Circulation/Circ2.pm,v
retrieving revision 1.50
retrieving revision 1.51
diff -C2 -r1.50 -r1.51
*** Circ2.pm	5 Feb 2003 07:55:42 -0000	1.50
--- Circ2.pm	10 Mar 2003 15:19:33 -0000	1.51
***************
*** 67,174 ****
  
  @ISA = qw(Exporter);
! @EXPORT = qw(&getbranches &getprinters &getpatroninformation
! 	&getbranch &getprinter
  	&currentissues &getissues &getiteminformation &findborrower
  	&issuebook &returnbook &find_reserves &transferbook &decode
  	&calc_charges);
  
! =item getbranches
! 
!   $branches = &getbranches();
!   @branch_codes = keys %$branches;
!   %main_branch_info = %{$branches->{"MAIN"}};
! 
! Returns information about existing library branches.
! 
! C<$branches> is a reference-to-hash. Its keys are the branch codes for
! all of the existing library branches, and its values are
! references-to-hash describing that particular branch.
! 
! In each branch description (C<%main_branch_info>, above), there is a
! key for each field in the branches table of the Koha database. In
! addition, there is a key for each branch category code to which the
! branch belongs (the category codes are taken from the branchrelations
! table).
! 
! =cut
! #'
! # FIXME - This function doesn't feel as if it belongs here. It should
! # go in some generic or administrative module, not in circulation.
! sub getbranches {
! # returns a reference to a hash of references to branches...
!     my %branches;
!     my $dbh = C4::Context->dbh;
!     my $sth=$dbh->prepare("select * from branches");
!     $sth->execute;
!     while (my $branch=$sth->fetchrow_hashref) {
! 	my $tmp = $branch->{'branchcode'}; my $brc = $dbh->quote($tmp);
! 		# FIXME - my $brc = $dbh->quote($branch->{"branchcode"});
! 	my $query = "select categorycode from branchrelations where branchcode = $brc";
! 	my $nsth = $dbh->prepare($query);
! 	$nsth->execute;
! 	while (my ($cat) = $nsth->fetchrow_array) {
! 	    # FIXME - This seems wrong. It ought to be
! 	    # $branch->{categorycodes}{$cat} = 1;
! 	    # otherwise, there's a namespace collision if there's a
! 	    # category with the same name as a field in the 'branches'
! 	    # table (i.e., don't create a category called "issuing").
! 	    # In addition, the current structure doesn't really allow
! 	    # you to list the categories that a branch belongs to:
! 	    # you'd have to list keys %$branch, and remove those keys
! 	    # that aren't fields in the "branches" table.
! 	    $branch->{$cat} = 1;
! 	}
! 	$nsth->finish;
! 	$branches{$branch->{'branchcode'}}=$branch;
!     }
!     return (\%branches);
! }
! 
! =item getprinters
! 
!   $printers = &getprinters($env);
!   @queues = keys %$printers;
! 
! Returns information about existing printer queues.
! 
! C<$env> is ignored.
! 
! C<$printers> is a reference-to-hash whose keys are the print queues
! defined in the printers table of the Koha database. The values are
! references-to-hash, whose keys are the fields in the printers table.
! 
! =cut
! #'
! # FIXME - Perhaps this really belongs in C4::Print?
! sub getprinters {
!     my ($env) = @_;
!     my %printers;
!     my $dbh = C4::Context->dbh;
!     my $sth=$dbh->prepare("select * from printers");
!     $sth->execute;
!     while (my $printer=$sth->fetchrow_hashref) {
! 	$printers{$printer->{'printqueue'}}=$printer;
!     }
!     return (\%printers);
! }
! 
! # FIXME - This function doesn't feel as if it belongs here. It should
! # go in some generic or administrative module, not in circulation.
! sub getbranch ($$) {
!     my($query, $branches) = @_; # get branch for this query from branches
!     my $branch = $query->param('branch');
!     ($branch) || ($branch = $query->cookie('branch'));
!     ($branches->{$branch}) || ($branch=(keys %$branches)[0]);
!     return $branch;
! }
! 
! # FIXME - Perhaps this really belongs in C4::Print?
! sub getprinter ($$) {
!     my($query, $printers) = @_; # get printer for this query from printers
!     my $printer = $query->param('printer');
!     ($printer) || ($printer = $query->cookie('printer'));
!     ($printers->{$printer}) || ($printer = (keys %$printers)[0]);
!     return $printer;
! }
  
  =item getpatroninformation
--- 67,76 ----
  
  @ISA = qw(Exporter);
! @EXPORT = qw(&getpatroninformation
  	&currentissues &getissues &getiteminformation &findborrower
  	&issuebook &returnbook &find_reserves &transferbook &decode
  	&calc_charges);
  
! # &getbranches &getprinters &getbranch &getprinter => moved to C4::Koha.pm
  
  =item getpatroninformation





More information about the Koha-cvs mailing list