Revert "Merge branch '256-privacy-policy-for-warranty' into 'master'"
This reverts merge request !302
This commit is contained in:
parent
8d19f6e9b9
commit
96bd2684b1
5 changed files with 1 additions and 89 deletions
|
|
@ -18,8 +18,6 @@ access_keys:
|
|||
label: Cancel
|
||||
- id: warranty.delete
|
||||
label: Delete
|
||||
- id: warranty.set.privacypolicy
|
||||
label: Set Privacy Policy
|
||||
- id: batterybrand
|
||||
label: Battery Brand Access
|
||||
acls:
|
||||
|
|
|
|||
|
|
@ -149,8 +149,3 @@ api_partner_review:
|
|||
path: /api/partners/{pid}/review
|
||||
controller: App\Controller\APIController:reviewPartner
|
||||
methods: [POST]
|
||||
|
||||
api_warranty_privacy_policy:
|
||||
path: /api/warranty/{wid}/privacy_policy
|
||||
controller: App\Controller\APIController::setPrivacyPolicy
|
||||
methods: [POST]
|
||||
|
|
|
|||
|
|
@ -81,8 +81,7 @@ class APIController extends Controller
|
|||
else if ($req->getMethod() == 'POST')
|
||||
{
|
||||
$check = $req->request->get($param);
|
||||
//if (empty($check))
|
||||
if (!isset($check))
|
||||
if (empty($check))
|
||||
$missing[] = $param;
|
||||
}
|
||||
else
|
||||
|
|
@ -2183,53 +2182,4 @@ class APIController extends Controller
|
|||
|
||||
return $res->getReturnResponse();
|
||||
}
|
||||
|
||||
public function setPrivacyPolicy($wid, Request $req, EntityManagerInterface $em)
|
||||
{
|
||||
$required_params = [
|
||||
'privacy_policy_id',
|
||||
];
|
||||
|
||||
$res = $this->checkParamsAndKey($req, $em, $required_params);
|
||||
if ($res->isError())
|
||||
return $res->getReturnResponse();
|
||||
|
||||
$policy_id = $req->request->get('privacy_policy_id');
|
||||
|
||||
// check if warranty exists
|
||||
$warranty = $em->getRepository(Warranty::class)->find($wid);
|
||||
if ($warranty == null)
|
||||
{
|
||||
$res->setError(true)
|
||||
->setErrorMessage('No warranty found.');
|
||||
return $res->getReturnResponse();
|
||||
}
|
||||
|
||||
if ($policy_id == 0)
|
||||
{
|
||||
$warranty->setPrivacyPolicy(null);
|
||||
}
|
||||
else
|
||||
{
|
||||
// find the privacy policy
|
||||
$privacy_policy = $em->getRepository(PrivacyPolicy::class)->find($policy_id);
|
||||
if ($privacy_policy == null)
|
||||
{
|
||||
$res->setError(true)
|
||||
->setErrorMessage('No privacy policy found.');
|
||||
return $res->getReturnResponse();
|
||||
}
|
||||
|
||||
$warranty->setPrivacyPolicy($privacy_policy);
|
||||
}
|
||||
|
||||
// save to db
|
||||
$em->persist($warranty);
|
||||
$em->flush();
|
||||
|
||||
$data = [];
|
||||
$res->setData($data);
|
||||
|
||||
return $res->getReturnResponse();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,11 +48,6 @@ class PrivacyPolicy
|
|||
*/
|
||||
protected $cust_promo;
|
||||
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity="Warranty", mappedBy="privacy_policy")
|
||||
*/
|
||||
protected $warranties;
|
||||
|
||||
public function getID()
|
||||
{
|
||||
return $this->id;
|
||||
|
|
|
|||
|
|
@ -127,13 +127,6 @@ class Warranty
|
|||
*/
|
||||
protected $flag_activated;
|
||||
|
||||
// privacy policy
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="PrivacyPolicy", inversedBy="warranties")
|
||||
* @ORM\JoinColumn(name="warranty_privacy_policy", referencedColumnName="id", nullable=true)
|
||||
*/
|
||||
protected $privacy_policy;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->date_create = new DateTime();
|
||||
|
|
@ -373,23 +366,4 @@ class Warranty
|
|||
{
|
||||
return $this->flag_activated;
|
||||
}
|
||||
|
||||
public function hasPrivacyPolicy()
|
||||
{
|
||||
if ($this->privacy_policy == null)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function setPrivacyPolicy($privacy_policy)
|
||||
{
|
||||
$this->privacy_policy = $privacy_policy;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPrivacyPolicy()
|
||||
{
|
||||
return $this->privacy_policy;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue