Merge branch '583-modify-command-to-import-car-club-members' into 'master-fix'
Resolve "Modify command to import car club members" See merge request jankstudio/resq!698
This commit is contained in:
commit
3b02bd76e7
1 changed files with 7 additions and 86 deletions
|
|
@ -18,28 +18,11 @@ use App\Entity\CustomerTag;
|
||||||
class ImportCarClubCustomerDataCommand extends Command
|
class ImportCarClubCustomerDataCommand extends Command
|
||||||
{
|
{
|
||||||
// field index in csv file
|
// field index in csv file
|
||||||
const F_TIMESTAMP = 0;
|
const F_DPA = 0;
|
||||||
const F_DPA = 1;
|
const F_FIRST_NAME = 1;
|
||||||
const F_FIRST_NAME = 2;
|
const F_LAST_NAME = 2;
|
||||||
const F_MIDDLE_NAME = 3;
|
const F_CAR_CLUB = 3;
|
||||||
const F_LAST_NAME = 4;
|
const F_CONTACT_NUM = 4;
|
||||||
const F_BIRTHDATE = 5;
|
|
||||||
const F_ADDRESS = 6;
|
|
||||||
const F_CITY = 7;
|
|
||||||
const F_REGION = 8;
|
|
||||||
const F_CAR_CLUB = 9;
|
|
||||||
const F_POSITION = 10;
|
|
||||||
const F_MEMBER_NUM = 11;
|
|
||||||
const F_VEHICLE = 12;
|
|
||||||
const F_VEHICLE_EXCEL = 13;
|
|
||||||
const F_BATT_SIZE = 14;
|
|
||||||
const F_REPLACE_SKED = 15;
|
|
||||||
const F_DEALER_VISIT = 16;
|
|
||||||
const F_CONTACT_NUM = 17;
|
|
||||||
const F_BWI_LOCATION = 18;
|
|
||||||
const F_SAP_CODE = 19;
|
|
||||||
const F_SKU = 20;
|
|
||||||
const F_QTY = 21;
|
|
||||||
|
|
||||||
protected $em;
|
protected $em;
|
||||||
protected $cust_tag_hash;
|
protected $cust_tag_hash;
|
||||||
|
|
@ -145,54 +128,20 @@ class ImportCarClubCustomerDataCommand extends Command
|
||||||
|
|
||||||
protected function setOutputInfo($fields, $status, $reason, $cust_id)
|
protected function setOutputInfo($fields, $status, $reason, $cust_id)
|
||||||
{
|
{
|
||||||
$timestamp = trim($fields[self::F_TIMESTAMP]);
|
|
||||||
$mname = trim($fields[self::F_MIDDLE_NAME]);
|
|
||||||
$birthdate = trim($fields[self::F_BIRTHDATE]);
|
|
||||||
$address = trim($fields[self::F_ADDRESS]);
|
|
||||||
$city = trim($fields[self::F_CITY]);
|
|
||||||
$region = trim($fields[self::F_REGION]);
|
|
||||||
$car_club = trim($fields[self::F_CAR_CLUB]);
|
$car_club = trim($fields[self::F_CAR_CLUB]);
|
||||||
$position = trim($fields[self::F_POSITION]);
|
|
||||||
$member_number = trim($fields[self::F_MEMBER_NUM]);
|
|
||||||
$vehicle = trim($fields[self::F_VEHICLE]);
|
|
||||||
$vehicle_excel = trim($fields[self::F_VEHICLE_EXCEL]);
|
|
||||||
$batt_size = trim($fields[self::F_BATT_SIZE]);
|
|
||||||
$replace_sked = trim($fields[self::F_REPLACE_SKED]);
|
|
||||||
$dealer_visit = trim($fields[self::F_DEALER_VISIT]);
|
|
||||||
$bwi_location = trim($fields[self::F_BWI_LOCATION]);
|
|
||||||
$sap_code = trim($fields[self::F_SAP_CODE]);
|
|
||||||
$sku = trim($fields[self::F_SKU]);
|
|
||||||
$qty = trim($fields[self::F_QTY]);
|
|
||||||
$fname = trim($fields[self::F_FIRST_NAME]);
|
$fname = trim($fields[self::F_FIRST_NAME]);
|
||||||
$lname = trim($fields[self::F_LAST_NAME]);
|
$lname = trim($fields[self::F_LAST_NAME]);
|
||||||
$dpa = trim($fields[self::F_DPA]);
|
$dpa = trim($fields[self::F_DPA]);
|
||||||
$contact_number = trim($fields[SELF::F_CONTACT_NUM]);
|
$contact_number = trim($fields[SELF::F_CONTACT_NUM]);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
$timestamp,
|
|
||||||
$dpa,
|
$dpa,
|
||||||
$fname,
|
$fname,
|
||||||
$mname,
|
|
||||||
$lname,
|
$lname,
|
||||||
$birthdate,
|
|
||||||
$address,
|
|
||||||
$city,
|
|
||||||
$region,
|
|
||||||
$car_club,
|
$car_club,
|
||||||
$position,
|
|
||||||
$member_number,
|
|
||||||
$vehicle,
|
|
||||||
$vehicle_excel,
|
|
||||||
$batt_size,
|
|
||||||
$replace_sked,
|
|
||||||
$dealer_visit,
|
|
||||||
$contact_number,
|
$contact_number,
|
||||||
$bwi_location,
|
$status,
|
||||||
$sap_code,
|
$reason,
|
||||||
$sku,
|
|
||||||
$qty,
|
|
||||||
$status,
|
|
||||||
$reason,
|
|
||||||
$cust_id
|
$cust_id
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
@ -237,17 +186,6 @@ class ImportCarClubCustomerDataCommand extends Command
|
||||||
// clean up contact number
|
// clean up contact number
|
||||||
$valid_contact_numbers = $this->getValidContactNumbers($contact_number);
|
$valid_contact_numbers = $this->getValidContactNumbers($contact_number);
|
||||||
|
|
||||||
// NOTE: commenting this out because we want to add customers without mobile number
|
|
||||||
/*
|
|
||||||
// QUESTION: do we need this?
|
|
||||||
// QUESTION: why are we not adding those without contact numbers? Add customer, leave contact number blank was what was agreed, right?
|
|
||||||
if (count($valid_contact_numbers) <= 0)
|
|
||||||
{
|
|
||||||
// add info to output array
|
|
||||||
return $this->setOutputInfo($fields, 'NOT CREATED', 'Missing contact number', 0);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
// check customer tag
|
// check customer tag
|
||||||
$cust_tag = $this->findCustomerTag($car_club);
|
$cust_tag = $this->findCustomerTag($car_club);
|
||||||
$cust_id = '';
|
$cust_id = '';
|
||||||
|
|
@ -310,28 +248,11 @@ class ImportCarClubCustomerDataCommand extends Command
|
||||||
|
|
||||||
// write the headers
|
// write the headers
|
||||||
fputcsv($fh, [
|
fputcsv($fh, [
|
||||||
'Timestamp',
|
|
||||||
'I have read and understood and agreed to the confidentiality of this form request',
|
'I have read and understood and agreed to the confidentiality of this form request',
|
||||||
'First Name',
|
'First Name',
|
||||||
'Middle Name',
|
|
||||||
'Last Name',
|
'Last Name',
|
||||||
'Birth date',
|
|
||||||
'Address',
|
|
||||||
'City',
|
|
||||||
'Region',
|
|
||||||
'Car Club/Organization',
|
'Car Club/Organization',
|
||||||
'Position in the organization',
|
|
||||||
'Official Member Number (type NA if not applicable)',
|
|
||||||
'Vehicles you own? Year - Make -Model - Plate/Conduction number (ex 2017 NISSAN NAVARA ABC 1234) you can indicate all your vehicles',
|
|
||||||
'If your were given a chance to EXperience the New Motolite Excel, Choose 1 vehicle and it\'s plate/conduction number',
|
|
||||||
'What is the Battery size of the vehicle you with to EXperience the New Motolite Excel',
|
|
||||||
'Given a specific date, when can you schedule your replacement?',
|
|
||||||
'Will you be able to visit our dealer that we will assign nearest to you?',
|
|
||||||
'Contact Number',
|
'Contact Number',
|
||||||
'BWI LOCATION',
|
|
||||||
'SAP CODE',
|
|
||||||
'SKU',
|
|
||||||
'QTY',
|
|
||||||
'Status',
|
'Status',
|
||||||
'Reason',
|
'Reason',
|
||||||
'Customer ID',
|
'Customer ID',
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue