Bug 12740

Summary: It should not be possible to store empty news
Product: Koha Reporter: Marc Véron <veron>
Component: ToolsAssignee: Galen Charlton <gmcharlt>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: minor    
Priority: P5 - low CC: nick, tomascohen
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Screenshot of empty news in staff and OPAC
Bug 12740 - It should not be possible to store empty news
Bug 12740 - It should not be possible to store empty news
[SIGNED OFF] Bug 12740 - It should not be possible to store empty news
Bug 12740 - Data Validation followup
[Signed-off] Bug 12740 - Data Validation followup
Bug 12740 - It should not be possible to store empty news
Bug 12740 - Data Validation followup
Bug 12740: Make the error message translatable

Description Marc Véron 2014-08-09 09:12:59 UTC
Created attachment 30647 [details]
Screenshot of empty news in staff and OPAC

To reproduce:

In staff client go to Tools->News
Click 'New entry'
Click 'Submit'

Result: News without title an text is stored without warning and is displayed for all libraries in staff client, OPAC and on slips.
Comment 1 Marc Véron 2014-09-13 16:21:08 UTC Comment hidden (obsolete)
Comment 2 Nick Clemens (kidclamp) 2014-09-19 20:57:26 UTC
I like this, it works as expected, but I wonder why the fields 'News' is marked as required since it actually isn't being required?  

I actually think title only news is a good feature for short announcements.
Comment 3 Marc Véron 2014-09-20 08:51:35 UTC Comment hidden (obsolete)
Comment 4 Mark Tompsett 2014-09-20 11:50:36 UTC Comment hidden (obsolete)
Comment 5 Mark Tompsett 2014-09-20 12:06:34 UTC Comment hidden (obsolete)
Comment 6 Marc Véron 2014-09-20 12:39:22 UTC Comment hidden (obsolete)
Comment 7 Jonathan Druart 2014-09-22 07:56:18 UTC
Created attachment 31804 [details] [review]
Bug 12740 - It should not be possible to store empty news

This patch marks the title field as 'required' and it is not
longer possible to store a news without having at least a title.

To test:
Got to Tools->News
Create news or edit existing news
Field "Title" should have a red label and should be marked as "required"
It should not be possible to save with empty field "Title"

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

NOTE: Only keeps the user from doing it.
      Fails to handle the fake the url call case.
https://demo.library-admin.kohasystem.ca/cgi-bin/koha/tools/koha-news.pl?op=add&lang=&branch=&title=&from=&to=&number=&new=

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Comment 8 Jonathan Druart 2014-09-22 07:56:46 UTC
Created attachment 31805 [details] [review]
Bug 12740 - Data Validation followup

Added server-side validation and feedback to Koha news.

TEST PLAN
---------
1) Log in to staff client as someone who can add news
2) Paste a variation of the ugly following URL into your
   address bar:

https://demo.library-admin.kohasystem.ca/cgi-bin/koha/tools/koha-news.pl?op=add&lang=&branch=&title=&from=&to=&number=&new=

   -- A blank news item is added without warning!
3) Apply patch
4) Repeat step 2
   -- "ERROR: Required news title missing!" is displayed
      and no blank news is added
5) run koha qa test tools

Followed test plan, Error message appears as expected, qa test tool: OK
Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Comment 9 Jonathan Druart 2014-09-22 07:56:50 UTC
Created attachment 31806 [details] [review]
Bug 12740: Make the error message translatable

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Comment 10 Tomás Cohen Arazi (tcohen) 2014-10-11 15:31:45 UTC
Patches pushed to master.

Thanks Marc!