fix: [decaying] Set default value and pre-checks

pull/5032/head
mokaddem 2019-08-21 12:06:49 +02:00
parent 60338499c7
commit f59b338c47
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
2 changed files with 10 additions and 3 deletions

View File

@ -3138,6 +3138,9 @@ class Attribute extends AppModel
if (!isset($options['decayingModel'])) {
$options['decayingModel'] = false;
}
if (!isset($options['modelOverrides'])) {
$options['modelOverrides'] = array();
}
if (!isset($options['excludeDecayed'])) {
$options['excludeDecayed'] = 0;
} else {

View File

@ -166,7 +166,11 @@ class DecayingModel extends AppModel
public function isDefaultModel($decaying_model)
{
return !is_null($decaying_model['DecayingModel']['uuid']);
if (isset($decaying_model['DecayingModel']['uuid'])) {
return !is_null($decaying_model['DecayingModel']['uuid']);
} else {
return false;
}
}
public function isEditableByCurrentUser($user, $decaying_model)
@ -482,9 +486,9 @@ class DecayingModel extends AppModel
$models = $this->fetchModels($user, $associated_model_ids, false, array('enabled' => true));
}
} elseif (is_array($model_id)) {
$models = $this->fetchModels($user, $model_id, false, array('enabled' => true));
$models = $this->fetchModels($user, $model_id, false, array());
} else {
$models[] = $this->fetchModel($user, $model_id, false, array('enabled' => true));
$models[] = $this->fetchModel($user, $model_id, false, array());
}
foreach ($models as $i => $model) {