Merge branch '394-warranty-expiration-sms-reminder' of gitlab.com:jankstudio/resq into 394-warranty-expiration-sms-reminder
This commit is contained in:
commit
e8446cd181
2 changed files with 17 additions and 6 deletions
|
|
@ -24,7 +24,7 @@ class WarrantySMSCommand extends Command
|
||||||
$this->setName('warranty:sms')
|
$this->setName('warranty:sms')
|
||||||
->setDescription('Sends an SMS message to users whose warranty expired one month ago.')
|
->setDescription('Sends an SMS message to users whose warranty expired one month ago.')
|
||||||
->setHelp('Sends warranty SMS.')
|
->setHelp('Sends warranty SMS.')
|
||||||
->addArgument('date', InputArgument::REQUIRED, 'Date to use as basis of expiration. Defaults to current date.');
|
->addArgument('date', InputArgument::OPTIONAL, 'Date to use as basis of expiration. Defaults to current date.');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __construct(EntityManagerInterface $em, RisingTideGateway $gateway)
|
public function __construct(EntityManagerInterface $em, RisingTideGateway $gateway)
|
||||||
|
|
@ -37,9 +37,14 @@ class WarrantySMSCommand extends Command
|
||||||
|
|
||||||
protected function execute(InputInterface $input, OutputInterface $output)
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
|
$date = new DateTime();
|
||||||
$date_string = $input->getArgument('date');
|
$date_string = $input->getArgument('date');
|
||||||
$date = DateTime::createFromFormat('Ymd', $date_string);
|
|
||||||
$date->modify('-1 month');
|
if (!empty($date_string))
|
||||||
|
{
|
||||||
|
$date = DateTime::createFromFormat('Ymd', $date_string);
|
||||||
|
$date->modify('-1 month');
|
||||||
|
}
|
||||||
|
|
||||||
$warrs = $this->em->getRepository(Warranty::class)->findBy(['date_expire' => $date]);
|
$warrs = $this->em->getRepository(Warranty::class)->findBy(['date_expire' => $date]);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -718,11 +718,11 @@ class APIController extends Controller implements LoggedController
|
||||||
$cvs = $cust->getVehicles();
|
$cvs = $cust->getVehicles();
|
||||||
foreach ($cvs as $cv)
|
foreach ($cvs as $cv)
|
||||||
{
|
{
|
||||||
$battery_id = '';
|
$battery_id = null;
|
||||||
if ($cv->getCurrentBattery() != null)
|
if ($cv->getCurrentBattery() != null)
|
||||||
$battery_id = $cv->getCurrentBattery()->getID();
|
$battery_id = $cv->getCurrentBattery()->getID();
|
||||||
|
|
||||||
$wty_ex = '';
|
$wty_ex = null;
|
||||||
if ($cv->getWarrantyExpiration() != null)
|
if ($cv->getWarrantyExpiration() != null)
|
||||||
$wty_ex = $cv->getWarrantyExpiration()->format('Y-m-d');
|
$wty_ex = $cv->getWarrantyExpiration()->format('Y-m-d');
|
||||||
|
|
||||||
|
|
@ -2360,7 +2360,7 @@ class APIController extends Controller implements LoggedController
|
||||||
$schedule_date = $req->request->get('date_schedule');
|
$schedule_date = $req->request->get('date_schedule');
|
||||||
$slot_id = $req->request->get('slot_id');
|
$slot_id = $req->request->get('slot_id');
|
||||||
$advance_order = $req->request->get('flag_advance_order');
|
$advance_order = $req->request->get('flag_advance_order');
|
||||||
$flag_advance_order = ($advance_order === 'true') ? true : false;
|
$flag_advance_order = ($advance_order == 1) ? true : false;
|
||||||
|
|
||||||
$jo = new JobOrder();
|
$jo = new JobOrder();
|
||||||
$jo->setSource(TransactionOrigin::MOBILE_APP)
|
$jo->setSource(TransactionOrigin::MOBILE_APP)
|
||||||
|
|
@ -2664,6 +2664,7 @@ class APIController extends Controller implements LoggedController
|
||||||
}
|
}
|
||||||
|
|
||||||
$need_update = false;
|
$need_update = false;
|
||||||
|
$msg = 'Version is up to date.';
|
||||||
|
|
||||||
$api_version = $this->getParameter('api_version');
|
$api_version = $this->getParameter('api_version');
|
||||||
|
|
||||||
|
|
@ -2680,10 +2681,15 @@ class APIController extends Controller implements LoggedController
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($api_v[0] > $app_v[0])
|
if ($api_v[0] > $app_v[0])
|
||||||
|
{
|
||||||
$need_update = true;
|
$need_update = true;
|
||||||
|
$msg = 'Your version is outdated and needs an update to use the latest features RES-Q has to offer.';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'need_update' => $need_update,
|
'need_update' => $need_update,
|
||||||
|
'message' => $msg,
|
||||||
];
|
];
|
||||||
|
|
||||||
$res->setData($data);
|
$res->setData($data);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue