$location = "{$row['street_dir']} {$row['street_name']} {$row['street_type']} {$row['sud_type']} {$row['sud_num']}"; $location = preg_replace('/\\s+/', ' ', $location); $ticket->setLocation($location); } echo $ticket->getLocation() . "\n"; // Create the issue on this ticket $issue = new Issue(); $issue->setDate($ticket->getEnteredDate()); if ($row['comments']) { $issue->setDescription($row['comments']); } $ticket->updateIssues($issue); $issue = $ticket->getIssue(); $location = $ticket->getLocation(); $date = $issue->getDate(); $description = $issue->getDescription(); echo "Query: {$location}, {$description}, {$date}\n"; $ticketList = new TicketList(); $ticketList->findByMongoQuery(array('location' => $location, 'issues.description' => $description, 'issues.date' => $date)); if (count($ticketList) == 1) { // Update the Mongo case Number with what's in reqpro foreach ($ticketList as $t) { $data = $t->getData(); $data['number'] = (int) $row['c_num']; echo "Saving new number {$data['number']}\n"; #$mongo->tickets->save($data,array('safe'=>true)); } } else { fwrite($FAILLOG, "{$row['c_num']}\n"); } }
<?php /** * @copyright 2011 City of Bloomington, Indiana * @license http://www.gnu.org/licenses/agpl.txt GNU/AGPL, see LICENSE.txt * @author Cliff Ingham <*****@*****.**> */ include '../../../configuration.inc'; $mongo = Database::getConnection(); $ticketList = new TicketList(); $ticketList->findByMongoQuery(array('issues[0].date' => array('$ne' => 'history[0].actionDate'))); foreach ($ticketList as $ticket) { $ticketModified = false; $issue = $ticket->getIssue(); if ($issue) { $issueDate = $issue->getDate('Y-m-d'); $history = $ticket->getHistory(); echo "Ticket {$ticket->getId()} {$issueDate} ("; foreach ($history as $index => $action) { $actionDate = $action->getActionDate('Y-m-d'); if ($actionDate == '2011-06-28') { $action->setActionDate($issueDate); $ticket->updateHistory($action, $index); $ticketModified = true; } } $dates = array(); $history = $ticket->getHistory(); foreach ($history as $action) { $dates[] = "{$action->getActionDate('Y-m-d')}"; }
<?php /** * @copyright 2013 City of Bloomington, Indiana * @license http://www.gnu.org/licenses/agpl.txt GNU/AGPL, see LICENSE.txt * @author Cliff Ingham <*****@*****.**> */ include '../configuration.inc'; // We want to find all tickets, not just the ones that are public. // This can only be done with a logged in user, which we don't have // when this is run from the CRON. // Instead, we create a Mock user with Admin privileges. $_SESSION['USER'] = new Person(); $_SESSION['USER']->setRole('Administrator'); $zend_db = Database::getConnection(); $sql = "select distinct assignedPerson_id\n\t\tfrom tickets\n\t\twhere status='open'"; $ids = $zend_db->fetchCol($sql); foreach ($ids as $id) { $person = new Person($id); $tickets = new TicketList(); $tickets->find(array('assignedPerson_id' => $person->getId(), 'status' => 'open'), 't.enteredDate'); $template = new Template('email', 'txt'); $template->blocks[] = new Block('notifications/digestNotification.inc', array('person' => $person)); $template->blocks[] = new Block('tickets/ticketList.inc', array('ticketList' => $tickets, 'title' => 'Outstanding cases', 'disableButtons' => true)); $text = $template->render(); $count = count($tickets); $person->sendNotification($text, "{$count} open cases in " . APPLICATION_NAME); }