Summary: | cannot create list whose title is '0' | ||
---|---|---|---|
Product: | Koha | Reporter: | Galen Charlton <gmcharlt> |
Component: | Lists | Assignee: | Aleksa Vujicic <aleksa> |
Status: | CLOSED FIXED | QA Contact: | |
Severity: | minor | ||
Priority: | P5 - low | CC: | aleisha, jonathan.druart, mtompset, veron |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
Change sponsored?: | --- | Patch complexity: | --- |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: | Version(s) released in: | ||
Circulation function: | |||
Attachments: |
Patched to check for '0' entered as a list name.
Now allows list names that evaluate to false. Also doesn't allow list names that have leading or trailing whitespace. |
Description
Chris Cormack
2010-05-21 01:23:49 UTC
Created attachment 6878 [details] [review] Patched to check for '0' entered as a list name. Simple check in JavaScript to test for the case where a user enters a '0' as the name of a list and warns them that this is invalid. This should probably be changed in the Perl file in the future as there is not really any reason that a list cannot be called '0', but this is a temporary catch. Created attachment 7303 [details] [review] Now allows list names that evaluate to false. Also doesn't allow list names that have leading or trailing whitespace. List names now have to contain a non-whitespace character, and must not start or end with whitespace. If the list name starts/ends with whitespace, the user gets a popup and the list is not created. This patch is dependent on 6878. This is a little confusing: the second patch here doesn't apply without the first, but seems to re-implement all the changes in the first one. Anyway, I tested with both patches applied. The patch fixes the problem in 50% of the cases. If I use the "new list" function from the lists page, either in the OPAC or staff client, I can successfully create a list named "0" and am prevented from creating a list called " ". However if I do a search, select items, and try to add them to a new list none of these improvements are apparent. It doesn't look like this use case was examined. Another note: Instead of checking whether a list name starts or ends with whitespace, wouldn't it make more sense to trim whitespace from the submitted name and check to see if there's anything left? If I accidentally try to name my list " foo" I would prefer that Koha assume I meant "foo" rather than reject the operation. Prog theme no longer exists. This would need a rewrite. Is this still valid? I was able to create a list called 0. I tested as well on current master, could create a list with title 0, add items, delete items, delete list (from staff and OPAC). |