Fix bugs during testing customer tag removal. #591

This commit is contained in:
Korina Cordero 2021-07-21 06:36:47 +00:00
parent e33b9eb719
commit 64bf68e445
3 changed files with 9 additions and 5 deletions

View file

@ -158,7 +158,7 @@ class JobOrderController extends APIController
if ($jo->getServiceType() == ServiceType::BATTERY_REPLACEMENT_NEW) if ($jo->getServiceType() == ServiceType::BATTERY_REPLACEMENT_NEW)
{ {
$customer_tags = $cust->getCustomerTagObjects(); $customer_tags = $cust->getCustomerTagObjects();
$jo_manager->removeCustomerTag($jo, $customer_tags, $mobile_user->getID()); $jo_manager->removeCustomerTag($jo, $cust, $customer_tags, $mobile_user->getID());
} }
return new APIResponse(true, 'Job order created', $data); return new APIResponse(true, 'Job order created', $data);
@ -290,7 +290,7 @@ class JobOrderController extends APIController
if ($jo->getServiceType() == ServiceType::BATTERY_REPLACEMENT_NEW) if ($jo->getServiceType() == ServiceType::BATTERY_REPLACEMENT_NEW)
{ {
$customer_tags = $cust->getCustomerTagObjects(); $customer_tags = $cust->getCustomerTagObjects();
$jo_manager->removeCustomerTag($jo, $customer_tags, $mobile_user->getID()); $jo_manager->removeCustomerTag($jo, $cust, $customer_tags, $mobile_user->getID());
} }
return new APIResponse(true, 'Job order created', $data); return new APIResponse(true, 'Job order created', $data);

View file

@ -408,7 +408,7 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
if (!empty($customer_tags)) if (!empty($customer_tags))
{ {
$username = $jo->getCreatedBy()->getUsername(); $username = $jo->getCreatedBy()->getUsername();
$this->jo_manager->removeCustomerTag($jo, $customer_tags, $username); $this->jo_manager->removeCustomerTag($jo, $customer, $customer_tags, $username);
} }
} }
} }

View file

@ -9,6 +9,7 @@ use Symfony\Component\Security\Core\Security;
use App\Entity\JobOrder; use App\Entity\JobOrder;
use App\Entity\JOEvent; use App\Entity\JOEvent;
use App\Entity\User; use App\Entity\User;
use App\Entity\Customer;
use App\Ramcar\ServiceType; use App\Ramcar\ServiceType;
use App\Ramcar\JOStatus; use App\Ramcar\JOStatus;
@ -22,14 +23,17 @@ class JobOrderManager
protected $security; protected $security;
protected $rah; protected $rah;
protected $mclient; protected $mclient;
protected $promo_logger;
public function __construct(EntityManagerInterface $em, Security $security, public function __construct(EntityManagerInterface $em, Security $security,
RiderAssignmentHandlerInterface $rah, MQTTClient $mclient) RiderAssignmentHandlerInterface $rah, MQTTClient $mclient,
PromoLogger $promo_logger)
{ {
$this->em = $em; $this->em = $em;
$this->security = $security; $this->security = $security;
$this->rah = $rah; $this->rah = $rah;
$this->mclient = $mclient; $this->mclient = $mclient;
$this->promo_logger = $promo_logger;
} }
public function fulfillJobOrder($jo_id) public function fulfillJobOrder($jo_id)
@ -136,7 +140,7 @@ class JobOrderManager
} }
} }
public function removeCustomerTag(JobOrder $jo, $customer_tags, $username) public function removeCustomerTag(JobOrder $jo, Customer $customer, $customer_tags, $username)
{ {
foreach ($customer_tags as $customer_tag) foreach ($customer_tags as $customer_tag)
{ {