Bug 33106

Summary: Add vendor link to ERM Licences
Product: Koha Reporter: Jonathan Druart <jonathan.druart>
Component: AcquisitionsAssignee: Jonathan Druart <jonathan.druart>
Status: BLOCKED --- QA Contact: Katrin Fischer <katrin.fischer>
Severity: enhancement    
Priority: P5 - low CC: jonathan.field, tomascohen
Version: unspecified   
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:
Circulation function:
Bug Depends on: 32968    
Bug Blocks: 33465    
Attachments: Bug 33106: Add vendor link to ERM licenses
Bug 33106: Add vendor link to ERM licenses
Bug 33106: Add vendor link to ERM licenses
Bug 33106: Add vendor link to ERM licenses
Bug 33106: Add vendor link to ERM licenses

Description Jonathan Druart 2023-03-01 10:02:31 UTC
If a staff user has the permission to view licences they will see an additional tab on the vendor record. This means a staff member could have access to a vendor but without access to the contractual information.
Comment 1 Jonathan Druart 2023-03-02 14:35:37 UTC
Created attachment 147631 [details] [review]
Bug 33106: Add vendor link to ERM licenses

This patch adds a "Licenses" link in the acquisition module to link to
the licenses defined in the ERM module.

Test plan:
- Create a vendor
- Create some licenses in the ERM module, add some to the vendor
previously created
- Go to the detail page of the vendor in the acquisition module
=> Notice the new "Licenses" tab on the side bar
=> Notice that this tab does not appear if you do not have the permission
to see licenses
- Click on the new tab
=> Notice that you are redirected to the license list view, in the ERM
module, with an automatic filter on the vendor
Comment 2 Jonathan Druart 2023-03-28 09:57:50 UTC
Created attachment 148810 [details] [review]
Bug 33106: Add vendor link to ERM licenses

This patch adds a "Licenses" link in the acquisition module to link to
the licenses defined in the ERM module.

Test plan:
- Create a vendor
- Create some licenses in the ERM module, add some to the vendor
previously created
- Go to the detail page of the vendor in the acquisition module
=> Notice the new "Licenses" tab on the side bar
=> Notice that this tab does not appear if you do not have the permission
to see licenses
- Click on the new tab
=> Notice that you are redirected to the license list view, in the ERM
module, with an automatic filter on the vendor
Comment 3 Jonathan Field 2023-03-29 12:40:20 UTC
With the latest patches applied I find that the link from the vendor to Licences always links to ALL licences, rather than filtering to the linked vendor. 

I also think it would be helpful if the link in the vendor ONLY displayed if the licence record is linked to a vendor. Right now, the Licence link displays on all vendor records if ERM is enabled. Libraries might find it annoying that the Licence link display of print book vendors that aren't linked in any way?

So, the erm_licenses table has a vendor_id link. Only display the vendor link if this link exists in the db?

Thanks
Jonathan
Comment 4 Jonathan Druart 2023-03-29 13:23:20 UTC
(In reply to Jonathan Field from comment #3)
> With the latest patches applied I find that the link from the vendor to
> Licences always links to ALL licences, rather than filtering to the linked
> vendor. 

I am not recreating that. Did you try on a sandbox?
Comment 5 Jonathan Field 2023-03-29 14:06:28 UTC
Yes, on our sandbox
Comment 6 Jonathan Druart 2023-03-29 15:07:22 UTC
I've asked Martin to create a sandbox and I did recreate the problem there. After we rebuilt the JS file it's now working: http://staff-bug33106.sandboxes.ptfs-europe.co.uk
Comment 7 Jonathan Druart 2023-03-29 15:12:14 UTC
(In reply to Jonathan Druart from comment #6)
> I've asked Martin to create a sandbox and I did recreate the problem there.
> After we rebuilt the JS file it's now working:
> http://staff-bug33106.sandboxes.ptfs-europe.co.uk

I've opened https://gitlab.com/koha-community/koha-sandboxes-docker/-/issues/88
Comment 8 PTFS Europe Sandboxes 2023-03-30 06:20:40 UTC
Created attachment 148944 [details] [review]
Bug 33106: Add vendor link to ERM licenses

This patch adds a "Licenses" link in the acquisition module to link to
the licenses defined in the ERM module.

Test plan:
- Create a vendor
- Create some licenses in the ERM module, add some to the vendor
previously created
- Go to the detail page of the vendor in the acquisition module
=> Notice the new "Licenses" tab on the side bar
=> Notice that this tab does not appear if you do not have the permission
to see licenses
- Click on the new tab
=> Notice that you are redirected to the license list view, in the ERM
module, with an automatic filter on the vendor

Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>
Comment 9 Jonathan Field 2023-03-30 06:22:23 UTC
That works now, thanks for fixing that! I still think it would be good to not display the link if there is no attached record but I think we can deal with that in a separate bugzilla entry, this works as planned.
Comment 10 Jonathan Druart 2023-03-30 07:32:36 UTC
Created attachment 148946 [details] [review]
Bug 33106: Add vendor link to ERM licenses

This patch adds a "Licenses" link in the acquisition module to link to
the licenses defined in the ERM module.

Test plan:
- Create a vendor
- Create some licenses in the ERM module, add some to the vendor
previously created
- Go to the detail page of the vendor in the acquisition module
=> Notice the new "Licenses" tab on the side bar
=> Notice that this tab does not appear if you do not have the permission
to see licenses
- Click on the new tab
=> Notice that you are redirected to the license list view, in the ERM
module, with an automatic filter on the vendor

Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>
Comment 11 Jonathan Druart 2023-03-30 08:39:31 UTC
(In reply to Jonathan Field from comment #9)
> That works now, thanks for fixing that! I still think it would be good to
> not display the link if there is no attached record but I think we can deal
> with that in a separate bugzilla entry, this works as planned.

I am not sure about that. The other tabs are there even if there is nothing on the view (for baskets). If we add another tab later (for issues for instance), it  will be placed differently depending on the existence of license linked to the vendor, that does not seem correct to me.

We could add the number of licenses in parenthesis but again, it is inconsistent with the other tabs.

So basically, yes, we should discuss that on a separate bug :)
Comment 12 Katrin Fischer 2023-04-09 13:48:51 UTC
(In reply to Jonathan Druart from comment #11)
> (In reply to Jonathan Field from comment #9)
> > That works now, thanks for fixing that! I still think it would be good to
> > not display the link if there is no attached record but I think we can deal
> > with that in a separate bugzilla entry, this works as planned.
> 
> I am not sure about that. The other tabs are there even if there is nothing
> on the view (for baskets). If we add another tab later (for issues for
> instance), it  will be placed differently depending on the existence of
> license linked to the vendor, that does not seem correct to me.
> 
> We could add the number of licenses in parenthesis but again, it is
> inconsistent with the other tabs.
> 
> So basically, yes, we should discuss that on a separate bug :)

I agree about the separate bug, so I filed it: 

Bug 33465 - Make it clear if there are linked licenses when viewing the vendor record

I also agree that we should make it visible somehow if there are even licenses linked. Either by not displaying the tab or by showing the number of licenses link in the tab label.
Comment 13 Katrin Fischer 2023-04-09 13:50:03 UTC
Created attachment 149371 [details] [review]
Bug 33106: Add vendor link to ERM licenses

This patch adds a "Licenses" link in the acquisition module to link to
the licenses defined in the ERM module.

Test plan:
- Create a vendor
- Create some licenses in the ERM module, add some to the vendor
previously created
- Go to the detail page of the vendor in the acquisition module
=> Notice the new "Licenses" tab on the side bar
=> Notice that this tab does not appear if you do not have the permission
to see licenses
- Click on the new tab
=> Notice that you are redirected to the license list view, in the ERM
module, with an automatic filter on the vendor

Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>