Bug 20001

Summary: ILL: Adding a 'new request' from OPAC is not possible
Product: Koha Reporter: Katrin Fischer <katrin.fischer>
Component: ILLAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact:
Severity: blocker    
Priority: P5 - low CC: fridolin.somers, jonathan.druart, jonathan.field, mtompset, nick, oha
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on: 7317    
Bug Blocks:    
Attachments: Bug 20001: Fix confusion between array and arrayref
Bug 20001: Fix confusion between array and arrayref
Bug 20001: Fix confusion between array and arrayref
Bug 20001: Fix confusion between array and arrayref

Description Katrin Fischer 2018-01-17 07:19:02 UTC
The button to add a 'new request' from the OPAC doesn't work, it doesn't matter if there is one or multiple backends installed:

http://localhost:8080/cgi-bin/koha/opac-illrequests.pl?method=create&backend=ARRAY(0xa943760)

Internal server error

Can't locate Koha/Illbackends/ARRAY(0xb154640)/Base.pm in @INC (you may need to install the Koha::Illbackends::ARRAY(0xb154640)::Base module) (@INC contains: /home/vagrant/kohaclone /home/vagrant/kohaclone/installer /home/vagrant/kohaclone/lib/installer /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.20.2 /usr/local/share/perl/5.20.2 /usr/lib/x86_64-linux-gnu/perl5/5.20 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.20 /usr/share/perl/5.20 /usr/local/lib/site_perl .) at /home/vagrant/kohaclone/Koha/Illrequest.pm line 153.

When there are mulitple backends installed the button is a menu on the staff side that lets you pick, what you want to do. I think the same should probably happen on the OPAC.

Marking critical for ILL.
Comment 1 Katrin Fischer 2018-01-17 07:22:49 UTC
Actually it's the same from the staff side. The button is nicer, but once you click on it, it breaks:

Button:
http://localhost:8081/cgi-bin/koha/ill/ill-requests.pl?method=create&backend=FreeForm

Internal server error

Template process failed: file error - : not found at /home/vagrant/kohaclone/C4/Templates.pm line 122.
Comment 2 Katrin Fischer 2018-01-17 07:33:39 UTC
I've followed installation instructions on bug 20001 comment20
Comment 3 Francesco Rivetti 2018-01-17 08:55:00 UTC
in our implementation (NNCIP) the creation of a new request come from a xml requests on a different component.

The backend properly create the request and everything else work reasonably fine.

It's probable than that the issue is on the user interface

HTH
Comment 4 Victor Grousset/tuxayo 2018-01-17 08:56:58 UTC
(In reply to Katrin Fischer from comment #2)
> I've followed installation instructions on bug 20001 comment20

bug 20001 comment20?

20001 is this bug and there aren't 20 comments.
Comment 5 Katrin Fischer 2018-01-17 10:25:42 UTC
Sorry, bug 7317 comment 20

I have tested on master, maybe it works on 17.11? I haven't had time to verify this yet.

The problem appears in the GUI, I think your .it implementation is not listed on the wiki, so can't test. Dummy and FreeForm don't work.
Comment 6 Katrin Fischer 2018-01-18 06:19:40 UTC
Sorry, silly me. I don't know exactly what happened yet, but I somehow managed to end up with empty Illbackends directories after the initial cloning (had checked contents then). So it's right, Base.pm was absolutely not there. I think some unintentional git magic.

There is no RESOLVED SILLYME, so picking INVALID :)
Comment 7 Katrin Fischer 2018-01-18 06:28:31 UTC
The problem with the broken button in OPAC remains:

http://localhost:8080/cgi-bin/koha/opac-illrequests.pl?method=create&backend=ARRAY(0xa943760)
Comment 8 Katrin Fischer 2018-01-18 07:04:52 UTC
This appears to get the split button in OPAC working, not a good fix, but a clue on how to fix it maybe:

                     <div id="illrequests-create-button" class="dropdown btn-group">
-                        [% IF backends.size > 1 %]
+                        [% IF backends.0.size > 1 %]
[...]

Now stuck with:
Template process failed: file error - : not found at /home/vagrant/kohaclone/C4/Templates.pm line 122.
Comment 9 Jonathan Druart 2018-01-18 15:50:04 UTC
Created attachment 70696 [details] [review]
Bug 20001: Fix confusion between array and arrayref

Illrequest->available_backends always returned only 1 element
Comment 10 Mark Tompsett 2018-01-18 16:32:05 UTC
Comment on attachment 70696 [details] [review]
Bug 20001: Fix confusion between array and arrayref

Review of attachment 70696 [details] [review]:
-----------------------------------------------------------------

::: Koha/Illrequest.pm
@@ +478,4 @@
>  
>  sub available_backends {
>      my ( $self ) = @_;
> +    my $backends = $self->_config->available_backends;

YIKES! Line 117 of Koha/Illrequest/Config.pm in available_backends returns \@backends, which should be this, and not what it was. Nice fix.
Comment 11 Mark Tompsett 2018-01-18 17:01:30 UTC
I can't sign off, because I can't figure out how to set up my koha-conf.xml file for inter-library loans. Anyone have documentation or links?
Comment 12 Mark Tompsett 2018-01-18 17:18:58 UTC
(In reply to M. Tompsett from comment #11)
> I can't sign off, because I can't figure out how to set up my koha-conf.xml
> file for inter-library loans. Anyone have documentation or links?

Bug 7317 comment #20 was helpful for addressing this.
Comment 13 Mark Tompsett 2018-01-18 17:36:17 UTC
Created attachment 70700 [details] [review]
Bug 20001: Fix confusion between array and arrayref

Illrequest->available_backends always returned only 1 element

TEST PLAN
---------
See bug 7317 comment #20 for configuring ILL
Make sure to restart_all
Strangely, ILLIBS didn't exist, but IL did in default install,
    so use that as the patron code in your koha-conf.xml
Make sure to turn on the ILL related system preference.

1) Configure ILL.
   -- this is the hard part. Hopefully the above will give you
      enough.
2) open OPAC and log in
3) Click the 'your interlibrary loan request' in the left pane
4) Click the 'Create a new request' button.
   -- when you hover your mouse over the links for the backends,
      they will have ARRAY(...) instead of a meaningful name.
      This is what triggers the error (see comment #7).
5) Run the following commands
    git checkout -b bug_20001 origin/master
    git bz apply 20001
    reset_all
6) Refresh the OPAC page, and repeat step 4.
    -- when hovering your mouse over the links for the backends,
       they will have meaningful values now.
7) run koha qa test tools.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Comment 14 Mark Tompsett 2018-01-18 17:39:44 UTC
Created attachment 70701 [details] [review]
Bug 20001: Fix confusion between array and arrayref

Illrequest->available_backends always returned only 1 element

TEST PLAN
---------
See bug 7317 comment #20 for configuring ILL
Make sure to restart_all
Strangely, ILLIBS didn't exist, but IL did in default install,
    so use that as the patron code in your koha-conf.xml
Make sure to turn on the ILL related system preference.

1) Configure ILL.
   -- this is the hard part. Hopefully the above will give you
      enough.
2) open OPAC and log in
3) Click the 'your interlibrary loan request' in the left pane
4) Click the 'Create a new request' button.
   -- when you hover your mouse over the links for the backends,
      they will have ARRAY(...) instead of a meaningful name.
      This is what triggers the error (see comment #7).
5) Run the following commands
    git checkout -b bug_20001 origin/master
    git bz apply 20001
    restart_all
6) Refresh the OPAC page, and repeat step 4.
    -- when hovering your mouse over the links for the backends,
       they will have meaningful values now.
7) run koha qa test tools.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Comment 15 Katrin Fischer 2018-01-19 05:52:16 UTC
The button's functionality is restored with the patch. But the problem of the non-functional exploding Dummy and FreeForm (which should work universally) remains. Actually using the button still leads to:

Template process failed: file error - : not found at /home/vagrant/kohaclone/C4/Templates.pm line 122.
Comment 16 Katrin Fischer 2018-01-19 05:53:35 UTC
Created attachment 70737 [details] [review]
Bug 20001: Fix confusion between array and arrayref

Illrequest->available_backends always returned only 1 element

TEST PLAN
---------
See bug 7317 comment #20 for configuring ILL
Make sure to restart_all
Strangely, ILLIBS didn't exist, but IL did in default install,
    so use that as the patron code in your koha-conf.xml
Make sure to turn on the ILL related system preference.

1) Configure ILL.
   -- this is the hard part. Hopefully the above will give you
      enough.
2) open OPAC and log in
3) Click the 'your interlibrary loan request' in the left pane
4) Click the 'Create a new request' button.
   -- when you hover your mouse over the links for the backends,
      they will have ARRAY(...) instead of a meaningful name.
      This is what triggers the error (see comment #7).
5) Run the following commands
    git checkout -b bug_20001 origin/master
    git bz apply 20001
    restart_all
6) Refresh the OPAC page, and repeat step 4.
    -- when hovering your mouse over the links for the backends,
       they will have meaningful values now.
7) run koha qa test tools.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 17 Katrin Fischer 2018-01-19 05:54:07 UTC
I am passing QA on the fix as it's obviously correct, but this bug is not resolved with it yet.
Comment 18 Katrin Fischer 2018-01-19 07:14:00 UTC
As the create functionality works on the intranet side, I wonder if it's a problem with picking the right templates on OPAC?
Comment 19 Katrin Fischer 2018-01-19 07:39:29 UTC
[% PROCESS $whole.opac_template %] doesn't work... but I am not sure why.
Comment 20 Jonathan Druart 2018-01-19 12:09:15 UTC
(In reply to Katrin Fischer from comment #15)
> The button's functionality is restored with the patch. But the problem of
> the non-functional exploding Dummy and FreeForm (which should work
> universally) remains. Actually using the button still leads to:
> 
> Template process failed: file error - : not found at
> /home/vagrant/kohaclone/C4/Templates.pm line 122.

Dummy works for me
Comment 21 Jonathan Druart 2018-01-19 12:11:19 UTC
https://screenshots.firefox.com/PlajuumMOPG7dPMe/catalogue.kohadev.org

And FreeForm as well
Comment 22 Jonathan Druart 2018-01-19 18:56:46 UTC
Pushed to master for 18.05, thanks to everybody involved!
Comment 23 Nick Clemens 2018-01-23 04:10:54 UTC
Awesome work all!

Pushed to Stable for 17.11.02
Comment 24 Katrin Fischer 2018-01-29 21:05:32 UTC
I am using Jonathan's koha-conf.xml configuration now with most extra features turned off. I think the problems I saw might be related to a special combination of features. If I can I will do more testing and open a separate bug if I manage to find the problem case.
Comment 25 Fridolin Somers 2018-01-31 07:48:15 UTC
Bug 7317 not in 17.05.x
Comment 26 Jonathan Field 2018-02-23 12:09:51 UTC
I managed to reproduce the problem with the 

Template process failed: file error - : not found at /usr/share/koha/lib/C4/Templates.pm line 122.

error. It seems to occur in the OPAC ILL request if you have text in your ILLModuleCopyrightClearance system preference. Once removed, the template loads without a problem. I'll log this as a separate bug as it's unrelated to this one. This is just for information to confirm what Katrin found.
Comment 27 Katrin Fischer 2018-02-23 12:34:12 UTC
Thx Jonathan! I am sure I had some text in this pref when testing, so this seems the right clue.
Comment 28 Jonathan Field 2018-02-23 12:35:15 UTC
I've added a bug 20284