Quellcode durchsuchen

[Administration] Emails automatiques : ajustements

develop
Guillaume Bourgeois vor 4 Monaten
Ursprung
Commit
98b0091446
3 geänderte Dateien mit 30 neuen und 24 gelöschten Zeilen
  1. +1
    -1
      backend/views/automatic-email/_form.php
  2. +1
    -1
      console/commands/AutomaticEmailController.php
  3. +28
    -22
      domain/Communication/AutomaticEmail/AutomaticEmail.php

+ 1
- 1
backend/views/automatic-email/_form.php Datei anzeigen

@@ -44,7 +44,7 @@ use yii\widgets\ActiveForm;
?>

<div class="automatic-email-form">
<?php $form = ActiveForm::begin(); ?>
<?php $form = ActiveForm::begin(['enableClientValidation' => false]); ?>
<div class="col-md-8">
<div class="panel panel-default">
<div class="panel-heading">

+ 1
- 1
console/commands/AutomaticEmailController.php Datei anzeigen

@@ -23,7 +23,7 @@ class AutomaticEmailController extends Controller
$automaticEmailsArray = $automaticEmailModule->getRepository()->findAutomaticEmails();
foreach($automaticEmailsArray as $automaticEmail) {
$distribution = $automaticEmailModule->getResolver()->getMatchedDistribution($automaticEmail);
if($distribution) {
if($automaticEmail->isEnabled() && $distribution) {
$email = $automaticEmailModule->getManager()->createEmailFromAutomaticEmail($automaticEmail, $distribution);
$usersArray = $emailModule->getContactListResolver()->search($producer, Email::TYPE_ORDER_TAKING, $distribution);
$emailModule->getBulkMailer()->sendEmail($email, $usersArray);

+ 28
- 22
domain/Communication/AutomaticEmail/AutomaticEmail.php Datei anzeigen

@@ -4,6 +4,7 @@ namespace domain\Communication\AutomaticEmail;

use common\components\ActiveRecordCommon;
use common\components\Date;
use domain\_\StatusInterface;
use domain\Producer\Producer\Producer;
use yii\db\ActiveQuery;

@@ -37,6 +38,33 @@ class AutomaticEmail extends ActiveRecordCommon
];
}

/* Méthodes */

public function isEnabled(): bool
{
return (bool) $this->getStatus() == StatusInterface::STATUS_ONLINE;
}

public function getDayAsString(): string
{
return Date::getDayOfWeekStringByNumber($this->getDay());
}

public function getDelayBeforeDistributionAsString(): string
{
return $this->getDelayBeforeDistribution().' jour(s) avant';
}

public function getStatusAsHtml(): string
{
if($this->getStatus()) {
return '<span class="label label-success">Activé</span>';
}
else {
return '<span class="label label-danger">Désactivé</span>';
}
}

/* Getters / Setters */

public function getId(): ?int
@@ -127,26 +155,4 @@ class AutomaticEmail extends ActiveRecordCommon
{
return $this->hasOne(Producer::class, ['id' => 'id_producer']);
}

/* Méthodes */

public function getDayAsString(): string
{
return Date::getDayOfWeekStringByNumber($this->getDay());
}

public function getDelayBeforeDistributionAsString(): string
{
return $this->getDelayBeforeDistribution().' jour(s) avant';
}

public function getStatusAsHtml(): string
{
if($this->getStatus()) {
return '<span class="label label-success">Activé</span>';
}
else {
return '<span class="label label-danger">Désactivé</span>';
}
}
}

Laden…
Abbrechen
Speichern