@@ -90,15 +90,15 @@ private function getTicketIconUrl(array $ticket): string {
9090 // Determine icon based on ticket state
9191 $ iconName = '' ;
9292
93- // Check for closed state first
93+ // Check for closed state first (based on close_date)
9494 if (!empty ($ closeDate )) {
9595 $ iconName = strtolower ($ type ) . '-closed.svg ' ;
9696 }
97- // Check for escalated state (high priority)
98- elseif (stripos ($ priority, ' high ' ) !== false || stripos ( $ priority, ' critical ' ) !== false ) {
97+ // Check for escalated state (high priority: 1 or 2 )
98+ elseif (is_numeric ($ priority) && ( int ) $ priority <= 2 ) {
9999 $ iconName = strtolower ($ type ) . '-escalated.svg ' ;
100100 }
101- // Check for deadline state (you may need to adjust this logic based on your needs )
101+ // Check for deadline state (pending/waiting status )
102102 elseif (stripos ($ status , 'pending ' ) !== false || stripos ($ status , 'waiting ' ) !== false ) {
103103 $ iconName = strtolower ($ type ) . '-deadline.svg ' ;
104104 }
@@ -362,7 +362,7 @@ private function getTicketReference(int $ticketId, string $class, string $url):
362362 'class ' => $ class ,
363363 'id ' => $ ticketId
364364 ]);
365- return $ this ->buildTicketReference ($ cachedTicketInfo , $ url );
365+ return $ this ->buildTicketReference ($ cachedTicketInfo , $ url, $ class );
366366 }
367367
368368 // Cache miss - fetch data from iTop API
@@ -398,7 +398,7 @@ private function getTicketReference(int $ticketId, string $class, string $url):
398398 // Cache the ticket info for next request
399399 $ this ->cacheService ->setTicketInfo ($ this ->userId , $ ticketId , $ class , $ fields );
400400
401- return $ this ->buildTicketReference ($ fields , $ url );
401+ return $ this ->buildTicketReference ($ fields , $ url, $ class );
402402 } catch (\Exception $ e ) {
403403 $ this ->logger ->error ('Error getting iTop ticket reference: ' . $ e ->getMessage (), ['app ' => Application::APP_ID ]);
404404 return null ;
@@ -619,7 +619,7 @@ private function formatCIDescription(array $ci): string {
619619 * @param string $url Original iTop URL
620620 * @return IReference
621621 */
622- private function buildTicketReference (array $ fields , string $ url ): IReference {
622+ private function buildTicketReference (array $ fields , string $ url, string $ class = '' ): IReference {
623623 // Get iTop URL for building links
624624 $ adminItopUrl = $ this ->config ->getAppValue (Application::APP_ID , 'admin_instance_url ' , '' );
625625 $ userItopUrl = $ this ->config ->getUserValue ($ this ->userId , Application::APP_ID , 'url ' , '' );
@@ -636,6 +636,7 @@ private function buildTicketReference(array $fields, string $url): IReference {
636636 $ reference ->setRichObject (
637637 self ::RICH_OBJECT_TYPE ,
638638 [
639+ 'class ' => $ class ,
639640 'title ' => $ fields ['title ' ] ?? '' ,
640641 'ref ' => $ fields ['ref ' ] ?? '' ,
641642 'status ' => $ fields ['status ' ] ?? '' ,
0 commit comments