Procházet zdrojové kódy

[Administration] Distributions > Synchronisation Tiller : correctif synchronisation en double des commandes #1321

feature/souke
Guillaume Bourgeois před 1 rokem
rodič
revize
ddd4fa8035
2 změnil soubory, kde provedl 34 přidání a 26 odebrání
  1. +24
    -22
      backend/controllers/DistributionController.php
  2. +10
    -4
      common/helpers/Tiller.php

+ 24
- 22
backend/controllers/DistributionController.php Zobrazit soubor

@@ -888,31 +888,33 @@ class DistributionController extends BackendController
$typePaymentTiller = 'CASH';
}

$returnTiller = $tiller->postOrder([
'externalId' => $order->id,
'type' => 1,
'status' => 'IN_PROGRESS',
'openDate' => $strDate,
'closeDate' => $strDate,
'lines' => $lines,
'payments' => [
[
'type' => $typePaymentTiller,
'amount' => $orderManager->getOrderAmountWithTax(
$order,
Order::AMOUNT_PAID
) * 100,
'status' => 'ACCEPTED',
'date' => $strDate
if(!$tiller->isSynchro($date, $order->id)) {
$returnTiller = $tiller->postOrder([
'externalId' => $order->id,
'type' => 1,
'status' => 'IN_PROGRESS',
'openDate' => $strDate,
'closeDate' => $strDate,
'lines' => $lines,
'payments' => [
[
'type' => $typePaymentTiller,
'amount' => $orderManager->getOrderAmountWithTax(
$order,
Order::AMOUNT_PAID
) * 100,
'status' => 'ACCEPTED',
'date' => $strDate
]
]
]
]);
]);

$returnTillerObject = json_decode($returnTiller);
$order->tiller_external_id = '' . $returnTillerObject->id;
$order->save();
$returnTillerObject = json_decode($returnTiller);
$order->tiller_external_id = '' . $returnTillerObject->id;
$order->save();

$return[] = $returnTiller;
$return[] = $returnTiller;
}
}
}
}

+ 10
- 4
common/helpers/Tiller.php Zobrazit soubor

@@ -80,12 +80,13 @@ class Tiller
}
}

public function isSynchro($date)
public function isSynchro($date, $idOrder = null)
{
$orderManager = OrderManager::getInstance();

if ($this->producer_tiller) {
$ordersTiller = $this->getOrders($date);

$ordersOpendistrib = Order::searchAll([
'distribution.date' => $date,
'order.tiller_synchronization' => 1
@@ -115,9 +116,14 @@ class Tiller
}
}

foreach ($ordersOpendistribSynchro as $idOrder => $isSynchro) {
if (!$isSynchro) {
return false;
if($idOrder && isset($ordersOpendistribSynchro[$idOrder])) {
return $ordersOpendistribSynchro[$idOrder];
}
else {
foreach ($ordersOpendistribSynchro as $idOrder => $isSynchro) {
if (!$isSynchro) {
return false;
}
}
}


Načítá se…
Zrušit
Uložit