Parcourir la source

Merge branch 'develop'

master
Fab il y a 4 ans
Parent
révision
963039702e
4 fichiers modifiés avec 93 ajouts et 1 suppressions
  1. +2
    -1
      ShopBundle/Controller/Backend/AdminController.php
  2. +87
    -0
      ShopBundle/Listener/MailLoggerListener.php
  3. +1
    -0
      ShopBundle/Resources/translations/lcshop.fr.yaml
  4. +3
    -0
      ShopBundle/Services/Utils.php

+ 2
- 1
ShopBundle/Controller/Backend/AdminController.php Voir le fichier

@@ -15,6 +15,7 @@ use Lc\ShopBundle\Context\StatusInterface;
use Lc\ShopBundle\Context\TreeInterface;
use Lc\ShopBundle\Form\Backend\Common\AbstractEditPositionType;
use Lc\ShopBundle\Form\Backend\Filters\ListFilterType;
use Lc\ShopBundle\Model\User;
use Lc\ShopBundle\Services\UtilsManager;
use Mailjet\MailjetSwiftMailer\SwiftMailer\MailjetTransport;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
@@ -517,7 +518,7 @@ class AdminController extends EasyAdminController

$id = $this->request->query->get('id');
$easyadmin = $this->request->attributes->get('easyadmin');
$entity = $easyadmin['item'];
$entity = $easyadmin['item'];

if ($this->request->isXmlHttpRequest() && $property = $this->request->query->get('property')) {
$newValue = 'true' === mb_strtolower($this->request->query->get('newValue'));

+ 87
- 0
ShopBundle/Listener/MailLoggerListener.php Voir le fichier

@@ -0,0 +1,87 @@
<?php

namespace Lc\ShopBundle\Services;

use Psr\Log\LoggerInterface;
use Psr\Log\LogLevel;
use Swift_Events_SendEvent;
use Swift_Events_SendListener;

class MailLoggerUtil implements Swift_Events_SendListener
{
protected $logger;

/**
* MailerLoggerUtil constructor.
*
* @param LoggerInterface $logger
*/
public function __construct(LoggerInterface $logger)
{
$this->logger = $logger;
}

/**
* @param Swift_Events_SendEvent $evt
*/
public function beforeSendPerformed(Swift_Events_SendEvent $evt)
: void
{
}

/**
* @param Swift_Events_SendEvent $evt
*/
public function sendPerformed(Swift_Events_SendEvent $evt)
: void
{

dump('ncnnc');
$level = $this->getLogLevel($evt);
$message = $evt->getMessage();

$this->logger->log(
$level,
$message->getSubject().' - '.$message->getId(),
[
'result' => $evt->getResult(),
'subject' => $message->getSubject(),
'to' => $message->getTo(),
'cc' => $message->getCc(),
'bcc' => $message->getBcc(),
]
);
}

/**
* @param Swift_Events_SendEvent $evt
*
* @return string
*/
private function getLogLevel(Swift_Events_SendEvent $evt)
: string
{
switch ($evt->getResult()) {
// Sending has yet to occur
case Swift_Events_SendEvent::RESULT_PENDING:
return LogLevel::DEBUG;

// Email is spooled, ready to be sent
case Swift_Events_SendEvent::RESULT_SPOOLED:
return LogLevel::DEBUG;

// Sending failed
default:
case Swift_Events_SendEvent::RESULT_FAILED:
return LogLevel::CRITICAL;

// Sending worked, but there were some failures
case Swift_Events_SendEvent::RESULT_TENTATIVE:
return LogLevel::ERROR;

// Sending was successful
case Swift_Events_SendEvent::RESULT_SUCCESS:
return LogLevel::INFO;
}
}
}

+ 1
- 0
ShopBundle/Resources/translations/lcshop.fr.yaml Voir le fichier

@@ -382,6 +382,7 @@ field:
unit: Unité
OrderShop:
createdAt: Date de création
updatedAt: Date de modification
save: Sauvegarder
reference: Référence
mainInfo: Information principal

+ 3
- 0
ShopBundle/Services/Utils.php Voir le fichier

@@ -360,6 +360,9 @@ class Utils
return $str;
}

public function csvEscape($str){
return str_replace(array("\r", "\n"), ' ', $str);
}
public function getRemindersByUser($user)
{
$reminderRepo = $this->em->getRepository(ReminderInterface::class);

Chargement…
Annuler
Enregistrer