/** * Return total cost assigned to task on external costs attached * * $id_task integer ID of task **/ function project_cost_invoices($id_project) { $tasks = get_db_all_rows_sql("SELECT * FROM ttask WHERE id_project = {$id_project}"); if ($tasks === false) { $tasks = array(); } $total = 0; foreach ($tasks as $task) { $total += task_cost_invoices($task["id"]); } return $total; }
echo "</ul>"; return; } //Branch with items $new = true; $count = 0; $clause = ""; if ($cont) { foreach ($cont as $c) { $clause .= $c["id"] . ","; } $clause = substr($clause, 0, -1); $clause = " AND tinventory.id IN ({$clause})"; } $sql = "SELECT DISTINCT(tinventory.id_object_type), tobject_type.* FROM tinventory, tobject_type \n\t\t\t\tWHERE tinventory.id_object_type = tobject_type.id" . $clause . " ORDER BY tobject_type.name ASC"; $cont = get_db_all_rows_sql($sql); // Add no object type $last_key = count($cont); $cont[$last_key]['name'] = __('No object type'); $cont[$last_key]['icon'] = "box.png"; $cont[$last_key]['id'] = 0; echo "<ul style='margin: 0; padding: 0;'>\n"; $cont_size = count($cont); $end = 1; foreach ($cont as $row) { if ($row != end($cont)) { $end = 0; } $aux_ref_tree = $ref_tree . "" . $count; $new = false; $count++;
} // 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 Estimated cost : %s Current progress : %d %%
$sql_search_pagination = 'SELECT '.$pr.' FROM tinventory i, tobject_field_data t, tobject_type_field o where t.id_object_type_field= o.id and i.id = t.id_inventory'; $sql_search_count = 'SELECT i.id, i.name FROM tinventory i, tobject_field_data t, tobject_type_field o where t.id_object_type_field= o.id and i.id = t.id_inventory'; } else { $sql_search = 'SELECT '.$pr.' FROM tinventory i WHERE 1=1'; $sql_search_pagination = 'SELECT '.$pr.' FROM tinventory i WHERE 1=1'; $sql_search_count = 'SELECT i.id, i.name FROM tinventory i WHERE 1=1'; } if ($id_object_type != -1) { $sql_search .= " AND i.id_object_type = $id_object_type"; $sql_search_pagination .= " AND i.id_object_type = $id_object_type"; $sql_search_count .= " AND i.id_object_type = $id_object_type"; //for object fields $sql_object_fields_custom = 'select label, id from tobject_type_field where show_list=1 and id_object_type='.$id_object_type; $object_fields_custom = get_db_all_rows_sql($sql_object_fields_custom); //id_type_object $params['object_fields_custom'] = $object_fields_custom; } //search word in the inventory only name, description,id,status and custom fields if(isset($params_array['search_free']) && $params_array['search_free'] != ''){ $search_free = $params_array['search_free']; } else { $search_free = (string)get_parameter ('search_free', ''); } if ($id_object_type != -1 && !empty($object_fields) && $search_free != '') { $params['search_free']= $search_free; $string_fields_object_types == ''; $string_fields_types == '';
$table->data[15][0] = print_checkbox("active_validate", 1, $config["active_validate"], true, __('Activate email validation')); $table->data[16][1] = "<h4>" . __("Mail general texts") . "</h4>"; $table->colspan[17][0] = 3; $table->colspan[18][0] = 3; $table->colspan[19][0] = 3; $table->data[17][0] = print_textarea("header_email", 5, 40, $config["HEADER_EMAIL"], '', true, __('Email header')); $table->data[18][0] = print_textarea("footer_email", 5, 40, $config["FOOTER_EMAIL"], '', true, __('Email footer')); $table->data[19][1] = "<h4>" . __("Mail queue control"); $total_pending = get_db_sql("SELECT COUNT(*) from tpending_mail"); $table->data[19][1] .= " : " . $total_pending . " " . __("mails in queue") . "</h4>"; if ($total_pending > 0) { $table->colspan[20][0] = 3; $mail_queue = "<div style='height: 250px; overflow-y: auto;'>"; $mail_queue .= "<table width=100% class=listing>"; $mail_queue .= "<tr><th>" . __("Date") . "<th>" . __("Recipient") . "<th>" . __("Subject") . "<th>" . __("Attempts") . "<th>" . __("Status") . "</tr>"; $mails = get_db_all_rows_sql("SELECT * FROM tpending_mail LIMIT 1000"); foreach ($mails as $mail) { $mail_queue .= "<tr>"; $mail_queue .= "<td style='font-size: 9px;'>"; $mail_queue .= $mail["date"]; $mail_queue .= "<td>"; $mail_queue .= $mail["recipient"]; $mail_queue .= "<td style='font-size: 9px;'>"; $mail_queue .= $mail["subject"]; $mail_queue .= "<td>"; $mail_queue .= $mail["attempts"]; if ($mail["status"] == 1) { $mail_queue .= "<td>" . __("Bad mail"); } else { $mail_queue .= "<td>" . __("Pending"); }
$report = get_db_row ('tinventory_reports', 'id', $id); if ($report === false) return; ini_set ("memory_limit", "3072M"); ini_set ("max_execution_time", 600); echo "<h2>".__('Custom report')."</h2>"; echo "<h4>".$report['name']; echo "<div id='button-bar-title'><ul>"; echo "<li><a href='index.php?sec=projects&sec2=operation/inventories/inventory_reports'>".print_image ("images/flecha_volver.png", true, array("title" => __("Back to Report")))."</a></li>"; echo "</ul></div>"; echo "</h4>"; $config['mysql_result_type'] = MYSQL_ASSOC; $rows = get_db_all_rows_sql (clean_output ($report['sql'])); if ($rows === false) return; //count $row chunk $row_chunk_cont = count(array_chunk($rows[0], 10)); //keys $row chunk $row_chunk_keys = array_chunk(array_keys($rows[0]), 10); $table = array(); for($i=0; $i < $row_chunk_cont; $i++){ $table[$i][] = $row_chunk_keys[$i]; foreach ($rows as $row) { $row_chunk = array_chunk($row, 10); $table[$i][] = $row_chunk[$i];
$search_by_status .= "<td>"; $search_by_status .= "<a href='index.php?sec=incidents&sec2=operation/incidents/incident_search&search_first_date=" . $first_start . "&search_status=".$status["id"]."'>"; $search_by_status .= __($status["name"])." (".count($incidents).")"; $search_by_status .= "</a>"; $search_by_status .= "</td>"; if ($key % 2 != 0) { $search_by_status .= "</tr>"; } } $search_by_status .= "</table>"; $right_side = print_container('incident_search_by_status', __('Search by status'), $search_by_status); $rows = get_db_all_rows_sql ("SELECT id, name FROM tincident_type ORDER BY name ASC"); $search_by_type = "<table>"; if (!$rows) { $search_by_type .="<tr>"; $search_by_type .="<td>"; $search_by_type .="<em>".__("There aren't ticket types defined")."</em>"; $search_by_type .="</td>"; $search_by_type .="</tr>"; } else { $count = 0; $rows = get_incident_types();
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") . " #" . $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(); }
$where_clause .= sprintf('AND name LIKE "%%%s%%"', $search_text); } $table->width = '90%'; $table->class = 'search-table'; $table->style = array(); $table->style[0] = 'font-weight: bold;'; $table->style[2] = 'font-weight: bold;'; $table->data = array(); $table->data[0][0] = __('Search'); $table->data[0][1] = print_input_text("search_text", $search_text, "", 25, 100, true); $table->data[0][4] = print_submit_button(__('Search'), "search_btn", false, 'class="sub search"', true); echo '<form method="post" action="">'; print_table($table); echo '</form>'; $sql = "SELECT * FROM tnewsletter {$where_clause} ORDER BY name"; $newsletters = get_db_all_rows_sql($sql); $newsletters = print_array_pagination($newsletters, "index.php?sec=customers&sec2=operation/newsletter/operation/newsletter/newsletter_definition&search_text='{$search_text}"); if ($newsletters !== false) { $table->width = "90%"; $table->class = "listing"; $table->data = array(); $table->style = array(); $table->style[0] = 'font-weight: bold; font-size: 14px'; $table->style[1] = 'font-weight: bold'; $table->colspan = array(); $table->head[0] = __('ID'); $table->head[1] = __('Name'); $table->head[2] = __('Total addresses'); $table->head[3] = __('Subscribe Link'); $table->head[4] = __('Unsubscribe Link'); $table->head[5] = __('Validated addr.');
INNER JOIN ( SELECT twi.id_workunit, ti.id_incidencia, ti.titulo, tis.name AS estado FROM tworkunit_incident twi INNER JOIN tincidencia ti ON twi.id_incident = ti.id_incidencia AND ti.id_task = %d INNER JOIN tincident_status tis ON ti.estado = tis.id ) twin ON tw2.id = twin.id_workunit ) final ORDER BY final.id_user, final.timestamp', $task['id'], $task['id']); $all_wu = get_db_all_rows_sql($sql); if (!empty($all_wu)) { $table_wu = new StdClass(); $table_wu->width = '100%'; $table_wu->class = 'listing'; $table_wu->head = array(); $table_wu->head['person'] = __('Person'); $table_wu->head['date'] = __('Date'); $table_wu->head['duration'] = __('Duration (' . __('In hours') . ')'); $table_wu->head['ticket_id'] = __('Ticket id'); $table_wu->head['ticket_title'] = __('Ticket title'); $table_wu->head['ticket_status'] = __('Ticket status'); if (!$pdf_output) { $table_wu->head['content'] = __('Content'); } $table_wu->style = array();
$select = ''; } else { $select = 'select'; } if (give_acl ($config['id_user'], $id_grupo, "IW") || give_acl ($config['id_user'], $id_grupo, "SI") || (get_standalone_user($config["id_user"]))) { $table->data[0][1] .= print_select($types, 'id_incident_type', $id_incident_type, '', $select, '', true, 0, true, false, $disabled_itype); } else if (give_acl ($config['id_user'], $id_grupo, "SI")){ $group_escalate_sql = 'select g.nombre from tusuario_perfil u, tgrupo g where g.id_grupo=u.id_grupo and u.id_usuario = "'.$config['id_user'].'"'; $group_escalate_p = get_db_all_rows_sql($group_escalate_sql); foreach ($group_escalate_p as $v) { $group_escalate .= $v['nombre']. '|'; } $group_escalate = rtrim($group_escalate, "|"); $types_escalate_sql = 'select id, name from tincident_type where id_group REGEXP "'.$group_escalate.'"'; $types_escalate_s = get_db_all_rows_sql($types_escalate_sql); $types_escalate = array(); foreach ($types_escalate_s as $v) { $types_escalate[$v['id']] = $v['name']; } $table->data[0][1] .= print_select($types_escalate, 'id_incident_type', $id_incident_type, '', $select, '', true, 0, true, false, $disabled_itype); } $id_group_type = safe_output(get_db_value("id_group", "tincident_type", "id", $id_incident_type)); if($id_group_type != "" && $id_group_type != "0"){ if(give_acl ($config['id_user'], $id_grupo, "SI")){ $groups_all = safe_output(users_get_groups_for_select ($config['id_user'], "SI", false, true)); } else{ $groups_all = safe_output(users_get_groups_for_select ($config['id_user'], "IW", false, true)); }
function api_ovo_manager($return_type, $params) { $values[0] = $params[0]; //title $values[1] = $params[1]; //id group $values[2] = $params[2]; //priority $values[3] = $params[3]; //description $values[4] = $params[4]; //id inventory $values[5] = $params[5]; //id incident type $values[6] = ''; //email $values[7] = ''; //owner $values[8] = 0; //id parent $values[9] = 1; //status $values[10] = $params[6]; //info extra $prioridad = $params[2]; $descripcion = $params[3]; $extra_data = $params[6]; $msg_group = $params[7]; //~ $sql = "SELECT * FROM tincidencia WHERE extra_data = '".$extra_data."' AND estado <> 7"; $sql = "SELECT * FROM tincidencia WHERE extra_data = '" . $extra_data . "'"; $incidents = get_db_all_rows_sql($sql); if ($incidents == false) { if ($prioridad == 2 || $prioridad == 3 || $prioridad == 4) { //minor, major o critical $values[1] = 11; //grupo M112 GM24. Hay que ponerlo a mano $new_id = api_create_incident('int', 'ovo', $values); $values_update[0] = $new_id; $values_update[1] = $params[0]; //title $values_update[2] = $params[3]; //description $values_update[3] = ""; //epilog $values_update[4] = 11; //group $values_update[5] = $params[2]; //prority $values_update[7] = 3; //estado asignado $values_update[8] = ""; //owner $values_update[9] = 0; //id parent $values_update[10] = $params[5]; //id incident type $values_update[11] = $params[6]; //info extra api_update_incident($return_type, 'ovo', $values_update); } } else { foreach ($incidents as $incident) { switch ($incident['estado']) { case 7: //cerrada if ($incident['resolution'] == 1 || $incident['resolution'] == 2) { //resolución arreglado o no válido if ($prioridad == 2 || $prioridad == 3 || $prioridad == 4) { //minor, major o critical $values[1] = 11; //grupo M112 GM24. Hay que ponerlo a mano $new_id = api_create_incident('int', 'ovo', $values); $values_update[0] = $new_id; $values_update[1] = $params[0]; //title $values_update[2] = $params[3]; //description $values_update[3] = ""; //epilog $values_update[4] = 11; //group $values_update[5] = $params[2]; $values_update[7] = 3; //estado asignado $values_update[8] = ""; //owner $values_update[9] = 0; //id parent $values_update[10] = $params[5]; //id incident type $values_update[11] = $params[6]; //info extra api_update_incident($return_type, 'ovo', $values_update); } } else { if ($incident['resolution'] == 9) { if ($prioridad == 2 || $prioridad == 3 || $prioridad == 4) { //minor, major o critical //update ticket $values_update[0] = $incident['id_incidencia']; $values_update[1] = $incident['titulo']; //title $values_update[2] = $incident['descripcion']; //description $values_update[3] = $incident['epilog']; //epilog $values_update[4] = $incident['id_grupo']; //id grupo if ($prioridad > $incident['prioridad']) { $values_update[5] = $prioridad; } else { $values_update[5] = $incident['prioridad']; } $values_update[6] = 9; //in process $values_update[7] = 4; //re opened $values_update[8] = $incident['id_usuario']; //owner $values_update[9] = $incident['id_parent']; //id parent $values_update[10] = $incident['id_incident_type']; //id incident type $values_update[11] = $incident['extra_data']; //info extra api_update_incident($return_type, 'ovo', $values_update); //add wu $workunit[0] = $incident['id_incidencia']; // id ticket $workunit[1] = $descripcion; // descripcion $workunit[2] = 0; // duracion $workunit[3] = 0; // coste $workunit[4] = 1; // publico $workunit[5] = 2; // perfil api_create_incident_workunit($return_type, 'ovo', $workunit); } } } break; default: if ($prioridad == 2 || $prioridad == 3 || $prioridad == 4) { //minor, major o critical //update ticket $values_update[0] = $incident['id_incidencia']; $values_update[1] = $incident['titulo']; //title $values_update[2] = $incident['descripcion']; //description $values_update[3] = $incident['epilog']; //epilog $values_update[4] = $incident['id_grupo']; //id grupo if ($prioridad > $incident['prioridad']) { $values_update[5] = $prioridad; } else { $values_update[5] = $incident['prioridad']; } $values_update[6] = $incident['resolution']; //resolution $values_update[7] = $incident['estado']; //status $values_update[8] = $incident['id_usuario']; //owner $values_update[9] = $incident['id_parent']; //id parent $values_update[10] = $incident['id_incident_type']; //id incident type $values_update[11] = $incident['extra_data']; //info extra api_update_incident($return_type, 'ovo', $values_update); //add wu $workunit[0] = $incident['id_incidencia']; // id ticket $workunit[1] = $descripcion; // descripcion $workunit[2] = 0; // duracion $workunit[3] = 0; // coste $workunit[4] = 1; // publico $workunit[5] = 2; // perfil api_create_incident_workunit($return_type, 'ovo', $workunit); } //~ if ($prioridad == 0) { //normal if ($prioridad != 2 && $prioridad != 3 && $prioridad != 4) { //normal if ($msg_group == "AutoResolved") { //update ticket $values_update[0] = $incident['id_incidencia']; $values_update[1] = $incident['titulo']; //title $values_update[2] = $incident['descripcion']; //description $values_update[3] = $incident['epilog']; //epilog $values_update[4] = $incident['id_grupo']; //id grupo $values_update[5] = $incident['prioridad']; //priority $values_update[6] = 9; //in process $values_update[7] = 7; //closed $values_update[8] = $incident['id_usuario']; //owner $values_update[9] = $incident['id_parent']; //id parent $values_update[10] = $incident['id_incident_type']; //id incident type $values_update[11] = $incident['extra_data']; //info extra api_update_incident($return_type, 'ovo', $values_update); //add wu $workunit[0] = $incident['id_incidencia']; // id ticket $workunit[1] = $descripcion; // descripcion $workunit[2] = 0; // duracion $workunit[3] = 0; // coste $workunit[4] = 1; // publico $workunit[5] = 2; // perfil api_create_incident_workunit($return_type, 'ovo', $workunit); } else { //add wu $workunit[0] = $incident['id_incidencia']; // id ticket $workunit[1] = $descripcion; // descripcion $workunit[2] = 0; // duracion $workunit[3] = 0; // coste $workunit[4] = 1; // publico $workunit[5] = 2; // perfil api_create_incident_workunit($return_type, 'ovo', $workunit); } } break; } } } echo $result; return; }
else $labour .= __("N/A"); $labour .= "</td></tr>"; $labour .= "<tr>"; $labour .= '<td>'.__('Proyect length deviation (days)').'</td><td>'; $labour .= abs($deviation/8). " ".__('Days'); $labour .= "</td></tr>"; // People involved //Get users with tasks $sql = sprintf("SELECT DISTINCT id_user FROM trole_people_task, ttask WHERE ttask.id_project= %d AND ttask.id = trole_people_task.id_task", $id_project); $users_aux = get_db_all_rows_sql($sql); if(empty($users_aux)) { $users_aux = array(); } foreach ($users_aux as $ua) { $users_involved[] = $ua['id_user']; } //Delete duplicated items if (empty($users_involved)) { $users_involved = array(); } else { $users_involved = array_unique($users_involved);
if ($id_task == 0){ if ($timestamp_l != "" && $timestamp_h != "") $sql= "SELECT * FROM tworkunit WHERE tworkunit.id_user = '******' AND timestamp >= '$timestamp_l' AND timestamp <= '$timestamp_h' ORDER BY timestamp DESC"; else $sql= "SELECT * FROM tworkunit WHERE tworkunit.id_user = '******' ORDER BY timestamp DESC"; } else { if ($timestamp_l != "" && $timestamp_h != "") $sql= "SELECT * FROM tworkunit, tworkunit_task WHERE tworkunit.id_user = '******' AND timestamp >= '$timestamp_l' AND timestamp <= '$timestamp_h' AND tworkunit_task.id_task = $id_task AND tworkunit_task.id_workunit = tworkunit.id ORDER BY timestamp DESC"; else $sql= "SELECT * FROM tworkunit, tworkunit_task WHERE tworkunit.id_user = '******' AND tworkunit_task.id_task = $id_task AND tworkunit_task.id_workunit = tworkunit.id ORDER BY timestamp DESC"; } } $sql = safe_output ($sql); $alldata = get_db_all_rows_sql ($sql); foreach ($alldata as $row){ if ($row["id"] != -1) show_workunit_user ($row['id'], 1, true, true, $id_user, $timestamp_h, $timestamp_l); else show_workunit_user ($row['id'], 0, true, true, $id_user, $timestamp_h, $timestamp_l); } echo '<div id="show_multiple_edit">'; echo '<h2>'.__('Massive operations over selected items').'</h2>'; $table = new StdClass; $table->class = 'search-table-button'; $table->width = '100%';
echo '<form id="form-template_manager" method="post" action="index.php?sec=leads&sec2=operation/leads/template_manager">'; print_table($table); echo '</form>'; } // ------------------------- // LIST OF CRM TEMPLATES // ------------------------- if ($operation == "") { echo "<h1>" . __('CRM Template management') . "</h1>"; //TODO: Show only my companies templates or my "child" companies tempaltes (and all if I'm admin) if (dame_admin($config["id_user"])) { $sql = sprintf('SELECT * FROM tcrm_template'); } else { $sql = sprintf('SELECT * FROM tcrm_template'); } $todos = get_db_all_rows_sql($sql); if ($todos === false) { $todos = array(); } echo '<table class="listing" width="99%">'; echo "<th>" . __('Name'); echo "<th>" . __('Language'); echo "<th>" . __('Company'); echo "<th>" . __('Operations'); foreach ($todos as $todo) { echo "<tr><td valign=top>"; echo '<a href="index.php?sec=customers&sec2=operation/leads/template_manager&operation=edit&id=' . $todo["id"] . '">'; echo "<b>" . $todo["name"] . "</b></a>"; echo "<td valign=top>"; echo "<b>" . $todo["id_language"] . "</b>"; echo "<td valign=top>";
if ($search_text != "") { $where_clause .= sprintf('WHERE name LIKE "%%%s%%"', $search_text); } $table->width = '400px'; $table->class = 'search-table'; $table->style = array(); $table->style[0] = 'font-weight: bold;'; $table->data = array(); $table->data[0][0] = __('Search'); $table->data[0][1] = print_input_text("search_text", $search_text, "", 25, 100, true); $table->data[0][2] = print_submit_button(__('Search'), "search_btn", false, 'class="sub search"', true); echo '<form method="post" action="index.php?sec=inventory&sec2=operation/types/type_detail">'; print_table($table); echo '</form>'; $sql = "SELECT * FROM tbuilding {$where_clause} ORDER BY name"; $buildings = get_db_all_rows_sql($sql); if ($buildings !== false) { $table->width = '90%'; $table->class = 'listing'; $table->data = array(); $table->size = array(); $table->size[2] = '40px'; $table->style = array(); $table->style[0] = 'font-weight: bold'; $table->head[0] = __('Name'); $table->head[1] = __('Description'); $table->head[2] = __('Delete'); foreach ($buildings as $building) { $data = array(); $data[0] = '<a href=index.php?sec=inventory&sec2=operation/buildings/building_detail&id=' . $building['id'] . '">' . $building['name'] . '</a>'; $data[1] = substr($building['description'], 0, 50) . "...";
echo print_button (__('Upload a new file'), 'add_link', false, '$(\'#upload_div\').slideToggle (); return false', 'class="sub upload"'); echo '<div id="upload_div" style="display: none;" class="">'; $target_directory = 'attachment'; $action = "index.php?sec=customers&sec2=operation/leads/lead_detail&id=$id&op=files&upload=1"; $into_form = "<input type='hidden' name='directory' value='$target_directory'><b>Description</b> <input type=text name=description size=20>"; print_input_file_progress($action,$into_form,'','sub upload'); echo '</td>'; echo '</tr>'; echo '</table>'; echo '</div>'; // List of lead attachments $sql = "SELECT * FROM tattachment WHERE id_lead = $id ORDER BY timestamp DESC"; $files = get_db_all_rows_sql ($sql); echo "<div style='width: 86%; float: right;'>"; echo "<div class='divresult'>"; if ($files !== false) { $files = print_array_pagination ($files, "index.php?sec=customers&sec2=operation/leads/lead_detail&id=$id&op=files"); unset ($table); $table->width = "100%"; $table->class = "listing"; $table->data = array (); $table->size = array (); $table->style = array (); $table->rowstyle = array (); $table->head = array (); $table->head[0] = __('Filename');
// Get the roles assigned to user in the project of a given task if ($get_task_roles) { $id_user = get_parameter ('id_user'); $id_task = get_parameter ('id_task'); $id_project = get_db_value('id_project','ttask','id',$id_task); // If the user is Project Manager, all the roles are retrieved. // If not, only the assigned roles if(give_acl($id_user, 0, "PM")) { $roles = get_db_all_rows_filter('trole',array(),'id, name'); } else { $roles = get_db_all_rows_sql('SELECT trole.id, trole.name FROM trole, trole_people_project WHERE id_role = trole.id AND id_user = "******" AND id_project = '.$id_project); } echo json_encode($roles); return; } if (get_parameter("get_new_mult_wu")) { $number = get_parameter ("next"); $date = get_parameter("given_date"); create_new_table_multiworkunit($number, $date); return; } }
function graph_workorder_num($width, $height, $type = "owner", $where_clause = "WHERE 1=1", $max = 5, $ttl = 1) { global $config; $data = array(); if ($type == "submitter") { $sql = "SELECT COUNT(id), created_by_user FROM ttodo {$where_clause} GROUP BY created_by_user ORDER BY 1 DESC, 2"; } else { $sql = "SELECT COUNT(id), assigned_user FROM ttodo {$where_clause} GROUP BY assigned_user ORDER BY 1 DESC, 2"; } $wos = get_db_all_rows_sql($sql); $data = NULL; $count = 0; if ($wos !== false) { foreach ($wos as $wo) { if ($type == "submitter") { if ($count < $max) { $data[$wo['created_by_user']] = $wo['COUNT(id)']; } else { $data[__('Others')] += $wo['COUNT(id)']; } } else { if ($count < $max) { $data[$wo['assigned_user']] = $wo['COUNT(id)']; } else { $data[__('Others')] += $wo['COUNT(id)']; } } $count++; } } if ($data == NULL) { return __("There is no data to show"); } else { return pie3d_graph($config['flash_charts'], $data, $width, $height, __('others'), "", "", $config['font'], $config['fontsize'], $ttl); } }
array_push($table->data, $data); } print_table($table); if ($section_write_permission || $section_manage_permission) { echo '<form method="post" action="index.php?sec=customers&sec2=operation/leads/lead_detail&id_company=' . $id . '">'; echo '<div style="width: ' . $table->width . '; text-align: right;">'; print_submit_button(__('Create'), 'new_btn', false, 'class="sub next"'); print_input_hidden('new', 1); echo '</div>'; echo '</form>'; } } } else { if ($op == 'projects') { $sql = "SELECT DISTINCT id_project FROM trole_people_task, ttask WHERE ttask.id = trole_people_task.id_task\n\t\t\tAND id_user IN (SELECT id_usuario FROM tusuario WHERE id_company={$id})"; $company_projects = get_db_all_rows_sql($sql); if ($company_projects == false) { echo '<h4>' . __("No projects") . '</h4>'; } crm_print_company_projects_tree($company_projects); //div to show user info echo "<div class= 'dialog ui-dialog-content' title='" . __("User info") . "' id='user_info_window'></div>"; } } // No id passed as parameter if (!$id and $new_company == 0) { $message = get_parameter('message', ''); if ($message != '') { echo "<h3 class='suc'>" . __($message) . "</h3>"; } // Search // General Company listing
$button .= '</div>'; $table->data[1][1] = $button; echo '<form id="add_row" method="post" action="index.php?sec=inventory&sec2=operation/inventories/manage_external_tables&id=' . $id_object_type . '&external_table=' . $external_table . '&add_row=1">'; print_table($table); echo '</form>'; if ($external_table) { $table_list->width = '99%'; $table_list->class = 'listing'; $table_list->data = array(); $table_list->head = array(); $table_list->size = array(); $table_fields = get_db_all_rows_sql("DESC " . $external_table); if ($table_fields == false) { $table_fields = array(); } $table_data = get_db_all_rows_sql("SELECT * from " . $external_table); if ($table_data == false) { $table_data = array(); } $i = 0; $key = ""; foreach ($table_fields as $field) { if ($field['Key'] == 'PRI') { $key = $field['Field']; } $data = array(); $table_list->head[$i] = $field['Field']; $i++; } if (!empty($table_fields)) { $table_list->size[$i] = '430px';
$content = '<div class="pie_frame">' . graph_project_task_per_user(180, 150, $id_project) . '</div>'; print_container('planning_hours_task_user', __("Task per user"), $content, 'no', false, '10px'); echo "</td>"; echo "</tr>"; echo "</table>"; echo "</center>"; //Create button bar echo "<div style='width:100%; border-spacing:0px;' class='button'>"; // Oppen the task creation print_button(__('Add tasks'), 'addmass', false, '', 'class="sub create"'); // Submit the update form print_button(__('Update'), 'update', false, 'document.forms[\'form-tasks\'].submit()', 'class="sub upd"'); echo "</div>"; //Get project users $sql = sprintf("SELECT DISTINCT(id_user) FROM trole_people_project WHERE id_project = %d", $id_project); $users_db = get_db_all_rows_sql($sql); foreach ($users_db as $u) { $users[$u['id_user']] = $u['id_user']; } //Hidden div for task creation. Only for PM flag echo "<div id='createTaskmass' style='display:none;padding:5px;'>"; //Form for task creation echo "<form id='form-new_tasks' method='post' action='index.php?sec=projects&sec2=operation/projects/task_planning&id_project=" . $id_project . "'>"; echo "<table class='search-table-button' style='width: 99%'><tr><td colspan=4>"; echo "<strong>" . __('Put taskname in each line') . "</strong><br>"; print_textarea('tasklist', 5, 40); echo "<tr>"; // User assigned by default echo "<td>"; print_select($users, "dueno", $config['id_user'], '', '', 0, false, 0, false, __("Owner")); echo "</td>";
$url_id_src = 'index.php?sec=inventory&sec2=operation/inventories/inventory_detail&id='.$id_src; $url_id_dst = 'index.php?sec=inventory&sec2=operation/inventories/inventory_detail&id='.$id_dst; $data[0] = "<a href=".$url_id_src.">". inventories_link_get_name($id_src) ."</a>"; $data[1] = "<a href=".$url_id_dst.">". inventories_link_get_name($id_dst) ."</a>"; $data[2] = "<a onclick=\"if (!confirm('" . __('Are you sure?') . "')) return false;\" href='" . $url . "'> <img src='images/cross.png' border=0 /></a>"; array_push ($table->data, $data); } } if ($ids_str == '') { $available_links = get_db_all_rows_sql("SELECT `id`,`name` FROM tinventory WHERE id NOT IN ($id)"); } else { $available_links = get_db_all_rows_sql("SELECT `id`,`name` FROM tinventory WHERE id NOT IN ($ids_str)"); } if ($available_links == false) { $available_links = array(); } $available_inventory = array(); foreach ($available_links as $key => $inventory) { $available_inventory[$inventory['id']] = $inventory['name']; } if ($write_permission) { $url = "index.php?sec=inventory&sec2=operation/inventories/inventory_relationship&add_link=1&id_src=$id&id=$id"; $data[0] = "<form name=dataedit method=post action='" . $url . "'>";
echo "</a>"; echo "<td>"; echo $row["description"]; echo "<td>"; echo "<a href='index.php?sec=kb&sec2=operation/kb/manage_data&update={$id}&delete_attach={$attach_id}'><img border=0 src='images/cross.png'></A>"; } echo "</table>"; } } // Show list of items // ======================= if (!isset($_GET["update"]) and !isset($_GET["create"])) { echo "<h2>" . __('KB Data management') . " » " . __('Defined data') . "</h2>"; $condition = get_filter_by_kb_product_accessibility(); $sql1 = 'SELECT * FROM tkb_data ' . $condition . ' ORDER BY title, id_category, id_product'; $kb = get_db_all_rows_sql($sql1); if (sizeof($kb) > 0) { echo '<table width="90%" class="listing">'; echo "<th>" . __('Title') . "</th>"; echo "<th>" . __('Timestamp') . "</th>"; echo "<th>" . __('Category') . "</th>"; echo "<th>" . __('Product') . "</th>"; echo "<th>" . __('User') . "</th>"; echo "<th>" . __('Delete') . "</th>"; $kb = print_array_pagination($kb, "index.php?sec=kb&sec2=operation/kb/manage_data"); foreach ($kb as $row) { echo "<tr>"; // Name echo "<td valign='top'><b><a href='index.php?sec=kb&sec2=operation/kb/manage_data&update=" . $row["id"] . "'>" . $row["title"] . "</a></b></td>"; // Timestamp echo "<td class='f9' valign='top'>";
$types = array('text' => __('Text'), 'textarea' => __('Textarea'), 'combo' => __('Combo'), 'linked' => __('Linked'), 'numeric' => __('Numeric')); $table->data[0][1] = print_select($types, 'type', $type, '', '', '', true, 0, false, __("Type"), $global_field); // Show in the ticket list $table->data[0][2] = print_checkbox('show_in_list', 1, $show_in_list, true, __('Show in the tickets list'), $global_field); // Global field $table->data[0][3] = print_checkbox('global', 1, $global_field, true, __('Global field'), $global_field); // Combo value $table->data['id_combo_value'][0] = print_input_text('combo_value', $combo_value, '', 45, 0, true, __('Combo value'), $global_field); $table->data['id_combo_value'][0] .= print_help_tip(__("Set values separated by comma"), true); // Add values if ($global_field) { $table->data['id_combo_value'][1] = print_input_text('add_combo_value', $add_combo_value, '', 45, 0, true, __('Add values')) . print_help_tip(__("Set values separated by comma"), true); } // Linked values $sql = "SELECT id, label\n\t\tFROM tincident_type_field\t\n\t\tWHERE id_incident_type = {$id_incident_type}\n\t\t\tAND type = 'linked'"; $parents_result = get_db_all_rows_sql($sql); if ($parents_result == false) { $parents_result = array(); } $parents = array(); foreach ($parents_result as $result) { $parents[$result['id']] = $result['label']; } $table->data['id_parent_value'][0] = print_select($parents, 'parent', $parent, '', __('Select parent'), '0', true, 0, true, __("Parent"), $global_field); $table->data['id_linked_value'][0] = print_textarea('linked_value', 15, 1, $linked_value, '', true, __('Linked value') . integria_help("linked_values", true), $global_field); if ($global_field) { $table->data['id_linked_value'][1] = ""; $table->data['id_linked_value'][2] = print_textarea('add_linked_value', 15, 1, $add_linked_value, '', true, __('Add values') . integria_help("linked_values", true)); } // Buttons if ($add_field) {
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] .= " <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; }
audit_db($config["id_user"], $config["REMOTE_ADDR"], "Group management", "Deleted group '{$name}'"); echo '<h3 class="suc">' . __('Successfully deleted') . '</h3>'; } } $offset = get_parameter("offset", 0); $search_text = get_parameter("search_text", ""); echo "<table class='search-table' style='width: 99%;'><form name='bskd' method=post action='index.php?sec=users&sec2=godmode/grupos/lista_grupos'>"; echo "<td>"; echo "<b>" . __('Search text') . "</b> "; print_input_text("search_text", $search_text, '', 40, 0, false); echo "</td>"; echo "<td>"; print_submit_button(__('Search'), '', false, 'class="sub next"', false, false); echo "</td>"; echo "</table></form>"; $groups = get_db_all_rows_sql("SELECT * FROM tgrupo WHERE nombre LIKE '%{$search_text}%' ORDER BY nombre"); $groups = print_array_pagination($groups, "index.php?sec=users&sec2=godmode/grupos/lista_grupos"); print_groups_table($groups); echo '<form method="post" action="index.php?sec=users&sec2=godmode/grupos/configurar_grupo">'; echo '<div class="button" style="width: ' . $table->width . '">'; print_submit_button(__('Create'), 'create_btn', false, 'class="sub next"'); echo '</div>'; echo '</form>'; ?> <script type="text/javascript" src="include/js/jquery.validation.functions.js"></script> <script type="text/javascript"> trim_element_on_submit('#text-search_text'); </script>
incidents_set_tracking($id, 'create', $priority, $estado, $resolution, $usuario, $grupo); audit_db($config["id_user"], $config["REMOTE_ADDR"], "Ticket created", "User " . $config['id_user'] . " created incident #" . $id); // Create automatically a WU with the editor ? if ($config["incident_creation_wu"] == 1) { $wu_text = __("WU automatically created by the editor on the incident creation."); // Do not send mail in this WU create_workunit($id, $wu_text, $editor, $config["iwu_defaultime"], 0, "", 1, 0); } // Email notify to all people involved in this incident if ($email_notify) { mail_incident($id, $usuario, "", 0, 1); } //insert data to incident type fields if ($id_incident_type != 0) { $sql_label = "SELECT `label` FROM `tincident_type_field` WHERE id_incident_type = {$id_incident_type}"; $labels = get_db_all_rows_sql($sql_label); if ($labels === false) { $labels = array(); } foreach ($labels as $label) { $id_incident_field = get_db_value_filter('id', 'tincident_type_field', array('id_incident_type' => $id_incident_type, 'label' => $label['label']), 'AND'); $values_insert['id_incident'] = $id; $values_insert['data'] = get_parameter(base64_encode($label['label'])); //~ $values_insert['data'] = str_replace('
', "",get_parameter (base64_encode($label['label']))); $values_insert['id_incident_field'] = $id_incident_field; $id_incident_field = get_db_value('id', 'tincident_type_field', 'id_incident_type', $id_incident_type); process_sql_insert('tincident_field_data', $values_insert); } } // ATTACH A FILE IF IS PROVIDED $upfiles = json_decode(safe_output($upfiles), true);
/** * Prints an array of fields in a popup menu of a form based on a SQL query. * The first and second columns of the query will be used. * * The element will have an id like: "password-$value". Based on choose_from_menu() from Moodle. * * @param string $sql SQL sentence, the first field will be the identifier of the option. * The second field will be the shown value in the dropdown. * @param string $name Select form name * @param string $selected Current selected value. * @param string $script Javascript onChange code. * @param string $nothing Label when nothing is selected. * @param string $nothing_value Value when nothing is selected * @param bool $return Whether to return an output string or echo now (optional, echo by default). * @param bool $multiple Whether to allow multiple selections or not. Single by default * @param bool $sort Whether to sort the options or not. Sorted by default. * @param bool $disabled if it's true, disable the select. * @param string $style The string of style. * @param mixed $size Max elements showed in select or default (size=10) * @param int $truncante_size Truncate size of the element, by default is set to GENERIC_SIZE_TEXT constant * * @return string HTML code if return parameter is true. */ function html_print_select_from_sql($sql, $name, $selected = '', $script = '', $nothing = '', $nothing_value = '0', $return = false, $multiple = false, $sort = true, $disabled = false, $style = false, $size = false, $trucate_size = GENERIC_SIZE_TEXT) { global $config; $fields = array(); $result = get_db_all_rows_sql($sql); if ($result === false) { $result = array(); } foreach ($result as $row) { $id = array_shift($row); $value = array_shift($row); $fields[$id] = ui_print_truncate_text($value, $trucate_size, false, true, false); } return html_print_select($fields, $name, $selected, $script, $nothing, $nothing_value, $return, $multiple, $sort, '', $disabled, $style, '', $size); }
echo "<div class='divform'>"; echo '<form method="post" action="index.php?sec=incidents&sec2=operation/slas/sla_detail">'; print_table ($table); echo '</form>'; echo '<form id="form-sla_detail" method="post" action="index.php?sec=incidents&sec2=operation/slas/sla_detail">'; unset($table->data); $table->data[0][0] = print_submit_button (__('Create'), 'new_btn', false, 'class="sub create"',true); $table->data[0][0] .= print_input_hidden ('new_sla', 1); print_table ($table); echo '</form>'; echo "</div>"; $sql = "SELECT * FROM tsla $where_clause ORDER BY name"; $slas = get_db_all_rows_sql ($sql); if ($slas !== false) { $table->width = "100%"; $table->class = "listing"; $table->data = array (); $table->style = array (); $table->style[0] = 'font-weight: bold'; $table->head[0] = __('Name'); $table->head[1] = __('Max.Response'); $table->head[2] = __('Max.Resolution'); $table->head[3] = __('Max.Tickets'); $table->head[4] = __('Max.Inactivity'); $table->head[5] = __('Enforced'); $table->head[6] = __('Parent'); $table->head[7] = __('Delete');