1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
| public function isValid():bool {
if (empty($this->id_ticket))
{
$this->errors[]="a line without any ID";
}
else
{
if (!is_string($this->product_name))
{
$this->errors[]="For Ticket ID =".$this->id_ticket.', "'
.$this->productname.'" is not a string (productname)' ;
}
if (!is_string($this->assignedgroup))
{
$this->errors[]="For Ticket ID =".$this->id_ticket.', "'
.$this->assignedgroup.'" is not a string (assignedgroup)' ;
}
if ($this->validateDate($this->submit_date,'d/m/Y H:i')===false)
{
$this->errors[]="For Ticket ID =".$this->id_ticket.', "'
.$this->submit_date.'" is not a valid submit date';
}
if ($this->ValidateDate($this->last_resolved_date,'d/m/Y H:i')===false)
{
$this->errors[]="For Ticket ID =".$this->id_ticket.', "'
.$this->last_resolved_date.'" is not a valid last resolved date';
}
if ( !in_array(strtolower($this->priority), ['low', 'medium', 'high']) )
{
$this->errors[]="For Ticket ID =".$this->id_ticket.', "'
.$this->priority.'" is not an accepted value (priority)' ;
}
if ( !in_array($this->status, ['Assigned', 'Cancelled', 'Closed', 'In Progress', 'Pending', 'Resolved']) )
{
$this->errors[]="For Ticket ID =".$this->id_ticket.', "'
.$this->status.'" is not an accepted value (status)' ;
}
//tester format de SESA
$var = $this->submitter_SESA;
if (!(is_int($var) ) )
{
$this->errors[]="For Ticket ID =".$this->id_ticket.', "'
.$this->submitter_SESA." is not in a valid format for SESA (SESA12345 or SESA123456)" ;
}
if ( !in_array(strtolower($this->incident_type), ["incident"]) )
{
$this->errors[]="For Ticket ID =".$this->id_ticket.', "'
.$this->incident_type.'" is not an accepted value (incident_type)' ;
}
if ( !in_array( $this->reported_source, ["Chat", "Direct Input", "Email", "Phone", "Web"]) )
{
$this->errors[]="For Ticket ID =".$this->id_ticket.', "'
.$this->reported_source.'" is not an accepted value (reported_source)' ;
}
}
return(empty($this->errors));
} |
Partager