Exemplo n.º 1
0
 /**
  * Exclude object from result
  *
  * @param   Action $action Object to remove from the list of results
  *
  * @return ActionQuery The current query, for fluid interface
  */
 public function prune($action = null)
 {
     if ($action) {
         $this->addUsingAlias(ActionPeer::ID, $action->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }
Exemplo n.º 2
0
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      Action $obj A Action object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool($obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         ActionPeer::$instances[$key] = $obj;
     }
 }
Exemplo n.º 3
0
 * and let it sit.
 *
 * Now that we're displaying reports and stats, these old tickets
 * are skewing the stats.  We need to try and close them out, but
 * still give them some reasonable dates so they don't skew the stats
 *
 * These old tickets do not usually pass validation, so we have to do
 * raw SQL queries to do the work.
 *
 * @copyright 2012 City of Bloomington, Indiana
 * @license http://www.gnu.org/licenses/agpl.txt GNU/AGPL, see LICENSE.txt
 * @author Cliff Ingham <*****@*****.**>
 */
include '../configuration.inc';
$zend_db = Database::getConnection();
$closedAction = new Action('close');
$cutoff_date = '2009-01-01';
$sql = "select t.id, t.enteredDate, t.assignedPerson_id\n\t\tfrom tickets t\n\t\twhere t.status='open'\n\t\tand t.enteredDate<'{$cutoff_date}'";
$result = $zend_db->fetchAll($sql);
foreach ($result as $row) {
    $sql = 'select max(actionDate) from ticketHistory where ticket_id=?';
    $actionDate = $zend_db->fetchOne($sql, array($row['id']));
    $history = array('ticket_id' => $row['id'], 'actionPerson_id' => $row['assignedPerson_id'], 'action_id' => $closedAction->getId(), 'actionDate' => $actionDate ? $actionDate : $row['enteredDate'], 'notes' => '[data cleanup] Closed old ticket from ReqPro');
    $zend_db->insert('ticketHistory', $history);
    $zend_db->update('tickets', array('status' => 'closed'), 'id=' . $row['id']);
    $ticket = new Ticket($row['id']);
    $search = new Search();
    $search->add($ticket);
    $search->solrClient->commit();
    echo "{$row['id']} {$row['enteredDate']} {$history['actionDate']}\n";
}
Exemplo n.º 4
0
 * When we originally imported them, they received a mix of
 * 1970-01-01 (the original unix timestamp) and CURRENT_TIME
 *
 * We don't know when these things were originally entered, but
 * cannot leave the date as zero.  So, we're setting all dates on
 * these tickets to 1970-01-01.
 */
$sql = "select t.id,t.enteredDate,h.enteredDate,h.actionDate\n\t\tfrom tickets t\n\t\tleft join ticketHistory h on (t.id=h.ticket_id and h.action_id=?)\n\t\twhere t.enteredDate='1970-01-01'";
$result = $zend_db->fetchAll($sql, $openAction->getId());
foreach ($result as $row) {
    $zend_db->update('ticketHistory', array('enteredDate' => '1970-01-01', 'actionDate' => '1970-01-01', 'notes' => '[data cleanup] Dates were missing and have been set to 1970'), "ticket_id={$row['id']}");
    echo "{$row['id']} set to 1970-01-01\n";
}
/**
 * A ton a records are closed, yet do not have a ticketHistory with a closed action
 * We are relying on the ticketHistory date for Reporting, so we need to have dates set
 * We're going to have to just invent the close date
 * This should use the date of the last TicketHistory, if available,
 * otherwise it will set the close date as the same as the Ticket enteredDate
 */
$sql = "select t.id, t.enteredDate, t.assignedPerson_id\n\t\tfrom tickets t\n\t\tleft join ticketHistory h on t.id=h.ticket_id and h.action_id=?\n\t\twhere t.status='closed' and h.actionDate is null";
$result = $zend_db->fetchAll($sql, $closedAction->getId());
foreach ($result as $row) {
    $sql = 'select max(actionDate) from ticketHistory where ticket_id=?';
    $actionDate = $zend_db->fetchOne($sql, array($row['id']));
    $history = array('ticket_id' => $row['id'], 'actionPerson_id' => $row['assignedPerson_id'], 'action_id' => $closedAction->getId(), 'actionDate' => $actionDate ? $actionDate : $row['enteredDate'], 'notes' => '[data cleanup] Closing date was missing and has been provided by the system as a best guess');
    $zend_db->insert('ticketHistory', $history);
    echo "{$row['id']} {$row['enteredDate']} {$history['actionDate']}\n";
}
$q = $zend_db->query('update tickets set latitude=null, longitude=null where latitude=0');
$q->execute();