Преглед изворни кода

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

feature/souke
Guillaume Bourgeois пре 1 година
родитељ
комит
ddd4fa8035
2 измењених фајлова са 34 додато и 26 уклоњено
  1. +24
    -22
      backend/controllers/DistributionController.php
  2. +10
    -4
      common/helpers/Tiller.php

+ 24
- 22
backend/controllers/DistributionController.php Прегледај датотеку

@@ -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 Прегледај датотеку

@@ -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;
}
}
}


Loading…
Откажи
Сачувај