Exemple #1
0
if ($HELPDESK_CONFIG['search_criteria_requestor']) {
    if (isset($_GET['requestor'])) {
        $AppUI->setState('HelpDeskRequestor', $_GET['requestor']);
    }
    $requestor = $AppUI->getState('HelpDeskRequestor') !== null ? $AppUI->getState('HelpDeskRequestor') : -1;
    if (isset($requestor) && strlen($requestor) > 0 && $requestor != '-1') {
        $tarr[] = "hi.item_requestor='{$requestor}'";
    }
    // retrieve requestor list
    $sql = "SELECT distinct(item_requestor) as requestor, item_requestor\n\t\t      FROM helpdesk_items\n\t\t      WHERE " . getCompanyPerms("item_company_id", NULL, PERM_READ) . "\n\t\t      ORDER BY item_requestor";
    $requestor_list = db_loadHashList($sql);
    if (!$_REQUEST['project_id']) {
        $selectors[] = "<td align=\"right\"><label for=\"requestor\">" . $AppUI->_('Requestor') . ":</label></td><td>" . arraySelect(arrayMerge(array('-1' => $AppUI->_('All')), $requestor_list), 'requestor', 'size="1" id="requestor" class="text" onchange="changeList()"', $requestor) . "</td>";
    }
}
$where = getItemPerms();
if (count($tarr)) {
    $where .= 'AND (' . implode("\n AND ", $tarr) . ') ';
}
$sql = "SELECT hi.*,\n        CONCAT(co.contact_first_name,' ',co.contact_last_name) assigned_fullname,\n        co.contact_email as assigned_email,\n        p.project_id,\n        p.project_name,\n        p.project_color_identifier\n        FROM helpdesk_items hi\n        LEFT JOIN users u2 ON u2.user_id = hi.item_assigned_to\n        LEFT JOIN contacts co ON u2.user_contact = co.contact_id\n        LEFT JOIN projects p ON p.project_id = hi.item_project_id\n        WHERE {$where}\n        ORDER BY ";
// Do custom order by if needed, default at the end
if ($orderby == "project_name") {
    $sql .= "p.project_name";
} elseif ($orderby == "item_assigned_to") {
    $sql .= "assigned_fullname";
} elseif ($orderby == "item_updated") {
    $sql .= "hi.item_updated";
} else {
    $sql .= "hi.{$orderby}";
}
// Ascending or Descending
Exemple #2
0
}
$AppUI->savePlace();
if (isset($_GET['tab'])) {
    $AppUI->setState('HelpDeskIdxTab', $_GET['tab']);
}
$tab = $AppUI->getState('HelpDeskIdxTab') !== NULL ? $AppUI->getState('HelpDeskIdxTab') : 0;
// Setup the title block
$titleBlock = new CTitleBlock('Help Desk', 'helpdesk.png', $m, 'ID_HELP_HELPDESK_IDX');
if ($canEdit) {
    $titleBlock->addCell('<input type="submit" class="button" value="' . $AppUI->_('new item') . '" />', '', '<form action="?m=helpdesk&a=addedit" method="post">', '</form>');
}
$titleBlock->addCrumb("?m=helpdesk", 'home');
$titleBlock->addCrumb("?m=helpdesk&a=list", 'list');
$titleBlock->addCrumb("?m=helpdesk&a=reports", 'reports');
$titleBlock->show();
$item_perms = getItemPerms();
$sql = "SELECT COUNT(item_id)\n        FROM helpdesk_items\n        WHERE {$item_perms}";
$numtotal = db_loadResult($sql);
/*
 * Unassigned = 0
 * Open = 1
 * Closed = 2
 * On hold = 3
 * Delete = 4
 * Testing = 5
 */
$sql = "SELECT COUNT(DISTINCT(item_id))\n        FROM \n        \thelpdesk_items\n        WHERE \n        \titem_assigned_to=" . $AppUI->user_id . "\n        \tAND (item_status != 2)";
$nummine = db_loadResult($sql);
$sql = "SELECT COUNT(DISTINCT(item_id))\n        FROM \n        \thelpdesk_items\n        \tLEFT JOIN helpdesk_item_status on helpdesk_items.item_id = helpdesk_item_status.status_item_id\n        WHERE \n        \tstatus_code = 0\n            AND item_status <> 2\n            AND (TO_DAYS(NOW()) - TO_DAYS(status_date) = 0)\n        \tAND {$item_perms}";
$numopened = db_loadResult($sql);
$sql = "SELECT COUNT(DISTINCT(item_id))\n        FROM \n        \thelpdesk_items\n        \tLEFT JOIN helpdesk_item_status on helpdesk_items.item_id = helpdesk_item_status.status_item_id\n        WHERE \n        \titem_status=2\n        \tAND status_code=11\n        \tAND (TO_DAYS(NOW()) - TO_DAYS(status_date) = 0)\n          AND {$item_perms}";
            ?>
				</ul>
            </div>
        </div>
        <div class="panel panel-primary">
            <div class="panel-heading">
				<span class="panel-title">Items &amp; Equipment Permissions</span>
				<div class="pull-right">
					<button type='button' title="Minimize Item &amp; Equipment Permissions" class='minimize btn btn-success'><span class='glyphicon glyphicon-chevron-up'></span></button>
					<button type='button' ref='getItemPerms' rel='itemPermList' class='refresh btn btn-success'><span class='glyphicon glyphicon-refresh'></span></button>
				</div>			
			</div>
            <div class="panel-body" id="itemList">
				<ul class="list-group" id="itemPermList">
				<?php 
            getItemPerms();
            ?>
				</ul>
            </div>
        </div>

    </div>

    <div class="col-xs-6">
        <div class="panel panel-primary">
            <div class="panel-heading">
				<span class="panel-title">Add View Permissions</span>
				<div class="pull-right">
					<button type='button' title="Minimize Add View Permissions" class='minimize btn btn-success'><span class='glyphicon glyphicon-chevron-up'></span></button>
				</div>		
			</div>
Exemple #4
0
        $AppUI->setMsg('Access denied', UI_MSG_ERROR);
        $AppUI->redirect();
    }
}
$AppUI->savePlace();
if (isset($helpdeskItemTask['task_log_date'])) {
    $date = new CDate($helpdeskItemTask['task_log_date']);
} else {
    if (isset($_GET['date'])) {
        $date = new CDate($_GET['date']);
    } else {
        $date = new CDate();
    }
}
// get user -> help desk items
$sql = "\r\nSELECT h.*, p.project_name, c.company_name, c.company_id\r\nFROM helpdesk_items h\r\nLEFT JOIN projects p ON h.item_project_id = p.project_id \r\nLEFT JOIN companies c ON h.item_company_id = c.company_id\r\nWHERE " . getItemPerms() . "\r\nORDER by p.project_name, h.item_title\r\n";
//echo "<pre>$sql</pre>";
$res = db_exec($sql);
echo db_error();
$helpdeskItemTasks = array();
$project = array();
$companies = array();
while ($row = db_fetch_assoc($res)) {
    // collect help desk items in js format
    $helpdeskItemTasks[$row['item_id']] = "[{$row['item_project_id']},{$row['item_id']},'" . addslashes($row['item_title']) . "',{$row['item_company_id']}]";
    // collect projects in js format
    $projects[$row['item_project_id']] = "[{$row['company_id']},{$row['item_project_id']},'" . addslashes($row['project_name']) . "']";
    // collect companies in normal format
    $companies[$row['item_company_id']] = $row['company_name'];
}
//echo '<pre>';print_r($companies);echo '</pre>';
function vw_idx_handler($type)
{
    global $m, $ipr, $ist, $AppUI;
    $where = $date_field_name = $date_field_title = "";
    switch ($type) {
        case 0:
            // Opened
            $date_field_title = $AppUI->_('Opened On');
            $date_field_name = "item_created";
            $where .= "(TO_DAYS(NOW()) - TO_DAYS(hi.item_created) = 0)\n\t\t             AND his.status_code = 0 and hi.item_status <> 2";
            break;
        case 1:
            // Closed
            $date_field_title = $AppUI->_('Closed On');
            $date_field_name = "status_date";
            $where .= "item_status=2\n        \t     AND status_code=11\n        \t     AND (TO_DAYS(NOW()) - TO_DAYS(status_date) = 0)";
            break;
        case 2:
            // Mine
            $date_field_title = $AppUI->_('Opened On');
            $date_field_name = "item_created";
            $where .= "item_assigned_to={$AppUI->user_id}\n                 AND item_status !=2\n                 AND his.status_code = 0";
            break;
        default:
            print "Shouldn't be here (for now)";
            exit(1);
    }
    $df = $AppUI->getPref('SHDATEFORMAT');
    $tf = $AppUI->getPref('TIMEFORMAT');
    $format = $df . " " . $tf;
    /*
     * Unassigned = 0
     * Open = 1
     * Closed = 2
     * On hold = 3
     * Delete = 4
     * Testing = 5
     */
    $item_perms = getItemPerms();
    $sql = "SELECT hi.*,\n          CONCAT(co.contact_first_name,' ',co.contact_last_name) assigned_fullname,\n          co.contact_email as assigned_email,\n          p.project_id,\n          p.project_name,\n          p.project_color_identifier,\n          his.status_date\n          FROM helpdesk_items hi\n          LEFT JOIN helpdesk_item_status his ON his.status_item_id = hi.item_id\n          LEFT JOIN users u ON u.user_id = hi.item_assigned_to\n          LEFT JOIN contacts co ON co.contact_id = u.user_contact\n          LEFT JOIN projects p ON p.project_id = hi.item_project_id\n          WHERE {$where}\n          AND {$item_perms}\n          GROUP BY item_id\n          ORDER BY item_id";
    $items = db_loadList($sql);
    ?>
  <table cellspacing="1" cellpadding="2" border="0" width="100%" class="tbl">
  <tr>
    <th><?php 
    echo $AppUI->_('Number');
    ?>
</th>
    <th><?php 
    echo $AppUI->_('Requestor');
    ?>
</th>
    <th><?php 
    echo $AppUI->_('Title');
    ?>
</th>
    <th nowrap="nowrap"><?php 
    echo $AppUI->_('Assigned To');
    ?>
</th>
    <th><?php 
    echo $AppUI->_('Status');
    ?>
</th>
    <th><?php 
    echo $AppUI->_('Priority');
    ?>
</th>
    <th><?php 
    echo $AppUI->_('Updated');
    ?>
</th>
    <th><?php 
    echo $AppUI->_('Project');
    ?>
</th>
    <th nowrap="nowrap"><?php 
    echo $date_field_title;
    ?>
</th>
  </tr>
  <?php 
    foreach ($items as $row) {
        /* We need to check if the user who requested the item is still in the
           system. Just because we have a requestor id does not mean we'll be
           able to retrieve a full name */
        if ($row[$date_field_name]) {
            $date = new CDate($row[$date_field_name]);
            $tc = $date->format($format);
        } else {
            $tc = '';
        }
        if ($row['status_date']) {
            $datesd = new CDate($row['status_date']);
            $sd = $datesd->format($format);
        } else {
            $sd = ' ';
        }
        ?>
    <tr>
      <td nowrap="nowrap"><b><a href="?m=helpdesk&a=view&item_id=<?php 
        echo $row['item_id'];
        ?>
"><?php 
        echo $row['item_id'];
        ?>
</a></b>
          <?php 
        echo dPshowImage(dPfindImage('ct' . $row["item_calltype"] . '.png', 'helpdesk'), 15, 17, '');
        ?>
</td>
      <td nowrap=\"nowrap\">
      <?php 
        if ($row["item_requestor_email"]) {
            print "<a href=\"mailto: " . $row["item_requestor_email"] . "\">" . $row['item_requestor'] . "</a>";
        } else {
            print $row['item_requestor'];
        }
        ?>
      </td>
      <td width="80%"><a href="?m=helpdesk&a=view&item_id=<?php 
        echo $row['item_id'];
        ?>
"><?php 
        echo $row['item_title'];
        ?>
</a></td>
      <td align="center" nowrap="nowrap">
      <?php 
        if ($row['assigned_email']) {
            print "<a href='mailto:{$row['assigned_email']}'>{$row['assigned_fullname']}</a>";
        } else {
            print $row['assigned_fullname'] ? $row['assigned_fullname'] : "-";
        }
        ?>
      </td>
      <td align="center" nowrap><?php 
        echo $AppUI->_($ist[@$row["item_status"]]);
        ?>
</td>
      <td align="center" nowrap><?php 
        echo $AppUI->_($ipr[@$row["item_priority"]]);
        ?>
</td>
      <td align="center" nowrap><?php 
        echo @$sd;
        ?>
</td>
      <td align="center" style="background-color: #<?php 
        echo $row['project_color_identifier'];
        ?>
;" nowrap>
      <?php 
        if ($row['project_id']) {
            ?>
        <a href="./index.php?m=projects&a=view&project_id=<?php 
            echo $row['project_id'];
            ?>
" style="color: <?php 
            echo bestColor($row["project_color_identifier"]);
            ?>
;"><?php 
            echo $row['project_name'];
            ?>
</a>
      <?php 
        } else {
            ?>
        -
      <?php 
        }
        ?>
      </td>
      <td nowrap="nowrap"><?php 
        print $tc;
        ?>
</td>
    </tr>
  <?php 
    }
    ?>
  </table>
<?php 
}