|
Lines 60-65
BEGIN {
Link Here
|
| 60 |
GetMaxPatronHoldsForRecord |
60 |
GetMaxPatronHoldsForRecord |
| 61 |
|
61 |
|
| 62 |
MergeHolds |
62 |
MergeHolds |
|
|
63 |
|
| 64 |
FixPriority |
| 63 |
); |
65 |
); |
| 64 |
} |
66 |
} |
| 65 |
|
67 |
|
|
Lines 290-296
sub AddReserve {
Link Here
|
| 290 |
ChargeReserveFee( $borrowernumber, $reserve_fee, $title ); |
292 |
ChargeReserveFee( $borrowernumber, $reserve_fee, $title ); |
| 291 |
} |
293 |
} |
| 292 |
|
294 |
|
| 293 |
_FixPriority( { biblionumber => $biblionumber } ); |
295 |
FixPriority( { biblionumber => $biblionumber } ); |
| 294 |
|
296 |
|
| 295 |
# Send e-mail to librarian if syspref is active |
297 |
# Send e-mail to librarian if syspref is active |
| 296 |
if ( C4::Context->preference("emailLibrarianWhenHoldIsPlaced") ) { |
298 |
if ( C4::Context->preference("emailLibrarianWhenHoldIsPlaced") ) { |
|
Lines 1219-1224
sub ModReserve {
Link Here
|
| 1219 |
my $biblionumber = $params->{'biblionumber'}; |
1221 |
my $biblionumber = $params->{'biblionumber'}; |
| 1220 |
my $cancellation_reason = $params->{'cancellation_reason'}; |
1222 |
my $cancellation_reason = $params->{'cancellation_reason'}; |
| 1221 |
my $date = $params->{expirationdate}; |
1223 |
my $date = $params->{expirationdate}; |
|
|
1224 |
my $skip_fixup_priority = $params->{skip_fixup_priority}; |
| 1222 |
|
1225 |
|
| 1223 |
return if defined $rank && $rank eq "n"; |
1226 |
return if defined $rank && $rank eq "n"; |
| 1224 |
|
1227 |
|
|
Lines 1277-1283
sub ModReserve {
Link Here
|
| 1277 |
} |
1280 |
} |
| 1278 |
} |
1281 |
} |
| 1279 |
|
1282 |
|
| 1280 |
_FixPriority( { reserve_id => $reserve_id, rank => $rank } ); |
1283 |
FixPriority( { reserve_id => $reserve_id, rank => $rank } ) unless $skip_fixup_priority; |
| 1281 |
|
1284 |
|
| 1282 |
logaction( 'HOLDS', 'MODIFY', $hold->reserve_id, $hold, undef, $original ) |
1285 |
logaction( 'HOLDS', 'MODIFY', $hold->reserve_id, $hold, undef, $original ) |
| 1283 |
if C4::Context->preference('HoldsLog'); |
1286 |
if C4::Context->preference('HoldsLog'); |
|
Lines 1390-1396
sub ModReserveAffect {
Link Here
|
| 1390 |
|
1393 |
|
| 1391 |
_koha_notify_hold_changed($hold) if $notify_library; |
1394 |
_koha_notify_hold_changed($hold) if $notify_library; |
| 1392 |
|
1395 |
|
| 1393 |
_FixPriority( { biblionumber => $biblionumber } ); |
1396 |
FixPriority( { biblionumber => $biblionumber } ); |
| 1394 |
my $item = Koha::Items->find($itemnumber); |
1397 |
my $item = Koha::Items->find($itemnumber); |
| 1395 |
if ( $item->location |
1398 |
if ( $item->location |
| 1396 |
&& $item->location eq 'CART' |
1399 |
&& $item->location eq 'CART' |
|
Lines 1477-1483
sub ModReserveMinusPriority {
Link Here
|
| 1477 |
$sth_upd->execute( $itemnumber, $reserve_id ); |
1480 |
$sth_upd->execute( $itemnumber, $reserve_id ); |
| 1478 |
|
1481 |
|
| 1479 |
# second step update all others reserves |
1482 |
# second step update all others reserves |
| 1480 |
_FixPriority( { reserve_id => $reserve_id, rank => '0' } ); |
1483 |
FixPriority( { reserve_id => $reserve_id, rank => '0' } ); |
| 1481 |
} |
1484 |
} |
| 1482 |
|
1485 |
|
| 1483 |
=head2 IsAvailableForItemLevelRequest |
1486 |
=head2 IsAvailableForItemLevelRequest |
|
Lines 1634-1647
sub AlterPriority {
Link Here
|
| 1634 |
|
1637 |
|
| 1635 |
if ( $where eq 'up' ) { |
1638 |
if ( $where eq 'up' ) { |
| 1636 |
return unless $prev_priority; |
1639 |
return unless $prev_priority; |
| 1637 |
_FixPriority( { reserve_id => $reserve_id, rank => $prev_priority } ); |
1640 |
FixPriority( { reserve_id => $reserve_id, rank => $prev_priority } ); |
| 1638 |
} elsif ( $where eq 'down' ) { |
1641 |
} elsif ( $where eq 'down' ) { |
| 1639 |
return unless $next_priority; |
1642 |
return unless $next_priority; |
| 1640 |
_FixPriority( { reserve_id => $reserve_id, rank => $next_priority } ); |
1643 |
FixPriority( { reserve_id => $reserve_id, rank => $next_priority } ); |
| 1641 |
} elsif ( $where eq 'top' ) { |
1644 |
} elsif ( $where eq 'top' ) { |
| 1642 |
_FixPriority( { reserve_id => $reserve_id, rank => $first_priority } ); |
1645 |
FixPriority( { reserve_id => $reserve_id, rank => $first_priority } ); |
| 1643 |
} elsif ( $where eq 'bottom' ) { |
1646 |
} elsif ( $where eq 'bottom' ) { |
| 1644 |
_FixPriority( { reserve_id => $reserve_id, rank => $last_priority } ); |
1647 |
FixPriority( { reserve_id => $reserve_id, rank => $last_priority } ); |
| 1645 |
} |
1648 |
} |
| 1646 |
|
1649 |
|
| 1647 |
Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue->new->enqueue( { biblio_ids => [ $hold->biblionumber ] } ) |
1650 |
Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue->new->enqueue( { biblio_ids => [ $hold->biblionumber ] } ) |
|
Lines 1666-1672
sub ToggleLowestPriority {
Link Here
|
| 1666 |
my $sth = $dbh->prepare("UPDATE reserves SET lowestPriority = NOT lowestPriority WHERE reserve_id = ?"); |
1669 |
my $sth = $dbh->prepare("UPDATE reserves SET lowestPriority = NOT lowestPriority WHERE reserve_id = ?"); |
| 1667 |
$sth->execute($reserve_id); |
1670 |
$sth->execute($reserve_id); |
| 1668 |
|
1671 |
|
| 1669 |
_FixPriority( { reserve_id => $reserve_id, rank => '999999' } ); |
1672 |
FixPriority( { reserve_id => $reserve_id, rank => '999999' } ); |
| 1670 |
} |
1673 |
} |
| 1671 |
|
1674 |
|
| 1672 |
=head2 SuspendAll |
1675 |
=head2 SuspendAll |
|
Lines 1709-1717
sub SuspendAll {
Link Here
|
| 1709 |
} |
1712 |
} |
| 1710 |
} |
1713 |
} |
| 1711 |
|
1714 |
|
| 1712 |
=head2 _FixPriority |
1715 |
=head2 FixPriority |
| 1713 |
|
1716 |
|
| 1714 |
_FixPriority({ |
1717 |
FixPriority({ |
| 1715 |
reserve_id => $reserve_id, |
1718 |
reserve_id => $reserve_id, |
| 1716 |
[rank => $rank,] |
1719 |
[rank => $rank,] |
| 1717 |
[ignoreSetLowestRank => $ignoreSetLowestRank] |
1720 |
[ignoreSetLowestRank => $ignoreSetLowestRank] |
|
Lines 1719-1725
sub SuspendAll {
Link Here
|
| 1719 |
|
1722 |
|
| 1720 |
or |
1723 |
or |
| 1721 |
|
1724 |
|
| 1722 |
_FixPriority({ biblionumber => $biblionumber}); |
1725 |
FixPriority({ biblionumber => $biblionumber}); |
| 1723 |
|
1726 |
|
| 1724 |
This routine adjusts the priority of a hold request and holds |
1727 |
This routine adjusts the priority of a hold request and holds |
| 1725 |
on the same bib. |
1728 |
on the same bib. |
|
Lines 1740-1750
In both cases, holds that have the lowestPriority flag on are have their
Link Here
|
| 1740 |
priority adjusted to ensure that they remain at the end of the line. |
1743 |
priority adjusted to ensure that they remain at the end of the line. |
| 1741 |
|
1744 |
|
| 1742 |
Note that the ignoreSetLowestRank parameter is meant to be used only |
1745 |
Note that the ignoreSetLowestRank parameter is meant to be used only |
| 1743 |
when _FixPriority calls itself. |
1746 |
when FixPriority calls itself. |
| 1744 |
|
1747 |
|
| 1745 |
=cut |
1748 |
=cut |
| 1746 |
|
1749 |
|
| 1747 |
sub _FixPriority { |
1750 |
sub FixPriority { |
| 1748 |
my ($params) = @_; |
1751 |
my ($params) = @_; |
| 1749 |
my $reserve_id = $params->{reserve_id}; |
1752 |
my $reserve_id = $params->{reserve_id}; |
| 1750 |
my $rank = $params->{rank} // ''; |
1753 |
my $rank = $params->{rank} // ''; |
|
Lines 1837-1843
sub _FixPriority {
Link Here
|
| 1837 |
"SELECT reserve_id FROM reserves WHERE lowestPriority = 1 AND biblionumber = ? ORDER BY priority"); |
1840 |
"SELECT reserve_id FROM reserves WHERE lowestPriority = 1 AND biblionumber = ? ORDER BY priority"); |
| 1838 |
$sth->execute($biblionumber); |
1841 |
$sth->execute($biblionumber); |
| 1839 |
while ( my $res = $sth->fetchrow_hashref() ) { |
1842 |
while ( my $res = $sth->fetchrow_hashref() ) { |
| 1840 |
_FixPriority( |
1843 |
FixPriority( |
| 1841 |
{ |
1844 |
{ |
| 1842 |
reserve_id => $res->{'reserve_id'}, |
1845 |
reserve_id => $res->{'reserve_id'}, |
| 1843 |
rank => '999999', |
1846 |
rank => '999999', |