|
@@ -117,13 +117,13 @@ class OrderRepository extends Repository
|
|
|
* @param \Webkul\Sales\Models\Order|int $orderOrId
|
|
* @param \Webkul\Sales\Models\Order|int $orderOrId
|
|
|
* @return bool
|
|
* @return bool
|
|
|
*/
|
|
*/
|
|
|
- public function cancel($orderOrId)
|
|
|
|
|
|
|
+ public function cancel($orderOrId,$force=false)
|
|
|
{
|
|
{
|
|
|
/* order */
|
|
/* order */
|
|
|
$order = $this->resolveOrderInstance($orderOrId);
|
|
$order = $this->resolveOrderInstance($orderOrId);
|
|
|
|
|
|
|
|
/* check wether order can be cancelled or not */
|
|
/* check wether order can be cancelled or not */
|
|
|
- if (! $order->canCancel()) {
|
|
|
|
|
|
|
+ if (! $order->canCancel() && ! $force) {
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -167,7 +167,7 @@ class OrderRepository extends Repository
|
|
|
$this->downloadableLinkPurchasedRepository->updateStatus($item, 'expired');
|
|
$this->downloadableLinkPurchasedRepository->updateStatus($item, 'expired');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- $this->updateOrderStatus($order);
|
|
|
|
|
|
|
+ $this->updateOrderStatus($order, $force ? Order::STATUS_CANCELED : null);
|
|
|
|
|
|
|
|
Event::dispatch('sales.order.cancel.after', $order);
|
|
Event::dispatch('sales.order.cancel.after', $order);
|
|
|
|
|
|
|
@@ -299,7 +299,7 @@ class OrderRepository extends Repository
|
|
|
|
|
|
|
|
if (! empty($orderState)) {
|
|
if (! empty($orderState)) {
|
|
|
$status = $orderState;
|
|
$status = $orderState;
|
|
|
- } else {
|
|
|
|
|
|
|
+ } else {
|
|
|
$status = Order::STATUS_PROCESSING;
|
|
$status = Order::STATUS_PROCESSING;
|
|
|
|
|
|
|
|
if ($this->isInCompletedState($order)) {
|
|
if ($this->isInCompletedState($order)) {
|