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);
|
||||
error_log($tag_name);
|
||||
$cust_tag = null;
|
||||
if (isset($this->cust_tag_hash[$tag_name]))
|
||||
{
|
||||
error_log('customer tag in hash');
|
||||
$cust_tag = $this->cust_tag_hash[$tag_name];
|
||||
}
|
||||
else
|
||||
if (!isset($this->cust_tag_hash[$tag_name]))
|
||||
{
|
||||
error_log('customer tag not in hash...');
|
||||
// create the customer tag
|
||||
$new_cust_tag = new CustomerTag();
|
||||
$tag_details = json_decode('{"type":"car club"}', true);
|
||||
$new_cust_tag->setID($tag_name)
|
||||
->setName(strtoupper($car_club))
|
||||
->setTagDetails($tag_details);
|
||||
// add to hash
|
||||
$this->cust_tag_hash[$tag_name] = $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 contact number if mobile or not
|
||||
|
|
@ -202,6 +200,9 @@ class ImportCarClubCustomerDataCommand extends Command
|
|||
if (strtoupper($dpa) == 'YES')
|
||||
$is_dpa = true;
|
||||
|
||||
// get the customer tag?
|
||||
$c_tag = $this->em->getRepository(CustomerTag::class)->find($cust_tag->getID());
|
||||
|
||||
// create new customer
|
||||
$new_cust = new Customer();
|
||||
$new_cust->setFirstName($fname)
|
||||
|
|
@ -209,7 +210,7 @@ class ImportCarClubCustomerDataCommand extends Command
|
|||
->setPhoneMobile($clean_number)
|
||||
->setDpaConsent($is_dpa)
|
||||
->setCreateSource('car_club_file')
|
||||
->addCustomerTag($cust_tag);
|
||||
->addCustomerTag($c_tag);
|
||||
|
||||
$this->em->persist($new_cust);
|
||||
$this->em->flush();
|
||||
|
|
|
|||
Loading…
Reference in a new issue