PDA

View Full Version : Current Helpdesk CVS


cookm
28-05-05, 03:02 AM
The current helpdesk cvs seems to rely on the users list to populate requestors instead of contacts, which all previous versions did. I needed the ability for contacts to fill it, since the user list populates the watchers/assigned to: fields as well. I filter out my userlist to just the support department, since those are the only pertitant people who need to be watchers or have tickets assigned to them.

The ability to use contacts seemed half adapted; the html was commented out, and the function was only half written in helpdesk.function.php. I didn't want to put this in mantis since it's not a bug with core functionality, but here's my fixes to make this work.

addedit.php:


insert below line 37:
$contacts = getAllowedContacts();

insert below line 130:
function popContactDialog() {
window.open('./index.php?m=helpdesk&a=selector&callback=setUserRequestor&table=contacts&dialog=1', 'selector', 'left=50,top=50,height=250,width=400,resizable,scr ollbars=yes')
}

insert below line 159:
function setContactRequestor( key, val ) {
var f = document.frmHelpDeskItem;

if (val != '') {
setRequestor( key, val );
f.item_requestor_type.value = 2
}
}

Comment out line 278, using <!-- -->
Uncomment out line 279, removing the <!-- -->



in helpdesk.functions.php

add this after line 14:
function getAllowedContacts(){
global $HELPDESK_CONFIG;
//populate user list with all users from permitted companies
$sql = "SELECT user_id, CONCAT(contact_last_name, ',', contact_first_name)
FROM users
LEFT JOIN contacts ON user_contact = contact_id
WHERE ". getCompanyPerms("user_company", PERM_EDIT, $HELPDESK_CONFIG['the_company'])
." OR ". getCompanyPerms("contact_company", PERM_EDIT, $HELPDESK_CONFIG['the_company'])

. "ORDER BY contact_last_name, contact_first_name";
$contacts = db_loadHashList( $sql );
return $contacts;
}


and in selector.php

insert this after line 104:
case 'contacts':
/* $select = "user_contact,CONCAT_WS(' ',contact_first_name,contact_last_name)";
$order = 'contact_last_name, contact_first_name';
// $where = getCompanyPerms("contact_company", NULL, PERM_EDIT);
*/
$title = 'Contacts';
$templist = getAllowedContacts();
foreach($templist as $key=>$value){
$list[$key]=$value;
}
break;


That should do it!

jbresler
02-06-05, 05:31 AM
I tried this fix, but it's not working for me. I get the contacts button, but I still only see users and not contacts. Any Ideas on what I'm doing wrong?