Commit 9fd2f673 authored by Олег Гиммельшпах's avatar Олег Гиммельшпах

Merge branch 'master' of git.task-on.com:ktask/task-on.com

parents 7e407406 a1f81783
......@@ -5,13 +5,12 @@ namespace common\modules\triggers\components\conditions\conditions;
use common\components\UnisenderAPI;
use common\modules\triggers\components\conditions\vendor\ConditionBase;
use common\modules\triggers\components\conditions\vendor\ConditionInterface;
use common\modules\users\models\User;
class CheckUserToRegistration extends ConditionBase implements ConditionInterface{
const CONDITION_ID = 6;
public $recall=false;
public $name = 'Пользователь зарегистрировался (Игнорируется оператором "И")';
public $name = 'Пользователь зарегистрировался';
/**
* @param null|string $conditionName
......@@ -26,6 +25,7 @@ class CheckUserToRegistration extends ConditionBase implements ConditionInterfac
* @return bool
*/
public function check($message){
return true;
$exists = User::find()->where(['email' => $message->email])->exists();
return $exists;
}
}
\ No newline at end of file
......@@ -526,6 +526,11 @@ class User extends \common\components\ActiveRecordModel implements IdentityInter
return true;
}
public function afterDelete()
{
TriggerSchedule::deleteAll(['email' => $this->email]);
}
public function getFio()
{
$result = $this->name;
......@@ -578,7 +583,9 @@ class User extends \common\components\ActiveRecordModel implements IdentityInter
$actualTriggers = TriggerTrigger::getActualTriggers();
foreach($actualTriggers as $trigger) {
$exists = TriggerCondition::find()->where(['trigger_id'=>$trigger->id, 'condition_id'=>CheckUserToRegistration::CONDITION_ID])->exists();
if ($exists===true) {
$count = TriggerCondition::find()->where(['trigger_id'=>$trigger->id])->count();
// Добавляем в расписание срабатывание триггера регистрации только при условии что у триггера условие регистрации есть и оно там одно
if ($exists===true && $count==1) {
$init = $trigger->initAction($params);
if ($init===true) {
$curl = curl_init();
......
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