static function getCreatedFields($is_fake = false, $ticket_id = 0, $msg_id = 0) { if (!$is_fake) { $ticket = Tickets::find($ticket_id); $thread_message = ThreadMessages::where('id', $msg_id)->first(); $ticket_attachment = TicketAttachments::where('message_id', $msg_id)->first(); $customer = User::where('id', $ticket->customer_id)->first(); $company = Company::where('id', $ticket->company_id)->first(); $department = Department::where('id', $ticket->department_id)->first(); $mailer_extra = ['ticket_id' => $ticket->id, 'ticket_subject' => $ticket->subject, 'ticket_description' => $ticket->description, 'ticket_status' => $ticket->status, 'ticket_status_txt' => self::resolveStatus($ticket->status), 'ticket_priority' => $ticket->priority, 'ticket_priority_txt' => self::resolveStatus($ticket->priority), 'company_name' => $company->name, 'company_description' => $company->description, 'company_domain' => $company->domain, 'company_logo' => $company->logo, 'department_name' => $department->name, 'has_attachment' => $ticket_attachment->has_attachment, 'attachment_path' => $ticket_attachment->attachment_path, 'receiver_name' => $customer->name, 'receiver_email' => $customer->email]; } else { $mailer_extra = ['ticket_id' => 1, 'ticket_subject' => "How can i use contact us form", 'ticket_description' => "Hi , Sir how can i use contact us form", 'ticket_status' => 1, 'ticket_status_txt' => self::resolveStatus(1), 'ticket_priority' => 1, 'ticket_priority_txt' => self::resolveStatus(1), 'company_name' => "KODEINFO", 'company_description' => "We are a small and dedicated team of designers/developers. This is our web design and development focused blog.We focus on pushing the boundaries of standards based web technologies.", 'company_domain' => "http://www.kodeinfo.com", 'company_logo' => "http://kodeinfo.com/img/shortlogo.png", 'department_name' => "General Queries", 'has_attachment' => false, 'attachment_path' => "", 'receiver_name' => "Imran", 'receiver_email' => "*****@*****.**"]; } return $mailer_extra; }
/** * Save the ticket note * * @param integer $ticketid * @param array $params */ public static function saveIt($tid, $date, $note, $category = null, $status = null, $isAdmin = false, $noteid = null, $sendemail = true) { $translator = Shineisp_Registry::getInstance()->Zend_Translate; if (!is_numeric($tid)) { return false; } if (is_numeric($noteid)) { $ticketnote = self::find($noteid); } else { $ticketnote = new TicketsNotes(); } // Get and Check the ticket note $ticket = Tickets::find($tid); // update the ticket if (!empty($status) && is_numeric($status)) { $ticket->status_id = $status; } $ticket->date_updated = date('Y-m-d H:i:s'); if (is_numeric($category)) { $ticket->category_id = $category; } $ticket->save(); if ($ticket && !empty($note)) { $ticketnote->date_post = !empty($date) ? $date : $date('Y-m-d H:i:s'); $ticketnote->note = $note; $ticketnote->admin = $isAdmin; $ticketnote->ticket_id = $tid; $ticketnote->parent_id = 0; // Save the note if ($ticketnote->trySave()) { $noteid = is_numeric($noteid) ? $noteid : $ticketnote->getIncremented(); // Save the upload file $attachment = self::UploadDocument($tid, $ticket->get('customer_id')); if ($sendemail) { Tickets::send($noteid, false, $attachment); } return $ticketnote; } } return false; }
/** * return all tickets in current project. If category is specified it returns all tickets by category * * @param Project $project * @param Category $category * @param integer $min_state * @param integer $min_visibility * */ function findByProject($project, $category = null, $min_state = STATE_VISIBLE, $min_visibility = VISIBILITY_NORMAL) { if ($category) { return Tickets::find(array("conditions" => array('project_id = ? AND type = ? AND parent_id =? AND state >= ? AND visibility >= ?', $project->getId(), 'Ticket', $category->getId(), $min_state, $min_visibility), "order" => "priority DESC")); } else { return Tickets::find(array("conditions" => array('project_id = ? AND type = ? AND state >= ? AND visibility >= ?', $project->getId(), 'Ticket', $min_state, $min_visibility), "order" => "priority DESC")); } }