@@ -163,6 +163,11 @@ public function trashTicket(Request $request, ContainerInterface $container, Ent
163163
164164 /**
165165 * Create support tickets.
166+ * customFields data passed like :
167+ * {
168+ * customFields[key] : value,
169+ * customFields[key] : value,
170+ * }
166171 *
167172 * @param Request $request
168173 * @return void
@@ -286,6 +291,12 @@ public function createTicket(Request $request, ContainerInterface $container, En
286291 }
287292
288293 $ thread = $ container ->get ('ticket.service ' )->createTicketBase ($ ticketData );
294+ $ customFields = $ request ->request ->get ('customFields ' );
295+
296+ if ($ customFields ) {
297+ $ container ->get ('ticket.service ' )->addTicketCustomFields ($ thread , $ customFields , $ customFields );
298+ }
299+
289300 // Trigger ticket created event
290301 try {
291302 $ event = new CoreWorkflowEvents \Ticket \Create ();
@@ -473,14 +484,22 @@ public function viewTicket($ticketId, ContainerInterface $container, UVDeskServi
473484 $ ticketDetails ['customer ' ] = $ customerDetails ;
474485 $ ticketDetails ['totalThreads ' ] = count ($ threads );
475486
487+ $ customFields = [];
488+
489+ if ($ userService ->isFileExists ('apps/uvdesk/custom-fields ' )) {
490+ $ customFieldsService = $ this ->container ->get ('uvdesk_package_custom_fields.service ' );
491+ $ customFields = $ customFieldsService ->getTicketCustomFieldDetails ($ ticket ->getId ());
492+ }
493+
476494 return new JsonResponse ([
477495 'ticket ' => $ ticketDetails ,
478496 'totalCustomerTickets ' => ($ ticketRepository ->countCustomerTotalTickets ($ customer , $ container )),
479497 'supportGroups ' => $ userRepository ->getSupportGroups (),
480498 'supportTeams ' => $ userRepository ->getSupportTeams (),
481499 'ticketStatuses ' => $ status ,
482500 'ticketPriorities ' => $ priority ,
483- 'ticketTypes ' => $ type
501+ 'ticketTypes ' => $ type ,
502+ 'customFields ' => $ customFields
484503 ]);
485504 }
486505
0 commit comments