Fix display of ticket types when listing tickets in ticket list, ticket list in job order and ticket list in customer. #680

This commit is contained in:
Korina Cordero 2022-06-10 07:20:24 +00:00
parent c63b9ffe43
commit cf97c74ea6
2 changed files with 18 additions and 1 deletions

View file

@ -96,6 +96,20 @@ class TicketController extends Controller
// process rows // process rows
$rows = []; $rows = [];
foreach ($obj_rows as $orow) { foreach ($obj_rows as $orow) {
// check for the ticket types (legacy vs new)
$ttype = '';
$new_ticket_type = $orow->getNewTicketType();
if ($new_ticket_type == null)
{
// get legacy ticket type
$ttype = TicketType::getName($orow->getTicketType());
}
else
{
// use new ticket type
$ttype = $orow->getNewTicketType()->getName();
}
// add row data // add row data
$row['id'] = $orow->getID(); $row['id'] = $orow->getID();
$row['date_create'] = $orow->getDateCreate()->format("d M Y g:i A"); $row['date_create'] = $orow->getDateCreate()->format("d M Y g:i A");
@ -103,7 +117,7 @@ class TicketController extends Controller
$row['last_name'] = $orow->getLastName(); $row['last_name'] = $orow->getLastName();
$row['contact_num'] = $orow->getContactNumber(); $row['contact_num'] = $orow->getContactNumber();
$row['status'] = TicketStatus::getName($orow->getStatus()); $row['status'] = TicketStatus::getName($orow->getStatus());
$row['ticket_type'] = TicketType::getName($orow->getTicketType()); $row['ticket_type'] = $ttype;
$row['plate_number'] = $orow->getPlateNumber(); $row['plate_number'] = $orow->getPlateNumber();
// add row metadata // add row metadata

View file

@ -195,6 +195,9 @@ class Ticket
public function getTicketTypeText() public function getTicketTypeText()
{ {
if ($this->new_ticket_type != null)
return $this->new_ticket_type->getName();
if ($this->ticket_type == LegacyTicketType::OTHER) { if ($this->ticket_type == LegacyTicketType::OTHER) {
return $this->other_ticket_type; return $this->other_ticket_type;
} else { } else {