Bug 37448: Add build_sample_ill_request

The linked biblio_id of a generated test ILL request needs to be created by build_sample_biblio->AddBiblio.
Or else the related biblio is created by just 'build' and is not indexed + its related metadata is missing.

To test:
1) Apply the [DONT PUSH] patch and enable ILLModule
2) Run the script for ILL requests:
  misc/devel/create_test_data.pl -n 5 -s Illrequest -d backend=Standard
3) Visit the ILLModule:
  http://<intra_url>/cgi-bin/koha/ill/ill-requests.pl
4) Notice it loads 5 test ILL requests correctly

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Pedro Amorim 2024-07-24 13:45:05 +00:00 committed by Katrin Fischer
parent 576621a6df
commit c42cfecd43
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
1 changed files with 34 additions and 0 deletions

View File

@ -210,6 +210,40 @@ sub build_sample_item {
)->store->get_from_storage;
}
=pod
=head2 build_sample_ill_request
Builds a sample ILL request with the supplied arguments.
C<$args> is a hashref with the following optional keys:
=over 4
=item * C<biblio_id> (default: a new sample biblio created with L<build_sample_biblio>)
=item * C<backend> (default: Standard)
=item * C<branchcode> (default: a random branch)
=back
=cut
sub build_sample_ill_request {
my ( $self, $args ) = @_;
$args->{biblio_id} = $args->{biblio_id} || $self->build_sample_biblio->biblionumber;
$args->{backend} = $args->{backend} || 'Standard';
$args->{branchcode} = $args->{branchcode} || $self->build_object( { class => 'Koha::Libraries' } )->branchcode;
return $self->build_object(
{
class => 'Koha::ILL::Requests',
value => $args,
}
)->store->get_from_storage;
}
# ------------------------------------------------------------------------------
# Internal helper routines