|
@@ -2,6 +2,7 @@
|
|
|
App::uses('ShimModel', 'Shim.Model');
|
|
App::uses('ShimModel', 'Shim.Model');
|
|
|
App::uses('Utility', 'Tools.Utility');
|
|
App::uses('Utility', 'Tools.Utility');
|
|
|
App::uses('Hash', 'Utility');
|
|
App::uses('Hash', 'Utility');
|
|
|
|
|
+App::uses('Validation', 'Utility');
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* Model enhancements for Cake2
|
|
* Model enhancements for Cake2
|
|
@@ -1033,9 +1034,7 @@ class MyModel extends ShimModel {
|
|
|
// crashed with white screen of death otherwise... (if foreign page is 404)
|
|
// crashed with white screen of death otherwise... (if foreign page is 404)
|
|
|
$this->UndisposableEmail->useOnlineList(false);
|
|
$this->UndisposableEmail->useOnlineList(false);
|
|
|
}
|
|
}
|
|
|
- if (!class_exists('Validation')) {
|
|
|
|
|
- App::uses('Validation', 'Utility');
|
|
|
|
|
- }
|
|
|
|
|
|
|
+
|
|
|
if (!Validation::email($email)) {
|
|
if (!Validation::email($email)) {
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
@@ -1204,7 +1203,7 @@ class MyModel extends ShimModel {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (empty($this->validate[$column])) {
|
|
if (empty($this->validate[$column])) {
|
|
|
- $this->validate[$column]['notEmpty'] = ['rule' => 'notEmpty', 'required' => true, 'allowEmpty' => $setAllowEmpty, 'message' => 'valErrMandatoryField'];
|
|
|
|
|
|
|
+ $this->validate[$column]['notBlank'] = ['rule' => 'notBlank', 'required' => true, 'allowEmpty' => $setAllowEmpty, 'message' => 'valErrMandatoryField'];
|
|
|
} else {
|
|
} else {
|
|
|
$keys = array_keys($this->validate[$column]);
|
|
$keys = array_keys($this->validate[$column]);
|
|
|
if (!in_array('rule', $keys)) {
|
|
if (!in_array('rule', $keys)) {
|
|
@@ -1336,6 +1335,20 @@ class MyModel extends ShimModel {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
|
+ * Shim wrapper for 2.6 to allow 2.7 notBlank validation rule to work already.
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param $data
|
|
|
|
|
+ * @return bool
|
|
|
|
|
+ */
|
|
|
|
|
+ public function notBlank($data) {
|
|
|
|
|
+ $value = array_shift($data);
|
|
|
|
|
+ if ((float)Configure::version() < 2.7) {
|
|
|
|
|
+ return Validation::notEmpty($value);
|
|
|
|
|
+ }
|
|
|
|
|
+ return Validation::notBlank($value);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
* Recursive Dropdown Lists
|
|
* Recursive Dropdown Lists
|
|
|
* NEEDS tree behavior, NEEDS lft, rght, parent_id (!)
|
|
* NEEDS tree behavior, NEEDS lft, rght, parent_id (!)
|
|
|
* //FIXME
|
|
* //FIXME
|