Esempio n. 1
0
	}
	echo ui_print_success_message (__("Operation successfully completed"), '', true, 'h3', true);
}

// Get names
if ($id_project)
	$project_name = get_db_value ('name', 'tproject', 'id', $id_project);
else
	$project_name = '';

if ($id_task)
	$task = get_db_row ('ttask', 'id', $id_task);

$task_days = $task["hours"] / $config["hours_perday"];
$task_cost = $task['estimated_cost']. $config["currency"];
$prio_array = get_priorities();

$task_participants = get_db_all_rows_sql ("SELECT direccion, nombre_real FROM tusuario, trole_people_task WHERE tusuario.id_usuario = trole_people_task.id_user AND trole_people_task.id_task = $id_task");
$participants ="";
foreach ($task_participants as $participant){
	$participants .= $participant["nombre_real"]. ", ";
}

$title = "[".$config["sitename"]."] Task report - $project_name / ".$task["name"];

$description = sprintf ( "This is a resume of task %s. This report has been sent by Project manager [%s]

------------------------------------------------------------------------------------------------------
Start - End             : %s - %s
Priority                : %s
Estimated length (days) : %d
Esempio n. 2
0
    $disabled_itype = true;
}
if ($disabled_itype || $blocked_incident) {
    $disabled_itype = true;
}
if ($config['required_ticket_type']) {
    $select = '';
} else {
    $select = 'select';
}
$table->data[0][2] .= print_select($types, 'id_incident_type', $id_incident_type, '', $select, '', true, 0, true, false, $disabled_itype);
$disabled = false;
if ($disabled) {
    $table->data[1][0] = print_label(__('Priority'), '', '', true, $priority);
} else {
    $table->data[1][0] = print_select(get_priorities(), 'priority_form', $priority, '', '', '', true, false, false, __('Priority'), $blocked_incident);
}
$table->data[1][0] .= ' ' . print_priority_flag_image($priority, true);
if (!$create_incident) {
    if ($incident["estado"] != STATUS_CLOSED) {
        $table->data[1][1] = "<div id='div_incident_resolution' style='display: none;'>";
    } else {
        $table->data[1][1] = "<div id='div_incident_resolution'>";
    }
    if ($has_im) {
        $table->data[1][1] .= combo_incident_resolution($resolution, $blocked_incident, true);
    } else {
        $table->data[1][1] .= print_label(__('Resolution'), '', '', true, render_resolution($resolution));
        $table->data[1][1] .= print_input_hidden('incident_resolution', $resolution, true);
    }
    $table->data[1][1] .= "</div>";
Esempio n. 3
0
 private function showWorkOrder($message = "")
 {
     $system = System::getInstance();
     $ui = Ui::getInstance();
     $ui->createPage();
     $back_href = "index.php?page=workorders&filter_status=0&filter_owner=" . $system->getConfig('id_user');
     if ($this->id_workorder < 0) {
         $title = __("Workorder");
     } else {
         $title = __("Workorder") . "&nbsp;#" . $this->id_workorder;
     }
     $ui->createDefaultHeader($title, $ui->createHeaderButton(array('icon' => 'back', 'pos' => 'left', 'text' => __('Back'), 'href' => $back_href)));
     $ui->beginContent();
     // Message popup
     if ($message != "") {
         $options = array('popup_id' => 'message_popup', 'popup_content' => $message);
         $ui->addPopup($options);
         $ui->contentAddHtml("<script type=\"text/javascript\">\n\t\t\t\t\t\t\t\t\t\t\$(document).on('pageshow', function() {\n\t\t\t\t\t\t\t\t\t\t\t\$(\"#message_popup\").popup(\"open\");\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t</script>");
     }
     $options = array('id' => 'form-workorder', 'action' => "index.php?page=workorder", 'method' => 'POST');
     $ui->beginForm($options);
     // Title
     $options = array('name' => 'title', 'label' => __('Title'), 'value' => $this->title, 'placeholder' => __('Title'));
     $ui->formAddInputText($options);
     // Assigned user
     $options = array('name' => 'assigned_user', 'id' => 'text-assigned_user', 'label' => __('Assigned user'), 'value' => $this->assigned_user, 'placeholder' => __('Assigned user'), 'autocomplete' => 'off');
     $ui->formAddInputText($options);
     // Assigned user autocompletion
     // List
     $ui->formAddHtml("<ul id=\"ul-autocomplete\" data-role=\"listview\" data-inset=\"true\"></ul>");
     // Autocomplete binding
     $ui->bindMobileAutocomplete("#text-assigned_user", "#ul-autocomplete");
     // Status
     $values = array();
     if (get_db_value("need_external_validation", "ttodo", "id", $this->id_workorder)) {
         $values = wo_status_array(0);
     } else {
         $values = wo_status_array(1);
     }
     $options = array('name' => 'status', 'title' => __('Status'), 'label' => __('Status'), 'items' => $values, 'selected' => $this->status);
     $ui->formAddSelectBox($options);
     // Priority
     $values = array();
     $values = get_priorities();
     $options = array('name' => 'priority', 'title' => __('Priority'), 'label' => __('Priority'), 'items' => $values, 'selected' => $this->priority);
     $ui->formAddSelectBox($options);
     // Category
     $workorders = get_db_all_rows_sql("SELECT id, name FROM two_category ORDER BY name");
     $values = array();
     if ($workorders) {
         foreach ($workorders as $workorder) {
             $values[$workorder[0]] = $workorder[1];
         }
     }
     array_unshift($values, __('Any'));
     $options = array('name' => 'category', 'title' => __('Category'), 'label' => __('Category'), 'items' => $values, 'selected' => $this->category);
     $ui->formAddSelectBox($options);
     // Task
     $sql = "SELECT ttask.id, tproject.name, ttask.name\n\t\t\t\t\t\tFROM ttask, trole_people_task, tproject\n\t\t\t\t\t\tWHERE ttask.id_project = tproject.id\n\t\t\t\t\t\t\tAND tproject.disabled = 0\n\t\t\t\t\t\t\tAND ttask.id = trole_people_task.id_task\n\t\t\t\t\t\t\tAND trole_people_task.id_user = '******'id_user') . "'\n\t\t\t\t\t\tORDER BY tproject.name, ttask.name";
     if (dame_admin($system->getConfig('id_user'))) {
         $sql = "SELECT ttask.id, tproject.name, ttask.name \n\t\t\t\t\t\t\tFROM ttask, tproject\n\t\t\t\t\t\t\tWHERE ttask.id_project = tproject.id\n\t\t\t\t\t\t\t\tAND tproject.disabled = 0\n\t\t\t\t\t\t\tORDER BY tproject.name, ttask.name";
     }
     $tasks = get_db_all_rows_sql($sql);
     $values = array();
     $values[0] = __('N/A');
     if ($tasks) {
         foreach ($tasks as $task) {
             $values[$task[0]] = array('optgroup' => $task[1], 'name' => $task[2]);
         }
     }
     $selected = $this->id_task > 0 ? $this->id_task : 0;
     $options = array('name' => 'id_task', 'title' => __('Task'), 'label' => __('Task'), 'items' => $values, 'selected' => $selected);
     $ui->formAddSelectBox($options);
     // Description
     $options = array('name' => 'description', 'label' => __('Description'), 'value' => $this->description);
     $ui->formAddHtml($ui->getTextarea($options));
     // Hidden operation (insert or update+id)
     if ($this->id_workorder < 0) {
         $options = array('type' => 'hidden', 'name' => 'operation', 'value' => 'insert');
         $ui->formAddInput($options);
         // Submit button
         $options = array('text' => __('Add'), 'data-icon' => 'plus');
         $ui->formAddSubmitButton($options);
     } else {
         $options = array('type' => 'hidden', 'name' => 'operation', 'value' => 'update');
         $ui->formAddInput($options);
         $options = array('type' => 'hidden', 'name' => 'id_workorder', 'value' => $this->id_workorder);
         $ui->formAddInput($options);
         // Submit button
         $options = array('text' => __('Update'), 'data-icon' => 'refresh');
         $ui->formAddSubmitButton($options);
     }
     $ui->endForm();
     $ui->endContent();
     // Foooter buttons
     // Add
     if ($this->id_workorder < 0) {
         $button_add = "<a onClick=\"\$('#form-workorder').submit();\" data-role='button' data-icon='plus'>" . __('Add') . "</a>\n";
     } else {
         $button_add = "<a onClick=\"\$('#form-workorder').submit();\" data-role='button' data-icon='refresh'>" . __('Update') . "</a>\n";
     }
     // Delete
     $workorder_creator = get_db_value("created_by_user", "ttodo", "id", $this->id_workorder);
     if ($this->id_workorder > 0 && (dame_admin($system->getConfig('id_user')) || $system->getConfig('id_user') == $workorder_creator)) {
         $button_delete = "<a href='index.php?page=workorders&operation=delete&id_workorder=" . $this->id_workorder . "\n\t\t\t\t\t\t\t\t\t&filter_status=0&filter_owner=" . $system->getConfig('id_user') . "' data-ajax='false'\n\t\t\t\t\t\t\t\t\tdata-role='button' data-icon='delete'>" . __('Delete') . "</a>\n";
     }
     $ui->createFooter("<div data-type='horizontal' data-role='controlgroup'>{$button_add}" . "{$button_delete}</div>");
     $ui->showFooter();
     $ui->showPage();
 }
$incident_users .= "</table>";
$right_side = print_container('incident_users', __('People') . print_help_tip(_('Click on icons for more details'), true), $incident_users);
// Quick editor
if ($config['enabled_ticket_editor']) {
    $has_im = give_acl($config['id_user'], $id_grupo, "IM") || $config['id_user'] == $incident['id_creator'];
    $has_iw = give_acl($config['id_user'], $id_grupo, "IW") || $config['id_user'] == $incident['id_usuario'] || $config['id_user'] == $incident['id_creator'];
    if ($has_iw) {
        $incident_data = get_incident($id);
        $resolution = $incident_data['resolution'];
        $priority = $incident_data['prioridad'];
        $owner = $incident_data['id_usuario'];
        $status = $incident['estado'];
        $ticket_editor .= "<table style='width: 100%;'>";
        $ticket_editor .= "<tr>";
        $ticket_editor .= "<td>";
        $ticket_editor .= print_select(get_priorities(true), 'priority_editor', $priority, "", '', '', true, false, false, __('Priority'), false, '');
        $ticket_editor .= "</td>";
        $ticket_editor .= "<td>";
        //If IW creator enabled flag is enabled, the user can change the creator
        if ($has_im || $has_iw && $config['iw_creator_enabled']) {
            $src_code = print_image('images/group.png', true, false, true);
            $params_assigned['input_id'] = 'text-owner_editor';
            $params_assigned['input_name'] = 'owner_editor';
            $params_assigned['input_value'] = $owner;
            $params_assigned['title'] = __('Owner');
            $params_assigned['help_message'] = __("User assigned here is user that will be responsible to manage tickets. If you are opening a ticket and want to be resolved by someone different than yourself, please assign to other user");
            $params_assigned['return'] = true;
            $params_assigned['return_help'] = true;
            $ticket_editor .= user_print_autocomplete_input($params_assigned);
        } else {
            $ticket_editor .= print_label(__('Owner'), 'id_user', '', true, '<div id="plain-id_user">' . dame_nombre_real($owner) . '</div>');
Esempio n. 5
0
function form_search_incident($return = false, $filter = false)
{
    include_once "functions_user.php";
    global $config;
    $output = '';
    if (!$filter) {
        $search_string = (string) get_parameter('search_string');
        $status = (int) get_parameter('search_status', -10);
        $priority = (int) get_parameter('search_priority', -1);
        $resolution = (int) get_parameter('search_resolution', -1);
        $id_group = (int) get_parameter('search_id_group');
        $id_inventory = (int) get_parameter('search_id_inventory');
        $id_company = (int) get_parameter('search_id_company');
        $search_id_user = (string) get_parameter('search_id_user');
        $search_id_incident_type = (int) get_parameter('search_id_incident_type');
        $date_from = (int) get_parameter("search_from_date");
        $date_start = (string) get_parameter("search_first_date");
        $date_end = (string) get_parameter("search_last_date");
        $search_creator = (string) get_parameter('search_id_creator');
        $search_editor = (string) get_parameter('search_editor');
        $search_closed_by = (string) get_parameter('search_id_creator');
        $group_by_project = (bool) get_parameter('search_group_by_project');
        $sla_state = (int) get_parameter('search_sla_state', 0);
        $id_task = (int) get_parameter('search_id_task', 0);
        $left_sla = (int) get_parameter('search_left_sla', 0);
        $right_sla = (int) get_parameter('search_right_sla', 0);
        $show_hierarchy = (bool) get_parameter('show_hierarchy');
        $type_fields = incidents_get_type_fields($search_id_incident_type);
        $search_type_field = array();
        foreach ($type_fields as $key => $type_field) {
            $search_type_field[$type_field['id']] = (string) get_parameter('search_type_field_' . $type_field['id']);
        }
    } else {
        $search_string = (string) $filter['string'];
        $priority = (int) $filter['priority'];
        $id_group = (int) $filter['id_group'];
        $status = (int) $filter['status'];
        $resolution = (int) $filter['resolution'];
        $id_company = (int) $filter['id_company'];
        $id_inventory = (int) $filter['id_inventory'];
        $search_id_incident_type = (int) $filter['id_incident_type'];
        $search_id_user = (string) $filter['id_user'];
        $date_from = (int) $filter['from_date'];
        $date_start = (string) $filter['first_date'];
        $date_end = (string) $filter['last_date'];
        $search_creator = (string) $filter['id_creator'];
        $search_editor = (string) $filter['editor'];
        $search_closed_by = (string) $filter['closed_by'];
        $group_by_project = (bool) $filter['group_by_project'];
        $sla_state = (int) $filter['sla_state'];
        $id_task = (int) $filter['id_task'];
        $left_sla = (int) $filter['left_sla'];
        $right_sla = (int) $filter['right_sla'];
        $show_hierarchy = (bool) $filter['show_hierarchy'];
        $type_fields = incidents_get_type_fields($search_id_incident_type);
        $search_type_field = array();
        if ($type_fields) {
            foreach ($type_fields as $key => $type_field) {
                $search_type_field[$type_field['id']] = (string) $filter['type_field_' . $type_field['id']];
            }
        }
    }
    /* No action is set, so the form will be sent to the current page */
    $table = new stdclass();
    $table->width = "99%";
    $table->class = "search-table-button";
    $table->cellspacing = 2;
    $table->cellpadding = 2;
    $table->data = array();
    $table->size = array();
    $table->style = array();
    $table->style[0] = 'width: 25%';
    $table->style[1] = 'width: 25%';
    $table->style[2] = 'width: 25%; vertical-align:text-top;';
    $table->style[3] = 'width: 25%';
    $table->rowstyle = array();
    $table->rowstyle[1] = 'display: none';
    $table->rowstyle[2] = 'display: none';
    $table->rowstyle[3] = 'display: none';
    $table->rowstyle[4] = 'display: none';
    $table->rowstyle[5] = 'display: none';
    $table->rowstyle[6] = 'text-align: right';
    $table->colspan = array();
    $table->colspan[0][0] = 2;
    $table->colspan[6][0] = 4;
    $table->colspan[7][1] = 3;
    $table->rowspan = array();
    $table->rowspan[2][2] = 2;
    $table->data[0][0] = print_input_text('search_string', $search_string, '', 50, 100, true, __('Search string'));
    $available_status = get_indicent_status();
    $available_status[-10] = __("Not closed");
    $table->data[0][1] = print_select($available_status, 'search_status', $status, '', __('Any'), 0, true, false, true, __('Status'));
    $groups = users_get_groups_for_select($config['id_user'], "IW", true, true);
    $table->data[0][2] = print_select($groups, 'search_id_group', $id_group, '', '', '', true, false, false, __('Group'));
    $table->data[0][3] = print_checkbox_extended('search_show_hierarchy', 1, $show_hierarchy, false, '', '', true, __('Show hierarchy'));
    $params_owner = array();
    $params_owner['input_id'] = 'text-search_id_user';
    $params_owner['input_name'] = 'search_id_user';
    $params_owner['input_value'] = $search_id_user;
    $params_owner['title'] = __('Owner');
    $params_owner['return'] = true;
    $table->data[1][0] = user_print_autocomplete_input($params_owner);
    $params_editor = array();
    $params_editor['input_id'] = 'text-search_editor';
    $params_editor['input_name'] = 'search_editor';
    $params_editor['input_value'] = $search_editor;
    $params_editor['title'] = __('Editor');
    $params_editor['return'] = true;
    $table->data[1][1] = user_print_autocomplete_input($params_editor);
    $params_closed_by = array();
    $params_closed_by['input_id'] = 'text-search_closed_by';
    $params_closed_by['input_name'] = 'search_closed_by';
    $params_closed_by['input_value'] = $search_closed_by;
    $params_closed_by['title'] = __('Closed by');
    $params_closed_by['return'] = true;
    $table->data[1][2] = user_print_autocomplete_input($params_closed_by);
    $params_creator = array();
    $params_creator['input_id'] = 'text-search_id_creator';
    $params_creator['input_name'] = 'search_id_creator';
    $params_creator['input_value'] = $search_creator;
    $params_creator['title'] = __('Creator');
    $params_creator['return'] = true;
    $table->data[1][3] = user_print_autocomplete_input($params_creator);
    $table->data[2][0] = print_select(get_priorities(), 'search_priority', $priority, '', __('Any'), -1, true, false, false, __('Priority'), false);
    $table->data[2][1] = print_select(get_incident_resolutions(), 'search_resolution', $resolution, '', __('Any'), -1, true, false, false, __('Resolution'), false);
    $table->data[2][2] = get_last_date_control($date_from, 'search_from_date', __('Date'), $date_start, 'search_first_date', __('Created from'), $date_end, 'search_last_date', __('Created to'));
    $name = $id_inventory ? get_inventory_name($id_inventory) : '';
    $table->data[2][3] = print_input_text('inventory_name', $name, '', 7, 0, true, __('Inventory'), false);
    $table->data[2][3] .= "&nbsp;&nbsp;<a href='javascript: show_search_inventory(\"\",\"\",\"\",\"\",\"\",\"\");'>" . print_image('images/zoom.png', true, array('title' => __('Search inventory'))) . "</a>";
    $table->data[2][3] .= print_input_hidden('id_inventory', $id_inventory, true);
    if (!get_external_user($config["id_user"])) {
        $table->data[4][0] = print_select(get_companies(), 'search_id_company', $id_company, '', __('All'), 0, true, false, false, __('Company'));
    }
    $table->data[4][1] = print_select(get_incident_types(), 'search_id_incident_type', $search_id_incident_type, 'javascript:change_type_fields_table();', __('All'), 0, true, false, false, __('Ticket type'));
    $table->data[4][3] = print_checkbox_extended('search_group_by_project', 1, $group_by_project, false, '', '', true, __('Group by project/task'));
    $sla_states = array();
    $sla_states[1] = __('SLA is fired');
    $sla_states[2] = __('SLA is not fired');
    $table->data[5][0] = print_select($sla_states, 'search_sla_state', $sla_state, '', __('All'), 0, true, false, false, __('SLA'));
    $table->data[5][1] = combo_task_user_participant($config["id_user"], 0, $id_task, true, __("Task"), 'search_id_task');
    $table->data[5][2] = print_input_text('search_left_sla', $left_sla, '', 7, 0, true, __('SLA > (%)'), false);
    $table->data[5][3] = print_input_text('search_right_sla', $right_sla, '', 7, 0, true, __('SLA < (%)'), false);
    $table_type_fields = new stdclass();
    $table_type_fields->width = "100%";
    $table_type_fields->class = "search-table";
    $table_type_fields->data = array();
    //Print custom field data
    $column = 0;
    $row = 0;
    if ($type_fields) {
        foreach ($type_fields as $key => $type_field) {
            $data = $search_type_field[$type_field['id']];
            if ($type_field['type'] == "text" || $type_field['type'] == "textarea") {
                $input = print_input_text('search_type_field_' . $type_field['id'], $data, '', 30, 30, true, $type_field['label']);
            } else {
                if ($type_field['type'] == "combo") {
                    $combo_values = explode(",", $type_field['combo_value']);
                    $values = array();
                    foreach ($combo_values as $value) {
                        $values[$value] = $value;
                    }
                    $input = print_select($values, 'search_type_field_' . $type_field['id'], $data, '', __('Any'), '', true, false, false, $type_field['label']);
                } else {
                    if ($type_field['type'] == "linked") {
                        $linked_values = explode(",", $type_field['linked_value']);
                        $values = array();
                        foreach ($linked_values as $value) {
                            $value_without_parent = preg_replace("/^.*\\|/", "", $value);
                            $values[$value_without_parent] = $value_without_parent;
                            $has_childs = get_db_all_rows_sql("SELECT * FROM tincident_type_field WHERE parent=" . $type_field['id']);
                            if ($has_childs) {
                                $i = 0;
                                foreach ($has_childs as $child) {
                                    if ($i == 0) {
                                        $childs = $child['id'];
                                    } else {
                                        $childs .= ',' . $child['id'];
                                    }
                                    $i++;
                                }
                                $childs = "'" . $childs . "'";
                                $script = 'javascript:change_linked_type_fields_table(' . $childs . ',' . $type_field['id'] . ');';
                            } else {
                                $script = '';
                            }
                        }
                        $input = print_select($values, 'search_type_field_' . $type_field['id'], $data, $script, __('Any'), '', true, false, false, $type_field['label']);
                    }
                }
            }
            $table_type_fields->data[$row][$column] = $input;
            if ($column >= 3) {
                $column = 0;
                $row++;
            } else {
                $column++;
            }
        }
    }
    if ($table_type_fields->data) {
        $table_type_fields_html = print_table($table_type_fields, true);
    }
    $table->data[6][0] = "<div id='table_type_fields'>" . $table_type_fields_html . "</div>";
    $table->data[7][0] = '<div style="width: 100%; text-align: left; height: 20px;"><a class="show_advanced_search" id="show_advanced_search" href="javascript:show_ad_search();">' . __('Advanced search') . '></a></div>';
    //Store serialize filter
    serialize_in_temp($filter, $config["id_user"]);
    $table->data[7][2] = print_submit_button(__('Search'), 'search', false, 'class="sub search"', true);
    $table->data[7][2] .= print_button(__('Export to CSV'), '', false, 'window.open(\'' . 'include/export_csv.php?export_csv_tickets=1' . '\')', 'class="sub csv"', true);
    $table->colspan[7][2] = 4;
    $output .= '<form id="search_incident_form" method="post" action="index.php?sec=incidents&sec2=operation/incidents/incident_search">';
    $output .= print_table($table, true);
    $output .= '</form>';
    echo "<div class= 'dialog ui-dialog-content' id='search_inventory_window'></div>";
    if ($return) {
        return $output;
    }
    echo $output;
}
Esempio n. 6
0
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// LOAD GLOBAL VARS
global $config;
// CHECK LOGIN AND ACLs
check_login();
if (!give_acl($config['id_user'], 0, "IR")) {
    audit_db($config['id_user'], $config["REMOTE_ADDR"], "ACL Violation", "Trying to access ticket viewer");
    require "general/noaccess.php";
    exit;
}
// GET THE FIRST KNOWN GROUP OF THE USER
$user_groups = get_user_groups($config['id_user']);
$group_id = reset(array_keys($user_groups));
// GET PRIORITIES
$priorities = get_priorities();
// GET INCIDENT TYPES
$types = get_incident_types();
echo "<h1>" . __('CREATE TICKET') . "</h1>";
echo "<div id=msg-str></div>";
// NEW INCIDENT FORM
echo "<div id='form_file'>";
$table->width = '98%';
$table->class = 'search-table';
$table->id = "incident-editor";
$table->style = array();
$table->data = array();
$table->colspan = array();
$table->colspan[0][0] = 2;
$table->colspan[2][0] = 2;
$table->data[0][0] = print_input_text('title', '', '', 100, 0, true, __('Title'));
Esempio n. 7
0
		$groups = safe_output(users_get_groups_for_select ($config['id_user'], "SI", false,  true));
	}
	else{
		$groups = safe_output(users_get_groups_for_select ($config['id_user'], "IW", false,  true));
	}
	$groups_selected = explode(', ', $id_group_type);
}

$table->data[0][2] = print_select ($groups, "grupo_form", $id_grupo_incident, '', '', 0, true, false, false, __('Group'), $blocked_incident) . "<div id='group_spinner'></div>";
$disabled = false;

if ($disabled) {
	$table->data[1][0] = print_label (__('Priority'), '', '', true,
		$priority);
} else {
	$table->data[1][0] = print_select (get_priorities (),
		'priority_form', $priority, '', '',
		'', true, false, false, __('Priority'), $blocked_incident);
}

$table->data[1][0] .= '&nbsp;'. print_priority_flag_image ($priority, true);

$table->data[1][1] = combo_incident_status ($estado, $blocked_incident, 0, true, false, '', '', 0);


if ($incident["estado"] != STATUS_CLOSED) {
	$table->data[1][2] = "<div id='div_incident_resolution' style='display: none;'>";
} else {
	$table->data[1][2] = "<div id='div_incident_resolution'>";
}
	
//Store serialize filter
serialize_in_temp($filter, $config["id_user"]);
$resolution = 0;
$parent_name = 0;
$id_parent = 0;

$table = new StdClass();
$table->class = 'search-table-button';
$table->width = '100%';
$table->id = 'incident_massive';
$table->data = array();
$table->style = array ();

$table->data[0][0] = combo_incident_status (-1, 0, 0, true, true);
$table->data[0][1] = print_select (get_priorities (),'mass_priority', -1, '', __('Select'), -1, true, 0, true, __('Priority'), false, 'min-width: 70px;');
$table->data[0][2] = combo_incident_resolution ($resolution, false, true, true);
$table->data[0][3] = print_select_from_sql('SELECT id_usuario, nombre_real FROM tusuario;', 'mass_assigned_user', '0', '', __('Select'), -1, true, false, true, __('Owner'));

//Task
$table->data[1][0] = combo_task_user (0, $config["id_user"], 0, 0, true);
//Groups
$table->data[1][1] =  print_select_from_sql('SELECT id_grupo, nombre FROM tgrupo;', 'mass_groups', '0', '', __('Select'), -1, true, false, true, __('Groups'));

if ($has_im) {
	//Parent ticket
	$table->data[1][2] = print_input_text ('search_parent', $parent_name, '', 10, 100, true, __('Parent ticket'));
	$table->data[1][2] .= print_input_hidden ('id_parent', $id_parent, true);
	$table->data[1][2] .= print_image("images/cross.png", true, array("onclick" => "clean_parent_field()", "style" => "cursor: pointer"));
	//Delete tickets
	$table->data[1][3] = "<b>" . __("Delete all tickets") . "</b>";
Esempio n. 9
0
function form_search_incident($return = false, $filter = false, $ajax = 0)
{
    include_once "functions_user.php";
    global $config;
    $output = '';
    if (!$filter) {
        $inverse_filter = (bool) get_parameter('search_inverse_filter');
        $search_string = (string) get_parameter('search_string');
        $status = (int) get_parameter('search_status', -10);
        $priority = (int) get_parameter('search_priority', -1);
        $resolution = (int) get_parameter('search_resolution', -1);
        $id_group = (int) get_parameter('search_id_group');
        $id_inventory = (int) get_parameter('search_id_inventory');
        $id_company = (int) get_parameter('search_id_company');
        $search_id_user = (string) get_parameter('search_id_user');
        $search_id_incident_type = (int) get_parameter('search_id_incident_type');
        $date_from = (int) get_parameter("search_from_date");
        $date_start = (string) get_parameter("search_first_date");
        $date_end = (string) get_parameter("search_last_date");
        $search_creator = (string) get_parameter('search_id_creator');
        $search_editor = (string) get_parameter('search_editor');
        $search_closed_by = (string) get_parameter('search_closed_by');
        $group_by_project = (bool) get_parameter('search_group_by_project');
        $sla_state = (int) get_parameter('search_sla_state', 0);
        $id_task = (int) get_parameter('search_id_task', 0);
        $left_sla = (int) get_parameter('search_left_sla', 0);
        $right_sla = (int) get_parameter('search_right_sla', 0);
        $show_hierarchy = (bool) get_parameter('search_show_hierarchy');
        $search_medal = get_parameter('search_medals');
        $name = get_parameter('parent_name');
        $type_fields = incidents_get_type_fields($search_id_incident_type);
        $search_type_field = array();
        foreach ($type_fields as $key => $type_field) {
            $search_type_field[$type_field['id']] = (string) get_parameter('search_type_field_' . $type_field['id']);
        }
    } else {
        $inverse_filter = (bool) $filter['inverse_filter'];
        $search_string = (string) $filter['string'];
        $priority = (int) $filter['priority'];
        $id_group = (int) $filter['id_group'];
        $status = (int) $filter['status'];
        $resolution = (int) $filter['resolution'];
        $id_company = (int) $filter['id_company'];
        $id_inventory = (int) $filter['id_inventory'];
        $search_id_incident_type = (int) $filter['id_incident_type'];
        $search_id_user = (string) $filter['id_user'];
        $date_from = (int) $filter['from_date'];
        $date_start = (string) $filter['first_date'];
        $date_end = (string) $filter['last_date'];
        $search_creator = (string) $filter['id_creator'];
        $search_editor = (string) $filter['editor'];
        $search_closed_by = (string) $filter['closed_by'];
        $group_by_project = (bool) $filter['group_by_project'];
        $sla_state = (int) $filter['sla_state'];
        $id_task = (int) $filter['id_task'];
        $left_sla = (int) $filter['left_sla'];
        $right_sla = (int) $filter['right_sla'];
        $show_hierarchy = (bool) $filter['show_hierarchy'];
        $search_medal = (int) $filter['medals'];
        $name = (string) $filter['parent_name'];
        //This is inventory obj name value !!!
        $type_fields = incidents_get_type_fields($search_id_incident_type);
        $search_type_field = array();
        if ($type_fields) {
            foreach ($type_fields as $key => $type_field) {
                $search_type_field[$type_field['id']] = (string) $filter['type_field_' . $type_field['id']];
            }
        }
    }
    /* No action is set, so the form will be sent to the current page */
    $table = new stdclass();
    $table->width = "100%";
    $table->class = "search-table-button";
    $table->data = array();
    // Filter text
    $table->data[0][0] = print_input_text('search_string', $search_string, '', 30, 100, true, __('Text filter'));
    // Status
    $available_status = get_indicent_status();
    $available_status[-10] = __("Not closed");
    $table->data[0][1] = print_select($available_status, 'search_status', $status, '', __('Any'), 0, true, false, true, __('Status'));
    // Groups
    $groups = users_get_groups_for_select($config['id_user'], "IW", true, true);
    $table->data[0][2] = print_select($groups, 'search_id_group', $id_group, '', '', '', true, false, false, __('Group'));
    // Check Box
    $table->data[0][3] = print_checkbox_extended('search_show_hierarchy', 1, $show_hierarchy, false, '', '', true, __('Show hierarchy'));
    $table_advanced = new stdclass();
    $table_advanced->width = "100%";
    $table_advanced->class = "search-table-button";
    $params_owner = array();
    $params_owner['input_id'] = 'text-search_id_user';
    $params_owner['input_name'] = 'search_id_user';
    $params_owner['input_value'] = $search_id_user;
    $params_owner['title'] = __('Owner');
    $params_owner['attributes'] = 'style="width: 210px;"';
    $params_owner['return'] = true;
    $table_advanced->data[1][0] = user_print_autocomplete_input($params_owner);
    $params_editor = array();
    $params_editor['input_id'] = 'text-search_editor';
    $params_editor['input_name'] = 'search_editor';
    $params_editor['input_value'] = $search_editor;
    $params_editor['title'] = __('Editor');
    $params_editor['attributes'] = 'style="width: 210px;"';
    $params_editor['return'] = true;
    $table_advanced->data[1][1] = user_print_autocomplete_input($params_editor);
    $params_closed_by = array();
    $params_closed_by['input_id'] = 'text-search_closed_by';
    $params_closed_by['input_name'] = 'search_closed_by';
    $params_closed_by['input_value'] = $search_closed_by;
    $params_closed_by['title'] = __('Closed by');
    $params_closed_by['attributes'] = 'style="width: 210px;"';
    $params_closed_by['return'] = true;
    $table_advanced->data[1][2] = user_print_autocomplete_input($params_closed_by);
    $params_creator = array();
    $params_creator['input_id'] = 'text-search_id_creator';
    $params_creator['input_name'] = 'search_id_creator';
    $params_creator['input_value'] = $search_creator;
    $params_creator['title'] = __('Creator');
    $params_creator['attributes'] = 'style="width: 210px;"';
    $params_creator['return'] = true;
    $table_advanced->data[1][3] = user_print_autocomplete_input($params_creator);
    $table_advanced->data[2][0] = print_select(get_priorities(), 'search_priority', $priority, '', __('Any'), -1, true, false, false, __('Priority'), false);
    $table_advanced->data[2][1] = print_select(get_incident_resolutions(), 'search_resolution', $resolution, '', __('Any'), -1, true, false, false, __('Resolution'), false);
    //$name = $id_inventory ? get_inventory_name ($id_inventory) : '';
    //Parent name
    $table_advanced->data[2][2] = print_input_text_extended("parent_name", $name, "text-parent_name", '', 20, 0, false, "", "class='inventory_obj_search' style='width:165px !important;'", true, false, __('Inventory object'), false, true);
    $table_advanced->data[2][2] .= "&nbsp;&nbsp;" . print_image("images/add.png", true, array("onclick" => "show_inventory_search('','','','','','','','','','', '', '')", "style" => "cursor: pointer"));
    $table_advanced->data[2][2] .= "&nbsp;&nbsp;" . print_image("images/cross.png", true, array("onclick" => "cleanParentInventory()", "style" => "cursor: pointer"));
    $table_advanced->data[2][2] .= print_input_hidden('id_parent', $id_inventory, true);
    $table_advanced->data[2][3] = get_last_date_control($date_from, 'search_from_date', __('Date'), $date_start, 'search_first_date', __('Created from'), $date_end, 'search_last_date', __('Created to'));
    $table_advanced->rowspan[2][3] = 2;
    $table_advanced->cellstyle[2][3] = "vertical-align:top;";
    if (!get_standalone_user($config["id_user"])) {
        $table_advanced->data[4][0] = print_select(get_companies(), 'search_id_company', $id_company, '', __('Any'), 0, true, false, false, __('Company'));
    }
    $table_advanced->data[4][1] = print_select(get_incident_types(), 'search_id_incident_type', $search_id_incident_type, 'javascript:change_type_fields_table(\'' . __('Custom field') . '\');', __('Any'), 0, true, false, false, __('Ticket type'));
    $table_advanced->data[4][3] = print_checkbox_extended('search_group_by_project', 1, $group_by_project, false, '', '', true, __('Group by project/task'));
    $sla_states = array();
    $sla_states[1] = __('SLA is fired');
    $sla_states[2] = __('SLA is not fired');
    $table_advanced->data[5][0] = print_select($sla_states, 'search_sla_state', $sla_state, '', __('Any'), 0, true, false, false, __('SLA'));
    $table_advanced->data[5][1] = combo_task_user_participant($config["id_user"], 0, $id_task, true, __("Task"), 'search_id_task');
    $table_advanced->data[5][2] = "<div>";
    $table_advanced->data[5][2] .= "<div style='display: inline-block;'>" . print_input_text('search_left_sla', $left_sla, '', 8, 0, true, __('SLA > (%)'), false) . "</div>";
    $table_advanced->data[5][2] .= "&nbsp;<div style='display: inline-block;'>" . print_input_text('search_right_sla', $right_sla, '', 8, 0, true, __('SLA < (%)'), false) . "</div>";
    $table_advanced->data[5][2] .= "</div>";
    $medals = array();
    $medals[1] = __('Gold medals');
    $medals[2] = __('Black medals');
    $table_advanced->data[5][3] = print_select($medals, 'search_medals', $search_medal, '', __('Any'), 0, true, false, false, __('Medals'));
    $table_type_fields = new StdClass();
    $table_type_fields->width = "100%";
    $table_type_fields->class = "search-table";
    $table_type_fields->data = array();
    $table_type_fields->align[0] = 'left';
    //Print custom field data
    $column = 0;
    $row = 0;
    if ($type_fields) {
        foreach ($type_fields as $key => $type_field) {
            $data = $search_type_field[$type_field['id']];
            switch ($type_field['type']) {
                case "text":
                    $input = print_input_text('search_type_field_' . $type_field['id'], $data, '', 30, 30, true, $type_field['label']);
                    break;
                case "combo":
                    $combo_values = explode(",", $type_field['combo_value']);
                    $values = array();
                    foreach ($combo_values as $value) {
                        $values[$value] = $value;
                    }
                    $input = print_select($values, 'search_type_field_' . $type_field['id'], $data, '', __('Any'), '', true, false, false, $type_field['label']);
                    break;
                case "linked":
                    $linked_values = explode(",", $type_field['linked_value']);
                    $values = array();
                    foreach ($linked_values as $value) {
                        $value_without_parent = preg_replace("/^.*\\|/", "", $value);
                        $values[$value_without_parent] = $value_without_parent;
                        $has_childs = get_db_all_rows_sql("SELECT * FROM tincident_type_field WHERE parent=" . $type_field['id']);
                        if ($has_childs) {
                            $i = 0;
                            foreach ($has_childs as $child) {
                                if ($i == 0) {
                                    $childs = $child['id'];
                                } else {
                                    $childs .= ',' . $child['id'];
                                }
                                $i++;
                            }
                            $childs = "'" . $childs . "'";
                            $script = 'javascript:change_linked_type_fields_table(' . $childs . ',' . $type_field['id'] . ');';
                        } else {
                            $script = '';
                        }
                    }
                    $input = print_select($values, 'search_type_field_' . $type_field['id'], $data, $script, __('Any'), '', true, false, false, $type_field['label']);
                    break;
                case "numeric":
                    $input = print_input_number('search_type_field_' . $type_field['id'], $data, 1, 1000000, '', true, $type_field['label']);
                    break;
                case "date":
                    $input = print_input_date('search_type_field_' . $type_field['id'], $data, '', '', '', true, $type_field['label']);
                    break;
                case "textarea":
                    $input = print_input_text('search_type_field_' . $type_field['id'], $data, '', 30, 30, true, $type_field['label']);
                    break;
            }
            $table_type_fields->data[$row][$column] = $input;
            if ($column >= 3) {
                $column = 0;
                $row++;
            } else {
                $column++;
            }
        }
    }
    $table_advanced->colspan[6][0] = 4;
    if ($table_type_fields->data) {
        $table_type_fields_html = print_table($table_type_fields, true);
    }
    if (!isset($table_type_fields_html)) {
        $table_type_fields_html = '';
    }
    $table_advanced->data[6][0] = "<div id='table_type_fields'>" . $table_type_fields_html . "</div>";
    $table->colspan['row_advanced'][0] = 5;
    $table->data['row_advanced'][0] = print_container_div('advanced_parameters_incidents_search', __('Advanced filter'), print_table($table_advanced, true), 'closed', true, true);
    //Store serialize filter
    serialize_in_temp($filter, $config["id_user"]);
    $table->colspan['button'][0] = 2;
    $table->colspan['button'][2] = 2;
    $table->data['button'][0] = '</br>';
    $table->data['button'][2] = print_submit_button(__('Filter'), 'search', false, 'class="sub search"', true);
    $table->data['button'][2] .= print_input_hidden('search_inverse_filter', (int) $inverse_filter, true);
    $table->data['button'][2] .= print_submit_button(__('Inverse filter'), 'submit_inverse_filter', false, 'class="sub search"', true);
    $table->data['button'][2] .= print_button(__('Export to CSV'), '', false, 'window.open(\'' . 'include/export_csv.php?export_csv_tickets=1' . '\')', 'class="sub"', true);
    // Inverse filter info
    $output .= '<div id="inverse_filter_info" style="display: ' . ($inverse_filter ? 'block' : 'none') . ';">';
    $output .= ui_print_message(__('Inverse filter enabled'), 'suc', 'style="display:inline;padding-top: 15px;padding-bottom: 15px;"', true, 'h3', false);
    $output .= print_help_tip(__('The result will be the items which doesn\'t match the filters') . '. ' . __('The select controls with \'Any\' or \'All\' selected will be ignored'), true);
    $output .= '<br /><br />';
    $output .= '</div>';
    if ($ajax) {
        $output .= '<form id="search_incident_form" method="post">';
    } else {
        $output .= '<form id="search_incident_form" method="post" onsubmit="incidents_gift();return false">';
    }
    //~ $output .= '<form id="search_incident_form" method="post">';
    $output .= '<div class="divresult_incidents">' . print_table($table, true) . '</div>';
    $output .= '</form>';
    echo "<div class= 'dialog ui-dialog-content' id='search_inventory_window'></div>";
    // WARNING: Important for the inverse filter feature
    // Change the search_inverse_filter value when the form is submitted using the submit_inverse_filter or the search buttons
    // Show or hide the inverse filter info
    $output .= '<script type="text/javascript">';
    $output .= '$(document).ready(function () {';
    $output .= 'var inverseFilterInfo = document.getElementById("inverse_filter_info");';
    $output .= 'var filterForm = document.getElementById("search_incident_form");';
    $output .= 'var filterBtn = filterForm.elements["search"];';
    $output .= 'var inverseFilterBtn = filterForm.elements["submit_inverse_filter"];';
    $output .= 'var inverseFilter = filterForm.elements["search_inverse_filter"];';
    $output .= '$(filterBtn).click(function (e) {';
    $output .= 'inverseFilter.value = 0;';
    $output .= '$(inverseFilterInfo).hide();';
    $output .= '});';
    $output .= '$(inverseFilterBtn).click(function (e) {';
    $output .= 'inverseFilter.value = 1;';
    $output .= '$(inverseFilterInfo).show();';
    $output .= '});';
    $output .= '});';
    $output .= '</script>';
    if ($return) {
        return $output;
    }
    echo $output;
}
Esempio n. 10
0
function incident_tracking($id_incident, $state, $aditional_data = 0, $user = '')
{
    global $config;
    if ($id_incident == 0) {
        return;
    }
    switch ($state) {
        case INCIDENT_CREATED:
            $description = 'Created';
            break;
        case INCIDENT_UPDATED:
            $description = 'Updated';
            break;
        case INCIDENT_WORKUNIT_ADDED:
            $description = 'Workunit added';
            break;
        case INCIDENT_FILE_ADDED:
            $description = 'File added';
            break;
        case INCIDENT_NOTE_ADDED:
            $description = 'Note added';
            break;
        case INCIDENT_FILE_REMOVED:
            $description = 'File removed';
            break;
        case INCIDENT_PRIORITY_CHANGED:
            $description = 'Priority changed';
            $priorities = get_priorities();
            $description .= " -> " . $priorities[$aditional_data];
            break;
        case INCIDENT_STATUS_CHANGED:
            $description = 'Status changed';
            $description .= " -> " . get_db_value("name", "tincident_status", "id", $aditional_data);
            break;
        case INCIDENT_RESOLUTION_CHANGED:
            $description = 'Resolution changed';
            $description .= " -> " . get_db_value("name", "tincident_resolution", "id", $aditional_data);
            break;
        case INCIDENT_NOTE_DELETED:
            $description = 'Note deleted';
            break;
        case INCIDENT_USER_CHANGED:
            $description = 'Assigned user changed';
            $description .= ' -> ' . get_db_value('nombre_real', 'tusuario', 'id_usuario', $aditional_data);
            break;
        case INCIDENT_DELETED:
            $description = 'Incident deleted';
            break;
        case INCIDENT_CONTACT_ADDED:
            $description = 'Contact added';
            $description .= ' -> ' . get_db_value('fullname', 'tcompany_contact', 'id', $aditional_data);
            break;
        case INCIDENT_INVENTORY_ADDED:
            $description = 'Added inventory object ';
            $description .= " -> " . get_db_value('name', 'tinventory', 'id', $aditional_data);
            break;
        case INCIDENT_GROUP_CHANGED:
            $description = "Group has changed";
            $description .= " -> " . get_db_value("nombre", "tgrupo", "id_grupo", $aditional_data);
            break;
        case INCIDENT_INVENTORY_REMOVED:
            $description = 'Removed inventory object ';
            $description .= " -> " . get_db_value('name', 'tinventory', 'id', $aditional_data);
            break;
        default:
            $description = 'Unknown update';
            break;
    }
    $fecha = print_mysql_timestamp();
    if ($user == '') {
        $user = $config['id_user'];
    }
    audit_db($user, $config["REMOTE_ADDR"], "Ticket updated", $description);
    $sql = sprintf('INSERT INTO tincident_track (id_user, id_incident,
		timestamp, state, id_aditional, description)
		VALUES ("%s", %d, "%s", %d, "%s", "%s")', $user, $id_incident, $fecha, $state, $aditional_data, $description);
    return process_sql($sql, 'insert_id');
}
Esempio n. 11
0
    $table->style = array();
    $table->style[0] = '';
    print_table($table);
    print_table_pager();
    unset($table);
    $table->class = 'result_table listing';
    $table->width = '99%';
    $table->id = 'incident_massive';
    $table->style = array();
    $table->head[0] = print_label(__('Status'), '', '', true);
    $table->head[1] = print_label(__('Priority'), '', '', true);
    $table->head[2] = print_label(__('Resolution'), '', '', true);
    $table->head[3] = print_label(__('Assigned user'), '', '', true);
    echo '<br><h2>&nbsp;' . print_image('images/arrow_ele_blue.png', true) . ' ' . __('Massive operations over selected items') . '</h2>';
    $table->data[0][0] = combo_incident_status(-1, 0, 0, true, true);
    $table->data[0][1] = print_select(get_priorities(), 'mass_priority', -1, '', __('Select'), -1, true);
    $table->data[0][2] = combo_incident_resolution($resolution, $disabled, true, true);
    $table->data[0][3] = print_select_from_sql('SELECT id_usuario, nombre_real FROM tusuario;', 'mass_assigned_user', '0', '', __('Select'), -1, true);
    print_table($table);
    echo "<div style='width:" . $table->width . "'>";
    print_submit_button(__('Update selected items'), 'massive_update', false, 'class="sub next" style="float:right;');
    echo "</div>";
    /* End of first tab container */
    echo '</div>';
    echo '<div id="incident-stats" style="display">TODO STATS</div>';
}
//////
echo '</div>';
/* End of tabs code */
?>
Esempio n. 12
0
    echo "</ul>";
    echo "</div>";
}
$table->width = '100%';
$table->class = 'search-table-button';
$table->rowspan = array();
$table->colspan = array();
$table->style = array();
$table->style[0] = 'vertical-align: top; width: 30%';
$table->style[1] = 'vertical-align: top; width: 30%';
$table->style[2] = 'vertical-align: top; width: 30%';
$table->data = array();
$table->cellspacing = 2;
$table->cellpadding = 2;
$table->data[0][0] = print_input_text('name', $name, '', 60, 240, true, __('Name'));
$table->data[0][1] = print_select(get_priorities(), 'priority', $priority, '', '', '', true, false, false, __('Priority'));
if ($project_permission['manage'] || $operation == "view") {
    $combo_none = __('None');
} else {
    $combo_none = false;
}
$table->data[0][2] = combo_task_user_manager($config['id_user'], $parent, true, __('Parent'), 'parent', $combo_none, false, $id_project, $id_task);
$table->data[1][0] = print_input_text('start_date', $start, '', 15, 15, true, __('Start'));
$table->data[1][1] = print_input_text('end_date', $end, '', 15, 15, true, __('End'));
$table->data[1][2] = print_select(get_periodicities(), 'periodicity', $periodicity, '', __('None'), 'none', true, false, false, __('Recurrence'));
$table->data[2][0] = print_input_text('hours', $hours, '', 5, 5, true, __('Estimated hours'));
$table->data[2][0] .= "&nbsp;&nbsp;<a href='javascript: show_calculation();'>" . print_image('images/play.gif', true, array('title' => __('Calculate hours'))) . "</a>";
$table->data[2][1] = print_input_text('estimated_cost', $estimated_cost, '', 7, 11, true, __('Estimated cost'));
$table->data[2][1] .= ' ' . $config['currency'];
$table->data[2][2] = print_checkbox_extended('count_hours', 1, $count_hours, false, '', '', true, __('Completion based on hours')) . print_help_tip(__("Calculated task completion using workunits inserted by project members, if not it uses Completion field of this form"), true);
$table->data[3][0] = print_input_text('cc', $cc, '', 60, 240, true, __('CC') . print_help_tip(__("Email to notify changes in workunits"), true));
Esempio n. 13
0
 public function getIncidentQuickForm($incident = false, $action = "index.php?page=incident", $method = "POST")
 {
     $system = System::getInstance();
     $ui = Ui::getInstance();
     if (!$incident) {
         $incident = get_db_row("tincidencia", "id_incidencia", $this->id_incident);
     }
     $resolution_text = incidents_get_incident_resolution_text($incident['id_incidencia']);
     $has_im = $system->checkACL("IM");
     $has_iw = $system->checkACL("IW");
     if ($has_iw || $has_im) {
         include_once $system->getConfig('homedir') . "/include/functions_incidents.php";
         $options = array('id' => 'form-quick_update_incident', 'action' => $action, 'method' => $method, 'data-ajax' => 'false');
         $ui->beginForm($options);
         //If IW creator enabled flag is enabled, the user can change the creator
         if ($has_im || $has_iw && $system->getConfig('iw_creator_enabled')) {
             // Filter owner
             $options = array('name' => 'quick_id_owner', 'id' => 'text-id_owner', 'label' => __('Owner'), 'value' => $incident["id_usuario"], 'placeholder' => __('Owner'), 'autocomplete' => 'off');
             $ui->formAddInputText($options);
             // Owner autocompletion
             // List
             $ui->formAddHtml("<ul id=\"ul-autocomplete_owner\" data-role=\"listview\" data-inset=\"true\"></ul>");
             // Autocomplete binding
             $owner_callback = "\$.ajax({\n\t\t\t\t\t\t\t\t\t\ttype: \"POST\",\n\t\t\t\t\t\t\t\t\t\turl: \"../ajax.php\",\n\t\t\t\t\t\t\t\t\t\tdata: \"page=include/ajax/incidents&set_owner=1&id_ticket=\"+ " . $this->id_incident . " +\"&id_user=\" + \$('#text-id_owner').val(),\n\t\t\t\t\t\t\t\t\t\tdataType: \"text\",\n\t\t\t\t\t\t\t\t\t\tsuccess: function (data) {\n\t\t\t\t\t\t\t\t\t\t\tlocation.reload();\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t});";
             $ui->bindMobileAutocomplete("#text-id_owner", "#ul-autocomplete_owner", false, $owner_callback);
         }
         // Priority
         $options = array('name' => 'quick_priority', 'id' => 'select-priority', 'title' => __('Priority'), 'label' => __('Priority'), 'items' => get_priorities(), 'selected' => $incident["prioridad"]);
         $ui->formAddSelectBox($options);
         $ui->formAddHtml("<script type=\"text/javascript\">\n\t\t\t\t\t\t\t\t\$(document).ready(function() {\n\t\t\t\t\t\t\t\t\t\$('#select-priority').change( function() {\n\t\t\t\t\t\t\t\t\t\t\$.ajax({\n\t\t\t\t\t\t\t\t\t\t\ttype: \"POST\",\n\t\t\t\t\t\t\t\t\t\t\turl: \"../ajax.php\",\n\t\t\t\t\t\t\t\t\t\t\tdata: \"page=include/ajax/incidents&set_priority=1&id_ticket=\"+ " . $this->id_incident . " +\"&id_priority=\" + \$(this).val(),\n\t\t\t\t\t\t\t\t\t\t\tdataType: \"text\",\n\t\t\t\t\t\t\t\t\t\t\tsuccess: function (data) {\n\t\t\t\t\t\t\t\t\t\t\t\tlocation.reload();\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t</script>");
         if ($has_im) {
             // Resolution
             $values = array();
             $values[0] = __('None');
             $resolutions = get_incident_resolutions();
             foreach ($resolutions as $key => $value) {
                 $values[$key] = $value;
             }
             $options = array('name' => 'quick_resolution', 'id' => 'select-quick_resolution', 'title' => __('Resolution'), 'label' => __('Resolution'), 'items' => $values, 'selected' => $incident["resolution"]);
             $ui->formAddSelectBox($options);
             $ui->formAddHtml("<script type=\"text/javascript\">\n\t\t\t\t\t\t\t\t\t\$(document).ready(function() {\n\t\t\t\t\t\t\t\t\t\t\$('#select-quick_resolution').change( function() {\n\t\t\t\t\t\t\t\t\t\t\t\$.ajax({\n\t\t\t\t\t\t\t\t\t\t\t\ttype: \"POST\",\n\t\t\t\t\t\t\t\t\t\t\t\turl: \"../ajax.php\",\n\t\t\t\t\t\t\t\t\t\t\t\tdata: \"page=include/ajax/incidents&set_resolution=1&id_ticket=\"+ " . $this->id_incident . " +\"&id_resolution=\" + \$(this).val(),\n\t\t\t\t\t\t\t\t\t\t\t\tdataType: \"text\",\n\t\t\t\t\t\t\t\t\t\t\t\tsuccess: function (data) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tlocation.reload();\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t</script>");
         }
         // Filter status
         $values = array();
         $status_table = process_sql("select * from tincident_status");
         foreach ($status_table as $status) {
             $values[$status['id']] = __($status['name']);
         }
         $options = array('name' => 'quick_status', 'id' => 'select-quick_status', 'title' => __('Status'), 'label' => __('Status'), 'items' => $values, 'selected' => $incident["estado"]);
         $ui->formAddSelectBox($options);
         $ui->formAddHtml("<script type=\"text/javascript\">\n\t\t\t\t\t\t\t\t\$(document).ready(function() {\n\t\t\t\t\t\t\t\t\t\$('#select-quick_status').change( function() {\n\t\t\t\t\t\t\t\t\t\t\$.ajax({\n\t\t\t\t\t\t\t\t\t\t\ttype: \"POST\",\n\t\t\t\t\t\t\t\t\t\t\turl: \"../ajax.php\",\n\t\t\t\t\t\t\t\t\t\t\tdata: \"page=include/ajax/incidents&set_status=1&id_ticket=\"+ " . $this->id_incident . " +\"&id_status=\" + \$(this).val(),\n\t\t\t\t\t\t\t\t\t\t\tdataType: \"text\",\n\t\t\t\t\t\t\t\t\t\t\tsuccess: function (data) {\n\t\t\t\t\t\t\t\t\t\t\t\tlocation.reload();\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t</script>");
         // Hidden operation (update+id)
         $options = array('type' => 'hidden', 'name' => 'operation', 'value' => 'quick_update_incident');
         $ui->formAddInput($options);
         $options = array('type' => 'hidden', 'name' => 'quick_update_type', 'id' => 'quick_update_type', 'value' => '');
         $ui->formAddInput($options);
         $options = array('type' => 'hidden', 'name' => 'quick_update_value', 'id' => 'quick_update_value', 'value' => '');
         $ui->formAddInput($options);
         $options = array('type' => 'hidden', 'name' => 'id_incident', 'value' => $this->id_incident);
         $ui->formAddInput($options);
         return $ui->getEndForm();
     } else {
         return "";
     }
 }
Esempio n. 14
0
$table = new stdClass();
$table->width = '100%';
$table->class = 'search-table-button';
$table->rowspan = array ();
$table->colspan = array ();
$table->style = array ();
$table->style[0] = 'width: 30%';
$table->style[1] = 'width: 30%';
$table->style[2] = 'width: 30%';
$table->data = array ();
$table->cellspacing = 2;
$table->cellpadding = 2;

$table->data[0][0] = print_input_text_extended ('name', $name, '', '', 40, 240, false, '', "style='width:300px;'", true, false, __('Name'));

$table->data[0][1] = print_select (get_priorities (), 'priority', $priority,
	'', '', '', true, false, false, __('Priority'));

if ($project_permission['manage'] || $operation == "view") {
	$combo_none = __('None');
} else {
	$combo_none = false;
}

$table->data[0][2] = combo_task_user_manager ($config['id_user'], $parent, true, __('Parent'), 'parent', $combo_none, false, $id_project, $id_task);

$table->data[1][0] = print_input_text_extended ('cc', $cc, '', '', 40,
			240, false, '', "style='width:300px;'", true, false, 
				__('CC') . print_help_tip (__("Email to notify changes in workunits"), true));
if(!isset($periodicity)){
	$periodicity = "";