Bug 33003

Summary: Show the vendor type description on vendor detail page when AV is used
Product: Koha Reporter: Caroline Cyr La Rose <caroline.cyr-la-rose>
Component: AcquisitionsAssignee: Katrin Fischer <katrin.fischer>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: minor    
Priority: P5 - low CC: jonathan.druart
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:
23.05.00
Circulation function:
Bug Depends on: 31017    
Bug Blocks:    
Attachments: Bug 33003: Show the vendor type on vendor detail page
Bug 33003: Show the vendor type on vendor detail page
Bug 33003: Show the vendor type on vendor detail page
Bug 33003: Show the vendor type on vendor detail page
Bug 33003: Show the vendor type on vendor detail page
Bug 33003: Show the vendor type on vendor detail page

Description Caroline Cyr La Rose 2023-02-17 21:01:06 UTC
Bug 31017 added a new vendor type field, where we can either enter a free text or add authorized values in the VENDOR_TYPE category to get a drop-down menu.

When using the authorized values, we should show the authorized value description in supplier.pl.

To test:
1. Add at least one authorized value in VENDOR_TYPE
   1.1. Go to Administration > Authorized values
   1.2. Search for VENDOR_TYPE
   1.3. Click 'Add'
   1.4. Fill out the form
        - Authorized value: BOOK
        - Description: Print books
   1.5. Click 'Save'
2. Add a new vendor
   2.1. Go to Acquisitions
   2.2. Click 'New vendor'
   2.3. Fill out the form
        - Name: ABC Bookstore
        - Vendor type: Print books
   2.4. Click 'Save'
3. Go to the vendor page
   3.1. Click on the vendor name
   --> The value in "Type" is BOOK, it should be "Print books"
Comment 1 Katrin Fischer 2023-02-18 10:29:59 UTC
Created attachment 146910 [details] [review]
Bug 33003: Show the vendor type on vendor detail page

When using an authorised value VENDOR_TYPE for the
vendor type, we should show the AV description
everywhere instead of the code. It already works on
the vendor search, but not on the vendor detail page.
With this patch it will also work there.

To test:
1. Add at least one authorized value in VENDOR_TYPE
   1.1. Go to Administration > Authorized values
   1.2. Search for VENDOR_TYPE
   1.3. Click 'Add'
   1.4. Fill out the form
        - Authorized value: BOOK
        - Description: Print books
   1.5. Click 'Save'
2. Add a new vendor
   2.1. Go to Acquisitions
   2.2. Click 'New vendor'
   2.3. Fill out the form
        - Name: ABC Bookstore
        - Vendor type: Print books
   2.4. Click 'Save'
3. Go to the vendor page
   3.1. Click on the vendor name
   --> The value in "Type" is BOOK, it should be "Print books"
4. Apply patch
   4.1. Repeat test, now it should show the description

https://bugs.koha-community.org/show_bug.cgi?id=33002
Comment 2 Katrin Fischer 2023-02-18 10:34:23 UTC
Created attachment 146911 [details] [review]
Bug 33003: Show the vendor type on vendor detail page

When using an authorised value VENDOR_TYPE for the
vendor type, we should show the AV description
everywhere instead of the code. It already works on
the vendor search, but not on the vendor detail page.
With this patch it will also work there.

To test:
1. Add at least one authorized value in VENDOR_TYPE
   1.1. Go to Administration > Authorized values
   1.2. Search for VENDOR_TYPE
   1.3. Click 'Add'
   1.4. Fill out the form
        - Authorized value: BOOK
        - Description: Print books
   1.5. Click 'Save'
2. Add a new vendor
   2.1. Go to Acquisitions
   2.2. Click 'New vendor'
   2.3. Fill out the form
        - Name: ABC Bookstore
        - Vendor type: Print books
   2.4. Click 'Save'
3. Go to the vendor page
   3.1. Click on the vendor name
   --> The value in "Type" is BOOK, it should be "Print books"
4. Apply patch
   4.1. Repeat test, now it should show the description
Comment 3 Owen Leonard 2023-02-18 15:09:51 UTC
Created attachment 146920 [details] [review]
Bug 33003: Show the vendor type on vendor detail page

When using an authorised value VENDOR_TYPE for the
vendor type, we should show the AV description
everywhere instead of the code. It already works on
the vendor search, but not on the vendor detail page.
With this patch it will also work there.

To test:
1. Add at least one authorized value in VENDOR_TYPE
   1.1. Go to Administration > Authorized values
   1.2. Search for VENDOR_TYPE
   1.3. Click 'Add'
   1.4. Fill out the form
        - Authorized value: BOOK
        - Description: Print books
   1.5. Click 'Save'
2. Add a new vendor
   2.1. Go to Acquisitions
   2.2. Click 'New vendor'
   2.3. Fill out the form
        - Name: ABC Bookstore
        - Vendor type: Print books
   2.4. Click 'Save'
3. Go to the vendor page
   3.1. Click on the vendor name
   --> The value in "Type" is BOOK, it should be "Print books"
4. Apply patch
   4.1. Repeat test, now it should show the description

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 4 Caroline Cyr La Rose 2023-02-20 14:14:20 UTC
Created attachment 146958 [details] [review]
Bug 33003: Show the vendor type on vendor detail page

When using an authorised value VENDOR_TYPE for the
vendor type, we should show the AV description
everywhere instead of the code. It already works on
the vendor search, but not on the vendor detail page.
With this patch it will also work there.

To test:
1. Add at least one authorized value in VENDOR_TYPE
   1.1. Go to Administration > Authorized values
   1.2. Search for VENDOR_TYPE
   1.3. Click 'Add'
   1.4. Fill out the form
        - Authorized value: BOOK
        - Description: Print books
   1.5. Click 'Save'
2. Add a new vendor
   2.1. Go to Acquisitions
   2.2. Click 'New vendor'
   2.3. Fill out the form
        - Name: ABC Bookstore
        - Vendor type: Print books
   2.4. Click 'Save'
3. Go to the vendor page
   3.1. Click on the vendor name
   --> The value in "Type" is BOOK, it should be "Print books"
4. Apply patch
   4.1. Repeat test, now it should show the description

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Comment 5 Caroline Cyr La Rose 2023-02-20 14:16:53 UTC
Thanks Katrin!
Comment 6 Jonathan Druart 2023-02-23 09:33:19 UTC
Should not we fallback to the original value of the AV does not exist?

To recreate:
Don't have VENDOR_TYPE
Add a type (free text)
Add the av category + create some values
Edit the vendor, save
=> You lost the original value.
Comment 7 Jonathan Druart 2023-02-23 09:33:41 UTC
(In reply to Jonathan Druart from comment #6)
> Should not we fallback to the original value of the AV does not exist?

*if* the AV does not exist
Comment 8 Katrin Fischer 2023-02-23 09:43:59 UTC
(In reply to Jonathan Druart from comment #6)
> Should not we fallback to the original value of the AV does not exist?
> 
> To recreate:
> Don't have VENDOR_TYPE
> Add a type (free text)
> Add the av category + create some values
> Edit the vendor, save
> => You lost the original value.

This is a known data loss issue we struggle in some places with, but it's not reason to fail this patch :)

* This is a display fix, it doesn't touch the pull down/edit page at all.
* The same code is used in the result list already.
* If you have no matching AV entry, the code will display, so it works for both types: libraries using the AV and the ones not using it.
* The category will be added as system_internal in bug 33004, so ALL will have it an cannot get rid of it.
Comment 9 Jonathan Druart 2023-02-23 10:06:29 UTC
Created attachment 147212 [details] [review]
Bug 33003: Show the vendor type on vendor detail page

When using an authorised value VENDOR_TYPE for the
vendor type, we should show the AV description
everywhere instead of the code. It already works on
the vendor search, but not on the vendor detail page.
With this patch it will also work there.

To test:
1. Add at least one authorized value in VENDOR_TYPE
   1.1. Go to Administration > Authorized values
   1.2. Search for VENDOR_TYPE
   1.3. Click 'Add'
   1.4. Fill out the form
        - Authorized value: BOOK
        - Description: Print books
   1.5. Click 'Save'
2. Add a new vendor
   2.1. Go to Acquisitions
   2.2. Click 'New vendor'
   2.3. Fill out the form
        - Name: ABC Bookstore
        - Vendor type: Print books
   2.4. Click 'Save'
3. Go to the vendor page
   3.1. Click on the vendor name
   --> The value in "Type" is BOOK, it should be "Print books"
4. Apply patch
   4.1. Repeat test, now it should show the description

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Comment 10 Jonathan Druart 2023-02-23 10:07:02 UTC
Indeed, only for display. I hit the problem when editing the vendor. We should not have pushed the feature without some AVs...
Comment 11 Jonathan Druart 2023-02-23 10:50:13 UTC
Created attachment 147222 [details] [review]
Bug 33003: Show the vendor type on vendor detail page

When using an authorised value VENDOR_TYPE for the
vendor type, we should show the AV description
everywhere instead of the code. It already works on
the vendor search, but not on the vendor detail page.
With this patch it will also work there.

To test:
1. Add at least one authorized value in VENDOR_TYPE
   1.1. Go to Administration > Authorized values
   1.2. Search for VENDOR_TYPE
   1.3. Click 'Add'
   1.4. Fill out the form
        - Authorized value: BOOK
        - Description: Print books
   1.5. Click 'Save'
2. Add a new vendor
   2.1. Go to Acquisitions
   2.2. Click 'New vendor'
   2.3. Fill out the form
        - Name: ABC Bookstore
        - Vendor type: Print books
   2.4. Click 'Save'
3. Go to the vendor page
   3.1. Click on the vendor name
   --> The value in "Type" is BOOK, it should be "Print books"
4. Apply patch
   4.1. Repeat test, now it should show the description

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 12 Tomás Cohen Arazi (tcohen) 2023-03-02 12:39:39 UTC
Pushed to master for 23.05.

Nice work everyone, thanks!
Comment 13 Jonathan Druart 2023-09-20 07:43:27 UTC
There are extra spaces: https://snipboard.io/M90DXR.jpg