diff --git a/app/Controllers/ThzController.php b/app/Controllers/ThzController.php index 29f89df4..d0151013 100644 --- a/app/Controllers/ThzController.php +++ b/app/Controllers/ThzController.php @@ -108,7 +108,7 @@ class ThzController extends BaseController $data = $this->request->getGet(); - if ($returnType === 'web' && in_array(get_role_id(), [3, 4])) { + if ($returnType === 'web' && in_array(get_role_id(), [4])) { $data['assign_to'] = $data['assign_to'] ?? get_session_userid(); } diff --git a/app/Controllers/TicketController.php b/app/Controllers/TicketController.php index 18018d3c..87620e51 100644 --- a/app/Controllers/TicketController.php +++ b/app/Controllers/TicketController.php @@ -26,6 +26,7 @@ use App\Models\VehicleModel; use App\Models\PartnerPolicyModel; use DOMDocument; +use DOMXPath; use Psr\Log\LoggerInterface; use Kint\Kint; @@ -1313,7 +1314,7 @@ class TicketController extends BaseController } } - public function convertHtmlToText($html) + public function convertHtmlToTextOld($html) { if(!empty($html)){ $dom = new DOMDocument(); @@ -1324,6 +1325,36 @@ class TicketController extends BaseController } } + public function convertHtmlToText($html) + { + if (empty($html)) { + return ''; + } + + // Remove BOM / strange characters + $html = preg_replace('/[\x00-\x1F\x80-\xFF]/', ' ', $html); + + // Load HTML safely + $dom = new DOMDocument(); + libxml_use_internal_errors(true); + $dom->loadHTML(mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8')); + + // Remove style and script tags + $xpath = new DOMXPath($dom); + foreach ($xpath->query('//style|//script') as $node) { + $node->parentNode->removeChild($node); + } + + // Extract clean text + $text = $dom->textContent; + + // Clean extra spaces + $text = preg_replace('/\s+/', ' ', $text); + + return trim($text); + } + + public function removeTicket() { $ticket_id = $this->request->getGet('ticket_id'); diff --git a/app/Views/UserList.php b/app/Views/UserList.php index a991670d..adf1a29d 100755 --- a/app/Views/UserList.php +++ b/app/Views/UserList.php @@ -440,7 +440,7 @@ table.dataTable tbody td { " . $ct . ""; endif; ?> @@ -448,7 +448,7 @@ table.dataTable tbody td { " . $ut . ""; endif; ?> diff --git a/app/Views/claim_dump_file_list.php b/app/Views/claim_dump_file_list.php index a2f27a80..45fea592 100644 --- a/app/Views/claim_dump_file_list.php +++ b/app/Views/claim_dump_file_list.php @@ -90,7 +90,7 @@ - ' . $file['user_name'] . '' ?> + ' . $file['user_name'] . '' ?> diff --git a/app/Views/commission_file_upload.php b/app/Views/commission_file_upload.php index 4bec2202..a9b81c3b 100644 --- a/app/Views/commission_file_upload.php +++ b/app/Views/commission_file_upload.php @@ -179,7 +179,7 @@ - ' . $row['created_user_name'] . '' ?> + ' . $row['created_user_name'] . '' ?>