From 381323a07e6bcb3c439f9ad99e70261ab02e615d Mon Sep 17 00:00:00 2001 From: Kendrick Chan Date: Fri, 1 May 2020 14:29:40 +0800 Subject: [PATCH 1/4] Set some defaults to null in get vehicles #395 --- src/Controller/APIController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Controller/APIController.php b/src/Controller/APIController.php index 10a5d26e..a6ea86cf 100644 --- a/src/Controller/APIController.php +++ b/src/Controller/APIController.php @@ -718,11 +718,11 @@ class APIController extends Controller implements LoggedController $cvs = $cust->getVehicles(); foreach ($cvs as $cv) { - $battery_id = ''; + $battery_id = null; if ($cv->getCurrentBattery() != null) $battery_id = $cv->getCurrentBattery()->getID(); - $wty_ex = ''; + $wty_ex = null; if ($cv->getWarrantyExpiration() != null) $wty_ex = $cv->getWarrantyExpiration()->format('Y-m-d'); From 50e38e1e4b1d1e80fe5603b4eee9d67e686697df Mon Sep 17 00:00:00 2001 From: Kendrick Chan Date: Fri, 1 May 2020 14:58:59 +0800 Subject: [PATCH 2/4] Replace flag_advance_order check with 1 instead of 'true' #395 --- src/Controller/APIController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Controller/APIController.php b/src/Controller/APIController.php index a6ea86cf..daae8c27 100644 --- a/src/Controller/APIController.php +++ b/src/Controller/APIController.php @@ -2360,7 +2360,7 @@ class APIController extends Controller implements LoggedController $schedule_date = $req->request->get('date_schedule'); $slot_id = $req->request->get('slot_id'); $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->setSource(TransactionOrigin::MOBILE_APP) From 7043f0c483892e45264f9326fc6fd720136a3bff Mon Sep 17 00:00:00 2001 From: Kendrick Chan Date: Fri, 1 May 2020 15:29:24 +0800 Subject: [PATCH 3/4] Add message field for version check #395 --- src/Controller/APIController.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Controller/APIController.php b/src/Controller/APIController.php index daae8c27..f613d02e 100644 --- a/src/Controller/APIController.php +++ b/src/Controller/APIController.php @@ -2664,6 +2664,7 @@ class APIController extends Controller implements LoggedController } $need_update = false; + $msg = 'Version is up to date.'; $api_version = $this->getParameter('api_version'); @@ -2680,10 +2681,15 @@ class APIController extends Controller implements LoggedController } if ($api_v[0] > $app_v[0]) + { $need_update = true; + $msg = 'Your version is outdated and needs an update to use the latest features RES-Q has to offer.'; + } + $data = [ 'need_update' => $need_update, + 'message' => $msg, ]; $res->setData($data); From 81f8bf84d3a83a4a9462ef63e444aaf60662ef38 Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Mon, 4 May 2020 03:23:04 +0000 Subject: [PATCH 4/4] Made date an optional argument to command. #394 --- src/Command/WarrantySMSCommand.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Command/WarrantySMSCommand.php b/src/Command/WarrantySMSCommand.php index 3e8591aa..0b6f9d39 100644 --- a/src/Command/WarrantySMSCommand.php +++ b/src/Command/WarrantySMSCommand.php @@ -24,7 +24,7 @@ class WarrantySMSCommand extends Command $this->setName('warranty:sms') ->setDescription('Sends an SMS message to users whose warranty expired one month ago.') ->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) @@ -37,9 +37,14 @@ class WarrantySMSCommand extends Command protected function execute(InputInterface $input, OutputInterface $output) { + $date = new DateTime(); $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]);