- Дописаны дополнительные условия проверки передаемых параметров. email теперь...

- Дописаны дополнительные условия проверки передаемых параметров. email теперь определяется одним из двух возможных способов, получением его через params или через message
parent 95a3970a
......@@ -80,8 +80,15 @@ class CheckPresenceTime extends ConditionBase implements ConditionInterface {
* @param TriggerSchedule $message
* @return bool
*/
public function check($message){
$user = User::find()->where(['email' => $message->email])->one();
public function check($message=null, $params = array()){
$email = null;
if (!is_null($message))
$email = $message->email;
elseif(array_key_exists('email', $params)) {
$email = $params['email'];
}
if (!is_null($email)) {
$user = User::find()->where(['email' => $email])->one();
if (!is_null($message->trigger_id) && !is_null($user)) {
/** @var TriggerCondition[] $conditions */
$conditions = TriggerCondition::find()->where(['trigger_id'=>$message->trigger_id, 'condition_id' => self::CONDITION_ID])->all();
......@@ -96,6 +103,7 @@ class CheckPresenceTime extends ConditionBase implements ConditionInterface {
}
}
}
}
return false;
}
}
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment