Bug 35408

Summary: ERM > Titles > Import from a list gives an invalid link to the import job
Product: Koha Reporter: Victor Grousset/tuxayo <victor>
Component: ERMAssignee: Jonathan Druart <jonathan.druart>
Status: Pushed to oldstable --- QA Contact:
Severity: normal    
Priority: P5 - low CC: fridolin.somers, jonathan.druart, jonathan.field, lucas, martin.renvoize, matt.blenkinsop, pedro.amorim
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
24.05.00,23.11.01,23.05.07
Bug Depends on: 32030    
Bug Blocks:    
Attachments: Bug 35408: Fix import job link
Bug 35408: Fix import job link
Bug 35408: Fix import job link

Description Victor Grousset/tuxayo 2023-11-27 22:43:10 UTC
Test plan

1. enable ERMModule syspref
2. create a new list and add one or more records to it
4. go to eHoldings > Local > Titles > Import from a list
5. start import
6. click on the link to job
7. 404 :o


link is 
http://localhost:8081/cgi-bin/koha/admin/background_jobs/1
instead of 
http://localhost:8081/cgi-bin/koha/admin/background_jobs.pl?op=view&id=1

It happened to me once, then I tried to reproduce and the link was correct...
And now it happened again. No idea how to make it consistent.
Comment 1 Jonathan Druart 2023-11-28 08:18:50 UTC
Created attachment 159284 [details] [review]
Bug 35408: Fix import job link

After importing titles from a list there is a link to the background job
that is displayed.
This link points to /cgi-bin/koha/admin/background_jobs/:id
There is a route to this path in routes/erm.js, to redirect to the
correct URI /cgi-bin/koha/admin/background_jobs.pl?op=view&id=:id
However this link will not work if we are accessing it from outside the
ERM app/module, or if we are opening it in a new tab/window.

The idea was interesting, but does not work...

Test plan:
Create a new ERM local package, a new list (virtual shelf), add some
items to the list.
Go to E-resource management > eHoldings > Local > Titles > Import from a list
Click "import"
Notice the "see job" link and click it

=> Confirm that with this patch applied you can open it in a new tab
without getting a 404
Comment 2 Matt Blenkinsop 2023-11-28 17:29:15 UTC
Created attachment 159309 [details] [review]
Bug 35408: Fix import job link

After importing titles from a list there is a link to the background job
that is displayed.
This link points to /cgi-bin/koha/admin/background_jobs/:id
There is a route to this path in routes/erm.js, to redirect to the
correct URI /cgi-bin/koha/admin/background_jobs.pl?op=view&id=:id
However this link will not work if we are accessing it from outside the
ERM app/module, or if we are opening it in a new tab/window.

The idea was interesting, but does not work...

Test plan:
Create a new ERM local package, a new list (virtual shelf), add some
items to the list.
Go to E-resource management > eHoldings > Local > Titles > Import from a list
Click "import"
Notice the "see job" link and click it

=> Confirm that with this patch applied you can open it in a new tab
without getting a 404

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Comment 3 Victor Grousset/tuxayo 2023-11-29 20:04:15 UTC
Created attachment 159371 [details] [review]
Bug 35408: Fix import job link

After importing titles from a list there is a link to the background job
that is displayed.
This link points to /cgi-bin/koha/admin/background_jobs/:id
There is a route to this path in routes/erm.js, to redirect to the
correct URI /cgi-bin/koha/admin/background_jobs.pl?op=view&id=:id
However this link will not work if we are accessing it from outside the
ERM app/module, or if we are opening it in a new tab/window.

The idea was interesting, but does not work...

Test plan:
Create a new ERM local package, a new list (virtual shelf), add some
items to the list.
Go to E-resource management > eHoldings > Local > Titles > Import from a list
Click "import"
Notice the "see job" link and click it

=> Confirm that with this patch applied you can open it in a new tab
without getting a 404

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Comment 4 Victor Grousset/tuxayo 2023-11-29 20:06:41 UTC
> There is a route to this path in routes/erm.js, to redirect to the
> correct URI /cgi-bin/koha/admin/background_jobs.pl?op=view&id=:id
> However this link will not work if we are accessing it from outside the
> ERM app/module, or if we are opening it in a new tab/window.

I would have never guess it was new tab vs normal click. Thanks a lot Jonathan :)

Works, makes sense, QA script happy, code looks good, passing QA :)
Comment 5 Katrin Fischer 2023-12-11 18:47:02 UTC
Pushed for 24.05!

Well done everyone, thank you!
Comment 6 Fridolin Somers 2023-12-12 07:32:57 UTC
Pushed to 23.11.x for 23.11.01
Comment 7 Lucas Gass 2023-12-14 21:09:52 UTC
Backported to 23.05.x for upcoming 23.05.07