Fix issues found. #572
This commit is contained in:
parent
7d99eab2cc
commit
6a075bd46b
1 changed files with 12 additions and 11 deletions
|
|
@ -114,26 +114,24 @@ class ImportCarClubCustomerDataCommand extends Command
|
||||||
$tag_name = $this->normalizeClubName($car_club);
|
$tag_name = $this->normalizeClubName($car_club);
|
||||||
error_log($tag_name);
|
error_log($tag_name);
|
||||||
$cust_tag = null;
|
$cust_tag = null;
|
||||||
if (isset($this->cust_tag_hash[$tag_name]))
|
if (!isset($this->cust_tag_hash[$tag_name]))
|
||||||
{
|
|
||||||
error_log('customer tag in hash');
|
|
||||||
$cust_tag = $this->cust_tag_hash[$tag_name];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
|
error_log('customer tag not in hash...');
|
||||||
// create the customer tag
|
// create the customer tag
|
||||||
$new_cust_tag = new CustomerTag();
|
$new_cust_tag = new CustomerTag();
|
||||||
$tag_details = json_decode('{"type":"car club"}', true);
|
$tag_details = json_decode('{"type":"car club"}', true);
|
||||||
$new_cust_tag->setID($tag_name)
|
$new_cust_tag->setID($tag_name)
|
||||||
->setName(strtoupper($car_club))
|
->setName(strtoupper($car_club))
|
||||||
->setTagDetails($tag_details);
|
->setTagDetails($tag_details);
|
||||||
// add to hash
|
|
||||||
$this->cust_tag_hash[$tag_name] = $new_cust_tag;
|
|
||||||
|
|
||||||
$this->em->persist($new_cust_tag);
|
$this->em->persist($new_cust_tag);
|
||||||
|
|
||||||
$cust_tag = $new_cust_tag;
|
// need to flush before adding to hash
|
||||||
|
$this->em->flush();
|
||||||
|
|
||||||
|
$this->cust_tag_hash[$tag_name] = $new_cust_tag;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
$cust_tag = $this->cust_tag_hash[$tag_name];
|
||||||
|
|
||||||
// check in case of multiple numbers
|
// check in case of multiple numbers
|
||||||
// check contact number if mobile or not
|
// check contact number if mobile or not
|
||||||
|
|
@ -202,6 +200,9 @@ class ImportCarClubCustomerDataCommand extends Command
|
||||||
if (strtoupper($dpa) == 'YES')
|
if (strtoupper($dpa) == 'YES')
|
||||||
$is_dpa = true;
|
$is_dpa = true;
|
||||||
|
|
||||||
|
// get the customer tag?
|
||||||
|
$c_tag = $this->em->getRepository(CustomerTag::class)->find($cust_tag->getID());
|
||||||
|
|
||||||
// create new customer
|
// create new customer
|
||||||
$new_cust = new Customer();
|
$new_cust = new Customer();
|
||||||
$new_cust->setFirstName($fname)
|
$new_cust->setFirstName($fname)
|
||||||
|
|
@ -209,7 +210,7 @@ class ImportCarClubCustomerDataCommand extends Command
|
||||||
->setPhoneMobile($clean_number)
|
->setPhoneMobile($clean_number)
|
||||||
->setDpaConsent($is_dpa)
|
->setDpaConsent($is_dpa)
|
||||||
->setCreateSource('car_club_file')
|
->setCreateSource('car_club_file')
|
||||||
->addCustomerTag($cust_tag);
|
->addCustomerTag($c_tag);
|
||||||
|
|
||||||
$this->em->persist($new_cust);
|
$this->em->persist($new_cust);
|
||||||
$this->em->flush();
|
$this->em->flush();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue