public function execute() { $lastMonth = date('Y-m-d', strtotime('-1 month')) . ' 00:00:00'; $issues = $this->issueService->getIssues(array('status=' => Issue::STATUS_RESOLVED, 'issue.updated < ' => $lastMonth)); foreach ($issues as $issue) { $issue->status = Issue::STATUS_CLOSED; $this->issueService->saveIssue($issue, false); echo "Closed request " . $issue->id . ": " . $issue->title . "\r\n"; } }
/** * Adds a note to this issue * */ public function addnoteAction() { $issue = $this->byId(); if ($issue) { $note = $this->_getParam('note'); $title = 'RE Request #' . $issue->id . ': ' . $this->_getParam('title'); $note = $this->notificationService->addNoteTo($issue, $note, $title); // If this is a 'new' note, then lets update it to be open now that there's a thing if ($issue->status == 'New') { $issue->status = 'Open'; } // Save the issue so it's mod time is updated $this->issueService->saveIssue($issue); $this->notificationService->sendWatchNotifications($note, array('controller' => 'issue', 'action' => 'edit', 'params' => array('id' => $issue->id))); } $this->redirect('issue', 'edit', array('id' => $issue->id, '#notes')); }