예제 #1
0
 private function getWorkOrdersQuery($columns = "*", $order_by = "priority DESC, name", $limit = true)
 {
     $system = System::getInstance();
     $filter = "";
     if ($this->filter_search != '') {
         $filter .= " AND name LIKE '%" . $this->filter_search . "%' ";
     }
     if ($this->filter_owner != '') {
         $filter .= " AND assigned_user = '******' ";
     }
     if ($this->filter_creator != '') {
         $filter .= " AND created_by_user = '******' ";
     }
     if ($this->filter_status >= 0) {
         $filter .= " AND progress = " . $this->filter_status;
     }
     if (dame_admin($system->getConfig('id_user'))) {
         $sql = "SELECT {$columns}\n\t\t\t\t\tFROM ttodo\n\t\t\t\t\tWHERE 1=1\n\t\t\t\t\t{$filter}";
     } else {
         $sql = "SELECT {$columns}\n\t\t\t\t\tFROM ttodo\n\t\t\t\t\tWHERE (assigned_user = '******'id_user') . "'\n\t\t\t\t\t\tOR created_by_user = '******'id_user') . "')\n\t\t\t\t\t\t{$filter}";
     }
     if ($order_by != "") {
         $sql .= " ORDER BY {$order_by}";
     }
     if ($limit) {
         $sql .= " LIMIT " . (int) (($this->offset - 1) * $system->getPageSize()) . ", " . (int) $system->getPageSize();
     }
     return $sql;
 }
예제 #2
0
 private function getIncidentsQuery($columns = "*", $order_by = "actualizacion DESC, prioridad DESC, titulo", $limit = true)
 {
     $system = System::getInstance();
     $filter = "";
     if ($this->filter_search != '') {
         $filter .= " AND (titulo LIKE '%" . $this->filter_search . "%'\n\t\t\t\t\t\t\t\tOR descripcion LIKE '%" . $this->filter_search . "%' \n\t\t\t\t\t\t\t\tOR id_creator LIKE '%" . $this->filter_search . "%'\n\t\t\t\t\t\t\t\tOR id_usuario LIKE '%" . $this->filter_search . "%' \n\t\t\t\t\t\t\t\tOR id_incidencia IN (SELECT id_incident\n\t\t\t\t\t\t\t\t\t\t\t\t\t FROM tincident_field_data\n\t\t\t\t\t\t\t\t\t\t\t\t\t WHERE data LIKE '%" . $this->filter_search . "%'))";
     }
     if ($this->filter_status != 0) {
         if ($this->filter_status == -10) {
             $filter .= " AND estado <> 7";
         } else {
             $filter .= " AND estado = " . $this->filter_status;
         }
     }
     if ($this->filter_owner != '') {
         $filter .= " AND id_usuario = '" . $this->filter_owner . "' ";
     }
     if (dame_admin($system->getConfig('id_user'))) {
         $sql = "SELECT {$columns}\n\t\t\t\t\tFROM tincidencia\n\t\t\t\t\tWHERE 1=1\n\t\t\t\t\t{$filter}";
     } else {
         $sql = "SELECT {$columns}\n\t\t\t\t\tFROM tincidencia\n\t\t\t\t\tWHERE (id_usuario = '" . $system->getConfig('id_user') . "'\n\t\t\t\t\t\tOR id_creator = '" . $system->getConfig('id_user') . "')\n\t\t\t\t\t\t{$filter}";
     }
     if ($order_by != "") {
         $sql .= " ORDER BY {$order_by}";
     }
     if ($limit) {
         $sql .= " LIMIT " . (int) (($this->offset - 1) * $system->getPageSize()) . ", " . (int) $system->getPageSize();
     }
     return $sql;
 }
예제 #3
0
	private function getWorkUnitsQuery ($columns = "*", $order_by = "timestamp DESC, id", $limit = true) {
		$system = System::getInstance();
		
		$id_incident = $system->getRequest('id_incident', -1);
		
		$filter = '';
		if ($id_incident > 0) {
			$filter = " AND id = ANY(SELECT id_workunit
									 FROM tworkunit_incident
									 WHERE id_incident = $id_incident)";
		}
		if (dame_admin($system->getConfig('id_user'))) {
			$sql = "SELECT $columns
					FROM tworkunit
					WHERE 1=1
						$filter";
		} else {
			$sql = "SELECT $columns
					FROM tworkunit
					WHERE id_user = '******'id_user')."'
						$filter";
		}
		if ($order_by != "") {
			$sql .= " ORDER BY $order_by";
		}
		if ($limit) {
			$sql .= " LIMIT ".(int)(($this->offset -1) * $system->getPageSize()).", ".(int)$system->getPageSize();
		}
		
		return $sql;
	}
예제 #4
0
	public function showCalendars ($message = "") {
		$system = System::getInstance();
		$ui = Ui::getInstance();
		
		$ui->createPage();
		
		// Header
		$back_href = 'index.php?page=home';
		$ui->createDefaultHeader(__("Calendars"),
			$ui->createHeaderButton(
				array('icon' => 'back',
					'pos' => 'left',
					'text' => __('Back'),
					'href' => $back_href)));
					
		// Content
		$ui->beginContent();
			// Message popup
			if ($message != "") {
				$options = array(
					'popup_id' => 'message_popup',
					'popup_custom' => true,
					'popup_content' => $message
					);
				$ui->addPopup($options);
				$ui->contentAddHtml("<script type=\"text/javascript\">
										$(document).on('pageshow', function() {
											$(\"div.popup-back\")
												.click(function (e) {
													e.preventDefault();
													$(this).remove();
												})
												.show();
										});
									</script>");
			}

			$html = $this->getCalendars();
			$this->addCalendarsLoader();

			$ui->contentAddHtml($html);
		$ui->endContent();

		if (dame_admin($system->getConfig("id_user"))) {
			$options = array (
				'id' => 'form-user_calendar',
				'action' => "index.php?page=calendars",
				'method' => "POST",
				'data-ajax' => 'false'
				);
			$ui->beginForm($options);
			// User
			$options = array(
				'name' => 'user',
				'id' => 'text-user',
				'value' => $this->user,
				'placeholder' => __('User'),
				'autocomplete' => 'off'
				);
			$ui->formAddInputText($options);
			// User autocompletion
			// List
			$ui->formAddHtml("<ul id=\"ul-autocomplete_user\" data-role=\"listview\" data-inset=\"true\"></ul>");
			// Autocomplete binding
			$callbackF = "$('#form-user_calendar').submit();";
			$ui->bindMobileAutocomplete("#text-user", "#ul-autocomplete_user", false, $callbackF);
			$html = $ui->getEndForm();

			$options = array (
				'popup_id' => 'popup-user_calendar',
				'popup_class' => 'ui-content',
				'popup_content' => $html
				);
			$ui->addPopup($options);

			$html = "<a href=\"javascript:\" onclick=\"$('#popup-user_calendar').popup('open');\" data-role=\"button\" data-inline=\"false\" data-icon=\"search\">" . $this->user . "</a>";
			$ui->createFooter($html);
			$ui->showFooter();
		} else {
			$ui->showFooter(false);
		}
		
		$ui->showPage();
	}
$table->data[1][0] = print_textarea ('sql', 10, 100, $sql, '', true, __('Report SQL sentence'));

if (dame_admin ($config['id_user'])) {
	if ($id) {
			$button = print_input_hidden ('update_report', 1, true);
			$button .= print_input_hidden ('id', $id, true);
			$button .= print_submit_button (__('Update'), 'update', false, 'class="sub upd"', true);
	} else {
		$button = print_input_hidden ('create_report', 1, true);
		$button .= print_submit_button (__('Create'), 'create', false, 'class="sub create"', true);
	}
}

echo '<form id="form-inventory_report" method="post">';
print_table ($table);
if (dame_admin ($config['id_user'])) 
	echo "<div class='button-form'>" . $button . "</div>";
echo '</form>';
?>

<script type="text/javascript" src="include/js/jquery.validate.js"></script>
<script type="text/javascript" src="include/js/jquery.validation.functions.js"></script>

<script type="text/javascript">
	
// Form validation
trim_element_on_submit('#text-name');
validate_form("#form-inventory_report");
var rules, messages;
// Rules: #text-name
rules = {
예제 #6
0
			GROUP BY tproject.name',
			$start_date, $end_date);

		// If it's not an incident match.... search in regular project data

	}
	else {

		if ($user_id != "")
			$user_search = " AND tworkunit.id_user = '******'";
		else
			$user_search = "";

		// ACL CHECK, show all info (user) or only related info for this user (current user) projects
		
		if ((dame_admin($config["id_user"])) OR ($config["id_user"] == $user_id)) {
			
			$sql = sprintf ('SELECT tproject.id as id, tproject.name as name, SUM(tworkunit.duration) AS sum
			FROM tproject, ttask, tworkunit_task, tworkunit
			WHERE tworkunit_task.id_workunit = tworkunit.id '. $user_search . '
			AND tworkunit_task.id_task = ttask.id
			AND ttask.id_project = tproject.id
			AND tworkunit.timestamp >= "%s"
			AND tworkunit.timestamp <= "%s"
			GROUP BY tproject.name',
			$start_date, $end_date);

		} else {
		
			// Show only info on my projects for this user
			// TODO: Move this to enterprise code.
예제 #7
0
 public function checkPermission($id_user, $acl = 'IR', $operation = '', $id_incident = 0)
 {
     $system = System::getInstance();
     $permission = false;
     if (dame_admin($id_user)) {
         $permission = true;
     } else {
         if ($system->checkACL($this->acl)) {
             if ($id_incident > 0) {
                 $incident_creator = get_db_value("id_creator", "tincidencia", "id_incidencia", $id_incident);
                 $incident_user = get_db_value("id_usuario", "tincidencia", "id_incidencia", $id_incident);
                 if (strcasecmp($id_user, $incident_creator) == 0 || strcasecmp($id_user, $incident_user) == 0) {
                     switch ($operation) {
                         case 'insert_file':
                             if ($system->checkACL('IW') || $system->checkACL('IM')) {
                                 $permission = true;
                             }
                             break;
                         case 'delete_file':
                             if ($system->checkACL('IW') || $system->checkACL('IM')) {
                                 $permission = true;
                             }
                             break;
                         case 'update_incident':
                             if ($system->checkACL('IW') || $system->checkACL('IM')) {
                                 $permission = true;
                             }
                             break;
                         case 'quick_update_incident':
                             $quick_update_type = $system->getRequest('quick_update_type', "");
                             switch ($quick_update_type) {
                                 case 'priority':
                                     if ($system->checkACL('IM') || $system->checkACL('IW')) {
                                         $permission = true;
                                     }
                                     break;
                                 case 'owner':
                                     if ($system->checkACL('IM') || $system->checkACL('IW') && $system->getConfig('iw_creator_enabled')) {
                                         $permission = true;
                                     }
                                     break;
                                 case 'resolution':
                                     if ($system->checkACL('IM')) {
                                         $permission = true;
                                     }
                                     break;
                                 case 'status':
                                     if ($system->checkACL('IM') || $system->checkACL('IW')) {
                                         $permission = true;
                                     }
                                     break;
                             }
                             break;
                         case 'insert_workunit':
                             if ($system->checkACL('IW') || $system->checkACL('IM')) {
                                 $permission = true;
                             }
                             break;
                         case 'update_workunit':
                             if ($system->checkACL('IW') || $system->checkACL('IM')) {
                                 // If the workunit exists, should belong to the user
                                 $id_workunit = (int) $system->getRequest('id_workunit', -1);
                                 $user_workunit = get_db_value("id_user", "tworkunit", "id", $id_workunit);
                                 if (strcasecmp($id_user, $user_workunit) == 0) {
                                     $permission = true;
                                 }
                             }
                             break;
                         case 'delete_incident':
                             if ($system->checkACL("IM") && strcasecmp($id_user, $incident_creator) == 0) {
                                 $permission = true;
                             }
                             break;
                         default:
                             $permission = true;
                     }
                 }
             } else {
                 if ($operation == "insert_incident") {
                     if ($system->checkACL('IW') || $system->checkACL('IM')) {
                         $permission = true;
                     }
                 } else {
                     if ($operation == "") {
                         $permission = true;
                     }
                 }
             }
         }
     }
     return $permission;
 }
예제 #8
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();
 }
예제 #9
0
function workunits_print_table_massive_edition($id_task = 0, $id_profile = 0)
{
    global $config;
    echo '<br><h2>' . __('Massive operations over selected items') . '</h2>';
    $table = new StdClass();
    $table->class = 'search-table-button';
    $table->width = '99%';
    $table->data = array();
    $table->colspan = array();
    // Profile or role
    if (dame_admin($config['id_user'])) {
        $table->data[0][0] = combo_roles(false, 'id_profile', __('Role'), true, true, '', true);
    } else {
        $table->data[0][0] = combo_user_task_profile($id_task, 'id_profile', $id_profile, false, true, true);
    }
    // Show task combo if none was given.
    if (!$id_task) {
        $table->data[0][1] = combo_task_user_participant($config['id_user'], true, 0, true, __('Task'), false, false, false, '', true);
    } else {
        $table->data[0][1] = combo_task_user_participant($config['id_user'], true, $id_task, true, __('Task'), false, false, false, true);
    }
    // Various checkboxes
    $table->data[2][0] = print_checkbox('have_cost', 1, '', true, __('Have cost'));
    $table->data[2][1] = print_checkbox('keep_cost', 1, '', true, __('Keep cost'));
    $table->data[3][0] = print_checkbox('public', 1, '', true, __('Public'));
    $table->data[3][1] = print_checkbox('keep_public', 1, '', true, __('Keep public'));
    $table->colspan[5][0] = 2;
    $table->data[5][0] = print_submit_button(__('Update'), 'update_btn', false, 'class="sub upd"', true);
    $table->data[5][0] .= print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"', true);
    print_table($table);
}
예제 #10
0
파일: wo.php 프로젝트: articaST/integriaims
			$data[9] = "<span style='font-size: 9px'>". human_time_comparation($wo["start_date"]) . "<br>". human_time_comparation($wo["last_update"]). "</span>";
			
			$data[10] = "";
			if ($wo['assigned_user'] == $config["id_user"]){
				if ($wo["progress"] == 0){
					$data[10] .= "<a href='index.php?sec=projects&sec2=operation/workorders/wo$params&id=". $wo['id']."&set_progress=1'><img src='images/ack.png' title='".__("Set as finished")."'></a>";
				} 
			}

			if (($wo["progress"] < 2) AND ($wo["created_by_user"] == $config["id_user"]) AND ($wo["need_external_validation"] == 1) ){	
				$data[10] = "<a href='index.php?sec=projects&sec2=operation/workorders/wo$params&id="
					. $wo['id']."&set_progress=2&offset=$offset'><img src='images/rosette.png' title='".__("Validate")."'></a>";
			}

			// Evaluate different conditions to allow WO deletion
			$can_delete = dame_admin($config["id_user"]);

			if ($wo["created_by_user"] == $config["id_user"])
				$can_delete = 1;				

			if ($can_delete){
				$data[10] .= '&nbsp;&nbsp;<a href="index.php?sec=projects&sec2=operation/workorders/wo'
					.$params.'&operation=delete&id='.$wo['id'].'&offset='.$offset.'""onClick="if (!confirm(\''
					.__('Are you sure?').'\')) return false;"><img src="images/cross.png" title="' . __('Delete') . '"></a>';
			}

			array_push ($table->data, $data);
			array_push ($table->rowstyle, $style);
		}
		print_table ($table);
	}
예제 #11
0
/**
 * process_user_login accepts $login and $pass and handles it according to current authentication scheme
 *
 * @param string $login 
 * @param string $pass
 *
 * @return mixed False in case of error or invalid credentials, the username in case it's correct.
 */
function process_user_login($login, $pass)
{
    global $config, $mysql_cache;
    include_once $config['homedir'] . "/include/functions_profile.php";
    // Always authenticate admins against the local database
    if (strtolower($config["auth_methods"]) == 'mysql' || dame_admin($login)) {
        $sql = sprintf("SELECT `id_usuario`, `password` FROM `tusuario` WHERE `disabled` = 0 AND `id_usuario` = '%s' AND `enable_login` = 1", $login);
        $row = get_db_row_sql($sql);
        //Check that row exists, that password is not empty and that password is the same hash
        if ($row !== false && $row["password"] !== md5("") && $row["password"] == md5($pass)) {
            // Login OK
            // Nick could be uppercase or lowercase (select in MySQL
            // is not case sensitive)
            // We get DB nick to put in PHP Session variable,
            // to avoid problems with case-sensitive usernames.
            // Thanks to David Muñiz for Bug discovery :)
            return $row["id_usuario"];
        } else {
            $mysql_cache["auth_error"] = "User not found in database or incorrect password";
        }
        return false;
        // Remote authentication
    } else {
        switch ($config["auth_methods"]) {
            // LDAP
            case 'ldap':
                $sql = sprintf("SELECT `disabled` FROM `tusuario` WHERE `id_usuario` = '%s'", $login);
                $disabled = get_db_sql($sql);
                // Check if user is disabled
                if ($disabled == 1) {
                    $config["auth_error"] = "User not found in database or incorrect password";
                    return false;
                }
                if (ldap_process_user_login($login, $pass) === false) {
                    $config["auth_error"] = "User not found in database or incorrect password";
                    return false;
                }
                break;
                // Active Directory
            // Active Directory
            case 'ad':
                if (enterprise_hook('ad_process_user_login', array($login, $pass)) === false) {
                    return false;
                }
                break;
                // Remote Pandora FMS
                /* case 'pandora':
                				
                				break;
                
                			// Remote Babel Enterprise
                			case 'babel':
                				
                				break;
                
                			// Remote Integria
                			case 'integria':
                				
                				break; */
                // Unknown authentication method
            // Remote Pandora FMS
            /* case 'pandora':
            				
            				break;
            
            			// Remote Babel Enterprise
            			case 'babel':
            				
            				break;
            
            			// Remote Integria
            			case 'integria':
            				
            				break; */
            // Unknown authentication method
            default:
                $config["auth_error"] = "User not found in database or incorrect password";
                return false;
        }
        // Authentication ok, check if the user exists in the local database
        if (is_user($login)) {
            return $login;
        }
        // The user does not exist and can not be created
        if ($config['autocreate_remote_users'] == 0 || is_user_blacklisted($login)) {
            $config["auth_error"] = "Ooops User not found in database or incorrect password";
            return false;
        }
        // Create the user in the local database
        if (create_user($login, $pass, array('nombre_real' => $login, 'comentarios' => 'Imported from ' . $config['auth_methods'])) === false) {
            $config["auth_error"] = "User not found in database or incorrect password";
            return false;
        }
        profile_create_user_profile($login, $config['default_remote_profile'], $config['default_remote_group']);
        return $login;
    }
    return false;
}
예제 #12
0
check_login();
if (!give_acl($config["id_user"], 0, "FRR")) {
    audit_db($config["id_user"], $config["REMOTE_ADDR"], "ACL Violation", "Trying to access Downloads browser");
    require "general/noaccess.php";
    exit;
}
require_once $config['homedir'] . "/operation/file_sharing/FileSharingFile.class.php";
require_once $config['homedir'] . "/operation/file_sharing/FileSharingPackage.class.php";
$user_is_admin = (bool) dame_admin($config['id_user']);
$id_user = get_parameter('id_user', $config['id_user']);
// If the user doesn't exist get the current user
$user_data = get_user($id_user);
if (empty($user_data)) {
    $id_user = $config['id_user'];
}
$user_is_admin = (bool) dame_admin($config['id_user']);
$sql = "SELECT id_attachment FROM tattachment\n\t\tWHERE id_usuario = '{$id_user}'\n\t\t\tAND file_sharing = 1\n\t\tORDER BY timestamp DESC, id_attachment DESC";
$files_aux = get_db_all_rows_sql($sql);
if (empty($files_aux) || empty($files_aux[0])) {
    $files_aux = array();
}
$files = array();
foreach ($files_aux as $file_aux) {
    $id = $file_aux['id_attachment'];
    $file = new FileSharingPackage($id);
    $file->loadTrackingDownload();
    // Load the downloads tracking info
    $files[] = $file->toArray();
}
?>
예제 #13
0
    }
    print_input_hidden('result_check_update_manager', $result_check_update_manager);
}
if (!$check_cron_exec || !$check_email_queue || $result_check_update_manager != '' || $check_alarm_calendar || $check_directory_permissions || $check_minor_release_available || $check_browser) {
    $got_alerts = 1;
    echo '<a href: >' . print_image('images/header_warning.png', true, array("onclick" => "openAlerts()", "alt" => __('Warning'), "id" => "alerts", 'title' => __('Warning'))) . '</a>';
}
echo '<a href="index.php?sec=users&sec2=operation/users/user_edit&id=' . $config['id_user'] . '" >';
if (dame_admin($config['id_user'])) {
    echo print_image('images/header_suit.png', true, array("alt" => $config['id_user'], 'title' => $config['id_user']));
} else {
    echo print_image('images/header_user.png', true, array("alt" => $config['id_user'], 'title' => $config['id_user']));
}
echo '</a>';
echo '<a href="index.php?logout=1">' . print_image('images/header_logout.png', true, array("alt" => __('Logout'), 'title' => __('Logout'))) . '</a>';
if (isset($config["id_user"]) && dame_admin($config["id_user"]) && $show_setup != MENU_HIDDEN) {
    echo '<a href="index.php?sec=godmode&sec2=godmode/setup/setup" id="setup_link"><img src="images/header_setup.png" title="' . __('Setup') . '"></a>';
}
echo '</div>';
echo '</div>';
//echo '</tr>';
echo '</div>';
echo "<div class= 'dialog ui-dialog-content' title='" . __("Notices") . "' id='alert_window'></div>";
//one div per alarm calendar
if ($check_alarm_calendar) {
    $alarms = check_alarm_calendar(false);
    foreach ($alarms as $alarm) {
        echo "<div class= 'dialog ui-dialog-content' id='popup_alert_window_" . $alarm['id'] . "'></div>";
    }
}
?>
예제 #14
0
			if ($lead['progress'] < 100 && $lead['owner'] == "")
				$data[10] = "<a href='index.php?sec=customers&sec2=operation/leads/lead&tab=search&id=".
				$lead['id']."&make_owner=1&offset=$offset'><img src='images/award_star_silver_1.png' title='".__("Take ownership of this lead")."'></a>&nbsp;";
			else
				$data[10] = "";


			// Close that lead
			if ($lead['progress'] < 100 && ((($config["id_user"] == $lead["owner"] && ($section_write_permission || $section_manage_permission)) || dame_admin($config["id_user"])))) {
				$data[10] .= "<a href='index.php?sec=customers&sec2=operation/leads/lead&tab=search&id=".
				$lead['id']."&close=1&offset=$offset'><img src='images/lock.png' title='".__('Close this lead')."'></a>";
			}

			// Show delete control if its owned by the user
			if (($config["id_user"] == $lead["owner"] && ($section_write_permission || $section_manage_permission)) || dame_admin($config["id_user"])) {
				$data[10] .= "<a href='#' onClick='javascript: show_validation_delete(\"delete_lead\",".$lead["id"].",0,".$offset.");'><img src='images/cross.png'></a>";
			} else {
				if ($lead["owner"] == ""){
					if ($section_write_permission || $section_manage_permission) {				
						$data[10] .= "<a href='#' onClick='javascript: show_validation_delete(\"delete_lead\",".$lead["id"].",0,".$offset.");'><img src='images/cross.png'></a>";
					}
				}
			}

			array_push ($table->data, $data);

		}
		print_table ($table);
		
		echo "<h5>".$count_total_leads.__(" lead(s) found")."</h5>";
 /**
  * Create a zip package with the /tmp files in the user folder on tattachment/file_sharing
  * and delete the original files.
  * Fill the files with FileSharingFile objects is required. This objects should have filled
  * the params 'fullpath' and 'basename'.
  * 
  * @return array The index 'status' shows the result of the operation, the index 'message'
  * returns a message and the index 'bad_files' returns an array with the not created files.
  */
 public function save()
 {
     global $config;
     $result = array('status' => false, 'message' => '', 'badFiles' => array());
     if (isset($this->files) && !empty($this->files) && is_array($this->files)) {
         if (isset($this->id)) {
             // Do nothing. At this moment the package edition is not supported
             $result['message'] = __('At this moment the package edition is not supported');
         } else {
             // Package creation
             if (class_exists("ZipArchive")) {
                 // The admin can manage the file uploads as any user
                 $user_is_admin = (bool) dame_admin($config['id_user']);
                 if ($user_is_admin) {
                     $id_user = get_parameter("id_user", $config['id_user']);
                     // If the user doesn't exist get the current user
                     $user_data = get_user($id_user);
                     if (empty($user_data)) {
                         $id_user = $config['id_user'];
                     }
                     $this->uploader = $id_user;
                 } else {
                     $this->uploader = $config['id_user'];
                 }
                 if (!isset($this->filename) || empty($this->filename)) {
                     $this->filename = 'IntegriaIMS-SharedFile';
                 }
                 if (!isset($this->description)) {
                     $this->description = '';
                 }
                 if (!isset($this->created)) {
                     $this->created = time();
                 }
                 $this->filename .= ".zip";
                 // Insert the package info into the tattachment table
                 $values = array();
                 $values['id_usuario'] = safe_input($this->uploader);
                 $values['filename'] = safe_input($this->filename);
                 $values['timestamp'] = date("Y-m-d", $this->created);
                 $values['public_key'] = hash("sha256", $id . $this->uploader . $this->filename . $this->created);
                 $values['file_sharing'] = 1;
                 $id = process_sql_insert(FileSharingFile::$dbTable, $values);
                 if (!empty($id)) {
                     $this->id = $id;
                     if (!file_exists(self::$fileSharingDir) && !is_dir(self::$fileSharingDir)) {
                         mkdir(self::$fileSharingDir);
                     }
                     $userDir = self::$fileSharingDir . "/" . $this->uploader;
                     if (!file_exists($userDir) && !is_dir($userDir)) {
                         mkdir($userDir);
                     }
                     $this->fullpath = $userDir . "/" . $this->id . "_" . $this->filename;
                     // Zip creation
                     $zip = new ZipArchive();
                     $res = $zip->open($this->fullpath, ZipArchive::CREATE);
                     if ($res === true) {
                         foreach ($this->files as $file) {
                             if (is_array($file)) {
                                 $file = new FileSharingFile($file);
                             }
                             $fullpath = $file->getFullpath();
                             $basename = $file->getBasename();
                             if ($file->isReadable() && !empty($fullpath) && !empty($basename)) {
                                 // Add the file to the package
                                 if (!$zip->addFile($fullpath, $basename)) {
                                     $result['badFiles'][] = $file;
                                 }
                             } else {
                                 $result['badFiles'][] = $file;
                             }
                         }
                         $zip->close();
                         $filesCount = count($this->files);
                         $badFilesCount = count($result['badFiles']);
                         if ($badFilesCount == 0) {
                             $result['status'] = true;
                         } else {
                             if ($badFilesCount < $filesCount) {
                                 $result['status'] = true;
                                 $result['message'] = __('Not all the files where added to the package');
                             } else {
                                 $result['message'] = __('An error occurred while building the package');
                             }
                         }
                         // Remove the original files
                         foreach ($this->files as $file) {
                             if (is_array($file)) {
                                 $file = new FileSharingFile($file);
                             }
                             $file->deleteFromDisk();
                         }
                         // Reload the data and recheck the package
                         if ($result['status']) {
                             $this->loadWithID($this->id);
                             if (!$this->exists || !$this->readable) {
                                 $result['status'] = false;
                                 $result['message'] = __('An error occurred while building the package');
                                 $result['badFiles'] = array();
                                 $this->delete();
                             } else {
                                 // The file was created successsfully
                                 $this->trackingCreation();
                             }
                         }
                     }
                 } else {
                     $result['message'] = __('An error occurred while creating the package');
                     foreach ($this->files as $file) {
                         if (is_array($file)) {
                             $file = new FileSharingFile($file);
                         }
                         $file->deleteFromDisk();
                     }
                 }
             } else {
                 if (get_admin_user($config['id_user'])) {
                     $result['message'] = __("Impossible to handle the package. You have to install the PHP's Zip extension");
                 } else {
                     $result['message'] = __('An error occurred while building the package');
                 }
             }
         }
     } else {
         $result['message'] = __('This package has no files');
     }
     return $result;
 }
예제 #16
0
/**
 * Function to get a where filter to filter results
 * by accessible companies.
 * NOT FULLY IMPLEMENTED IN OPENSOURCE version
 * Please visit http://integriaims.com for more information
*/
function get_filter_by_company_accessibility($id_user)
{
    global $config;
    $company = get_user_company($id_user, false);
    if (get_standalone_user($id_user)) {
        return "IN (" . $company['id'] . ")";
    }
    $return = enterprise_hook('get_filter_by_company_accessibility_extra', array($company['id']));
    if ($return !== ENTERPRISE_NOT_HOOK && !dame_admin($id_user)) {
        return $return;
    }
    return "";
}
예제 #17
0
if ($files !== false) {
    unset($table);
    $table->width = "99%";
    $table->class = "listing";
    $table->data = array();
    $table->size = array();
    $table->style = array();
    $table->rowstyle = array();
    $table->head = array();
    $table->head[0] = __('Filename');
    $table->head[1] = __('Description');
    $table->head[2] = __('Size');
    $table->head[3] = __('Date');
    $table->head[4] = __('Ops.');
    foreach ($files as $file) {
        $data = array();
        $data[0] = "<a href='operation/common/download_file.php?id_attachment=" . $file["id_attachment"] . "&type=company'>" . $file["filename"] . "</a>";
        $data[1] = $file["description"];
        $data[2] = format_numeric($file["size"]);
        $data[3] = $file["timestamp"];
        // Todo. Delete files owner of lead and admins only
        if (dame_admin($config["id_user"]) || $file["id_usuario"] == $config["id_user"]) {
            $data[4] = "<a href='index.php?sec=customers&sec2=operation/companies/company_detail&id={$id}&op=files&deletef=" . $file["id_attachment"] . "'><img src='images/cross.png'></a>";
        }
        array_push($table->data, $data);
        array_push($table->rowstyle, $style);
    }
    print_table($table);
} else {
    echo "<h3>" . __('There is no files attached for this lead') . "</h3>";
}
예제 #18
0
function user_get_task_roles($id_user, $id_task)
{
    if (dame_admin($id_user)) {
        $sql = "SELECT id, name FROM trole";
    } else {
        $sql = "SELECT trole.id, trole.name \n\t\t\tFROM trole, trole_people_task\n\t\t\tWHERE id_task={$id_task} and id_user='******'\n\t\t\tAND trole.id = trole_people_task.id_role";
    }
    $roles = get_db_all_rows_sql($sql);
    return $roles;
}
예제 #19
0
//Get group if was not defined
if ($id_grupo == 0) {
    $id_grupo_incident = get_db_value("id_grupo", "tusuario_perfil", "id_usuario", $config['id_user']);
    //If no group assigned use ALL by default
    if (!$id_grupo_incident) {
        $id_grupo_incident = 1;
    }
} else {
    $id_grupo_incident = $id_grupo;
}
$groups = users_get_groups_for_select($config['id_user'], "IW", false, true);
$table->data[0][1] = print_select($groups, "grupo_form", $id_grupo_incident, '', '', 0, true, false, false, __('Group'), $blocked_incident) . "<div id='group_spinner'></div>";
$types = get_incident_types(true, $config['required_ticket_type']);
$table->data[0][2] = print_label(__('Ticket type'), '', '', true);
//Disabled incident type if any, type changes not allowed
if ($id <= 0 || $config["incident_type_change"] == 1 || dame_admin($config['id_user'])) {
    $disabled_itype = false;
} else {
    $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) {
예제 #20
0
function load_menu_visibility()
{
    global $show_projects;
    global $show_incidents;
    global $show_inventory;
    global $show_kb;
    global $show_file_releases;
    global $show_people;
    global $show_todo;
    global $show_agenda;
    global $show_setup;
    global $show_box;
    global $show_wiki;
    global $show_customers;
    global $config;
    // Get visibility permissions to sections
    $show_projects = enterprise_hook('get_menu_section_access', array('projects'));
    if ($show_projects == ENTERPRISE_NOT_HOOK) {
        $show_projects = MENU_FULL;
    }
    $show_incidents = enterprise_hook('get_menu_section_access', array('incidents'));
    if ($show_incidents == ENTERPRISE_NOT_HOOK) {
        $show_incidents = MENU_FULL;
    }
    $show_inventory = enterprise_hook('get_menu_section_access', array('inventory'));
    if ($show_inventory == ENTERPRISE_NOT_HOOK) {
        $show_inventory = MENU_FULL;
    }
    $show_kb = enterprise_hook('get_menu_section_access', array('kb'));
    if ($show_kb == ENTERPRISE_NOT_HOOK) {
        $show_kb = MENU_FULL;
    }
    $show_file_releases = enterprise_hook('get_menu_section_access', array('file_releases'));
    if ($show_file_releases == ENTERPRISE_NOT_HOOK) {
        $show_file_releases = MENU_FULL;
    }
    $show_people = enterprise_hook('get_menu_section_access', array('people'));
    if ($show_people == ENTERPRISE_NOT_HOOK) {
        $show_people = MENU_FULL;
    }
    $show_agenda = enterprise_hook('get_menu_section_access', array('agenda'));
    if ($show_agenda == ENTERPRISE_NOT_HOOK) {
        $show_agenda = MENU_FULL;
    }
    $show_setup = enterprise_hook('get_menu_section_access', array('setup'));
    if ($show_setup == ENTERPRISE_NOT_HOOK) {
        $show_setup = MENU_FULL;
    }
    $show_wiki = enterprise_hook('get_menu_section_access', array('wiki'));
    if ($show_wiki == ENTERPRISE_NOT_HOOK) {
        $show_wiki = MENU_FULL;
    }
    $show_customers = enterprise_hook('get_menu_section_access', array('customers'));
    if ($show_customers == ENTERPRISE_NOT_HOOK) {
        $show_customers = MENU_FULL;
    }
    $sec = get_parameter('sec', '');
    if (!isset($customers)) {
        $customers = "";
    }
    $show_box = $sec == "projects" && $show_projects == MENU_FULL || $sec == "incidents" && $show_incidents == MENU_FULL || $sec == "inventory" && $show_inventory == MENU_FULL || $sec == "kb" && $show_kb == MENU_FULL || $sec == "download" && $show_file_releases == MENU_FULL || $sec == "users" && $show_people == MENU_FULL || $sec == "godmode" && $show_setup == MENU_FULL || $sec == "wiki" && $show_wiki == MENU_FULL || $sec == "customers" && $customers == MENU_FULL || dame_admin($config['id_user']);
}
예제 #21
0
        echo __("Ticket management");
        echo "</h3>";
        $table->width = '80%';
        $table->class = 'listing';
        $table->data = array();
        $table->size = array();
        $table->style = array();
        $table->head[0] = __('# ID');
        $table->head[1] = __('Title');
        $table->head[2] = __('Creation datetime');
        $table->head[3] = __('Status');
        $table->head[4] = __('WU time (hr)');
        $statuses = get_indicent_status();
        foreach ($incidents as $incident) {
            $data = array();
            if (user_belong_incident($config["id_user"], $incident["id_incidencia"]) or dame_admin($config["id_user"])) {
                $data[0] = $incident["id_incidencia"];
                $data[1] = "<a href='index.php?sec=incidents&sec2=operation/incidents/incident_dashboard_detail&id=" . $incident["id_incidencia"] . "'>" . $incident["titulo"] . "</a>";
                $data[2] = $incident["inicio"];
                $data[3] = $statuses[$incident['estado']];
                $data[4] = get_incident_workunit_hours($incident["id_incidencia"]);
                array_push($table->data, $data);
            }
        }
        print_table($table);
    }
}
// Projects
if (give_acl($config["id_user"], 0, "PR") && $show_projects != MENU_HIDDEN) {
    $sql = "SELECT tproject.id as project_id, ttask.id as task_id, tproject.name as pname, ttask.name as tname FROM \n\t\t\ttproject, ttask WHERE tproject.disabled = 0 AND ttask.id_project = tproject.id AND (ttask.name LIKE '%{$search_string}%' \n\t\t\tOR tproject.name  LIKE '%{$search_string}%')";
    $tasks = get_db_all_rows_sql($sql);
예제 #22
0
function combo_task_user_participant($id_user, $show_vacations = false, $actual = 0, $return = false, $label = false, $name = false, $nothing = true, $multiple = false, $script = '', $no_change = false, $disabled)
{
    $output = '';
    $values = array();
    if ($show_vacations) {
        $values[-1] = "(*) " . __('Vacations');
        $values[-2] = "(*) " . __('Not working for disease');
        $values[-3] = "(*) " . __('Not justified');
    }
    $sql = sprintf('SELECT ttask.id, tproject.name AS project_name, ttask.name AS task_name
					FROM ttask, trole_people_task, tproject
					WHERE ttask.id_project = tproject.id
					AND tproject.disabled = 0
					AND ttask.id = trole_people_task.id_task
					AND trole_people_task.id_user = "******" 
					ORDER BY project_name, task_name', $id_user);
    //if (dame_admin ($id_user) && $multiple) {
    if (dame_admin($id_user)) {
        $sql = 'SELECT ttask.id, tproject.name AS project_name, ttask.name AS task_name
				FROM ttask, tproject
				WHERE ttask.id_project = tproject.id
					AND tproject.disabled = 0
				ORDER BY project_name, task_name';
    }
    $tasks = get_db_all_rows_sql($sql);
    if ($tasks) {
        foreach ($tasks as $task) {
            $values[$task['id']] = array('optgroup' => $task['project_name'], 'name' => '&nbsp;' . $task['task_name']);
        }
    }
    if (!$name) {
        $name = 'id_task';
    }
    if ($nothing) {
        $nothing = __('N/A');
    } else {
        $nothing = '';
    }
    if ($no_change) {
        $nothing = __('No change');
    }
    $output .= print_select($values, $name, $actual, $script, $nothing, '0', true, $multiple, false, $label, $disabled);
    if ($return) {
        return $output;
    }
    echo $output;
}
예제 #23
0
		$table->class = 'listing';
		$table->data = array ();
		$table->size = array ();
		$table->style = array ();
		$table->head[0] = __('# ID');
		$table->head[1] = __('Title');
		$table->head[2] = __('Creation datetime');
		$table->head[3] = __('Status');
		$table->head[4] = __('WU time (hr)');

		$statuses = get_indicent_status ();

		foreach ($incidents as $incident) {
			$data = array ();
			if ((user_belong_incident ($config["id_user"], $incident["id_incidencia"]))
			OR (dame_admin ($config["id_user"]))) {

				$data[0] = $incident["id_incidencia"];
				$data[1] = "<a href='index.php?sec=incidents&sec2=operation/incidents/incident_dashboard_detail&id=".$incident["id_incidencia"]."'>".$incident["titulo"]."</a>";
				$data[2] = $incident["inicio"];
				$data[3] = $statuses[$incident['estado']];
				$data[4] = get_incident_workunit_hours($incident["id_incidencia"]);
				array_push ($table->data, $data);
			}
		}

		print_table ($table);
	}
}

예제 #24
0
	$table->head[0] = __('Filename');
	$table->head[1] = __('Description');
	$table->head[2] = __('Size');
	$table->head[3] = __('Date');
	$table->head[4] = __('Ops.');

	foreach ($files as $file) {
		$data = array ();
		
		$data[0] = "<a href='operation/common/download_file.php?id_attachment=".$file["id_attachment"]."&type=lead'>".$file["filename"] . "</a>";
		$data[1] = $file["description"];
		$data[2] = format_numeric($file["size"]);
		$data[3] = $file["timestamp"];

		// Todo. Delete files owner of lead and admins only
		if ( (dame_admin($config["id_user"])) || ($file["id_usuario"] == $config["id_user"]) ){
			$data[4] = "<a href='index.php?sec=customers&sec2=operation/leads/lead_detail&id=$id&op=files&deletef=".$file["id_attachment"]."'><img src='images/cross.png'></a>";
		}

		array_push ($table->data, $data);
		array_push ($table->rowstyle, $style);
	}
	print_table ($table);

} else {
	echo ui_print_error_message (__('There is no files attached for this lead'), '', true, 'h3', true);
}
echo "</div>";
echo "</div>";

?>
예제 #25
0
$id_task = (int) get_parameter ('id');
$operation = (string) get_parameter ('operation');

if ($operation == 'move') {
	
	// ACL
	$task_access = get_project_access ($config["id_user"], $id_project, $id_task, false, true);
	if (! $task_access["manage"]) {
		// Doesn't have access to this page
		audit_db($config['id_user'], $config["REMOTE_ADDR"], "ACL Violation", "Trying to move a task without permission");
		no_permission ();
	}
	
	$target_project = get_parameter ("target_project");
	$id_task = get_parameter ("id_task");
	if ((dame_admin($config['id_user'])==1) OR (project_manager_check ($id_project) == 1)){
		$sql = sprintf ('UPDATE ttask
			SET id_project = %d,
			id_parent_task = 0
			WHERE id = %d', $target_project, $id_task);
		process_sql ($sql);
		
		// Move subtasks of this task
		$sql = sprintf ('UPDATE ttask
			SET id_project = %d WHERE id_parent_task = %d', $target_project, $id_task);
		process_sql ($sql);
		
		
		task_tracking ($id_task, TASK_MOVED);
	}
	else {
예제 #26
0
function get_wo_end_date($now, $days_margin = 0, $id_user = "")
{
    global $config;
    if ($id_user == "") {
        $id_user = $config["id_user"];
    }
    $now3 = date('Y-m-d', strtotime("{$now} + {$days_margin} days"));
    $result = array();
    // Search for tasks that end in this date
    if (dame_admin($id_user)) {
        $sql = "SELECT ttodo.id as idwo, ttodo.name as woname, ttodo.assigned_user woowner, ttodo.created_by_user as wocreator, ttodo.priority as wopriority, ttodo.end_date as woend, ttodo.start_date as wostart FROM ttodo WHERE ttodo.progress = 0 AND ttodo.end_date >= '{$now}' AND ttodo.end_date <= '{$now3}' GROUP BY idwo ORDER BY ttodo.end_date";
    } else {
        $sql = "SELECT ttodo.id as idwo, ttodo.name as woname, ttodo.assigned_user woowner, ttodo.created_by_user as wocreator, ttodo.priority as wopriority, ttodo.end_date as woend, ttodo.start_date as wostart FROM ttodo WHERE ttodo.progress = 0 AND (ttodo.assigned_user = '******' OR ttodo.created_by_user = '******') AND ttodo.end_date >= '{$now}' AND ttodo.end_date <= '{$now3}' GROUP BY idwo ORDER BY ttodo.end_date";
    }
    $res = mysql_query($sql);
    while ($row = mysql_fetch_array($res)) {
        $result[] = $row["idwo"] . "|" . $row["woname"] . "|" . $row["woowner"] . "|" . $row["wocreator"] . "|" . $row["wopriority"] . "|" . $row["woend"] . "|" . $row["wostart"];
    }
    return $result;
}
예제 #27
0
	public function getWorkUnitForm ($action = "index.php?page=workunit", $method = "POST") {
		$system = System::getInstance();
		$ui = Ui::getInstance();
		
		if ($this->id_workunit > 0) {
			$workunit = get_db_row ("tworkunit", "id", $this->id_workunit);
			if ($workunit) {
				$id_task = get_db_value ("id_task", "tworkunit_task", "id_workunit", $workunit['id']);
				$id_incident = get_db_value ("id_incident", "tworkunit_incident", "id_workunit", $workunit['id']);
				if ($id_incident == false) {
					$id_incident = -1;
				}
				$date = strtotime($workunit['timestamp']);
				$this->setValues ($workunit['id'], $id_task, $id_incident, date ("Y-m-d", $date),
									$workunit['duration'], $workunit['description'], 'view');
			}
		}
		
		$options = array (
			'id' => 'form-workunit',
			'action' => $action,
			'method' => $method
			);
		$ui->beginForm($options);
			// Date
			$options = array(
				'name' => 'date_workunit',
				'label' => __('Date'),
				'value' => $this->date_workunit,
				'placeholder' => __('Date')
				);
			$ui->formAddInputDate($options);
			// Hours
			$options = array(
				'name' => 'duration_workunit',
				'label' => __('Hours'),
				'type' => 'number',
				'step' => 'any',
				'min' => '0.00',
				'value' => $this->duration_workunit,
				'placeholder' => __('Hours')
				);
			$ui->formAddInput($options);
			
			// Tasks combo or hidden id_incident
			if ($this->id_incident < 0) {
				
				$sql = "SELECT ttask.id, tproject.name, ttask.name
						FROM ttask, trole_people_task, tproject
						WHERE ttask.id_project = tproject.id
							AND tproject.disabled = 0
							AND ttask.id = trole_people_task.id_task
							AND trole_people_task.id_user = '******'id_user')."'
						ORDER BY tproject.name, ttask.name";
				if (dame_admin ($system->getConfig('id_user'))) {
					$sql = "SELECT ttask.id, tproject.name, ttask.name 
							FROM ttask, tproject
							WHERE ttask.id_project = tproject.id
								AND tproject.disabled = 0
							ORDER BY tproject.name, ttask.name";
				}
				$tasks = get_db_all_rows_sql ($sql);
				
				$values[-3] = "(*) ".__('Not justified');
				$values[-2] = "(*) ".__('Not working for disease');
				$values[-1] = "(*) ".__('Vacations');
				//$values[0] =  __('N/A');
				if ($tasks) {
					foreach ($tasks as $task) {
						$values[$task[0]] = array('optgroup' => $task[1], 'name' => $task[2]);
					}
				}
				$selected = ($this->id_task === false) ? 0 : $this->id_task;
				$options = array(
					'name' => 'id_task',
					'title' => __('Task'),
					'label' => __('Task'),
					'items' => $values,
					'selected' => $selected
					);
				$ui->formAddSelectBox($options);
			} else {
				$options = array(
					'type' => 'hidden',
					'name' => 'id_incident',
					'value' => $this->id_incident
					);
				$ui->formAddInput($options);
			}
			// Description
			$options = array(
					'name' => 'description_workunit',
					'label' => __('Description'),
					'value' => $this->description_workunit
					);
			$ui->formAddHtml($ui->getTextarea($options));
			// Hidden operation (insert or update+id)
			if ($this->id_workunit < 0) {
				$options = array(
					'type' => 'hidden',
					'name' => 'operation',
					'value' => 'insert_workunit'
					);
				$ui->formAddInput($options);
				// Submit button
				$options = array(
					'text' => __('Add'),
					'data-icon' => 'plus'
					);
				$ui->formAddSubmitButton($options);
			} else {
				$options = array(
					'type' => 'hidden',
					'name' => 'operation',
					'value' => 'update_workunit'
					);
				$ui->formAddInput($options);
				$options = array(
					'type' => 'hidden',
					'name' => 'id_workunit',
					'value' => $this->id_workunit
					);
				$ui->formAddInput($options);
				// Submit button
				$options = array(
					'text' => __('Update'),
					'data-icon' => 'refresh'
					);
				$ui->formAddSubmitButton($options);
			}
			
		return $ui->getEndForm();
	}
예제 #28
0
// Integria 4.2 - http://integria.sourceforge.net
// ==================================================
// Copyright (c) 2007-2008 Sancho Lerena, slerena@gmail.com
// Copyright (c) 2007-2008 Artica Soluciones Tecnologicas
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
global $config;
check_login();
require_once 'include/functions_tags.php';
if (!dame_admin($config["id_user"])) {
    audit_db("ACL Violation", $config["REMOTE_ADDR"], "No administrator access", "Trying to access setup");
    require "general/noaccess.php";
    exit;
}
echo "<h1>" . __("Tags management") . "</h1>";
// Tag info
$id = (int) get_parameter('id');
$name = (string) get_parameter('name');
$colour = (string) get_parameter('colour');
// Actions
$action = (string) get_parameter('action');
$create = $action === 'create';
$update = $action === 'update';
$delete = $action === 'delete';
if ($create || $update || $delete) {
예제 #29
0
set_include_path($path . PATH_SEPARATOR . $dir);
$libs = array('include/config.php', 'include/functions.php', 'include/functions_db.php');
foreach ($libs as $file) {
    if (!@(include_once $file)) {
        echo 'Could not access ' . $file . "\n";
        set_include_path($path);
        return 1;
    }
}
set_include_path($path);
$username = $argv[1];
$password = $argv[2];
$filepath = $argv[3];
$separator = isset($argv[4]) ? $argv[4] : ',';
// Check credentials
if (!dame_admin($username)) {
    echo 'Wrong user/password' . "\n";
    return 1;
}
$user = (bool) get_db_value_filter('COUNT(*)', 'tusuario', array('id_usuario' => $username, 'password' => md5($password)));
if (!$user) {
    echo 'Wrong user/password' . "\n";
    return 1;
}
if ($filepath == "-") {
    $file = fopen('php://stdin', 'r');
    $filepath = 'STDIN';
} else {
    $file = @fopen($filepath, 'r');
}
if (!$file) {