{ | { | ||||
public function sendEmailNewProducer(Producer $producer): void | public function sendEmailNewProducer(Producer $producer): void | ||||
{ | { | ||||
\Yii::$app->mailer->compose( | |||||
\Yii::$app->mailerService->sendAdmin( | |||||
'Nouveau producteur', | |||||
'new-producer', | |||||
[ | [ | ||||
'html' => 'new-producer-html', | |||||
'text' => 'new-producer-text' | |||||
], [ | |||||
'producer' => $producer | |||||
]) | |||||
->setTo(\Yii::$app->parameterBag->get('adminEmail')) | |||||
->setFrom([\Yii::$app->parameterBag->get('adminEmail') => 'Opendistrib']) | |||||
->setSubject('[Opendistrib] Nouveau producteur') | |||||
->send(); | |||||
'producer' => $producer | |||||
] | |||||
); | |||||
} | } | ||||
} | } |
class m190205_160337_produit_don_distrib extends Migration { | class m190205_160337_produit_don_distrib extends Migration { | ||||
public function up() { | public function up() { | ||||
$this->insert('product', [ | |||||
/*$this->insert('product', [ | |||||
'name' => 'Don', | 'name' => 'Don', | ||||
'description' => 'Don à la plateforme distrib', | 'description' => 'Don à la plateforme distrib', | ||||
'recipe' => '', | 'recipe' => '', | ||||
'id_producer' => 0, | 'id_producer' => 0, | ||||
'sale_mode' => 'unit', | 'sale_mode' => 'unit', | ||||
'order' => 1000, | 'order' => 1000, | ||||
]) ; | |||||
]);*/ | |||||
} | } | ||||
public function down() { | public function down() { | ||||
$this->delete('product', 'name = \'Don\' AND id_producer = 0') ; | |||||
//$this->delete('product', 'name = \'Don\' AND id_producer = 0') ; | |||||
} | } | ||||
} | } |
} | } | ||||
if ($user->save()) { | if ($user->save()) { | ||||
return \Yii::$app->mailer->compose(['html' => 'passwordResetToken-html', 'text' => 'passwordResetToken-text'], ['user' => $user]) | |||||
->setFrom(['contact@opendistrib.net' => 'distrib']) | |||||
->setTo($this->email) | |||||
->setSubject('[Opendistrib] Mot de passe oublié') | |||||
->send(); | |||||
return \Yii::$app->mailerService->sendFromSite( | |||||
'Mot de passe oublié', | |||||
'passwordResetToken', | |||||
['user' => $user], | |||||
$this->email | |||||
); | |||||
} | } | ||||
} | } | ||||
if ($this->validate()) { | if ($this->validate()) { | ||||
$user = $userModule->instanciateUser(); | |||||
$user = $userModule->instanciateUser(User::TYPE_INDIVIDUAL); | |||||
$this->populateUser($user); | $this->populateUser($user); | ||||
if ($this->isProducer()) { | if ($this->isProducer()) { |