Browse Source

Merge branch 'dev'

master
Guillaume 4 years ago
parent
commit
eb44407f1a
5 changed files with 33 additions and 9 deletions
  1. +13
    -0
      common/models/Producer.php
  2. +10
    -2
      producer/controllers/OrderController.php
  3. +3
    -4
      producer/controllers/SiteController.php
  4. +6
    -2
      producer/views/layouts/main.php
  5. +1
    -1
      producer/views/site/index.php

+ 13
- 0
common/models/Producer.php View File

return $this->slug.'@opendistrib.net' ; return $this->slug.'@opendistrib.net' ;
} }


public function getMainContact()
{
if($this->contact) {
foreach($this->contact as $contact) {
if($contact->is_main_contact) {
return $contact ;
}
}
}

return false ;
}

} }

+ 10
- 2
producer/controllers/OrderController.php View File

// envoi mail de confirmation // envoi mail de confirmation
if($isNewOrder && Producer::getConfig('option_email_confirm')) { if($isNewOrder && Producer::getConfig('option_email_confirm')) {
$user = User::getCurrent() ; $user = User::getCurrent() ;
$successMail = Mailjet::sendMail([
$paramsEmail = [
'from_email' => $producer->getEmailOpendistrib(), 'from_email' => $producer->getEmailOpendistrib(),
'from_name' => $producer->name, 'from_name' => $producer->name,
'to_email' => $user->email, 'to_email' => $user->email,
'distribution' => $distribution, 'distribution' => $distribution,
'user' => $user 'user' => $user
] ]
]);
] ;
$successMail = Mailjet::sendMail($paramsEmail);

$contactProducer = $producer->getMainContact() ;
if($contactProducer && strlen($contactProducer->email)) {
$paramsEmail['to_email'] = $contactProducer->email ;
$paramsEmail['to_name'] = $contactProducer->name ;
$successMail = Mailjet::sendMail($paramsEmail);
}
} }


$order->setTillerSynchronization() ; $order->setTillerSynchronization() ;

+ 3
- 4
producer/controllers/SiteController.php View File

$isSent = false ; $isSent = false ;
if (is_array($producer->contact)) { if (is_array($producer->contact)) {
$email = '' ; $email = '' ;
foreach($producer->contact as $contact) {
if($contact->is_main_contact) {
$email = $contact->email ;
}
$contact = $producer->getMainContact() ;
if($contact) {
$email = $contact->email ;
} }


if(strlen($email) && $model->sendEmail($email)) { if(strlen($email) && $model->sendEmail($email)) {

+ 6
- 2
producer/views/layouts/main.php View File

</div> </div>
<?php endif; ?> <?php endif; ?>
<div id="infos-producer"> <div id="infos-producer">
<?php if(!$producer->hasSpecificDelays()): ?>
<?php if(!$producer->hasSpecificDelays() && $producer->order_deadline && $producer->order_delay): ?>
<span data-toggle="tooltip" data-placement="bottom" title="Heure limite de commande"> <span data-toggle="tooltip" data-placement="bottom" title="Heure limite de commande">
<span class="glyphicon glyphicon-time"></span> Commande avant <span class="glyphicon glyphicon-time"></span> Commande avant
<strong><?php echo Html::encode($producer->order_deadline) ?> h</strong></span>, <strong><?php echo Html::encode($producer->order_deadline) ?> h</strong></span>,
<span data-toggle="tooltip" data-placement="bottom" <span data-toggle="tooltip" data-placement="bottom"
title="Exemple : commande le lundi pour le <?php if ($producer->order_delay == 1): ?>mardi<?php elseif ($producer->order_delay == 2): ?>mercredi<?php elseif ($producer->order_delay == 3): ?>jeudi<?php elseif ($producer->order_delay == 4): ?>vendredi<?php elseif ($producer->order_delay == 5): ?>samedi<?php elseif ($producer->order_delay == 6): ?>dimanche<?php elseif ($producer->order_delay == 7): ?>lundi d'après<?php endif; ?>"><strong><?= Html::encode($producer->order_delay) ?> jour<?php if ($producer->order_delay > 1): ?>s<?php endif; ?></strong> à l'avance</span>
title="Exemple : commande le lundi pour le
<?php if ($producer->order_delay == 1): ?>mardi<?php elseif ($producer->order_delay == 2): ?>mercredi
<?php elseif ($producer->order_delay == 3): ?>jeudi<?php elseif ($producer->order_delay == 4): ?>vendredi
<?php elseif ($producer->order_delay == 5): ?>samedi<?php elseif ($producer->order_delay == 6): ?>dimanche
<?php elseif ($producer->order_delay == 7): ?>lundi d'après<?php endif; ?>"><strong><?= Html::encode($producer->order_delay) ?> jour<?php if ($producer->order_delay > 1): ?>s<?php endif; ?></strong> à l'avance</span>
<?php endif; ?> <?php endif; ?>


<?php if (!Yii::$app->user->isGuest): ?> <?php if (!Yii::$app->user->isGuest): ?>

+ 1
- 1
producer/views/site/index.php View File

$html .= ' / '.Html::encode($model->description) ; $html .= ' / '.Html::encode($model->description) ;
} }
if(strlen($model->recipe)) { if(strlen($model->recipe)) {
$html .= '<br />'.Html::encode($model->recipe) ;
$html .= '<br />'.nl2br(Html::encode($model->recipe)) ;
} }
return $html ; return $html ;
} }

Loading…
Cancel
Save