Bug 12740 - It should not be possible to store empty news
Summary: It should not be possible to store empty news
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Tools (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor (vote)
Assignee: Galen Charlton
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-08-09 09:12 UTC by Marc Véron
Modified: 2015-06-04 23:32 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Screenshot of empty news in staff and OPAC (39.34 KB, image/png)
2014-08-09 09:12 UTC, Marc Véron
Details
Bug 12740 - It should not be possible to store empty news (2.42 KB, patch)
2014-09-13 16:21 UTC, Marc Véron
Details | Diff | Splinter Review
Bug 12740 - It should not be possible to store empty news (2.05 KB, patch)
2014-09-20 08:51 UTC, Marc Véron
Details | Diff | Splinter Review
[SIGNED OFF] Bug 12740 - It should not be possible to store empty news (2.32 KB, patch)
2014-09-20 11:50 UTC, Mark Tompsett
Details | Diff | Splinter Review
Bug 12740 - Data Validation followup (3.54 KB, patch)
2014-09-20 12:06 UTC, Mark Tompsett
Details | Diff | Splinter Review
[Signed-off] Bug 12740 - Data Validation followup (3.76 KB, patch)
2014-09-20 12:39 UTC, Marc Véron
Details | Diff | Splinter Review
Bug 12740 - It should not be possible to store empty news (2.37 KB, patch)
2014-09-22 07:56 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 12740 - Data Validation followup (3.80 KB, patch)
2014-09-22 07:56 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 12740: Make the error message translatable (1.80 KB, patch)
2014-09-22 07:56 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
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 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 2014-10-11 15:31:45 UTC
Patches pushed to master.

Thanks Marc!