HUGE COMMIT : code cleaning circulation.

some stuff to do, i'll write a mail on koha-devel NOW !
This commit is contained in:
tipaul 2007-04-04 16:46:22 +00:00
parent d23c6c9955
commit c596d55374
65 changed files with 804 additions and 3500 deletions

View File

@ -24,7 +24,7 @@ require Exporter;
use C4::Context;
use C4::Stats;
use C4::Members;
#use C4::Circulation::Circ2;
#use C4::Circulation;
use vars qw($VERSION @ISA @EXPORT);
# set the version for version checking
@ -55,7 +55,7 @@ patron.
=head2 checkaccount
$owed = &checkaccount($env, $borrowernumber, $dbh, $date);
$owed = &checkaccount($borrowernumber, $dbh, $date);
Looks up the total amount of money owed by a borrower (fines, etc.).
@ -71,7 +71,7 @@ C<$env> is ignored.
sub checkaccount {
#take borrower number
#check accounts and list amounts owing
my ($env,$borrowernumber,$dbh,$date)=@_;
my ($borrowernumber,$dbh,$date)=@_;
my $select="SELECT SUM(amountoutstanding) AS total
FROM accountlines
WHERE borrowernumber = ?
@ -126,7 +126,7 @@ sub recordpayment{
warn $branch;
my $amountleft = $data;
# begin transaction
my $nextaccntno = getnextacctno($env,$borrowernumber,$dbh);
my $nextaccntno = getnextacctno($borrowernumber);
# get lines with outstanding amounts to offset
my $sth = $dbh->prepare("select * from accountlines
where (borrowernumber = ?) and (amountoutstanding<>0)
@ -189,7 +189,7 @@ sub makepayment{
$env{'branchcode'}=$branch;
my $dbh = C4::Context->dbh;
# begin transaction
my $nextaccntno = getnextacctno(\%env,$borrowernumber,$dbh);
my $nextaccntno = getnextacctno($borrowernumber);
my $newamtos=0;
my $sth=$dbh->prepare("Select * from accountlines where borrowernumber=? and accountno=?");
$sth->execute($borrowernumber,$accountno);
@ -234,7 +234,7 @@ EOT
=head2 getnextacctno
$nextacct = &getnextacctno($env, $borrowernumber, $dbh);
$nextacct = &getnextacctno($borrowernumber);
Returns the next unused account number for the patron with the given
borrower number.
@ -248,11 +248,12 @@ C<$env> is ignored.
#'
# FIXME - Okay, so what does the above actually _mean_?
sub getnextacctno {
my ($env,$borrowernumber,$dbh)=@_;
my ($borrowernumber)=@_;
my $nextaccntno = 1;
my $sth = $dbh->prepare("select * from accountlines
where (borrowernumber = ?)
order by accountno desc");
my $dbh = C4::Context->dbh;
my $sth = $dbh->prepare("SELECT * FROM accountlines
WHERE (borrowernumber = ?)
ORDER BY accountno DESC");
$sth->execute($borrowernumber);
if (my $accdata=$sth->fetchrow_hashref){
$nextaccntno = $accdata->{'accountno'} + 1;
@ -330,7 +331,7 @@ sub manualinvoice{
my $insert;
$itemnum=~ s/ //g;
my %env;
my $accountno=getnextacctno('',$borrowernumber,$dbh);
my $accountno=getnextacctno($borrowernumber);
my $amountleft=$amount;
if ($type eq 'CS' || $type eq 'CB' || $type eq 'CW'
@ -395,8 +396,8 @@ sub fixcredit{
my $accdata = "";
my $amountleft = $data;
if ($barcode ne ''){
my $item=getiteminformation('',$barcode);
my $nextaccntno = getnextacctno($env,$borrowernumber,$dbh);
my $item=GetBiblioFromItemNumber('',$barcode);
my $nextaccntno = getnextacctno($borrowernumber);
my $query="Select * from accountlines where (borrowernumber=?
and itemnumber=? and amountoutstanding > 0)";
if ($type eq 'CL'){
@ -431,7 +432,7 @@ sub fixcredit{
$usth->finish;
}
# begin transaction
my $nextaccntno = getnextacctno($env,$borrowernumber,$dbh);
my $nextaccntno = getnextacctno($borrowernumber);
# get lines with outstanding amounts to offset
my $sth = $dbh->prepare("select * from accountlines
where (borrowernumber = ?) and (amountoutstanding >0)
@ -483,7 +484,7 @@ sub refund{
my $amountleft = $data *-1;
# begin transaction
my $nextaccntno = getnextacctno($env,$borrowernumber,$dbh);
my $nextaccntno = getnextacctno($borrowernumber);
# get lines with outstanding amounts to offset
my $sth = $dbh->prepare("select * from accountlines
where (borrowernumber = ?) and (amountoutstanding<0)

View File

@ -27,7 +27,7 @@ require Exporter;
use C4::Context;
use C4::Output; # to get the template
use C4::Interface::CGI::Output;
use C4::Circulation::Circ2; # getpatroninformation
use C4::Members;
use C4::Koha;
use C4::Branch; # GetBranches
@ -130,7 +130,7 @@ sub get_template_and_user {
$borrowernumber = getborrowernumber($user);
my ( $borr, $alternativeflags ) =
getpatroninformation( undef, $borrowernumber );
GetMemberDetails( $borrowernumber );
my @bordat;
$bordat[0] = $borr;
$template->param( "USER_INFO" => \@bordat );

View File

@ -27,7 +27,6 @@ require Exporter;
use C4::Context;
use C4::Output; # to get the template
use C4::Interface::CGI::Output;
use C4::Circulation::Circ2; # getpatroninformation
use C4::Members;
# use Net::LDAP;
@ -136,7 +135,7 @@ sub get_template_and_user {
$borrowernumber = getborrowernumber($user);
my ( $borr, $alternativeflags ) =
getpatroninformation( undef, $borrowernumber );
GetMemberDetails( $borrowernumber );
my @bordat;
$bordat[0] = $borr;
$template->param( USER_INFO => \@bordat, );

View File

@ -52,9 +52,12 @@ push @EXPORT, qw(
&GetBiblioFromItemNumber
&GetMarcItem
&GetItem
&GetItemInfosOf
&GetItemStatus
&GetItemLocation
&GetLostItems
&GetItemsForInventory
&GetMarcNotes
&GetMarcSubjects
@ -82,6 +85,7 @@ push @EXPORT, qw(
&ModZebra
&ModItemInMarc
&ModItemInMarconefield
&ModDateLastSeen
);
# To delete something
@ -501,6 +505,24 @@ sub ModItemInMarc {
ModZebra($biblionumber,"specialUpdate","biblioserver");
}
=head2 ModDateLastSeen
&ModDateLastSeen($itemnum)
Mark item as seen. Is called when an item is issued, returned or manually marked during inventory/stocktaking
C<$itemnum> is the item number
=cut
sub ModDateLastSeen {
my ($itemnum) = @_;
my $dbh = C4::Context->dbh;
my $sth =
$dbh->prepare(
"update items set itemlost=0, datelastseen = now() where items.itemnumber = ?"
);
$sth->execute($itemnum);
return;
}
=head2 DelBiblio
=over
@ -970,6 +992,114 @@ sub GetItemLocation {
return \%itemlocation;
}
=head2 GetLostItems
$items = GetLostItems($where,$orderby);
This function get the items lost into C<$items>.
=over 2
=item input:
C<$where> is a hashref. it containts a field of the items table as key
and the value to match as value.
C<$orderby> is a field of the items table.
=item return:
C<$items> is a reference to an array full of hasref which keys are items' table column.
=item usage in the perl script:
my %where;
$where{barcode} = 0001548;
my $items = GetLostItems( \%where, "homebranch" );
$template->param(itemsloop => $items);
=back
=cut
sub GetLostItems {
# Getting input args.
my $where = shift;
my $orderby = shift;
my $dbh = C4::Context->dbh;
my $query = "
SELECT *
FROM items
WHERE itemlost IS NOT NULL
AND itemlost <> 0
";
foreach my $key (keys %$where) {
$query .= " AND " . $key . " LIKE '%" . $where->{$key} . "%'";
}
$query .= " ORDER BY ".$orderby if defined $orderby;
my $sth = $dbh->prepare($query);
$sth->execute;
my @items;
while ( my $row = $sth->fetchrow_hashref ){
push @items, $row;
}
return \@items;
}
=head2 GetItemsForInventory
$itemlist = GetItemsForInventory($minlocation,$maxlocation,$datelastseen,$offset,$size)
Retrieve a list of title/authors/barcode/callnumber, for biblio inventory.
The sub returns a list of hashes, containing itemnumber, author, title, barcode & item callnumber.
It is ordered by callnumber,title.
The minlocation & maxlocation parameters are used to specify a range of item callnumbers
the datelastseen can be used to specify that you want to see items not seen since a past date only.
offset & size can be used to retrieve only a part of the whole listing (defaut behaviour)
=cut
sub GetItemsForInventory {
my ( $minlocation, $maxlocation, $datelastseen, $branch, $offset, $size ) = @_;
my $dbh = C4::Context->dbh;
my $sth;
if ($datelastseen) {
my $query =
"SELECT itemnumber,barcode,itemcallnumber,title,author,datelastseen
FROM items
LEFT JOIN biblio ON items.biblionumber=biblio.biblionumber
WHERE itemcallnumber>= ?
AND itemcallnumber <=?
AND (datelastseen< ? OR datelastseen IS NULL)";
$query.= " AND items.homebranch=".$dbh->quote($branch) if $branch;
$query .= " ORDER BY itemcallnumber,title";
$sth = $dbh->prepare($query);
$sth->execute( $minlocation, $maxlocation, $datelastseen );
}
else {
my $query ="
SELECT itemnumber,barcode,itemcallnumber,title,author,datelastseen
FROM items
LEFT JOIN biblio ON items.biblionumber=biblio.biblionumber
WHERE itemcallnumber>= ?
AND itemcallnumber <=?";
$query.= " AND items.homebranch=".$dbh->quote($branch) if $branch;
$query .= " ORDER BY itemcallnumber,title";
$sth = $dbh->prepare($query);
$sth->execute( $minlocation, $maxlocation );
}
my @results;
while ( my $row = $sth->fetchrow_hashref ) {
$offset-- if ($offset);
if ( ( !$offset ) && $size ) {
push @results, $row;
$size--;
}
}
return \@results;
}
=head2 &GetBiblioItemData
=over 4
@ -1110,6 +1240,39 @@ sub GetBiblio {
return ( $count, @results );
} # sub GetBiblio
=head2 GetItem
=over 4
$data = &GetItem($itemnumber,$barcode);
return Item information, for a given itemnumber or barcode
=back
=cut
sub GetItem {
my ($itemnumber,$barcode) = @_;
my $dbh = C4::Context->dbh;
if ($itemnumber) {
my $sth = $dbh->prepare("
SELECT * FROM items
WHERE itemnumber = ?");
$sth->execute($itemnumber);
my $data = $sth->fetchrow_hashref;
return $data;
} else {
my $sth = $dbh->prepare("
SELECT * FROM items
WHERE barcode = ?"
);
$sth->execute($barcode);
my $data = $sth->fetchrow_hashref;
return $data;
}
} # sub GetItem
=head2 get_itemnumbers_of
=over 4
@ -1445,6 +1608,8 @@ sub GetMarcItem {
return $newrecord;
}
=head2 GetMarcNotes
=over 4
@ -3489,6 +3654,11 @@ Joshua Ferraro jmf@liblime.com
# $Id$
# $Log$
# Revision 1.195 2007/04/04 16:46:22 tipaul
# HUGE COMMIT : code cleaning circulation.
#
# some stuff to do, i'll write a mail on koha-devel NOW !
#
# Revision 1.194 2007/03/30 12:00:42 tipaul
# why the hell do we need to explicitly utf8 decode this string ? I really don't know, but it seems it's mandatory, otherwise, tag descriptions are not properly encoded...
#

View File

@ -25,7 +25,7 @@ package C4::BookShelves;
use strict;
require Exporter;
use C4::Context;
use C4::Circulation::Circ2;
use C4::Circulation;
use vars qw($VERSION @ISA @EXPORT);
# set the version for version checking
@ -161,7 +161,7 @@ Looks up information about the contents of virtual bookshelf number
C<$shelfnumber>.
Returns a reference-to-array, whose elements are references-to-hash,
as returned by C<C4::Circ2::getiteminformation>.
as returned by C<C4::Biblio::GetBiblioFromItemNumber>.
=cut
@ -422,6 +422,11 @@ C4::Circulation::Circ2(3)
#
# $Log$
# Revision 1.21 2007/04/04 16:46:22 tipaul
# HUGE COMMIT : code cleaning circulation.
#
# some stuff to do, i'll write a mail on koha-devel NOW !
#
# Revision 1.20 2007/03/09 14:31:47 tipaul
# rel_3_0 moved to HEAD
#

File diff suppressed because it is too large Load Diff

View File

@ -38,7 +38,7 @@ C4::Circulation::Fines - Koha module dealing with fines
=head1 SYNOPSIS
use C4::Circulation::Fines;
use C4::Overdues;
=head1 DESCRIPTION
@ -439,11 +439,11 @@ sub UpdateFine {
# $sth3->finish;
# $accountno[0]++;
# begin transaction
my $nextaccntno = getnextacctno(undef,$borrowernumber,$dbh);
my $nextaccntno = getnextacctno($borrowernumber);
my $sth2 = $dbh->prepare(
"Insert into accountlines
"INSERT INTO accountlines
(borrowernumber,itemnumber,date,amount,
description,accounttype,amountoutstanding,accountno) values
description,accounttype,amountoutstanding,accountno) VALUES
(?,?,now(),?,?,'FU',?,?)"
);
$sth2->execute( $borrowernumber, $itemnum, $amount,
@ -764,11 +764,11 @@ C<$level> contains the file level
sub CreateItemAccountLine {
my ($borrowernumber,$itemnumber,$date,$amount,$description,$accounttype,$amountoutstanding,$timestamp,$notify_id,$level)=@_;
my $dbh = C4::Context->dbh;
my $nextaccntno = getnextacctno(undef,$borrowernumber,$dbh);
my $query= qq|INSERT into accountlines
my $nextaccntno = getnextacctno($borrowernumber);
my $query= "INSERT into accountlines
(borrowernumber,accountno,itemnumber,date,amount,description,accounttype,amountoutstanding,timestamp,notify_id,notify_level)
VALUES
(?,?,?,?,?,?,?,?,?,?,?)|;
(?,?,?,?,?,?,?,?,?,?,?)";
my $sth=$dbh->prepare($query);

View File

@ -31,6 +31,7 @@ $VERSION = 0.01;
&get_date_format_string_for_DHTMLcalendar
&format_date
&format_date_in_iso
&fixdate
);
@ -183,4 +184,56 @@ sub check_whether_iso
return 1 if (length($olddate[0])==4 && length($olddate[1])<=2 && length($olddate[2])<=2);
return 0;
}
=head2 fixdate
( $date, $invalidduedate ) = fixdate( $year, $month, $day );
=cut
sub fixdate {
my ( $year, $month, $day ) = @_;
my $invalidduedate;
my $date;
if ( $year && $month && $day ) {
if ( ( $year eq 0 ) && ( $month eq 0 ) && ( $year eq 0 ) ) {
# $env{'datedue'}='';
}
else {
if ( ( $year eq 0 ) || ( $month eq 0 ) || ( $year eq 0 ) ) {
$invalidduedate = 1;
}
else {
if (
( $day > 30 )
&& ( ( $month == 4 )
|| ( $month == 6 )
|| ( $month == 9 )
|| ( $month == 11 ) )
)
{
$invalidduedate = 1;
}
elsif ( ( $day > 29 ) && ( $month == 2 ) ) {
$invalidduedate = 1;
}
elsif (
( $month == 2 )
&& ( $day > 28 )
&& ( ( $year % 4 )
&& ( ( !( $year % 100 ) || ( $year % 400 ) ) ) )
)
{
$invalidduedate = 1;
}
else {
$date = "$year-$month-$day";
}
}
}
}
return ( $date, $invalidduedate );
}
1;

View File

@ -26,6 +26,9 @@ use C4::Date;
use Digest::MD5 qw(md5_base64);
use Date::Calc qw/Today Add_Delta_YM/;
use C4::Log; # logaction
use C4::Accounts;
use C4::Overdues;
use C4::Reserves2;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
@ -52,7 +55,7 @@ This module contains routines for adding, modifying and deleting members/patrons
@ISA = qw(Exporter);
@EXPORT = qw(
&BornameSearch &GetMember
&BornameSearch &GetMember &GetMemberDetails
&borrdata &borrdata2
&fixup_cardnumber &findguarantees &findguarantor &GuarantornameSearch
&modmember &newmember &changepassword &borrissues &allissues
@ -236,6 +239,256 @@ sub GetMember {
return undef;
}
=head2 GetMemberDetails
($borrower, $flags) = &GetMemberDetails($borrowernumber, $cardnumber);
Looks up a patron and returns information about him or her. If
C<$borrowernumber> is true (nonzero), C<&GetMemberDetails> looks
up the borrower by number; otherwise, it looks up the borrower by card
number.
C<$env> is effectively ignored, but should be a reference-to-hash.
C<$borrower> is a reference-to-hash whose keys are the fields of the
borrowers table in the Koha database. In addition,
C<$borrower-E<gt>{flags}> is a hash giving more detailed information
about the patron. Its keys act as flags :
if $borrower->{flags}->{LOST} {
# Patron's card was reported lost
}
Each flag has a C<message> key, giving a human-readable explanation of
the flag. If the state of a flag means that the patron should not be
allowed to borrow any more books, then it will have a C<noissues> key
with a true value.
The possible flags are:
=head3 CHARGES
=over 4
=item Shows the patron's credit or debt, if any.
=back
=head3 GNA
=over 4
=item (Gone, no address.) Set if the patron has left without giving a
forwarding address.
=back
=head3 LOST
=over 4
=item Set if the patron's card has been reported as lost.
=back
=head3 DBARRED
=over 4
=item Set if the patron has been debarred.
=back
=head3 NOTES
=over 4
=item Any additional notes about the patron.
=back
=head3 ODUES
=over 4
=item Set if the patron has overdue items. This flag has several keys:
C<$flags-E<gt>{ODUES}{itemlist}> is a reference-to-array listing the
overdue items. Its elements are references-to-hash, each describing an
overdue item. The keys are selected fields from the issues, biblio,
biblioitems, and items tables of the Koha database.
C<$flags-E<gt>{ODUES}{itemlist}> is a string giving a text listing of
the overdue items, one per line.
=back
=head3 WAITING
=over 4
=item Set if any items that the patron has reserved are available.
C<$flags-E<gt>{WAITING}{itemlist}> is a reference-to-array listing the
available items. Each element is a reference-to-hash whose keys are
fields from the reserves table of the Koha database.
=back
=cut
sub GetMemberDetails {
my ( $borrowernumber, $cardnumber ) = @_;
my $dbh = C4::Context->dbh;
my $query;
my $sth;
if ($borrowernumber) {
$sth = $dbh->prepare("select * from borrowers where borrowernumber=?");
$sth->execute($borrowernumber);
}
elsif ($cardnumber) {
$sth = $dbh->prepare("select * from borrowers where cardnumber=?");
$sth->execute($cardnumber);
}
else {
return undef;
}
my $borrower = $sth->fetchrow_hashref;
my $amount = C4::Accounts::checkaccount( $borrowernumber, $dbh );
$borrower->{'amountoutstanding'} = $amount;
my $flags = patronflags( $borrower, $dbh );
my $accessflagshash;
$sth = $dbh->prepare("select bit,flag from userflags");
$sth->execute;
while ( my ( $bit, $flag ) = $sth->fetchrow ) {
if ( $borrower->{'flags'} && $borrower->{'flags'} & 2**$bit ) {
$accessflagshash->{$flag} = 1;
}
}
$sth->finish;
$borrower->{'flags'} = $flags;
$borrower->{'authflags'} = $accessflagshash;
# find out how long the membership lasts
$sth =
$dbh->prepare(
"select enrolmentperiod from categories where categorycode = ?");
$sth->execute( $borrower->{'categorycode'} );
my $enrolment = $sth->fetchrow;
$borrower->{'enrolmentperiod'} = $enrolment;
return ($borrower); #, $flags, $accessflagshash);
}
=head2 patronflags
Not exported
NOTE!: If you change this function, be sure to update the POD for
&GetMemberDetails.
$flags = &patronflags($env, $patron, $dbh);
$flags->{CHARGES}
{message} Message showing patron's credit or debt
{noissues} Set if patron owes >$5.00
{GNA} Set if patron gone w/o address
{message} "Borrower has no valid address"
{noissues} Set.
{LOST} Set if patron's card reported lost
{message} Message to this effect
{noissues} Set.
{DBARRED} Set is patron is debarred
{message} Message to this effect
{noissues} Set.
{NOTES} Set if patron has notes
{message} Notes about patron
{ODUES} Set if patron has overdue books
{message} "Yes"
{itemlist} ref-to-array: list of overdue books
{itemlisttext} Text list of overdue items
{WAITING} Set if there are items available that the
patron reserved
{message} Message to this effect
{itemlist} ref-to-array: list of available items
=cut
sub patronflags {
my %flags;
my ( $patroninformation, $dbh ) = @_;
my $amount =
C4::Accounts::checkaccount( $patroninformation->{'borrowernumber'}, $dbh );
if ( $amount > 0 ) {
my %flaginfo;
my $noissuescharge = C4::Context->preference("noissuescharge");
$flaginfo{'message'} = sprintf "Patron owes \$%.02f", $amount;
if ( $amount > $noissuescharge ) {
$flaginfo{'noissues'} = 1;
}
$flags{'CHARGES'} = \%flaginfo;
}
elsif ( $amount < 0 ) {
my %flaginfo;
$flaginfo{'message'} = sprintf "Patron has credit of \$%.02f", -$amount;
$flags{'CHARGES'} = \%flaginfo;
}
if ( $patroninformation->{'gonenoaddress'}
&& $patroninformation->{'gonenoaddress'} == 1 )
{
my %flaginfo;
$flaginfo{'message'} = 'Borrower has no valid address.';
$flaginfo{'noissues'} = 1;
$flags{'GNA'} = \%flaginfo;
}
if ( $patroninformation->{'lost'} && $patroninformation->{'lost'} == 1 ) {
my %flaginfo;
$flaginfo{'message'} = 'Borrower\'s card reported lost.';
$flaginfo{'noissues'} = 1;
$flags{'LOST'} = \%flaginfo;
}
if ( $patroninformation->{'debarred'}
&& $patroninformation->{'debarred'} == 1 )
{
my %flaginfo;
$flaginfo{'message'} = 'Borrower is Debarred.';
$flaginfo{'noissues'} = 1;
$flags{'DBARRED'} = \%flaginfo;
}
if ( $patroninformation->{'borrowernotes'}
&& $patroninformation->{'borrowernotes'} )
{
my %flaginfo;
$flaginfo{'message'} = "$patroninformation->{'borrowernotes'}";
$flags{'NOTES'} = \%flaginfo;
}
my ( $odues, $itemsoverdue ) =
checkoverdues( $patroninformation->{'borrowernumber'}, $dbh );
if ( $odues > 0 ) {
my %flaginfo;
$flaginfo{'message'} = "Yes";
$flaginfo{'itemlist'} = $itemsoverdue;
foreach ( sort { $a->{'date_due'} cmp $b->{'date_due'} }
@$itemsoverdue )
{
$flaginfo{'itemlisttext'} .=
"$_->{'date_due'} $_->{'barcode'} $_->{'title'} \n";
}
$flags{'ODUES'} = \%flaginfo;
}
my $itemswaiting =
C4::Reserves2::GetWaitingReserves( $patroninformation->{'borrowernumber'} );
my $nowaiting = scalar @$itemswaiting;
if ( $nowaiting > 0 ) {
my %flaginfo;
$flaginfo{'message'} = "Reserved items available";
$flaginfo{'itemlist'} = $itemswaiting;
$flags{'WAITING'} = \%flaginfo;
}
return ( \%flags );
}
=item borrdata
$borrower = &borrdata($cardnumber, $borrowernumber);

View File

@ -23,7 +23,7 @@ use strict;
require Exporter;
use C4::Context;
use C4::Circulation::Circ2;
use C4::Circulation;
use vars qw($VERSION @ISA @EXPORT);
@ -65,12 +65,12 @@ queue to print to; if it is empty or has the special value C<nulllp>,
C<&remoteprint> will print to the file F</tmp/kohaiss>.
C<$borrower> is a reference-to-hash giving information about a patron.
This may be gotten from C<&getpatroninformation>. The patron's name
This may be gotten from C<&GetMemberDetails>. The patron's name
will be printed in the output.
C<$items> is a reference-to-list, where each element is a
reference-to-hash describing a borrowed item. C<$items> may be gotten
from C<&currentissues>.
from C<&GetBorrowerIssues>.
=cut
@ -197,12 +197,12 @@ EOF
#'
sub printslip {
my ( $env, $borrowernumber ) = @_;
my ( $borrower, $flags ) = getpatroninformation( $env, $borrowernumber, 0 );
my ( $borrower, $flags ) = GetMemberDetails( $borrowernumber);
$env->{'todaysissues'} = 1;
my ($borrowerissues) = currentissues( $env, $borrower );
my ($borrowerissues) = GetBorrowerIssues( $borrower );
$env->{'nottodaysissues'} = 1;
$env->{'todaysissues'} = 0;
my ($borroweriss2) = currentissues( $env, $borrower );
my ($borroweriss2) = GetBorrowerIssues( $borrower );
$env->{'nottodaysissues'} = 0;
my $i = 0;
my @issues;

View File

@ -27,7 +27,7 @@ require Exporter;
use C4::Context;
use C4::Biblio;
use C4::Search;
use C4::Circulation::Circ2;
use C4::Circulation;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
my $library_name = C4::Context->preference("LibraryName");
@ -75,6 +75,8 @@ this modules provides somes functions to deal with reservations.
&CountReservesFromBorrower
&FixPriority
&FindReservesInQueue
GetReservesForBranch
GetReservesToBranch
);
# make all your functions, whether exported or not;
@ -87,7 +89,6 @@ this modules provides somes functions to deal with reservations.
=cut
#'
sub GlobalCancel {
my $messages;
my $nextreservinfo;
@ -117,7 +118,7 @@ sub OtherReserves {
my $nextreservinfo;
my ( $restype, $checkreserves ) = CheckReserves($itemnumber);
if ($checkreserves) {
my $iteminfo = C4::Circulation::Circ2::getiteminformation($itemnumber,undef);
my $iteminfo = GetItem($itemnumber);
if ( $iteminfo->{'holdingbranch'} ne $checkreserves->{'branchcode'} ) {
$messages->{'transfert'} = $checkreserves->{'branchcode'};
#minus priorities of others reservs
@ -167,37 +168,37 @@ sub MinusPriority {
#first step update the value of the first person on reserv
my $dbh = C4::Context->dbh;
my $query = qq/
my $query = "
UPDATE reserves
SET priority = 0 , itemnumber = ?
WHERE cancellationdate IS NULL
AND borrowernumber=?
AND biblionumber=?
/;
";
my $sth_upd = $dbh->prepare($query);
$sth_upd->execute( $itemnumber, $borrowernumber, $biblionumber );
$sth_upd->finish;
# second step update all others reservs
$query = qq/
$query = "
SELECT priority,borrowernumber,biblionumber,reservedate
FROM reserves
WHERE priority !='0'
AND biblionumber = ?
AND cancellationdate IS NULL
/;
";
my $sth_oth = $dbh->prepare($query);
$sth_oth->execute($biblionumber);
while ( my ( $priority, $borrowernumber, $biblionumber, $reservedate ) =
$sth_oth->fetchrow_array )
{
$priority--;
$query = qq/
$query = "
UPDATE reserves
SET priority = ?
WHERE biblionumber = ?
AND borrowernumber = ?
AND reservedate = ?
/;
";
my $sth_upd_oth = $dbh->prepare($query);
$sth_upd_oth->execute( $priority, $biblionumber, $borrowernumber,
$reservedate );
@ -219,13 +220,13 @@ sub SetWaitingStatus {
#first : check if we have a reservation for this item .
my ($itemnumber) = @_;
my $dbh = C4::Context->dbh;
my $query = qq/
my $query = "
SELECT priority,borrowernumber
FROM reserves
WHERE itemnumber=?
AND cancellationdate IS NULL
AND found IS NULL AND priority='0'
/;
";
my $sth_find = $dbh->prepare($query);
$sth_find->execute($itemnumber);
my ( $priority, $borrowernumber ) = $sth_find->fetchrow_array;
@ -233,13 +234,13 @@ sub SetWaitingStatus {
return unless $borrowernumber;
# step 2 : if we have a borrowernumber, we update the value found to 'W' to notify the borrower
$query = qq/
$query = "
UPDATE reserves
SET found='W',waitingdate = now()
WHERE borrowernumber=?
AND itemnumber=?
AND found IS NULL
/;
";
my $sth_set = $dbh->prepare($query);
$sth_set->execute( $borrowernumber, $itemnumber );
$sth_set->finish;
@ -258,13 +259,13 @@ sub GetReservations {
my ( $itemnumber, $borrowernumber ) = @_;
if ($itemnumber) {
my $dbh = C4::Context->dbh;
my $query = qq/
my $query = "
SELECT reservedate,borrowernumber
FROM reserves
WHERE itemnumber=?
AND cancellationdate IS NULL
AND (found <> 'F' OR found IS NULL)
/;
";
my $sth_res = $dbh->prepare($query);
$sth_res->execute($itemnumber);
my ( $reservedate, $borrowernumber ) = $sth_res->fetchrow_array;
@ -272,14 +273,14 @@ sub GetReservations {
}
if ($borrowernumber) {
my $dbh = C4::Context->dbh;
my $query = qq/
my $query = "
SELECT *
FROM reserves
WHERE borrowernumber=?
AND cancellationdate IS NULL
AND (found != 'F' or found is null)
ORDER BY reservedate
/;
";
my $sth_find = $dbh->prepare($query);
$sth_find->execute($borrowernumber);
@ -324,7 +325,7 @@ sub FindReserves {
my @bind;
# Find the desired items in the reserves
my $query = qq/
my $query = "
SELECT branchcode,
timestamp AS rtimestamp,
priority,
@ -337,7 +338,7 @@ sub FindReserves {
FROM reserves
WHERE cancellationdate IS NULL
AND (found <> \'F\' OR found IS NULL)
/;
";
if ( $biblionumber ne '' ) {
$query .= '
@ -511,25 +512,25 @@ sub CheckReserves {
if ($item) {
my $qitem = $dbh->quote($item);
# Look up the item by itemnumber
my $query = qq(
my $query = "
SELECT items.biblionumber, items.biblioitemnumber, itemtypes.notforloan
FROM items, biblioitems, itemtypes
WHERE items.biblioitemnumber = biblioitems.biblioitemnumber
AND biblioitems.itemtype = itemtypes.itemtype
AND itemnumber=$qitem
);
";
$sth = $dbh->prepare($query);
}
else {
my $qbc = $dbh->quote($barcode);
# Look up the item by barcode
my $query = qq(
my $query = "
SELECT items.biblionumber, items.biblioitemnumber, itemtypes.notforloan
FROM items, biblioitems, itemtypes
WHERE items.biblioitemnumber = biblioitems.biblioitemnumber
AND biblioitems.itemtype = itemtypes.itemtype
AND barcode=$qbc
);
";
$sth = $dbh->prepare($query);
# FIXME - This function uses $item later on. Ought to set it here.
@ -611,14 +612,14 @@ sub CancelReserve {
if ( ( $item and $borr ) and ( not $biblio ) ) {
# removing a waiting reserve record....
# update the database...
my $query = qq/
my $query = "
UPDATE reserves
SET cancellationdate = now(),
found = Null,
priority = 0
WHERE itemnumber = ?
AND borrowernumber = ?
/;
";
my $sth = $dbh->prepare($query);
$sth->execute( $item, $borr );
$sth->finish;
@ -844,17 +845,17 @@ sub ReserveWaiting {
# update reserves record....
if ($diffBranchSend) {
$query = qq/
$query = "
UPDATE reserves
SET priority = 0,
itemnumber = ?
WHERE borrowernumber = ?
AND biblionumber = ?
AND timestamp = ?
/;
";
}
else {
$query = qq/
$query = "
UPDATE reserves
SET priority = 0,
found = 'W',
@ -863,7 +864,7 @@ sub ReserveWaiting {
WHERE borrowernumber = ?
AND biblionumber = ?
AND timestamp = ?
/;
";
}
$sth = $dbh->prepare($query);
$sth->execute( $item, $borr, $biblio, $timestamp );
@ -889,13 +890,13 @@ sub GetWaitingReserves {
my ($borr) = @_;
my $dbh = C4::Context->dbh;
my @itemswaiting;
my $query = qq/
my $query = "
SELECT *
FROM reserves
WHERE borrowernumber = ?
AND reserves.found = 'W'
AND cancellationdate IS NULL
/;
";
my $sth = $dbh->prepare($query);
$sth->execute($borr);
while ( my $data = $sth->fetchrow_hashref ) {
@ -1002,7 +1003,7 @@ sub CreateReserve {
#eval {
# updates take place here
if ( $fee > 0 ) {
my $nextacctno = &getnextacctno( $env, $borrowernumber, $dbh );
my $nextacctno = &getnextacctno( $borrowernumber );
my $query = qq/
INSERT INTO accountlines
(borrowernumber,accountno,date,amount,description,accounttype,amountoutstanding)
@ -1383,6 +1384,63 @@ sub FindReservesInQueue {
return ( $#results + 1, \@results );
}
=head2 GetReservesToBranch
@transreserv = GetReservesToBranch( $frombranch, $excludingbranch );
=cut
sub GetReservesToBranch {
my ( $frombranch, $excludingbranch ) = @_;
my $dbh = C4::Context->dbh;
my $sth = $dbh->prepare(
"SELECT borrowernumber,reservedate,itemnumber,timestamp
FROM reserves
WHERE priority='0' AND cancellationdate is null
AND branchcode=?
AND branchcode!=?
AND found IS NULL "
);
$sth->execute( $frombranch, $excludingbranch );
my @transreserv;
my $i = 0;
while ( my $data = $sth->fetchrow_hashref ) {
$transreserv[$i] = $data;
$i++;
}
$sth->finish;
return (@transreserv);
}
=head2 GetReservesForBranch
@transreserv = GetReservesForBranch($frombranch);
=cut
sub GetReservesForBranch {
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
AND found='W'
AND branchcode=?
ORDER BY waitingdate" );
$sth->execute($frombranch);
my @transreserv;
my $i = 0;
while ( my $data = $sth->fetchrow_hashref ) {
$transreserv[$i] = $data;
$i++;
}
$sth->finish;
return (@transreserv);
}
=back
=head1 AUTHOR

View File

@ -60,7 +60,7 @@ use C4::Biblio;
use CGI;
use C4::Output;
use C4::BookShelves;
use C4::Circulation::Circ2;
use C4::Circulation;
use C4::Auth;
use C4::Interface::CGI::Output;
@ -122,6 +122,11 @@ if ($shelfnumber || ($shelfnumber == -1)) { # the shelf already exist.
}
# $Log$
# Revision 1.7 2007/04/04 16:46:22 tipaul
# HUGE COMMIT : code cleaning circulation.
#
# some stuff to do, i'll write a mail on koha-devel NOW !
#
# Revision 1.6 2007/03/09 14:32:26 tipaul
# rel_3_0 moved to HEAD
#

View File

@ -67,7 +67,7 @@ use strict;
use CGI;
use C4::Output;
use C4::BookShelves;
use C4::Circulation::Circ2;
use C4::Biblio;
use C4::Auth;
use C4::Interface::CGI::Output;
@ -86,7 +86,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
if ( $query->param('modifyshelfcontents') ) {
my $shelfnumber = $query->param('viewshelf');
my $barcode = $query->param('addbarcode');
my ($item) = getiteminformation( 0, $barcode );
my ($item) = GetItem( 0, $barcode );
if ( ShelfPossibleAction( $loggedinuser, $shelfnumber, 'manage' ) ) {
AddToShelf( $item->{'itemnumber'}, $shelfnumber );
foreach ( $query->param ) {
@ -281,6 +281,11 @@ sub shelves {
#
# $Log$
# Revision 1.12 2007/04/04 16:46:22 tipaul
# HUGE COMMIT : code cleaning circulation.
#
# some stuff to do, i'll write a mail on koha-devel NOW !
#
# Revision 1.11 2007/03/09 14:32:26 tipaul
# rel_3_0 moved to HEAD
#

View File

@ -23,7 +23,7 @@ use CGI;
use C4::Auth;
use C4::Interface::CGI::Output;
use C4::Circulation::Circ2; # GetIssuesFromBiblio
use C4::Circulation; # GetBiblioIssues
my $query = new CGI;
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
@ -43,7 +43,7 @@ my $biblionumber = $params->{'biblionumber'};
my $title = $params->{'title'};
my $author = $params->{'author'};
my $issues = GetIssuesFromBiblio($biblionumber);
my $issues = GetBiblioIssues($biblionumber);
my $total = scalar @$issues;
if ( $total && !$title ) {

View File

@ -29,7 +29,7 @@ use C4::Output; # contains gettemplate
use C4::Auth;
use C4::Interface::CGI::Output;
use C4::Date;
use C4::Circulation::Circ2; # to use itemissues
use C4::Circulation; # to use itemissues
my $query=new CGI;

View File

@ -25,7 +25,7 @@
use strict;
use CGI;
use C4::Context;
use C4::Circulation::Circ2;
use C4::Circulation;
use C4::Output;
use C4::Koha;
use C4::Auth;

View File

@ -23,7 +23,7 @@ use CGI;
use C4::Interface::CGI::Output;
use C4::Auth;
use C4::Date;
use C4::Circulation::Circ2; # AddNotifyLine
use C4::Overdues; # AddNotifyLine
use C4::Koha; # GetDepartment...
use Mail::Sendmail;
use Getopt::Long;

View File

@ -26,7 +26,7 @@ use CGI;
use C4::Branch; # GetBranchName
use C4::Auth;
use C4::Date;
use C4::Circulation::Circ2;
use C4::Circulation;
use Date::Calc qw(
Today
@ -77,8 +77,8 @@ if ($item) {
# if we have a result
if ($nextreservinfo) {
my $borrowerinfo = getpatroninformation( \%env, $nextreservinfo );
my $iteminfo = C4::Circulation::Circ2::getiteminformation($item);
my $borrowerinfo = GetMemberDetails( $nextreservinfo );
my $iteminfo = GetBiblioFromItemNumber($item);
if ( $messages->{'transfert'} ) {
my $branchname = GetBranchName( $messages->{'transfert'} );
$template->param(
@ -114,8 +114,8 @@ my @getreserves = GetReservesForBranch($default);
foreach my $num (@getreserves) {
my %getreserv;
my %env;
my $gettitle = getiteminformation( $num->{'itemnumber'} );
my $getborrower = getpatroninformation( \%env, $num->{'borrowernumber'} );
my $gettitle = GetBiblioFromItemNumber( $num->{'itemnumber'} );
my $getborrower = GetMemberDetails( $num->{'borrowernumber'} );
my $itemtypeinfo = getitemtypeinfo( $gettitle->{'itemtype'} );
$getreserv{'waitingdate'} = format_date( $num->{'waitingdate'} );

View File

@ -23,7 +23,7 @@
use strict;
use CGI;
use C4::Circulation::Circ2;
use C4::Circulation;
use C4::Output;
use C4::Reserves2;
use C4::Auth;
@ -157,7 +157,7 @@ foreach ( $query->param ) {
$item{barcode} = $bc;
$item{frombrcd} = $frbcd;
$item{tobrcd} = $tobcd;
my ($iteminformation) = getiteminformation( 0, $bc );
my ($iteminformation) = GetBiblioFromItemNumer( 0, $bc );
$item{'biblionumber'} = $iteminformation->{'biblionumber'};
$item{'title'} = $iteminformation->{'title'};
$item{'author'} = $iteminformation->{'author'};
@ -193,7 +193,7 @@ my $wastransferred;
if ($found) {
my $res = $messages->{'ResFound'};
$branchname = $branches->{ $res->{'branchcode'} }->{'branchname'};
my ($borr) = getpatroninformation( \%env, $res->{'borrowernumber'}, 0 );
my ($borr) = GetMemberDetails( $res->{'borrowernumber'}, 0 );
$title = $borr->{'title'};
$surname = $borr->{'surname'};
$firstname = $borr->{'firstname'};
@ -243,7 +243,7 @@ foreach my $code ( keys %$messages ) {
$err{errwasreturned} = 1;
$allmessages = 1;
my ($borrowerinfo) =
getpatroninformation( \%env, $messages->{'WasReturned'}, 0 );
GetMemberDetails( $messages->{'WasReturned'}, 0 );
$title = $borrowerinfo->{'title'};
$surname = $borrowerinfo->{'surname'};
$firstname = $borrowerinfo->{'firstname'};

View File

@ -24,11 +24,10 @@
use strict;
use CGI;
use C4::Circulation::Circ2;
use C4::Members;
use C4::Output;
use C4::Print;
use C4::Auth;
use C4::Date;
use C4::Interface::CGI::Output;
use C4::Branch; # GetBranches
use C4::Koha; # GetPrinter
@ -40,9 +39,10 @@ use Date::Calc qw(
Date_to_Days
);
use C4::Circulation;
use C4::Members;
use C4::Biblio;
use C4::Reserves2;
use C4::Date;
#
# PARAMETERS READING
@ -170,7 +170,7 @@ my $borrower;
my @lines;
if ($borrowernumber) {
$borrower = getpatroninformation( \%env, $borrowernumber, 0 );
$borrower = GetMemberDetails( $borrowernumber, 0 );
my ( $od, $issue, $fines ) = borrdata2( \%env, $borrowernumber );
# Warningdate is the date that the warning starts appearing
@ -217,17 +217,17 @@ if ($barcode) {
$barcode = cuecatbarcodedecode($barcode);
my ( $datedue, $invalidduedate ) = fixdate( $year, $month, $day );
if ($issueconfirmed) {
issuebook( \%env, $borrower, $barcode, $datedue, $cancelreserve );
AddIssue( \%env, $borrower, $barcode, $datedue, $cancelreserve );
$inprocess = 1;
}
else {
my ( $error, $question ) =
canbookbeissued( \%env, $borrower, $barcode, $year, $month, $day,
CanBookBeIssued( \%env, $borrower, $barcode, $year, $month, $day,
$inprocess );
my $noerror = 1;
my $noquestion = 1;
# Get the item title for more information
my $getmessageiteminfo = getiteminformation( undef, $barcode );
my $getmessageiteminfo = GetBiblioFromItemNumber( undef, $barcode );
foreach my $impossible ( keys %$error ) {
$template->param(
@ -250,7 +250,7 @@ if ($barcode) {
year => $year
);
if ( $noerror && ( $noquestion || $issueconfirmed ) ) {
issuebook( \%env, $borrower, $barcode, $datedue );
AddIssue( \%env, $borrower, $barcode, $datedue );
$inprocess = 1;
}
}
@ -264,7 +264,7 @@ if ($barcode) {
# reload the borrower info for the sake of reseting the flags.....
if ($borrowernumber) {
$borrower = getpatroninformation( \%env, $borrowernumber, 0 );
$borrower = GetMemberDetails( $borrowernumber, 0 );
}
##################################################################################
@ -282,10 +282,10 @@ if ($borrowernumber) {
my %getreserv;
my %getWaitingReserveInfo;
my %env;
my $getiteminfo = getiteminformation( $num_res->{'itemnumber'} );
my $getiteminfo = GetBiblioFromItemNumber( $num_res->{'itemnumber'} );
my $itemtypeinfo = getitemtypeinfo( $getiteminfo->{'itemtype'} );
my ( $transfertwhen, $transfertfrom, $transfertto ) =
checktransferts( $num_res->{'itemnumber'} );
GetTransfers( $num_res->{'itemnumber'} );
$getreserv{waiting} = 0;
$getreserv{transfered} = 0;
@ -377,73 +377,69 @@ if ($borrower) {
# get each issue of the borrower & separate them in todayissues & previous issues
my @todaysissues;
my @previousissues;
my $issueslist = getissues($borrower);
my $issueslist = GetBorrowerIssues($borrower);
# split in 2 arrays for today & previous
my $dbh = C4::Context->dbh;
foreach my $it ( keys %$issueslist ) {
my $issuedate = $issueslist->{$it}->{'timestamp'};
foreach my $it ( @$issueslist ) {
my $issuedate = $it->{'timestamp'};
$issuedate =~ s/-//g;
$issuedate = substr( $issuedate, 0, 8 );
# to let perl sort this correctly
$issueslist->{$it}->{'timestamp'} =~ s/(-|\:| )//g;
$it->{'timestamp'} =~ s/(-|\:| )//g;
if ( $todaysdate == $issuedate ) {
(
$issueslist->{$it}->{'charge'},
$issueslist->{$it}->{'itemtype_charge'}
$it->{'charge'},
$it->{'itemtype_charge'}
)
= calc_charges(
$dbh,
$issueslist->{$it}->{'itemnumber'},
= GetIssuingCharges(
$it->{'itemnumber'},
$borrower->{'borrowernumber'}
);
$issueslist->{$it}->{'charge'} =
sprintf( "%.2f", $issueslist->{$it}->{'charge'} );
$it->{'charge'} =
sprintf( "%.2f", $it->{'charge'} );
(
$issueslist->{$it}->{'can_renew'},
$issueslist->{$it}->{'can_renew_error'}
$it->{'can_renew'},
$it->{'can_renew_error'}
)
= renewstatus(
\%env,
= CanBookBeRenewed(
$borrower->{'borrowernumber'},
$issueslist->{$it}->{'itemnumber'}
$it->{'itemnumber'}
);
my ( $restype, $reserves ) =
CheckReserves( $issueslist->{$it}->{'itemnumber'} );
CheckReserves( $it->{'itemnumber'} );
if ($restype) {
$issueslist->{$it}->{'can_renew'} = 0;
$it->{'can_renew'} = 0;
}
push @todaysissues, $issueslist->{$it};
}
else {
(
$issueslist->{$it}->{'charge'},
$issueslist->{$it}->{'itemtype_charge'}
$it->{'charge'},
$it->{'itemtype_charge'}
)
= calc_charges(
$dbh,
$issueslist->{$it}->{'itemnumber'},
= GetIssuingCharges(
$it->{'itemnumber'},
$borrower->{'borrowernumber'}
);
$issueslist->{$it}->{'charge'} =
sprintf( "%.2f", $issueslist->{$it}->{'charge'} );
$it->{'charge'} =
sprintf( "%.2f", $it->{'charge'} );
(
$issueslist->{$it}->{'can_renew'},
$issueslist->{$it}->{'can_renew_error'}
$it->{'can_renew'},
$it->{'can_renew_error'}
)
= renewstatus(
\%env,
= CanBookBeRenewed(
$borrower->{'borrowernumber'},
$issueslist->{$it}->{'itemnumber'}
$it->{'itemnumber'}
);
my ( $restype, $reserves ) =
CheckReserves( $issueslist->{$it}->{'itemnumber'} );
CheckReserves( $it->{'itemnumber'} );
if ($restype) {
$issueslist->{$it}->{'can_renew'} = 0;
$it->{'can_renew'} = 0;
}
push @previousissues, $issueslist->{$it};
push @previousissues, $it;
}
}
my $od; # overdues
@ -642,14 +638,15 @@ foreach $flag ( sort keys %$flags ) {
);
my $items = $flags->{$flag}->{'itemlist'};
{
my @itemswaiting;
foreach my $item (@$items) {
my ($iteminformation) =
getiteminformation( $item->{'itemnumber'}, 0 );
push @itemswaiting, $iteminformation;
}
}
# useless ???
# {
# my @itemswaiting;
# foreach my $item (@$items) {
# my ($iteminformation) =
# getiteminformation( $item->{'itemnumber'}, 0 );
# push @itemswaiting, $iteminformation;
# }
# }
if ( $query->param('module') ne 'returns' ) {
$template->param( nonreturns => 'true' );
}

View File

@ -26,7 +26,7 @@ use C4::Output;
use C4::Branch;
use C4::Auth;
use C4::Date;
use C4::Circulation::Circ2;
use C4::Circulation;
use C4::Interface::CGI::Output;
use Date::Calc qw(
Today
@ -71,7 +71,7 @@ foreach my $br ( keys %$branches ) {
$branchloop{'branchname'} = $branches->{$br}->{'branchname'};
$branchloop{'branchcode'} = $branches->{$br}->{'branchcode'};
my @gettransfers =
GetTransfersFromBib( $branches->{$br}->{'branchcode'}, $default );
GetTransfersFromTo( $branches->{$br}->{'branchcode'}, $default );
if (@gettransfers) {
foreach my $num (@gettransfers) {
@ -91,7 +91,7 @@ foreach my $br ( keys %$branches ) {
if ( $warning > 0 ) {
$getransf{'messcompa'} = 1;
}
my $gettitle = getiteminformation( $num->{'itemnumber'} );
my $gettitle = GetBiblioFromItemNumber( $num->{'itemnumber'} );
my $itemtypeinfo = getitemtypeinfo( $gettitle->{'itemtype'} );
$getransf{'title'} = $gettitle->{'title'};
@ -108,7 +108,7 @@ foreach my $br ( keys %$branches ) {
my @checkreserv = GetReservations( $num->{'itemnumber'} );
if ( $checkreserv[0] ) {
my $getborrower =
getpatroninformation( \%env, $checkreserv[1] );
GetMemberDetails( $checkreserv[1] );
$getransf{'borrowernum'} = $getborrower->{'borrowernumber'};
$getransf{'borrowername'} = $getborrower->{'surname'};
$getransf{'borrowerfirstname'} = $getborrower->{'firstname'};

View File

@ -27,7 +27,7 @@ written 11/3/2002 by Finlay
use strict;
use CGI;
use C4::Circulation::Circ2;
use C4::Circulation;
use C4::Date;
use C4::Output;
use C4::Print;
@ -116,7 +116,7 @@ if ( $query->param('resbarcode') ) {
my $resbarcode = $query->param('resbarcode');
my $diffBranchReturned = $query->param('diffBranch');
# set to waiting....
my $iteminfo = getiteminformation($item);
my $iteminfo = GetBiblioFromItemNumber($item);
my $diffBranchSend;
# addin in ReserveWaiting the possibility to check if the document is expected in this library or not,
@ -133,7 +133,7 @@ if ( $query->param('resbarcode') ) {
my ( $messages, $nextreservinfo ) = OtherReserves($item);
my $branchname = GetBranchName( $messages->{'transfert'} );
my ($borr) = getpatroninformation( \%env, $nextreservinfo, 0 );
my ($borr) = GetMemberDetails( $nextreservinfo, 0 );
my $borcnum = $borr->{'cardnumber'};
my $name =
$borr->{'surname'} . ", " . $borr->{'title'} . " " . $borr->{'firstname'};
@ -166,7 +166,7 @@ if ($barcode) {
# decode cuecat
$barcode = cuecatbarcodedecode($barcode);
( $returned, $messages, $iteminformation, $borrower ) =
returnbook( $barcode, C4::Context->userenv->{'branch'} );
AddReturn( $barcode, C4::Context->userenv->{'branch'} );
if ($returned) {
$returneditems{0} = $barcode;
$riborrowernumber{0} = $borrower->{'borrowernumber'};
@ -225,7 +225,7 @@ my $reserved = 0;
if ( $messages->{'WasTransfered'} ) {
my ($iteminfo) = getiteminformation( 0, $barcode );
my $iteminfo = GetBiblioFromItemNumber( 0, $barcode );
$template->param(
found => 1,
@ -247,10 +247,10 @@ if ( $messages->{'WrongTransfer'} and not $messages->{'WasTransfered'}) {
my $res = $messages->{'ResFound'};
my $branchname = $branches->{ $res->{'branchcode'} }->{'branchname'};
my ($borr) = getpatroninformation( \%env, $res->{'borrowernumber'}, 0 );
my ($borr) = GetMemberDetails( $res->{'borrowernumber'}, 0 );
my $name =
$borr->{'surname'} . " " . $borr->{'title'} . " " . $borr->{'firstname'};
my ($iteminfo) = getiteminformation( 0, $barcode );
my $iteminfo = GetBiblioFromItemNumber( 0, $barcode );
$template->param(
wname => $name,
@ -278,10 +278,10 @@ if ( $messages->{'WrongTransfer'} and not $messages->{'WasTransfered'}) {
if ( $messages->{'ResFound'} and not $messages->{'WrongTransfer'}) {
my $res = $messages->{'ResFound'};
my $branchname = $branches->{ $res->{'branchcode'} }->{'branchname'};
my ($borr) = getpatroninformation( \%env, $res->{'borrowernumber'}, 0 );
my ($borr) = GetMemberDetails( $res->{'borrowernumber'}, 0 );
my $name =
$borr->{'surname'} . " " . $borr->{'title'} . " " . $borr->{'firstname'};
my ($iteminfo) = getiteminformation( 0, $barcode );
my $iteminfo = GetBiblioFromItemNumber( 0, $barcode );
if ( $res->{'ResFound'} eq "Waiting" ) {
if ( C4::Context->userenv->{'branch'} eq $res->{'branchcode'} ) {
@ -441,8 +441,8 @@ if ($borrower) {
my @waitingitemloop;
my $items = $flags->{$flag}->{'itemlist'};
foreach my $item (@$items) {
my ($iteminformation) =
getiteminformation( $item->{'itemnumber'}, 0 );
my $iteminformation =
GetBiblioFromItemNumber( $item->{'itemnumber'});
my %waitingitem;
$waitingitem{biblionum} = $iteminformation->{'biblionumber'};
$waitingitem{barcode} = $iteminformation->{'barcode'};
@ -460,8 +460,8 @@ if ($borrower) {
foreach my $item ( sort { $a->{'date_due'} cmp $b->{'date_due'} }
@$items )
{
my ($iteminformation) =
getiteminformation( $item->{'itemnumber'}, 0 );
my $iteminformation =
GetBiblioFromItemNumber( $item->{'itemnumber'}, 0 );
my %overdueitem;
$overdueitem{duedate} = format_date( $item->{'date_due'} );
$overdueitem{biblionum} = $iteminformation->{'biblionumber'};
@ -515,7 +515,7 @@ foreach ( sort { $a <=> $b } keys %returneditems ) {
. sprintf( "%0.2d", $datearr[3] );
$ri{duedate} = format_date($duedate);
my ($borrower) =
getpatroninformation( \%env, $riborrowernumber{$_}, 0 );
GetMemberDetails( $riborrowernumber{$_}, 0 );
$ri{borrowernumber} = $borrower->{'borrowernumber'};
$ri{borcnum} = $borrower->{'cardnumber'};
$ri{borfirstname} = $borrower->{'firstname'};
@ -527,7 +527,7 @@ foreach ( sort { $a <=> $b } keys %returneditems ) {
}
# my %ri;
my ($iteminformation) = getiteminformation( 0, $barcode );
my $iteminformation = GetBiblioFromItemNumber( 0, $barcode );
$ri{itembiblionumber} = $iteminformation->{'biblionumber'};
$ri{itemtitle} = $iteminformation->{'title'};
$ri{itemauthor} = $iteminformation->{'author'};

View File

@ -19,7 +19,7 @@
use strict;
use CGI qw/:standard/;
use C4::Circulation::Circ2;
use C4::Circulation;
use C4::Output;
use C4::Auth;
use C4::Print;

View File

@ -26,7 +26,7 @@ use CGI;
use C4::Branch; # GetBranches
use C4::Auth;
use C4::Date;
use C4::Circulation::Circ2;
use C4::Circulation;
use Date::Calc qw(
Today
Add_Delta_Days
@ -85,11 +85,11 @@ foreach my $br ( keys %$branches ) {
foreach my $num (@getreserves) {
my %getreserv;
my %env;
my $gettitle = getiteminformation( $num->{'itemnumber'} );
my $gettitle = GetBiblioFromItemNumber( $num->{'itemnumber'} );
my $itemtypeinfo = getitemtypeinfo( $gettitle->{'itemtype'} );
if ( $gettitle->{'holdingbranch'} eq $default ) {
my $getborrower =
getpatroninformation( \%env, $num->{'borrowernumber'} );
GetMemberDetails( $num->{'borrowernumber'} );
$getreserv{'reservedate'} =
format_date( $num->{'reservedate'} );

View File

@ -30,7 +30,7 @@ use CGI;
use C4::Context;
use C4::Interface::CGI::Output;
use C4::Output;
use C4::Circulation::Circ2;
use C4::Circulation;
use C4::Auth;
use C4::Members;
@ -49,12 +49,12 @@ my %env;
$env{'nottodayissues'}=1;
my %member2;
$member2{'borrowernumber'}=$member;
my $issues=currentissues(\%env,\%member2);
my $issues=GetBorrowerIssues(\%member2);
my $i=0;
foreach (sort keys %$issues) {
$i++;
}
my ($bor,$flags)=getpatroninformation(\%env, $member,'');
my ($bor,$flags)=GetMemberDetails($member,'');
if (C4::Context->preference("IndependantBranches")) {
my $userenv = C4::Context->userenv;
unless ($userenv->{flags} == 1){

View File

@ -10,7 +10,7 @@ use CGI;
use C4::Output;
use C4::Auth;
use C4::Context;
use C4::Circulation::Circ2;
use C4::Circulation;
#use C4::Acquisitions;
use C4::Interface::CGI::Output;
@ -38,7 +38,7 @@ my %env;
$env{'nottodayissues'}=1;
my %member2;
$member2{'borrowernumber'}=$member;
my $issues=currentissues(\%env,\%member2);
my $issues=GetBorrowerIssues(\%member2);
my $i=0;
foreach (sort keys %$issues) {
$i++;
@ -57,8 +57,8 @@ if ($input->param('newflags')) {
$sth->execute($flags, $member);
print $input->redirect("/cgi-bin/koha/members/moremember.pl?borrowernumber=$member");
} else {
# my ($bor,$flags,$accessflags)=getpatroninformation(\%env, $member,'');
my $bor = getpatroninformation(\%env, $member,'');
# my ($bor,$flags,$accessflags)=GetMemberDetails($member,'');
my $bor = GetMemberDetails( $member,'');
my $flags = $bor->{'flags'};
my $accessflags = $bor->{'authflags'};
my $dbh=C4::Context->dbh();

View File

@ -10,7 +10,7 @@ use C4::Output;
use C4::Interface::CGI::Output;
use C4::Context;
use C4::Members;
use C4::Circulation::Circ2;
use C4::Circulation;
use CGI;
use Digest::MD5 qw(md5_base64);
@ -38,13 +38,13 @@ my %env;
$env{'nottodayissues'}=1;
my %member2;
$member2{'borrowernumber'}=$member;
my $issues=currentissues(\%env,\%member2);
my $issues=GetBorrowerIssues(\%member2);
my $i=0;
foreach (sort keys %$issues) {
$i++;
}
my ($bor,$flags)=getpatroninformation(\%env, $member,'');
my ($bor,$flags)=GetMemberDetails( $member,'');
my $newpassword = $input->param('newpassword');
if ( $newpassword ) {

View File

@ -43,7 +43,7 @@ use C4::Members;
use Date::Manip;
use C4::Date;
use C4::Reserves2;
use C4::Circulation::Circ2;
use C4::Circulation;
use C4::Koha;
use C4::Letters;
use C4::Biblio;
@ -223,15 +223,8 @@ for ( my $i = 0 ; $i < $count ; $i++ ) {
$row{toggle} = $toggle++ % 2;
#find the charge for an item
# FIXME - This is expecting
# &C4::Circulation::Renewals2::calc_charges, but it's getting
# &C4::Circulation::Circ2::calc_charges, which only returns one
# element, so itemtype isn't being set.
# But &C4::Circulation::Renewals2::calc_charges doesn't appear to
# return the correct item type either (or a properly-formatted
# charge, for that matter).
my ( $charge, $itemtype ) =
calc_charges( $dbh, $issue->[$i]{'itemnumber'}, $borrowernumber );
GetIssuingCharges( $issue->[$i]{'itemnumber'}, $borrowernumber );
my $itemtypeinfo = getitemtypeinfo($itemtype);
$row{'itemtype_description'} = $itemtypeinfo->{description};
@ -284,10 +277,10 @@ if ($borrowernumber) {
foreach my $num_res (@borrowerreserv) {
my %getreserv;
my %env;
my $getiteminfo = getiteminformation( $num_res->{'itemnumber'} );
my $getiteminfo = GetBiblioFromItemNumber( $num_res->{'itemnumber'} );
my $itemtypeinfo = getitemtypeinfo( $getiteminfo->{'itemtype'} );
my ( $transfertwhen, $transfertfrom, $transfertto ) =
checktransferts( $num_res->{'itemnumber'} );
GetTransfers( $num_res->{'itemnumber'} );
$getreserv{waiting} = 0;
$getreserv{transfered} = 0;

View File

@ -35,7 +35,7 @@ use C4::Members;
use C4::Accounts;
use C4::Stats;
use C4::Koha;
use C4::Circulation::Fines;
use C4::Overdues;
use C4::Branch; # GetBranches
my $input = new CGI;

View File

@ -3,7 +3,7 @@ use C4::Context;
use C4::Date;
use Mail::Sendmail; # comment out if not doing e-mail notices
use Getopt::Long;
use C4::Circulation::Circ2;
use C4::Circulation;
# use C4::Members;
# this module will notify only the mail case
# Now it's only programmed for ouest provence, you can modify it for yourself
@ -204,7 +204,7 @@ foreach my $num (@getnofifys) {
# now deal with the debarred mode
# if ($debarred eq 1) {
# à ajouter : si le lecteur est en mode debarred, ajouter la fonction qui nous permettra cela
# <EFBFBD>ajouter : si le lecteur est en mode debarred, ajouter la fonction qui nous permettra cela
# UpdateBorrowerDebarred($num->{'borrowernumber'});
# }
close(OUT);

View File

@ -28,8 +28,8 @@
# $Id$
use C4::Context;
use C4::Circulation::Circ2;
use C4::Circulation::Fines;
use C4::Circulation;
use C4::Overdues;
use Date::Manip qw/Date_DaysSince1BC/;
use C4::Biblio;

View File

@ -28,8 +28,8 @@
# $Id$
use C4::Context;
use C4::Circulation::Circ2;
use C4::Circulation::Fines;
use C4::Circulation;
use C4::Overdues;
use Date::Manip;
use C4::Biblio;
@ -130,15 +130,15 @@ for (my $i=0;$i<$numOverdueItems;$i++){
my $cost=ReplacementCost($data->[$i]->{'itemnumber'});
my $dbh = C4::Context->dbh;
my $env;
my $accountno=C4::Circulation::Circ2::getnextacctno($env,$data->[$i]->{'borrowernumber'},$dbh);
my $accountno=C4::Circulation::Circ2::getnextacctno($data->[$i]->{'borrowernumber'});
my $item=GetBiblioFromItemNumber($data->[$i]->{'itemnumber'});
if ($item->{'itemlost'} ne '1' && $item->{'itemlost'} ne '2' ){
# FIXME
# this should be a separate function
#
my $sth=$dbh->prepare("Insert into accountlines
my $sth=$dbh->prepare("INSERT INTO accountlines
(borrowernumber,itemnumber,accountno,date,amount,
description,accounttype,amountoutstanding) values
description,accounttype,amountoutstanding) VALUES
(?,?,?,now(),?,?,'L',?)");
$sth->execute($data->[$i]->{'borrowernumber'},$data->[$i]->{'itemnumber'},
$accountno,$cost,"Lost item $item->{'title'} $item->{'barcode'} $due",$cost);

View File

@ -26,8 +26,8 @@ use strict;
use CGI;
use C4::Circulation::Circ2;
use C4::Circulation::Fines;
use C4::Circulation;
use C4::Overdues;
use Data::Dumper;

View File

@ -17,8 +17,8 @@
use C4::Members;
use C4::Circulation::Circ2;
use C4::Circulation::Fines;
use C4::Circulation;
use C4::Overdues;
use Date::Manip;
use Mail::Sendmail;
@ -101,7 +101,7 @@ sub levyFines {
my $dbh=C4Connect();
my $env;
my $accountno=C4::Circulation::Circ2::getnextacctno($env,$overdue->{'borrowernumber'},$dbh);
my $accountno=C4::Circulation::Circ2::getnextacctno($overdue->{'borrowernumber'});
my $item=GetBiblioFromItemNumber($overdue->{'itemnumber'});
if ($item->{'itemlost'} ne '1' && $item->{'itemlost'} ne '2' ){
$item->{'title'}=~ s/\'/\\'/g;

View File

@ -27,8 +27,8 @@ use strict;
use CGI;
use C4::Circulation::Circ2;
use C4::Circulation::Fines;
use C4::Circulation;
use C4::Overdues;
my $input = new CGI;
my $borrowernumber = $input->param('borrowernumber');

View File

@ -22,7 +22,7 @@ use strict;
use C4::Output;
use CGI;
use C4::Members;
use C4::Circulation::Circ2;
use C4::Circulation;
use C4::Auth;
use C4::Interface::CGI::Output;
@ -41,7 +41,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
);
# get borrower information ....
my ( $borr, $flags ) = getpatroninformation( undef, $borrowernumber );
my ( $borr, $flags ) = GetMemberDetails( $borrowernumber );
my @bordat;
$bordat[0] = $borr;

View File

@ -27,7 +27,7 @@ use C4::Biblio;
use CGI;
use C4::Output;
use C4::BookShelves;
use C4::Circulation::Circ2;
use C4::Circulation;
use C4::Auth;
use C4::Interface::CGI::Output;

View File

@ -25,7 +25,7 @@ use CGI;
use C4::Auth; # checkauth, getborrowernumber.
use C4::Context;
use Digest::MD5 qw(md5_base64);
use C4::Circulation::Circ2;
use C4::Circulation;
use C4::Interface::CGI::Output;
@ -44,7 +44,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
);
# get borrower information ....
my ( $borr, $flags ) = getpatroninformation( undef, $borrowernumber );
my ( $borr, $flags ) = GetMemberDetails( $borrowernumber );
my $sth =
$dbh->prepare("UPDATE borrowers SET password = ? WHERE borrowernumber=?");

View File

@ -23,7 +23,7 @@ use CGI;
use C4::Auth;
use C4::Koha;
use C4::Circulation::Circ2;
use C4::Circulation;
use C4::Date;
use C4::Members;
@ -42,7 +42,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
);
# get borrower information ....
my ( $borr, $flags ) = getpatroninformation( undef, $borrowernumber );
my ( $borr, $flags ) = GetMemberDetails( $borrowernumber );
$template->param($borr);

View File

@ -5,7 +5,7 @@
#script to renew items from the web
use CGI;
use C4::Circulation::Circ2;
use C4::Circulation;
my $query = new CGI;
@ -13,9 +13,9 @@ my $itemnumber = $query->param('item');
my $borrowernumber = $query->param("borrowernumber");
my %env;
my $status = renewstatus( \%env, $borrowernumber, $itemnumber );
my $status = CanBookBeRenewed( $borrowernumber, $itemnumber );
if ( $status == 1 ) {
renewbook( \%env, $borrowernumber, $itemnumber );
AddRenewal( $borrowernumber, $itemnumber );
}
if ( $query->param('from') eq 'opac_user' ) {

View File

@ -21,7 +21,7 @@ use CGI;
use C4::Biblio;
use C4::Auth; # checkauth, getborrowernumber.
use C4::Koha;
use C4::Circulation::Circ2;
use C4::Circulation;
use C4::Reserves2;
use C4::Interface::CGI::Output;
use C4::Date;
@ -43,7 +43,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
);
# get borrower information ....
my ( $borr, $flags ) = getpatroninformation( undef, $borrowernumber );
my ( $borr, $flags ) = GetMemberDetails( $borrowernumber );
# get biblionumber.....
my $biblionumber = $query->param('biblionumber');

View File

@ -23,7 +23,7 @@ use CGI;
use C4::Auth;
use C4::Koha;
use C4::Interface::CGI::Output;
use C4::Circulation::Circ2;
use C4::Circulation;
use C4::Review;
use C4::Biblio;

View File

@ -68,7 +68,7 @@ use strict;
use CGI;
use C4::Output;
use C4::BookShelves;
use C4::Circulation::Circ2;
use C4::Circulation;
use C4::Auth;
use C4::Interface::CGI::Output;
@ -86,7 +86,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
if ( $query->param('modifyshelfcontents') ) {
my $shelfnumber = $query->param('viewshelf');
my $barcode = $query->param('addbarcode');
my ($item) = getiteminformation( 0, $barcode );
my ($item) = GetItemFromBarcode($barcode);
if ( ShelfPossibleAction( $loggedinuser, $shelfnumber, 'manage' ) ) {
AddToShelf( $item->{'itemnumber'}, $shelfnumber );
foreach ( $query->param ) {
@ -229,6 +229,11 @@ output_html_with_http_headers $query, $cookie, $template->output;
#
# $Log$
# Revision 1.10 2007/04/04 16:46:23 tipaul
# HUGE COMMIT : code cleaning circulation.
#
# some stuff to do, i'll write a mail on koha-devel NOW !
#
# Revision 1.9 2007/03/09 15:12:54 tipaul
# rel_3_0 moved to HEAD
#

View File

@ -21,7 +21,7 @@ use CGI;
use C4::Auth;
use C4::Koha;
use C4::Interface::CGI::Output;
use C4::Circulation::Circ2;
use C4::Circulation;
use C4::Review;
use C4::Biblio;

View File

@ -23,7 +23,7 @@ use CGI;
use C4::Auth;
use C4::Koha;
use C4::Circulation::Circ2;
use C4::Circulation;
use C4::Reserves2;
use C4::Members;
use C4::Interface::CGI::Output;
@ -45,7 +45,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
);
# get borrower information ....
my ( $borr, $flags ) = getpatroninformation( undef, $borrowernumber );
my ( $borr, $flags ) = GetMemberDetails( $borrowernumber );
$borr->{'dateenrolled'} = format_date( $borr->{'dateenrolled'} );
$borr->{'expiry'} = format_date( $borr->{'expiry'} );
@ -76,7 +76,7 @@ $template->param( BORROWER_INFO => \@bordat );
$template->param( borrowernumber => $borrowernumber );
#get issued items ....
my $issues = getissues($borr);
my $issues = GetBorrowerIssues($borr);
my $count = 0;
my $overdues_count = 0;
@ -84,9 +84,7 @@ my @overdues;
my @issuedat;
my $imgdir = getitemtypeimagesrc();
my $itemtypes = GetItemTypes();
foreach my $key ( keys %$issues ) {
my $issue = $issues->{$key};
$issue->{'date_due'} = format_date( $issue->{'date_due'} );
foreach my $issue ( @$issues ) {
# check for reserves
my ( $restype, $res ) = CheckReserves( $issue->{'itemnumber'} );
@ -113,7 +111,7 @@ foreach my $key ( keys %$issues ) {
# check if item is renewable
my %env;
my $status = renewstatus( \%env, $borrowernumber, $issue->{'itemnumber'} );
my $status = CanBookBeRenewed( $borrowernumber, $issue->{'itemnumber'} );
$issue->{'status'} = $status;
@ -162,7 +160,7 @@ my @waiting;
my $wcount = 0;
foreach my $res (@$reserves) {
if ( $res->{'itemnumber'} ) {
my $item = getiteminformation( $res->{'itemnumber'}, '' );
my $item = GetItem( $res->{'itemnumber'});
$res->{'holdingbranch'} =
$branches->{ $item->{'holdingbranch'} }->{'branchname'};
$res->{'branch'} = $branches->{ $res->{'branchcode'} }->{'branchname'};

View File

@ -22,7 +22,7 @@ use CGI;
use C4::Auth;
use C4::Koha;
use C4::Circulation::Circ2;
use C4::Circulation;
use C4::Interface::CGI::Output;
use C4::Date;
@ -41,7 +41,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
);
# get borrower information ....
my ( $borr, $flags ) = getpatroninformation( undef, $borrowernumber );
my ( $borr, $flags ) = GetMemberDetails( $borrowernumber );
$borr->{'dateenrolled'} = format_date( $borr->{'dateenrolled'} );
$borr->{'dateexpiry'} = format_date( $borr->{'dateexpiry'} );

View File

@ -25,7 +25,7 @@ use Mail::Sendmail;
use C4::Auth; # checkauth, getborrowernumber.
use C4::Context;
use C4::Koha;
use C4::Circulation::Circ2;
use C4::Circulation;
use C4::Interface::CGI::Output;
use C4::Date;
use C4::Members;
@ -44,7 +44,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
);
# get borrower information ....
my ( $borr, $flags ) = getpatroninformation( undef, $borrowernumber );
my ( $borr, $flags ) = GetMemberDetails( $borrowernumber );
# handle the new information....
# collect the form values and send an email.

View File

@ -29,7 +29,7 @@ use C4::Context;
use C4::Output;
use C4::Koha;
use C4::Interface::CGI::Output;
use C4::Circulation::Circ2;
use C4::Circulation;
=head1 NAME

View File

@ -27,7 +27,7 @@ use C4::Branch; # GetBranches
use C4::Output;
use C4::Koha;
use C4::Interface::CGI::Output;
use C4::Circulation::Circ2;
use C4::Circulation;
use Date::Manip;
use C4::Members;

View File

@ -27,7 +27,7 @@ use C4::Context;
use C4::Output;
use C4::Koha;
use C4::Interface::CGI::Output;
use C4::Circulation::Circ2;
use C4::Circulation;
use Date::Manip;
use C4::Members;

View File

@ -28,7 +28,7 @@ use C4::Output;
use C4::Koha;
use C4::Acquisition;
use C4::Interface::CGI::Output;
use C4::Circulation::Circ2;
use C4::Circulation;
=head1 NAME

View File

@ -27,7 +27,7 @@ use C4::Branch; # GetBranches
use C4::Output;
use C4::Koha;
use C4::Interface::CGI::Output;
use C4::Circulation::Circ2;
use C4::Circulation;
use Date::Manip;
use C4::Members;

View File

@ -27,7 +27,7 @@ use C4::Branch; # GetBranches
use C4::Output;
use C4::Koha;
use C4::Interface::CGI::Output;
use C4::Circulation::Circ2;
use C4::Circulation;
use Date::Manip;
=head1 NAME

View File

@ -27,7 +27,7 @@ use C4::Branch; # GetBranches
use C4::Output;
use C4::Koha;
use C4::Interface::CGI::Output;
use C4::Circulation::Circ2;
use C4::Circulation;
=head1 NAME

View File

@ -23,7 +23,7 @@ use C4::Auth;
use C4::Context;
use C4::Output;
use C4::Interface::CGI::Output;
use C4::Circulation::Circ2;
use C4::Biblio;
use C4::Date;
@ -93,7 +93,7 @@ if ($uploadbarcodes && length($uploadbarcodes)>0){
$qonloan->execute($barcode);
if ($qonloan->rows){
my $data = $qonloan->fetchrow_hashref;
my ($doreturn, $messages, $iteminformation, $borrower) =returnbook($barcode, $data->{homebranch});
my ($doreturn, $messages, $iteminformation, $borrower) =AddReturn($barcode, $data->{homebranch});
if ($doreturn){push @errorloop, {'barcode'=>$barcode,'ERR_ONLOAN_RET'=>1}}
else {push @errorloop, {'barcode'=>$barcode,'ERR_ONLOAN_NOT_RET'=>1}}
}
@ -112,7 +112,7 @@ if ($uploadbarcodes && length($uploadbarcodes)>0){
if ($markseen) {
foreach my $field ($input->param) {
if ($field =~ /SEEN-(.*)/) {
&itemseen($1);
&ModDateLastSeen($1);
}
}
}

View File

@ -27,7 +27,7 @@ use C4::Branch; # GetBranches
use C4::Output;
use C4::Koha;
use C4::Interface::CGI::Output;
use C4::Circulation::Circ2;
use C4::Circulation;
use Date::Calc qw(Delta_Days);
=head1 NAME

View File

@ -27,7 +27,7 @@ use C4::Branch; # GetBranches
use C4::Output;
use C4::Koha;
use C4::Interface::CGI::Output;
use C4::Circulation::Circ2;
use C4::Circulation;
use Date::Manip;
=head1 NAME

View File

@ -23,7 +23,7 @@ use C4::Auth;
use C4::Context;
use C4::Output;
use C4::Interface::CGI::Output;
use C4::Circulation::Circ2;
use C4::Circulation;
my $input = new CGI;

View File

@ -26,7 +26,7 @@ use C4::Biblio;
use CGI;
use C4::Output;
use C4::Reserves2;
use C4::Circulation::Circ2;
use C4::Circulation;
use C4::Members;
my $input = new CGI;
@ -49,7 +49,7 @@ my $found;
if ($checkitem ne ''){
$rank[0] = '0';
my $item = $checkitem;
$item = getiteminformation($item);
$item = GetItem($item);
if ( $item->{'holdingbranch'} eq $branch ){
$found = 'W';
}

View File

@ -24,7 +24,7 @@
# Suite 330, Boston, MA 02111-1307 USA
use CGI;
use C4::Circulation::Circ2;
use C4::Circulation;
my $input = new CGI;
@ -49,8 +49,8 @@ my $borrowernumber = $input->param("borrowernumber");
foreach my $itemno (@data) {
#check status before renewing issue
if (renewstatus(\%env,$borrowernumber,$itemno)){
renewbook(\%env,$borrowernumber,$itemno);
if (CanBookBeRenewed($borrowernumber,$itemno)){
AddRenewal($borrowernumber,$itemno);
}
}

View File

@ -37,7 +37,7 @@ use C4::Auth;
use C4::Reserves2;
use C4::Biblio;
use C4::Koha;
use C4::Circulation::Circ2;
use C4::Circulation;
use C4::Date;
use C4::Members;
@ -88,7 +88,7 @@ if ($findborrower) {
}
if ($cardnumber) {
my $borrowerinfo = getpatroninformation( \%env, 0, $cardnumber );
my $borrowerinfo = GetMemberDetails( 0, $cardnumber );
my $expiry;
my $diffbranch;
my @getreservloop;
@ -166,8 +166,8 @@ my ( $count, $reserves ) = FindReserves($biblionumber);
my $totalcount = $count;
my $alreadyreserved;
# FIXME launch another time getpatroninformation perhaps until
my $borrowerinfo = getpatroninformation( \%env, 0, $cardnumber );
# FIXME launch another time GetMemberDetails perhaps until
my $borrowerinfo = GetMemberDetails( 0, $cardnumber );
foreach my $res (@$reserves) {
if ( ( $res->{found} eq 'W' ) or ( $res->{priority} == 0 ) ) {
@ -226,8 +226,6 @@ foreach my $biblioitemnumber (@biblioitemnumbers) {
my $itemtypeinfos_of = get_itemtypeinfos_of(@itemtypes);
my $return_date_of = get_current_return_date_of(@itemnumbers);
my @bibitemloop;
foreach my $biblioitemnumber (@biblioitemnumbers) {
@ -251,22 +249,20 @@ foreach my $biblioitemnumber (@biblioitemnumbers) {
$branchinfos_of->{ $item->{holdingbranch} }{branchname};
}
# add inforrmation
# add information
$item->{itemcallnumber} = $item->{itemcallnumber};
# if the item is currently on loan, we display its return date and
# change the background color
my $date_due;
if ( defined $return_date_of->{$itemnumber} ) {
$date_due = format_date( $return_date_of->{$itemnumber} );
$item->{date_due} = $date_due;
my $issues= GetItemIssue($itemnumber);
if ( $issues->{'date_due'} ) {
$item->{date_due} = format_date($issues->{'date_due'});
$item->{backgroundcolor} = 'onloan';
}
# checking reserve
my ($reservedate,$reservedfor,$expectedAt) = GetFirstReserveDateFromItem($itemnumber);
my $ItemBorrowerReserveInfo = getpatroninformation( \%env, $reservedfor, 0);
my $ItemBorrowerReserveInfo = GetMemberDetails( $reservedfor, 0);
if ( defined $reservedate ) {
$item->{backgroundcolor} = 'reserved';
@ -298,7 +294,7 @@ foreach my $biblioitemnumber (@biblioitemnumbers) {
# Check of the transfered documents
my ( $transfertwhen, $transfertfrom, $transfertto ) =
get_transfert_infos($itemnumber);
GetTransfers($itemnumber);
if ( $transfertwhen ne '' ) {
$item->{transfertwhen} = format_date($transfertwhen);
@ -314,7 +310,7 @@ foreach my $biblioitemnumber (@biblioitemnumbers) {
# An item is available only if:
if (
not defined $reservedate # not reserved yet
and $date_due eq '' # not currently on loan
and $issues->{'date_due'} eq '' # not currently on loan
and not $item->{itemlost} # not lost
and not $item->{notforloan} # not forbidden to loan
and $transfertwhen eq '' # not currently on transfert
@ -371,7 +367,7 @@ foreach my $res ( sort { $a->{found} cmp $b->{found} } @$reserves ) {
}
# get borrowers reserve info
my $reserveborrowerinfo = getpatroninformation( \%env, $res->{'borrowernumber'}, 0);
my $reserveborrowerinfo = GetMemberDetails( $res->{'borrowernumber'}, 0);
$reserve{'date'} = format_date( $res->{'reservedate'} );
$reserve{'borrowernumber'} = $res->{'borrowernumber'};

View File

@ -11,7 +11,7 @@ use C4::Date;
use C4::Output;
use C4::Acquisition;
use C4::Reserves2;
use C4::Circulation::Circ2;
use C4::Circulation;
use C4::Interface::CGI::Output;
use C4::Context;
use C4::Members;

View File

@ -40,7 +40,7 @@ use C4::Interface::CGI::Output;
use C4::Members; # GetBorrowersWhoHavexxxBorrowed.
use C4::Circulation::Circ2; # AnonymiseIssueHistory.
use C4::Circulation; # AnonymiseIssueHistory.
use Date::Calc qw/Date_to_Days Today/;
my $cgi = new CGI;

View File

@ -23,7 +23,7 @@ use C4::Auth;
use C4::Context;
use C4::Output;
use C4::Interface::CGI::Output;
use C4::Circulation::Circ2;
use C4::Biblio;
use C4::Date;
use C4::Koha;
use C4::Branch; # GetBranches
@ -98,7 +98,7 @@ if ($uploadbarcodes && length($uploadbarcodes)>0){
$qonloan->execute($barcode);
if ($qonloan->rows){
my $data = $qonloan->fetchrow_hashref;
my ($doreturn, $messages, $iteminformation, $borrower) =returnbook($barcode, $data->{homebranch});
my ($doreturn, $messages, $iteminformation, $borrower) =AddReturn($barcode, $data->{homebranch});
if ($doreturn){push @errorloop, {'barcode'=>$barcode,'ERR_ONLOAN_RET'=>1}}
else {push @errorloop, {'barcode'=>$barcode,'ERR_ONLOAN_NOT_RET'=>1}}
}
@ -117,12 +117,12 @@ if ($uploadbarcodes && length($uploadbarcodes)>0){
if ($markseen) {
foreach my $field ($input->param) {
if ($field =~ /SEEN-(.*)/) {
&itemseen($1);
&ModDateLastSeen($1);
}
}
}
if ($op) {
my $res = C4::Circulation::Circ2::GetItemsForInventory($minlocation,$maxlocation,$datelastseen,$branchcode,$offset,$pagesize);
my $res = GetItemsForInventory($minlocation,$maxlocation,$datelastseen,$branchcode,$offset,$pagesize);
$template->param(loop =>$res,
nextoffset => ($offset+$pagesize),
prevoffset => ($offset?$offset-$pagesize:0),

View File

@ -27,7 +27,7 @@ use strict;
use CGI;
use C4::Auth;
use C4::Interface::CGI::Output;
use C4::Circulation::Circ2; # GetLostItems
use C4::Biblio; # GetLostItems
use C4::Koha; # GetItemTypes
use C4::Branch; # GetBranches