function run($max_time) { global $cfg; $i18n = new Internationalization($cfg->get('system_language', 'en_US')); $sequences = $i18n->getTemplate('sequence.yaml')->getData(); foreach ($sequences as $s) { Sequence::create($s)->save(); } db_query('UPDATE '.SEQUENCE_TABLE.' SET `next`= ' .'(SELECT MAX(ticket_id)+1 FROM '.TICKET_TABLE.') ' .'WHERE `id`=1'); require_once(INCLUDE_DIR . 'class.list.php'); $lists = $i18n->getTemplate('list.yaml')->getData(); foreach ($lists as $l) { DynamicList::create($l); } $statuses = $i18n->getTemplate('ticket_status.yaml')->getData(); foreach ($statuses as $s) { TicketStatus::__create($s); } // Initialize MYSQL search backend MysqlSearchBackend::__init(); }
echo __('Department'); ?> </a> </th> </tr> </thead> <tbody> <?php $subject_field = TicketForm::objects()->one()->getField('subject'); $defaultDept = Dept::getDefaultDeptName(); //Default public dept. if ($tickets->exists(true)) { foreach ($tickets as $T) { $dept = $T['dept__ispublic'] ? Dept::getLocalById($T['dept_id'], 'name', $T['dept__name']) : $defaultDept; $subject = $subject_field->display($subject_field->to_php($T['cdata__subject']) ?: $T['cdata__subject']); $status = TicketStatus::getLocalById($T['status_id'], 'value', $T['status__name']); if (false) { // XXX: Reimplement attachment count support $subject .= ' <span class="Icon file"></span>'; } $ticketNumber = $T['number']; if ($T['isanswered'] && !strcasecmp($T['status__state'], 'open')) { $subject = "<b>{$subject}</b>"; $ticketNumber = "<b>{$ticketNumber}</b>"; } ?> <tr id="<?php echo $T['ticket_id']; ?> "> <td>
/** * View single ticket * * @param int $id * @param string $alias */ public function actionViewTicket($id, $alias) { if ($id && ($ticket = Tickets::model()->with(array('reporter', 'assigned', 'status', 'type', 'category', 'ticketpriority', 'version', 'fixed', 'ticketmilestone', 'comments', 'comments.commentreporter', 'comments.changes', 'lastcomment'))->byCommentDate()->findByPk($id))) { // Initiate the ticket comment model $comment = new TicketComments(); $props = new TicketProps(); $ticketChanges = array(); $commentPassed = false; $propsPassed = false; $propertiesPassed = false; // Make sure if we submit the form that we enter a comment if (isset($_POST['TicketComments'])) { $comment->setAttributes($_POST['TicketComments']); $comment->ticketid = $ticket->id; if ($comment->validate()) { $commentPassed = true; } } // Make suer we submitted the form if (isset($_POST['TicketProps'])) { $props->setAttributes($_POST['TicketProps']); if ($props->validate()) { $propsPassed = true; // did we change the title if ($props->title != $ticket->title) { $ticketChanges[] = Yii::t('tickets', '<strong>Title</strong> Changed from <em>{old}</em> To <em>{new}</em>', array('{old}' => $ticket->title, '{new}' => $props->title)); } // did we change the keywords if ($props->keywords != $ticket->keywords) { $ticketChanges[] = Yii::t('tickets', '<strong>Keywords</strong> Changed from <em>{old}</em> To <em>{new}</em>', array('{old}' => $ticket->keywords, '{new}' => $props->keywords)); } // did we change the assigned to if ($props->assignedtoid && $props->assignedtoid != $ticket->assignedtoid) { // Load the users $oldUser = Users::model()->findByPk($ticket->assignedtoid); $newUser = Users::model()->find('username=:username', array(':username' => $props->assignedtoid)); $ticketChanges[] = Yii::t('tickets', '<strong>Assigned</strong> Changed from <em>{old}</em> To <em>{new}</em>', array('{old}' => $oldUser ? $oldUser->getLink() : "''", '{new}' => $newUser ? $newUser->getLink() : "''")); } // Did we change the status if ($props->status && $props->status != $ticket->ticketstatus) { $oldStatus = TicketStatus::model()->findByPk($ticket->ticketstatus); $newStatus = TicketStatus::model()->findByPk($props->status); $ticketChanges[] = Yii::t('tickets', '<strong>Status</strong> Changed from <em>{old}</em> To <em>{new}</em>', array('{old}' => $oldStatus ? $oldStatus->getLink() : "''", '{new}' => $newStatus ? $newStatus->getLink() : "''")); $ticket->ticketstatus = $props->status; } // Did we change the type if ($props->type && $props->type != $ticket->tickettype) { $oldType = TicketType::model()->findByPk($ticket->tickettype); $newType = TicketType::model()->findByPk($props->type); $ticketChanges[] = Yii::t('tickets', '<strong>Type</strong> Changed from <em>{old}</em> To <em>{new}</em>', array('{old}' => $oldType ? $oldType->getLink() : "''", '{new}' => $newType ? $newType->getLink() : "''")); $ticket->tickettype = $props->type; } // Did we change the category if ($props->category && $props->category != $ticket->ticketcategory) { $oldCategory = TicketCategory::model()->findByPk($ticket->ticketcategory); $newCategory = TicketCategory::model()->findByPk($props->category); $ticketChanges[] = Yii::t('tickets', '<strong>Category</strong> Changed from <em>{old}</em> To <em>{new}</em>', array('{old}' => $oldCategory ? $oldCategory->getLink() : "''", '{new}' => $newCategory ? $newCategory->getLink() : "''")); $ticket->ticketcategory = $props->category; } // Did we change the version if ($props->version && $props->version != $ticket->ticketversion) { $oldVersion = TicketVersion::model()->findByPk($ticket->ticketversion); $newVersion = TicketVersion::model()->findByPk($props->version); $ticketChanges[] = Yii::t('tickets', '<strong>Version</strong> Changed from <em>{old}</em> To <em>{new}</em>', array('{old}' => $oldVersion ? $oldVersion->getVersionLink() : "''", '{new}' => $newVersion ? $newVersion->getVersionLink() : "''")); $ticket->ticketversion = $props->version; } // Did we change the fixedin if ($props->fixedin && $props->fixedin != $ticket->fixedin) { $oldFixed = TicketVersion::model()->findByPk($ticket->fixedin); $newFixed = TicketVersion::model()->findByPk($props->fixedin); $ticketChanges[] = Yii::t('tickets', '<strong>Fixed In Version</strong> Changed from <em>{old}</em> To <em>{new}</em>', array('{old}' => $oldFixed ? $oldFixed->getFixedinLink() : "''", '{new}' => $newFixed ? $newFixed->getFixedinLink() : "''")); $ticket->fixedin = $props->fixedin; } // Did we change the priority if ($props->priority && $props->priority != $ticket->priority) { $oldPriority = TicketPriority::model()->findByPk($ticket->priority); $newPriority = TicketPriority::model()->findByPk($props->priority); $ticketChanges[] = Yii::t('tickets', '<strong>Priority</strong> Changed from <em>{old}</em> To <em>{new}</em>', array('{old}' => $oldPriority ? $oldPriority->getLink() : "''", '{new}' => $newPriority ? $newPriority->getLink() : "''")); $ticket->priority = $props->priority; } // Assign props data to ticket $ticket->title = $props->title; $ticket->keywords = $props->keywords; // Reset the ticket assigned to if ($props->assignedtoid) { $ticket->assignedtoid = $props->assignedtoid; } else { $ticket->assignedtoid = (int) $ticket->assignedtoid; } // Make sure we have some changes or at least entered comment if (!$comment->content && !count($ticketChanges)) { $commentPassed = false; Functions::setFlash(Yii::t('tickets', 'You must enter a comment or make some changes to the ticket.')); } // validate ticket if ($ticket->validate()) { $propertiesPassed = true; } } } // Only if all flags were ok then save and update if (isset($_POST['submit']) && $commentPassed && $propsPassed && $propertiesPassed) { // Save both and redirect $comment->save(); // Did we change something? if (count($ticketChanges)) { foreach ($ticketChanges as $change) { $changes = new TicketChanges(); $changes->ticketid = $ticket->id; $changes->commentid = $comment->id; $changes->content = $change; $changes->save(); } } // Save ticket $ticket->lastcommentid = $comment->id; $ticket->update(); // Set flash Functions::setFlash(Yii::t('tickets', 'Tickets: Ticket Updated')); $this->redirect($ticket->getLink('', array(), true)); } // Reset the ticket assigned to if ($props->assignedtoid) { if (is_int($props->assignedtoid)) { $username = Users::model()->findByPk($props->assignedtoid); } else { $username = Users::model()->find('username=:username', array(':username' => $props->assignedtoid)); } $props->assignedtoid = $username ? $username->username : ''; } else { $props->assignedtoid = ''; } // Assign keywords if (!$props->keywords && $ticket->keywords) { $props->keywords = $ticket->keywords; } // Assign Title if (!$props->title && $ticket->title) { $props->title = $ticket->title; } // Show the view screen $this->pageTitle[] = Yii::t('tickets', 'Viewing Ticket - {title}', array('{title}' => CHtml::encode($ticket->title))); $this->render('showticket', array('props' => $props, 'ticket' => $ticket, 'comment' => $comment)); } else { $this->redirect(array('/tickets')); } }
function postNote($vars, &$errors, $poster, $alert = true) { global $cfg, $thisstaff; //Who is posting the note - staff or system? $vars['staffId'] = 0; $vars['poster'] = 'SYSTEM'; if ($poster && is_object($poster)) { $vars['staffId'] = $poster->getId(); $vars['poster'] = $poster->getName(); } elseif ($poster) { //string $vars['poster'] = $poster; } if (!$vars['ip_address'] && $_SERVER['REMOTE_ADDR']) { $vars['ip_address'] = $_SERVER['REMOTE_ADDR']; } if (!($note = $this->getThread()->addNote($vars, $errors))) { return null; } $alert = $alert && (isset($vars['flags']) ? !$vars['flags']['bounce'] && !$vars['flags']['auto-reply'] : true); // Get assigned staff just in case the ticket is closed. $assignee = $this->getStaff(); if ($vars['note_status_id'] && ($status = TicketStatus::lookup($vars['note_status_id']))) { if ($this->setStatus($status)) { $this->reload(); } } $activity = $vars['activity'] ?: _S('New Internal Note'); $this->onActivity(array('activity' => $activity, 'threadentry' => $note, 'assignee' => $assignee), $alert); return $note; }
public function getStatusbyfilter() { if (in_array(Yii::app()->session['user_data']['user_role_type'], array(0, 1))) { $result = TicketStatus::model()->findAll("status_id !=6"); } else { if (in_array(Yii::app()->session['user_data']['user_role_type'], array(2, 3))) { $result = TicketStatus::model()->findAllByAttributes(array(), array('condition' => 'status_id >:s_id and status_id !=6', 'params' => array('s_id' => 1))); } else { $result = TicketStatus::model()->findAllByAttributes(array(), array('condition' => 'status_id >:s_id and status_id !=6', 'params' => array('s_id' => 2))); } } return $result; }
<div class="row"> <div class="col-md-12"> <div id="statusChangeMsg"></div> </div> <div class="col-md-4" style="border-right: 1px solid rgb(67, 129, 185);"> <div class="row"> <div class="col-md-12"> <h4 class="text-blue">Change Ticket Status</h4> <hr style="margin: 5px 0px;"> <div class="form-group"> <label class="required" style="margin: 8px 0px;">Ticket Status</label> <?php echo CHtml::dropDownlist('status_id', "", CHtml::listData(TicketStatus::model()->getStatusbyfilter(), 'status_id', 'status_name'), array('class' => 'form-control', 'empty' => 'Please Select Status')); ?> <div id="status_error" class="text-red" style="display: none">Please select ticket status.</div> </div> <div class="form-group"> <label class="required" style="margin: 8px 0px;">Remark <span class="required">*</span></label> <?php echo CHtml::textArea('remark_message', '', array('class' => 'form-control', 'placeholder' => 'Remark (if any)', 'style' => 'resize:none;', 'rows' => 5)); ?> <div id="remark_error" class="text-red" style="display: none">Remark cannot be blank.</div> </div> <div class="form-group"> <?php echo CHtml::submitButton('Save Status', array('class' => 'btn btn-green btn-square', 'id' => 'changebtn')); ?> </div> </div> </div>
</td> <td width="auto" class="flush-right has_bottom_border"> <?php if ($thisstaff->canBanEmails() || $thisstaff->canEditTickets() || $dept && $dept->isManager($thisstaff)) { ?> <span class="action-button pull-right" data-dropdown="#action-dropdown-more"> <i class="icon-caret-down pull-right"></i> <span ><i class="icon-cog"></i> <?php echo __('More'); ?> </span> </span> <?php } // Status change options echo TicketStatus::status_options(); if ($thisstaff->canEditTickets()) { ?> <a class="action-button pull-right" href="tickets.php?id=<?php echo $ticket->getId(); ?> &a=edit"><i class="icon-edit"></i> <?php echo __('Edit'); ?> </a> <?php } if ($ticket->isOpen() && !$ticket->isAssigned() && $thisstaff->canAssignTickets() && $ticket->getDept()->isMember($thisstaff)) { ?> <a id="ticket-claim" class="action-button pull-right confirm-action" href="#claim"><i class="icon-user"></i> <?php echo __('Claim');
/** * table data rules * * @return array */ public function rules() { return array(array('status', 'in', 'range' => CHtml::listData(TicketStatus::model()->findAll(), 'id', 'id')), array('type', 'in', 'range' => CHtml::listData(TicketType::model()->findAll(), 'id', 'id')), array('category', 'in', 'range' => CHtml::listData(TicketCategory::model()->findAll(), 'id', 'id')), array('priority', 'in', 'range' => CHtml::listData(TicketPriority::model()->findAll(), 'id', 'id')), array('version', 'in', 'range' => CHtml::listData(TicketVersion::model()->findAll(), 'id', 'id')), array('fixedin', 'in', 'range' => CHtml::listData(TicketVersion::model()->findAll(), 'id', 'id')), array('assignedtoid', 'safe'), array('keywords', 'safe'), array('title', 'required'), array('title', 'length', 'min' => 3, 'max' => 100)); }
/** * table data rules * * @return array */ public function rules() { return array(array('title, content', 'required'), array('title', 'length', 'min' => 3, 'max' => 100), array('keywords', 'length', 'max' => 100), array('content', 'length', 'min' => 3), array('projectid', 'in', 'range' => array_keys(Projects::model()->getUserProjects(true)), 'allowEmpty' => false, 'on' => 'ticketupdate'), array('ticketstatus', 'in', 'range' => CHtml::listData(TicketStatus::model()->findAll(), 'id', 'id')), array('tickettype', 'in', 'range' => CHtml::listData(TicketType::model()->findAll(), 'id', 'id')), array('ticketcategory', 'in', 'range' => CHtml::listData(TicketCategory::model()->findAll(), 'id', 'id')), array('priority', 'in', 'range' => CHtml::listData(TicketPriority::model()->findAll(), 'id', 'id')), array('ticketversion', 'in', 'range' => CHtml::listData(TicketVersion::model()->findAll(), 'id', 'id')), array('fixedin', 'in', 'range' => CHtml::listData(TicketVersion::model()->findAll(), 'id', 'id')), array('assignedtoid', 'checkAssignedTo')); }
<li class="active"><a href="#ticket-list" data-toggle="tab"><i class="fa fa-list"></i> List of Ticket</a></li> <?php if (in_array(Yii::app()->session['user_data']['user_role_type'], array(0, 1, 2, 3))) { ?> <li class=""><a href="#ticket-report" data-toggle="tab"><i class="fa fa-search"></i> Order Report</a></li> <?php } ?> </ul> <div id="userTabContent" class="tab-content"> <div class="tab-pane fade active in" id="ticket-list"> <div class="row"> <div class="col-md-12"> <div class="table-responsive"> <?php $this->widget('zii.widgets.grid.CGridView', array('id' => 'users-grid', 'htmlOptions' => array('class' => 'dataTables_wrapper', 'role' => 'grid'), 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array(array('header' => 'S. No.', 'name' => 'S. No.', 'value' => '$this->grid->dataProvider->pagination->currentPage * $this->grid->dataProvider->pagination->pageSize + ($row+1)', 'htmlOptions' => array('style' => 'text-align:center'), 'headerHtmlOptions' => array('style' => 'text-align: center;width:60px')), array('name' => 'order_id', 'value' => '$data->order_id', 'htmlOptions' => array('style' => 'text-align:justify;-ms-word-break: break-all;word-break: break-all;'), 'filter' => CHtml::activeTextField($model, 'order_id', array('placeholder' => $model->getAttributeLabel('order_id'), 'style' => '', 'autocomplete' => 'off', 'class' => 'form-control')), 'headerHtmlOptions' => array('style' => 'text-align: center;width:100px')), array('header' => 'Client', 'type' => 'raw', 'headerHtmlOptions' => array('style' => 'text-align:left;'), 'value' => 'Orders::model()->getClientName($data->order_id)', 'htmlOptions' => array('style' => 'text-align:left;'), 'filter' => CHtml::activeTextField($model, 'clientname', array('value' => @$_GET['Ticket']['clientname'], 'placeholder' => $model->getAttributeLabel('clientname'), 'style' => '', 'autocomplete' => 'off', 'class' => 'form-control'))), array('name' => 'ticket_title', 'value' => '$data->ticket_title', 'headerHtmlOptions' => array('style' => 'text-align: center;width:200px'), 'htmlOptions' => array('style' => 'text-align:left;'), 'filter' => CHtml::activeTextField($model, 'ticket_title', array('placeholder' => $model->getAttributeLabel('ticket_title'), 'style' => '', 'autocomplete' => 'off', 'class' => 'form-control'))), array('name' => 'ticket_status', 'type' => 'raw', 'value' => 'TicketStatus::getTicketStatus($data->ticket_status)', 'htmlOptions' => array('style' => 'text-align:center;'), 'headerHtmlOptions' => array('style' => 'text-align: center;width:120px'), 'filter' => CHtml::activeDropDownList($model, 'ticket_status', TicketStatus::getTicketStatus(), array('style' => '', 'class' => 'form-control', 'empty' => 'Select'))), array('header' => 'Read/Unread', 'name' => 'read', 'type' => 'raw', 'value' => '($data->read)?"Read":"Unread"', 'htmlOptions' => array('style' => 'text-align:center;'), 'headerHtmlOptions' => array('style' => 'text-align: center;width:100px'), 'filter' => CHtml::activeDropDownList($model, 'read', array(1 => 'Read', 0 => "Unread"), array('style' => '', 'class' => 'form-control', 'empty' => 'Select'))), array('header' => 'Action', 'class' => 'CButtonColumn', 'deleteConfirmation' => 'Do you want to delete this Ticket Record?', 'afterDelete' => 'function(link,success,data){ if(success) { $("#statusMsg").css("display", "block"); $("#statusMsg").html(data); $("#statusMsg").animate({opacity: 1.0}, 3000).fadeOut("fast");}}', 'headerHtmlOptions' => array('style' => 'text-align: center;width:60px'), 'htmlOptions' => array('style' => 'text-align:center;'), 'template' => '{view}', 'buttons' => array('view' => array('label' => '<i class="fa fa-search"></i>', 'options' => array('title' => 'View Ticket'), 'imageUrl' => FALSE, 'url' => 'Yii::app()->createUrl("ticket/view", array("id" => base64_encode($data->ticket_id)))'), 'delete' => array('label' => '<i class="fa fa-times"></i>', 'options' => array('title' => 'Delete', 'class' => 'remove'), 'imageUrl' => FALSE), 'assign' => array('label' => '<i class="fa fa-mail-forward"></i>', 'options' => array('title' => 'Assign Ticket'), 'imageUrl' => FALSE), 'close' => array('label' => '<i class="fa fa-minus"></i>', 'options' => array('title' => 'Close Ticket'), 'imageUrl' => FALSE)))), 'itemsCssClass' => 'table table-striped table-bordered table-hover dataTable', 'pagerCssClass' => 'dataTables_paginate paging_bootstrap', 'summaryCssClass' => 'dataTables_info', 'template' => '{items}<div class = "row"><div class = "col-xs-6">{summary}</div><div class = "col-xs-6">{pager}</div></div>', 'pager' => array('htmlOptions' => array('class' => 'pagination', 'id' => ''), 'header' => '', 'cssFile' => false, 'selectedPageCssClass' => 'active', 'previousPageCssClass' => 'prev', 'nextPageCssClass' => 'next', 'hiddenPageCssClass' => 'disabled', 'maxButtonCount' => 5), 'emptyText' => '<span class="text-danger text-center">No Record Found!</span>')); ?> </div> </div> </div> </div> <?php if (in_array(Yii::app()->session['user_data']['user_role_type'], array(0, 1, 2, 3))) { ?> <div class="tab-pane " id="ticket-report"> <div class="row"> <div class="col-md-12"> <?php $this->renderPartial('_report', array('model' => $model, 'ticket_id' => $ticket_id));
function setSelectedTicketsStatus($state) { global $thisstaff, $ost; $errors = $info = array(); if (!$thisstaff || !$thisstaff->canManageTickets()) { $errors['err'] = sprintf('%s %s', sprintf(__('You do not have permission %s.'), __('to mass manage tickets')), __('Contact admin for such access')); } elseif (!$_REQUEST['tids'] || !count($_REQUEST['tids'])) { $errors['err'] = sprintf(__('You must select at least %s.'), __('one ticket')); } elseif (!($status = TicketStatus::lookup($_REQUEST['status_id']))) { $errors['status_id'] = sprintf('%s %s', __('Unknown or invalid'), __('status')); } elseif (!$errors) { // Make sure the agent has permission to set the status switch (mb_strtolower($status->getState())) { case 'open': if (!$thisstaff->canCloseTickets() && !$thisstaff->canCreateTickets()) { $errors['err'] = sprintf(__('You do not have permission %s.'), __('to reopen tickets')); } break; case 'closed': if (!$thisstaff->canCloseTickets()) { $errors['err'] = sprintf(__('You do not have permission %s.'), __('to resolve/close tickets')); } break; case 'deleted': if (!$thisstaff->canDeleteTickets()) { $errors['err'] = sprintf(__('You do not have permission %s.'), __('to archive/delete tickets')); } break; default: $errors['err'] = sprintf('%s %s', __('Unknown or invalid'), __('status')); } } $count = count($_REQUEST['tids']); if (!$errors) { $i = 0; $comments = $_REQUEST['comments']; foreach ($_REQUEST['tids'] as $tid) { if (($ticket = Ticket::lookup($tid)) && $ticket->getStatusId() != $status->getId() && $ticket->checkStaffAccess($thisstaff) && $ticket->setStatus($status, $comments)) { $i++; } } if (!$i) { $errors['err'] = sprintf(__('Unable to change status for %s'), _N('the selected ticket', 'any of the selected tickets', $count)); } else { // Assume success if ($i == $count) { if (!strcasecmp($status->getState(), 'deleted')) { $msg = sprintf(__('Successfully deleted %s.'), _N('selected ticket', 'selected tickets', $count)); } else { $msg = sprintf(__('Successfully changed status of %1$s to %2$s'), _N('selected ticket', 'selected tickets', $count), $status->getName()); } $_SESSION['::sysmsgs']['msg'] = $msg; } else { if (!strcasecmp($status->getState(), 'deleted')) { $warn = sprintf(__('Successfully deleted %s.'), sprintf(__('%1$d of %2$d selected tickets'), $i, $count)); } else { $warn = sprintf(__('%1$d of %2$d %3$s status changed to %4$s'), $i, $count, _N('selected ticket', 'selected tickets', $count), $status->getName()); } $_SESSION['::sysmsgs']['warn'] = $warn; } Http::response(201, 'Successfully processed'); } } return self::_changeSelectedTicketsStatus($state, $info, $errors); }
function actionEmailChangeTicketStatus() { $template = Template::getTemplate('ticket_status_changed_mail_template_'); $subject = $template->template_subject; $message = $template->template_content; $results = TicketChangeLog::model()->findAllByAttributes(array(), array('condition' => 'send_mail = :send_mail', 'params' => array('send_mail' => 0))); foreach ($results as $users) { $userdata['user_by'] = Users::model()->getUserName($users->user_id); $userInfo = Users::model()->findByPk($user->fwd_to); $ticket_id = $users->ticket_id; $remark = $users->remark; $userdata['user_by'] = Users::model()->getUserName($users->user_id); $userdata['remark'] = $remark; $userdata['ticket_status_name'] = TicketStatus::model()->getStatusName($users->status_id); $userdata['ticket_id'] = $ticket_id; $userdata['ticket_link'] = Utils::getBaseUrl() . "/ticket/view/" . base64_encode($ticket_id); $assignee = TicketAssign::model()->findAllByAttributes(array(), array('condition' => 'ticket_id = :ticket_id AND fwd_to !=:user_id AND status=1 ', 'params' => array('ticket_id' => $ticket_id, user_id => $users->user_id))); $assigneeby = TicketAssign::model()->findAllByAttributes(array(), array('condition' => 'ticket_id = :ticket_id AND fwd_by !=:user_id AND status=1 ', 'params' => array('ticket_id' => $ticket_id, user_id => $users->user_id), 'group' => "fwd_by")); // For Assignee mail foreach ($assignee as $user) { $userInfo = Users::model()->findByPk($user->fwd_to); $userdata['user_name'] = $userInfo->user_name; $subject = $this->replace($userdata, $subject); $message = $this->replace($userdata, $message); $this->SendMail($userInfo->user_email, $userInfo->user_name, $subject, $message); } // this is fowwarded by foreach ($assigneeby as $user) { $userInfo = Users::model()->findByPk($user->fwd_by); $userdata['user_name'] = $userInfo->user_name; $subject = $this->replace($userdata, $subject); $message = $this->replace($userdata, $message); $this->SendMail($userInfo->user_email, $userInfo->user_name, $subject, $message); } $model = TicketChangeLog::model()->findByPk($users->id); $model->send_mail = 1; $model->update(); } }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return TicketStatus the loaded model * @throws CHttpException */ public function loadModel($id) { $model = TicketStatus::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
/** * table data rules * * @return array */ public function rules() { return array(array('status', 'in', 'range' => CHtml::listData(TicketStatus::model()->findAll(), 'id', 'id')), array('type', 'in', 'range' => CHtml::listData(TicketType::model()->findAll(), 'id', 'id')), array('category', 'in', 'range' => CHtml::listData(TicketCategory::model()->findAll(), 'id', 'id')), array('priority', 'in', 'range' => CHtml::listData(TicketPriority::model()->findAll(), 'id', 'id')), array('version', 'in', 'range' => CHtml::listData(TicketVersion::model()->findAll(), 'id', 'id')), array('fixedin', 'in', 'range' => CHtml::listData(TicketVersion::model()->findAll(), 'id', 'id')), array('assignedtoid', 'checkAssignedTo')); }
echo CHtml::submitButton(Yii::t('global', 'Search'), array('id' => 'searchsubmit')); ?> </div> <div id="suggestions"></div> <?php echo CHtml::endForm(); ?> </li> <li class="widget-container"> <h3><?php echo Yii::t('global', 'Statuses'); ?> </h3> <ul> <?php foreach (TicketStatus::model()->with(array('ticketsCount'))->findAll() as $status) { ?> <li> <?php echo $status->getRssLink(CHtml::image(Yii::app()->themeManager->baseUrl . '/images/atom.gif', 'ATOM'), array('class' => 'atom'), 'atom'); ?> <?php echo $status->getRssLink(CHtml::image(Yii::app()->themeManager->baseUrl . '/images/rss.gif', 'RSS'), array('class' => 'rss')); ?> <?php echo $status->getLink(CHtml::encode($status->title) . ' <small>(' . Yii::app()->format->number($status->ticketsCount) . ')</small>'); ?> </li> <?php } ?>
<?php echo CHtml::error($search, 'keywords'); ?> </p> </fieldset> <fieldset id="ticket-form"> <legend><?php echo Yii::t('tickets', 'Ticket Properties'); ?> </legend> <p id="ticket-status" class='inline-input'> <?php echo CHtml::activeLabel($search, 'status'); ?> <?php echo CHtml::activeListBox($search, 'status', CHtml::listData(TicketStatus::model()->findAll(), 'id', 'title'), array('multiple' => 'multiple')); ?> </p> <p id="ticket-priority" class='inline-input'> <?php echo CHtml::activeLabel($search, 'priority'); ?> <?php echo CHtml::activeListBox($search, 'priority', CHtml::listData(TicketPriority::model()->findAll(), 'id', 'title'), array('multiple' => 'multiple')); ?> </p> <p id="ticket-type" class='inline-input'> <?php echo CHtml::activeLabel($search, 'type'); ?> <?php
public function getStatus() { return $this->hasOne(TicketStatus::className(), array('status_id' => 'status_id')); }
public function actionTicketStatusName() { $ts = $_POST['ticket_status']; $statusName = 'All Tickets'; if ($ts) { $statusName = TicketStatus::model()->getStatusName($ts); } echo $statusName; }
static function __create($ht, &$error = false) { global $ost; $ht['properties'] = JsonDataEncoder::encode($ht['properties']); if ($status = TicketStatus::create($ht)) { $status->save(true); } return $status; }
?> </div> <div class='clearboth'></div> <div class='ticket-moreoptions' id='ticketsMoreOptionsHidden'> <div> <fieldset id="ticket-form"> <legend><?php echo Yii::t('tickets', 'Ticket Properties'); ?> </legend> <p id="ticket-status" class='inline-input'> <?php echo CHtml::activeLabel($moderation, 'status'); ?> <?php echo CHtml::activeDropDownList($moderation, 'status', CHtml::listData(TicketStatus::model()->findAll(), 'id', 'title'), array('prompt' => Yii::t('tickets', '-- Select Status --'))); ?> </p> <p id="ticket-priority" class='inline-input'> <?php echo CHtml::activeLabel($moderation, 'priority'); ?> <?php echo CHtml::activeDropDownList($moderation, 'priority', CHtml::listData(TicketPriority::model()->findAll(), 'id', 'title'), array('prompt' => Yii::t('tickets', '-- Select Priority --'))); ?> </p> <p id="ticket-type" class='inline-input'> <?php echo CHtml::activeLabel($moderation, 'type'); ?> <?php
<style type="text/css"> .ticket_portlet { background: none repeat scroll 0 0 #fff9f3; border: 1px solid #ddd; border-radius: 5px; margin: 10px 0; padding: 10px; } .ticket_icon { margin-top: 25px; text-align: center; color:<?php echo TicketStatus::model()->getTicketColorName($model->ticket_status); ?> ; } .tt li{ margin-bottom: 5px; } th{ width: 200px; } @media (min-width:320px) and (min-width:360px) { .view { padding: 0 !important;
function postNote($vars, &$errors, $poster, $alert = true) { global $cfg, $thisstaff; //Who is posting the note - staff or system? $vars['staffId'] = 0; $vars['poster'] = 'SYSTEM'; if ($poster && is_object($poster)) { $vars['staffId'] = $poster->getId(); $vars['poster'] = $poster->getName(); } elseif ($poster) { //string $vars['poster'] = $poster; } if (!($note = $this->getThread()->addNote($vars, $errors))) { return null; } $alert = $alert && (isset($vars['flags']) ? !$vars['flags']['bounce'] && !$vars['flags']['auto-reply'] : true); // Get assigned staff just in case the ticket is closed. $assignee = $this->getStaff(); if ($vars['note_status_id'] && ($status = TicketStatus::lookup($vars['note_status_id']))) { if ($this->setStatus($status)) { $this->reload(); } } // If alerts are not enabled then return a success. if (!$alert || !$cfg->alertONNewNote() || !($dept = $this->getDept())) { return $note; } if (($email = $dept->getAlertEmail()) && ($tpl = $dept->getTemplate()) && ($msg = $tpl->getNoteAlertMsgTemplate())) { $msg = $this->replaceVars($msg->asArray(), array('note' => $note)); // Alert recipients $recipients = array(); //Last respondent. if ($cfg->alertLastRespondentONNewNote()) { $recipients[] = $this->getLastRespondent(); } // Assigned staff / team if ($cfg->alertAssignedONNewNote()) { if ($assignee && $assignee instanceof Staff) { $recipients[] = $assignee; } if ($team = $this->getTeam()) { $recipients = array_merge($recipients, $team->getMembers()); } } // Dept manager if ($cfg->alertDeptManagerONNewNote() && $dept && $dept->getManagerId()) { $recipients[] = $dept->getManager(); } $options = array('inreplyto' => $note->getEmailMessageId(), 'references' => $note->getEmailReferences(), 'thread' => $note); $isClosed = $this->isClosed(); $sentlist = array(); foreach ($recipients as $k => $staff) { if (!is_object($staff) || !$staff->isAvailable() || isset($sentlist[$staff->getEmail()]) || $note->getStaffId() == $staff->getId() || $isClosed && !$this->checkStaffAccess($staff)) { continue; } $alert = $this->replaceVars($msg, array('recipient' => $staff)); $email->sendAlert($staff->getEmail(), $alert['subj'], $alert['body'], null, $options); $sentlist[$staff->getEmail()] = 1; } } return $note; }