Advertisement
Guest User

Untitled

a guest
Jul 26th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. /**
  2. * @return bool
  3. */
  4. public function cancel()
  5. {
  6. $type = get_class($this) . '::' . __FUNCTION__;
  7. $title = self::STATUS_CANCELLED . ' ' . $this->getRisRequest()->getValue('id');
  8. $currentStatus = $this->getRequestRisStatus();
  9. $status = isset($this->workflow[$currentStatus]) ? $this->workflow[$currentStatus] : false;
  10. $users = $status[1]['notification'];
  11.  
  12. $this->risRequest->setStatus(self::STATUS_CANCELLED);
  13.  
  14. if ($currentStatus == self::STATUS_CANCELLED) {
  15. return true;
  16. } else if ( $currentStatus == self::STATUS_WAIT_SUPERIOR || $currentStatus == self::STATUS_WAIT_EPES_APPROVAL) {
  17.  
  18. // head or his backups
  19. if (self::STATUS_WAIT_EPES_APPROVAL == $currentStatus) {
  20. $user = current($users);
  21. $this->setRisPerson($user);
  22. // some protected
  23. $this->sendMessageToUserAndBackups($user, $title, $title, $type);
  24. } elseif (self::STATUS_WAIT_SUPERIOR == $currentStatus) { // superior or his backups
  25. $superior = $this->getSuperior();
  26. // some protected
  27. $this->sendMessageToUserAndBackups($superior, $title, $title, $type);
  28. }
  29.  
  30. } else {
  31. foreach ($users as $user) {
  32. $this->getMessage()->postWithDynamicRequest($this->setRisPerson($user)->getRisPerson(), $title, $title, $type, false, $this->getRisRequest()->getValue('id'));
  33. }
  34. }
  35.  
  36. // some protected
  37. $this->notifyStatusChangeOrs($type);
  38.  
  39. return true;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement