Bug 35915 - Add URL encoding to status tabs in purchase suggestions management
Summary: Add URL encoding to status tabs in purchase suggestions management
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low enhancement
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-01-25 21:06 UTC by Caroline Cyr La Rose
Modified: 2024-03-05 17:53 UTC (History)
1 user (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Caroline Cyr La Rose 2024-01-25 21:06:31 UTC
If users add custom suggestion statuses in the SUGGEST_STATUS authorized values and the value has spaces (or probably any other weird character), the tab in the suggestions management page becomes unclickable/inaccessible.

To recreate:
1. Add a custom suggestion status with a space in the authorized value (e.g. "En analyse")
   1.1. Go to Adminsitration > Authorized values > SUGGEST_STATUS
   1.2. Click Add new authorized value
   1.3. Fill out the form
        - Authorized value: term with a space (e.g. "En analyse")
        - Description: description (e.g. "En analyse")
   1.4. Click Save

2. Create two suggestions
   2.1. Go to Acquisitions > Suggestions
   2.2. Click New purchase suggestion
   2.3. Fill out the form (with whatever)
   2.4. Click Submit your suggestion
   2.5. Redo steps 2.2 to 2.4 for the second suggestion
 
3. Change the status of one of the suggestion to the custom status
   3.1. Check the box next to one of the suggestion
   3.2. At the bottom of the page, under Mark selected as, choose the custom status
   3.3. Click Submit

4. Try to access the custom status tab
   --> Nothing happens

If you look at the URL it's trying to access it's "suggestion.pl#En analyse_panel" with the space instead of %20. I don't know if that's the blocking element, but it looks suspicious...

Now, I know some of you are going to say "Just don't put spaces in the authorized value!" But even though I repeat it ALL the time and wrote it in RED in our FAQ, users are gonna use... So either we make it impossible to enter spaces in authorized values (I don't think that's a good idea, as some categories might require spaces, such as categories to fill out marc fields), or we make it so that Koha doesn't break if there is a space...
Comment 1 Caroline Cyr La Rose 2024-01-25 21:14:52 UTC
I added a note in the manual, but like I said, you can write it everywhere, there is still someone who will do it...

https://gitlab.com/koha-community/koha-manual/-/merge_requests/827

A major problem with this is that users cannot correct this by themselves if they make the error. You must go into the database and update the value of suggestions.STATUS.
Comment 2 Caroline Cyr La Rose 2024-01-25 21:23:14 UTC
If someone stumbled upon this and needs to correct their suggestions:

Changing the authorized value (this can be done via the staff interface under Administration > Authorized values > SUGGEST_STATUS):

UPDATE authorised_values SET authorised_value = 'SPACELESS_STATUS' WHERE category  = 'SUGGEST_STATUS' AND authorised_value = 'Old status';


Changing the suggestions themselves (this must be done in the db):

UPDATE suggestions SET STATUS = 'SPACELESS_STATUS' WHERE STATUS = 'Old status';


If you had notices linked to that status (this must be done in the db also):

UPDATE letter SET code = 'SPACELESS_STATUS' WHERE code = 'Old status';