Add setting of privacy policy for customer when user updates info for mobile session and when user sends privacy settings for third party and promo. #233
This commit is contained in:
parent
50a3afb213
commit
b657ae95d5
1 changed files with 43 additions and 1 deletions
|
|
@ -395,6 +395,17 @@ class APIController extends Controller
|
||||||
// update mobile phone of customer
|
// update mobile phone of customer
|
||||||
$cust->setPhoneMobile(substr($this->session->getPhoneNumber(), 2));
|
$cust->setPhoneMobile(substr($this->session->getPhoneNumber(), 2));
|
||||||
|
|
||||||
|
// get privacy policy for mobile
|
||||||
|
$policy = $em->createQuery('SELECT policy FROM App\Entity\PrivacyPolicy policy WHERE policy.name LIKE :policy_type')
|
||||||
|
->setParameter('policy_type', "%" . "mobile" . "%")
|
||||||
|
->getOneOrNullResult();
|
||||||
|
|
||||||
|
// set policy id
|
||||||
|
if ($policy != null)
|
||||||
|
{
|
||||||
|
$cust->setPrivacyPolicyMobile($policy);
|
||||||
|
}
|
||||||
|
|
||||||
$em->flush();
|
$em->flush();
|
||||||
|
|
||||||
return $res->getReturnResponse();
|
return $res->getReturnResponse();
|
||||||
|
|
@ -1787,9 +1798,40 @@ class APIController extends Controller
|
||||||
|
|
||||||
// set privacy settings
|
// set privacy settings
|
||||||
$priv_promo = $req->request->get('priv_promo', false);
|
$priv_promo = $req->request->get('priv_promo', false);
|
||||||
$cust->setPrivacyThirdParty($req->request->get('priv_third_party'))
|
$priv_third_party = $req->request->get('priv_third_party');
|
||||||
|
$cust->setPrivacyThirdParty($priv_third_party)
|
||||||
->setPrivacyPromo($priv_promo);
|
->setPrivacyPromo($priv_promo);
|
||||||
|
|
||||||
|
// check if privacy settings are true
|
||||||
|
// if true, set the private policy for the customer
|
||||||
|
if ($priv_promo)
|
||||||
|
{
|
||||||
|
// find the promo policy
|
||||||
|
$policy = $em->createQuery('SELECT policy FROM App\Entity\PrivacyPolicy policy WHERE policy.name LIKE :policy_type')
|
||||||
|
->setParameter('policy_type', "%" . "promo" . "%")
|
||||||
|
->getOneOrNullResult();
|
||||||
|
|
||||||
|
// set policy id
|
||||||
|
if ($policy != null)
|
||||||
|
{
|
||||||
|
$cust->setPrivacyPolicyPromo($policy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($priv_third_party)
|
||||||
|
{
|
||||||
|
// find the third party policy
|
||||||
|
$policy = $em->createQuery('SELECT policy FROM App\Entity\PrivacyPolicy policy WHERE policy.name LIKE :policy_type')
|
||||||
|
->setParameter('policy_type', "%" . "third party" . "%")
|
||||||
|
->getOneOrNullResult();
|
||||||
|
|
||||||
|
// set policy id
|
||||||
|
if ($policy != null)
|
||||||
|
{
|
||||||
|
$cust->setPrivacyPolicyThirdParty($policy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$em->flush();
|
$em->flush();
|
||||||
|
|
||||||
return $res->getReturnResponse();
|
return $res->getReturnResponse();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue