Quellcode durchsuchen

Merge branch 'develop'

master
Guillaume Bourgeois vor 4 Monaten
Ursprung
Commit
8732c27c68
16 geänderte Dateien mit 152 neuen und 104 gelöschten Zeilen
  1. +1
    -1
      backend/controllers/DistributionController.php
  2. +2
    -1
      backend/views/automatic-email/_form.php
  3. +8
    -1
      backend/views/automatic-email/index.php
  4. +1
    -1
      backend/views/dashboard/index.php
  5. +0
    -1
      backend/views/product/_form.php
  6. +1
    -1
      console/commands/AutomaticEmailController.php
  7. +28
    -22
      domain/Communication/AutomaticEmail/AutomaticEmail.php
  8. +19
    -3
      domain/Distribution/Distribution/Distribution.php
  9. +35
    -3
      domain/Order/Order/Order.php
  10. +1
    -1
      domain/Order/Order/OrderBuilder.php
  11. +2
    -2
      domain/Order/Order/OrderManager.php
  12. +8
    -40
      domain/Order/Order/OrderSolver.php
  13. +1
    -1
      producer/controllers/OrderController.php
  14. +1
    -1
      producer/views/order/history.php
  15. +34
    -24
      producer/web/css/screen.css
  16. +10
    -1
      producer/web/sass/order/_order.scss

+ 1
- 1
backend/controllers/DistributionController.php Datei anzeigen

@@ -314,7 +314,7 @@ class DistributionController extends BackendController
if ($ordersArray) {
foreach ($ordersArray as $order) {
$orderModule->initOrder($order);
if($orderModule->getSolver()->isOrderStatusValid($order)) {
if($order->isOrderStatusValid()) {
$revenues += $orderModule->getOrderAmount($order);
$revenuesWithTax += $orderModule->getOrderAmountWithTax($order);
$weight += $order->weight;

+ 2
- 1
backend/views/automatic-email/_form.php Datei anzeigen

@@ -44,7 +44,7 @@ use yii\widgets\ActiveForm;
?>

<div class="automatic-email-form">
<?php $form = ActiveForm::begin(); ?>
<?php $form = ActiveForm::begin(['enableClientValidation' => false]); ?>
<div class="col-md-8">
<div class="panel panel-default">
<div class="panel-heading">
@@ -84,6 +84,7 @@ use yii\widgets\ActiveForm;
</div>
</div>
</div>

<?= $this->render('@backend/views/_include/form_actions.php',[
'model' => $automaticEmail,
]); ?>

+ 8
- 1
backend/views/automatic-email/index.php Datei anzeigen

@@ -51,7 +51,14 @@ $this->addButton(['label' => 'Nouvel email automatique <span class="glyphicon gl

?>

<div class="accessory-index">
<div class="callout callout-info">
<p>
<i class="icon fa fa-info-circle"></i>
L'heure d'envoi des emails automatiques est programmée à 7h
</p>
</div>

<div class="automatic-email-index">
<?= GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [

+ 1
- 1
backend/views/dashboard/index.php Datei anzeigen

@@ -118,7 +118,7 @@ $this->setTitle('Tableau de bord');
<div class="info-box-content">
<span class="info-box-text">
<?php if(count($distribution->order)): ?>
<strong><?= count($distribution->order); ?></strong> COMMANDES
<strong><?= $distribution->countOrders(); ?></strong> COMMANDES
<?php else: ?>
AUCUNE COMMANDE
<?php endif; ?>

+ 0
- 1
backend/views/product/_form.php Datei anzeigen

@@ -127,7 +127,6 @@ $accessoryModule = $this->getAccessoryModule();
<h3 class="panel-title">
<i class="fa fa-<?= $accessoryModule->getDefinition()->getIcon() ?>"></i>
Accessoires
<a class="btn btn-default btn-xs" href="<?= Yii::$app->urlManager->createUrl(['accessory/index']) ?>">Gérer</a>
</h3>
</div>
<div class="panel-body">

+ 1
- 1
console/commands/AutomaticEmailController.php Datei anzeigen

@@ -23,7 +23,7 @@ class AutomaticEmailController extends Controller
$automaticEmailsArray = $automaticEmailModule->getRepository()->findAutomaticEmails();
foreach($automaticEmailsArray as $automaticEmail) {
$distribution = $automaticEmailModule->getResolver()->getMatchedDistribution($automaticEmail);
if($distribution) {
if($automaticEmail->isEnabled() && $distribution) {
$email = $automaticEmailModule->getManager()->createEmailFromAutomaticEmail($automaticEmail, $distribution);
$usersArray = $emailModule->getContactListResolver()->search($producer, Email::TYPE_ORDER_TAKING, $distribution);
$emailModule->getBulkMailer()->sendEmail($email, $usersArray);

+ 28
- 22
domain/Communication/AutomaticEmail/AutomaticEmail.php Datei anzeigen

@@ -4,6 +4,7 @@ namespace domain\Communication\AutomaticEmail;

use common\components\ActiveRecordCommon;
use common\components\Date;
use domain\_\StatusInterface;
use domain\Producer\Producer\Producer;
use yii\db\ActiveQuery;

@@ -37,6 +38,33 @@ class AutomaticEmail extends ActiveRecordCommon
];
}

/* Méthodes */

public function isEnabled(): bool
{
return (bool) $this->getStatus() == StatusInterface::STATUS_ONLINE;
}

public function getDayAsString(): string
{
return Date::getDayOfWeekStringByNumber($this->getDay());
}

public function getDelayBeforeDistributionAsString(): string
{
return $this->getDelayBeforeDistribution().' jour(s) avant';
}

public function getStatusAsHtml(): string
{
if($this->getStatus()) {
return '<span class="label label-success">Activé</span>';
}
else {
return '<span class="label label-danger">Désactivé</span>';
}
}

/* Getters / Setters */

public function getId(): ?int
@@ -127,26 +155,4 @@ class AutomaticEmail extends ActiveRecordCommon
{
return $this->hasOne(Producer::class, ['id' => 'id_producer']);
}

/* Méthodes */

public function getDayAsString(): string
{
return Date::getDayOfWeekStringByNumber($this->getDay());
}

public function getDelayBeforeDistributionAsString(): string
{
return $this->getDelayBeforeDistribution().' jour(s) avant';
}

public function getStatusAsHtml(): string
{
if($this->getStatus()) {
return '<span class="label label-success">Activé</span>';
}
else {
return '<span class="label label-danger">Désactivé</span>';
}
}
}

+ 19
- 3
domain/Distribution/Distribution/Distribution.php Datei anzeigen

@@ -80,9 +80,25 @@ class Distribution extends ActiveRecordCommon
];
}

/*
* Relations
*/
/* Getters / Setters */

/* Méthodes */

public function countOrders(): int
{
$count = 0;
$ordersArray = $this->order;

foreach($ordersArray as $order) {
if($order->isOrderStatusValid()) {
$count ++;
}
}

return $count;
}

/* Relations */

public function getProducer()
{

+ 35
- 3
domain/Order/Order/Order.php Datei anzeigen

@@ -172,9 +172,41 @@ class Order extends ActiveRecordCommon
];
}

/*
* Relations
*/
/* Getters / Setters */

/* Méthodes */

public function isOrderStatusValid(): bool
{
return $this->isOrderStatusOrdered() || $this->isOrderStatusUpdated();
}

public function isOrderStatusCanceledOrDeleted(): bool
{
return $this->isOrderStatusCanceled() || $this->isOrderStatusDeleted();
}

public function isOrderStatusOrdered(): bool
{
return $this->getOrderStatusAlias() == OrderStatus::ALIAS_ORDERED;
}

public function isOrderStatusUpdated(): bool
{
return $this->getOrderStatusAlias() == OrderStatus::ALIAS_UPDATED;
}

public function isOrderStatusCanceled(): bool
{
return $this->getOrderStatusAlias() == OrderStatus::ALIAS_CANCELED;
}

public function isOrderStatusDeleted(): bool
{
return $this->getOrderStatusAlias() == OrderStatus::ALIAS_DELETED;
}

/* Relations */

public function getUser()
{

+ 1
- 1
domain/Order/Order/OrderBuilder.php Datei anzeigen

@@ -484,7 +484,7 @@ class OrderBuilder extends AbstractBuilder
if ($pointSale->id == $order->id_point_sale) {
$pointSale->orders[] = $order;

if($this->orderSolver->isOrderStatusValid($order)) {
if($order->isOrderStatusValid()) {
$pointSale->revenues += (float)$order->amount;
$pointSale->revenues_with_tax += (float)$order->amount_with_tax;
}

+ 2
- 2
domain/Order/Order/OrderManager.php Datei anzeigen

@@ -51,7 +51,7 @@ class OrderManager extends AbstractService implements ManagerInterface
$orderStatus = $this->orderStatusRepository->getOrderStatusByAlias($orderStatusAlias);

$order->setOrderStatus($orderStatus);
if(!$this->orderSolver->isOrderStatusOrdered($order)) {
if(!$order->isOrderStatusOrdered()) {
$this->orderBuilder->initDateUpdate($order);
}
$this->orderBuilder->update($order);
@@ -72,7 +72,7 @@ class OrderManager extends AbstractService implements ManagerInterface
// delete
if ($this->producerSolver->getConfig('option_behavior_cancel_order') == Producer::BEHAVIOR_DELETE_ORDER_DELETE ||
($this->producerSolver->getConfig('option_behavior_cancel_order') == Producer::BEHAVIOR_DELETE_ORDER_STATUS
&& $this->orderSolver->isOrderStatusCanceled($order))
&& $order->isOrderStatusCanceled())
|| $force) {

$this->changeOrderStatus($order, OrderStatus::ALIAS_DELETED, $user);

+ 8
- 40
domain/Order/Order/OrderSolver.php Datei anzeigen

@@ -209,7 +209,7 @@ class OrderSolver extends AbstractService implements SolverInterface

if (count($ordersArray)) {
foreach ($ordersArray as $order) {
if($this->isOrderStatusValid($order)) {
if($order->isOrderStatusValid()) {
foreach ($order->productOrder as $productOrder) {
if ($productOrder->id_product == $product->id) {
$quantity += $this->productOrderSolver->getQuantityPieces($productOrder);
@@ -231,7 +231,7 @@ class OrderSolver extends AbstractService implements SolverInterface

if (count($ordersArray)) {
foreach ($ordersArray as $order) {
if ($this->isOrderStatusValid($order) || $ignoreCancel) {
if ($order->isOrderStatusValid() || $ignoreCancel) {
foreach ($order->productOrder as $productOrder) {
if ($productOrder->id_product == $product->id &&
((is_null($unit) && $productOrder->product->unit == $productOrder->unit)
@@ -253,7 +253,7 @@ class OrderSolver extends AbstractService implements SolverInterface
// getClassHistory
public function getHistoryClass(Order $order): string
{
if($this->isOrderStatusCanceled($order)) {
if($order->isOrderStatusCanceled()) {
return 'commande-delete';
}

@@ -539,43 +539,11 @@ class OrderSolver extends AbstractService implements SolverInterface
return $orderStatusHistoryReturn;
}

public function isOrderStatusValid(Order $order): bool
{
return $this->isOrderStatusOrdered($order)
|| $this->isOrderStatusUpdated($order);
}

public function isOrderStatusCanceledOrDeleted(Order $order): bool
{
return $this->isOrderStatusCanceled($order)
|| $this->isOrderStatusDeleted($order);
}

public function isOrderStatusOrdered(Order $order): bool
{
return $order->getOrderStatusAlias() == OrderStatus::ALIAS_ORDERED;
}

public function isOrderStatusUpdated(Order $order): bool
{
return $order->getOrderStatusAlias() == OrderStatus::ALIAS_UPDATED;
}

public function isOrderStatusCanceled(Order $order): bool
{
return $order->getOrderStatusAlias() == OrderStatus::ALIAS_CANCELED;
}

public function isOrderStatusDeleted(Order $order): bool
{
return $order->getOrderStatusAlias() == OrderStatus::ALIAS_DELETED;
}

public function getLabelDeleteAction(Order $order): string
{
$optionBehaviorCancelOrder = $this->producerSolver->getConfig('option_behavior_cancel_order');

if($optionBehaviorCancelOrder == Producer::BEHAVIOR_DELETE_ORDER_STATUS && $this->isOrderStatusValid($order)) {
if($optionBehaviorCancelOrder == Producer::BEHAVIOR_DELETE_ORDER_STATUS && $order->isOrderStatusValid()) {
return 'Annuler';
}

@@ -584,16 +552,16 @@ class OrderSolver extends AbstractService implements SolverInterface

public function getOrderStatusCssClass(Order $order): string
{
if($this->isOrderStatusOrdered($order)) {
if($order->isOrderStatusOrdered()) {
return 'success';
}
elseif($this->isOrderStatusUpdated($order)) {
elseif($order->isOrderStatusUpdated()) {
return 'warning';
}
elseif($this->isOrderStatusCanceled($order)) {
elseif($order->isOrderStatusCanceled()) {
return 'danger';
}
elseif($this->isOrderStatusDeleted($order)) {
elseif($order->isOrderStatusDeleted()) {
return 'danger';
}


+ 1
- 1
producer/controllers/OrderController.php Datei anzeigen

@@ -393,7 +393,7 @@ class OrderController extends ProducerBaseController
$pointSaleModule->getComment($pointSale) : '';

// une commande annulée est automatiquement réactivée lors d'une modification
if($orderModule->getSolver()->isOrderStatusCanceled($order)) {
if($order->isOrderStatusCanceled()) {
$orderModule->getManager()->changeOrderStatus($order, OrderStatus::ALIAS_UPDATED, $this->getUserCurrent());
}


+ 1
- 1
producer/views/order/history.php Datei anzeigen

@@ -121,7 +121,7 @@ $this->setTitle('Mes commandes') ;
'value' => function($order) use ($orderModule) {
$html = '' ;
if($orderModule->getSolver()->isOrderStatusCanceled($order)) {
if($order->isOrderStatusCanceled()) {
$html .= '<span class="badge text-bg-danger">Annulée</span>' ;
}
else {

+ 34
- 24
producer/web/css/screen.css Datei anzeigen

@@ -1519,79 +1519,89 @@ termes.
/* line 333, ../sass/order/_order.scss */
.order-order #main #app-order-order table#products .price-unit .decreasing-prices {
margin-top: 10px;
font-size: 10px;
font-size: 12px;
line-height: 15px;
padding-top: 6px;
padding-bottom: 2px;
margin-bottom: 0px;
padding-left: 10px;
padding-right: 10px;
}
/* line 343, ../sass/order/_order.scss */
.order-order #main #app-order-order table#products .price-unit .decreasing-prices ul {
padding: 0px;
margin: 0px;
list-style-type: none;
}
/* line 341, ../sass/order/_order.scss */
/* line 348, ../sass/order/_order.scss */
.order-order #main #app-order-order table#products .price-unit .decreasing-prices ul li {
margin-bottom: 5px;
text-align: left;
}
/* line 343, ../sass/order/_order.scss */
/* line 352, ../sass/order/_order.scss */
.order-order #main #app-order-order table#products .price-unit .decreasing-prices ul li strong {
font-weight: bold;
}
/* line 351, ../sass/order/_order.scss */
/* line 360, ../sass/order/_order.scss */
.order-order #main #app-order-order table#products .price-unit, .order-order #main #app-order-order table#products .price-total {
width: 135px;
text-align: center;
}
/* line 355, ../sass/order/_order.scss */
/* line 364, ../sass/order/_order.scss */
.order-order #main #app-order-order table#products .price-unit .price-infos, .order-order #main #app-order-order table#products .price-total .price-infos {
color: gray;
font-size: 13px;
line-height: 15px;
}
/* line 362, ../sass/order/_order.scss */
/* line 371, ../sass/order/_order.scss */
.order-order #main #app-order-order table#products tr.product-open td.price-total {
font-size: 1.1rem;
font-family: 'worksans_bold';
padding-top: 19px;
}
/* line 368, ../sass/order/_order.scss */
/* line 377, ../sass/order/_order.scss */
.order-order #main #app-order-order table#products .td-quantity {
width: 175px;
}
/* line 371, ../sass/order/_order.scss */
/* line 380, ../sass/order/_order.scss */
.order-order #main #app-order-order table#products .td-quantity input.quantity,
.order-order #main #app-order-order table#products .td-quantity .input-group-text {
background-color: white;
}
/* line 376, ../sass/order/_order.scss */
/* line 385, ../sass/order/_order.scss */
.order-order #main #app-order-order table#products .td-quantity input.quantity {
text-align: center;
border: 0px none;
}
/* line 380, ../sass/order/_order.scss */
/* line 389, ../sass/order/_order.scss */
.order-order #main #app-order-order table#products .td-quantity .input-group-text {
border: 0px none;
padding-right: 10px;
padding-left: 0px;
margin: 0px;
}
/* line 388, ../sass/order/_order.scss */
/* line 397, ../sass/order/_order.scss */
.order-order #main #app-order-order table#products .td-quantity .input-group-btn button {
padding: 4px 5px 0px 5px;
}
/* line 390, ../sass/order/_order.scss */
/* line 399, ../sass/order/_order.scss */
.order-order #main #app-order-order table#products .td-quantity .input-group-btn button .bi {
font-size: 1.5em;
font-weight: bold;
margin: 0px;
}
/* line 401, ../sass/order/_order.scss */
/* line 410, ../sass/order/_order.scss */
.order-order #main #app-order-order table#products tr.total .summary {
padding: 25px;
}
/* line 404, ../sass/order/_order.scss */
/* line 413, ../sass/order/_order.scss */
.order-order #main #app-order-order table#products tr.total .summary h3 {
font-family: 'worksans_bold';
margin-top: 0px;
text-transform: uppercase;
margin-bottom: 5px;
}
/* line 411, ../sass/order/_order.scss */
/* line 420, ../sass/order/_order.scss */
.order-order #main #app-order-order table#products tr.total .summary ul {
margin-bottom: 15px;
padding-left: 20px;
@@ -1599,17 +1609,17 @@ termes.
line-height: 1.4rem;
list-style-type: disc;
}
/* line 419, ../sass/order/_order.scss */
/* line 428, ../sass/order/_order.scss */
.order-order #main #app-order-order table#products tr.total .summary ul li .quantity {
font-weight: bold;
}
/* line 426, ../sass/order/_order.scss */
/* line 435, ../sass/order/_order.scss */
.order-order #main #app-order-order table#products tr.total .price-total {
padding-top: 25px;
font-size: 1.5rem;
font-family: 'worksans_bold';
}
/* line 431, ../sass/order/_order.scss */
/* line 440, ../sass/order/_order.scss */
.order-order #main #app-order-order table#products tr.total .price-total span {
display: inline-block;
padding: 7px 15px;
@@ -1619,30 +1629,30 @@ termes.
color: white;
font-size: 1.2rem;
}
/* line 443, ../sass/order/_order.scss */
/* line 452, ../sass/order/_order.scss */
.order-order #main #app-order-order #payment-methods .infos {
margin-top: 10px;
color: gray;
}
/* line 450, ../sass/order/_order.scss */
/* line 459, ../sass/order/_order.scss */
.order-order #main #app-order-order #content-step-payment .delivery {
margin-bottom: 20px;
}
/* line 454, ../sass/order/_order.scss */
/* line 463, ../sass/order/_order.scss */
.order-order #main #app-order-order #content-step-payment .comment {
margin-bottom: 20px;
}
/* line 458, ../sass/order/_order.scss */
/* line 467, ../sass/order/_order.scss */
.order-order #main #app-order-order #content-step-payment #payment-methods {
margin-bottom: 20px;
}
/* line 463, ../sass/order/_order.scss */
/* line 472, ../sass/order/_order.scss */
.order-order #main #app-order-order #content-step-payment .credit .info {
margin-left: 20px;
color: gray;
}

/* line 476, ../sass/order/_order.scss */
/* line 485, ../sass/order/_order.scss */
#main #content .panel h3 {
font-family: "worksans_bold";
margin: 0px;

+ 10
- 1
producer/web/sass/order/_order.scss Datei anzeigen

@@ -332,14 +332,23 @@
.price-unit {
.decreasing-prices {
margin-top: 10px;
font-size: 10px;
font-size: 12px;
line-height: 15px;
padding-top: 6px;
padding-bottom: 2px;
margin-bottom: 0px;
padding-left: 10px;
padding-right: 10px;

ul {
padding: 0px;
margin: 0px;
list-style-type: none;

li {
margin-bottom: 5px;
text-align: left;

strong {
font-weight: bold;
}

Laden…
Abbrechen
Speichern