Lines 41-47
use Koha::DateUtils;
Link Here
|
41 |
use Koha::Calendar; |
41 |
use Koha::Calendar; |
42 |
use Koha::Database; |
42 |
use Koha::Database; |
43 |
|
43 |
|
44 |
use List::MoreUtils qw( firstidx ); |
44 |
use List::MoreUtils qw( firstidx any ); |
45 |
|
45 |
|
46 |
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); |
46 |
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); |
47 |
|
47 |
|
Lines 879-885
table in the Koha database.
Link Here
|
879 |
=cut |
879 |
=cut |
880 |
|
880 |
|
881 |
sub CheckReserves { |
881 |
sub CheckReserves { |
882 |
my ( $item, $barcode, $lookahead_days) = @_; |
882 |
my ( $item, $barcode, $lookahead_days, $ignore_borrowers) = @_; |
883 |
my $dbh = C4::Context->dbh; |
883 |
my $dbh = C4::Context->dbh; |
884 |
my $sth; |
884 |
my $sth; |
885 |
my $select; |
885 |
my $select; |
Lines 930-936
sub CheckReserves {
Link Here
|
930 |
return if ( $notforloan_per_item > 0 ) or $notforloan_per_itemtype; |
930 |
return if ( $notforloan_per_item > 0 ) or $notforloan_per_itemtype; |
931 |
|
931 |
|
932 |
# Find this item in the reserves |
932 |
# Find this item in the reserves |
933 |
my @reserves = _Findgroupreserve( $bibitem, $biblio, $itemnumber, $lookahead_days); |
933 |
my @reserves = _Findgroupreserve( $bibitem, $biblio, $itemnumber, $lookahead_days, $ignore_borrowers); |
934 |
|
934 |
|
935 |
# $priority and $highest are used to find the most important item |
935 |
# $priority and $highest are used to find the most important item |
936 |
# in the list returned by &_Findgroupreserve. (The lower $priority, |
936 |
# in the list returned by &_Findgroupreserve. (The lower $priority, |
Lines 1785-1791
sub _FixPriority {
Link Here
|
1785 |
|
1785 |
|
1786 |
=head2 _Findgroupreserve |
1786 |
=head2 _Findgroupreserve |
1787 |
|
1787 |
|
1788 |
@results = &_Findgroupreserve($biblioitemnumber, $biblionumber, $itemnumber, $lookahead); |
1788 |
@results = &_Findgroupreserve($biblioitemnumber, $biblionumber, $itemnumber, $lookahead, $ignore_borrowers); |
1789 |
|
1789 |
|
1790 |
Looks for an item-specific match first, then for a title-level match, returning the |
1790 |
Looks for an item-specific match first, then for a title-level match, returning the |
1791 |
first match found. If neither, then we look for a 3rd kind of match based on |
1791 |
first match found. If neither, then we look for a 3rd kind of match based on |
Lines 1802-1808
C<biblioitemnumber>.
Link Here
|
1802 |
=cut |
1802 |
=cut |
1803 |
|
1803 |
|
1804 |
sub _Findgroupreserve { |
1804 |
sub _Findgroupreserve { |
1805 |
my ( $bibitem, $biblio, $itemnumber, $lookahead) = @_; |
1805 |
my ( $bibitem, $biblio, $itemnumber, $lookahead, $ignore_borrowers) = @_; |
1806 |
my $dbh = C4::Context->dbh; |
1806 |
my $dbh = C4::Context->dbh; |
1807 |
|
1807 |
|
1808 |
# TODO: consolidate at least the SELECT portion of the first 2 queries to a common $select var. |
1808 |
# TODO: consolidate at least the SELECT portion of the first 2 queries to a common $select var. |
Lines 1834-1840
sub _Findgroupreserve {
Link Here
|
1834 |
$sth->execute($itemnumber, $lookahead||0); |
1834 |
$sth->execute($itemnumber, $lookahead||0); |
1835 |
my @results; |
1835 |
my @results; |
1836 |
if ( my $data = $sth->fetchrow_hashref ) { |
1836 |
if ( my $data = $sth->fetchrow_hashref ) { |
1837 |
push( @results, $data ); |
1837 |
push( @results, $data ) |
|
|
1838 |
unless any{ $data->{borrowernumber} eq $_ } @$ignore_borrowers ; |
1838 |
} |
1839 |
} |
1839 |
return @results if @results; |
1840 |
return @results if @results; |
1840 |
|
1841 |
|
Lines 1866-1872
sub _Findgroupreserve {
Link Here
|
1866 |
$sth->execute($itemnumber, $lookahead||0); |
1867 |
$sth->execute($itemnumber, $lookahead||0); |
1867 |
@results = (); |
1868 |
@results = (); |
1868 |
if ( my $data = $sth->fetchrow_hashref ) { |
1869 |
if ( my $data = $sth->fetchrow_hashref ) { |
1869 |
push( @results, $data ); |
1870 |
push( @results, $data ) |
|
|
1871 |
unless any{ $data->{borrowernumber} eq $_ } @$ignore_borrowers ; |
1870 |
} |
1872 |
} |
1871 |
return @results if @results; |
1873 |
return @results if @results; |
1872 |
|
1874 |
|
Lines 1899-1905
sub _Findgroupreserve {
Link Here
|
1899 |
$sth->execute( $biblio, $bibitem, $itemnumber, $lookahead||0); |
1901 |
$sth->execute( $biblio, $bibitem, $itemnumber, $lookahead||0); |
1900 |
@results = (); |
1902 |
@results = (); |
1901 |
while ( my $data = $sth->fetchrow_hashref ) { |
1903 |
while ( my $data = $sth->fetchrow_hashref ) { |
1902 |
push( @results, $data ); |
1904 |
push( @results, $data ) |
|
|
1905 |
unless any{ $data->{borrowernumber} eq $_ } @$ignore_borrowers ; |
1903 |
} |
1906 |
} |
1904 |
return @results; |
1907 |
return @results; |
1905 |
} |
1908 |
} |