From d676727c1ee4cae4f97c45cabd0e12a42b55091e Mon Sep 17 00:00:00 2001 From: Simon Holywell Date: Sat, 10 Mar 2012 23:16:12 +0000 Subject: [PATCH] Allow for non-mandantory date time fields --- src/IDF/Form/Field/Datetime.php | 36 +++++++++++++++++++++++++++++++++ src/IDF/Form/IssueCreate.php | 2 +- src/IDF/Form/IssueUpdate.php | 2 +- 3 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 src/IDF/Form/Field/Datetime.php diff --git a/src/IDF/Form/Field/Datetime.php b/src/IDF/Form/Field/Datetime.php new file mode 100644 index 0000000..04c4e29 --- /dev/null +++ b/src/IDF/Form/Field/Datetime.php @@ -0,0 +1,36 @@ +required and empty($value)) { + return null; + } + throw $e; + } + } +} diff --git a/src/IDF/Form/IssueCreate.php b/src/IDF/Form/IssueCreate.php index cd86193..b39d7bb 100644 --- a/src/IDF/Form/IssueCreate.php +++ b/src/IDF/Form/IssueCreate.php @@ -112,7 +112,7 @@ class IDF_Form_IssueCreate extends Pluf_Form 'size' => 15, ), )); - $this->fields['due_dtime'] = new Pluf_Form_Field_Datetime( + $this->fields['due_dtime'] = new IDF_Form_Field_Datetime( array('required' => false, 'label' => __('Due date'), 'initial' => '', diff --git a/src/IDF/Form/IssueUpdate.php b/src/IDF/Form/IssueUpdate.php index 302c0a4..09f5e8c 100644 --- a/src/IDF/Form/IssueUpdate.php +++ b/src/IDF/Form/IssueUpdate.php @@ -103,7 +103,7 @@ class IDF_Form_IssueUpdate extends IDF_Form_IssueCreate 'size' => 15, ), )); - $this->fields['due_dtime'] = new Pluf_Form_Field_Datetime( + $this->fields['due_dtime'] = new IDF_Form_Field_Datetime( array('required' => false, 'label' => __('Due date'), 'initial' => $this->issue->due_dtime,