Last active
December 6, 2018 01:47
-
-
Save chonthu/bfa4c8f1f4cb81e0d82dd8bc2a9bb4f4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* We set the on hold flag to true when any work ticket is created. | |
* We set the on hold flag to false when any work ticket is approved. | |
* @return bool | |
*/ | |
public function should_be_on_hold() | |
{ | |
/** @var RepairOrder $order */ | |
$order = $this->__get('product_order'); | |
if( ! $order){ | |
// throw exception, trying to place hold a order that doesnt exist | |
} | |
if($order->status == Order::STATUS_NEW && $order->type == Order::TYPE_REPAIR){ | |
return true; | |
} | |
if(! $order->has_been_approved()){ | |
return true; | |
} | |
if (in_array($order->status, [Order::STATUS_PENDING_APPROVAL, Order::STATUS_REJECTED] ) | |
{ | |
return true; | |
} | |
return false | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment