Browse Source

[Administration] Emails automatiques

feature/rotating_product
Guillaume Bourgeois 4 months ago
parent
commit
03c035e693
7 changed files with 18 additions and 12 deletions
  1. +1
    -1
      backend/views/communicate-admin/index.php
  2. +2
    -2
      backend/views/communicate/paper.php
  3. +1
    -1
      backend/views/layouts/left.php
  4. +6
    -0
      backend/web/js/backend.js
  5. +1
    -1
      common/components/UrlManagerCommon.php
  6. +7
    -3
      domain/Communication/AutomaticEmail/AutomaticEmailResolver.php
  7. +0
    -4
      producer/controllers/OrderController.php

+ 1
- 1
backend/views/communicate-admin/index.php View File

use yii\widgets\ActiveForm; use yii\widgets\ActiveForm;


$this->setTitle('Envoyer un email') ; $this->setTitle('Envoyer un email') ;
$this->addBreadcrumb(['label' => 'Communiquer', 'url' => ['user/index']]) ;
$this->addBreadcrumb(['label' => 'Communication', 'url' => ['user/index']]) ;
$this->addBreadcrumb($this->getTitle()) ; $this->addBreadcrumb($this->getTitle()) ;


?> ?>

+ 2
- 2
backend/views/communicate/paper.php View File



use yii\helpers\Html ; use yii\helpers\Html ;


$this->setTitle('Communiquer par papier') ;
$this->addBreadcrumb('Communiquer') ;
$this->setTitle('Communication par papier') ;
$this->addBreadcrumb('Communication') ;


?> ?>



+ 1
- 1
backend/views/layouts/left.php View File

], ],
['label' => 'Abonnements', 'icon' => 'repeat', 'url' => ['/subscription/index'], 'visible' => $isUserCurrentGrantedAsProducer, 'active' => Yii::$app->controller->id == 'subscription'], ['label' => 'Abonnements', 'icon' => 'repeat', 'url' => ['/subscription/index'], 'visible' => $isUserCurrentGrantedAsProducer, 'active' => Yii::$app->controller->id == 'subscription'],
[ [
'label' => 'Communiquer',
'label' => 'Communication',
'icon' => 'bullhorn', 'icon' => 'bullhorn',
'url' => ['/communicate/email'], 'url' => ['/communicate/email'],
'visible' => $isUserCurrentGrantedAsProducer, 'visible' => $isUserCurrentGrantedAsProducer,

+ 6
- 0
backend/web/js/backend.js View File

} }
} }


function opendistrib_user_credit() {
if($('body.user-credit').length) {
$('#creditform-amount').focus();
}
}

function opendistrib_producers_admin() { function opendistrib_producers_admin() {
$('.producer-admin-index .btn-alwaysdata, .producer-admin-index .btn-dolibarr').click(function () { $('.producer-admin-index .btn-alwaysdata, .producer-admin-index .btn-dolibarr').click(function () {
var $button = $(this); var $button = $(this);

+ 1
- 1
common/components/UrlManagerCommon.php View File

{ {
if ($this->_hostInfo === null) if ($this->_hostInfo === null)
{ {
$secure = Yii::$app->getRequest()->getIsSecureConnection();
$secure = Yii::$app->getRequest()->isConsoleRequest ? false : Yii::$app->getRequest()->getIsSecureConnection();
$http = $secure ? 'https' : 'http'; $http = $secure ? 'https' : 'http';


if (isset($_SERVER['HTTP_HOST'])) { if (isset($_SERVER['HTTP_HOST'])) {

+ 7
- 3
domain/Communication/AutomaticEmail/AutomaticEmailResolver.php View File



public function getMatchedDistribution(AutomaticEmail $automaticEmail): ?Distribution public function getMatchedDistribution(AutomaticEmail $automaticEmail): ?Distribution
{ {
$date = (new \DateTime('+'.$automaticEmail->getDelayBeforeDistribution().' days'))->format('Y-m-d');
$distribution = $this->distributionRepository->findOneDistribution($date);
$date = (new \DateTime('+'.$automaticEmail->getDelayBeforeDistribution().' days'));
$dateFormat = $date->format('Y-m-d');
$distribution = $this->distributionRepository->findOneDistribution($dateFormat);


if($distribution && $distribution->active && !$this->producerSolver->isOnLeavePeriodByDistribution($distribution)) {
if($distribution
&& $distribution->active
&& $date->format('N') == $automaticEmail->getDay()
&& !$this->producerSolver->isOnLeavePeriodByDistribution($distribution)) {
return $distribution; return $distribution;
} }



+ 0
- 4
producer/controllers/OrderController.php View File

$idProducer = $producer->id; $idProducer = $producer->id;
$order = new Order; $order = new Order;


if ($idProducer) {
$this->_verifyProducerActive($idProducer);
}

if ($order->load($posts)) { if ($order->load($posts)) {
$user = $this->getUserCurrent(); $user = $this->getUserCurrent();



Loading…
Cancel
Save