Resolve "Filter SMS Hub Rejection" #1664

Merged
korina.cordero merged 3 commits from 738-filter-sms-hub-rejection into master 2023-02-28 10:14:21 +00:00

View file

@ -1661,10 +1661,7 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
$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);
$this->sendSMSHubRejection($obj, $jo);
}
return $error_array;
@ -4013,8 +4010,21 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
$this->rt->sendSMS($phone_number, $this->translator->trans('message.battery_brand_allcaps'), $message);
}
protected function sendSMSHubRejection($phone_number, $rejection, $jo)
protected function sendSMSHubRejection($rejection, $jo)
{
$hub = $rejection->getHub();
// check if hub has a notification number
$notif_number = $hub->getNotifNumber();
if (empty($notif_number))
return null;
$phone_number = $this->country_code . $notif_number;
// check if reason is administrative
if ($rejection->getReason() == JORejectionReason::ADMINISTRATIVE)
return null;
// sms content
// Job Order # - can get from jo
// Order Date and Time - get from jo
@ -4024,7 +4034,6 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
// 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)