* [FIX] Fixed wrong behavior when searching for accounts on accounts manager. Thanks to @Weptun for the feedback. Closes #1271

* [ADD] Added missing tests
* [MOD] Code cleanup

Signed-off-by: Rubén D <nuxsmin@syspass.org>
This commit is contained in:
Rubén D
2019-04-21 23:12:45 +02:00
parent b3906afa13
commit 2318796c00
366 changed files with 5141 additions and 3752 deletions

View File

@@ -25,9 +25,17 @@
namespace SP\Modules\Web\Controllers;
use DI\DependencyException;
use DI\NotFoundException;
use Exception;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use SP\Core\Acl\Acl;
use SP\Core\Events\Event;
use SP\Core\Events\EventMessage;
use SP\Core\Exceptions\ConstraintException;
use SP\Core\Exceptions\QueryException;
use SP\Core\Exceptions\SPException;
use SP\Core\Exceptions\ValidationException;
use SP\DataModel\ClientData;
use SP\Http\JsonResponse;
@@ -36,7 +44,10 @@ use SP\Modules\Web\Controllers\Traits\ItemTrait;
use SP\Modules\Web\Controllers\Traits\JsonTrait;
use SP\Modules\Web\Forms\ClientForm;
use SP\Mvc\Controller\CrudControllerInterface;
use SP\Repositories\NoSuchItemException;
use SP\Services\Auth\AuthException;
use SP\Services\Client\ClientService;
use SP\Services\ServiceException;
/**
* Class ClientController
@@ -56,11 +67,11 @@ final class ClientController extends ControllerBase implements CrudControllerInt
* Search action
*
* @return bool
* @throws \DI\DependencyException
* @throws \DI\NotFoundException
* @throws \SP\Core\Exceptions\ConstraintException
* @throws \SP\Core\Exceptions\QueryException
* @throws \SP\Core\Exceptions\SPException
* @throws DependencyException
* @throws NotFoundException
* @throws ConstraintException
* @throws QueryException
* @throws SPException
*/
public function searchAction()
{
@@ -81,10 +92,10 @@ final class ClientController extends ControllerBase implements CrudControllerInt
* getSearchGrid
*
* @return $this
* @throws \DI\DependencyException
* @throws \DI\NotFoundException
* @throws \SP\Core\Exceptions\ConstraintException
* @throws \SP\Core\Exceptions\QueryException
* @throws DependencyException
* @throws NotFoundException
* @throws ConstraintException
* @throws QueryException
*/
protected function getSearchGrid()
{
@@ -116,7 +127,7 @@ final class ClientController extends ControllerBase implements CrudControllerInt
$this->eventDispatcher->notifyEvent('show.client.create', new Event($this));
return $this->returnJsonResponseData(['html' => $this->render()]);
} catch (\Exception $e) {
} catch (Exception $e) {
processException($e);
$this->eventDispatcher->notifyEvent('exception', new Event($e));
@@ -130,10 +141,10 @@ final class ClientController extends ControllerBase implements CrudControllerInt
*
* @param $clientId
*
* @throws \SP\Core\Exceptions\ConstraintException
* @throws \SP\Core\Exceptions\QueryException
* @throws \SP\Services\ServiceException
* @throws \SP\Repositories\NoSuchItemException
* @throws ConstraintException
* @throws QueryException
* @throws ServiceException
* @throws NoSuchItemException
*/
protected function setViewData($clientId = null)
{
@@ -182,7 +193,7 @@ final class ClientController extends ControllerBase implements CrudControllerInt
$this->eventDispatcher->notifyEvent('show.client.edit', new Event($this));
return $this->returnJsonResponseData(['html' => $this->render()]);
} catch (\Exception $e) {
} catch (Exception $e) {
processException($e);
$this->eventDispatcher->notifyEvent('exception', new Event($e));
@@ -230,7 +241,7 @@ final class ClientController extends ControllerBase implements CrudControllerInt
);
return $this->returnJsonResponse(JsonResponse::JSON_SUCCESS, __u('Client deleted'));
} catch (\Exception $e) {
} catch (Exception $e) {
processException($e);
$this->eventDispatcher->notifyEvent('exception', new Event($e));
@@ -268,7 +279,7 @@ final class ClientController extends ControllerBase implements CrudControllerInt
return $this->returnJsonResponse(JsonResponse::JSON_SUCCESS, __u('Client added'));
} catch (ValidationException $e) {
return $this->returnJsonResponseException($e);
} catch (\Exception $e) {
} catch (Exception $e) {
processException($e);
$this->eventDispatcher->notifyEvent('exception', new Event($e));
@@ -308,7 +319,7 @@ final class ClientController extends ControllerBase implements CrudControllerInt
return $this->returnJsonResponse(JsonResponse::JSON_SUCCESS, __u('Client updated'));
} catch (ValidationException $e) {
return $this->returnJsonResponseException($e);
} catch (\Exception $e) {
} catch (Exception $e) {
processException($e);
$this->eventDispatcher->notifyEvent('exception', new Event($e));
@@ -341,7 +352,7 @@ final class ClientController extends ControllerBase implements CrudControllerInt
$this->eventDispatcher->notifyEvent('show.client', new Event($this));
return $this->returnJsonResponseData(['html' => $this->render()]);
} catch (\Exception $e) {
} catch (Exception $e) {
processException($e);
$this->eventDispatcher->notifyEvent('exception', new Event($e));
@@ -353,9 +364,9 @@ final class ClientController extends ControllerBase implements CrudControllerInt
/**
* Initialize class
*
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface
* @throws \SP\Services\Auth\AuthException
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
* @throws AuthException
*/
protected function initialize()
{