Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * @return bool
- */
- public function cancel()
- {
- $type = get_class($this) . '::' . __FUNCTION__;
- $title = self::STATUS_CANCELLED . ' ' . $this->getRisRequest()->getValue('id');
- $currentStatus = $this->getRequestRisStatus();
- $status = isset($this->workflow[$currentStatus]) ? $this->workflow[$currentStatus] : false;
- $users = $status[1]['notification'];
- $this->risRequest->setStatus(self::STATUS_CANCELLED);
- if ($currentStatus == self::STATUS_CANCELLED) {
- return true;
- } else if ( $currentStatus == self::STATUS_WAIT_SUPERIOR || $currentStatus == self::STATUS_WAIT_EPES_APPROVAL) {
- // head or his backups
- if (self::STATUS_WAIT_EPES_APPROVAL == $currentStatus) {
- $user = current($users);
- $this->setRisPerson($user);
- // some protected
- $this->sendMessageToUserAndBackups($user, $title, $title, $type);
- } elseif (self::STATUS_WAIT_SUPERIOR == $currentStatus) { // superior or his backups
- $superior = $this->getSuperior();
- // some protected
- $this->sendMessageToUserAndBackups($superior, $title, $title, $type);
- }
- } else {
- foreach ($users as $user) {
- $this->getMessage()->postWithDynamicRequest($this->setRisPerson($user)->getRisPerson(), $title, $title, $type, false, $this->getRisRequest()->getValue('id'));
- }
- }
- // some protected
- $this->notifyStatusChangeOrs($type);
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement