Commit 50ee98ef by Timothy J Warren

Fix a few issues with task validation changes

parent 94468161
......@@ -11,7 +11,7 @@ class MY_Controller extends CI_Controller {
public $session;
/**
* @var CI_DB_query_builder
* @var CI_DB_driver
*/
public $db;
......
......@@ -31,7 +31,7 @@ class Validation_callbacks {
//Verify date format
$date_pattern = '/(20|1[0-9])[0-9]{2}\-(1[0-2]|0[1-9])\-(3[0-1]|2[0-8]|1[0-9]|0[1-9])/';
if ( ! (bool) preg_match($date_pattern, $due))
if ( ! (bool) preg_match($date_pattern, $due) && $due != 0)
{
$this->CI->form_validation->set_message('validate', 'You must enter a due date in YYYY-MM-DD format.');
return FALSE;
......
......@@ -411,7 +411,7 @@ class Task_model extends CI_Model {
if ( ! $valid)
{
$err = array_merge($err, $this->form_validation->get_error_array());
$err = array_merge($err, (array)$this->form_validation->get_error_array());
}
//Check due date
......
......@@ -11,12 +11,12 @@
<dl>
<dt><label for="title">Title</label></dt>
<dd>
<input type="text" name="title" id="title" value="<?= $title ?>" placeholder="Task Heading" />
<input type="text" name="title" id="title" value="<?= set_value('title') ?>" placeholder="Task Heading" />
</dd>
<dt><label for="desc">Description</label></dt>
<dd>
<textarea rows="10" cols="80" name="desc" id="desc" placeholder="Task details"><?= $description ?></textarea>
<textarea rows="10" cols="80" name="desc" id="desc" placeholder="Task details"><?= set_value('description') ?></textarea>
</dd>
<dt><label for="category">Category</label></dt>
......
......@@ -22,7 +22,7 @@ class TaskModelNoFixturesTest extends Todo_TestCase {
'The Description field is required.',
'The Category field is required.',
'The Priority field is required.',
'You must enter a due date in YYYY-MM-DD format.',
//'You must enter a due date in YYYY-MM-DD format.',
'You must set a due date in order to get a reminder.',
'You must put numeric hours and minutes for a reminder time.'
]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment