Karena adanya sedikit perbedaan kode di dalam berkas /scp/tickets.php antara osTicket v1.6 RC5 dan osTicket v1.6 ST (Stabil; versi terakhir saat artikel ini saya tulis), dan juga adanya sebuah permintaan yang ditujukan kepada saya melalui tulisan di Forum Diskusi osTicket, maka modifikasi yang saya buat ini ditujukan khusus kepada mereka yang ingin mengimplementasikan Lampiran di Catatan Internal pada osTicket v1.6 ST.
- Pertama sekali, Anda harus mengubah tabel ticket_attachment dengan menambahkan sebuah nilai enum, yaitu: “N” ke dalam field ref_type, di samping nilai yang sudah ada: M dan R. Nilai N ini artinya adalah: Note atau Internal Note dalam hal ini. Pastikan sekali lagi bahwa Anda tidak melewatkan langkah yang ini!
-
Buka file \include\staff\viewticket.inc.php, dan temukan kode ini:
219
<tr><td><?=Format::display($row['note'])?></td></tr>
setelah baris terakhir dari kode tadi, tambahkan kode berikut ini:
220 221 222 223
<?php // added by Masino Sinaga, Februari 26, 2009, attachment on Internal Notes osTicket v1.6 ST ?> <tr class="header"> <td><?php echo $ticket->getAttachmentStr($row['note_id'],'N')?></td> </tr>
-
Cari lagi kode yang ini:
363 364 365 366 367
<div style="margin-top: 3px;"> <label for="note" valign="top">Enter note content. <font class="error">* <?=$errors['note']?></font></label><br/> <textarea name="note" id="note" cols="80" rows="7" wrap="soft" style="width:90%"><?=$info['note']?></textarea> </div>setelah baris terakhir dari kode tadi, tambahkan kode berikut ini:
368 369 370 371 372 373 374
<?php if($cfg->canUploadFiles()){ //TODO: may be allow anyways and simply email out attachment?? ?> <div style="margin-top: 3px;"> <label for="attachment" >Attach File:</label> <input type="file" name="attachment" id="attachment2" size=30px value="<?php echo $info['attachment']; ?>" /> <font class="error"> <?php echo $errors['attachment']; ?></font> </div> <?php }?>
-
Buka file \scp\tickets.php, dan temukan kode yang ini:
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193
case 'postnote': $fields=array(); $fields['title'] = array('type'=>'string', 'required'=>1, 'error'=>'Title required'); $fields['note'] = array('type'=>'string', 'required'=>1, 'error'=>'Note message required'); $params = new Validator($fields); if(!$params->validate($_POST)) $errors=array_merge($errors,$params->errors()); if(!$errors && $ticket->postNote($_POST['title'],$_POST['note'])){ $msg='Internal note posted'; if(isset($_POST['ticket_status']) && $_POST['ticket_status']){ if($ticket->setStatus($_POST['ticket_status']) && $ticket->reload()){ $msg.=' and status set to '.($ticket->isClosed()?'closed':'open'); if($ticket->isClosed()) $page=$ticket=null; //Going back to main listing. } } }elseif(!$errors['err']) { $errors['err']='Error(s) occured. Unable to post the note.'; } break;
lalu timpa dengan kode berikut:
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211
case 'postnote': $fields=array(); $fields['title'] = array('type'=>'string', 'required'=>1, 'error'=>'Title required'); $fields['note'] = array('type'=>'string', 'required'=>1, 'error'=>'Note message required'); $params = new Validator($fields); if(!$params->validate($_POST)) $errors=array_merge($errors,$params->errors()); // Added by Masino Sinaga, February 26, 2010 for attachment on Internal Notes //Check attachments restrictions. if($_FILES['attachment'] && $_FILES['attachment']['size']) { if(!$_FILES['attachment']['name'] || !$_FILES['attachment']['tmp_name']) $errors['attachment']='Invalid attachment'; elseif(!$cfg->canUploadFiles()) //TODO: saved vs emailed attachments...admin config?? $errors['attachment']='upload dir invalid. Contact admin.'; elseif(!$cfg->canUploadFileType($_FILES['attachment']['name'])) $errors['attachment']='Invalid file type'; } // Added by Masino Sinaga, February 26, 2010 attachment on Internal Notes if(!$errors && ($noteID=$ticket->postNote($_POST['title'],$_POST['note'],$_POST['alert_assigned'],''))) { $msg='Internal note posted'; if(isset($_POST['ticket_status']) && $_POST['ticket_status']){ if($ticket->setStatus($_POST['ticket_status']) && $ticket->reload()){ $msg.=' and status set to '.($ticket->isClosed()?'closed':'open'); if($ticket->isClosed()) $page=$ticket=null; //Going back to main listing. } } // Added by Masino Sinaga, February 26, 2010, attachment on Internal Notes //Finally upload attachment if any if($_FILES['attachment'] && $_FILES['attachment']['size']){ $ticket->uploadAttachment($_FILES['attachment'],$noteID,'N'); } }else{ $errors['err']=$errors['err']?$errors['err']:'Error(s) occured. Unable to post the note.'; } break;
Itulah semuanya. Saya sudah mencobanya, dan semuanya nampak berjalan dengan baik. Selamat menikmati kode yang indah!

can someone point me to a tutorial on how to do this?
———-
alter the ticket_attachment table by adding a new enum value, that is: “N” into ref_type field
——-
thanks!
figured it out – you can change this by editing the re_type row under the ‘structure’ tab in the ticket_attachment table using phpMyAdmin.
Fantastic!
Hi,
After this implement, then I can’t see the internal notes “Closed by…”
Can anyone help me?
thanks for the codes needed help on my website
@Mads Kikkenborg
First of all, congratulations Mr. Sinaga for your great work.
To solve the closed by problem, you have to invest the last part of the code, like this:
if someone have problems with this mood and email to all with internal notes (Not sending mails)
in the line code:
change for
the mod not work to mail to all
when i change for:
the attachment not upload, but when i write:
Attachment succesfull upload but not mail to all
This is a great fix for as issue which stopped me using osticket.
The only downside I see is that I can open the attachment when looking in the ticket. It says the note and description but shows nothing. Checking in the file I can see the attachment is there. How can I resolve this
Thanks