Example #1
0
<?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')}";
        }
Example #2
0
        $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");
    }
}