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',
|
||||
];
|
||||
|
||||
$api->get('/capi/warranties', $params);
|
||||
//$api->get('/capi/warranties', $params);
|
||||
|
||||
|
||||
// warranty find
|
||||
|
|
@ -123,7 +123,7 @@ class TestAPICommand extends Command
|
|||
|
||||
// privacy policy
|
||||
$privacy_policy_id = 2;
|
||||
$api->get('/capi/privacy_policy/' . $privacy_policy_id );
|
||||
//$api->get('/capi/privacy_policy/' . $privacy_policy_id );
|
||||
|
||||
// register new customer
|
||||
$params = [
|
||||
|
|
@ -137,6 +137,19 @@ class TestAPICommand extends Command
|
|||
'v_condition' => 'new',
|
||||
'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
|
||||
- id: warranty.set.privacypolicy
|
||||
label: Set Privacy Policy
|
||||
- id: warranty.list.serial
|
||||
label: List by Serial
|
||||
- id: batterybrand
|
||||
label: Battery Brand Access
|
||||
acls:
|
||||
|
|
|
|||
|
|
@ -108,6 +108,12 @@ capi_warranty_privacy_policy:
|
|||
controller: App\Controller\CAPI\WarrantyController::setPrivacyPolicy
|
||||
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
|
||||
|
||||
# find customer vehicle by id
|
||||
|
|
|
|||
|
|
@ -46,5 +46,7 @@ class AdjustLongLatCommand extends Command
|
|||
}
|
||||
|
||||
$em->flush();
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,5 +71,7 @@ class ComputeWarrantyExpiryDateCommand extends Command
|
|||
|
||||
$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 customers added: ' . $total_cust_added);
|
||||
$output->writeln('Total customer vehicles added: ' . $total_cv_added);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected function getDefaultVehicle()
|
||||
|
|
|
|||
|
|
@ -22,9 +22,9 @@ class FulfillOldJobOrderCommand extends Command
|
|||
{
|
||||
protected $em;
|
||||
|
||||
public function __construct(EntityManagerInterface $om)
|
||||
public function __construct(EntityManagerInterface $em)
|
||||
{
|
||||
$this->em = $om;
|
||||
$this->em = $em;
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
|
@ -76,5 +76,7 @@ class FulfillOldJobOrderCommand extends Command
|
|||
}
|
||||
|
||||
$em->flush();
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,9 +22,9 @@ class FulfillPendingJobOrderCommand extends Command
|
|||
{
|
||||
protected $em;
|
||||
|
||||
public function __construct(EntityManagerInterface $om)
|
||||
public function __construct(EntityManagerInterface $em)
|
||||
{
|
||||
$this->em = $om;
|
||||
$this->em = $em;
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
|
@ -79,5 +79,7 @@ class FulfillPendingJobOrderCommand extends Command
|
|||
}
|
||||
|
||||
$em->flush();
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,9 +21,9 @@ class GenerateBatteryCompatibilityCommand extends Command
|
|||
protected $em;
|
||||
protected $vmfg_index;
|
||||
|
||||
public function __construct(EntityManagerInterface $om)
|
||||
public function __construct(EntityManagerInterface $em)
|
||||
{
|
||||
$this->em = $om;
|
||||
$this->em = $em;
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
|
@ -100,5 +100,7 @@ class GenerateBatteryCompatibilityCommand extends Command
|
|||
fwrite($json_file, json_encode($this->vmfg_index, JSON_PRETTY_PRINT));
|
||||
fclose($json_file);
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -211,5 +211,7 @@ class GenerateWarrantyFromJobOrderCommand extends Command
|
|||
$em->detach($row[0]);
|
||||
$em->clear();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,9 +30,9 @@ class ImportBatteryPriceCommand extends Command
|
|||
protected $em;
|
||||
protected $size_index;
|
||||
|
||||
public function __construct(EntityManagerInterface $om)
|
||||
public function __construct(EntityManagerInterface $em)
|
||||
{
|
||||
$this->em = $om;
|
||||
$this->em = $em;
|
||||
$this->size_index = [];
|
||||
|
||||
parent::__construct();
|
||||
|
|
@ -174,5 +174,7 @@ class ImportBatteryPriceCommand extends Command
|
|||
}
|
||||
|
||||
$em->flush();
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -170,6 +170,8 @@ class ImportCMBBatteryDataCommand extends Command
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected function addBatteryManufacturer($name)
|
||||
|
|
|
|||
|
|
@ -92,9 +92,9 @@ class ImportCMBBatteryTradeInPriceCommand extends Command
|
|||
{
|
||||
error_log('Cannot find battery size ' . $size);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected function loadBatterySizes()
|
||||
|
|
|
|||
|
|
@ -289,6 +289,8 @@ class ImportCMBVehicleCompatibilityCommand extends Command
|
|||
|
||||
$row_num++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected function addVehicleManufacturer($name)
|
||||
|
|
|
|||
|
|
@ -479,5 +479,7 @@ class ImportCustomerCommand extends Command
|
|||
}
|
||||
fclose($cust_file);
|
||||
fclose($cv_file);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,5 +35,7 @@ class ImportKMLFileCommand extends Command
|
|||
$kml_file = $input->getArgument('file');
|
||||
|
||||
$this->importer->getMapData($kml_file);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,9 +44,9 @@ class ImportLegacyJobOrderCommand extends Command
|
|||
protected $row_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->loadBatterySizes();
|
||||
|
|
@ -544,6 +544,8 @@ class ImportLegacyJobOrderCommand extends Command
|
|||
fclose($warr_outfile);
|
||||
fclose($jo_outfile);
|
||||
fclose($jorow_outfile);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected function initializeMaxFieldCounters()
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ use Symfony\Component\Console\Input\InputArgument;
|
|||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
use App\Entity\Outlet;
|
||||
|
|
@ -17,11 +18,11 @@ use DateTime;
|
|||
|
||||
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;
|
||||
|
||||
parent::__construct();
|
||||
|
|
@ -60,7 +61,7 @@ class ImportOutletsCommand extends Command
|
|||
}
|
||||
|
||||
// get entity manager
|
||||
$em = $this->object_manager;
|
||||
$em = $this->em;
|
||||
|
||||
// row counter
|
||||
$row = 1;
|
||||
|
|
@ -167,7 +168,8 @@ class ImportOutletsCommand extends Command
|
|||
{
|
||||
$output->writeln("Errors occurred! Please check the CSV file is in the proper format.");
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected function setObject($obj, $fields)
|
||||
|
|
|
|||
|
|
@ -34,9 +34,9 @@ class ImportPartnersCommand extends Command
|
|||
|
||||
protected $em;
|
||||
|
||||
public function __construct(EntityManagerInterface $om)
|
||||
public function __construct(EntityManagerInterface $em)
|
||||
{
|
||||
$this->em = $om;
|
||||
$this->em = $em;
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
|
@ -163,6 +163,7 @@ class ImportPartnersCommand extends Command
|
|||
$row_num++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ use Symfony\Component\Console\Input\InputArgument;
|
|||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
use App\Entity\SAPBattery;
|
||||
|
|
@ -37,12 +38,14 @@ class ImportSAPBatteryCommand extends Command
|
|||
$this->setName('sap_battery:import')
|
||||
->setDescription('Import a CSV file with SAP battery data.')
|
||||
->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)
|
||||
{
|
||||
$csv_file = $input->getArgument('file');
|
||||
$report_file = $input->getArgument('output_file');
|
||||
|
||||
// CSV column order:
|
||||
// 0 - brand
|
||||
|
|
@ -68,6 +71,9 @@ class ImportSAPBatteryCommand extends Command
|
|||
// has error?
|
||||
$has_error = false;
|
||||
|
||||
$dupe_brands = [];
|
||||
$dupe_sizes = [];
|
||||
$dupe_batteries = [];
|
||||
// loop through rows and build hashes
|
||||
while (($fields = fgetcsv($handle)) !== false)
|
||||
{
|
||||
|
|
@ -77,7 +83,7 @@ class ImportSAPBatteryCommand extends Command
|
|||
|
||||
// clean up fields
|
||||
$clean_brand = trim($fields[0]);
|
||||
$clean_sku = trim($fields[1]);
|
||||
$clean_sku = strtoupper(trim($fields[1]));
|
||||
$clean_size = trim($fields[2]);
|
||||
|
||||
$output->writeln("Parsing $clean_sku...");
|
||||
|
|
@ -92,6 +98,11 @@ class ImportSAPBatteryCommand extends Command
|
|||
|
||||
$this->batt_brand_hash[$clean_brand] = $brand;
|
||||
}
|
||||
else
|
||||
{
|
||||
// add to duplicate list
|
||||
$dupe_brands[] = $clean_brand;
|
||||
}
|
||||
|
||||
// size hash
|
||||
if (!isset($this->batt_size_hash[$clean_size]))
|
||||
|
|
@ -103,6 +114,10 @@ class ImportSAPBatteryCommand extends Command
|
|||
|
||||
$this->batt_size_hash[$clean_size] = $size;
|
||||
}
|
||||
else
|
||||
{
|
||||
$dupe_sizes[] = $clean_size;
|
||||
}
|
||||
|
||||
// battery hash
|
||||
if (!isset($this->battery_hash[$clean_sku]))
|
||||
|
|
@ -110,14 +125,28 @@ class ImportSAPBatteryCommand extends Command
|
|||
// create battery entry
|
||||
$battery = new SAPBattery();
|
||||
$battery->setID($clean_sku)
|
||||
->setSize($size_hash[$clean_size])
|
||||
->setBrand($brand_hash[$clean_brand]);
|
||||
->setSize($this->batt_size_hash[$clean_size])
|
||||
->setBrand($this->batt_brand_hash[$clean_brand]);
|
||||
|
||||
$em->persist($battery);
|
||||
}
|
||||
else
|
||||
{
|
||||
$dupe_batteries[] = $clean_sku;
|
||||
}
|
||||
}
|
||||
|
||||
$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()
|
||||
|
|
@ -146,4 +175,40 @@ class ImportSAPBatteryCommand extends Command
|
|||
foreach ($brands as $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;
|
||||
|
||||
public function __construct(EntityManagerInterface $om)
|
||||
public function __construct(EntityManagerInterface $em)
|
||||
{
|
||||
$this->em = $om;
|
||||
$this->em = $em;
|
||||
$this->vmfg_index = [];
|
||||
$this->v_index = [];
|
||||
$this->batt_index = [];
|
||||
|
|
@ -221,6 +221,6 @@ class ImportVehicleBatteryCommand extends Command
|
|||
|
||||
$em->flush();
|
||||
|
||||
// print_r($batteries);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,9 +28,9 @@ class ImportVehicleCompatibilityCommand extends Command
|
|||
protected $bsize_index;
|
||||
protected $b_index;
|
||||
|
||||
public function __construct(EntityManagerInterface $om)
|
||||
public function __construct(EntityManagerInterface $em)
|
||||
{
|
||||
$this->em = $om;
|
||||
$this->em = $em;
|
||||
$this->vmfg_index = [];
|
||||
$this->v_index = [];
|
||||
$this->b_index = [];
|
||||
|
|
@ -317,6 +317,6 @@ class ImportVehicleCompatibilityCommand extends Command
|
|||
|
||||
$em->flush();
|
||||
|
||||
// print_r($batteries);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,9 +15,9 @@ class MergeDuplicateVehiclesCommand extends Command
|
|||
{
|
||||
protected $em;
|
||||
|
||||
public function __construct(EntityManagerInterface $om)
|
||||
public function __construct(EntityManagerInterface $em)
|
||||
{
|
||||
$this->em = $om;
|
||||
$this->em = $em;
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
|
@ -161,8 +161,7 @@ class MergeDuplicateVehiclesCommand extends Command
|
|||
$em->flush();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// print_r($dupes);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,5 +64,7 @@ class RefreshJobOrderCacheCommand extends Command
|
|||
{
|
||||
$this->jo_cache->addActiveJobOrder($jo);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -142,5 +142,7 @@ class ReportRiderTime extends Command
|
|||
}
|
||||
|
||||
fclose($fh);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,5 +55,7 @@ class SeedRiderSessionsCommand extends Command
|
|||
$this->redis->set($redis_key, $rider_id);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,10 +22,10 @@ class SetCustomerPrivacyPolicyCommand extends Command
|
|||
private $policy_third_party_id;
|
||||
private $policy_mobile_id;
|
||||
|
||||
public function __construct(EntityManagerInterface $om, $policy_promo,
|
||||
public function __construct(EntityManagerInterface $em, $policy_promo,
|
||||
$policy_third_party, $policy_mobile)
|
||||
{
|
||||
$this->em = $om;
|
||||
$this->em = $em;
|
||||
|
||||
$this->policy_promo_id = $policy_promo;
|
||||
$this->policy_third_party_id = $policy_third_party;
|
||||
|
|
@ -80,5 +80,7 @@ class SetCustomerPrivacyPolicyCommand extends Command
|
|||
}
|
||||
|
||||
$this->em->flush();
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,5 +66,7 @@ class TestGeneralSearchCommand extends Command
|
|||
echo "Last Name: " . $warranty->getLastName() . "\n";
|
||||
echo "First Name: " . $warranty->getFirstName() . "\n";
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,5 +40,7 @@ class TestGeofenceCommand extends Command
|
|||
echo "In geofence\n";
|
||||
else
|
||||
echo "NOT in geofence\n";
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,5 +35,7 @@ class TestHubCounterCommand extends Command
|
|||
$available_rc = $this->hc->getAvailableRiderCount($hub_id);
|
||||
|
||||
echo "Available Riders in Hub: " . $available_rc . "\n";
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,5 +36,7 @@ class TestJobOrderManagerCommand extends Command
|
|||
echo "Job Order successfully updated" . "\n";
|
||||
else
|
||||
echo "Job Order not updated" . "\n";
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,5 +34,7 @@ class TestRegAPNSCommand extends Command
|
|||
{
|
||||
$push_id = $input->getArgument('push_id');
|
||||
$this->apns->sendReg($push_id, 'Test Delay', 'Body');
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,5 +42,7 @@ class TestRiderTrackerCommand extends Command
|
|||
{
|
||||
echo "Invalid rider id." . "\n";
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,9 +18,9 @@ class UpdateCustomerVehicleBatteryCommand extends Command
|
|||
protected $em;
|
||||
protected $custvehicle_hash;
|
||||
|
||||
public function __construct(EntityManagerInterface $om)
|
||||
public function __construct(EntityManagerInterface $em)
|
||||
{
|
||||
$this->em = $om;
|
||||
$this->em = $em;
|
||||
$this->custvehicle_hash = [];
|
||||
|
||||
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]);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ use Symfony\Component\Console\Input\InputInterface;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
use Symfony\Component\Filesystem\Exception\IOExceptionInterface;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
use App\Entity\Rider;
|
||||
|
|
@ -18,11 +19,11 @@ use DirectoryIterator;
|
|||
class UploadCleanupCommand extends Command
|
||||
{
|
||||
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->uploader = $uploader;
|
||||
|
||||
|
|
@ -41,7 +42,7 @@ class UploadCleanupCommand extends Command
|
|||
$output->writeln('Retrieving file whitelist...');
|
||||
|
||||
// get all image filenames
|
||||
$em = $this->object_manager;
|
||||
$em = $this->em;
|
||||
|
||||
$riders = $em->getRepository(Rider::class)->findAll();
|
||||
$whitelist = ['.gitkeep'];
|
||||
|
|
@ -95,5 +96,7 @@ class UploadCleanupCommand extends Command
|
|||
$output->writeln('Deleted ' . $i . ' orphaned file(s). Done!');
|
||||
else
|
||||
$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\Output\OutputInterface;
|
||||
use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
use App\Entity\User;
|
||||
|
|
@ -16,12 +17,12 @@ use App\Entity\Role;
|
|||
class UserCreateCommand extends Command
|
||||
{
|
||||
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->object_manager = $om;
|
||||
$this->em = $em;
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
|
@ -49,7 +50,7 @@ class UserCreateCommand extends Command
|
|||
|
||||
// get entity manager
|
||||
// $em = $this->getContainer()->get('doctrine')->getEntityManager();
|
||||
$em = $this->object_manager;
|
||||
$em = $this->em;
|
||||
|
||||
// build user
|
||||
$user->setUsername($username)
|
||||
|
|
@ -66,5 +67,7 @@ class UserCreateCommand extends Command
|
|||
$em->persist($user);
|
||||
|
||||
$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)
|
||||
{
|
||||
$w_mobile = $warranty->getMobileNumber();
|
||||
|
|
|
|||
Loading…
Reference in a new issue