$solr = Util_SolrFactory::get_instance()->get_solr();
$id = @intval($argv[2]);
if (empty($id)) {
    $id = @intval(file_get_contents('/tmp/ibug_ticket_log_id'));
}
$logs = Bll_TicketLogBiz::get_instance()->get_ticket_ids_great_than_id($id, 500);
if (empty($logs)) {
    echo date('c ') . "No tickets to update\n";
    exit(0);
}
$ticket_ids = array();
foreach ($logs as $ticket_log) {
    $ticket_ids[] = $ticket_log->ticket_id;
}
$id = $ticket_log->id;
$dao = Model_Ticket::data_access();
$ticket_ids = array_unique($ticket_ids);
$tickets = $dao->find_by_pks($ticket_ids);
$tickets = Bll_TicketBiz::get_instance()->process_solr_field($tickets);
$_ticket_ccs = Bll_TicketCcBiz::get_instance()->get_ticket_cc_by_ticket_ids($ticket_ids);
$ticket_ccs = array();
if (!empty($_ticket_ccs)) {
    foreach ($_ticket_ccs as $_ticket_cc) {
        $ticket_ccs[$_ticket_cc->ticket_id][] = $_ticket_cc->cc_to;
    }
}
foreach ($tickets as $ticket_id => $ticket) {
    if (empty($ticket)) {
        try {
            $solr->deleteById($ticket_id);
            echo date('c ') . " Delete ok {$ticket_id}\n";
Exemple #2
0
 public function __construct($ticket_id)
 {
     $this->ticket = Model_Ticket::data_access()->find_by_pk($ticket_id);
     $this->user = APF::get_instance()->get_request()->get_username();
 }
Exemple #3
0
 public function get_count_by_function($begin, $end, $function)
 {
     $dao = Model_Ticket::data_access();
     $tickets = $dao->filter_by_op(Model_Ticket::Enviroment, '=', 19);
     $tickets = $tickets->filter(Model_Ticket::Priority, array(7, 11, 80));
     $tickets = $tickets->filter_by_op(Model_Ticket::CreatedAt, '>=', $begin)->filter_by_op(Model_Ticket::CreatedAt, '<=', $end);
     $tickets = $tickets->filter_by_op(Model_Ticket::Component, 'in', $function)->find();
     return count($tickets);
 }
Exemple #4
0
 /**
  * test if we get a array from db
  */
 public function testArray()
 {
     $data = $this->tickets->getAll();
     $this->assertNotEmpty($data);
     $this->assertEquals('*****@*****.**', $data[0]['email']);
 }
Exemple #5
0
 public function action_close()
 {
     $user = Auth::instance()->get_user();
     $ticket_id = $this->request->param('id', 0);
     //getting the parent ticket
     $ticket = new Model_Ticket();
     //only supportadmin can close any ticket
     if (!$user->has_access('supportadmin')) {
         $ticket->where('id_user', '=', $user->id_user);
     }
     $ticket->where('id_ticket', '=', $ticket_id)->where('id_ticket_parent', 'IS', NULL)->limit(1)->find();
     if (!$ticket->loaded()) {
         Alert::set(Alert::ERROR, __('Not your ticket.'));
         $this->redirect(Route::url('oc-panel', array('controller' => 'support', 'action' => 'index')));
     } else {
         //close ticket
         $ticket->status = Model_Ticket::STATUS_CLOSED;
         $ticket->save();
         Alert::set(Alert::SUCCESS, __('Ticket closed.'));
         $this->redirect(Route::url('oc-panel', array('controller' => 'support', 'action' => 'index')));
     }
 }