Browse Source

[Administration] Emails automatiques : adaptations jour et heure d'envoi + filtre par point de vente

develop
Guillaume Bourgeois 3 months ago
parent
commit
c3b4e97b32
3 changed files with 19 additions and 8 deletions
  1. +11
    -0
      backend/views/automatic-email/index.php
  2. +1
    -2
      console/commands/AutomaticEmailController.php
  3. +7
    -6
      domain/Communication/Email/EmailGenerator.php

+ 11
- 0
backend/views/automatic-email/index.php View File

@@ -55,6 +55,17 @@ $this->addButton(['label' => 'Nouvel email automatique <span class="glyphicon gl
<?= GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
[
'attribute' => 'id_point_sale',
'format' => 'raw',
'value' => function(AutomaticEmail $automaticEmail) {
if(!$automaticEmail->getPointSale()) {
return '<span class="label label-default">Tous</span>';
}

return $automaticEmail->getPointSale()->getName();
}
],
[
'attribute' => 'day',
'value' => function(AutomaticEmail $automaticEmail) {

+ 1
- 2
console/commands/AutomaticEmailController.php View File

@@ -34,8 +34,7 @@ class AutomaticEmailController extends Controller
$distribution,
$automaticEmail->getPointSale()
);
//$emailModule->getBulkMailer()->sendEmail($email, $usersArray);
echo $email->getHtmlContent();
$emailModule->getBulkMailer()->sendEmail($email, $usersArray);
echo 'Email automatique "'.$automaticEmail->getSubject().'" envoyé à '.count($usersArray)." utilisateur(s)\n";
}
}

+ 7
- 6
domain/Communication/Email/EmailGenerator.php View File

@@ -37,6 +37,11 @@ class EmailGenerator extends AbstractResolver
bool $addLinkOrderWhenNoDistribution = false
): Email
{
$linkProducer = '';
if($producer) {
$linkProducer = 'https://'.$producer->slug.'.souke.fr';
}

$messageAutoText = '' ;
$messageAutoHtml = '' ;

@@ -60,7 +65,7 @@ class EmailGenerator extends AbstractResolver
' ;
$messageAutoHtml .= '<br /><br />' ;

$linkOrder = $this->distributionSolver->getLinkOrder($distribution);
$linkOrder = $linkProducer.'/order/order?date='.$distribution->date;
$dateOrder = strftime('%A %d %B %Y', strtotime($distribution->date)) ;
$messageAutoHtml .= '<a href="'.$linkOrder.'">Passer ma commande du '.$dateOrder.'</a>' ;
$messageAutoText .= 'Suivez ce lien pour passer votre commande du '.$dateOrder.' :
@@ -110,10 +115,7 @@ Produits disponibles :
}
else {
if($addLinkOrderWhenNoDistribution) {
$linkOrder = \Yii::$app->urlManagerProducer->createAbsoluteUrl([
'order/order',
'slug_producer' => $this->getProducerContext()->slug
]) ;
$linkOrder = $linkProducer.'/order/order';
$messageAutoHtml .= '<a href="'.$linkOrder.'">Passer ma commande</a>' ;
$messageAutoText .= 'Suivez ce lien pour passer votre commande :
'.$linkOrder ;
@@ -124,7 +126,6 @@ Produits disponibles :
$fromEmail = $this->producerSolver->getProducerEmailPlatform($producer) ;
$fromName = $producer->name ;

$linkProducer = 'https://'.$producer->slug.'.souke.fr';
$linkUnsubscribe = $linkProducer.'/newsletter/unsubscribe';

// Message inscription newsletter

Loading…
Cancel
Save