diff --git a/src/Command/WarrantySMSCommand.php b/src/Command/WarrantySMSCommand.php index 8e0f9fc0..24ae7542 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]); diff --git a/src/Controller/APIController.php b/src/Controller/APIController.php index 10a5d26e..f613d02e 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'); @@ -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) @@ -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);