diff --git a/src/app/search/controllers/SearchController.php b/src/app/search/controllers/SearchController.php index a5a644e287d4bf043273c71557341e4913df1a34..4b43c7495adf066329b3df5137dbbf8ecb07c4ef 100644 --- a/src/app/search/controllers/SearchController.php +++ b/src/app/search/controllers/SearchController.php @@ -18,17 +18,13 @@ use Attachment\models\AttachmentModel; use Basket\models\BasketModel; use Basket\models\RedirectBasketModel; use Configuration\models\ConfigurationModel; -use Contact\controllers\ContactController; use Contact\models\ContactModel; use Convert\controllers\FullTextController; use CustomField\models\CustomFieldModel; use Docserver\models\DocserverModel; -use Doctype\models\DoctypeModel; -use Entity\models\EntityModel; use Entity\models\ListInstanceModel; use Folder\models\ResourceFolderModel; use Note\models\NoteModel; -use Priority\models\PriorityModel; use RegisteredMail\models\RegisteredMailModel; use Resource\controllers\ResourceListController; use Resource\models\ResModel; @@ -396,9 +392,9 @@ class SearchController } if (!empty($body['status']) && !empty($body['status']['values']) && is_array($body['status']['values'])) { if (in_array(null, $body['status']['values'])) { - $args['searchWhere'][] = '(status in (?) OR status is NULL)'; + $args['searchWhere'][] = '(status in (select id from status where identifier in (?)) OR status is NULL)'; } else { - $args['searchWhere'][] = 'status in (?)'; + $args['searchWhere'][] = 'status in (select id from status where identifier in (?))'; } $args['searchData'][] = $body['status']['values']; } @@ -665,7 +661,7 @@ class SearchController } } if (!empty($body['groupSign']) && !empty($body['groupSign']['values']) && is_array($body['groupSign']['values'])) { - $args['searchWhere'][] = 'res_id in (select DISTINCT res_id from listinstance where requested_signature = ? AND item_id in (select DISTINCT user_id from usergroup_content where group_id in (?)))'; + $args['searchWhere'][] = 'res_id in (select DISTINCT res_id from listinstance where signatory = ? AND item_id in (select DISTINCT user_id from usergroup_content where group_id in (?)))'; $args['searchData'][] = 'true'; $args['searchData'][] = $body['groupSign']['values']; } diff --git a/test/unitTests/app/group/GroupControllerTest.php b/test/unitTests/app/group/GroupControllerTest.php index 3776433432a3c67d074c75b74f24acdc47fb72f2..49c1ce3d7a81aa6d2e609d5ea987e1774a585fda 100755 --- a/test/unitTests/app/group/GroupControllerTest.php +++ b/test/unitTests/app/group/GroupControllerTest.php @@ -269,14 +269,13 @@ class GroupControllerTest extends TestCase $this->assertIsInt($value->id); } - // Fail $GLOBALS['login'] = 'bbain'; $userInfo = \User\models\UserModel::getByLogin(['login' => $GLOBALS['login'], 'select' => ['id']]); $GLOBALS['id'] = $userInfo['id']; $response = $groupController->get($request, new \Slim\Http\Response()); $this->assertSame(200, $response->getStatusCode()); - $responseBody = json_decode((string)$response->getBody(), true); + $responseBody = json_decode((string)$response->getBody()); $this->assertNotEmpty($responseBody->groups);