コード例 #1
0
 public static function &get_instance()
 {
     if (!self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
コード例 #2
0
ファイル: StatusVerified.php プロジェクト: emilymwang8/ibug
 public function change_status($status, $input_arr)
 {
     $current_time = date("Y-m-d H:i:s");
     if ($status != 'Verified') {
         $history_arr = array('ticket_id' => $this->ticket->id, 'status' => strtolower($status), 'created_at' => $current_time, 'created_by' => $this->user);
         $history_id = Bll_TicketStatusHistoryBiz::get_instance()->insert_status_history($history_arr);
     }
     if ($status == 'Opened') {
         $input_log_open = array('ticket_id' => $this->ticket->id, 'created_by' => $input_arr['owner'], 'field' => 'resolution', 'oldvalue' => $this->ticket->resolution, 'newvalue' => 'null', 'created_at' => $current_time, 'rlog' => $input_arr['rlog']);
         $log_id_open = Bll_TicketLogBiz::get_instance()->log_add($input_log_open);
         $reject_counter = Bll_TicketCounterBiz::get_instance()->insert_reject_counter($this->ticket->id);
         $this->ticket->status = 'opened';
         $this->ticket->resolution = '';
     } else {
         if ($status == 'Closed') {
             $this->ticket->status = 'closed';
             $this->ticket->closed_at = $current_time;
         } else {
             if ($status == 'Released') {
                 $this->ticket->status = 'released';
             }
         }
     }
     $this->ticket->updated_at = $current_time;
     $success = $this->ticket->save();
     return $this->ticket->status;
 }
コード例 #3
0
ファイル: StatusOpened.php プロジェクト: emilymwang8/ibug
 public function change_status($status, $input_arr)
 {
     $current_time = date("Y-m-d H:i:s");
     if ($status != 'Opened') {
         $history_arr = array('ticket_id' => $this->ticket->id, 'status' => strtolower($status), 'created_at' => $current_time, 'created_by' => $this->user);
         $history_id = Bll_TicketStatusHistoryBiz::get_instance()->insert_status_history($history_arr);
     }
     if ($status == 'Opened') {
         $this->ticket->owner = $input_arr['owner'];
     } else {
         if ($status == 'Accepted') {
             $this->ticket->owner = $input_arr['owner'];
             $this->ticket->status = 'accepted';
         } else {
             if ($status == 'Closed') {
                 $input_log_reason = array('ticket_id' => $this->ticket->id, 'created_by' => $input_arr['owner'], 'field' => 'reason', 'oldvalue' => $this->ticket->reason, 'newvalue' => $input_arr['reason'], 'created_at' => $current_time);
                 if ($input_log_reason['oldvalue'] != $input_log_reason['newvalue']) {
                     $log_id_reason = Bll_TicketLogBiz::get_instance()->log_add($input_log_reason);
                 }
                 $input_log_reason_detail = array('ticket_id' => $this->ticket->id, 'created_by' => $input_arr['owner'], 'field' => 'reason Description', 'oldvalue' => $this->ticket->reason_detail ? $this->ticket->reason_detail : 'null', 'newvalue' => $input_arr['reason_detail'], 'created_at' => $current_time);
                 if ($input_log_reason_detail['oldvalue'] != $input_log_reason_detail['newvalue']) {
                     $log_id_reason_detail = Bll_TicketLogBiz::get_instance()->log_add($input_log_reason_detail);
                 }
                 $this->ticket->resolution = $input_arr['resolution'];
                 $this->ticket->reason = $input_arr['reason'];
                 $this->ticket->reason_detail = $input_arr['reason_detail'];
                 $this->ticket->closed_at = $current_time;
                 $this->ticket->status = 'closed';
                 $input_log_close = array('ticket_id' => $this->ticket->id, 'created_by' => $input_arr['owner'], 'field' => 'resolution', 'oldvalue' => 'null', 'newvalue' => $this->ticket->resolution, 'created_at' => $current_time);
                 $log_id_close = Bll_TicketLogBiz::get_instance()->log_add($input_log_close);
             }
         }
     }
     $this->ticket->updated_at = $current_time;
     $success = $this->ticket->save();
     return $this->ticket->status;
 }
コード例 #4
0
ファイル: ProcessTime.php プロジェクト: emilymwang8/ibug
 public function handle_request_internal()
 {
     $req = APF::get_instance()->get_request();
     $res = APF::get_instance()->get_response();
     $params = $req->get_parameters();
     $product = $params['pro'] ? $params['pro'] : 0;
     /*$tab_info = array(
               0 => array('name' => 'All', 'click' => false),
               1 => array('name' => 'Anjuke', 'click' => false),
               2 => array('name' => 'Aifang', 'click' => false),
               3 => array('name' => 'Haozu', 'click' => false),
               4 => array('name' => 'Jinpu', 'click' => false),
               5 => array('name' => 'Mobile', 'click' => false),
               6 => array('name' => 'Inc', 'click' => false)
       );*/
     $tab_info = array(0 => array('name' => 'All', 'click' => false), 1 => array('name' => '用户端', 'click' => false), 2 => array('name' => '客户端', 'click' => false), 3 => array('name' => '开发商', 'click' => false), 4 => array('name' => 'CRM', 'click' => false), 5 => array('name' => '移动', 'click' => false), 6 => array('name' => 'Inc.', 'click' => false));
     $tab_info[$product]['click'] = true;
     $from = $params['from'] ? date("Y-m-d 00:00:00", strtotime($params['from'])) : date("Y-m-01 00:00:00");
     $to = $params['to'] ? date("Y-m-d 23:59:59", strtotime($params['to'])) : date("Y-m-t 23:59:59");
     $input_from = date("Y-m-d", strtotime($from));
     $input_to = date("Y-m-d", strtotime($to));
     /*$depart_value_id = array(
       '0' => '0',
       '1' => '2',
       '2' => '4',
       '3' => '3',
       '4' => '5',
       '5' => '45',
       '6' => '46');*/
     $depart_value_id = array('0' => '0', '1' => '51', '2' => '52', '3' => '53', '4' => '54', '5' => '56', '6' => '75');
     $pro_id = $depart_value_id[$product];
     $bugs = Bll_TicketBiz::get_instance()->get_count_online_by_month_process($from, $to, 'all', $pro_id);
     $bug_ids = array();
     $bug_pro = array();
     foreach ($bugs as $row) {
         $bug_ids[] = $row->id;
         $bug_pro[$row->id] = $row;
     }
     if (!empty($bug_ids)) {
         $historys = Bll_TicketStatusHistoryBiz::get_instance()->get_history_by_ids($bug_ids);
         $his_pro = array();
         foreach ($historys as $row) {
             if ($row->status == 'accepted') {
                 if (isset($his_pro[$row->ticket_id][$row->status]) && strtotime($row->created_at) < strtotime($his_pro[$row->ticket_id][$row->status]) || !isset($his_pro[$row->ticket_id][$row->status])) {
                     $his_pro[$row->ticket_id][$row->status] = $row->created_at;
                 }
             } else {
                 if (isset($his_pro[$row->ticket_id][$row->status]) && strtotime($row->created_at) > strtotime($his_pro[$row->ticket_id][$row->status]) || !isset($his_pro[$row->ticket_id][$row->status])) {
                     $his_pro[$row->ticket_id][$row->status] = $row->created_at;
                 }
             }
         }
     }
     $table = array();
     foreach ($bug_ids as $id) {
         $table[$id]['id'] = $bug_pro[$id]->id;
         $table[$id]['summary'] = $bug_pro[$id]->summary;
         $table[$id]['owner'] = $bug_pro[$id]->owner;
         $table[$id]['priority'] = $bug_pro[$id]->priority;
         $table[$id]['component'] = $bug_pro[$id]->department . '-' . $bug_pro[$id]->component;
         $table[$id]['reporter'] = $bug_pro[$id]->reporter;
         $table[$id]['created_at'] = $bug_pro[$id]->created_at;
         $table[$id]['status'] = $bug_pro[$id]->status;
         if (isset($his_pro[$id]['accepted'])) {
             $table[$id]['qa_time'] = $this->convert_time($bug_pro[$id]->created_at, $his_pro[$id]['accepted']);
             $table[$id]['qa_time_format'] = $this->format_time($table[$id]['qa_time']);
         } else {
             $table[$id]['qa_time'] = '0';
             $table[$id]['qa_time_format'] = '-';
         }
         if (isset($his_pro[$id]['verified']) && !in_array($bug_pro[$id]->status, array('opened', 'accepted'))) {
             $table[$id]['dev_time'] = $this->convert_time($bug_pro[$id]->created_at, $his_pro[$id]['verified']);
             $table[$id]['dev_time_format'] = $this->format_time($table[$id]['dev_time']);
         } else {
             $table[$id]['dev_time'] = '0';
             $table[$id]['dev_time_format'] = '-';
         }
         if (isset($his_pro[$id]['closed'])) {
             $table[$id]['all_time'] = $this->convert_time($bug_pro[$id]->created_at, $his_pro[$id]['closed']);
             $table[$id]['all_time_format'] = $this->format_time($table[$id]['all_time']);
         } else {
             $table[$id]['all_time'] = '0';
             $table[$id]['all_time_format'] = '-';
         }
     }
     $req->set_attribute('product', $product);
     $req->set_attribute('tab_info', $tab_info);
     $req->set_attribute('input_from', $input_from);
     $req->set_attribute('input_to', $input_to);
     $req->set_attribute('table', $table);
     return 'Newreport_ProcessTime';
 }
コード例 #5
0
ファイル: CustomQuery.php プロジェクト: emilymwang8/ibug
 /**
  *	处理ticket数据 
  */
 public function deal_ticket_data($results)
 {
     $docs = $results['docs'];
     $ids = array();
     foreach ($docs as $doc) {
         $ids[] = $doc['fields']['id'];
         $tickets = Bll_TicketBiz::get_instance()->get_tickets_by_id_arr($ids);
         $tickets = $this->process_tickets($tickets, $results['docs']);
         $historys = Bll_TicketStatusHistoryBiz::get_instance()->get_history_by_ids($ids);
         $his_pro = array();
         foreach ($historys as $row) {
             if ($row->status == 'accepted') {
                 if (isset($his_pro[$row->ticket_id][$row->status]) && strtotime($row->created_at) < strtotime($his_pro[$row->ticket_id][$row->status]) || !isset($his_pro[$row->ticket_id][$row->status])) {
                     $his_pro[$row->ticket_id][$row->status] = $row->created_at;
                 }
             } else {
                 if (isset($his_pro[$row->ticket_id][$row->status]) && strtotime($row->created_at) > strtotime($his_pro[$row->ticket_id][$row->status]) || !isset($his_pro[$row->ticket_id][$row->status])) {
                     $his_pro[$row->ticket_id][$row->status] = $row->created_at;
                 }
             }
         }
         foreach ($tickets as $key => $ticket) {
             foreach ($tickets[$key] as $k => $v) {
                 $tickets[$key][$k]->additional = Bll_TicketColumnDetailBiz::get_instance()->get_all_custom($v->id);
                 //QA时间
                 if (isset($his_pro[$v->id]['accepted'])) {
                     $tickets[$key][$k]->qa_at = $his_pro[$v->id]['accepted'];
                     $tickets[$key][$k]->qa_time = $this->format_time_v1($this->convert_time($v->created_at, $tickets[$key][$k]->qa_at));
                 } else {
                     $tickets[$key][$k]->qa_at = '0';
                     $tickets[$key][$k]->qa_time = '-';
                 }
                 //开发时间
                 if (isset($his_pro[$v->id]['verified']) && !in_array($v->status, array('opened', 'accepted'))) {
                     $tickets[$key][$k]->dev_at = $his_pro[$v->id]['verified'];
                     $tickets[$key][$k]->dev_time = $this->format_time($this->convert_time($v->created_at, $tickets[$key][$k]->dev_at));
                 } else {
                     $tickets[$key][$k]->dev_at = '0';
                     $tickets[$key][$k]->dev_time = '-';
                 }
                 //完整处理时间
                 if (isset($his_pro[$v->id]['closed'])) {
                     $tickets[$key][$k]->all_at = $his_pro[$v->id]['closed'];
                     $tickets[$key][$k]->all_time = $this->format_time($this->convert_time($v->created_at, $tickets[$key][$k]->all_at));
                     $tickets[$key][$k]->all_time_2 = $this->format_time_v2($this->convert_time($v->created_at, $tickets[$key][$k]->all_at));
                 } else {
                     $tickets[$key][$k]->all_at = '0';
                     $tickets[$key][$k]->all_time = '-';
                 }
                 //reopened
                 $parent = Bll_TicketRelationBiz::get_instance()->find_root_by_parent($v->id);
                 if ($parent) {
                     $tickets[$key][$k]->pid = $parent->parent_ticket_id;
                 } else {
                     $tickets[$key][$k]->pid = '';
                 }
                 if (isset($v->description)) {
                     $tickets[$key][$k]->description = preg_replace('/<img.*>/siU', '', $v->description);
                 }
             }
         }
     }
     return $tickets;
 }
コード例 #6
0
 $input_arr['created_at'] = $current_time;
 $input_arr['total'] = count($row_second);
 $new = 0;
 $reopen = 0;
 $fixed = 0;
 $close = 0;
 $reject = 0;
 foreach ($row_second as $ticket_row) {
     if ($ticket_row->created_at >= $begin && $ticket_row->created_at <= $end) {
         $new++;
         $is_reopen = Bll_TicketRelationBiz::get_instance()->find_root_by_parent($ticket_row->id);
         if (!empty($is_reopen)) {
             $reopen++;
         }
     }
     $is_fixed = Bll_TicketStatusHistoryBiz::get_instance()->check_status_history($ticket_row->id, 'verified', $begin, $end);
     if (!empty($is_fixed)) {
         $fixed++;
     }
     if ($ticket_row->closed_at && $ticket_row->closed_at >= $begin && $ticket_row->closed_at <= $end) {
         $close++;
     }
     $is_reject = Bll_TicketCounterBiz::get_instance()->get_reject_counter($ticket_row->id);
     if (!empty($is_reject)) {
         if ($is_reject[0]->updated_at >= $begin && $is_reject[0]->updated_at <= $end) {
             $reject++;
         }
     }
 }
 $input_arr['new'] = $new;
 $input_arr['reopen'] = $reopen;