@@ -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 { |
@@ -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 \";\"."); | |||
} |
@@ -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; |