I want to create a small core modification that will auto-link / hot-link any order id's that are entered into the main ticket (and task). That way when a user has entered an order id that needs attention, I can hot-link right to the order in the admin of our store.

I can write the search and replace regex.

But I don't know where the output for this in the osTicket code.

Somewhere there is a function returning the data: return $ticket_content

Does anyone know where this is? And is the output the same for tasks or is this a different function and return? Ideally I'd like both tickets and tasks to be able to do this.

Thanks,

Neal

So after some persistence I was able to track down where to make the edit.

On /include/class.thread.php

FIND:
function toHtml() {
return $this->display('html');
}

REPLACE WITH:
function toHtml() {
//CUSTOMIZATION: ADDED AND MODIFIED
$display_html = $this->display('html');
$display_html_final = preg_replace_callback('/[0-9]{10}/', function($match) {
return sprintf('<a target="_blank" href="https://www.store.com/admin/orders/orderID/%s">%s</a>',
htmlspecialchars($match[0]),
htmlspecialchars($match[0])
);
}, $display_html);

	return $display_html_final;
}

The pattern matching regex for our order id's is a 10 digit number, so: /[0-9]{10}/

Write a Reply...