Commit c76d12b6 authored by Jean-Paul Saman's avatar Jean-Paul Saman

import of helpdesk module version 0.8

This diff is collapsed.
2009-07-16 - Field "Hours worked" added to helpdesk item edit form. Can be used to log spent time when creating new item
2009-07-20 - permissions related updates
2009-07-22 - notification system redesigned to be more flexible and to minimize emails sent:
- only one email is sent when tasklog modified status/calltype/etc.
- unified email format for tasklogs and ticket modifications emails
- if ticket is created and remain Unassigned email is sent
to an address defined in helpdesk configuration in case of email notification required
- added configuration radioboxes to choose whether watchers / requestor
are notified about all logs or only about status changes (incl. requestor change & calltype change)
- emails are not sent to current user
- if ticket is created by an user from non-helpdesk company, the user is filled-in as requestor
- localization applied on notification texts ( I hope everywhere )
2009-07-24 - when adding watchers notifications were not send always correctly. Unified with another notification emails.
\ No newline at end of file
This diff is collapsed.
if (!defined('W2P_BASE_DIR')) {
die('You should not access this file directly');
global $AppUI;
* This is a horrible ugly hack.. we need to rethink how we do contact lookups, etc.
$contact_id = (int) w2PgetParam( $_POST, 'contact_id', 0 );
$helpdesk = new CHelpDesk();
echo $helpdesk->lookup_contact($contact_id);
<?php /* HELPDESK $Id$ */
if (!defined('W2P_BASE_DIR')) {
die('You should not access this file directly.');
$del = w2PgetParam($_POST, 'del', 0);
$isNotNew = $_POST['task_log_id'];
$perms = &$AppUI->acl();
if ($del) {
if (!$perms->checkModule('task_log', 'delete')) {
} elseif ($isNotNew) {
if (!$perms->checkModule('task_log', 'edit')) {
} else {
if (!$perms->checkModule('task_log', 'add')) {
$obj = new CTask_Log();
if (!$obj->bind($_POST)) {
$AppUI->setMsg($obj->getError(), UI_MSG_ERROR);
$redir='m=helpdesk&a=view&tab=0&item_id=' . $obj->task_log_help_desk_id;
$AppUI->setMsg('Task Log');
if ($del) {
if (($msg = $obj->delete())) {
$AppUI->setMsg($msg, UI_MSG_ERROR);
} else {
$AppUI->setMsg('deleted', UI_MSG_ALERT);
This diff is collapsed.
<?php /* HELPDESK $Id: export.php v 0.1*/
if (!defined('W2P_BASE_DIR')) {
die('You should not access this file directly');
include_once 'helpdesk.functions.php';
//KZHAO 10-24-2006
global $HELPDESK_CONFIG, $w2Pconfig;
$item_id = (int) w2PgetParam($_GET, 'item_id', 0);
// Pull data
$q = new w2p_Database_Query;
$q->addWhere('item_id = ' . $item_id);
$hditem = $q->loadHash();
// Check permissions for this record
if ($item_id) {
// Already existing item
$canEdit = $perms->checkModule($m, 'edit') && hditemEditable($hditem);
} else {
echo "Cannot find the item id!";
if (!$canEdit) {
//KZHAO 10-24-2006
//Load helpdesk item
$org_hditem = new CHelpDesk();
$org_hditem->load( $item_id );
//Check required information before export
if (!@$hditem["item_project_id"]) {
$AppUI->setMsg( "Project must be specified for this item before exporting to task!" , UI_MSG_ERROR );
//KZHAO 7-10-2007
// Item with associated task cannot be exported
if (@$hditem["item_task_id"]) {
$AppUI->setMsg( "Item with associated task cannot be exported to another task!" , UI_MSG_ERROR );
//KZHAO 10-24-2006
// Check status
if ($ist[@$hditem["item_status"]]=="Closed") {
$AppUI->setMsg( "Closed helpdesk items cannot be exported to tasks!" , UI_MSG_ERROR );
if (!@$hditem["item_assigned_to"] && $HELPDESK_CONFIG['default_assigned_to_current_user']) {
@$hditem["item_assigned_to"] = $AppUI->user_id;
@$hditem["item_status"] = 1;
if (!@$hditem["item_company_id"] && $HELPDESK_CONFIG['default_company_current_company']) {
@$hditem["item_company_id"] = $AppUI->user_company;
// Setup the title block
$df = $AppUI->getPref('SHDATEFORMAT');
$tf = $AppUI->getPref('TIMEFORMAT');
$item_date = new w2p_Utilities_Date( $hditem["item_created"] );
$deadline_date = new w2p_Utilities_Date( $hditem["item_deadline"] );
$tc = $item_date->format( "$df $tf" );
$dateNow = new w2p_Utilities_Date();
$dateNowSQL = $dateNow->format( FMT_DATETIME_MYSQL );
$newTask = new CTask();
$ref_task ="This task was created from Helpdesk item #".$item_id.".\n";
$ref_task.= "-----------------------\n";
if (@$hditem["item_priority"]==0 || @$hditem["item_priority"]==2) {
} elseif (@$hditem["item_priority"]==1) {
} else {
$hditem["item_deadline"] = (isset($hditem["item_deadline"])) ? $hditem["item_deadline"] : $dateNowSQL;
$taskInfo= array( "task_id"=>0,
"task_name"=> @$hditem["item_title"],
"task_project"=> @$hditem["item_project_id"],
"task_start_date"=> $dateNowSQL,
"task_owner"=> $AppUI->user_id,
"task_description"=> $ref_task.@$hditem["item_summary"],
"task_contacts" => @$hditem["item_requestor_id"],
"task_related_url"=> $w2Pconfig['base_url']."/index.php?m=helpdesk&a=view&item_id=".$item_id
echo "<br><br>";
$result= $newTask->bind( $taskInfo);
if (!$result) {
$AppUI->setMsg( $newTask->getError(), UI_MSG_ERROR );
$result = $newTask->store();
if (is_array($result)) {
$AppUI->setMsg( $msg, UI_MSG_ERROR );
$AppUI->redirect(); // Store failed don't continue?
} else {
$ref_hd ="This helpdesk item has been exported to task #".$newTask->task_id.".\n";
$ref_hd.="Link: ".$w2Pconfig['base_url']."/index.php?m=tasks&a=view&task_id=".$newTask->task_id."\n";
$result = $org_hditem->store();
if (is_array($result)) {
$AppUI->setMsg( $msg, UI_MSG_ERROR );
$newTask->updateAssigned($hditem["item_assigned_to"], array($hditem["item_assigned_to"] => 100));
$AppUI->setMsg( 'Task added!', UI_MSG_OK);
-- Upgrade script for helpdesk module
-- Use this script only if you have already installed helpdesk module into dotproject.
-- Kang 12/19/2006
-- The LinuxBox Corp.
-- Ann Arbor, MI
ALTER TABLE helpdesk_items ADD item_updated datetime DEFAULT NULL;
ALTER TABLE helpdesk_items ADD item_deadline datetime DEFAULT NULL;
This diff is collapsed.
This diff is collapsed.
<?php /* TASKS $Id: helpdesk_tab.view.files.php 5771 2008-07-15 14:41:58Z merlinyoda $ */
if (!defined('W2P_BASE_DIR')) {
die('You should not access this file directly.');
GLOBAL $AppUI, $project_id, $task_id, $helpdesk_id, $deny, $canRead, $canEdit, $w2Pconfig, $cfObj, $m, $obj;
global $allowed_folders_ary, $denied_folders_ary, $limited;
$cfObj = new CFileFolder();
$allowed_folders_ary = $cfObj->getAllowedRecords($AppUI->user_id);
$denied_folders_ary = $cfObj->getDeniedRecords($AppUI->user_id);
$limited = ((count( $allowed_folders_ary ) < $cfObj->countFolders()) ? true : false);
if (!$limited) {
$canEdit = true;
} elseif ($limited && array_key_exists($folder, $allowed_folders_ary)) {
$canEdit = true;
} else {
$canEdit = false;
$showProject = false;
if (getPermission('files', 'edit')) {
echo ('<a href="./index.php?m=files&a=addedit&project_id=' . $project_id . '&file_helpdesk_item=' . $helpdesk_id
. '&file_task=' . $task_id . '">' . $AppUI->_('Attach a file') . '</a>');
echo w2PshowImage('stock_attach-16.png', 16, 16, '', '', $m);
$canAccess_folders = getPermission('file_folders', 'access');
if ($canAccess_folders) {
$folder = w2PgetParam($_GET, 'folder', 0);
require( W2P_BASE_DIR . '/modules/files/folders_table.php' );
} elseif (getPermission('files', 'view')) {
require( W2P_BASE_DIR . '/modules/files/index_table.php' );

257 Bytes


892 Bytes


611 Bytes


257 Bytes


574 Bytes


268 Bytes


273 Bytes


858 Bytes

<html><body bgcolor="#FFFFFF"></body></html>
\ No newline at end of file
<html><body bgcolor="#FFFFFF"></body></html>
\ No newline at end of file
<?php /* HELPDESK $Id$ */
if (!defined('W2P_BASE_DIR')) {
die('You should not access this file directly');
include_once 'helpdesk.functions.php';
// check permissions for this module
$canReadModule = canView( $m );
if (!$canReadModule) {
if (isset( $_GET['tab'] )) {
$AppUI->setState( 'HelpDeskIdxTab', $_GET['tab'] );
$tab = $AppUI->getState( 'HelpDeskIdxTab' ) !== NULL ? $AppUI->getState( 'HelpDeskIdxTab' ) : 0;
// Setup the title block
$titleBlock = new w2p_Theme_TitleBlock( 'Help Desk', 'helpdesk.png', $m, 'ID_HELP_HELPDESK_IDX' );
if (hditemCreate()) {
'<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' );
$item_perms = getItemPerms();
$q = new w2p_Database_Query;
$numtotal = $q->loadResult ();
* Unassigned = 0
* Open = 1
* Closed = 2
* On hold = 3
* ....
$item_perms = getItemPerms();
$q = new w2p_Database_Query;
$q->addWhere('item_assigned_to=' . $AppUI->user_id . ' AND (item_status != 2)');
$nummine = $q->loadResult ();
$q = new w2p_Database_Query;
$q->addJoin('helpdesk_item_status','his','helpdesk_items.item_id = his.status_item_id');
$q->addWhere('item_status = 1 AND status_code = 0 ');
$q->addWhere($item_perms . ' AND (TO_DAYS(NOW()) - TO_DAYS(status_date) = 0)');
$numopened = $q->loadResult ();
$q = new w2p_Database_Query;
$q->addJoin('helpdesk_item_status','his','helpdesk_items.item_id = his.status_item_id');
$q->addWhere('item_status = 2 AND status_code = 11 ');
$q->addWhere($item_perms . ' AND (TO_DAYS(NOW()) - TO_DAYS(status_date) = 0)');
$numclosed = $q->loadResult();
<table cellspacing="0" cellpadding="2" border="0" width="100%">
<td width="80%" valign="top">
// Tabbed information boxes
$tabBox = new CTabBox( '?m=helpdesk', W2P_BASE_DIR . '/modules/helpdesk/', $tab );
$tabBox->add( 'vw_idx_stats', $AppUI->_('Help Desk Items')." ($numtotal)" );
$tabBox->add( 'vw_idx_my', $AppUI->_('My Open')." ($nummine)" );
$tabBox->add( 'vw_idx_new', $AppUI->_('Opened Today')." ($numopened)" );
$tabBox->add( 'vw_idx_closed', $AppUI->_('Closed Today')." ($numclosed)" );
$tabBox->add( 'vw_idx_watched', "Watched Tickets" );
This diff is collapsed.
'new log',
'Add Log',
'Adding Help Desk Item',
'All (not closed)',
'All Companies and All Projects',
'All Helpdesk task log entries',
'All users',
'Assigned To',
'Attach a file',
'Call Source',
'Call Type',
'Closed On',
'Closed Today',
'Configure Help Desk Module',
'Cost Code',
'Created by',
'Date Created',
'Default Actions',
'Delete this item',
'Edit log',
'Edit this item',
'Editing Help Desk Item',
'Email Notification',
'Feature Request',
'For period',
'Help Desk',
'Help Desk Item',
'Help Desk Item ID is NULL',
'Help Desk Items',
'Helpdesk Reports',
'Helpdesk Task Log Report',
'Helpdesk Task Logs',
'Helpdesk task log entries from',
'Hours Worked',
'Ignore 0 hours',
'In Person',
'Invalid item id',
'IsNowWatched'=>'has been added to your watch list.',
'Item Created',
'Item Details',
'Item History',
'Log All',
'Make PDF',
'My Open',
'New Helpdesk Log',
'New Item',
'New Item Default Selections',
'New Log',
'Next Day',
'Next Month',
'Next Week',
'No Impact',
'Not Specified',
'Notify by e-mail',
'On Hold',
'Opened On',
'Opened Today',
'Operating System',
'Paging Options',
'Permission Options',
'Previous Day',
'Previous Month',
'Previous Week',
'Report Totals',
'Requestor E-mail',
'Requestor Phone',
'Required field',
'Search Fields On Item List',
'Task Log',
'Task Logs',
'This helpdesk item has been exported to task',
'This task is exported from Helpdesk item',
'Ticket Detail',
'Ticket ID',
'Title/Summary Search',
'Updated Today',
'View this item',
'Viewing Help Desk Item',
'Watched'=>'now being watched',
'Watched Tickets',
'Watchers Notification',
'Without Project',
'cannot be opened',
'cannot be written to',
'changed from',
'create task log',
'delete this item',
'edit this item',
'export this item to task',
'has been successfully updated',
'helpdeskDefCompany'=>'Default \"company\" field to be that of the current user',
'helpdeskDefCurUser'=>'Default \"assigned to\" field to be the current user',
'helpdeskDefNotify'=>'Default the \"notify by email\" field to on',
'helpdeskDefThisUser'=>'Default \"assigned to\" field to be this user',
'helpdeskFieldMessage'=>'If you select your name from the popup window, your e-mail address and phone number will be populated from your account details (if available).',
'helpdeskHDCompany'=>'The company which handles Help Desk items',
'helpdeskHDDepartment'=>'The department which handles Help Desk items',
'helpdeskItemsNoCompany'=>'Items with no company should be editable by anyone',
'helpdeskItemsPerPage'=>'Number of items displayed per page on the list view',
'helpdeskLogsPerPage'=>'Number of status log items displayed per page in item view',
'helpdeskMinLevel'=>'Minimum user level to edit other users\' logs',
'helpdeskMinRepLevel'=>'Minimum user level to view reports',
'helpdeskPagesPerSide'=>'Number of pages to display on each side of current page',
'helpdeskSignature'=>'The IT Department',
'helpdeskSubmitError'=>'You must enter the following value(s)',
'helpdeskUseProjectPerms'=>'Project list based on Project, as opposed to Company, permissions.',
'is not writable',
'new item',
'update task log',
'value for the previous buttons',
'view this item',
'Add Log'=>'Ajouter une action',
'Adding Help Desk Item'=>'Ajout d\'une demande d\'assistance',
'All (not closed)'=>'Tous (non fermés)',
'All Companies and All Projects'=>'Toutes les sociétés et tous les projets',
'All Helpdesk task log entries'=>'Tout le temps passé pour assistance',
'All users'=>'Tous',
'Assigned To'=>'Assignée à ',
'Attach a file'=>'Joindre un fichier',
'Call Source'=>'Source de l\'appel',
'Call Type'=>'Type d\'appel',
'Closed On'=>'Fermée le',
'Closed Today'=>'Fermées aujourd\'hui',
'Configure Help Desk Module'=>'Configurer le module d\'assistance',
'Cost Code'=>'C.Coût',
'Created by'=>'Créée par',
'Date Created'=>'Date de création',
'Default Actions'=>'Actions',
'Delete this item'=>'Supprimer cette demande d\'assistance',
'Edit log'=>'Editer l\'action',
'Edit this item'=>'Editer cette demande d\'assistance',
'Editing Help Desk Item'=>'Edition de la demande d\'assistance',
'Email Notification'=>'Informer par courriel',
'Feature Request'=>'Demande de fonctionalité',
'For period'=>'Pour la période',
'Help Desk'=>'Centre d\'assistance',
'Help Desk Item'=>'Demande d\'assistance',
'Help Desk Item ID is NULL'=>'L\'ID de la demande est nulle',
'Help Desk Items'=>'Demandes d\'assistance',
'Helpdesk Reports'=>'Rapports de demandes d\'assistance',
'Helpdesk Task Log Report'=>'Rapport de temps passé pour assistance',
'Helpdesk Task Logs'=>'Temps passé pour assistance',
'Helpdesk task log entries from'=>'Temps passé pour assistance du',
'Hours Worked'=>'Heures travaillées',
'Ignore 0 hours'=>'Ignorer les heures à 0',
'In Person'=>'En personne',
'Invalid item id'=>'ID de demande invalide',
'IsNowWatched'=>'A été ajoutée à votre liste de surveillance.',
'Item Created'=>'Demande créée',
'Item Details'=>'Détails de la demande',
'Item History'=>'Historique de la demande',
'Log All'=>'Montrer tout',
'Make PDF'=>'Générer en PDF',
'My Open'=>'Mes demandes ouvertes',
'New Helpdesk Log'=>'Nouvelle action',
'New Item'=>'Nouvelle demande',
'New Item Default Selections'=>'Sélection par défaut pour nouvelle demande',
'New Log'=>'Nouveau temps',
'Next Day'=>'Jour suivant',
'Next Month'=>'Mois suivant',
'Next Week'=>'Semaine suivante',
'No Impact'=>'Aucun Impact',
'Not Specified'=>'Non spécifié',
'Notify by e-mail'=>'Informer par courriel',
'On Hold'=>'En Attente',
'Opened On'=>'Ouverte le',
'Opened Today'=>'Ouvertes aujourd\'hui',
'Operating System'=>'Système d\'exploitation',
'Paging Options'=>'Options de pagination',
'Permission Options'=>'Options d\'authorisation',
'Previous Day'=>'Jour précédent',
'Previous Month'=>'Mois précédent',
'Previous Week'=>'Semaine précédente',
'Report Totals'=>'Totaux',
'Requestor E-mail'=>'Courriel du demandeur',
'Requestor Phone'=>'Téléphone du demandeur',
'Required field'=>'Champ obligatoire',
'Search Fields On Item List'=>'Rechercher les champs dans la liste de demandes',
'Task Log'=>'Temps passé',
'Task Logs'=>'Temps passé',
'Testing'=>'En cours de test',
'This helpdesk item has been exported to task'=>'Cette demande a été transformée dans la tâche',
'This task is exported from Helpdesk item'=>'Cette demande a été transformée de la demande',
'Ticket Detail'=>'Détails de la demande',
'Ticket ID'=>'Demande #',
'Title/Summary Search'=>'Recherche Titre/Résumé',
'Update'=>'Mise à jour',
'Updated'=>'mise à jour',
'Updated Today'=>'Mise à jour aujourd\'hui\'',
'View this item'=>'Voir cette demande',
'Viewing Help Desk Item'=>'Visualisation de la demande d\'assistance',
'Watched'=>'maintenant surveillée',
'Watched Tickets'=>'Demandes surveillées',
'Watchers Notification'=>'Avis de surveillance',
'Without Project'=>'Sans projet',
'cannot be opened'=>'impossible d\'ouvrir',
'cannot be written to'=>'impossible d\'écrire',
'changed from'=>'changé depuis',
'create task log'=>'créer une action',
'delete this item'=>'Supprimer cette demande',