From 4f682c2e932f7d1ba7d98931340ed8fd3c267986 Mon Sep 17 00:00:00 2001 From: Loic d'Anterroches Date: Tue, 23 Dec 2008 11:20:08 +0100 Subject: [PATCH] Fixed to prevent entering empty bug reports. --- src/IDF/Form/IssueCreate.php | 9 +++++++++ src/IDF/Form/IssueUpdate.php | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/src/IDF/Form/IssueCreate.php b/src/IDF/Form/IssueCreate.php index 67afca7..65e74e5 100644 --- a/src/IDF/Form/IssueCreate.php +++ b/src/IDF/Form/IssueCreate.php @@ -173,6 +173,15 @@ class IDF_Form_IssueCreate extends Pluf_Form return $this->cleaned_data; } + function clean_content() + { + $content = trim($this->cleaned_data['content']); + if (strlen($content) == 0) { + throw new Pluf_Form_Invalid(__('You need to provide a description of the issue.')); + } + return $content; + } + function clean_status() { // Check that the status is in the list of official status diff --git a/src/IDF/Form/IssueUpdate.php b/src/IDF/Form/IssueUpdate.php index 0d36e72..3422551 100644 --- a/src/IDF/Form/IssueUpdate.php +++ b/src/IDF/Form/IssueUpdate.php @@ -140,6 +140,15 @@ class IDF_Form_IssueUpdate extends IDF_Form_IssueCreate } } + function clean_content() + { + $content = trim($this->cleaned_data['content']); + if (!$this->show_full and strlen($content) == 0) { + throw new Pluf_Form_Invalid(__('You need to provide a description of the issue.')); + } + return $content; + } + /** * We check that something is really changed. */