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 904-910
table in the Koha database.
Link Here
|
904 |
=cut |
904 |
=cut |
905 |
|
905 |
|
906 |
sub CheckReserves { |
906 |
sub CheckReserves { |
907 |
my ( $item, $barcode, $lookahead_days) = @_; |
907 |
my ( $item, $barcode, $lookahead_days, $ignore_borrowers) = @_; |
908 |
my $dbh = C4::Context->dbh; |
908 |
my $dbh = C4::Context->dbh; |
909 |
my $sth; |
909 |
my $sth; |
910 |
my $select; |
910 |
my $select; |
Lines 955-961
sub CheckReserves {
Link Here
|
955 |
return if ( $notforloan_per_item > 0 ) or $notforloan_per_itemtype; |
955 |
return if ( $notforloan_per_item > 0 ) or $notforloan_per_itemtype; |
956 |
|
956 |
|
957 |
# Find this item in the reserves |
957 |
# Find this item in the reserves |
958 |
my @reserves = _Findgroupreserve( $bibitem, $biblio, $itemnumber, $lookahead_days); |
958 |
my @reserves = _Findgroupreserve( $bibitem, $biblio, $itemnumber, $lookahead_days, $ignore_borrowers); |
959 |
|
959 |
|
960 |
# $priority and $highest are used to find the most important item |
960 |
# $priority and $highest are used to find the most important item |
961 |
# in the list returned by &_Findgroupreserve. (The lower $priority, |
961 |
# in the list returned by &_Findgroupreserve. (The lower $priority, |
Lines 1813-1819
sub _FixPriority {
Link Here
|
1813 |
|
1813 |
|
1814 |
=head2 _Findgroupreserve |
1814 |
=head2 _Findgroupreserve |
1815 |
|
1815 |
|
1816 |
@results = &_Findgroupreserve($biblioitemnumber, $biblionumber, $itemnumber, $lookahead); |
1816 |
@results = &_Findgroupreserve($biblioitemnumber, $biblionumber, $itemnumber, $lookahead, $ignore_borrowers); |
1817 |
|
1817 |
|
1818 |
Looks for an item-specific match first, then for a title-level match, returning the |
1818 |
Looks for an item-specific match first, then for a title-level match, returning the |
1819 |
first match found. If neither, then we look for a 3rd kind of match based on |
1819 |
first match found. If neither, then we look for a 3rd kind of match based on |
Lines 1830-1836
C<biblioitemnumber>.
Link Here
|
1830 |
=cut |
1830 |
=cut |
1831 |
|
1831 |
|
1832 |
sub _Findgroupreserve { |
1832 |
sub _Findgroupreserve { |
1833 |
my ( $bibitem, $biblio, $itemnumber, $lookahead) = @_; |
1833 |
my ( $bibitem, $biblio, $itemnumber, $lookahead, $ignore_borrowers) = @_; |
1834 |
my $dbh = C4::Context->dbh; |
1834 |
my $dbh = C4::Context->dbh; |
1835 |
|
1835 |
|
1836 |
# TODO: consolidate at least the SELECT portion of the first 2 queries to a common $select var. |
1836 |
# TODO: consolidate at least the SELECT portion of the first 2 queries to a common $select var. |
Lines 1862-1868
sub _Findgroupreserve {
Link Here
|
1862 |
$sth->execute($itemnumber, $lookahead||0); |
1862 |
$sth->execute($itemnumber, $lookahead||0); |
1863 |
my @results; |
1863 |
my @results; |
1864 |
if ( my $data = $sth->fetchrow_hashref ) { |
1864 |
if ( my $data = $sth->fetchrow_hashref ) { |
1865 |
push( @results, $data ); |
1865 |
push( @results, $data ) |
|
|
1866 |
unless any{ $data->{borrowernumber} eq $_ } @$ignore_borrowers ; |
1866 |
} |
1867 |
} |
1867 |
return @results if @results; |
1868 |
return @results if @results; |
1868 |
|
1869 |
|
Lines 1894-1900
sub _Findgroupreserve {
Link Here
|
1894 |
$sth->execute($itemnumber, $lookahead||0); |
1895 |
$sth->execute($itemnumber, $lookahead||0); |
1895 |
@results = (); |
1896 |
@results = (); |
1896 |
if ( my $data = $sth->fetchrow_hashref ) { |
1897 |
if ( my $data = $sth->fetchrow_hashref ) { |
1897 |
push( @results, $data ); |
1898 |
push( @results, $data ) |
|
|
1899 |
unless any{ $data->{borrowernumber} eq $_ } @$ignore_borrowers ; |
1898 |
} |
1900 |
} |
1899 |
return @results if @results; |
1901 |
return @results if @results; |
1900 |
|
1902 |
|
Lines 1927-1933
sub _Findgroupreserve {
Link Here
|
1927 |
$sth->execute( $biblio, $bibitem, $itemnumber, $lookahead||0); |
1929 |
$sth->execute( $biblio, $bibitem, $itemnumber, $lookahead||0); |
1928 |
@results = (); |
1930 |
@results = (); |
1929 |
while ( my $data = $sth->fetchrow_hashref ) { |
1931 |
while ( my $data = $sth->fetchrow_hashref ) { |
1930 |
push( @results, $data ); |
1932 |
push( @results, $data ) |
|
|
1933 |
unless any{ $data->{borrowernumber} eq $_ } @$ignore_borrowers ; |
1931 |
} |
1934 |
} |
1932 |
return @results; |
1935 |
return @results; |
1933 |
} |
1936 |
} |