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 1155-1161
sub ModReserveAffect {
Link Here
|
1155 |
|
1158 |
|
1156 |
$hold->itemnumber($itemnumber); |
1159 |
$hold->itemnumber($itemnumber); |
1157 |
|
1160 |
|
1158 |
if( !$transferToDo ){ |
1161 |
if ($transferToDo) { |
|
|
1162 |
$hold->set_transfer(); |
1163 |
} elsif (C4::Context->preference('HoldsNeedProcessingSIP') |
1164 |
&& C4::Context->interface eq 'sip' |
1165 |
&& !$already_on_shelf) { |
1166 |
$hold->set_processing(); |
1167 |
} else { |
1159 |
$hold->set_waiting(); |
1168 |
$hold->set_waiting(); |
1160 |
_koha_notify_reserve( $hold->reserve_id ) unless $already_on_shelf; |
1169 |
_koha_notify_reserve( $hold->reserve_id ) unless $already_on_shelf; |
1161 |
my $transfers = Koha::Item::Transfers->search({ |
1170 |
my $transfers = Koha::Item::Transfers->search({ |
Lines 1165-1173
sub ModReserveAffect {
Link Here
|
1165 |
while( my $transfer = $transfers->next ){ |
1174 |
while( my $transfer = $transfers->next ){ |
1166 |
$transfer->datearrived( dt_from_string() )->store; |
1175 |
$transfer->datearrived( dt_from_string() )->store; |
1167 |
}; |
1176 |
}; |
1168 |
} else { |
1177 |
} |
1169 |
$hold->set_transfer(); |
|
|
1170 |
} |
1171 |
|
1178 |
|
1172 |
|
1179 |
|
1173 |
_FixPriority( { biblionumber => $biblionumber } ); |
1180 |
_FixPriority( { biblionumber => $biblionumber } ); |
Lines 1546-1552
sub _FixPriority {
Link Here
|
1546 |
UPDATE reserves |
1553 |
UPDATE reserves |
1547 |
SET priority = 0 |
1554 |
SET priority = 0 |
1548 |
WHERE reserve_id = ? |
1555 |
WHERE reserve_id = ? |
1549 |
AND found IN ('W', 'T') |
1556 |
AND found IN ('W', 'T', 'P') |
1550 |
"; |
1557 |
"; |
1551 |
my $sth = $dbh->prepare($query); |
1558 |
my $sth = $dbh->prepare($query); |
1552 |
$sth->execute( $reserve_id ); |
1559 |
$sth->execute( $reserve_id ); |
Lines 1558-1564
sub _FixPriority {
Link Here
|
1558 |
SELECT reserve_id, borrowernumber, reservedate |
1565 |
SELECT reserve_id, borrowernumber, reservedate |
1559 |
FROM reserves |
1566 |
FROM reserves |
1560 |
WHERE biblionumber = ? |
1567 |
WHERE biblionumber = ? |
1561 |
AND ((found <> 'W' AND found <> 'T') OR found IS NULL) |
1568 |
AND ((found <> 'W' AND found <> 'T' AND found <> 'P') OR found IS NULL) |
1562 |
ORDER BY priority ASC |
1569 |
ORDER BY priority ASC |
1563 |
"; |
1570 |
"; |
1564 |
my $sth = $dbh->prepare($query); |
1571 |
my $sth = $dbh->prepare($query); |
Lines 1970-1976
sub MergeHolds {
Link Here
|
1970 |
"UPDATE reserves SET priority = ? WHERE biblionumber = ? AND borrowernumber = ? |
1977 |
"UPDATE reserves SET priority = ? WHERE biblionumber = ? AND borrowernumber = ? |
1971 |
AND reservedate = ? AND (itemnumber = ? or itemnumber is NULL) " |
1978 |
AND reservedate = ? AND (itemnumber = ? or itemnumber is NULL) " |
1972 |
); |
1979 |
); |
1973 |
$sth->execute( $to_biblio, 'W', 'T' ); |
1980 |
$sth->execute( $to_biblio, 'W', 'T', 'P' ); |
1974 |
my $priority = 1; |
1981 |
my $priority = 1; |
1975 |
while ( my $reserve = $sth->fetchrow_hashref() ) { |
1982 |
while ( my $reserve = $sth->fetchrow_hashref() ) { |
1976 |
$upd_sth->execute( |
1983 |
$upd_sth->execute( |
Lines 2140-2146
sub CalculatePriority {
Link Here
|
2140 |
AND priority > 0 |
2147 |
AND priority > 0 |
2141 |
AND (found IS NULL OR found = '') |
2148 |
AND (found IS NULL OR found = '') |
2142 |
}; |
2149 |
}; |
2143 |
#skip found==W or found==T (waiting or transit holds) |
2150 |
#skip found==W or found==T or found==P (waiting, transit or processing holds) |
2144 |
if( $resdate ) { |
2151 |
if( $resdate ) { |
2145 |
$sql.= ' AND ( reservedate <= ? )'; |
2152 |
$sql.= ' AND ( reservedate <= ? )'; |
2146 |
} |
2153 |
} |