Ejemplo n.º 1
0
 /**
  * Notify the relevant people of a new issue
  *
  * @param unknown_type $issue
  */
 private function notifyOfNewIssue($issue)
 {
     // get the group assigned to the project that this issue is against
     $project = $this->projectService->getProject($issue->projectid);
     $group = $this->groupService->getGroup($project->ownerid);
     // Only send if the group exists
     if ($group) {
         $users = $this->groupService->getUsersInGroup($group);
         $msg = new TemplatedMessage('new-issue.php', array('model' => $issue, 'project' => $project));
         $this->notificationService->notifyUser("New request has been created", $users, $msg);
     }
     // if the new issue is a severity 1, then sms as well
     if ($issue->severity == Issue::SEVERITY_ONE) {
         $this->trackerService->track('sev1request', 'request-' . $issue->id);
         $user = $this->userService->getUserByField('username', $issue->userid);
         if ($user != null && $user->contactid) {
             $contactDetails = $this->clientService->getContact($user->contactid);
             if ($contactDetails && mb_strlen($contactDetails->mobile)) {
                 // lets send a quick SMS
                 if ($this->smsService->send("New Severity 1 request #" . $issue->id . ": " . $issue->title . ", please login and check ASAP!", $contactDetails->mobile)) {
                     $this->trackerService->track('sendsms', 'request-' . $issue->id);
                 }
             }
         }
     }
 }
Ejemplo n.º 2
0
 public function indexAction()
 {
     // get all the contacts for the currently logged in user's company.
     $contact = $this->clientService->getContact(za()->getUser()->contactid);
     if (!$contact) {
         return;
     }
     $client = $this->clientService->getClient($contact->clientid);
     $totalCount = $this->clientService->getContactCount(array('clientid=' => $client->id));
     $this->view->pagerName = 'pager';
     $currentPage = ifset($this->_getAllParams(), $this->view->pagerName, 1);
     $this->view->totalCount = $totalCount;
     $this->view->listSize = za()->getConfig('project_list_size');
     $this->view->contacts = $this->clientService->getContacts($client, array(), 'firstname asc', $currentPage, $this->view->listSize);
     $this->renderView('contact/index.php');
 }