357 lines
7.6 KiB
PHP
357 lines
7.6 KiB
PHP
<?php
|
|
|
|
namespace App\Entity;
|
|
|
|
use App\Ramcar\TicketType as LegacyTicketType;
|
|
use App\Ramcar\TicketStatus;
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
|
use Symfony\Component\Validator\Constraints as Assert;
|
|
|
|
use DateTime;
|
|
|
|
/**
|
|
* @ORM\Entity
|
|
* @ORM\Table(name="ticket", indexes={
|
|
* @ORM\Index(columns={"contact_num"}),
|
|
* @ORM\Index(columns={"plate_number"}),
|
|
* @ORM\Index(columns={"first_name"}),
|
|
* @ORM\Index(columns={"last_name"})
|
|
* })
|
|
*/
|
|
class Ticket
|
|
{
|
|
// unique id
|
|
/**
|
|
* @ORM\Id
|
|
* @ORM\Column(type="integer")
|
|
* @ORM\GeneratedValue(strategy="AUTO")
|
|
*/
|
|
protected $id;
|
|
|
|
// date ticket was created
|
|
/**
|
|
* @ORM\Column(type="datetime")
|
|
*/
|
|
protected $date_create;
|
|
|
|
// status of the ticket
|
|
/**
|
|
* @ORM\Column(type="string", length=15)
|
|
* @Assert\NotBlank()
|
|
*/
|
|
protected $status;
|
|
|
|
// ticket type
|
|
/**
|
|
* @ORM\Column(type="string", length=15, nullable=true)
|
|
*/
|
|
protected $ticket_type;
|
|
|
|
// user defined ticket type
|
|
/**
|
|
* @ORM\Column(type="string", length=80, nullable=true)
|
|
*/
|
|
protected $other_ticket_type;
|
|
|
|
// first name of ticket owner
|
|
/**
|
|
* @ORM\Column(type="string", length=80)
|
|
* @Assert\NotBlank()
|
|
*/
|
|
protected $first_name;
|
|
|
|
// last name of ticket owner
|
|
/**
|
|
* @ORM\Column(type="string", length=80)
|
|
* @Assert\NotBlank()
|
|
*/
|
|
protected $last_name;
|
|
|
|
// contact number of ticket owner
|
|
/**
|
|
* @ORM\Column(type="string", length=20, nullable=true)
|
|
*/
|
|
protected $contact_num;
|
|
|
|
// details of this ticket
|
|
/**
|
|
* @ORM\Column(type="text", nullable=true)
|
|
*/
|
|
protected $details;
|
|
|
|
// plate number
|
|
/**
|
|
* @ORM\Column(type="string", length=10, nullable=true)
|
|
*/
|
|
protected $plate_number;
|
|
|
|
// user that created the ticket
|
|
/**
|
|
* @ORM\ManyToOne(targetEntity="User", inversedBy="tickets")
|
|
* @ORM\JoinColumn(name="user_id", referencedColumnName="id")
|
|
*/
|
|
protected $created_by;
|
|
|
|
// customer associated with the ticket (optional)
|
|
/**
|
|
* @ORM\ManyToOne(targetEntity="Customer", inversedBy="tickets")
|
|
* @ORM\JoinColumn(name="customer_id", referencedColumnName="id", nullable=true)
|
|
*/
|
|
protected $customer;
|
|
|
|
// job order associated with the ticket (optional)
|
|
/**
|
|
* @ORM\ManyToOne(targetEntity="JobOrder", inversedBy="tickets")
|
|
* @ORM\JoinColumn(name="job_order_id", referencedColumnName="id", nullable=true)
|
|
*/
|
|
protected $job_order;
|
|
|
|
// source of awareness
|
|
/**
|
|
* @ORM\Column(type="string", length=80, nullable=true)
|
|
*/
|
|
protected $source_of_awareness;
|
|
|
|
// remarks related to source of awareness
|
|
/**
|
|
* @ORM\Column(type="text", nullable=true)
|
|
*/
|
|
protected $remarks;
|
|
|
|
// new ticket type
|
|
/**
|
|
* @ORM\ManyToOne(targetEntity="TicketType", inversedBy="tickets")
|
|
* @ORM\JoinColumn(name="ticket_type_id", referencedColumnName="id", nullable=true)
|
|
*/
|
|
protected $new_ticket_type;
|
|
|
|
// sub ticket type
|
|
/**
|
|
* @ORM\ManyToOne(targetEntity="SubTicketType", inversedBy="subtickets")
|
|
* @ORM\JoinColumn(name="subticket_type_id", referencedColumnName="id", nullable=true)
|
|
*/
|
|
protected $subticket_type;
|
|
|
|
// text field for Other subticket type
|
|
/**
|
|
* @ORM\Column(type="text", nullable=true)
|
|
*/
|
|
protected $other_description;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->date_create = new DateTime();
|
|
}
|
|
|
|
public function getID()
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
public function setDateCreate($date_create)
|
|
{
|
|
$this->date_create = $date_create;
|
|
return $this;
|
|
}
|
|
|
|
public function getDateCreate()
|
|
{
|
|
return $this->date_create;
|
|
}
|
|
|
|
public function setStatus($status)
|
|
{
|
|
$this->status = $status;
|
|
return $this;
|
|
}
|
|
|
|
public function getStatus()
|
|
{
|
|
return $this->status;
|
|
}
|
|
|
|
public function getStatusText()
|
|
{
|
|
$statuses = TicketStatus::getCollection();
|
|
return $statuses[$this->status] ?? "";
|
|
}
|
|
|
|
public function setTicketType($ticket_type)
|
|
{
|
|
$this->ticket_type = $ticket_type;
|
|
return $this;
|
|
}
|
|
|
|
public function getTicketType()
|
|
{
|
|
return $this->ticket_type;
|
|
}
|
|
|
|
public function setOtherTicketType($other_ticket_type)
|
|
{
|
|
$this->other_ticket_type = $other_ticket_type;
|
|
return $this;
|
|
}
|
|
|
|
public function getOtherTicketType()
|
|
{
|
|
return $this->other_ticket_type;
|
|
}
|
|
|
|
public function getTicketTypeText()
|
|
{
|
|
if ($this->new_ticket_type != null)
|
|
return $this->new_ticket_type->getName();
|
|
|
|
if ($this->ticket_type == LegacyTicketType::OTHER) {
|
|
return $this->other_ticket_type;
|
|
} else {
|
|
$types = LegacyTicketType::getCollection();
|
|
return $types[$this->ticket_type] ?? "";
|
|
}
|
|
}
|
|
|
|
public function setFirstName($first_name)
|
|
{
|
|
$this->first_name = $first_name;
|
|
return $this;
|
|
}
|
|
|
|
public function getFirstName()
|
|
{
|
|
return $this->first_name;
|
|
}
|
|
|
|
public function setLastName($last_name)
|
|
{
|
|
$this->last_name = $last_name;
|
|
return $this;
|
|
}
|
|
|
|
public function getLastName()
|
|
{
|
|
return $this->last_name;
|
|
}
|
|
|
|
public function setContactNumber($num)
|
|
{
|
|
$this->contact_num = $num;
|
|
return $this;
|
|
}
|
|
|
|
public function getContactNumber()
|
|
{
|
|
return $this->contact_num;
|
|
}
|
|
|
|
public function setDetails($details)
|
|
{
|
|
$this->details = $details;
|
|
return $this;
|
|
}
|
|
|
|
public function getDetails()
|
|
{
|
|
return $this->details;
|
|
}
|
|
|
|
public function setPlateNumber($plate_number)
|
|
{
|
|
$this->plate_number = $plate_number;
|
|
return $this;
|
|
}
|
|
|
|
public function getPlateNumber()
|
|
{
|
|
return $this->plate_number;
|
|
}
|
|
|
|
public function setCreatedBy(User $created_by)
|
|
{
|
|
$this->created_by = $created_by;
|
|
return $this;
|
|
}
|
|
|
|
public function getCreatedBy()
|
|
{
|
|
return $this->created_by;
|
|
}
|
|
|
|
public function setCustomer(Customer $customer)
|
|
{
|
|
$this->customer = $customer;
|
|
return $this;
|
|
}
|
|
|
|
public function getCustomer()
|
|
{
|
|
return $this->customer;
|
|
}
|
|
|
|
public function setJobOrder(JobOrder $job_order)
|
|
{
|
|
$this->job_order = $job_order;
|
|
return $this;
|
|
}
|
|
|
|
public function getJobOrder()
|
|
{
|
|
return $this->job_order;
|
|
}
|
|
|
|
public function setSourceOfAwareness($source_of_awareness)
|
|
{
|
|
$this->source_of_awareness = $source_of_awareness;
|
|
return $this;
|
|
}
|
|
|
|
public function getSourceOfAwareness()
|
|
{
|
|
return $this->source_of_awareness;
|
|
}
|
|
|
|
public function setRemarks($remarks)
|
|
{
|
|
$this->remarks = $remarks;
|
|
return $this;
|
|
}
|
|
|
|
public function getRemarks()
|
|
{
|
|
return $this->remarks;
|
|
}
|
|
|
|
public function setNewTicketType(TicketType $new_ticket_type = null)
|
|
{
|
|
$this->new_ticket_type = $new_ticket_type;
|
|
return $this;
|
|
}
|
|
|
|
public function getNewTicketType()
|
|
{
|
|
return $this->new_ticket_type;
|
|
}
|
|
|
|
public function setSubTicketType(SubTicketType $subticket_type = null)
|
|
{
|
|
$this->subticket_type = $subticket_type;
|
|
return $this;
|
|
}
|
|
|
|
public function getSubTicketType()
|
|
{
|
|
return $this->subticket_type;
|
|
}
|
|
|
|
public function setOtherDescription($other_description)
|
|
{
|
|
$this->other_description = $other_description;
|
|
return $this;
|
|
}
|
|
|
|
public function getOtherDescription()
|
|
{
|
|
return $this->other_description;
|
|
}
|
|
}
|