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 846-852
table in the Koha database.
Link Here
|
846 |
=cut |
846 |
=cut |
847 |
|
847 |
|
848 |
sub CheckReserves { |
848 |
sub CheckReserves { |
849 |
my ( $item, $barcode, $lookahead_days) = @_; |
849 |
my ( $item, $barcode, $lookahead_days, $ignore_borrowers) = @_; |
850 |
my $dbh = C4::Context->dbh; |
850 |
my $dbh = C4::Context->dbh; |
851 |
my $sth; |
851 |
my $sth; |
852 |
my $select; |
852 |
my $select; |
Lines 893-899
sub CheckReserves {
Link Here
|
893 |
return ( '' ) if ( $notforloan_per_item > 0 ) or $notforloan_per_itemtype; |
893 |
return ( '' ) if ( $notforloan_per_item > 0 ) or $notforloan_per_itemtype; |
894 |
|
894 |
|
895 |
# Find this item in the reserves |
895 |
# Find this item in the reserves |
896 |
my @reserves = _Findgroupreserve( $bibitem, $biblio, $itemnumber, $lookahead_days); |
896 |
my @reserves = _Findgroupreserve( $bibitem, $biblio, $itemnumber, $lookahead_days, $ignore_borrowers); |
897 |
|
897 |
|
898 |
# $priority and $highest are used to find the most important item |
898 |
# $priority and $highest are used to find the most important item |
899 |
# in the list returned by &_Findgroupreserve. (The lower $priority, |
899 |
# in the list returned by &_Findgroupreserve. (The lower $priority, |
Lines 1727-1733
sub _FixPriority {
Link Here
|
1727 |
|
1727 |
|
1728 |
=head2 _Findgroupreserve |
1728 |
=head2 _Findgroupreserve |
1729 |
|
1729 |
|
1730 |
@results = &_Findgroupreserve($biblioitemnumber, $biblionumber, $itemnumber, $lookahead); |
1730 |
@results = &_Findgroupreserve($biblioitemnumber, $biblionumber, $itemnumber, $lookahead, $ignore_borrowers); |
1731 |
|
1731 |
|
1732 |
Looks for an item-specific match first, then for a title-level match, returning the |
1732 |
Looks for an item-specific match first, then for a title-level match, returning the |
1733 |
first match found. If neither, then we look for a 3rd kind of match based on |
1733 |
first match found. If neither, then we look for a 3rd kind of match based on |
Lines 1744-1750
C<biblioitemnumber>.
Link Here
|
1744 |
=cut |
1744 |
=cut |
1745 |
|
1745 |
|
1746 |
sub _Findgroupreserve { |
1746 |
sub _Findgroupreserve { |
1747 |
my ( $bibitem, $biblio, $itemnumber, $lookahead) = @_; |
1747 |
my ( $bibitem, $biblio, $itemnumber, $lookahead, $ignore_borrowers) = @_; |
1748 |
my $dbh = C4::Context->dbh; |
1748 |
my $dbh = C4::Context->dbh; |
1749 |
|
1749 |
|
1750 |
# TODO: consolidate at least the SELECT portion of the first 2 queries to a common $select var. |
1750 |
# TODO: consolidate at least the SELECT portion of the first 2 queries to a common $select var. |
Lines 1776-1782
sub _Findgroupreserve {
Link Here
|
1776 |
$sth->execute($itemnumber, $lookahead||0); |
1776 |
$sth->execute($itemnumber, $lookahead||0); |
1777 |
my @results; |
1777 |
my @results; |
1778 |
if ( my $data = $sth->fetchrow_hashref ) { |
1778 |
if ( my $data = $sth->fetchrow_hashref ) { |
1779 |
push( @results, $data ); |
1779 |
push( @results, $data ) |
|
|
1780 |
unless any{ $data->{borrowernumber} eq $_ } @$ignore_borrowers ; |
1780 |
} |
1781 |
} |
1781 |
return @results if @results; |
1782 |
return @results if @results; |
1782 |
|
1783 |
|
Lines 1807-1813
sub _Findgroupreserve {
Link Here
|
1807 |
$sth->execute($itemnumber, $lookahead||0); |
1808 |
$sth->execute($itemnumber, $lookahead||0); |
1808 |
@results = (); |
1809 |
@results = (); |
1809 |
if ( my $data = $sth->fetchrow_hashref ) { |
1810 |
if ( my $data = $sth->fetchrow_hashref ) { |
1810 |
push( @results, $data ); |
1811 |
push( @results, $data ) |
|
|
1812 |
unless any{ $data->{borrowernumber} eq $_ } @$ignore_borrowers ; |
1811 |
} |
1813 |
} |
1812 |
return @results if @results; |
1814 |
return @results if @results; |
1813 |
|
1815 |
|
Lines 1839-1845
sub _Findgroupreserve {
Link Here
|
1839 |
$sth->execute( $biblio, $bibitem, $itemnumber, $lookahead||0); |
1841 |
$sth->execute( $biblio, $bibitem, $itemnumber, $lookahead||0); |
1840 |
@results = (); |
1842 |
@results = (); |
1841 |
while ( my $data = $sth->fetchrow_hashref ) { |
1843 |
while ( my $data = $sth->fetchrow_hashref ) { |
1842 |
push( @results, $data ); |
1844 |
push( @results, $data ) |
|
|
1845 |
unless any{ $data->{borrowernumber} eq $_ } @$ignore_borrowers ; |
1843 |
} |
1846 |
} |
1844 |
return @results; |
1847 |
return @results; |
1845 |
} |
1848 |
} |