Merge branch '233-privacy-policy-fixes' into 'master'
Add policy ids to the .env.dist file. Modify the query to get policy in the APIController. #233 Closes #233 See merge request jankstudio/resq!275
This commit is contained in:
commit
c8cb0baec0
2 changed files with 16 additions and 7 deletions
|
|
@ -34,4 +34,8 @@ REDIS_CLIENT_SCHEME=tcp
|
||||||
REDIS_CLIENT_HOST=127.0.0.1
|
REDIS_CLIENT_HOST=127.0.0.1
|
||||||
REDIS_CLIENT_PORT=6379
|
REDIS_CLIENT_PORT=6379
|
||||||
REDIS_CLIENT_PASSWORD=foobared
|
REDIS_CLIENT_PASSWORD=foobared
|
||||||
#
|
|
||||||
|
# privacy policy ids
|
||||||
|
POLICY_PROMO=insertpromopolicyidhere
|
||||||
|
POLICY_THIRD_PARTY=insertthirdpartypolicyidhere
|
||||||
|
POLICY_MOBILE=insertmobilepolicyidhere
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||||
|
use Symfony\Component\Dotenv\Dotenv;
|
||||||
|
|
||||||
use CrEOF\Spatial\PHP\Types\Geometry\Point;
|
use CrEOF\Spatial\PHP\Types\Geometry\Point;
|
||||||
|
|
||||||
|
|
@ -43,6 +44,7 @@ use App\Entity\Warranty;
|
||||||
use App\Entity\Service;
|
use App\Entity\Service;
|
||||||
use App\Entity\Partner;
|
use App\Entity\Partner;
|
||||||
use App\Entity\Review;
|
use App\Entity\Review;
|
||||||
|
use App\Entity\PrivacyPolicy;
|
||||||
|
|
||||||
use DateTime;
|
use DateTime;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
@ -1802,14 +1804,19 @@ class APIController extends Controller
|
||||||
$cust->setPrivacyThirdParty($priv_third_party)
|
$cust->setPrivacyThirdParty($priv_third_party)
|
||||||
->setPrivacyPromo($priv_promo);
|
->setPrivacyPromo($priv_promo);
|
||||||
|
|
||||||
|
// get the policy ids from .env
|
||||||
|
$dotenv = new Dotenv();
|
||||||
|
$dotenv->loadEnv(__DIR__.'/../../.env');
|
||||||
|
|
||||||
|
$policy_promo_id = $_ENV['POLICY_PROMO'];
|
||||||
|
$policy_third_party_id = $_ENV['POLICY_THIRD_PARTY'];
|
||||||
|
|
||||||
// check if privacy settings are true
|
// check if privacy settings are true
|
||||||
// if true, set the private policy for the customer
|
// if true, set the private policy for the customer
|
||||||
if ($priv_promo)
|
if ($priv_promo)
|
||||||
{
|
{
|
||||||
// find the promo policy
|
// find the promo policy
|
||||||
$policy = $em->createQuery('SELECT policy FROM App\Entity\PrivacyPolicy policy WHERE policy.name LIKE :policy_type')
|
$policy = $em->getRepository(PrivacyPolicy::class)->findOneBy(['id' => $policy_promo_id]);
|
||||||
->setParameter('policy_type', "%" . "promo" . "%")
|
|
||||||
->getOneOrNullResult();
|
|
||||||
|
|
||||||
// set policy id
|
// set policy id
|
||||||
if ($policy != null)
|
if ($policy != null)
|
||||||
|
|
@ -1821,9 +1828,7 @@ class APIController extends Controller
|
||||||
if ($priv_third_party)
|
if ($priv_third_party)
|
||||||
{
|
{
|
||||||
// find the third party policy
|
// find the third party policy
|
||||||
$policy = $em->createQuery('SELECT policy FROM App\Entity\PrivacyPolicy policy WHERE policy.name LIKE :policy_type')
|
$policy = $em->getRepository(PrivacyPolicy::class)->findOneBy(['id' => $policy_third_party_id]);
|
||||||
->setParameter('policy_type', "%" . "third party" . "%")
|
|
||||||
->getOneOrNullResult();
|
|
||||||
|
|
||||||
// set policy id
|
// set policy id
|
||||||
if ($policy != null)
|
if ($policy != null)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue