Merge branch '807-disable-sms-for-certain-rejection-reasons' into 'master'
Resolve "Disable SMS for certain Rejection Reasons" Closes #807 and #792 See merge request jankstudio/resq!922
This commit is contained in:
commit
f1609b2273
1 changed files with 40 additions and 5 deletions
|
|
@ -4367,12 +4367,10 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
|
||||
$phone_number = $this->country_code . $notif_number;
|
||||
|
||||
// check if reason is administrative
|
||||
if ($rejection->getReason() == JORejectionReason::ADMINISTRATIVE)
|
||||
return null;
|
||||
// check if reason is in the list of rejection reason
|
||||
$flag_send_sms = $this->checkRejectionReason($rejection->getReason());
|
||||
|
||||
// check if reason is discount
|
||||
if ($rejection->getReason() == JORejectionReason::DISCOUNT)
|
||||
if (!$flag_send_sms)
|
||||
return null;
|
||||
|
||||
// sms content
|
||||
|
|
@ -4406,6 +4404,43 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
$this->rt->sendSMS($phone_number, $this->translator->trans('message.battery_brand_allcaps'), $msg);
|
||||
}
|
||||
|
||||
protected function checkRejectionReason($reason): bool
|
||||
{
|
||||
// reason is administrative
|
||||
if ($reason == JORejectionReason::ADMINISTRATIVE)
|
||||
return false;
|
||||
|
||||
// reason is discount
|
||||
if ($reason == JORejectionReason::DISCOUNT)
|
||||
return false;
|
||||
|
||||
// reason is store closed on schedule
|
||||
if ($reason == JORejectionReason::STORE_CLOSED_SCHEDULED)
|
||||
return false;
|
||||
|
||||
// store closed half day
|
||||
if ($reason == JORejectionReason::STORE_CLOSED_HALF_DAY)
|
||||
return false;
|
||||
|
||||
// prio hub for warranty claim
|
||||
if ($reason == JORejectionReason::PRIORITY_HUB_WTY_CLAIM)
|
||||
return false;
|
||||
|
||||
// prio hub for jumpstart
|
||||
if ($reason == JORejectionReason::PRIORITY_HUB_JUMPSTART)
|
||||
return false;
|
||||
|
||||
// prio hub for RES-Q request
|
||||
if ($reason == JORejectionReason::PRIORITY_HUB_RESQ_REQUEST)
|
||||
return false;
|
||||
|
||||
// customer request
|
||||
if ($reason == JORejectionReason::CUSTOMER_REQUEST)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function skipInventoryCheck(Point $coordinates): bool
|
||||
{
|
||||
$long = $coordinates->getLongitude();
|
||||
|
|
|
|||
Loading…
Reference in a new issue