Lines 712-717
sub GetReserveStatus {
Link Here
|
712 |
|
712 |
|
713 |
if(defined $found) { |
713 |
if(defined $found) { |
714 |
return 'Waiting' if $found eq 'W' and $priority == 0; |
714 |
return 'Waiting' if $found eq 'W' and $priority == 0; |
|
|
715 |
return 'Processing' if $found eq 'P'; |
715 |
return 'Finished' if $found eq 'F'; |
716 |
return 'Finished' if $found eq 'F'; |
716 |
} |
717 |
} |
717 |
|
718 |
|
Lines 826-832
sub CheckReserves {
Link Here
|
826 |
if ( $res->{'itemnumber'} && $res->{'itemnumber'} == $itemnumber && $res->{'priority'} == 0) { |
827 |
if ( $res->{'itemnumber'} && $res->{'itemnumber'} == $itemnumber && $res->{'priority'} == 0) { |
827 |
if ($res->{'found'} eq 'W') { |
828 |
if ($res->{'found'} eq 'W') { |
828 |
return ( "Waiting", $res, \@reserves ); # Found it, it is waiting |
829 |
return ( "Waiting", $res, \@reserves ); # Found it, it is waiting |
829 |
} else { |
830 |
} elsif ($res->{'found'} eq 'P') { |
|
|
831 |
return ( "Processing", $res, \@reserves ); # Found determinated hold, e. g. the tranferred one |
832 |
} else { |
830 |
return ( "Reserved", $res, \@reserves ); # Found determinated hold, e. g. the tranferred one |
833 |
return ( "Reserved", $res, \@reserves ); # Found determinated hold, e. g. the tranferred one |
831 |
} |
834 |
} |
832 |
} else { |
835 |
} else { |
Lines 1154-1160
sub ModReserveAffect {
Link Here
|
1154 |
|
1157 |
|
1155 |
$hold->itemnumber($itemnumber); |
1158 |
$hold->itemnumber($itemnumber); |
1156 |
|
1159 |
|
1157 |
if( !$transferToDo ){ |
1160 |
if ($transferToDo) { |
|
|
1161 |
$hold->set_transfer(); |
1162 |
} elsif (C4::Context->preference('HoldsNeedProcessingSIP') |
1163 |
&& C4::Context->interface eq 'sip' |
1164 |
&& !$already_on_shelf) { |
1165 |
$hold->set_processing(); |
1166 |
} else { |
1158 |
$hold->set_waiting(); |
1167 |
$hold->set_waiting(); |
1159 |
_koha_notify_reserve( $hold->reserve_id ) unless $already_on_shelf; |
1168 |
_koha_notify_reserve( $hold->reserve_id ) unless $already_on_shelf; |
1160 |
my $transfers = Koha::Item::Transfers->search({ |
1169 |
my $transfers = Koha::Item::Transfers->search({ |
Lines 1164-1172
sub ModReserveAffect {
Link Here
|
1164 |
while( my $transfer = $transfers->next ){ |
1173 |
while( my $transfer = $transfers->next ){ |
1165 |
$transfer->datearrived( dt_from_string() )->store; |
1174 |
$transfer->datearrived( dt_from_string() )->store; |
1166 |
}; |
1175 |
}; |
1167 |
} else { |
1176 |
} |
1168 |
$hold->set_transfer(); |
|
|
1169 |
} |
1170 |
|
1177 |
|
1171 |
|
1178 |
|
1172 |
_FixPriority( { biblionumber => $biblionumber } ); |
1179 |
_FixPriority( { biblionumber => $biblionumber } ); |
Lines 1539-1545
sub _FixPriority {
Link Here
|
1539 |
UPDATE reserves |
1546 |
UPDATE reserves |
1540 |
SET priority = 0 |
1547 |
SET priority = 0 |
1541 |
WHERE reserve_id = ? |
1548 |
WHERE reserve_id = ? |
1542 |
AND found IN ('W', 'T') |
1549 |
AND found IN ('W', 'T', 'P') |
1543 |
"; |
1550 |
"; |
1544 |
my $sth = $dbh->prepare($query); |
1551 |
my $sth = $dbh->prepare($query); |
1545 |
$sth->execute( $reserve_id ); |
1552 |
$sth->execute( $reserve_id ); |
Lines 1551-1557
sub _FixPriority {
Link Here
|
1551 |
SELECT reserve_id, borrowernumber, reservedate |
1558 |
SELECT reserve_id, borrowernumber, reservedate |
1552 |
FROM reserves |
1559 |
FROM reserves |
1553 |
WHERE biblionumber = ? |
1560 |
WHERE biblionumber = ? |
1554 |
AND ((found <> 'W' AND found <> 'T') OR found IS NULL) |
1561 |
AND ((found <> 'W' AND found <> 'T' AND found <> 'P') OR found IS NULL) |
1555 |
ORDER BY priority ASC |
1562 |
ORDER BY priority ASC |
1556 |
"; |
1563 |
"; |
1557 |
my $sth = $dbh->prepare($query); |
1564 |
my $sth = $dbh->prepare($query); |
Lines 1963-1969
sub MergeHolds {
Link Here
|
1963 |
"UPDATE reserves SET priority = ? WHERE biblionumber = ? AND borrowernumber = ? |
1970 |
"UPDATE reserves SET priority = ? WHERE biblionumber = ? AND borrowernumber = ? |
1964 |
AND reservedate = ? AND (itemnumber = ? or itemnumber is NULL) " |
1971 |
AND reservedate = ? AND (itemnumber = ? or itemnumber is NULL) " |
1965 |
); |
1972 |
); |
1966 |
$sth->execute( $to_biblio, 'W', 'T' ); |
1973 |
$sth->execute( $to_biblio, 'W', 'T', 'P' ); |
1967 |
my $priority = 1; |
1974 |
my $priority = 1; |
1968 |
while ( my $reserve = $sth->fetchrow_hashref() ) { |
1975 |
while ( my $reserve = $sth->fetchrow_hashref() ) { |
1969 |
$upd_sth->execute( |
1976 |
$upd_sth->execute( |
Lines 2133-2139
sub CalculatePriority {
Link Here
|
2133 |
AND priority > 0 |
2140 |
AND priority > 0 |
2134 |
AND (found IS NULL OR found = '') |
2141 |
AND (found IS NULL OR found = '') |
2135 |
}; |
2142 |
}; |
2136 |
#skip found==W or found==T (waiting or transit holds) |
2143 |
#skip found==W or found==T or found==P (waiting, transit or processing holds) |
2137 |
if( $resdate ) { |
2144 |
if( $resdate ) { |
2138 |
$sql.= ' AND ( reservedate <= ? )'; |
2145 |
$sql.= ' AND ( reservedate <= ? )'; |
2139 |
} |
2146 |
} |