Merge branch 'master' of gitlab.com:jankstudio/resq into 329-transition-branch-for-cmb-and-resq-merging
This commit is contained in:
commit
615b5a3390
38 changed files with 234 additions and 48 deletions
|
|
@ -64,7 +64,7 @@ class TestAPICommand extends Command
|
||||||
'start' => '1',
|
'start' => '1',
|
||||||
];
|
];
|
||||||
|
|
||||||
$api->get('/capi/warranties', $params);
|
//$api->get('/capi/warranties', $params);
|
||||||
|
|
||||||
|
|
||||||
// warranty find
|
// warranty find
|
||||||
|
|
@ -123,7 +123,7 @@ class TestAPICommand extends Command
|
||||||
|
|
||||||
// privacy policy
|
// privacy policy
|
||||||
$privacy_policy_id = 2;
|
$privacy_policy_id = 2;
|
||||||
$api->get('/capi/privacy_policy/' . $privacy_policy_id );
|
//$api->get('/capi/privacy_policy/' . $privacy_policy_id );
|
||||||
|
|
||||||
// register new customer
|
// register new customer
|
||||||
$params = [
|
$params = [
|
||||||
|
|
@ -137,6 +137,19 @@ class TestAPICommand extends Command
|
||||||
'v_condition' => 'new',
|
'v_condition' => 'new',
|
||||||
'v_fuel_type' => 'gas',
|
'v_fuel_type' => 'gas',
|
||||||
];
|
];
|
||||||
$api->post('/capi/quick_registration', $params);
|
//$api->post('/capi/quick_registration', $params);
|
||||||
|
|
||||||
|
// get warranties given list of serial numbers
|
||||||
|
$serial_list = [
|
||||||
|
'AJ34LJADR12134LKJM4',
|
||||||
|
'AJ34LJADR12134LKJL5',
|
||||||
|
'test',
|
||||||
|
];
|
||||||
|
|
||||||
|
$params = [
|
||||||
|
'serial_list' => $serial_list,
|
||||||
|
];
|
||||||
|
|
||||||
|
$api->post('/capi/warranties_list', $params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,8 @@ access_keys:
|
||||||
label: Delete
|
label: Delete
|
||||||
- id: warranty.set.privacypolicy
|
- id: warranty.set.privacypolicy
|
||||||
label: Set Privacy Policy
|
label: Set Privacy Policy
|
||||||
|
- id: warranty.list.serial
|
||||||
|
label: List by Serial
|
||||||
- id: batterybrand
|
- id: batterybrand
|
||||||
label: Battery Brand Access
|
label: Battery Brand Access
|
||||||
acls:
|
acls:
|
||||||
|
|
|
||||||
|
|
@ -108,6 +108,12 @@ capi_warranty_privacy_policy:
|
||||||
controller: App\Controller\CAPI\WarrantyController::setPrivacyPolicy
|
controller: App\Controller\CAPI\WarrantyController::setPrivacyPolicy
|
||||||
methods: [POST]
|
methods: [POST]
|
||||||
|
|
||||||
|
# get list of warranties given list of serials
|
||||||
|
capi_warranty_get_warranties_from_serials:
|
||||||
|
path: /capi/warranties_list
|
||||||
|
controller: App\Controller\CAPI\WarrantyController::getWarrantiesBySerialList
|
||||||
|
methods: [POST]
|
||||||
|
|
||||||
# customer vehicle api
|
# customer vehicle api
|
||||||
|
|
||||||
# find customer vehicle by id
|
# find customer vehicle by id
|
||||||
|
|
|
||||||
|
|
@ -46,5 +46,7 @@ class AdjustLongLatCommand extends Command
|
||||||
}
|
}
|
||||||
|
|
||||||
$em->flush();
|
$em->flush();
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -71,5 +71,7 @@ class ComputeWarrantyExpiryDateCommand extends Command
|
||||||
|
|
||||||
$this->em->clear();
|
$this->em->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -290,6 +290,8 @@ class CreateCustomerFromWarrantyCommand extends Command
|
||||||
//$output->writeln('Total warranties with no mobile number: ' . $total_inv_warr);
|
//$output->writeln('Total warranties with no mobile number: ' . $total_inv_warr);
|
||||||
$output->writeln('Total customers added: ' . $total_cust_added);
|
$output->writeln('Total customers added: ' . $total_cust_added);
|
||||||
$output->writeln('Total customer vehicles added: ' . $total_cv_added);
|
$output->writeln('Total customer vehicles added: ' . $total_cv_added);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getDefaultVehicle()
|
protected function getDefaultVehicle()
|
||||||
|
|
|
||||||
|
|
@ -22,9 +22,9 @@ class FulfillOldJobOrderCommand extends Command
|
||||||
{
|
{
|
||||||
protected $em;
|
protected $em;
|
||||||
|
|
||||||
public function __construct(EntityManagerInterface $om)
|
public function __construct(EntityManagerInterface $em)
|
||||||
{
|
{
|
||||||
$this->em = $om;
|
$this->em = $em;
|
||||||
|
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
@ -76,5 +76,7 @@ class FulfillOldJobOrderCommand extends Command
|
||||||
}
|
}
|
||||||
|
|
||||||
$em->flush();
|
$em->flush();
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,9 +22,9 @@ class FulfillPendingJobOrderCommand extends Command
|
||||||
{
|
{
|
||||||
protected $em;
|
protected $em;
|
||||||
|
|
||||||
public function __construct(EntityManagerInterface $om)
|
public function __construct(EntityManagerInterface $em)
|
||||||
{
|
{
|
||||||
$this->em = $om;
|
$this->em = $em;
|
||||||
|
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
@ -79,5 +79,7 @@ class FulfillPendingJobOrderCommand extends Command
|
||||||
}
|
}
|
||||||
|
|
||||||
$em->flush();
|
$em->flush();
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,9 +21,9 @@ class GenerateBatteryCompatibilityCommand extends Command
|
||||||
protected $em;
|
protected $em;
|
||||||
protected $vmfg_index;
|
protected $vmfg_index;
|
||||||
|
|
||||||
public function __construct(EntityManagerInterface $om)
|
public function __construct(EntityManagerInterface $em)
|
||||||
{
|
{
|
||||||
$this->em = $om;
|
$this->em = $em;
|
||||||
|
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
@ -100,5 +100,7 @@ class GenerateBatteryCompatibilityCommand extends Command
|
||||||
fwrite($json_file, json_encode($this->vmfg_index, JSON_PRETTY_PRINT));
|
fwrite($json_file, json_encode($this->vmfg_index, JSON_PRETTY_PRINT));
|
||||||
fclose($json_file);
|
fclose($json_file);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -211,5 +211,7 @@ class GenerateWarrantyFromJobOrderCommand extends Command
|
||||||
$em->detach($row[0]);
|
$em->detach($row[0]);
|
||||||
$em->clear();
|
$em->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,9 +30,9 @@ class ImportBatteryPriceCommand extends Command
|
||||||
protected $em;
|
protected $em;
|
||||||
protected $size_index;
|
protected $size_index;
|
||||||
|
|
||||||
public function __construct(EntityManagerInterface $om)
|
public function __construct(EntityManagerInterface $em)
|
||||||
{
|
{
|
||||||
$this->em = $om;
|
$this->em = $em;
|
||||||
$this->size_index = [];
|
$this->size_index = [];
|
||||||
|
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
@ -174,5 +174,7 @@ class ImportBatteryPriceCommand extends Command
|
||||||
}
|
}
|
||||||
|
|
||||||
$em->flush();
|
$em->flush();
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -170,6 +170,8 @@ class ImportCMBBatteryDataCommand extends Command
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function addBatteryManufacturer($name)
|
protected function addBatteryManufacturer($name)
|
||||||
|
|
|
||||||
|
|
@ -92,9 +92,9 @@ class ImportCMBBatteryTradeInPriceCommand extends Command
|
||||||
{
|
{
|
||||||
error_log('Cannot find battery size ' . $size);
|
error_log('Cannot find battery size ' . $size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function loadBatterySizes()
|
protected function loadBatterySizes()
|
||||||
|
|
|
||||||
|
|
@ -289,6 +289,8 @@ class ImportCMBVehicleCompatibilityCommand extends Command
|
||||||
|
|
||||||
$row_num++;
|
$row_num++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function addVehicleManufacturer($name)
|
protected function addVehicleManufacturer($name)
|
||||||
|
|
|
||||||
|
|
@ -479,5 +479,7 @@ class ImportCustomerCommand extends Command
|
||||||
}
|
}
|
||||||
fclose($cust_file);
|
fclose($cust_file);
|
||||||
fclose($cv_file);
|
fclose($cv_file);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,5 +35,7 @@ class ImportKMLFileCommand extends Command
|
||||||
$kml_file = $input->getArgument('file');
|
$kml_file = $input->getArgument('file');
|
||||||
|
|
||||||
$this->importer->getMapData($kml_file);
|
$this->importer->getMapData($kml_file);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,9 +44,9 @@ class ImportLegacyJobOrderCommand extends Command
|
||||||
protected $row_max_field_size;
|
protected $row_max_field_size;
|
||||||
protected $data_max_field_size;
|
protected $data_max_field_size;
|
||||||
|
|
||||||
public function __construct(EntityManagerInterface $om)
|
public function __construct(EntityManagerInterface $em)
|
||||||
{
|
{
|
||||||
$this->em = $om;
|
$this->em = $em;
|
||||||
|
|
||||||
$this->loadBatteryModels();
|
$this->loadBatteryModels();
|
||||||
$this->loadBatterySizes();
|
$this->loadBatterySizes();
|
||||||
|
|
@ -544,6 +544,8 @@ class ImportLegacyJobOrderCommand extends Command
|
||||||
fclose($warr_outfile);
|
fclose($warr_outfile);
|
||||||
fclose($jo_outfile);
|
fclose($jo_outfile);
|
||||||
fclose($jorow_outfile);
|
fclose($jorow_outfile);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function initializeMaxFieldCounters()
|
protected function initializeMaxFieldCounters()
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ use Symfony\Component\Console\Input\InputArgument;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||||
|
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
|
||||||
use App\Entity\Outlet;
|
use App\Entity\Outlet;
|
||||||
|
|
@ -17,11 +18,11 @@ use DateTime;
|
||||||
|
|
||||||
class ImportOutletsCommand extends Command
|
class ImportOutletsCommand extends Command
|
||||||
{
|
{
|
||||||
private $object_manager;
|
private $em;
|
||||||
|
|
||||||
public function __construct(EntityManagerInterface $om, ValidatorInterface $validator)
|
public function __construct(EntityManagerInterface $em, ValidatorInterface $validator)
|
||||||
{
|
{
|
||||||
$this->object_manager = $om;
|
$this->em = $em;
|
||||||
$this->validator = $validator;
|
$this->validator = $validator;
|
||||||
|
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
@ -60,7 +61,7 @@ class ImportOutletsCommand extends Command
|
||||||
}
|
}
|
||||||
|
|
||||||
// get entity manager
|
// get entity manager
|
||||||
$em = $this->object_manager;
|
$em = $this->em;
|
||||||
|
|
||||||
// row counter
|
// row counter
|
||||||
$row = 1;
|
$row = 1;
|
||||||
|
|
@ -167,7 +168,8 @@ class ImportOutletsCommand extends Command
|
||||||
{
|
{
|
||||||
$output->writeln("Errors occurred! Please check the CSV file is in the proper format.");
|
$output->writeln("Errors occurred! Please check the CSV file is in the proper format.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function setObject($obj, $fields)
|
protected function setObject($obj, $fields)
|
||||||
|
|
|
||||||
|
|
@ -34,9 +34,9 @@ class ImportPartnersCommand extends Command
|
||||||
|
|
||||||
protected $em;
|
protected $em;
|
||||||
|
|
||||||
public function __construct(EntityManagerInterface $om)
|
public function __construct(EntityManagerInterface $em)
|
||||||
{
|
{
|
||||||
$this->em = $om;
|
$this->em = $em;
|
||||||
|
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
@ -163,6 +163,7 @@ class ImportPartnersCommand extends Command
|
||||||
$row_num++;
|
$row_num++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ use Symfony\Component\Console\Input\InputArgument;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||||
|
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
|
||||||
use App\Entity\SAPBattery;
|
use App\Entity\SAPBattery;
|
||||||
|
|
@ -37,12 +38,14 @@ class ImportSAPBatteryCommand extends Command
|
||||||
$this->setName('sap_battery:import')
|
$this->setName('sap_battery:import')
|
||||||
->setDescription('Import a CSV file with SAP battery data.')
|
->setDescription('Import a CSV file with SAP battery data.')
|
||||||
->setHelp('Creates SAP battery data entries off imported CSV.')
|
->setHelp('Creates SAP battery data entries off imported CSV.')
|
||||||
->addArgument('file', InputArgument::REQUIRED, 'Path to the CSV file.');
|
->addArgument('file', InputArgument::REQUIRED, 'Path to the CSV file.')
|
||||||
|
->addArgument('output_file', InputArgument::REQUIRED, 'Path to the output CSV file.');
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function execute(InputInterface $input, OutputInterface $output)
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
$csv_file = $input->getArgument('file');
|
$csv_file = $input->getArgument('file');
|
||||||
|
$report_file = $input->getArgument('output_file');
|
||||||
|
|
||||||
// CSV column order:
|
// CSV column order:
|
||||||
// 0 - brand
|
// 0 - brand
|
||||||
|
|
@ -68,6 +71,9 @@ class ImportSAPBatteryCommand extends Command
|
||||||
// has error?
|
// has error?
|
||||||
$has_error = false;
|
$has_error = false;
|
||||||
|
|
||||||
|
$dupe_brands = [];
|
||||||
|
$dupe_sizes = [];
|
||||||
|
$dupe_batteries = [];
|
||||||
// loop through rows and build hashes
|
// loop through rows and build hashes
|
||||||
while (($fields = fgetcsv($handle)) !== false)
|
while (($fields = fgetcsv($handle)) !== false)
|
||||||
{
|
{
|
||||||
|
|
@ -77,7 +83,7 @@ class ImportSAPBatteryCommand extends Command
|
||||||
|
|
||||||
// clean up fields
|
// clean up fields
|
||||||
$clean_brand = trim($fields[0]);
|
$clean_brand = trim($fields[0]);
|
||||||
$clean_sku = trim($fields[1]);
|
$clean_sku = strtoupper(trim($fields[1]));
|
||||||
$clean_size = trim($fields[2]);
|
$clean_size = trim($fields[2]);
|
||||||
|
|
||||||
$output->writeln("Parsing $clean_sku...");
|
$output->writeln("Parsing $clean_sku...");
|
||||||
|
|
@ -92,6 +98,11 @@ class ImportSAPBatteryCommand extends Command
|
||||||
|
|
||||||
$this->batt_brand_hash[$clean_brand] = $brand;
|
$this->batt_brand_hash[$clean_brand] = $brand;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// add to duplicate list
|
||||||
|
$dupe_brands[] = $clean_brand;
|
||||||
|
}
|
||||||
|
|
||||||
// size hash
|
// size hash
|
||||||
if (!isset($this->batt_size_hash[$clean_size]))
|
if (!isset($this->batt_size_hash[$clean_size]))
|
||||||
|
|
@ -103,6 +114,10 @@ class ImportSAPBatteryCommand extends Command
|
||||||
|
|
||||||
$this->batt_size_hash[$clean_size] = $size;
|
$this->batt_size_hash[$clean_size] = $size;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$dupe_sizes[] = $clean_size;
|
||||||
|
}
|
||||||
|
|
||||||
// battery hash
|
// battery hash
|
||||||
if (!isset($this->battery_hash[$clean_sku]))
|
if (!isset($this->battery_hash[$clean_sku]))
|
||||||
|
|
@ -110,14 +125,28 @@ class ImportSAPBatteryCommand extends Command
|
||||||
// create battery entry
|
// create battery entry
|
||||||
$battery = new SAPBattery();
|
$battery = new SAPBattery();
|
||||||
$battery->setID($clean_sku)
|
$battery->setID($clean_sku)
|
||||||
->setSize($size_hash[$clean_size])
|
->setSize($this->batt_size_hash[$clean_size])
|
||||||
->setBrand($brand_hash[$clean_brand]);
|
->setBrand($this->batt_brand_hash[$clean_brand]);
|
||||||
|
|
||||||
$em->persist($battery);
|
$em->persist($battery);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$dupe_batteries[] = $clean_sku;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$em->flush();
|
$em->flush();
|
||||||
|
|
||||||
|
// write dupes report
|
||||||
|
if ((count($dupe_brands) > 0) ||
|
||||||
|
(count($dupe_sizes) > 0) ||
|
||||||
|
(count($dupe_batteries) > 0))
|
||||||
|
{
|
||||||
|
$this->writeDupeReport($report_file, $dupe_brands, $dupe_sizes, $dupe_batteries);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function initBatteryHash()
|
protected function initBatteryHash()
|
||||||
|
|
@ -146,4 +175,40 @@ class ImportSAPBatteryCommand extends Command
|
||||||
foreach ($brands as $brand)
|
foreach ($brands as $brand)
|
||||||
$this->batt_brand_hash[$brand->getName()] = $brand;
|
$this->batt_brand_hash[$brand->getName()] = $brand;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function writeDupeReport($report_file, $brands, $sizes, $batts)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$fh = fopen($report_file, "w");
|
||||||
|
}
|
||||||
|
catch (Exception $e)
|
||||||
|
{
|
||||||
|
throw new Exception('The file "' . $report_file . '" could be opened.');
|
||||||
|
}
|
||||||
|
|
||||||
|
fputs($fh, 'Brands not added: ' . "\n");
|
||||||
|
foreach ($brands as $brand)
|
||||||
|
{
|
||||||
|
fputs($fh, $brand, strlen($brand));
|
||||||
|
fputs($fh, "\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
fputs($fh, 'Sizes not added: ' . "\n");
|
||||||
|
foreach ($sizes as $size)
|
||||||
|
{
|
||||||
|
fputs($fh, $size, strlen($size));
|
||||||
|
fputs($fh, "\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
fputs($fh, 'SKUs not added: ' . "\n");
|
||||||
|
foreach ($batts as $batt)
|
||||||
|
{
|
||||||
|
fputs($fh, $batt, strlen($batt));
|
||||||
|
fputs($fh, "\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose($fh);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,9 +35,9 @@ class ImportVehicleBatteryCommand extends Command
|
||||||
|
|
||||||
protected $batt_index;
|
protected $batt_index;
|
||||||
|
|
||||||
public function __construct(EntityManagerInterface $om)
|
public function __construct(EntityManagerInterface $em)
|
||||||
{
|
{
|
||||||
$this->em = $om;
|
$this->em = $em;
|
||||||
$this->vmfg_index = [];
|
$this->vmfg_index = [];
|
||||||
$this->v_index = [];
|
$this->v_index = [];
|
||||||
$this->batt_index = [];
|
$this->batt_index = [];
|
||||||
|
|
@ -221,6 +221,6 @@ class ImportVehicleBatteryCommand extends Command
|
||||||
|
|
||||||
$em->flush();
|
$em->flush();
|
||||||
|
|
||||||
// print_r($batteries);
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,9 +28,9 @@ class ImportVehicleCompatibilityCommand extends Command
|
||||||
protected $bsize_index;
|
protected $bsize_index;
|
||||||
protected $b_index;
|
protected $b_index;
|
||||||
|
|
||||||
public function __construct(EntityManagerInterface $om)
|
public function __construct(EntityManagerInterface $em)
|
||||||
{
|
{
|
||||||
$this->em = $om;
|
$this->em = $em;
|
||||||
$this->vmfg_index = [];
|
$this->vmfg_index = [];
|
||||||
$this->v_index = [];
|
$this->v_index = [];
|
||||||
$this->b_index = [];
|
$this->b_index = [];
|
||||||
|
|
@ -317,6 +317,6 @@ class ImportVehicleCompatibilityCommand extends Command
|
||||||
|
|
||||||
$em->flush();
|
$em->flush();
|
||||||
|
|
||||||
// print_r($batteries);
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,9 +15,9 @@ class MergeDuplicateVehiclesCommand extends Command
|
||||||
{
|
{
|
||||||
protected $em;
|
protected $em;
|
||||||
|
|
||||||
public function __construct(EntityManagerInterface $om)
|
public function __construct(EntityManagerInterface $em)
|
||||||
{
|
{
|
||||||
$this->em = $om;
|
$this->em = $em;
|
||||||
|
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
@ -161,8 +161,7 @@ class MergeDuplicateVehiclesCommand extends Command
|
||||||
$em->flush();
|
$em->flush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// print_r($dupes);
|
// print_r($dupes);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -64,5 +64,7 @@ class RefreshJobOrderCacheCommand extends Command
|
||||||
{
|
{
|
||||||
$this->jo_cache->addActiveJobOrder($jo);
|
$this->jo_cache->addActiveJobOrder($jo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -142,5 +142,7 @@ class ReportRiderTime extends Command
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose($fh);
|
fclose($fh);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -55,5 +55,7 @@ class SeedRiderSessionsCommand extends Command
|
||||||
$this->redis->set($redis_key, $rider_id);
|
$this->redis->set($redis_key, $rider_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,10 +22,10 @@ class SetCustomerPrivacyPolicyCommand extends Command
|
||||||
private $policy_third_party_id;
|
private $policy_third_party_id;
|
||||||
private $policy_mobile_id;
|
private $policy_mobile_id;
|
||||||
|
|
||||||
public function __construct(EntityManagerInterface $om, $policy_promo,
|
public function __construct(EntityManagerInterface $em, $policy_promo,
|
||||||
$policy_third_party, $policy_mobile)
|
$policy_third_party, $policy_mobile)
|
||||||
{
|
{
|
||||||
$this->em = $om;
|
$this->em = $em;
|
||||||
|
|
||||||
$this->policy_promo_id = $policy_promo;
|
$this->policy_promo_id = $policy_promo;
|
||||||
$this->policy_third_party_id = $policy_third_party;
|
$this->policy_third_party_id = $policy_third_party;
|
||||||
|
|
@ -80,5 +80,7 @@ class SetCustomerPrivacyPolicyCommand extends Command
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->em->flush();
|
$this->em->flush();
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -66,5 +66,7 @@ class TestGeneralSearchCommand extends Command
|
||||||
echo "Last Name: " . $warranty->getLastName() . "\n";
|
echo "Last Name: " . $warranty->getLastName() . "\n";
|
||||||
echo "First Name: " . $warranty->getFirstName() . "\n";
|
echo "First Name: " . $warranty->getFirstName() . "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,5 +40,7 @@ class TestGeofenceCommand extends Command
|
||||||
echo "In geofence\n";
|
echo "In geofence\n";
|
||||||
else
|
else
|
||||||
echo "NOT in geofence\n";
|
echo "NOT in geofence\n";
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,5 +35,7 @@ class TestHubCounterCommand extends Command
|
||||||
$available_rc = $this->hc->getAvailableRiderCount($hub_id);
|
$available_rc = $this->hc->getAvailableRiderCount($hub_id);
|
||||||
|
|
||||||
echo "Available Riders in Hub: " . $available_rc . "\n";
|
echo "Available Riders in Hub: " . $available_rc . "\n";
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,5 +36,7 @@ class TestJobOrderManagerCommand extends Command
|
||||||
echo "Job Order successfully updated" . "\n";
|
echo "Job Order successfully updated" . "\n";
|
||||||
else
|
else
|
||||||
echo "Job Order not updated" . "\n";
|
echo "Job Order not updated" . "\n";
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,5 +34,7 @@ class TestRegAPNSCommand extends Command
|
||||||
{
|
{
|
||||||
$push_id = $input->getArgument('push_id');
|
$push_id = $input->getArgument('push_id');
|
||||||
$this->apns->sendReg($push_id, 'Test Delay', 'Body');
|
$this->apns->sendReg($push_id, 'Test Delay', 'Body');
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,5 +42,7 @@ class TestRiderTrackerCommand extends Command
|
||||||
{
|
{
|
||||||
echo "Invalid rider id." . "\n";
|
echo "Invalid rider id." . "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,9 @@ class UpdateCustomerVehicleBatteryCommand extends Command
|
||||||
protected $em;
|
protected $em;
|
||||||
protected $custvehicle_hash;
|
protected $custvehicle_hash;
|
||||||
|
|
||||||
public function __construct(EntityManagerInterface $om)
|
public function __construct(EntityManagerInterface $em)
|
||||||
{
|
{
|
||||||
$this->em = $om;
|
$this->em = $em;
|
||||||
$this->custvehicle_hash = [];
|
$this->custvehicle_hash = [];
|
||||||
|
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
@ -63,5 +63,7 @@ class UpdateCustomerVehicleBatteryCommand extends Command
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -94,5 +94,7 @@ class UpdateCustomerVehicleWarrantyCommand extends Command
|
||||||
|
|
||||||
$this->em->detach($row[0]);
|
$this->em->detach($row[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
use Symfony\Component\Filesystem\Filesystem;
|
use Symfony\Component\Filesystem\Filesystem;
|
||||||
use Symfony\Component\Filesystem\Exception\IOExceptionInterface;
|
use Symfony\Component\Filesystem\Exception\IOExceptionInterface;
|
||||||
|
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
|
||||||
use App\Entity\Rider;
|
use App\Entity\Rider;
|
||||||
|
|
@ -18,11 +19,11 @@ use DirectoryIterator;
|
||||||
class UploadCleanupCommand extends Command
|
class UploadCleanupCommand extends Command
|
||||||
{
|
{
|
||||||
private $encoder_factory;
|
private $encoder_factory;
|
||||||
private $object_manager;
|
private $em;
|
||||||
|
|
||||||
public function __construct(EntityManagerInterface $om, Filesystem $fs, FileUploader $uploader)
|
public function __construct(EntityManagerInterface $em, Filesystem $fs, FileUploader $uploader)
|
||||||
{
|
{
|
||||||
$this->object_manager = $om;
|
$this->em = $em;
|
||||||
$this->filesystem = $fs;
|
$this->filesystem = $fs;
|
||||||
$this->uploader = $uploader;
|
$this->uploader = $uploader;
|
||||||
|
|
||||||
|
|
@ -41,7 +42,7 @@ class UploadCleanupCommand extends Command
|
||||||
$output->writeln('Retrieving file whitelist...');
|
$output->writeln('Retrieving file whitelist...');
|
||||||
|
|
||||||
// get all image filenames
|
// get all image filenames
|
||||||
$em = $this->object_manager;
|
$em = $this->em;
|
||||||
|
|
||||||
$riders = $em->getRepository(Rider::class)->findAll();
|
$riders = $em->getRepository(Rider::class)->findAll();
|
||||||
$whitelist = ['.gitkeep'];
|
$whitelist = ['.gitkeep'];
|
||||||
|
|
@ -95,5 +96,7 @@ class UploadCleanupCommand extends Command
|
||||||
$output->writeln('Deleted ' . $i . ' orphaned file(s). Done!');
|
$output->writeln('Deleted ' . $i . ' orphaned file(s). Done!');
|
||||||
else
|
else
|
||||||
$output->writeln('No files found. Done!');
|
$output->writeln('No files found. Done!');
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ use Symfony\Component\Console\Input\InputOption;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface;
|
use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface;
|
||||||
|
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
|
||||||
use App\Entity\User;
|
use App\Entity\User;
|
||||||
|
|
@ -16,12 +17,12 @@ use App\Entity\Role;
|
||||||
class UserCreateCommand extends Command
|
class UserCreateCommand extends Command
|
||||||
{
|
{
|
||||||
private $encoder_factory;
|
private $encoder_factory;
|
||||||
private $object_manager;
|
private $em;
|
||||||
|
|
||||||
public function __construct(EncoderFactoryInterface $ef, EntityManagerInterface $om)
|
public function __construct(EncoderFactoryInterface $ef, EntityManagerInterface $em)
|
||||||
{
|
{
|
||||||
$this->encoder_factory = $ef;
|
$this->encoder_factory = $ef;
|
||||||
$this->object_manager = $om;
|
$this->em = $em;
|
||||||
|
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
@ -49,7 +50,7 @@ class UserCreateCommand extends Command
|
||||||
|
|
||||||
// get entity manager
|
// get entity manager
|
||||||
// $em = $this->getContainer()->get('doctrine')->getEntityManager();
|
// $em = $this->getContainer()->get('doctrine')->getEntityManager();
|
||||||
$em = $this->object_manager;
|
$em = $this->em;
|
||||||
|
|
||||||
// build user
|
// build user
|
||||||
$user->setUsername($username)
|
$user->setUsername($username)
|
||||||
|
|
@ -66,5 +67,7 @@ class UserCreateCommand extends Command
|
||||||
$em->persist($user);
|
$em->persist($user);
|
||||||
|
|
||||||
$em->flush();
|
$em->flush();
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -502,6 +502,48 @@ class WarrantyController extends APIController
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getWarrantiesBySerialList(Request $req, EntityManagerInterface $em)
|
||||||
|
{
|
||||||
|
$this->denyAccessUnlessGranted('warranty.list.serial', null, 'No access.');
|
||||||
|
|
||||||
|
error_log('getWarrantiesBySerialList');
|
||||||
|
// required parameters
|
||||||
|
$params = [
|
||||||
|
'serial_list',
|
||||||
|
];
|
||||||
|
|
||||||
|
$msg = $this->checkRequiredParameters($req, $params);
|
||||||
|
error_log('msg - ' . $msg);
|
||||||
|
if ($msg)
|
||||||
|
return new APIResponse(false, $msg);
|
||||||
|
|
||||||
|
$serial_list = $req->request->get('serial_list');
|
||||||
|
|
||||||
|
if (empty($serial_list))
|
||||||
|
return new APIResponse(false, 'Empty serial numbers list.');
|
||||||
|
|
||||||
|
$warranty_list = [];
|
||||||
|
$warr_not_found_list = [];
|
||||||
|
foreach ($serial_list as $serial)
|
||||||
|
{
|
||||||
|
$clean_serial = $this->cleanSerial($serial);
|
||||||
|
$warr = $em->getRepository(Warranty::class)->findOneBy(['serial' => $clean_serial]);
|
||||||
|
|
||||||
|
if ($warr == null)
|
||||||
|
$warr_not_found_list[] = $clean_serial;
|
||||||
|
else
|
||||||
|
$warranty_list[] = $this->generateWarrantyData($warr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'warranties_found' => $warranty_list,
|
||||||
|
'warranties_not_found' => $warr_not_found_list,
|
||||||
|
];
|
||||||
|
|
||||||
|
return new APIResponse(true, 'Warranties found.', $data);
|
||||||
|
}
|
||||||
|
|
||||||
protected function getCustomerFromMobile($em, $warranty)
|
protected function getCustomerFromMobile($em, $warranty)
|
||||||
{
|
{
|
||||||
$w_mobile = $warranty->getMobileNumber();
|
$w_mobile = $warranty->getMobileNumber();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue