X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=C4%2FILSDI%2FUtility.pm;h=37220c670a6ede1bc2c3492a5e60c1dc9d40b8d4;hb=a600fbd74c2f01e0d4ed7159e08d6884f2c1c3f0;hp=bacabac98a377e7022aeac8a75615eb6988194ac;hpb=41b42dbe32245d7ca483906507fd5021e499d46a;p=koha.git diff --git a/C4/ILSDI/Utility.pm b/C4/ILSDI/Utility.pm index bacabac98a..37220c670a 100644 --- a/C4/ILSDI/Utility.pm +++ b/C4/ILSDI/Utility.pm @@ -1,6 +1,7 @@ package C4::ILSDI::Utility; # Copyright 2009 SARL Biblibre +# Copyright 2011 software.coop and MJ Ray # # This file is part of Koha. # @@ -24,7 +25,7 @@ use C4::Members; use C4::Items; use C4::Circulation; use C4::Biblio; -use C4::Reserves qw(GetReservesFromBorrowernumber); +use C4::Reserves qw(GetReservesFromBorrowernumber CanBookBeReserved); use C4::Context; use C4::Branch qw/GetBranchName/; use Digest::MD5 qw(md5_base64); @@ -38,7 +39,7 @@ BEGIN { require Exporter; @ISA = qw(Exporter); @EXPORT = qw( - &BorrowerExists &CanBookBeReserved &Availability + &BorrowerExists &Availability ); } @@ -67,55 +68,6 @@ sub BorrowerExists { return $sth->fetchrow; } -=head2 CanBookBeReserved - -Checks if a book (at bibliographic level) can be reserved by a borrower. - - if ( CanBookBeReserved($borrower, $biblionumber) ) { - # Do stuff - } - -=cut - -sub CanBookBeReserved { - my ( $borrower, $biblionumber ) = @_; - - my $MAXIMUM_NUMBER_OF_RESERVES = C4::Context->preference("maxreserves"); - my $MAXOUTSTANDING = C4::Context->preference("maxoutstanding"); - - my $out = 1; - - if ( $borrower->{'amountoutstanding'} > $MAXOUTSTANDING ) { - $out = undef; - } - if ( $borrower->{gonenoaddress} eq 1 ) { - $out = undef; - } - if ( $borrower->{lost} eq 1 ) { - $out = undef; - } - if ( $borrower->{debarred} ) { - $out = undef; - } - my @reserves = GetReservesFromBorrowernumber( $borrower->{'borrowernumber'} ); - if ( $MAXIMUM_NUMBER_OF_RESERVES && scalar(@reserves) >= $MAXIMUM_NUMBER_OF_RESERVES ) { - $out = undef; - } - foreach my $res (@reserves) { - if ( $res->{'biblionumber'} == $biblionumber ) { - $out = undef; - } - } - my $issues = GetPendingIssues( $borrower->{'borrowernumber'} ); - foreach my $issue (@$issues) { - if ( $issue->{'biblionumber'} == $biblionumber ) { - $out = undef; - } - } - - return $out; -} - =head2 Availability Returns, for an itemnumber, an array containing availability information.