Merge branch '579-add-warranty-source-to-warranty-entity' into 'master-fix'
Change retrieval of API username. #579 See merge request jankstudio/resq!693
This commit is contained in:
commit
da6b344bef
2 changed files with 2 additions and 31 deletions
|
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
namespace App\Controller\CAPI;
|
namespace App\Controller\CAPI;
|
||||||
|
|
||||||
use Catalyst\APIBundle\Entity\User as APIUser;
|
|
||||||
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpKernel\KernelInterface;
|
use Symfony\Component\HttpKernel\KernelInterface;
|
||||||
|
|
@ -320,7 +318,7 @@ class CustomerWarrantyController extends APIController
|
||||||
|
|
||||||
// get the api_user that made the call so that it gets added to the source
|
// get the api_user that made the call so that it gets added to the source
|
||||||
// source becomes CAPI_USER_<insert name of api user here>
|
// source becomes CAPI_USER_<insert name of api user here>
|
||||||
$username = $this->getAPIUsername($em, $user_id);
|
$username = $this->getUser()->getName();
|
||||||
$source = 'CAPI_USER_' . $username;
|
$source = 'CAPI_USER_' . $username;
|
||||||
|
|
||||||
error_log('SOURCE: ' . $source);
|
error_log('SOURCE: ' . $source);
|
||||||
|
|
@ -587,16 +585,4 @@ class CustomerWarrantyController extends APIController
|
||||||
|
|
||||||
$rt->sendSMS($clean_num, 'MOTOLITE', $message);
|
$rt->sendSMS($clean_num, 'MOTOLITE', $message);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getAPIUsername($em, $user_id)
|
|
||||||
{
|
|
||||||
$api_user_result = $em->getRepository(APIUser::class)->findBy(['api_key' => $user_id]);
|
|
||||||
$username = '';
|
|
||||||
foreach ($api_user_result as $api_user)
|
|
||||||
{
|
|
||||||
$username = $api_user->getName();
|
|
||||||
}
|
|
||||||
|
|
||||||
return $username;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
namespace App\Controller\CAPI;
|
namespace App\Controller\CAPI;
|
||||||
|
|
||||||
use Catalyst\APIBundle\Entity\User as APIUser;
|
|
||||||
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Doctrine\ORM\Query;
|
use Doctrine\ORM\Query;
|
||||||
|
|
@ -196,7 +194,7 @@ class WarrantyController extends APIController
|
||||||
|
|
||||||
// get the api_user that made the call so that it gets added to the source
|
// get the api_user that made the call so that it gets added to the source
|
||||||
// source becomes CAPI_USER_<insert name of api user here>
|
// source becomes CAPI_USER_<insert name of api user here>
|
||||||
$username = $this->getAPIUsername($em, $user_id);
|
$username = $this->getUser()->getName();
|
||||||
|
|
||||||
$source = 'CAPI_USER_' . $username;
|
$source = 'CAPI_USER_' . $username;
|
||||||
|
|
||||||
|
|
@ -788,17 +786,4 @@ class WarrantyController extends APIController
|
||||||
$customers = $em->getRepository(Customer::class)->findBy(['phone_mobile' => $number]);
|
$customers = $em->getRepository(Customer::class)->findBy(['phone_mobile' => $number]);
|
||||||
return $customers;
|
return $customers;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getAPIUsername($em, $user_id)
|
|
||||||
{
|
|
||||||
$api_user_result = $em->getRepository(APIUser::class)->findBy(['api_key' => $user_id]);
|
|
||||||
$username = '';
|
|
||||||
foreach ($api_user_result as $api_user)
|
|
||||||
{
|
|
||||||
$username = $api_user->getName();
|
|
||||||
}
|
|
||||||
|
|
||||||
return $username;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue