---- Reported by gmcharlt@gmail.com 2010-02-11 11:24:57 ---- Because of the way that every caller of AddShelf() checks to see if the user wants to add a new list, a new list whose title evaluates to Perl false (e.g., '0') will not be added - and the failure is silent. This applies to both staff and OPAC. --- Bug imported by chris@bigballofwax.co.nz 2010-05-21 01:23 UTC --- This bug was previously known as _bug_ 4158 at http://bugs.koha.org/cgi-bin/bugzilla3/show_bug.cgi?id=4158 Actual time not defined. Setting to 0.0
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).