</table> <?php $fieldset_data = array('heading' => array('type' => 'h3', 'main' => true, 'title' => 'Edit Ticket Data Key'), 'elements_before' => ob_get_clean()); echo module_form::generate_fieldset($fieldset_data); unset($fieldset_data); $form_actions = array('class' => 'action_bar action_bar_center action_bar_single', 'elements' => array(array('type' => 'save_button', 'name' => 'butt_save', 'value' => _l('Save')), array('type' => 'delete_button', 'name' => 'butt_del', 'value' => _l('Delete'), 'onclick' => "return confirm('" . _l('Really delete this record?') . "');"))); echo module_form::generate_form_actions($form_actions); ?> </form> <?php } else { print_heading(array('title' => 'Ticket Extra Fields', 'type' => 'h2', 'main' => true, 'button' => array('url' => module_ticket::link_open_field('new'), 'title' => 'Add New Field', 'type' => 'add'))); $ticket_data_keys = module_ticket::get_ticket_extras_keys(); ?> <table width="100%" border="0" cellspacing="0" cellpadding="2" class="tableclass tableclass_rows"> <thead> <tr class="title"> <th><?php echo _l('Ticket Extra Field'); ?> </th> <th><?php echo _l('Name'); ?> </th> <th><?php
<th> <?php echo _l('Your Message'); ?> </th> <td> <textarea rows="10" cols="20" name="new_ticket_message" style="width:90%"><?php echo isset($_POST['new_ticket_message']) ? htmlspecialchars($_POST['new_ticket_message']) : ''; ?> </textarea> </td> </tr> <?php if (module_config::c('ticket_allow_extra_data', 1)) { $extras = module_ticket::get_ticket_extras_keys($ticket_account['ticket_account_id']); if (count($extras)) { ?> <tr> <th> </th> <td> <?php _e('Please fill out as many of the below fields as possible:'); ?> </td> </tr> <?php foreach ($extras as $extra) { ?>
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; }