Skip to content

Instantly share code, notes, and snippets.

@chonthu
Last active December 6, 2018 01:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chonthu/bfa4c8f1f4cb81e0d82dd8bc2a9bb4f4 to your computer and use it in GitHub Desktop.
Save chonthu/bfa4c8f1f4cb81e0d82dd8bc2a9bb4f4 to your computer and use it in GitHub Desktop.
/**
* 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