Hari ini saya menyadari bahwa jika staf membuka tiket baru dari panel staf di Sistem osTicket, maka nilai dari help topic selalu blank tersimpan di tabel ticket, sedangkan jika klien membuka tiket baru, maka nilai dari help topic ini tersimpan sebagaimana mestinya di tabel ticket tersebut. Jadi, saya membuat modifikasi agar pilihan help topic muncul di form new ticket di panel staf. Ketika staf memilih salah satu dari item help topic melalui combobox, maka nilai department yang terkait dengan help topic yang terpilih akan otomatis terpilih juga. Modifikasi ini merupakan versi pengembangan dari modifikasi yang dibuat oleh michael.therrien di Forum osTicket. Perbedaan utama antara modifikasi yang dilakukan oleh michael.therrein’s dan yang saya lakukan adalah: topicId disimpan di tabel, sedangkan modifikasi yang saya buat adalah deskripsi topik disimpan di tabel mengikuti aturan default yang dibuat oleh osTicket.
-
Buka file \include\staff\newticket.inc.php, lalu cari kode ini:
55 56
<tr> <td align="left"><b>Department:</b></td>
sebelum baris pertama dari kode tersebut, sisipkan baris kode berikut:
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
<?php // Begin of Help Topic MOD by Masino Sinaga, October 13, 2009 ?> <tr> <td align="left"><b>Help Topic:</b></td> <td> <select name="topicId" onchange="autopopulateDeptPrio(this.form)"> <option value="" selected >Select Help Topic</option> <?php $i=0; $services= db_query('SELECT topic_id,topic FROM '.TOPIC_TABLE.' WHERE isactive=1 ORDER BY topic'); while (list($topicId,$topic) = db_fetch_row($services)){ $TopicArr[$i] = $topicId; $selected = ($info['topicId']==$topicId)?'selected':''; ?> <option value="<?=$topicId?>" <?=$selected?>><?=$topic?></option> <?php $i++; }; ?> </select> <font class="error">* <?=$errors['topicId']?></font> </td> </tr> <?php // End of Help Topic MOD by Masino Sinaga, October 13, 2009 ?>
Cari lagi kode ini masih pada file yang sama:
164
<script type="text/javascript">
Sebelum baris pertama dari kode tadi, sisipkan kode berikut ini:
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177
<?//MOD by michael.therrien 7/2/09?> <SCRIPT LANGUAGE="JavaScript"> function autopopulateDeptPrio(form) { <?php $i=0; $count = count($TopicArr) - 1; while($i<=$count) { echo"if(form.topicId.value == " .$TopicArr[$i][topic_id]. "){form.deptId.value = '" .$TopicArr[$i][dept_id]. "'; form.pri.value = '" .$TopicArr[$i][priority_id]. "';}\n"; $i++; } ?> } </SCRIPT>
-
Buka file \scp\tickets.php, dan cari kode ini:
341 342 343
case 'open': $ticket=null; $_POST['emailId']=$_POST['topicId']=0; //clean crap.
lalu timpa dengan kode yang ini:
341 342 343
case 'open': $ticket=null; //$_POST['emailId']=$_POST['topicId']=0; //clean crap. // mod Help Topic by Masino Sinaga, October 13, 2009
-
Buka file \include\class.ticket.php, dan cari kode yang ini:
1053 1054 1055 1056
}elseif(strcasecmp($origin,'staff')==0){ //tickets created by staff...e.g on callins. $fields['deptId'] = array('type'=>'int', 'required'=>1, 'error'=>'Dept. required'); $fields['source'] = array('type'=>'string', 'required'=>1, 'error'=>'Indicate source'); $fields['duedate'] = array('type'=>'date', 'required'=>0, 'error'=>'Invalid date - must be MM/DD/YY');
lalu timpa dengan kode yang ini:
1053 1054 1055 1056 1057
}elseif(strcasecmp($origin,'staff')==0){ //tickets created by staff...e.g on callins. $fields['topicId'] = array('type'=>'int', 'required'=>1, 'error'=>'Select help topic please'); $fields['deptId'] = array('type'=>'int', 'required'=>1, 'error'=>'Dept. required'); $fields['source'] = array('type'=>'string', 'required'=>1, 'error'=>'Indicate source'); $fields['duedate'] = array('type'=>'date', 'required'=>0, 'error'=>'Invalid date - must be MM/DD/YY');
Cari lagi kode yang ini masih pada file yang sama:
1144 1145 1146
// OK...just do it. $deptId=$var['deptId']; //pre-selected Dept if any. $priorityId=$var['pri'];
lalu timpa dengan kode yang ini:
1144 1145 1146 1147
// OK...just do it. $deptId=$var['deptId']; //pre-selected Dept if any. $topicId=$var['topicId']; // added by Masino Sinaga, October 13, 2009 $priorityId=$var['pri'];
Cari lagi kode yang ini:
1170 1171 1172 1173
}elseif($var['deptId']){ //Opened by staff. $deptId=$var['deptId']; $source=ucfirst($var['source']); }
lalu timpa dengan kode berikut ini:
1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181
}elseif($var['deptId']){ //Opened by staff. $deptId=$var['deptId']; $source=ucfirst($var['source']); // Begin of MOD by Masino Sinaga, October 13, 2009, mod Help Topic in RC5 $topic= new Topic($topicId); $priorityId=$priorityId?$priorityId:$topic->getPriorityId(); $topicDesc=$topic->getName(); if($autorespond) $autorespond=$topic->autoRespond(); // End of MOD by Masino Sinaga, October 13, 2009, mod Help Topic in RC5 }
Itulah semuanya. Sekarang help topic, atau dalam hal ini, nilai deskripsi dari help topic akan tersimpan sebagaimana mestinya di tabel ticket ketika staf menambah tiket baru dari panel staf.

Error noticed in class.ticket.php where code must be replaced with:
Department now is not required field, so it has be:
Am I correct?
@vitalijusg
Although you may change it from 1 to 0, but I suggest you not to change it. Why? Because we have to overcome if staff member change the department value intuitively, for example after a staff member selected the help topic, then he/she intuitively change the department value become ‘Select Department’ value. So, in this case, we have to anticipate this possibility the department value change. This is a preventive action that we made.
i really needed to tell you that your forum is awesome
thank you
What’s up everyone, my name is Shaun. I’m new to the forum and just wanted to say hey. I hope I posted this in the right section!
Hello Masino,
Great tutorial however, every time I change the help Id, (the department not being selected yet) The department value gets to be automatically changed and most of the time the department selected in not the department suited for the help topic.
Any improvements?
Thanks
Hello Masino,
After further checking of the codes and testing it. I could not create a new ticket any more. All the fields are correct and no errors were commented by the system.
I hope you can find a solution for the problem.
Thanks
@Thun Chropeckorn
Make sure you have already followed all steps carefully, especially the Javascript code. Also, make sure the Javascript is enabled in your browser. I have tested that modification, and everything works fine here.
@Thun Chropeckorn
See my answer above. FYI, everything works fine here.
Tried it and works fine though the status is set as delayed and the user receives no confirmation’s email (Password Needed to Activate A Ticket in osTicket v1.6 RC5 MOD installed).
So you need to go to the ticket and reopen it if you want it to be seen and to be able to assign it.
Time to review the delay status ?
Regards
Masino,
If you have implemented the mod: “Password Needed to Activate A Ticket…”, then the default status is “delay”.
If Someone as staff enters a new ticket in its UI then it should be *opened* by default, shouldn’t it?
Also the default message in “xxx_ticket_message:message” is ‘Ticket created by staff’ (scp/tickets.php) and the message entered is in “xxx_ticket_response:response”.
OST doesn’t send an auto-answer in this case and, when you send a response to the customer, the system sends “%message” in the email instead of the real message placed in “xxx_ticket_response:response”. It’s not even sending the content of “xxx_ticket_message:message” : ‘Ticket created by staff’.
Did I do something wrong?
I know evreything is working well on your side but I’ve not your knowledge of the whole thing.
Regards
Hello Masino,
Java script is enabled. Again when creating the ticket in staff mode here is what I experience: When I select a help topic, the department value gets to be changed automatically but not the right department. For example in my help topic “General Inquiry” I assigned Reception Dept. to be the new ticket department. But when I select General Inquiry on the form it becomes Communications Dept. Then after this I try to submit it and it does not generate a new ticket. It just goes back again to the form. I tried using the following browsers: Safari, IE, and Firefox all with javascript enabled.
I hope you can help me solve this problem on version rc5.
Thanks and God Bless
@Thun Chropeckorn
Have you tried with another help topic besides “General Inquiry”? It should be fine since there is no “General Inquiry” item in this modification. Actually, “General Inquiry” is the original help topic item, and it does not have relationship to any department since the code you mentioned probably you got from the new ticket from at the client-side. CMIIW.
Hello Masino,
I did try and they are not also at pair with the department I assigned. The first general inquiry (original) was deleted long ago then I made another General Inquiry and assigned Reception Dept. as the new ticket department. On what php file should I look to see if the variable for help topic and the variable for department match?
Thanks again.
Will there be an error to your code if the number of departments is greater than the help topic? Because this is the situation here on my system. Plus will this script also work on rc4?
Thanks
I don’t think so, since this modification was being intended only for RC5, as stated earlier in the article’s title.
HI
may i know whether this code will work with 1.6ST?
Because i found some differences in implementing it on 1.6ST