|
Lines 1703-1709
sub FixPriority {
Link Here
|
| 1703 |
|
1703 |
|
| 1704 |
# get what's left, sorting lowestPriority holds to the bottom |
1704 |
# get what's left, sorting lowestPriority holds to the bottom |
| 1705 |
my $query = " |
1705 |
my $query = " |
| 1706 |
SELECT reserve_id, borrowernumber, reservedate |
1706 |
SELECT reserve_id, borrowernumber, reservedate, lowestPriority |
| 1707 |
FROM reserves |
1707 |
FROM reserves |
| 1708 |
WHERE biblionumber = ? |
1708 |
WHERE biblionumber = ? |
| 1709 |
AND ((found <> 'W' AND found <> 'T' AND found <> 'P') OR found IS NULL) |
1709 |
AND ((found <> 'W' AND found <> 'T' AND found <> 'P') OR found IS NULL) |
|
Lines 1726-1745
sub FixPriority {
Link Here
|
| 1726 |
} |
1726 |
} |
| 1727 |
} |
1727 |
} |
| 1728 |
|
1728 |
|
| 1729 |
# if this hold is marked lowest priority, we can only move it so far |
1729 |
# if this hold is marked lowest priority, we can only move it so far; |
|
|
1730 |
# cap rank to just after the last non-lowestPriority hold using the |
| 1731 |
# already-fetched @priority array (avoids a second DB query and stale data) |
| 1730 |
if ( $hold && $hold->lowestPriority && $rank ne 'del' && $rank > 0 ) { |
1732 |
if ( $hold && $hold->lowestPriority && $rank ne 'del' && $rank > 0 ) { |
| 1731 |
my $query = " |
1733 |
my $non_lowest_count = scalar grep { !$_->{lowestPriority} } @priority; |
| 1732 |
SELECT max(priority) |
1734 |
$rank = $non_lowest_count + 1 if $non_lowest_count && $rank <= $non_lowest_count; |
| 1733 |
FROM reserves |
|
|
| 1734 |
WHERE biblionumber = ? |
| 1735 |
AND ((found <> 'W' AND found <> 'T' AND found <> 'P') OR found IS NULL) |
| 1736 |
AND lowestPriority = 0; |
| 1737 |
"; |
| 1738 |
my $sth = $dbh->prepare($query); |
| 1739 |
$sth->execute($biblionumber); |
| 1740 |
my ($highest_non_lowest_priority) = $sth->fetchrow_array(); |
| 1741 |
$rank = $highest_non_lowest_priority + 1 |
| 1742 |
if ( $highest_non_lowest_priority && $rank <= $highest_non_lowest_priority ); |
| 1743 |
} |
1735 |
} |
| 1744 |
|
1736 |
|
| 1745 |
# if index exists in array then move it to new position |
1737 |
# if index exists in array then move it to new position |
| 1746 |
- |
|
|