Bug 4158

Summary: cannot create list whose title is '0'
Product: Koha Reporter: Galen Charlton <gmcharlt>
Component: ListsAssignee: Aleksa Vujicic <aleksa>
Status: CLOSED FIXED QA Contact:
Severity: minor    
Priority: P5 - low CC: aleisha, jonathan.druart+koha, katrin.fischer, mtompset, veron
Version: master   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Text to go in the release notes:
Version(s) released in:
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

---- 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

Comment 1 Duncan 2011-12-20 02:58:56 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.
Comment 2 Aleksa Vujicic 2012-01-23 23:09:33 UTC
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.
Comment 3 Owen Leonard 2012-02-07 17:21:10 UTC
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.
Comment 4 Mark Tompsett 2015-10-19 16:10:25 UTC
Prog theme no longer exists. This would need a rewrite.
Comment 5 Aleisha Amohia 2016-03-15 06:11:13 UTC
Is this still valid? I was able to create a list called 0.
Comment 6 Marc VĂ©ron 2016-03-15 14:34:50 UTC
I tested as well on current master, could create a list with title 0, add items, delete items, delete list (from staff and OPAC).