Browse Source

updating cleanUpFields to skip created, modified, updated and only update if the field is set

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4623 3807eeeb-6ff5-0310-8944-8be069107fe0
gwoo 19 years ago
parent
commit
48a1a9cba2
1 changed files with 3 additions and 3 deletions
  1. 3 3
      cake/libs/controller/controller.php

+ 3 - 3
cake/libs/controller/controller.php

@@ -922,11 +922,11 @@ class Controller extends Object {
 			}
 
 			$newDate = null;
-			if ('datetime' == $field['type']) {
+			if ('datetime' == $field['type'] && isset($this->data[$modelClass][$field['name'].'_year'])) {
 				$newDate = "{$_year}-{$_month}-{$_day}:{$_hour}:{$_min}:{$_sec}";
-			} else if ('date' == $field['type']) {
+			} else if ('date' == $field['type'] && isset($this->data[$modelClass][$field['name'].'_year'])) {
 				$newDate = "{$_year}-{$_month}-{$_day}";
-			} else if ('time' == $field['type']) {
+			} else if ('time' == $field['type'] && isset($this->data[$modelClass][$field['name'].'_hour'])) {
 				$newDate = "{$_hour}:{$_min}:{$_sec}";
 			}
 			if($newDate && !in_array($field['name'], array('created', 'updated', 'modified'))) {