Преглед на файлове

Corrections diverses liées à l'annulation de commandes

dev
Guillaume Bourgeois преди 5 години
родител
ревизия
0f67ab5243
променени са 2 файла, в които са добавени 4 реда и са изтрити 3 реда
  1. +3
    -2
      common/models/Order.php
  2. +1
    -1
      producer/controllers/OrderController.php

+ 3
- 2
common/models/Order.php Целия файл

@@ -562,16 +562,17 @@ class Order extends ActiveRecordCommon
*
* @param integer $idProduct
* @param array $orders
* @param boolean $ignoreCancel
*
* @return integer
*/
public static function getProductQuantity($idProduct, $orders)
public static function getProductQuantity($idProduct, $orders, $ignoreCancel = false)
{
$quantity = 0;
if (isset($orders) && is_array($orders) && count($orders)) {
foreach ($orders as $c) {
if(is_null($c->date_delete)) {
if(is_null($c->date_delete) || $ignoreCancel) {
foreach ($c->productOrder as $po) {
if ($po->id_product == $idProduct) {
$quantity += $po->quantity ;

+ 1
- 1
producer/controllers/OrderController.php Целия файл

@@ -733,7 +733,7 @@ class OrderController extends ProducerBaseController
$product['quantity_remaining'] = $product['quantity_max'] - $quantityOrder ;
if($orderUser) {
$quantityOrderUser = Order::getProductQuantity($product['id'], [$orderUser]) ;
$quantityOrderUser = Order::getProductQuantity($product['id'], [$orderUser], true) ;
$product['quantity_ordered'] = $quantityOrder ;
$product['quantity_remaining'] = $product['quantity_max'] - $quantityOrder + $quantityOrderUser ;
$product['quantity_form'] = $quantityOrderUser ;

Loading…
Отказ
Запис