Lines 39-45
use C4::Dates qw( format_date_in_iso );
Link Here
|
39 |
|
39 |
|
40 |
use Koha::DateUtils; |
40 |
use Koha::DateUtils; |
41 |
|
41 |
|
42 |
use List::MoreUtils qw( firstidx ); |
42 |
use List::MoreUtils qw( firstidx any ); |
43 |
|
43 |
|
44 |
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); |
44 |
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); |
45 |
|
45 |
|
Lines 863-869
table in the Koha database.
Link Here
|
863 |
=cut |
863 |
=cut |
864 |
|
864 |
|
865 |
sub CheckReserves { |
865 |
sub CheckReserves { |
866 |
my ( $item, $barcode, $lookahead_days) = @_; |
866 |
my ( $item, $barcode, $lookahead_days, $ignore_borrowers) = @_; |
867 |
my $dbh = C4::Context->dbh; |
867 |
my $dbh = C4::Context->dbh; |
868 |
my $sth; |
868 |
my $sth; |
869 |
my $select; |
869 |
my $select; |
Lines 914-920
sub CheckReserves {
Link Here
|
914 |
return if ( $notforloan_per_item > 0 ) or $notforloan_per_itemtype; |
914 |
return if ( $notforloan_per_item > 0 ) or $notforloan_per_itemtype; |
915 |
|
915 |
|
916 |
# Find this item in the reserves |
916 |
# Find this item in the reserves |
917 |
my @reserves = _Findgroupreserve( $bibitem, $biblio, $itemnumber, $lookahead_days); |
917 |
my @reserves = _Findgroupreserve( $bibitem, $biblio, $itemnumber, $lookahead_days, $ignore_borrowers); |
918 |
|
918 |
|
919 |
# $priority and $highest are used to find the most important item |
919 |
# $priority and $highest are used to find the most important item |
920 |
# in the list returned by &_Findgroupreserve. (The lower $priority, |
920 |
# in the list returned by &_Findgroupreserve. (The lower $priority, |
Lines 1754-1760
sub _FixPriority {
Link Here
|
1754 |
|
1754 |
|
1755 |
=head2 _Findgroupreserve |
1755 |
=head2 _Findgroupreserve |
1756 |
|
1756 |
|
1757 |
@results = &_Findgroupreserve($biblioitemnumber, $biblionumber, $itemnumber, $lookahead); |
1757 |
@results = &_Findgroupreserve($biblioitemnumber, $biblionumber, $itemnumber, $lookahead, $ignore_borrowers); |
1758 |
|
1758 |
|
1759 |
Looks for an item-specific match first, then for a title-level match, returning the |
1759 |
Looks for an item-specific match first, then for a title-level match, returning the |
1760 |
first match found. If neither, then we look for a 3rd kind of match based on |
1760 |
first match found. If neither, then we look for a 3rd kind of match based on |
Lines 1771-1777
C<biblioitemnumber>.
Link Here
|
1771 |
=cut |
1771 |
=cut |
1772 |
|
1772 |
|
1773 |
sub _Findgroupreserve { |
1773 |
sub _Findgroupreserve { |
1774 |
my ( $bibitem, $biblio, $itemnumber, $lookahead) = @_; |
1774 |
my ( $bibitem, $biblio, $itemnumber, $lookahead, $ignore_borrowers) = @_; |
1775 |
my $dbh = C4::Context->dbh; |
1775 |
my $dbh = C4::Context->dbh; |
1776 |
|
1776 |
|
1777 |
# TODO: consolidate at least the SELECT portion of the first 2 queries to a common $select var. |
1777 |
# TODO: consolidate at least the SELECT portion of the first 2 queries to a common $select var. |
Lines 1803-1809
sub _Findgroupreserve {
Link Here
|
1803 |
$sth->execute($itemnumber, $lookahead||0); |
1803 |
$sth->execute($itemnumber, $lookahead||0); |
1804 |
my @results; |
1804 |
my @results; |
1805 |
if ( my $data = $sth->fetchrow_hashref ) { |
1805 |
if ( my $data = $sth->fetchrow_hashref ) { |
1806 |
push( @results, $data ); |
1806 |
push( @results, $data ) |
|
|
1807 |
unless any{ $data->{borrowernumber} eq $_ } @$ignore_borrowers ; |
1807 |
} |
1808 |
} |
1808 |
return @results if @results; |
1809 |
return @results if @results; |
1809 |
|
1810 |
|
Lines 1835-1841
sub _Findgroupreserve {
Link Here
|
1835 |
$sth->execute($itemnumber, $lookahead||0); |
1836 |
$sth->execute($itemnumber, $lookahead||0); |
1836 |
@results = (); |
1837 |
@results = (); |
1837 |
if ( my $data = $sth->fetchrow_hashref ) { |
1838 |
if ( my $data = $sth->fetchrow_hashref ) { |
1838 |
push( @results, $data ); |
1839 |
push( @results, $data ) |
|
|
1840 |
unless any{ $data->{borrowernumber} eq $_ } @$ignore_borrowers ; |
1839 |
} |
1841 |
} |
1840 |
return @results if @results; |
1842 |
return @results if @results; |
1841 |
|
1843 |
|
Lines 1868-1874
sub _Findgroupreserve {
Link Here
|
1868 |
$sth->execute( $biblio, $bibitem, $itemnumber, $lookahead||0); |
1870 |
$sth->execute( $biblio, $bibitem, $itemnumber, $lookahead||0); |
1869 |
@results = (); |
1871 |
@results = (); |
1870 |
while ( my $data = $sth->fetchrow_hashref ) { |
1872 |
while ( my $data = $sth->fetchrow_hashref ) { |
1871 |
push( @results, $data ); |
1873 |
push( @results, $data ) |
|
|
1874 |
unless any{ $data->{borrowernumber} eq $_ } @$ignore_borrowers ; |
1872 |
} |
1875 |
} |
1873 |
return @results; |
1876 |
return @results; |
1874 |
} |
1877 |
} |