Procházet zdrojové kódy

Merge branch 'dev'

master
Guillaume před 4 roky
rodič
revize
eb44407f1a
5 změnil soubory, kde provedl 33 přidání a 9 odebrání
  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 Zobrazit soubor

@@ -609,5 +609,18 @@ class Producer extends ActiveRecordCommon
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 Zobrazit soubor

@@ -412,7 +412,7 @@ class OrderController extends ProducerBaseController
// envoi mail de confirmation
if($isNewOrder && Producer::getConfig('option_email_confirm')) {
$user = User::getCurrent() ;
$successMail = Mailjet::sendMail([
$paramsEmail = [
'from_email' => $producer->getEmailOpendistrib(),
'from_name' => $producer->name,
'to_email' => $user->email,
@@ -426,7 +426,15 @@ class OrderController extends ProducerBaseController
'distribution' => $distribution,
'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() ;

+ 3
- 4
producer/controllers/SiteController.php Zobrazit soubor

@@ -152,10 +152,9 @@ class SiteController extends ProducerBaseController
$isSent = false ;
if (is_array($producer->contact)) {
$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)) {

+ 6
- 2
producer/views/layouts/main.php Zobrazit soubor

@@ -234,12 +234,16 @@ if (!Yii::$app->user->isGuest) {
</div>
<?php endif; ?>
<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 class="glyphicon glyphicon-time"></span> Commande avant
<strong><?php echo Html::encode($producer->order_deadline) ?> h</strong></span>,
<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 if (!Yii::$app->user->isGuest): ?>

+ 1
- 1
producer/views/site/index.php Zobrazit soubor

@@ -143,7 +143,7 @@ $this->setPageTitle(Html::encode($producer->type.' à '.$producer->city)) ;
$html .= ' / '.Html::encode($model->description) ;
}
if(strlen($model->recipe)) {
$html .= '<br />'.Html::encode($model->recipe) ;
$html .= '<br />'.nl2br(Html::encode($model->recipe)) ;
}
return $html ;
}

Načítá se…
Zrušit
Uložit