Staging #1663

Merged
korina.cordero merged 16 commits from staging into master 2023-02-09 10:19:34 +00:00
Showing only changes of commit 879c80f7be - Show all commits

View file

@ -1660,6 +1660,11 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
// validated! save the entity
$em->persist($obj);
$em->flush();
// check if hub has valid mobile number
$phone_number = $this->country_code . $hub->getNotifNumber();
if (!empty($phone_number))
$this->sendSMSHubRejection($phone_number, $obj, $jo);
}
return $error_array;
@ -3909,4 +3914,38 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
$this->rt->sendSMS($phone_number, $this->translator->trans('message.battery_brand_allcaps'), $message);
}
protected function sendSMSHubRejection($phone_number, $rejection, $jo)
{
// sms content
// Job Order # - can get from jo
// Order Date and Time - get from jo
// Date and Time Rejected - get from rejection
// Enrollee Name - get from rejection ($hub->getName() . ' - ' . $hub->getBranch())
// Reason of Rejection - get from rejection
// Remarks - get from rejection
// Type of Service - get from jo
$hub = $rejection->getHub();
$jo_id = $jo->getID();
// convert to string format the date fields (order date and time and date and time rejected)
$order_date_time = $jo->getDateCreate()->format('d M Y g:i A');
$reject_date_time = $rejection->getDateCreate()->format('d M Y g:i A');
$enrollee = $hub->getName() . ' - ' . $hub->getBranch();
$reason = JORejectionReason::getName($rejection->getReason());
$remarks = $rejection->getRemarks();
$service_type = ServiceType::getName($jo->getServiceType());
$msg = 'Job Order #: ' . $jo_id . "\n" . 'Order Date and Time: ' . $order_date_time . "\n" .
'Date and Time Rejected: ' . $reject_date_time . "\n" . 'Enrollee Name: ' . $enrollee . "\n" .
'Reason of Rejection: ' . $reason . "\n" . 'Remarks: ' . $remarks . "\n" .
'Type of Service: ' . $service_type;
// error_log($msg);
$this->rt->sendSMS($phone_number, $this->translator->trans('message.battery_brand_allcaps'), $msg);
}
}