Ver código fonte

[Backend] Correctif ajout produit + ajout produit dans documents

feature/souke
Guillaume 1 ano atrás
pai
commit
416bad3dfa
3 arquivos alterados com 4 adições e 5 exclusões
  1. +2
    -1
      backend/controllers/DocumentController.php
  2. +0
    -2
      backend/controllers/ProductController.php
  3. +2
    -2
      common/logic/Product/Product/Service/ProductSolver.php

+ 2
- 1
backend/controllers/DocumentController.php Ver arquivo

@@ -622,6 +622,7 @@ class DocumentController extends BackendController

if ($documentManager->isValidClass($classDocument)) {
$document = $this->findModel($idDocument, $classDocument);
$classDocumentComplete = $documentManager->getClass($document, true);
$product = $productManager->findOneProductById($idProduct);

if ($document && $product) {
@@ -633,7 +634,7 @@ class DocumentController extends BackendController
$order->status = 'tmp-order';
$order->origin = Order::ORIGIN_ADMIN;
$order->date = date('Y-m-d H:i:s');
$fieldIdDocument = 'id_' . $classDocument::tableName();
$fieldIdDocument = 'id_' . $classDocumentComplete::tableName();
$order->$fieldIdDocument = $document->id;
$order->save();
} else {

+ 0
- 2
backend/controllers/ProductController.php Ver arquivo

@@ -376,8 +376,6 @@ class ProductController extends BackendController
if ($model->file && $model->validate()) {
$productPriceCsvArray = array_map(function($data) { return str_getcsv($data,";");}, file($model->file->tempName));

//die('mime type : '.BaseFileHelper::getMimeType($model->file->tempName));

if(!$productPriceCsvArray || count($productPriceCsvArray[0]) != 6) {
$this->setFlash('error', "Format de fichier invalide. Veuillez vérifier que le séparateur de champs de votre fichier est bien \";\".");
}

+ 2
- 2
common/logic/Product/Product/Service/ProductSolver.php Ver arquivo

@@ -203,10 +203,10 @@ class ProductSolver extends AbstractService implements SolverInterface

public function getProductQuantityMaxByDay(Product $product, string $day): ?float
{
$quantityMax = $product->quantity_max;
$quantityMax = ($product->quantity_max && $product->quantity_max > 0) ? $product->quantity_max : null;
if($this->isProductQuantityMaxDefinedByDay($product, $day)) {
$fieldQuantityMax = $this->getProductFieldNameQuantityMax($day);
$quantityMax = (float) $product->$fieldQuantityMax;
$quantityMax = $product->$fieldQuantityMax;
}
return $quantityMax;

Carregando…
Cancelar
Salvar