Browse Source

Fix a few issues with task validation changes

Timothy J. Warren 4 years ago
parent
commit
50ee98efa5

+ 1
- 1
application/core/MY_Controller.php View File

@@ -11,7 +11,7 @@ class MY_Controller extends CI_Controller {
11 11
 	public $session;
12 12
 
13 13
 	/**
14
-	 * @var CI_DB_query_builder
14
+	 * @var CI_DB_driver
15 15
 	 */
16 16
 	public $db;
17 17
 

+ 1
- 1
application/libraries/Validation_callbacks.php View File

@@ -31,7 +31,7 @@ class Validation_callbacks {
31 31
 		//Verify date format
32 32
 		$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])/';
33 33
 
34
-		if ( ! (bool) preg_match($date_pattern, $due))
34
+		if ( ! (bool) preg_match($date_pattern, $due) && $due != 0)
35 35
 		{
36 36
 			$this->CI->form_validation->set_message('validate', 'You must enter a due date in YYYY-MM-DD format.');
37 37
 			return FALSE;

+ 1
- 1
application/models/task_model.php View File

@@ -411,7 +411,7 @@ class Task_model extends CI_Model {
411 411
 
412 412
 		if ( ! $valid)
413 413
 		{
414
-			$err = array_merge($err, $this->form_validation->get_error_array());
414
+			$err = array_merge($err, (array)$this->form_validation->get_error_array());
415 415
 		}
416 416
 
417 417
 		//Check due date

+ 2
- 2
application/views/task/edit.php View File

@@ -11,12 +11,12 @@
11 11
 			<dl>
12 12
 				<dt><label for="title">Title</label></dt>
13 13
 				<dd>
14
-					<input type="text" name="title" id="title" value="<?= $title ?>" placeholder="Task Heading" />
14
+					<input type="text" name="title" id="title" value="<?= set_value('title') ?>" placeholder="Task Heading" />
15 15
 				</dd>
16 16
 
17 17
 				<dt><label for="desc">Description</label></dt>
18 18
 				<dd>
19
-					<textarea rows="10" cols="80" name="desc" id="desc" placeholder="Task details"><?= $description ?></textarea>
19
+					<textarea rows="10" cols="80" name="desc" id="desc" placeholder="Task details"><?= set_value('description') ?></textarea>
20 20
 				</dd>
21 21
 
22 22
 				<dt><label for="category">Category</label></dt>

+ 1
- 1
tests/models/TaskModelNoFixturesTest.php View File

@@ -22,7 +22,7 @@ class TaskModelNoFixturesTest extends Todo_TestCase {
22 22
 					'The Description field is required.',
23 23
 					'The Category field is required.',
24 24
 					'The Priority field is required.',
25
-					'You must enter a due date in YYYY-MM-DD format.',
25
+					//'You must enter a due date in YYYY-MM-DD format.',
26 26
 					'You must set a due date in order to get a reminder.',
27 27
 					'You must put numeric hours and minutes for a reminder time.'
28 28
 				]