Hi All,
I managed to hack something together that works for me (I'm using IMAP).
I'm sure some of the elements could be streamlined or make better use of existing functions, but it works for me.
Description: Adds the ability for staff to be able to reply via email to tickets.
Works best if the reply separator is added to the top of staff notification emails.
*** Please check later in the thread for updated versions of the mod ***
Please see below 'diff' listed between the original and my modded files.
If anyone has issues integrating them I'm happy to post some download links to a zip containing the two modded files.
include/class.ticket.php
diff class.ticket.orig class.ticket.php
1544c1544,1552
< $poster = $thisstaff?$thisstaff->getName():'SYSTEM (Canned Reply)';
---
> if(!$vars){
> $poster = $thisstaff?$thisstaff->getName():'SYSTEM (Canned Reply)';
> $msgstaff = $thisstaff?$thisstaff->getId();
> $msgip = $thisstaff?$thisstaff->getIP():'';
> } else {
> $poster = $vars;
> $msgstaff = $vars;
> $msgip = $_SERVER;
> }
1551c1559
< .' ,staff_id='.db_input($thisstaff?$thisstaff->getId())
---
> .' ,staff_id='.db_input($msgstaff)
1553c1561
< .' ,ip_address='.db_input($thisstaff?$thisstaff->getIP():'');
---
> .' ,ip_address='.db_input($msgip);
1952,1953d1959
< if($email)
< $sql.=' AND email='.db_input($email);
1954a1961,1965
> if($email)
> $staffsql = 'SELECT email FROM '.STAFF_TABLE.' WHERE email='.db_input($email);
> if(($staffres=db_query($staffsql)) && (db_num_rows($staffres) == 0)){
> $sql.=' AND email='.db_input($email);
> }
1956c1967
< list($id)=db_fetch_row($res);
---
> list($id)=db_fetch_row($res);
include/class.mailfetch.php
diff class.mailfetch.orig class.mailfetch.php
401a402,403
> $staffsql = 'SELECT staff_id, firstname, lastname, email FROM '.STAFF_TABLE.' WHERE email='.db_input($vars).' LIMIT 1';
> if(($staffres=db_query($staffsql)) && (db_num_rows($staffres) == 0)){
403a406,417
> } else {
> $staffvars=db_fetch_row(db_query($staffsql));
> $replyvars=Array(
> "msgId" => $ticket,
> "response" => $vars,
> "name" => $staffvars.' '.$staffvars,
> "staffid" => $staffvars,
> );
> $errors=array();
> if(!($msgid=$ticket->postReply($replyvars, $errors)))
> return false;
> }
If anyone has any suggestions, issues or modifications I would be happy to hear them.