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