Add mobile api privacy settings call #130
This commit is contained in:
parent
7d3873022e
commit
be5a66e68a
2 changed files with 64 additions and 0 deletions
|
|
@ -1428,4 +1428,33 @@ class APIController extends Controller
|
||||||
|
|
||||||
return $res->getReturnResponse();
|
return $res->getReturnResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function privacySettings(Request $req)
|
||||||
|
{
|
||||||
|
$required_params = [
|
||||||
|
'priv_third_party',
|
||||||
|
'priv_promo',
|
||||||
|
];
|
||||||
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
$res = $this->checkParamsAndKey($req, $em, $required_params);
|
||||||
|
if ($res->isError())
|
||||||
|
return $res->getReturnResponse();
|
||||||
|
|
||||||
|
// get customer
|
||||||
|
$cust = $this->session->getCustomer();
|
||||||
|
if ($cust == null)
|
||||||
|
{
|
||||||
|
$res->setError(true)
|
||||||
|
->setErrorMessage('No customer information found');
|
||||||
|
return $res->getReturnResponse();
|
||||||
|
}
|
||||||
|
|
||||||
|
// set privacy settings
|
||||||
|
$cust->setPrivacyThirdParty($req->request->get('priv_third_party'))
|
||||||
|
->setPrivacyPromo($req->request->get('priv_promo'));
|
||||||
|
|
||||||
|
$em->flush();
|
||||||
|
|
||||||
|
return $res->getReturnResponse();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -131,6 +131,16 @@ class Customer
|
||||||
*/
|
*/
|
||||||
protected $email;
|
protected $email;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="boolean")
|
||||||
|
*/
|
||||||
|
protected $priv_third_party;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="boolean")
|
||||||
|
*/
|
||||||
|
protected $priv_promo;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->numbers = new ArrayCollection();
|
$this->numbers = new ArrayCollection();
|
||||||
|
|
@ -152,6 +162,9 @@ class Customer
|
||||||
$this->phone_fax = '';
|
$this->phone_fax = '';
|
||||||
|
|
||||||
$this->email = '';
|
$this->email = '';
|
||||||
|
|
||||||
|
$this->priv_third_party = 0;
|
||||||
|
$this->priv_promo = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getID()
|
public function getID()
|
||||||
|
|
@ -379,4 +392,26 @@ class Customer
|
||||||
{
|
{
|
||||||
return $this->email;
|
return $this->email;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setPrivacyThirdParty($bool = true)
|
||||||
|
{
|
||||||
|
$this->priv_third_party = $bool;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPrivacyThirdParty()
|
||||||
|
{
|
||||||
|
return $this->priv_third_party;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setPrivacyPromo($bool = true)
|
||||||
|
{
|
||||||
|
$this->priv_promo = $bool;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPrivacyPromo()
|
||||||
|
{
|
||||||
|
return $this->priv_promo;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue