Quellcode durchsuchen

Merge branch 'refactoring' of https://forge.laclic.fr/Laclic/Opendistrib into refactoring

refactoring
Guillaume Bourgeois vor 1 Jahr
Ursprung
Commit
d97c070485
14 geänderte Dateien mit 92 neuen und 38 gelöschten Zeilen
  1. +3
    -3
      backend/controllers/DistributionController.php
  2. +5
    -0
      backend/controllers/OrderController.php
  3. +6
    -7
      backend/views/distribution/index.php
  4. +2
    -2
      backend/views/document/download.php
  5. +22
    -12
      backend/web/css/screen.css
  6. +2
    -1
      backend/web/js/vuejs/distribution-index.js
  7. +9
    -0
      backend/web/sass/distribution/_index.scss
  8. +4
    -4
      common/helpers/Tiller.php
  9. +1
    -0
      common/logic/Document/Document/Service/DocumentUtils.php
  10. +7
    -4
      common/logic/Order/Order/Service/OrderBuilder.php
  11. +1
    -1
      common/logic/Product/Product/Repository/ProductRepository.php
  12. +7
    -1
      common/logic/Product/ProductCategory/Repository/ProductCategoryRepository.php
  13. +18
    -1
      producer/controllers/OrderController.php
  14. +5
    -2
      producer/controllers/SiteController.php

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

@@ -263,7 +263,7 @@ class DistributionController extends BackendController
'quantity' => $productOrder->quantity * Product::$unitsArray[$productOrder->unit]['coefficient'],
'unit' => $productOrder->unit,
'price' => number_format($productOrder->price, 3),
'invoice_price' => number_format($productOrder->invoice_price, 2),
'invoice_price' => number_format($productOrder->invoice_price, 3),
'price_with_tax' => Price::getPriceWithTax($productOrder->price, $productOrder->taxRate->value),
];
}
@@ -509,7 +509,7 @@ class DistributionController extends BackendController
foreach ($order->productOrder as $productOrder) {
if ($productOrder->id_product == $product['id']) {
if ($productOrder->invoice_price) {
$invoicePrice = number_format($productOrder->invoice_price, 2);
$invoicePrice = number_format($productOrder->invoice_price, 3);
} else {
$invoicePrice = number_format($productOrder->price, 3);
}
@@ -1479,7 +1479,7 @@ class DistributionController extends BackendController
'type' => $typePaymentTiller,
'amount' => $orderManager->getOrderAmountWithTax(
$order,
Order::AMOUNT_TOTAL
Order::AMOUNT_PAID
) * 100,
'status' => 'ACCEPTED',
'date' => $strDate

+ 5
- 0
backend/controllers/OrderController.php Datei anzeigen

@@ -946,6 +946,11 @@ class OrderController extends BackendController
if ($productOrder) {
$productOrder->quantity = $quantity;
$productOrder->price = $dataProductOrder->price;

if($dataProductOrder->invoice_price && $dataProductOrder->invoice_price != $dataProductOrder->price) {
//die('invoice price : '.$dataProductOrder->invoice_price);
$productOrder->invoice_price = $dataProductOrder->invoice_price;
}
} else {
$product = Product::findOne($key);


+ 6
- 7
backend/views/distribution/index.php Datei anzeigen

@@ -650,13 +650,12 @@ $this->setPageTitle('Distributions') ;
<input type="text" v-model="order.productOrder[product.id].price_with_tax" class="form-control input-sm" @change="productPriceChange" :data-with-tax="true" :data-id-product="product.id" />
<span class="input-group-addon" id="basic-addon2">€ TTC</span>
</div>
<div v-if="(order.id_invoice || order.id_delivery_note || order.id_quotation) && order.productOrder[product.id].quantity > 0">
<span class="label label-default">
Facturé
<template v-if="order.productOrder[product.id].invoice_price != null">{{ order.productOrder[product.id].invoice_price }}</template>
<template v-else>{{ order.productOrder[product.id].price }}</template>
€ HT
</span>
<div class="invoice-price" v-show="vatMode == 'all'" v-if="(order.id_invoice || order.id_delivery_note || order.id_quotation) && order.productOrder[product.id].quantity > 0">
<span class="label-invoice-price">Prix facturé</span><br />
<div class="input-group">
<input type="text" v-model="order.productOrder[product.id].invoice_price" class="form-control input-sm" :data-id-product="product.id" />
<span class="input-group-addon" id="basic-addon2">€ HT</span>
</div>
</div>
</td>
<td class="quantity">

+ 2
- 2
backend/views/document/download.php Datei anzeigen

@@ -43,8 +43,8 @@ $documentPriceDecimals = (int) $producerManager->getConfig('option_document_pric
<?php if (strlen($document->reference)) : ?>
<?= $documentManager->getType($document); ?> N°<?= $document->reference; ?>
<?php else: ?>
<div class="block-is-draft"><?= $document->getType(); ?> non
validé<?= ($document->getType() == 'Facture') ? 'e' : '' ?></div>
<div class="block-is-draft"><?= $documentManager->getType($document); ?> non
validé<?= ($documentManager->getType($document) == 'Facture') ? 'e' : '' ?></div>
<?php endif; ?>
</div>
<div class="name">

+ 22
- 12
backend/web/css/screen.css Datei anzeigen

@@ -2251,21 +2251,31 @@ termes.
.distribution-index .modal-form-order table.table-products td.price .input-group-addon {
background-color: #eee;
}
/* line 396, ../sass/distribution/_index.scss */
/* line 395, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.price .invoice-price {
margin-top: 8px;
}
/* line 397, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.price .invoice-price .label-invoice-price {
font-size: 11px;
font-weight: bold;
color: gray;
}
/* line 405, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity {
width: 165px;
}
/* line 399, ../sass/distribution/_index.scss */
/* line 408, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity input {
text-align: center;
color: black;
}
/* line 404, ../sass/distribution/_index.scss */
/* line 413, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity .form-control {
border-right: 0px none;
padding-right: 4px;
}
/* line 409, ../sass/distribution/_index.scss */
/* line 418, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity .input-group-addon {
padding: 5px;
padding-left: 0px;
@@ -2273,35 +2283,35 @@ termes.
border-left: 0px none;
border-right: 0px none;
}
/* line 418, ../sass/distribution/_index.scss */
/* line 427, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity-remaining {
text-align: right;
}
/* line 421, ../sass/distribution/_index.scss */
/* line 430, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity-remaining.quantity-remaining, .distribution-index .modal-form-order table.table-products td.quantity-remaining.infinite {
color: #00A65A;
}
/* line 425, ../sass/distribution/_index.scss */
/* line 434, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity-remaining.negative {
color: #DD4B39;
}
/* line 429, ../sass/distribution/_index.scss */
/* line 438, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity-remaining.infinite, .distribution-index .modal-form-order table.table-products td.quantity-remaining.empty {
font-size: 18px;
}
/* line 436, ../sass/distribution/_index.scss */
/* line 445, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order .actions-form button {
margin-left: 15px;
}
/* line 444, ../sass/distribution/_index.scss */
/* line 453, ../sass/distribution/_index.scss */
.distribution-index .modal-payment .info-box .info-box-icon {
width: 50px;
}
/* line 447, ../sass/distribution/_index.scss */
/* line 456, ../sass/distribution/_index.scss */
.distribution-index .modal-payment .info-box .info-box-icon i {
font-size: 30px;
}
/* line 452, ../sass/distribution/_index.scss */
/* line 461, ../sass/distribution/_index.scss */
.distribution-index .modal-payment .info-box .info-box-content {
margin-left: 50px;
}

+ 2
- 1
backend/web/js/vuejs/distribution-index.js Datei anzeigen

@@ -817,7 +817,8 @@ Vue.component('order-form',{
productOrderArrayRequest[key] = {
quantity: this.order.productOrder[key].quantity,
unit: this.order.productOrder[key].unit,
price: this.order.productOrder[key].price
price: this.order.productOrder[key].price,
invoice_price: this.order.productOrder[key].invoice_price
};
}
return JSON.stringify(productOrderArrayRequest);

+ 9
- 0
backend/web/sass/distribution/_index.scss Datei anzeigen

@@ -391,6 +391,15 @@ termes.
.input-group-addon {
background-color: #eee;
}

.invoice-price {
margin-top: 8px;
.label-invoice-price {
font-size: 11px;
font-weight: bold;
color: gray;
}
}
}

td.quantity {

+ 4
- 4
common/helpers/Tiller.php Datei anzeigen

@@ -102,11 +102,11 @@ class Tiller
if (isset($ordersTiller->orders)) {
foreach ($ordersTiller->orders as $orderTiller) {
if ($orderOpendistrib->tiller_external_id == $orderTiller->id) {
$amountTotalOrderOpendistrib = (int)round(
$orderManager->getOrderAmountWithTax($orderOpendistrib, Order::AMOUNT_TOTAL) * 100
$amountTotalPaidOrderOpendistrib = (int)round(
$orderManager->getOrderAmountWithTax($orderOpendistrib, Order::AMOUNT_PAID) * 100
);
if ($amountTotalOrderOpendistrib >= (int)$orderTiller->currentPayedAmount
|| $amountTotalOrderOpendistrib >= (int)$orderTiller->currentBill) {
if ($amountTotalPaidOrderOpendistrib >= (int)$orderTiller->currentPayedAmount
|| $amountTotalPaidOrderOpendistrib >= (int)$orderTiller->currentBill) {
$ordersOpendistribSynchro[$orderOpendistrib->id] = true;
}
}

+ 1
- 0
common/logic/Document/Document/Service/DocumentUtils.php Datei anzeigen

@@ -81,6 +81,7 @@ class DocumentUtils extends AbstractService implements UtilsInterface
$aliasDirectoryBase = $this->documentSolver->getAliasDirectoryBase($document);
$directoryPdf = \Yii::getAlias($aliasDirectoryBase);
if (!file_exists($directoryPdf)) {
//die('dir : '.$directoryPdf);
mkdir($directoryPdf, 0755);
}
}

+ 7
- 4
common/logic/Order/Order/Service/OrderBuilder.php Datei anzeigen

@@ -419,11 +419,14 @@ class OrderBuilder extends AbstractBuilder
*/
public function initOrderPaidAmount(Order $order): void
{
if (isset($order->creditHistory)) {
// Attention : $order->creditHistory pas à jour si un paiement vient d'avoir lieu
/*if (isset($order->creditHistory)) {
$history = $order->creditHistory;
} else {
$history = $this->creditHistoryRepository->getByOrder($order);
}
}*/

$history = $this->creditHistoryRepository->getByOrder($order);

$order->paid_amount = 0;

@@ -513,9 +516,9 @@ class OrderBuilder extends AbstractBuilder
if (!is_null($synchroTiller)) {
$order->tiller_synchronization = $synchroTiller;
} else {
$paymentStatus = $this->orderSolver->getPaymentStatus($order);
$amountPaid = $this->orderSolver->getOrderAmount($order, Order::AMOUNT_PAID);

if ($paymentStatus == Order::PAYMENT_PAID) {
if ($amountPaid >= 0.01) {
$order->tiller_synchronization = 1;
} else {
$order->tiller_synchronization = 0;

+ 1
- 1
common/logic/Product/Product/Repository/ProductRepository.php Datei anzeigen

@@ -93,7 +93,7 @@ class ProductRepository extends AbstractRepository
{
return Product::find()
->andWhere([
'id_producer' => $productCategory->id_producer,
'id_producer' => $this->getProducerContext()->id,
'active' => true,
])
->andWhere(

+ 7
- 1
common/logic/Product/ProductCategory/Repository/ProductCategoryRepository.php Datei anzeigen

@@ -31,7 +31,13 @@ class ProductCategoryRepository extends AbstractRepository

public function findProductCategories()
{
return ProductCategory::searchAll([], ['orderby' => 'product_category.position ASC']);
return ProductCategory::searchAll([
'id_producer' => $this->getProducerContext()->id
],
[
'orderby' => 'product_category.position ASC'
]
);
}

public function findProductCategoriesAsArray()

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

@@ -53,6 +53,7 @@ use common\logic\User\User\Model\User;
use DateTime;
use yii\base\UserException;
use yii\data\ActiveDataProvider;
use yii\filters\AccessControl;
use yii\web\NotFoundHttpException;

class OrderController extends ProducerBaseController
@@ -61,7 +62,22 @@ class OrderController extends ProducerBaseController

public function behaviors()
{
return [];
return [
'access' => [
'class' => AccessControl::class,
'only' => [
'history',
'remove-producer',
'cancel'
],
'rules' => [
[
'allow' => true,
'roles' => ['@']
]
],
],
];
}

public function actionOrder(int $id = 0, $date = '')
@@ -517,6 +533,7 @@ class OrderController extends ProducerBaseController
}
}

$orderManager->initOrder($order);
$orderManager->updateOrderTillerSynchronization($order);
}


+ 5
- 2
producer/controllers/SiteController.php Datei anzeigen

@@ -89,8 +89,11 @@ class SiteController extends ProducerBaseController
*/
public function actionIndex()
{
$productManager = $this->getProductManager();
$pointSaleManager = $this->getPointSaleManager();

$dataProviderPointsSale = new ActiveDataProvider([
'query' => $this->getPointSaleManager()->queryPointSalesPublic($this->getProducerCurrent()),
'query' => $pointSaleManager->queryPointSalesPublic($this->getProducerCurrent()),
'pagination' => [
'pageSize' => 50,
],
@@ -101,7 +104,7 @@ class SiteController extends ProducerBaseController
$dataProviderProductsByCategories = [];
foreach ($productCategoryArray as $productCategory) {
$dataProviderProductsByCategories[$productCategory->id] = new ActiveDataProvider([
'query' => $this->getProductManager()->queryProductsByProductCategory($productCategory),
'query' => $productManager->queryProductsByProductCategory($productCategory),
'pagination' => [
'pageSize' => 500,
],

Laden…
Abbrechen
Speichern