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()) ; | ||||
?> | ?> |
use yii\helpers\Html ; | use yii\helpers\Html ; | ||||
$this->setTitle('Communiquer par papier') ; | |||||
$this->addBreadcrumb('Communiquer') ; | |||||
$this->setTitle('Communication par papier') ; | |||||
$this->addBreadcrumb('Communication') ; | |||||
?> | ?> | ||||
], | ], | ||||
['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, |
} | } | ||||
} | } | ||||
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); |
{ | { | ||||
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'])) { |
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; | ||||
} | } | ||||
$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(); | ||||