Fix a few issues with task validation changes

This commit is contained in:
Timothy Warren 2014-08-18 16:08:50 -04:00
parent 9446816131
commit 50ee98efa5
5 changed files with 6 additions and 6 deletions

View File

@ -11,7 +11,7 @@ class MY_Controller extends CI_Controller {
public $session;
/**
* @var CI_DB_query_builder
* @var CI_DB_driver
*/
public $db;

View File

@ -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;

View File

@ -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

View File

@ -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>

View File

@ -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.'
]