|
|
|
|
|
|
|
|
|
|
|
|
|
|
$this->deleteOrder($order, true); |
|
|
$this->deleteOrder($order, true); |
|
|
|
|
|
|
|
|
$countOrdersDeleted ++; |
|
|
|
|
|
|
|
|
$countOrdersDeleted++; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$productsAdd = true; |
|
|
$productsAdd = true; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if(!$productsAdd) { |
|
|
|
|
|
|
|
|
if (!$productsAdd) { |
|
|
$this->deleteOrder($order); |
|
|
$this->deleteOrder($order); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function initOrderAutoPaymentFromSubscription(Order $order, Subscription $subscription): void |
|
|
public function initOrderAutoPaymentFromSubscription(Order $order, Subscription $subscription): void |
|
|
{ |
|
|
{ |
|
|
$pointSale = $subscription->pointSale; |
|
|
$pointSale = $subscription->pointSale; |
|
|
if($pointSale) { |
|
|
|
|
|
|
|
|
if ($pointSale) { |
|
|
$creditFunctioning = $this->producerRepository->getPointSaleCreditFunctioning($pointSale); |
|
|
$creditFunctioning = $this->producerRepository->getPointSaleCreditFunctioning($pointSale); |
|
|
|
|
|
|
|
|
$order->auto_payment = 0; |
|
|
$order->auto_payment = 0; |
|
|
|
|
|
|
|
|
// addUserPointSale |
|
|
// addUserPointSale |
|
|
public function createUserPointSale(Order $order): void |
|
|
public function createUserPointSale(Order $order): void |
|
|
{ |
|
|
{ |
|
|
if($order->user) { |
|
|
|
|
|
|
|
|
if ($order->user) { |
|
|
$this->pointSaleBuilder->addUser($order->user, $order->pointSale); |
|
|
$this->pointSaleBuilder->addUser($order->user, $order->pointSale); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// initCommentPointSale |
|
|
// initCommentPointSale |
|
|
public function initOrderCommentPointSale(Order $order): void |
|
|
public function initOrderCommentPointSale(Order $order): void |
|
|
{ |
|
|
{ |
|
|
if($order->user && $order->pointSale) { |
|
|
|
|
|
|
|
|
if ($order->user && $order->pointSale) { |
|
|
$userPointSale = $this->userPointSaleRepository->findOneUserPointSale($order->user, $order->pointSale); |
|
|
$userPointSale = $this->userPointSaleRepository->findOneUserPointSale($order->user, $order->pointSale); |
|
|
|
|
|
|
|
|
if ($userPointSale && strlen($userPointSale->comment)) { |
|
|
if ($userPointSale && strlen($userPointSale->comment)) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// addVat |
|
|
// addVat |
|
|
public function addProductOrderVat( |
|
|
public function addProductOrderVat( |
|
|
Order $order, |
|
|
|
|
|
string $typeTotal, |
|
|
|
|
|
float $priceTotalWithoutTax, |
|
|
|
|
|
|
|
|
Order $order, |
|
|
|
|
|
string $typeTotal, |
|
|
|
|
|
float $priceTotalWithoutTax, |
|
|
TaxRate $taxRate, |
|
|
TaxRate $taxRate, |
|
|
string $taxCalculationMethod): void |
|
|
|
|
|
|
|
|
string $taxCalculationMethod): void |
|
|
{ |
|
|
{ |
|
|
$fieldName = $this->orderSolver->getFieldNameAmount($typeTotal, 'vat'); |
|
|
$fieldName = $this->orderSolver->getFieldNameAmount($typeTotal, 'vat'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$this->productOrderBuilder->deleteProductOrdersByOrder($order); |
|
|
$this->productOrderBuilder->deleteProductOrdersByOrder($order); |
|
|
|
|
|
|
|
|
return $this->delete($order); |
|
|
return $this->delete($order); |
|
|
} |
|
|
|
|
|
// status 'delete' |
|
|
|
|
|
|
|
|
} // status 'delete' |
|
|
elseif ($this->producerRepository->getConfig('option_behavior_cancel_order') == Producer::BEHAVIOR_DELETE_ORDER_STATUS) { |
|
|
elseif ($this->producerRepository->getConfig('option_behavior_cancel_order') == Producer::BEHAVIOR_DELETE_ORDER_STATUS) { |
|
|
$order->date_delete = date('Y-m-d H:i:s'); |
|
|
$order->date_delete = date('Y-m-d H:i:s'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// updateTillerSynchronization |
|
|
// updateTillerSynchronization |
|
|
public function updateOrderTillerSynchronization(Order $order, int $synchroTiller = null): void |
|
|
public function updateOrderTillerSynchronization(Order $order, int $synchroTiller = null): void |
|
|
{ |
|
|
{ |
|
|
if(!is_null($synchroTiller)) { |
|
|
|
|
|
|
|
|
if (!is_null($synchroTiller)) { |
|
|
$order->tiller_synchronization = $synchroTiller; |
|
|
$order->tiller_synchronization = $synchroTiller; |
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
|
|
|
} else { |
|
|
$paymentStatus = $this->orderSolver->getPaymentStatus($order); |
|
|
$paymentStatus = $this->orderSolver->getPaymentStatus($order); |
|
|
|
|
|
|
|
|
if ($paymentStatus == Order::PAYMENT_PAID) { |
|
|
if ($paymentStatus == Order::PAYMENT_PAID) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch ($newStatus) { |
|
|
switch ($newStatus) { |
|
|
case 'new-order' : |
|
|
case 'new-order' : |
|
|
$this->orderStatusHistoryBuilder->createOrderStatusHistory($order, $userCurrent, $newStatus, $origin); |
|
|
|
|
|
|
|
|
//$this->orderStatusHistoryBuilder->createOrderStatusHistory($order, $userCurrent, $newStatus, $origin); |
|
|
$order->status = $newStatus; |
|
|
$order->status = $newStatus; |
|
|
$order->save(); |
|
|
$order->save(); |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
case 'refunded': |
|
|
case 'refunded': |
|
|
case 'cancel': |
|
|
case 'cancel': |
|
|
if (in_array($newStatus, $orderStatusArray[$order->status]['nextStatusAllow'])) { |
|
|
if (in_array($newStatus, $orderStatusArray[$order->status]['nextStatusAllow'])) { |
|
|
$this->orderStatusHistoryBuilder->createOrderStatusHistory($order, $userCurrent, $newStatus, $origin); |
|
|
|
|
|
|
|
|
//$this->orderStatusHistoryBuilder->createOrderStatusHistory($order, $userCurrent, $newStatus, $origin); |
|
|
$order->status = $newStatus; |
|
|
$order->status = $newStatus; |
|
|
$order->save(); |
|
|
$order->save(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
$pointSale->orders[] = $order; |
|
|
$pointSale->orders[] = $order; |
|
|
|
|
|
|
|
|
if (is_null($order->date_delete)) { |
|
|
if (is_null($order->date_delete)) { |
|
|
$pointSale->revenues += (float) $order->amount; |
|
|
|
|
|
$pointSale->revenues_with_tax += (float) $order->amount_with_tax; |
|
|
|
|
|
|
|
|
$pointSale->revenues += (float)$order->amount; |
|
|
|
|
|
$pointSale->revenues_with_tax += (float)$order->amount_with_tax; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |