Bug 23714

Summary: Problem with ILLModuleUnmediated
Product: Koha Reporter: Magnus Enger <magnus>
Component: ILLAssignee: Bugs List <koha-bugs>
Status: CLOSED FIXED QA Contact:
Severity: minor    
Priority: P5 - low    
Version: Main   
Hardware: All   
OS: All   
GIT URL: Change sponsored?: ---
Patch complexity: --- Documentation contact:
Documentation submission: Text to go in the release notes:
Version(s) released in:
Circulation function:

Description Magnus Enger 2019-10-01 14:56:42 UTC
If you run this:

$ sudo koha-shell -c "prove t/db_dependent/Illrequests.t" kohadev

you get this:

Use of uninitialized value in concatenation (.) or string at /home/vagrant/kohaclone/Koha/Illrequest.pm line 857.
Use of uninitialized value in concatenation (.) or string at /home/vagrant/kohaclone/Koha/Illrequest.pm line 859

(Among some other warnings that are fixed on bug 23712.)

Lines 857 and 859 look like this:

    my $intra_tmpl =  join "/", $backend_tmpl, "intra-includes",
        $params->{method} . ".inc";
    my $opac_tmpl =  join "/", $backend_tmpl, "opac-includes",
        $params->{method} . ".inc";

$params->{method} is uninitialized because of these lines in Koha::Illrequest::backend_create():

    if ( C4::Context->preference("ILLModuleUnmediated") && $permitted ) {
        my $unmediated_result = $self->_backend_capability(
            'unmediated_ill',
            $args
        );
        $result = $unmediated_result if $unmediated_result;
    }

This replaces whatever was in $result. So before this code you can have a $result that looks like this:

$VAR1 = {
          'stage' => 'commit',
          'method' => 'create',
          'permitted' => 1
        };

and after the code it looks like this:

$VAR1 = {
          'unmediated_ill' => 1
        };

Is this the intended behaviour? If no, we should fix it (add 'unmediated_ill' => 1 to the existing data instead of replacing it?). If yes, we should make expandTemplate() handle a missing method more gracefully.
Comment 1 Katrin Fischer 2023-01-13 12:01:44 UTC
There are no longer any warns when running the tests, I assume this has been fixed since.