if (module_ticket::can_edit_tickets()) { echo print_select_box(module_faq::get_faq_products_rel(), 'faq_product_id', $ticket['faq_product_id']); _h('Use this to link a ticket to a product. Set products in Settings > FAQ. This allows you to have different FAQ items for different products. Users are shown the FAQ items before submitting a support ticket.'); } else { echo friendly_key(module_faq::get_faq_products_rel(), $ticket['faq_product_id']); } // show a button that does a jquery popup with the list of faq items and an option to create new one. //if(module_faq::can_i('edit','FAQ')){ echo ' '; echo popup_link('<a href="' . module_faq::link_open_list($ticket['faq_product_id']) . '">' . _l('FAQ') . '</a>', array('force' => true, 'width' => 1100, 'height' => 600)); //} })); } if (module_config::c('ticket_support_accounts', 1) && module_ticket::get_accounts_rel()) { $fieldset_data['elements'][] = array('title' => _l('Account'), 'fields' => array(array('type' => module_ticket::can_edit_tickets() ? 'select' : 'html', 'name' => 'ticket_account_id', 'value' => module_ticket::can_edit_tickets() ? $ticket['ticket_account_id'] : friendly_key(module_ticket::get_accounts_rel(), $ticket['ticket_account_id']), 'options' => module_ticket::get_accounts_rel()))); } $fieldset_data['elements'][] = array('title' => _l('Status'), 'fields' => array(array('type' => module_ticket::can_edit_tickets() ? 'select' : 'html', 'name' => 'status_id', 'value' => module_ticket::can_edit_tickets() ? $ticket['status_id'] : friendly_key(module_ticket::get_statuses(), $ticket['status_id']), 'options' => module_ticket::get_statuses()))); if (module_ticket::can_edit_tickets() || module_config::c('ticket_allow_priority_selection', 0)) { $priorities = module_ticket::get_ticket_priorities(); if (!module_ticket::can_edit_tickets() && isset($priorities[_TICKET_PRIORITY_STATUS_ID]) && $ticket['priority'] != _TICKET_PRIORITY_STATUS_ID) { unset($priorities[_TICKET_PRIORITY_STATUS_ID]); } $fieldset_data['elements'][] = array('title' => _l('Priority'), 'fields' => array(array('type' => 'select', 'name' => 'priority', 'value' => $ticket['priority'], 'blank' => false, 'options' => $priorities))); } $fieldset_data['extra_settings'] = array('owner_table' => 'ticket', 'owner_key' => 'ticket_id', 'owner_id' => $ticket['ticket_id'], 'layout' => 'table_row', 'allow_new' => module_extra::can_i('create', 'Tickets'), 'allow_edit' => module_extra::can_i('edit', 'Tickets')); echo module_form::generate_fieldset($fieldset_data); unset($fieldset_data); $done_messages = false; if (class_exists('module_mobile', false)) { if (module_mobile::is_mobile_browser()) { // we're on mobile, display the ticket messages here: $tickets_in_reverse = false;
public static function get_replace_fields($ticket_id, $ticket_data = array()) { if (!$ticket_data) { $ticket_data = module_ticket::get_ticket($ticket_id); } $staff_user_id = $ticket_data['assigned_user_id'] ? $ticket_data['assigned_user_id'] : module_config::c('ticket_default_user_id', 1); $to = module_user::get_user($staff_user_id); //$ticket_data['assigned_user_id']); $ticket_data['staff_name'] = $to['name'] . ' ' . $to['last_name']; $ticket_data['ticket_number'] = module_ticket::ticket_number($ticket_data['ticket_id']); $ticket_contact = module_user::get_user($ticket_data['user_id'], false); $ticket_data['contact_name'] = (isset($ticket_contact['name']) ? $ticket_contact['name'] . ' ' : '') . (isset($ticket_contact['last_name']) ? $ticket_contact['last_name'] : ''); $ticket_data['contact_fname'] = isset($ticket_contact['name']) ? $ticket_contact['name'] : ''; $ticket_data['contact_lname'] = isset($ticket_contact['last_name']) ? $ticket_contact['last_name'] : ''; // addition. find all extra keys for this ticket and add them in. // we also have to find any EMPTY extra fields, and add those in as well. if (class_exists('module_extra', false) && module_extra::is_plugin_enabled()) { $all_extra_fields = module_extra::get_defaults('ticket'); foreach ($all_extra_fields as $e) { $ticket_data[$e['key']] = _l('N/A'); } // and find the ones with values: $extras = module_extra::get_extras(array('owner_table' => 'ticket', 'owner_id' => $ticket_id)); foreach ($extras as $e) { $ticket_data[$e['extra_key']] = $e['extra']; } } if (isset($ticket_data['faq_product_id']) && (int) $ticket_data['faq_product_id'] > 0) { $ticket_data['faq_product'] = friendly_key(module_faq::get_faq_products_rel(), $ticket_data['faq_product_id']); } else { $ticket_data['faq_product'] = _l('N/A'); } // find any extra keys (defined in the db for ticket submission, not the module_extra extra keys) $extras = module_ticket::get_ticket_extras_keys(); if (count($extras)) { foreach ($extras as $extra) { $key = strtolower($extra['key']); if (!isset($ticket_data[$key])) { $ticket_data[$key] = isset($ticket_data['extra_data'][$extra['ticket_data_key_id']]) ? $ticket_data['extra_data'][$extra['ticket_data_key_id']]['value'] : ''; } } } return $ticket_data; }
</td> </tr> <?php } ?> <?php if (module_ticket::can_edit_tickets()) { ?> <tr> <th> <?php _e('Change status %s to:', friendly_key(module_ticket::get_statuses(), $ticket['status_id'])); ?> </th> <td align="left"> <?php $current_status = $ticket['status_id']; //if ( count( $ticket_messages ) ) { if ($ticket_message_count) { if ($current_status <= 2) { //$current_status = 3; // change to replied $current_status = module_config::c('ticket_reply_status_id', _TICKET_STATUS_RESOLVED_ID); // resolved } else { //$current_status = 5; // change to in progress $current_status = module_config::c('ticket_reply_status_id', _TICKET_STATUS_RESOLVED_ID);
} ?> <tr> <th> <?php echo _l('Status'); ?> </th> <td> <?php if (module_ticket::can_edit_tickets()) { echo print_select_box(module_ticket::get_statuses(), 'status_id', $ticket['status_id']); } else { echo friendly_key(module_ticket::get_statuses(), $ticket['status_id']); } ?> </td> </tr> <?php if (module_ticket::can_edit_tickets() || module_config::c('ticket_allow_priority_selection', 0)) { $priorities = module_ticket::get_ticket_priorities(); if (!module_ticket::can_edit_tickets() && isset($priorities[_TICKET_PRIORITY_STATUS_ID]) && $ticket['priority'] != _TICKET_PRIORITY_STATUS_ID) { unset($priorities[_TICKET_PRIORITY_STATUS_ID]); } ?> <tr>