Bläddra i källkod

Refactoring services #885

refactoring
Guillaume Bourgeois 1 år sedan
förälder
incheckning
a4d86c63a6
38 ändrade filer med 211 tillägg och 147 borttagningar
  1. +1
    -1
      backend/controllers/CronController.php
  2. +2
    -1
      backend/controllers/DistributionController.php
  3. +10
    -9
      backend/controllers/OrderController.php
  4. +15
    -11
      backend/views/distribution/report-bourlingue.php
  5. +24
    -21
      backend/views/distribution/report.php
  6. +3
    -3
      backend/views/layouts/left.php
  7. +12
    -9
      backend/views/order/report.php
  8. +11
    -7
      backend/views/site/index.php
  9. +1
    -1
      common/components/ActiveRecordCommon.php
  10. +1
    -1
      common/logic/AbstractSingleton.php
  11. +2
    -2
      common/logic/Distribution/Distribution/Model/Distribution.php
  12. +0
    -3
      common/logic/Distribution/Distribution/Service/DistributionBuilder.php
  13. +2
    -2
      common/logic/Order/Order/Repository/OrderRepository.php
  14. +3
    -0
      common/logic/Order/Order/Service/OrderBuilder.php
  15. +38
    -2
      common/logic/Order/Order/Service/OrderSolver.php
  16. +3
    -3
      common/logic/Product/Product/Service/ProductSolver.php
  17. +2
    -2
      common/logic/Product/ProductPrice/Service/ProductPriceSolver.php
  18. +4
    -1
      common/logic/User/CreditHistory/Service/CreditHistoryBuilder.php
  19. +0
    -32
      common/logic/User/CreditHistory/Service/CreditHistorySolver.php
  20. +3
    -0
      common/mail/creditConfirm-html.php
  21. +3
    -0
      common/mail/creditConfirm-text.php
  22. +1
    -0
      common/mail/creditUser-text.php
  23. +9
    -6
      common/mail/orderConfirm-html.php
  24. +9
    -4
      common/mail/orderConfirm-text.php
  25. +6
    -1
      common/mail/orderConfirmProducer-html.php
  26. +6
    -1
      common/mail/orderConfirmProducer-text.php
  27. +2
    -3
      common/mail/passwordResetToken-html.php
  28. +1
    -3
      common/mail/passwordResetToken-text.php
  29. +5
    -3
      common/mail/paymentError-html.php
  30. +2
    -0
      common/mail/paymentError-text.php
  31. +6
    -2
      common/mail/paymentErrorProducer-html.php
  32. +6
    -1
      common/mail/paymentErrorProducer-text.php
  33. +2
    -1
      common/mail/paymentOrderConfirm-html.php
  34. +2
    -0
      common/mail/paymentOrderConfirm-text.php
  35. +0
    -1
      common/mail/signup-html.php
  36. +0
    -2
      common/mail/signup-text.php
  37. +5
    -5
      producer/controllers/OrderController.php
  38. +9
    -3
      producer/views/order/confirm.php

+ 1
- 1
backend/controllers/CronController.php Visa fil

@@ -200,7 +200,7 @@ class CronController extends BackendController
if ($orderManager->getOrderAmount($order, Order::AMOUNT_REMAINING) > 0) {
$creditHistoryManager->createCreditHistory(
CreditHistory::TYPE_PAYMENT,
$orderManager->getAmount($order, Order::AMOUNT_REMAINING),
$orderManager->getOrderAmount($order, Order::AMOUNT_REMAINING),
$order->distribution->producer,
$order->user,
$userManager->findOneUserById(User::ID_USER_SYSTEM),

+ 2
- 1
backend/controllers/DistributionController.php Visa fil

@@ -117,7 +117,6 @@ class DistributionController extends BackendController
$creditHistoryManager = $this->getCreditHistoryManager();
$userManager = $this->getUserManager();
$subscriptionManager = $this->getSubscriptionManager();
$pointSaleManager = $this->getPointSaleManager();

$producer = $this->getProducerCurrent();

@@ -254,6 +253,8 @@ class DistributionController extends BackendController
if ($ordersArray) {
foreach ($ordersArray as &$order) {

$orderManager->initOrder($order);

$productOrderArray = [];
foreach ($order->productOrder as $productOrder) {
$productOrderArray[$productOrder->id_product] = [

+ 10
- 9
backend/controllers/OrderController.php Visa fil

@@ -887,6 +887,7 @@ class OrderController extends BackendController
$userManager = $this->getUserManager();
$pointSaleManager = $this->getPointSaleManager();
$userPointSaleManager = $this->getUserPointSaleManager();
$creditHistoryManager = $this->getCreditHistoryManager();

$request = \Yii::$app->request;
$date = $request->post('date');
@@ -906,6 +907,7 @@ class OrderController extends BackendController
&& $order->distribution->id_producer == GlobalParam::getCurrentProducerId()) {

$oldIdUser = $order->id_user;
$oldUser = $userManager->findOneUserById($oldIdUser);
if ($idUser) {
$order->username = '';
$order->id_user = $idUser;
@@ -986,24 +988,23 @@ class OrderController extends BackendController
$order = Order::searchOne(['id' => $order->id]);
if ($order && $orderManager->isCreditAutoPayment($order)) {
// Si changement d'user : on rembourse l'ancien user
$amountPaid = $order->getAmount(Order::AMOUNT_PAID);
$amountPaid = $orderManager->getOrderAmount($order, Order::AMOUNT_PAID);
if ($oldIdUser != $idUser && $amountPaid > 0) {
$order->saveCreditHistory(
$creditHistoryManager->createCreditHistory(
CreditHistory::TYPE_REFUND,
$amountPaid,
GlobalParam::getCurrentProducerId(),
$oldIdUser,
GlobalParam::getCurrentUserId()
$this->getProducerCurrent(),
$oldUser,
$this->getUserCurrent()
);
$order = Order::searchOne(['id' => $order->id]);
}

$order->processCredit();
$orderManager->processCredit($order);
}
}
}


/**
* Retourne l'état du paiement (historique, crédit) d'une commande donnée.
*/
@@ -1025,7 +1026,7 @@ class OrderController extends BackendController
])
->one();

$amountPaid = $order->getAmount(Order::AMOUNT_PAID);
$amountPaid = $orderManager->getOrderAmount($order, Order::AMOUNT_PAID);

if (abs($order->amount - $amountPaid) < 0.0001) {
$html .= '<span class="label label-success">Payé</span>';

+ 15
- 11
backend/views/distribution/report-bourlingue.php Visa fil

@@ -36,15 +36,19 @@ pris connaissance de la licence CeCILL, et que vous en avez accepté les
termes.
*/

use common\models\Order ;
use common\models\Product ;
use common\helpers\Price;
use common\logic\Order\Order\Wrapper\OrderManager;
use common\logic\Product\Product\Model\Product;
use common\logic\Product\Product\Wrapper\ProductManager;
use common\logic\User\UserProducer\Model\UserProducer;

$productManager = ProductManager::getInstance();
$orderManager = OrderManager::getInstance();

$dayWeek = date('w', strtotime($date));
$dayWeekArray = [0 => 'sunday', 1 => 'monday', 2 => 'tuesday', 3 => 'wednesday', 4 => 'thursday', 5 => 'friday', 6 => 'saturday'];
$fieldInfosPointSale = 'infos_' . $dayWeekArray[$dayWeek];

$html = '' ;

$count = count($productsArray) ;
$limit = 100 ;
$isBig = $count > $limit ;
@@ -104,7 +108,7 @@ foreach ($pointsSaleArray as $pointSale) {
$add = false;
foreach ($order->productOrder as $productOrder) {
if($product->id == $productOrder->id_product) {
$unit = ( Product::strUnit($productOrder->unit, 'wording_short', true) == 'p.') ? '' : '&nbsp;'. Product::strUnit($productOrder->unit, 'wording_short', true) ;
$unit = ( $productManager->strUnit($productOrder->unit, 'wording_short', true) == 'p.') ? '' : '&nbsp;'. $productManager->strUnit($productOrder->unit, 'wording_short', true) ;
$strProducts .= $product->name . ' (' .$productOrder->quantity .$unit.')<br />';
$add = true;
}
@@ -182,9 +186,9 @@ foreach ($pointsSaleArray as $pointSale) {
$cpt = 0 ;
foreach ($productsArray as $product) {
foreach( Product::$unitsArray as $unit => $dataUnit) {
$quantity = Order::getProductQuantity($product->id, $pointSale->orders, false, $unit);
$quantity = $orderManager->getProductQuantity($product->id, $pointSale->orders, false, $unit);
if ($quantity) {
$theUnit = ( Product::strUnit($unit, 'wording_short', true) == 'p.') ? '' : '&nbsp;'. Product::strUnit($unit, 'wording_short', true) ;
$theUnit = ( $productManager->strUnit($unit, 'wording_short', true) == 'p.') ? '' : '&nbsp;'. $productManager->strUnit($unit, 'wording_short', true) ;
$strProducts .= $product->name . ' (' .$quantity .$theUnit.')<br />';
}
}
@@ -231,9 +235,9 @@ foreach ($pointsSaleArray as $pointSale)
$cpt = 0 ;
foreach ($productsArray as $product) {
foreach( Product::$unitsArray as $unit => $dataUnit) {
$quantity = Order::getProductQuantity($product->id, $pointSale->orders, false, $unit);
$quantity = $orderManager->getProductQuantity($product->id, $pointSale->orders, false, $unit);
if ($quantity) {
$theUnit = ( Product::strUnit($unit, 'wording_short', true) == 'p.') ? '' : '&nbsp;'. Product::strUnit($unit, 'wording_short', true) ;
$theUnit = ( Product::strUnit($unit, 'wording_short', true) == 'p.') ? '' : '&nbsp;'. $productManager->strUnit($unit, 'wording_short', true) ;
$html .= $product->name . ' (' .$quantity .$theUnit.')<br />';
}
}
@@ -258,9 +262,9 @@ $html .= '<tr><td><strong>Total</strong></td><td>' ;
$cpt = 0 ;
foreach ($productsArray as $product) {
foreach( Product::$unitsArray as $unit => $dataUnit) {
$quantity = Order::getProductQuantity($product->id, $ordersArray, false, $unit);
$quantity = $orderManager->getProductQuantity($product->id, $ordersArray, false, $unit);
if ($quantity) {
$theUnit = ( Product::strUnit($unit, 'wording_short', true) == 'p.') ? '' : '&nbsp;'. Product::strUnit($unit, 'wording_short', true) ;
$theUnit = ( $productManager->strUnit($unit, 'wording_short', true) == 'p.') ? '' : '&nbsp;'. $productManager->strUnit($unit, 'wording_short', true) ;
$html .= $product->name . ' (' .$quantity .$theUnit.')<br />';
}
}

+ 24
- 21
backend/views/distribution/report.php Visa fil

@@ -36,15 +36,22 @@ pris connaissance de la licence CeCILL, et que vous en avez accepté les
termes.
*/

use common\models\Order ;
use common\models\Product ;

use common\helpers\Price;
use common\logic\Order\Order\Model\Order;
use common\logic\Order\Order\Wrapper\OrderManager;
use common\logic\Producer\Producer\Model\Producer;
use common\logic\Product\Product\Model\Product;
use common\logic\Product\Product\Wrapper\ProductManager;
use common\logic\User\UserProducer\Model\UserProducer;

$productManager = ProductManager::getInstance();
$orderManager = OrderManager::getInstance();

$dayWeek = date('w', strtotime($date));
$dayWeekArray = [0 => 'sunday', 1 => 'monday', 2 => 'tuesday', 3 => 'wednesday', 4 => 'thursday', 5 => 'friday', 6 => 'saturday'];
$fieldInfosPointSale = 'infos_' . $dayWeekArray[$dayWeek];

$html = '' ;

$count = count($productsArray) ;
$limit = 100 ;
$isBig = $count > $limit ;
@@ -98,7 +105,7 @@ foreach ($pointsSaleArray as $pointSale) {
$add = false;
foreach ($order->productOrder as $productOrder) {
if($product->id == $productOrder->id_product) {
$unit = ( Product::strUnit($productOrder->unit, 'wording_short', true) == 'p.') ? '' : '&nbsp;'. Product::strUnit($productOrder->unit, 'wording_short', true) ;
$unit = ( $productManager->strUnit($productOrder->unit, 'wording_short', true) == 'p.') ? '' : '&nbsp;'. $productManager->strUnit($productOrder->unit, 'wording_short', true) ;
$strProducts .= '('.$productOrder->quantity .$unit.') '.$product->getNameExport() . '<br />';
$add = true;
}
@@ -129,17 +136,17 @@ foreach ($pointsSaleArray as $pointSale) {
$html .= '<td><strong>'.number_format($order->amount_with_tax, 2) . ' € ';

if($order->getPaymentStatus() == Order::PAYMENT_PAID)
if($orderManager->getPaymentStatus($order) == Order::PAYMENT_PAID)
{
$html .= '(payé)' ;
}
elseif($order->getPaymentStatus() == Order::PAYMENT_UNPAID && $order->getAmount(Order::AMOUNT_PAID))
elseif($orderManager->getPaymentStatus($order) == Order::PAYMENT_UNPAID && $orderManager->getOrderAmount($order, Order::AMOUNT_PAID))
{
$html .= '(reste '.$order->getAmount(Order::AMOUNT_REMAINING, true).' à payer)' ;
$html .= '(reste '.$orderManager->getOrderAmount($order, Order::AMOUNT_REMAINING, true).' à payer)' ;
}
elseif($order->getPaymentStatus() == Order::PAYMENT_SURPLUS)
elseif($orderManager->getPaymentStatus($order) == Order::PAYMENT_SURPLUS)
{
$html .= '(surplus : '.$order->getAmount(Order::PAYMENT_SURPLUS, true).' à rembourser)' ;
$html .= '(surplus : '.$orderManager->getOrderAmount($order, Order::PAYMENT_SURPLUS, true).' à rembourser)' ;
}
$html .= '</strong></td>' ;
@@ -154,9 +161,9 @@ foreach ($pointsSaleArray as $pointSale) {
$cpt = 0 ;
foreach ($productsArray as $product) {
foreach( Product::$unitsArray as $unit => $dataUnit) {
$quantity = Order::getProductQuantity($product->id, $pointSale->orders, false, $unit);
$quantity = $orderManager->getProductQuantity($product->id, $pointSale->orders, false, $unit);
if ($quantity) {
$theUnit = ( Product::strUnit($unit, 'wording_short', true) == 'p.') ? '' : '&nbsp;'. Product::strUnit($unit, 'wording_short', true) ;
$theUnit = ( $productManager->strUnit($unit, 'wording_short', true) == 'p.') ? '' : '&nbsp;'. $productManager->strUnit($unit, 'wording_short', true) ;
$strProducts .= '(' .$quantity .$theUnit.') '.$product->getNameExport() . '<br />';
}
}
@@ -167,9 +174,7 @@ foreach ($pointsSaleArray as $pointSale) {

$cpt ++ ;
}
//$strProducts = substr($strProducts, 0, strlen($strProducts) - 6) ;

$html .= '<td>'.$strProducts.'</td><td></td>' ;
if($pointSale->credit) {
$html .= '<td></td>' ;
@@ -203,9 +208,9 @@ foreach ($pointsSaleArray as $pointSale)
$cpt = 0 ;
foreach ($productsArray as $product) {
foreach( Product::$unitsArray as $unit => $dataUnit) {
$quantity = Order::getProductQuantity($product->id, $pointSale->orders, false, $unit);
$quantity = $orderManager->getProductQuantity($product->id, $pointSale->orders, false, $unit);
if ($quantity) {
$theUnit = ( Product::strUnit($unit, 'wording_short', true) == 'p.') ? '' : '&nbsp;'. Product::strUnit($unit, 'wording_short', true) ;
$theUnit = ( $productManager->strUnit($unit, 'wording_short', true) == 'p.') ? '' : '&nbsp;'. $productManager->strUnit($unit, 'wording_short', true) ;
$html .= '(' .$quantity .$theUnit.') '.$product->getNameExport() . '<br />';
}
}
@@ -230,9 +235,9 @@ $html .= '<tr><td><strong>Total</strong></td><td>' ;
$cpt = 0 ;
foreach ($productsArray as $product) {
foreach( Product::$unitsArray as $unit => $dataUnit) {
$quantity = Order::getProductQuantity($product->id, $ordersArray, false, $unit);
$quantity = $orderManager->getProductQuantity($product->id, $ordersArray, false, $unit);
if ($quantity) {
$theUnit = ( Product::strUnit($unit, 'wording_short', true) == 'p.') ? '' : '&nbsp;'. Product::strUnit($unit, 'wording_short', true) ;
$theUnit = ( $productManager->strUnit($unit, 'wording_short', true) == 'p.') ? '' : '&nbsp;'. $productManager->strUnit($unit, 'wording_short', true) ;
$html .= '(' .$quantity .$theUnit.') '.$product->name . '<br />';
}
}
@@ -243,8 +248,6 @@ foreach ($productsArray as $product) {
$cpt ++ ;
}

//$html = substr($html, 0, strlen($html) - 6) ;

$html .= '</td><td><strong>'.number_format($revenues, 2).' €</strong></td></tr>' ;

$html .= '</tbody></table>' ;

+ 3
- 3
backend/views/layouts/left.php Visa fil

@@ -122,9 +122,9 @@ $userManager = $this->getUserManager();
['label' => 'Taxes', 'icon' => 'eur', 'url' => ['/tax-rate-admin/index'], 'visible' => $userManager->isCurrentAdmin()],
['label' => 'Communiquer', 'icon' => 'bullhorn', 'url' => ['/communicate-admin/index'], 'visible' => $userManager->isCurrentAdmin()],

['label' => 'Outils', 'options' => ['class' => 'header'], 'visible' => $userManager->isCurrentAdmin()],
['label' => 'Gii', 'icon' => 'file-code-o', 'url' => ['/gii'], 'visible' => $userManager->isCurrentAdmin()],
['label' => 'Debug', 'icon' => 'dashboard', 'url' => ['/debug'], 'visible' => $userManager->isCurrentAdmin()],
//['label' => 'Outils', 'options' => ['class' => 'header'], 'visible' => $userManager->isCurrentAdmin()],
//['label' => 'Gii', 'icon' => 'file-code-o', 'url' => ['/gii'], 'visible' => $userManager->isCurrentAdmin()],
//['label' => 'Debug', 'icon' => 'dashboard', 'url' => ['/debug'], 'visible' => $userManager->isCurrentAdmin()],
['label' => 'Login', 'url' => ['site/login'], 'visible' => ! $userManager->isCurrentConnected()],
],
]

+ 12
- 9
backend/views/order/report.php Visa fil

@@ -36,7 +36,10 @@ pris connaissance de la licence CeCILL, et que vous en avez accepté les
termes.
*/

use common\models\Order ;
use common\logic\Order\Order\Model\Order;
use common\logic\Order\Order\Wrapper\OrderManager;

$orderManager = OrderManager::getInstance();

$dayWeek = date('w', strtotime($date));
$dayWeekArray = [0 => 'sunday', 1 => 'monday', 2 => 'tuesday', 3 => 'wednesday', 4 => 'thursday', 5 => 'friday', 6 => 'saturday'];
@@ -110,17 +113,17 @@ foreach ($pointsSaleArray as $pointSale) {
$html .= '<td><strong>'.number_format($order->amount, 2) . ' € ';

if($order->getPaymentStatus() == Order::PAYMENT_PAID)
if($orderManager->getPaymentStatus($order) == Order::PAYMENT_PAID)
{
$html .= '(payé)' ;
}
elseif($order->getPaymentStatus() == Order::PAYMENT_UNPAID && $order->getAmount(Order::AMOUNT_PAID))
elseif($orderManager->getPaymentStatus($order) == Order::PAYMENT_UNPAID && $orderManager->getOrderAmount($order, Order::AMOUNT_PAID))
{
$html .= '(reste '.$order->getAmount(Order::AMOUNT_REMAINING, true).' à payer)' ;
$html .= '(reste '.$orderManager->getOrderAmount($order, Order::AMOUNT_REMAINING, true).' à payer)' ;
}
elseif($order->getPaymentStatus() == Order::PAYMENT_SURPLUS)
elseif($orderManager->getPaymentStatus($order) == Order::PAYMENT_SURPLUS)
{
$html .= '(surplus : '.$order->getAmount(Order::PAYMENT_SURPLUS, true).' à rembourser)' ;
$html .= '(surplus : '.$orderManager->getOrderAmount($order, Order::PAYMENT_SURPLUS, true).' à rembourser)' ;
}
$html .= '</strong></td>' ;
@@ -133,7 +136,7 @@ foreach ($pointsSaleArray as $pointSale) {
$strProducts = '';
foreach ($productsArray as $product) {
$quantity = Order::getProductQuantity($product->id, $pointSale->orders);
$quantity = $orderManager->getProductQuantity($product->id, $pointSale->orders);
$strQuantity = '';
if ($quantity) {
$strQuantity = $quantity;
@@ -171,7 +174,7 @@ foreach ($pointsSaleArray as $pointSale)
{
$html .= '<tr><td>'.$pointSale->name.'</td><td>' ;
foreach ($productsArray as $product) {
$quantity = Order::getProductQuantity($product->id, $pointSale->orders);
$quantity = $orderManager->getProductQuantity($product->id, $pointSale->orders);
$strQuantity = ($quantity) ? $quantity : '' ;
if(strlen($strQuantity)) {
@@ -190,7 +193,7 @@ foreach ($pointsSaleArray as $pointSale)
// total
$html .= '<tr><td><strong>Total</strong></td><td>' ;
foreach ($productsArray as $product) {
$quantity = Order::getProductQuantity($product->id, $ordersArray);
$quantity = $orderManager->getProductQuantity($product->id, $ordersArray);
if($quantity) {
$html .= $quantity . '&nbsp;'.$product->name.', ' ;
}

+ 11
- 7
backend/views/site/index.php Visa fil

@@ -36,8 +36,12 @@ pris connaissance de la licence CeCILL, et que vous en avez accepté les
termes.
*/

use common\logic\Order\Order\Model\Order;
use common\logic\Order\Order\Wrapper\OrderManager;
use yii\helpers\Html ;

$orderManager = OrderManager::getInstance();

$this->setTitle('Tableau de bord');

?>
@@ -145,8 +149,8 @@ $this->setTitle('Tableau de bord');
</thead>
<tbody>
<?php foreach($ordersArray as $order): ?>
<tr class="<?= $order->getClassHistory() ; ?>">
<td class="infos"><?= $order->getStrOrigin(true); ?></td>
<tr class="<?= $orderManager->getHistoryClass($order) ; ?>">
<td class="infos"><?= $orderManager->getLabelOrigin($order, true); ?></td>
<td class="date">
<div class="block-date">
<div class="day"><?= strftime('%A', strtotime($order->distribution->date)) ?></div>
@@ -155,15 +159,15 @@ $this->setTitle('Tableau de bord');
</div>
</td>
<td>
<?= $order->getStrUser(); ?><br />
<?= $orderManager->getOrderUsername($order); ?><br />
<?php if(strlen($order->comment)): ?>
<div class="comment"><span class="glyphicon glyphicon-comment"></span> <?= nl2br(Html::encode($order->comment)) ; ?></div>
<?php endif; ?>
</td>
<td><?= $order->getCartSummary() ; ?></td>
<td><?= $order->getPointSaleSummary() ; ?></td>
<td><?= $order->getAmountWithTax(Order::AMOUNT_TOTAL, true) ; ?></td>
<td class="history"><?= $order->getStrHistory() ; ?></td>
<td><?= $orderManager->getCartSummary($order) ; ?></td>
<td><?= $orderManager->getPointSaleSummary($order) ; ?></td>
<td><?= $orderManager->getOrderAmountWithTax($order, Order::AMOUNT_TOTAL, true) ; ?></td>
<td class="history"><?= $orderManager->getHistorySummary($order) ; ?></td>
</tr>
<?php endforeach; ?>
</tbody>

+ 1
- 1
common/components/ActiveRecordCommon.php Visa fil

@@ -49,7 +49,7 @@ class ActiveRecordCommon extends \yii\db\ActiveRecord

public function populateFieldObject($fieldIdentifier, $fieldObject, $object)
{
$this->$fieldIdentifier = $object->id;
$this->{$fieldIdentifier} = $object->id;
$this->populateRelation($fieldObject, $object);
}


+ 1
- 1
common/logic/AbstractSingleton.php Visa fil

@@ -15,7 +15,7 @@ abstract class AbstractSingleton
trigger_error("Le clonage n'est pas autorisé.", E_USER_ERROR);
}

final public static function getInstance()
final public static function getInstance(): self
{
$c = get_called_class();


+ 2
- 2
common/logic/Distribution/Distribution/Model/Distribution.php Visa fil

@@ -83,11 +83,11 @@ class Distribution extends ActiveRecordCommon

public function init()
{
parent::init();

$this->on(Distribution::EVENT_ACTIVE, function($event) {
SubscriptionEventSubscriber::onActiveDistribution($event->distribution);
});

parent::init();
}

/*

+ 0
- 3
common/logic/Distribution/Distribution/Service/DistributionBuilder.php Visa fil

@@ -185,15 +185,12 @@ class DistributionBuilder extends AbstractBuilder
public function activeDistribution(Distribution $distribution, bool $active = true): void
{
$this->pointSaleDistributionBuilder->createAllPointSaleDistributions($distribution, true);

$distribution->active = (int) $active;

$this->saveUpdate($distribution);

if ($active) {
$distributionActiveEvent = new DistributionActiveEvent();
$distributionActiveEvent->distribution = $distribution;

$distribution->trigger(Distribution::EVENT_ACTIVE, $distributionActiveEvent);
}
}

+ 2
- 2
common/logic/Order/Order/Repository/OrderRepository.php Visa fil

@@ -287,9 +287,9 @@ class OrderRepository extends AbstractRepository
{
$pointSale = PointSale::findOne($order->id_point_sale);
$distribution = Distribution::findOne($order->id_distribution);
$creditFunctioning = $pointSale->getCreditFunctioning();
$creditFunctioning = $this->producerRepository->getPointSaleCreditFunctioning($pointSale);

if ($order->id_user && $order->producerRepository->getConfig('credit') && $pointSale->credit) {
if ($order->id_user && $this->producerRepository->getConfig('credit') && $pointSale->credit) {
if ($creditFunctioning == Producer::CREDIT_FUNCTIONING_OPTIONAL) {
return 0;
} elseif ($creditFunctioning == Producer::CREDIT_FUNCTIONING_MANDATORY) {

+ 3
- 0
common/logic/Order/Order/Service/OrderBuilder.php Visa fil

@@ -82,6 +82,7 @@ class OrderBuilder extends AbstractBuilder
$order->populateDistribution($distribution);
$order->date = date('Y-m-d H:i:s');
$order->status = 'tmp-order';
$order->id_user = 0;

return $order;
}
@@ -262,6 +263,8 @@ class OrderBuilder extends AbstractBuilder
$this->initOrderBaseFromSubscription($order, $subscription);
$this->initOrderAutoPaymentFromSubscription($order, $subscription);
$this->addProductOrdersFromSubscription($order, $subscription);

$this->saveUpdate($order);
}

public function initOrderBaseFromSubscription(Order $order, Subscription $subscription): void

+ 38
- 2
common/logic/Order/Order/Service/OrderSolver.php Visa fil

@@ -8,6 +8,8 @@ use common\logic\Document\Document\Service\DocumentSolver;
use common\logic\Order\Order\Model\Order;
use common\logic\Product\Product\Model\Product;
use common\logic\SolverInterface;
use common\logic\User\CreditHistory\Model\CreditHistory;
use common\logic\User\CreditHistory\Service\CreditHistorySolver;
use common\logic\User\User\Model\User;
use common\logic\User\User\Service\UserSolver;
use yii\helpers\Html;
@@ -16,11 +18,13 @@ class OrderSolver extends AbstractService implements SolverInterface
{
protected UserSolver $userSolver;
protected DocumentSolver $documentSolver;
protected CreditHistorySolver $creditHistorySolver;

public function loadDependencies(): void
{
$this->documentSolver = $this->loadService(DocumentSolver::class);
$this->userSolver = $this->loadService(UserSolver::class);
$this->creditHistorySolver = $this->loadService(CreditHistorySolver::class);
}

public function getFieldNameAmount($typeTotal = Order::AMOUNT_TOTAL, string $typeField = ''): string
@@ -388,8 +392,8 @@ class OrderSolver extends AbstractService implements SolverInterface
$jsonOrder = [
'products' => [],
'amount' => $order->amount,
'str_amount' => $order->getAmountWithTax(Order::AMOUNT_TOTAL, true),
'paid_amount' => $order->getAmount(Order::AMOUNT_PAID),
'str_amount' => $this->getOrderAmountWithTax($order, Order::AMOUNT_TOTAL, true),
'paid_amount' => $this->getOrderAmount($order, Order::AMOUNT_PAID),
'comment' => $order->comment,
];

@@ -401,4 +405,36 @@ class OrderSolver extends AbstractService implements SolverInterface
return json_encode($jsonOrder);
}

/**
* Retourne les informations à ajouter au commentaire du CreditHistorique
* (libellé, montant, client, action) au format HTML.
*
*/
public function getCreditHistoryComment(CreditHistory $creditHistory): string
{
$str = '';
if (strlen($creditHistory->getComment())) {
$str .= '<br />';
}

$str .= $this->creditHistorySolver->getStrWording($creditHistory);

$order = $creditHistory->getOrderObject();
if ($order) {
$str .= '<br />Montant de la commande : ' . $this->getOrderAmountWithTax($order, Order::AMOUNT_TOTAL, true);
}

$user = $creditHistory->getUserObject();
if ($user) {
$str .= '<br />Client : ' . Html::encode($user->getName() . ' ' . $user->getLastname());
}

$userAction = $creditHistory->getUserActionObject();
if ($userAction) {
$str .= '<br />Action : ' . Html::encode($userAction->getName() . ' ' . $userAction->getLastname());
}

return $str;
}

}

+ 3
- 3
common/logic/Product/Product/Service/ProductSolver.php Visa fil

@@ -23,9 +23,9 @@ class ProductSolver extends AbstractService implements SolverInterface
{
$specificPriceArray = $product->productPrice;

$user = isset($params['user']) ? $params['user'] : false;
$userProducer = isset($params['user_producer']) ? $params['user_producer'] : false;
$pointSale = isset($params['point_sale']) ? $params['point_sale'] : false;
$user = isset($params['user']) ? $params['user'] : null;
$userProducer = isset($params['user_producer']) ? $params['user_producer'] : null;
$pointSale = isset($params['point_sale']) ? $params['point_sale'] : null;
$quantity = (isset($params['quantity']) && $params['quantity']) ? $params['quantity'] : 1;

if ($specificPriceArray && ($user || $pointSale)) {

+ 2
- 2
common/logic/Product/ProductPrice/Service/ProductPriceSolver.php Visa fil

@@ -21,8 +21,8 @@ class ProductPriceSolver extends AbstractService implements SolverInterface
// getSpecificPricesFilterByPriorityMatch
public function filterByPriorityMatch(
array $specificPrices,
User $user,
PointSale $pointSale): array
User $user = null,
PointSale $pointSale = null): array
{
$priorityMatchSpecificPrice = $this->getPriorityMatch($specificPrices, $user, $pointSale);
$specificPricesFilter = [];

+ 4
- 1
common/logic/User/CreditHistory/Service/CreditHistoryBuilder.php Visa fil

@@ -4,6 +4,7 @@ namespace common\logic\User\CreditHistory\Service;

use common\logic\AbstractBuilder;
use common\logic\Order\Order\Model\Order;
use common\logic\Order\Order\Service\OrderSolver;
use common\logic\Producer\Producer\Model\Producer;
use common\logic\User\CreditHistory\Model\CreditHistory;
use common\logic\User\User\Model\User;
@@ -12,10 +13,12 @@ use yii\base\Event;
class CreditHistoryBuilder extends AbstractBuilder
{
protected CreditHistorySolver $creditHistorySolver;
protected OrderSolver $orderSolver;

public function loadDependencies(): void
{
$this->creditHistorySolver = $this->loadService(CreditHistorySolver::class);
$this->orderSolver = $this->loadService(OrderSolver::class);
}

public function instanciateCreditHistory(
@@ -63,7 +66,7 @@ class CreditHistoryBuilder extends AbstractBuilder
}

$creditHistory = $this->instanciateCreditHistory($type, $amount, $producer, $user, $userAction, $meanPayment, $order);
$creditHistory->setComment($creditHistory->getComment() . $this->creditHistorySolver->getStrComment($creditHistory));
$creditHistory->setComment($creditHistory->getComment() . $this->orderSolver->getCreditHistoryComment($creditHistory));
$this->saveCreate($creditHistory);

$creditHistory->trigger(CreditHistory::EVENT_CREATE, new Event(['creditHistory' => $creditHistory]));

+ 0
- 32
common/logic/User/CreditHistory/Service/CreditHistorySolver.php Visa fil

@@ -70,38 +70,6 @@ class CreditHistorySolver extends AbstractService implements SolverInterface
return $str;
}

/**
* Retourne les informations à ajouter au commentaire du CreditHistorique
* (libellé, montant, client, action) au format HTML.
*
*/
public function getStrComment(CreditHistory $creditHistory): string
{
$str = '';
if (strlen($creditHistory->getComment())) {
$str .= '<br />';
}

$str .= $this->getStrWording($creditHistory);

$order = $creditHistory->getOrderObject();
if ($order) {
$str .= '<br />Montant de la commande : ' . $order->getAmountWithTax(Order::AMOUNT_TOTAL, true);
}

$user = $creditHistory->getUserObject();
if ($user) {
$str .= '<br />Client : ' . Html::encode($user->getName() . ' ' . $user->getLastname());
}

$userAction = $creditHistory->getUserActionObject();
if ($userAction) {
$str .= '<br />Action : ' . Html::encode($userAction->getName() . ' ' . $userAction->getLastname());
}

return $str;
}

public function getDate(CreditHistory $creditHistory, bool $format = false): string
{
$date = $creditHistory->getDate();

+ 3
- 0
common/mail/creditConfirm-html.php Visa fil

@@ -36,6 +36,9 @@ pris connaissance de la licence CeCILL, et que vous en avez accepté les
termes.
*/

use common\helpers\Price;
use yii\helpers\Html;

?>

<p>Bonjour <?= Html::encode($user->name); ?>,</p>

+ 3
- 0
common/mail/creditConfirm-text.php Visa fil

@@ -36,6 +36,9 @@ pris connaissance de la licence CeCILL, et que vous en avez accepté les
termes.
*/

use common\helpers\Price;
use yii\helpers\Html;

?>

Bonjour <?= Html::encode($user->name); ?>,

+ 1
- 0
common/mail/creditUser-text.php Visa fil

@@ -40,6 +40,7 @@ use common\helpers\Price ;
use common\logic\User\CreditHistory\Model\CreditHistory;

?>

Bonjour <?= $user->name; ?>,</p>

Votre producteur <?= $producer->name; ?> vient de <?php if($creditForm->type == CreditHistory::TYPE_CREDIT): ?>créditer<?php else: ?>débiter<?php endif; ?> votre compte de <?= Price::format($creditForm->amount); ?> sur le site http://www.opendistrib.net/

+ 9
- 6
common/mail/orderConfirm-html.php Visa fil

@@ -36,16 +36,19 @@ pris connaissance de la licence CeCILL, et que vous en avez accepté les
termes.
*/

use common\helpers\GlobalParam ;
use common\logic\Order\Order\Model\Order;
use common\logic\Order\Order\Wrapper\OrderManager;
use common\logic\Producer\Producer\Wrapper\ProducerManager;
use yii\helpers\Html;
use common\logic\Producer\Producer\Producer;
use common\models\Order;

$producerManager = ProducerManager::getInstance();
$orderManager = OrderManager::getInstance();

?>

<p>Bonjour <?= Html::encode($user->name); ?>,</p>

<p>Votre commande <?= ($order->reference && strlen($order->reference) > 0) ? 'N°'.$order->reference : '' ?> d'une valeur de <strong><?= $order->getAmountWithTax(Order::AMOUNT_TOTAL, true); ?></strong> a bien été prise en compte.</p>
<p>Votre commande <?= ($order->reference && strlen($order->reference) > 0) ? 'N°'.$order->reference : '' ?> d'une valeur de <strong><?= $orderManager->getOrderAmountWithTax($order, Order::AMOUNT_TOTAL, true); ?></strong> a bien été prise en compte.</p>

<p>Récapitulatif des produits commandés :</p>
<p><?= $order->getCartSummary() ?></p>
@@ -57,13 +60,13 @@ use common\models\Order;
<?php endif; ?>
<?php if(strlen($pointSale->locality) > 0): ?> situé à <?= Html::encode($pointSale->locality) ?><?php endif ?>.</p>

<?php $payment_infos = Producer::getConfig('option_payment_info') ; ?>
<?php $payment_infos = $producerManager->getConfig('option_payment_info') ; ?>
<?php if($payment_infos && strlen($payment_infos) > 0): ?>
<p><strong>Informations de paiement :</strong><br />
<?= nl2br(Html::encode($payment_infos)); ?></p>
<?php endif; ?>

<?php $order_infos = Producer::getConfig('order_infos') ; ?>
<?php $order_infos = $producerManager->getConfig('order_infos') ; ?>
<?php if($order_infos && strlen($order_infos) > 0): ?>
<p><strong>Informations générales :</strong><br />
<?= nl2br(Html::encode($order_infos)); ?></p>

+ 9
- 4
common/mail/orderConfirm-text.php Visa fil

@@ -37,28 +37,33 @@ termes.
*/

use common\helpers\GlobalParam ;
use common\logic\Producer\Producer\Producer;
use common\logic\Order\Order\Model\Order;
use yii\helpers\Html;
use common\logic\Producer\Producer\Wrapper\ProducerManager;
use common\logic\Order\Order\Wrapper\OrderManager;

$producerManager = ProducerManager::getInstance();
$orderManager = OrderManager::getInstance();
$producer = GlobalParam::getCurrentProducer() ;

?>

Bonjour <?= $user->name; ?>,

Votre commande <?= ($order->reference && strlen($order->reference) > 0) ? '<strong>N°'.$order->reference.'</strong>' : '' ?> d'une valeur de <?= $order->getAmountWithTax(Order::AMOUNT_TOTAL, true); ?> a bien été prise en compte.
Votre commande <?= ($order->reference && strlen($order->reference) > 0) ? '<strong>N°'.$order->reference.'</strong>' : '' ?> d'une valeur de <?= $orderManager->getOrderAmountWithTax($order, Order::AMOUNT_TOTAL, true); ?> a bien été prise en compte.

Récapitulatif des produits commandés :
<?= $order->getCartSummary(false) ?>

Elle sera à retirer le <?= date('d/m/Y',strtotime($distribution->date)) ?> au point de retrait <?= $pointSale->name ?> <?php if($order->pointSale->is_bread_box && $order->pointSale->bread_box_code): ?> (Code : <?= $order->pointSale->bread_box_code; ?>) <?php endif; ?> <?php if(strlen($pointSale->locality) > 0): ?> situé à <?= Html::encode($pointSale->locality) ?><?php endif ?>.

<?php $payment_infos = Producer::getConfig('option_payment_info') ; ?>
<?php $payment_infos = $producerManager->getConfig('option_payment_info') ; ?>
<?php if($payment_infos && strlen($payment_infos) > 0): ?>
Informations de paiement :
<?= $payment_infos ?>
<?php endif; ?>

<?php $order_infos = Producer::getConfig('order_infos') ; ?>
<?php $order_infos = $producerManager->getConfig('order_infos') ; ?>
<?php if($order_infos && strlen($order_infos) > 0): ?>
Informations générales :
<?= $order_infos ?>

+ 6
- 1
common/mail/orderConfirmProducer-html.php Visa fil

@@ -37,13 +37,18 @@ termes.
*/

use common\helpers\GlobalParam ;
use common\logic\Order\Order\Model\Order;
use common\logic\Order\Order\Wrapper\OrderManager;
use yii\helpers\Html;

$orderManager = OrderManager::getInstance();
$producer = GlobalParam::getCurrentProducer() ;

?>

<p>Bonjour,</p>

<p>Une nouvelle commande d'une valeur de <strong><?= $order->getAmountWithTax(Order::AMOUNT_TOTAL, true); ?></strong> vient d'être passée par :</p>
<p>Une nouvelle commande d'une valeur de <strong><?= $orderManager->getOrderAmountWithTax($order, Order::AMOUNT_TOTAL, true); ?></strong> vient d'être passée par :</p>

<ul>
<li><strong><?= Html::encode($user->name); ?></strong></li>

+ 6
- 1
common/mail/orderConfirmProducer-text.php Visa fil

@@ -37,12 +37,17 @@ termes.
*/

use common\helpers\GlobalParam ;
use common\logic\Order\Order\Wrapper\OrderManager;
use common\logic\Order\Order\Model\Order;
use yii\helpers\Html;

$orderManager = OrderManager::getInstance();
$producer = GlobalParam::getCurrentProducer() ;

?>
Bonjour,

Une nouvelle commande d'une valeur de <?= $order->getAmountWithTax(Order::AMOUNT_TOTAL, true); ?> vient d'être passée par :
Une nouvelle commande d'une valeur de <?= $orderManager->getOrderAmountWithTax($order, Order::AMOUNT_TOTAL, true); ?> vient d'être passée par :

- <?= Html::encode($user->name); ?>
- <?= Html::encode($user->phone); ?>

+ 2
- 3
common/mail/passwordResetToken-html.php Visa fil

@@ -38,11 +38,10 @@ termes.

use yii\helpers\Html;

/* @var $this yii\web\View */
/* @var $user common\models\ User */

$resetLink = Yii::$app->urlManager->createAbsoluteUrl(['site/reset-password', 'token' => $user->password_reset_token]);

?>

<div class="password-reset">
<p>Bonjour <?= Html::encode($user->name) ?>,</p>


+ 1
- 3
common/mail/passwordResetToken-text.php Visa fil

@@ -36,10 +36,8 @@ pris connaissance de la licence CeCILL, et que vous en avez accepté les
termes.
*/

/* @var $this yii\web\View */
/* @var $user common\models\ User */

$resetLink = Yii::$app->urlManager->createAbsoluteUrl(['site/reset-password', 'token' => $user->password_reset_token]);

?>
Bonjour <?= $user->name ?>,


+ 5
- 3
common/mail/paymentError-html.php Visa fil

@@ -36,8 +36,10 @@ pris connaissance de la licence CeCILL, et que vous en avez accepté les
termes.
*/

use common\logic\Producer\Producer\Wrapper\ProducerManager;
use yii\helpers\Html;
use common\logic\Producer\Producer\Producer;

$producerManager = ProducerManager::getInstance();

?>

@@ -49,13 +51,13 @@ use common\logic\Producer\Producer\Producer;

<p>Vous pouvez retrouver le lien de paiement dans votre <a href="<?= Yii::$app->urlManagerProducer->createAbsoluteUrl(['credit/history','slug_producer' => $producer->slug]) ?>">historique de commandes</a>.</p>

<?php $payment_infos = Producer::getConfig('option_payment_info') ; ?>
<?php $payment_infos = $producerManager->getConfig('option_payment_info') ; ?>
<?php if($payment_infos && strlen($payment_infos) > 0): ?>
<p><strong>Informations de paiement :</strong><br />
<?= nl2br(Html::encode($payment_infos)); ?></p>
<?php endif; ?>

<?php $order_infos = Producer::getConfig('order_infos') ; ?>
<?php $order_infos = $producerManager->getConfig('order_infos') ; ?>
<?php if($order_infos && strlen($order_infos) > 0): ?>
<p><strong>Informations générales :</strong><br />
<?= nl2br(Html::encode($order_infos)); ?></p>

+ 2
- 0
common/mail/paymentError-text.php Visa fil

@@ -36,6 +36,8 @@ pris connaissance de la licence CeCILL, et que vous en avez accepté les
termes.
*/

use yii\helpers\Html;

?>

Bonjour <?= Html::encode($user->name); ?>,

+ 6
- 2
common/mail/paymentErrorProducer-html.php Visa fil

@@ -36,11 +36,15 @@ pris connaissance de la licence CeCILL, et que vous en avez accepté les
termes.
*/

?>
use common\logic\User\User\Wrapper\UserManager;
use yii\helpers\Html;

$userManager = UserManager::getInstance();

?>
<p>Bonjour,</p>

<p>Le client <strong><?= $user->getUsername() ?></strong> vient de passer une commande pour le <strong><?= date('d/m/Y',strtotime($distribution->date)) ?></strong> mais le paiement par carte bancaire n'a pas abouti.<br />
<p>Le client <strong><?= $userManager->getUsername($user) ?></strong> vient de passer une commande pour le <strong><?= date('d/m/Y',strtotime($distribution->date)) ?></strong> mais le paiement par carte bancaire n'a pas abouti.<br />
Il vient de recevoir un message pour régulariser le paiement par virement bancaire.</p>

<p>Sa commande a été enregistrée avec l'état "non payé".</p>

+ 6
- 1
common/mail/paymentErrorProducer-text.php Visa fil

@@ -36,11 +36,16 @@ pris connaissance de la licence CeCILL, et que vous en avez accepté les
termes.
*/

use common\logic\User\User\Wrapper\UserManager;
use yii\helpers\Html;

$userManager = UserManager::getInstance();

?>

Bonjour,

Le client <?= $user->getUsername() ?> vient de passer une commande pour le <?= date('d/m/Y',strtotime($distribution->date)) ?> mais le paiement par carte bancaire n'a pas abouti.
Le client <?= $userManager->getUsername() ?> vient de passer une commande pour le <?= date('d/m/Y',strtotime($distribution->date)) ?> mais le paiement par carte bancaire n'a pas abouti.
Il vient de recevoir un message pour régulariser le paiement par virement bancaire.

Sa commande a été enregistrée avec l'état "non payé".

+ 2
- 1
common/mail/paymentOrderConfirm-html.php Visa fil

@@ -36,8 +36,9 @@ pris connaissance de la licence CeCILL, et que vous en avez accepté les
termes.
*/

?>
use yii\helpers\Html;

?>
<p>Bonjour <?= Html::encode($user->name); ?>,</p>

<p>Nous vous confirmons que le paiement de votre commande d'un montant de <strong><?= number_format($amount, 2) ?> €</strong> a réussi.</p>

+ 2
- 0
common/mail/paymentOrderConfirm-text.php Visa fil

@@ -36,6 +36,8 @@ pris connaissance de la licence CeCILL, et que vous en avez accepté les
termes.
*/

use yii\helpers\Html;

?>

Bonjour <?= Html::encode($user->name); ?>,

+ 0
- 1
common/mail/signup-html.php Visa fil

@@ -37,7 +37,6 @@ termes.
*/

use yii\helpers\Html;
use common\helpers\Url ;
use common\logic\User\User\Model\User;

?>

+ 0
- 2
common/mail/signup-text.php Visa fil

@@ -36,8 +36,6 @@ pris connaissance de la licence CeCILL, et que vous en avez accepté les
termes.
*/

use common\helpers\Url ;

use common\logic\User\User\Model\User;

?>

+ 5
- 5
producer/controllers/OrderController.php Visa fil

@@ -434,7 +434,7 @@ class OrderController extends ProducerBaseController
$creditFunctioning = $pointSaleManager->getPointSaleCreditFunctioning($pointSale);
$creditUser = $userManager->getCredit($user, $producer);
$order = $orderManager->findOneOrderById($order->id);
$amountRemaining = $orderManager->getAmount($order, Order::AMOUNT_REMAINING);
$amountRemaining = $orderManager->getOrderAmount($order, Order::AMOUNT_REMAINING);

if ($credit && $pointSale->credit &&
(($creditFunctioning == Producer::CREDIT_FUNCTIONING_OPTIONAL && $posts['use_credit']) ||
@@ -463,7 +463,7 @@ class OrderController extends ProducerBaseController
}
} // surplus à rembourser
elseif ($order->getPaymentStatus() == Order::PAYMENT_SURPLUS) {
$amountSurplus = $orderManager->getAmount($order, Order::AMOUNT_SURPLUS);
$amountSurplus = $orderManager->getOrderAmount($order, Order::AMOUNT_SURPLUS);
$creditHistoryManager->createCreditHistory(
CreditHistory::TYPE_REFUND,
$amountSurplus,
@@ -720,7 +720,7 @@ class OrderController extends ProducerBaseController
if (is_array($ordersUserArray) && count($ordersUserArray)) {
foreach ($ordersUserArray as &$order) {
$order = array_merge($order->getAttributes(), [
'amount_total' => $orderManager->getAmountWithTax($order, Order::AMOUNT_TOTAL),
'amount_total' => $orderManager->getOrderAmountWithTax($order, Order::AMOUNT_TOTAL),
'date_distribution' => $order->distribution->date,
'pointSale' => $order->pointSale->getAttributes()
]);
@@ -976,8 +976,8 @@ class OrderController extends ProducerBaseController

if ($orderUser) {
$json['order'] = array_merge($orderUser->getAttributes(), [
'amount_total' => $orderManager->getAmountWithTax($orderUser, Order::AMOUNT_TOTAL),
'amount_paid' => $orderManager->getAmount($orderUser, Order::AMOUNT_PAID),
'amount_total' => $orderManager->getOrderAmountWithTax($orderUser, Order::AMOUNT_TOTAL),
'amount_paid' => $orderManager->getOrderAmount($orderUser, Order::AMOUNT_PAID),
]);
}


+ 9
- 3
producer/views/order/confirm.php Visa fil

@@ -37,10 +37,16 @@ termes.
*/

use common\helpers\GlobalParam ;
use common\logic\Order\Order\Model\Order;
use common\logic\Order\Order\Wrapper\OrderManager;
use common\logic\Producer\Producer\Wrapper\ProducerManager;
use yii\helpers\Html;

$this->setTitle('Confirmation de commande') ;
$producerManager = ProducerManager::getInstance();
$orderManager = OrderManager::getInstance();
$producer = GlobalParam::getCurrentProducer() ;
$producerManager = $this->getProducerManager();

$this->setTitle('Confirmation de commande') ;

?>

@@ -107,7 +113,7 @@ $producerManager = $this->getProducerManager();
<p><strong>Produit<?php if($order->countProducts() > 1): ?>s<?php endif; ?></strong></p>
<p><?= $order->getCartSummary() ?></p>
</li>
<li>Total : <strong><?= $order->getAmountWithTax(Order::AMOUNT_TOTAL, true); ?></strong></li>
<li>Total : <strong><?= $orderManager->getOrderAmountWithTax($order,Order::AMOUNT_TOTAL, true); ?></strong></li>
</ul>
</div>
</div>

Laddar…
Avbryt
Spara