ソースを参照

add config value to skip flash message joggling.

euromark 11 年 前
コミット
869a39b5ad
2 ファイル変更5 行追加5 行削除
  1. 1 1
      Controller/Component/CommonComponent.php
  2. 4 4
      Model/MyModel.php

+ 1 - 1
Controller/Component/CommonComponent.php

@@ -84,7 +84,7 @@ class CommonComponent extends Component {
 	 * @return void
 	 */
 	public function beforeRender(Controller $Controller) {
-		if ($messages = $this->Session->read('Message')) {
+		if (Configure::read('Common.messages') !== false && $messages = $this->Session->read('Message')) {
 			foreach ($messages as $message) {
 				$this->flashMessage($message['message'], 'error');
 			}

+ 4 - 4
Model/MyModel.php

@@ -1050,7 +1050,7 @@ class MyModel extends Model {
 	 * - dateFormat (defaults to 'ymd')
 	 * - allowEmpty
 	 * - after/before (fieldName to validate against)
-	 * - min/max (defaults to >= 1 - at least 1 minute apart)
+	 * - min/max (defaults to >= 1 - at least 1 second apart)
 	 * @return bool Success
 	 */
 	public function validateDateTime($data, $options = array()) {
@@ -1076,14 +1076,14 @@ class MyModel extends Model {
 		*/
 		if (Validation::date($date, $format) && Validation::time($time)) {
 			// after/before?
-			$minutes = isset($options['min']) ? $options['min'] : 1;
+			$seconds = isset($options['min']) ? $options['min'] : 1;
 			if (!empty($options['after']) && isset($this->data[$this->alias][$options['after']])) {
-				if (strtotime($this->data[$this->alias][$options['after']]) > strtotime($value) - $minutes) {
+				if (strtotime($this->data[$this->alias][$options['after']]) > strtotime($value) - $seconds) {
 					return false;
 				}
 			}
 			if (!empty($options['before']) && isset($this->data[$this->alias][$options['before']])) {
-				if (strtotime($this->data[$this->alias][$options['before']]) < strtotime($value) + $minutes) {
+				if (strtotime($this->data[$this->alias][$options['before']]) < strtotime($value) + $seconds) {
 					return false;
 				}
 			}