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 859-865
table in the Koha database.
Link Here
|
859 |
=cut |
859 |
=cut |
860 |
|
860 |
|
861 |
sub CheckReserves { |
861 |
sub CheckReserves { |
862 |
my ( $item, $barcode, $lookahead_days) = @_; |
862 |
my ( $item, $barcode, $lookahead_days, $ignore_borrowers) = @_; |
863 |
my $dbh = C4::Context->dbh; |
863 |
my $dbh = C4::Context->dbh; |
864 |
my $sth; |
864 |
my $sth; |
865 |
my $select; |
865 |
my $select; |
Lines 906-912
sub CheckReserves {
Link Here
|
906 |
return ( '' ) if ( $notforloan_per_item > 0 ) or $notforloan_per_itemtype; |
906 |
return ( '' ) if ( $notforloan_per_item > 0 ) or $notforloan_per_itemtype; |
907 |
|
907 |
|
908 |
# Find this item in the reserves |
908 |
# Find this item in the reserves |
909 |
my @reserves = _Findgroupreserve( $bibitem, $biblio, $itemnumber, $lookahead_days); |
909 |
my @reserves = _Findgroupreserve( $bibitem, $biblio, $itemnumber, $lookahead_days, $ignore_borrowers); |
910 |
|
910 |
|
911 |
# $priority and $highest are used to find the most important item |
911 |
# $priority and $highest are used to find the most important item |
912 |
# in the list returned by &_Findgroupreserve. (The lower $priority, |
912 |
# in the list returned by &_Findgroupreserve. (The lower $priority, |
Lines 1740-1746
sub _FixPriority {
Link Here
|
1740 |
|
1740 |
|
1741 |
=head2 _Findgroupreserve |
1741 |
=head2 _Findgroupreserve |
1742 |
|
1742 |
|
1743 |
@results = &_Findgroupreserve($biblioitemnumber, $biblionumber, $itemnumber, $lookahead); |
1743 |
@results = &_Findgroupreserve($biblioitemnumber, $biblionumber, $itemnumber, $lookahead, $ignore_borrowers); |
1744 |
|
1744 |
|
1745 |
Looks for an item-specific match first, then for a title-level match, returning the |
1745 |
Looks for an item-specific match first, then for a title-level match, returning the |
1746 |
first match found. If neither, then we look for a 3rd kind of match based on |
1746 |
first match found. If neither, then we look for a 3rd kind of match based on |
Lines 1757-1763
C<biblioitemnumber>.
Link Here
|
1757 |
=cut |
1757 |
=cut |
1758 |
|
1758 |
|
1759 |
sub _Findgroupreserve { |
1759 |
sub _Findgroupreserve { |
1760 |
my ( $bibitem, $biblio, $itemnumber, $lookahead) = @_; |
1760 |
my ( $bibitem, $biblio, $itemnumber, $lookahead, $ignore_borrowers) = @_; |
1761 |
my $dbh = C4::Context->dbh; |
1761 |
my $dbh = C4::Context->dbh; |
1762 |
|
1762 |
|
1763 |
# TODO: consolidate at least the SELECT portion of the first 2 queries to a common $select var. |
1763 |
# TODO: consolidate at least the SELECT portion of the first 2 queries to a common $select var. |
Lines 1789-1795
sub _Findgroupreserve {
Link Here
|
1789 |
$sth->execute($itemnumber, $lookahead||0); |
1789 |
$sth->execute($itemnumber, $lookahead||0); |
1790 |
my @results; |
1790 |
my @results; |
1791 |
if ( my $data = $sth->fetchrow_hashref ) { |
1791 |
if ( my $data = $sth->fetchrow_hashref ) { |
1792 |
push( @results, $data ); |
1792 |
push( @results, $data ) |
|
|
1793 |
unless any{ $data->{borrowernumber} eq $_ } @$ignore_borrowers ; |
1793 |
} |
1794 |
} |
1794 |
return @results if @results; |
1795 |
return @results if @results; |
1795 |
|
1796 |
|
Lines 1820-1826
sub _Findgroupreserve {
Link Here
|
1820 |
$sth->execute($itemnumber, $lookahead||0); |
1821 |
$sth->execute($itemnumber, $lookahead||0); |
1821 |
@results = (); |
1822 |
@results = (); |
1822 |
if ( my $data = $sth->fetchrow_hashref ) { |
1823 |
if ( my $data = $sth->fetchrow_hashref ) { |
1823 |
push( @results, $data ); |
1824 |
push( @results, $data ) |
|
|
1825 |
unless any{ $data->{borrowernumber} eq $_ } @$ignore_borrowers ; |
1824 |
} |
1826 |
} |
1825 |
return @results if @results; |
1827 |
return @results if @results; |
1826 |
|
1828 |
|
Lines 1852-1858
sub _Findgroupreserve {
Link Here
|
1852 |
$sth->execute( $biblio, $bibitem, $itemnumber, $lookahead||0); |
1854 |
$sth->execute( $biblio, $bibitem, $itemnumber, $lookahead||0); |
1853 |
@results = (); |
1855 |
@results = (); |
1854 |
while ( my $data = $sth->fetchrow_hashref ) { |
1856 |
while ( my $data = $sth->fetchrow_hashref ) { |
1855 |
push( @results, $data ); |
1857 |
push( @results, $data ) |
|
|
1858 |
unless any{ $data->{borrowernumber} eq $_ } @$ignore_borrowers ; |
1856 |
} |
1859 |
} |
1857 |
return @results; |
1860 |
return @results; |
1858 |
} |
1861 |
} |