Skip to content

Commit

Permalink
fix smtp issue when logged with agent user
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed Apr 11, 2019
1 parent a29f8e5 commit 93967dd
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
13 changes: 13 additions & 0 deletions protected/controllers/SmtpsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,19 @@ public function actionRead($asJson = true, $condition = null)
parent::actionRead($asJson = true, $condition = null);
}

public function extraFilterCustomAgent($filter)
{
//se é agente filtrar pelo user.id_user

$this->relationFilter['idUser'] = array(
'condition' => "idUser.id LIKE :agfby",
);

$this->paramsFilter[':agfby'] = Yii::app()->session['id_user'];

return $filter;
}

public function beforeSave($values)
{
if ($this->isNewRecord) {
Expand Down
13 changes: 13 additions & 0 deletions protected/controllers/TemplateMailController.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,17 @@ public function actionRead($asJson = true, $condition = null)
parent::actionRead($asJson = true, $condition = null);
}

public function extraFilterCustomAgent($filter)
{
//se é agente filtrar pelo user.id_user

$this->relationFilter['idUser'] = array(
'condition' => "idUser.id LIKE :agfby",
);

$this->paramsFilter[':agfby'] = Yii::app()->session['id_user'];

return $filter;
}

}
10 changes: 10 additions & 0 deletions protected/models/TemplateMail.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,20 @@ public function primaryKey()
public function rules()
{
return array(
array('id_user', 'numerical', 'integerOnly' => true),
array('mailtype', 'length', 'max' => 50),
array('fromname, fromemail, language', 'length', 'max' => 70),
array('subject', 'length', 'max' => 130),
array('messagehtml', 'length', 'max' => 3000),
);
}
/**
* @return array regras de relacionamento.
*/
public function relations()
{
return array(
'idUser' => array(self::BELONGS_TO, 'User', 'id_user'),
);
}
}

0 comments on commit 93967dd

Please sign in to comment.