https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43988

--- Comment #1 from Lisette Scheer <[email protected]> ---
Created attachment 210294
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=210294&action=edit
Bug 43988: Store a 0 additional contents position as no position

The edit form shows a 0 position as blank, but 0 was stored and sorted
before 1, so a news item or other additional content saved with 0 was
displayed first until it was saved again with the field blank.

This patch:
- Stores a blank or 0 position as NULL in Koha::AdditionalContent->store,
  so the content is displayed after the ones with a position, as the
  edit form shows it
- Restricts the position field to digits (inputmode="numeric" and
  pattern="[0-9]*") so invalid values are caught in the browser

To test:
1. Go to Tools -> News and add two news items for the staff interface,
   one with position 1 and one with position 0
2. Go to the staff interface home page, the item with position 0 is
   displayed first
3. Apply the patch and restart services
4. Edit the item with position 0 and save it without changing anything
5. Add a third item with position 0
6. Go to the staff interface home page, the items with position 0 are
   displayed after the item with position 1
7. Edit one of them, the position field is blank
8. Try saving a news item with letters or a negative number as position,
   the browser does not let you save it
9. prove t/db_dependent/Koha/AdditionalContents.t

Co-Authored-By: Claude Opus 5.5 <[email protected]>

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to