Bug 31907: Show items as On hold when in processing

Test plan:
1. Make sure syspref "opacbookbag" is set to "Allow".
2. Make sure syspref "HoldsNeedProcessingSIP" is set to "Don't fulfill".
3. Place a hold on an item.
4. Return item via SIP at the pickup library.
5. View biblio in Opac.
6. Note that it says "Available" as status.
7. Add biblio to Cart.
8. Open Cart.
9. Note that it says "Available" as status.
10. Apply patch.
11. Reload Opac page.
12. It should now say "On hold".
13. Reload Card page.
14. It should also say "On hold".

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Stefan Berndtsson 2022-10-21 14:10:42 +02:00 committed by Tomas Cohen Arazi
parent c6ddce6b21
commit ce4404002d
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F
4 changed files with 59 additions and 1 deletions

View file

@ -48,6 +48,13 @@ sub waiting {
return $self->search( { found => 'W' } );
}
sub processing {
my ( $self ) = @_;
return $self->search( { found => 'P' } );
}
=head3 unfilled
returns a set of holds that are unfilled from an existing set

View file

@ -61,7 +61,7 @@
to [% Branches.GetName( transfertto ) | html %] since [% transfertwhen | $KohaDates %]</span>
[% END %]
[% IF (item.isa('Koha::Item') AND item.holds.waiting.count) OR (NOT item.isa('Koha::Item') AND item.waiting) %]
[% IF (item.isa('Koha::Item') AND item.holds.waiting.count) OR (item.isa('Koha::Item') AND item.holds.processing.count) OR (NOT item.isa('Koha::Item') AND item.waiting) OR (NOT item.isa('Koha::Item') AND item.processing) %]
[% SET itemavailable = 0 %]
<span class="item-status onhold">On hold</span>
[% END %]

View file

@ -98,6 +98,7 @@ foreach my $biblionumber ( @bibs ) {
foreach my $item (@$items) {
my $reserve_status = C4::Reserves::GetReserveStatus($item->{itemnumber});
if( $reserve_status eq "Waiting"){ $item->{'waiting'} = 1; }
if( $reserve_status eq "Processing"){ $item->{'processing'} = 1; }
}
my $hasauthors = 0;

View file

@ -744,3 +744,53 @@ subtest 'filter_by_has_cancellation_requests() and filter_out_has_cancellation_r
$schema->storage->txn_rollback;
};
subtest 'get holds in processing' => sub {
plan tests => 1;
$schema->storage->txn_begin;
my $patron = $builder->build_object( { class => 'Koha::Patrons' } );
my $item = $builder->build_sample_item;
my $hold_1 = $builder->build_object(
{
class => 'Koha::Holds',
value => {
found => 'P',
itemnumber => $item->id,
biblionumber => $item->biblionumber,
borrowernumber => $patron->id
}
}
);
my $hold_2 = $builder->build_object(
{
class => 'Koha::Holds',
value => {
found => undef,
itemnumber => $item->id,
biblionumber => $item->biblionumber,
borrowernumber => $patron->id
}
}
);
my $hold_3 = $builder->build_object(
{
class => 'Koha::Holds',
value => {
found => undef,
itemnumber => $item->id,
biblionumber => $item->biblionumber,
borrowernumber => $patron->id
}
}
);
my $processing_holds = $item->holds->processing;
is( $processing_holds->count, 1 );
$schema->storage->txn_rollback;
};