PMCORE-3951

This commit is contained in:
Luciana Nuñez
2022-08-26 12:42:07 -04:00
parent b58420638c
commit 7894191249
21 changed files with 25 additions and 44 deletions

View File

@@ -50,7 +50,7 @@ class PMFNewUserTest extends TestCase
public function it_should_test_the_pmfnewuser_function()
{
global $RBAC;
$user = User::where('USR_ID', '=', 1)->get()->first();
$user = User::where('USR_ID', '=', 1)->first();
$_SESSION['USER_LOGGED'] = $user['USR_UID'];
$RBAC = RBAC::getSingleton(PATH_DATA, session_id());
$RBAC->initRBAC();

View File

@@ -706,7 +706,7 @@ class ReportTablesTest extends TestCase
$proUid = $result->processUid;
$grid = '';
$app = Application::where('APP_UID', '=', $result->applicationUid)->get()->first();
$app = Application::where('APP_UID', '=', $result->applicationUid)->first();
$appData = unserialize($app->APP_DATA);
unset($appData['var_Textarea1']);
$appData = serialize($appData);
@@ -742,7 +742,7 @@ class ReportTablesTest extends TestCase
$proUid = $result->processUid;
$grid = '';
$app = Application::where('APP_UID', '=', $result->applicationUid)->get()->first();
$app = Application::where('APP_UID', '=', $result->applicationUid)->first();
$appData = unserialize($app->APP_DATA);
$appData['var_Textarea1'] = [];
$appData = serialize($appData);
@@ -779,7 +779,7 @@ class ReportTablesTest extends TestCase
$proUid = $result->processUid;
$grid = 'var_Grid1';
$app = Application::where('APP_UID', '=', $result->applicationUid)->get()->first();
$app = Application::where('APP_UID', '=', $result->applicationUid)->first();
$appData = unserialize($app->APP_DATA);
unset($appData['var_Grid1'][1]['var_Textarea1']);
$appData = serialize($appData);
@@ -897,7 +897,7 @@ class ReportTablesTest extends TestCase
$proUid = $result->processUid;
$grid = 'var_Grid1';
$app = Application::where('APP_UID', '=', $result->applicationUid)->get()->first();
$app = Application::where('APP_UID', '=', $result->applicationUid)->first();
$appData = unserialize($app->APP_DATA);
$appData['var_Textarea1'] = [];
$appData = serialize($appData);

View File

@@ -1005,7 +1005,7 @@ class WsBaseTest extends TestCase
{
// Definition for avoid the error: Trying to get property 'aUserInfo' of non-object in the action buildAppDelayRow()
global $RBAC;
$user = User::where('USR_ID', '=', 1)->get()->first();
$user = User::where('USR_ID', '=', 1)->first();
$_SESSION['USER_LOGGED'] = $user['USR_UID'];
$RBAC = RBAC::getSingleton(PATH_DATA, session_id());
$RBAC->initRBAC();
@@ -1067,7 +1067,7 @@ class WsBaseTest extends TestCase
{
// Definition for avoid the error: Trying to get property 'aUserInfo' of non-object in the action buildAppDelayRow()
global $RBAC;
$user = User::where('USR_ID', '=', 1)->get()->first();
$user = User::where('USR_ID', '=', 1)->first();
$_SESSION['USER_LOGGED'] = $user['USR_UID'];
$RBAC = RBAC::getSingleton(PATH_DATA, session_id());
$RBAC->initRBAC();

View File

@@ -139,7 +139,6 @@ class AppNotesTest extends TestCase
public function it_should_test_send_note_notification_without_user()
{
$user = User::where('USR_UID', '=', '00000000000000000000000000000001')
->get()
->first();
$application = factory(Application::class)->create();
$delegation = factory(Delegation::class)->create([
@@ -159,7 +158,7 @@ class AppNotesTest extends TestCase
$appNotes->sendNoteNotification(...$params);
//assert
$appMessage = AppMessage::where('APP_UID', '=', $application->APP_UID)->get()->first()->toArray();
$appMessage = AppMessage::where('APP_UID', '=', $application->APP_UID)->first()->toArray();
$this->assertArrayHasKey('APP_UID', $appMessage);
$this->assertEquals($appMessage['APP_UID'], $application->APP_UID);
}
@@ -172,7 +171,6 @@ class AppNotesTest extends TestCase
public function it_should_test_send_note_notification_with_attach_files()
{
$user = User::where('USR_UID', '=', '00000000000000000000000000000001')
->get()
->first();
$application = factory(Application::class)->create();
$delegation = factory(Delegation::class)->create([
@@ -200,7 +198,7 @@ class AppNotesTest extends TestCase
$appNotes->sendNoteNotification(...$params);
//assert
$appMessage = AppMessage::where('APP_UID', '=', $application->APP_UID)->get()->first()->toArray();
$appMessage = AppMessage::where('APP_UID', '=', $application->APP_UID)->first()->toArray();
$this->assertArrayHasKey('APP_UID', $appMessage);
$this->assertEquals($appMessage['APP_UID'], $application->APP_UID);
}

View File

@@ -35,7 +35,7 @@ class CasesMenuHighlightTest extends TestCase
{
global $RBAC;
$this->user = User::where('USR_ID', '=', 1)->get()->first();
$this->user = User::where('USR_ID', '=', 1)->first();
$_SESSION['USER_LOGGED'] = $this->user['USR_UID'];

View File

@@ -61,7 +61,7 @@ class EmailServerTest extends TestCase
private function loadUserSession()
{
global $RBAC;
$user = User::where('USR_ID', '=', 1)->get()->first();
$user = User::where('USR_ID', '=', 1)->first();
$_SESSION['USER_LOGGED'] = $user['USR_UID'];
$RBAC = RBAC::getSingleton(PATH_DATA, session_id());
$RBAC->initRBAC();

View File

@@ -41,7 +41,7 @@ class CasesTraitTest extends TestCase
*/
private function prepareDerivationData()
{
$user = User::where('USR_ID', '=', 1)->get()->first();
$user = User::where('USR_ID', '=', 1)->first();
$process = factory(Process::class)->create([
'PRO_CREATE_USER' => $user->USR_UID
@@ -176,7 +176,7 @@ class CasesTraitTest extends TestCase
$cases = new Cases();
$cases->routeCase($processUid, $application, $postForm, $status, $flagGmail, $tasUid, $index, $userLogged);
$result = Delegation::where('APP_UID', '=', $application)->where('DEL_INDEX', '=', $index)->get()->first();
$result = Delegation::where('APP_UID', '=', $application)->where('DEL_INDEX', '=', $index)->first();
$this->assertEquals('CLOSED', $result->DEL_THREAD_STATUS);
}
@@ -231,7 +231,7 @@ class CasesTraitTest extends TestCase
$cases = new Cases();
$cases->routeCase($processUid, $appUid, $postForm, $status, $flagGmail, $tasUid, $index, $userLogged);
$result = Delegation::where('APP_UID', '=', $appUid)->where('DEL_INDEX', '=', $index)->get()->first();
$result = Delegation::where('APP_UID', '=', $appUid)->where('DEL_INDEX', '=', $index)->first();
$this->assertEquals('CLOSED', $result->DEL_THREAD_STATUS);
}
@@ -302,7 +302,7 @@ class CasesTraitTest extends TestCase
*/
public function it_should_verify_if_abe_is_completed()
{
$user = User::where('USR_ID', '=', 1)->get()->first();
$user = User::where('USR_ID', '=', 1)->first();
$process = factory(Process::class)->create([
'PRO_CREATE_USER' => $user->USR_UID

View File

@@ -147,7 +147,7 @@ class GmailOAuthTest extends TestCase
public function it_should_create_email_server()
{
global $RBAC;
$user = User::where('USR_ID', '=', 1)->get()->first();
$user = User::where('USR_ID', '=', 1)->first();
$_SESSION['USER_LOGGED'] = $user['USR_UID'];
$RBAC = RBAC::getSingleton(PATH_DATA, session_id());
$RBAC->initRBAC();

View File

@@ -42,7 +42,7 @@ class ServerTest extends TestCase
*/
public function it_should_test_post_token_with_valid_credentials()
{
$user = User::where('USR_ID', '=', 1)->get()->first();
$user = User::where('USR_ID', '=', 1)->first();
$oauthClients = factory(OauthClients::class)->create([
"USR_UID" => $user->USR_UID
]);
@@ -80,7 +80,7 @@ class ServerTest extends TestCase
*/
public function it_should_test_post_token_with_return_handle_token()
{
$user = User::where('USR_ID', '=', 1)->get()->first();
$user = User::where('USR_ID', '=', 1)->first();
$oauthClients = factory(OauthClients::class)->create([
"USR_UID" => $user->USR_UID
]);
@@ -116,7 +116,7 @@ class ServerTest extends TestCase
*/
public function it_should_test_post_token_with_empty_client_id()
{
$user = User::where('USR_ID', '=', 1)->get()->first();
$user = User::where('USR_ID', '=', 1)->first();
$oauthClients = factory(OauthClients::class)->create([
"USR_UID" => $user->USR_UID
]);
@@ -155,8 +155,8 @@ class ServerTest extends TestCase
*/
public function it_should_test_post_token_for_pm_client_id()
{
$user = User::where('USR_ID', '=', 1)->get()->first();
$oauthClients = OauthClients::where('CLIENT_ID', '=', 'x-pm-local-client')->get()->first();
$user = User::where('USR_ID', '=', 1)->first();
$oauthClients = OauthClients::where('CLIENT_ID', '=', 'x-pm-local-client')->first();
$data = '{
"grant_type":"password",

View File

@@ -2561,7 +2561,6 @@ class LdapAdvanced
->where('GRP_STATUS', '=', 'ACTIVE')
->where('GRP_TITLE', '=', $title)
->orderBy('GRP_ID', 'ASC')
->get()
->first();
if (!empty($groupWf)) {
return $groupWf->GRP_UID;

View File

@@ -104,7 +104,6 @@ switch ($function) {
$authenticationSource = RbacAuthenticationSource::query()
->select(['AUTH_SOURCE_UID', 'AUTH_SOURCE_NAME'])
->where('AUTH_SOURCE_NAME', '=', $authSourceName)
->get()
->first();
$row = false;
$suggestName = "";
@@ -114,7 +113,6 @@ switch ($function) {
->select(['AUTH_SOURCE_NAME'])
->where('AUTH_SOURCE_NAME', 'LIKE', "%{$authSourceName}%")
->orderBy('AUTH_SOURCE_NAME', 'desc')
->get()
->first();
if (!empty($lastAuthenticationSource)) {
$name = $lastAuthenticationSource->AUTH_SOURCE_NAME;

View File

@@ -162,7 +162,6 @@ try {
$dateCreate = empty($_REQUEST["UEA_DATE_CREATE"]) ? date("Y-m-d H:i:s") : $_REQUEST["UEA_DATE_CREATE"];
$userExtendedAttributes = UserExtendedAttributes::where('UEA_ID', '=', $id)
->get()
->first();
if (empty($userExtendedAttributes)) {
$userExtendedAttributes = new UserExtendedAttributes();
@@ -194,7 +193,6 @@ try {
$userExtendedAttributes = UserExtendedAttributes::query()
->where('UEA_NAME', '=', trim($name))
->where('UEA_ID', '<>', $id)
->get()
->first();
$result = [
"valid" => empty($userExtendedAttributes),
@@ -208,7 +206,6 @@ try {
$userExtendedAttributes = UserExtendedAttributes::query()
->where('UEA_ATTRIBUTE_ID', '=', trim($attributeId))
->where('UEA_ID', '<>', $id)
->get()
->first();
$result = [
"valid" => empty($userExtendedAttributes),
@@ -221,7 +218,6 @@ try {
$attributeId = empty($_REQUEST["attributeId"]) ? "" : $_REQUEST["attributeId"];
$user = User::query()
->where("USR_EXTENDED_ATTRIBUTES_DATA", "LIKE", "%\"{$attributeId}\"%")
->get()
->first();
$isUsed = false;
$message = "";

View File

@@ -308,7 +308,6 @@ class Home
->where('CAL_ID', '=', $id)
->join('ADDITIONAL_TABLES', 'ADDITIONAL_TABLES.ADD_TAB_UID', '=', 'CASE_LIST.ADD_TAB_UID')
->join('PROCESS', 'PROCESS.PRO_UID', '=', 'ADDITIONAL_TABLES.PRO_UID')
->get()
->first();
if (!empty($caseList)) {
$tableName = $caseList->ADD_TAB_NAME;

View File

@@ -350,7 +350,6 @@ class TaskSchedulerBM
$scheduler = TaskScheduler::select()
->where('title', '=', $service['title'])
->where('description', '=', $service['description'])
->get()
->first();
if (is_null($scheduler)) {
self::registerScheduledTask($service);

View File

@@ -1154,7 +1154,6 @@ class WebEntry
$result = true;
$webentry = WebEntryModel::select('WE_HIDE_ACTIVE_SESSION_WARNING', 'WE_AUTHENTICATION')
->where('WE_UID', '=', $weUid)
->get()
->first();
if ($webentry->WE_AUTHENTICATION === 'LOGIN_REQUIRED') {
$result = intval($webentry->WE_HIDE_ACTIVE_SESSION_WARNING) === 0;

View File

@@ -93,7 +93,6 @@ class CaseList extends Model
'ADDITIONAL_TABLES.ADD_TAB_NAME',
'ADDITIONAL_TABLES.PRO_UID'
])
->get()
->first();
return $caseList;
@@ -174,7 +173,7 @@ class CaseList extends Model
$caseList = CaseList::where('CAL_ID', '=', $id);
$caseList->update($attributes);
$model = $caseList->get()->first();
$model = $caseList->first();
if (!is_null($model)) {
$model->CAL_COLUMNS = json_decode($model->CAL_COLUMNS);
}
@@ -189,7 +188,7 @@ class CaseList extends Model
public static function deleteSetting(int $id)
{
$caseList = CaseList::where('CAL_ID', '=', $id);
$model = $caseList->get()->first();
$model = $caseList->first();
if (!is_null($model)) {
$caseList->delete();
$model->CAL_COLUMNS = json_decode($model->CAL_COLUMNS);
@@ -274,7 +273,6 @@ class CaseList extends Model
'CASE_LIST.*',
'ADDITIONAL_TABLES.ADD_TAB_NAME'
])
->get()
->first();
if (empty($model)) {
throw new Exception(G::LoadTranslation('ID_DOES_NOT_EXIST'));
@@ -322,7 +320,6 @@ class CaseList extends Model
//the pmtable not exist
$table = AdditionalTables::where('ADD_TAB_NAME', '=', $tableName)
->get()
->first();
if ($table === null) {
return [
@@ -352,7 +349,6 @@ class CaseList extends Model
//the name of the case list already exist
$list = CaseList::where('CAL_NAME', '=', $array['name'])
->get()
->first();
$requestData['duplicateName'] = $requestData['duplicateName'] ?? '';
if ($requestData['duplicateName'] !== 'continue') {

View File

@@ -67,6 +67,6 @@ class Groupwf extends Model
public static function getGroupId($grpUid)
{
$query = Groupwf::select('GRP_ID')->where('GRP_UID', $grpUid);
return $query->get()->first()->toArray();
return $query->first()->toArray();
}
}

View File

@@ -495,7 +495,6 @@ class Process extends Model
$process = Process::query()
->where($key, $proId)
->where('PRO_STATUS', 'ACTIVE')
->get()
->first();
return !empty($process);
}

View File

@@ -19,7 +19,7 @@ class RbacRoles extends Model
public static function getRolUidByCode($rolCode)
{
$query = RbacRoles::select('ROL_UID')->where('ROL_CODE', $rolCode);
$query = $query->get()->first();
$query = $query->first();
if (is_null($query)) {
return [];

View File

@@ -18,7 +18,6 @@ class Step extends Model
->where('TAS_UID', '=', $tasUid)
->where('STEP_TYPE_OBJ', '=', $stepTypeObj)
->where('STEP_UID_OBJ', '=', $stepUidObj)
->get()
->first();
return $step;
}

View File

@@ -29,7 +29,6 @@ class UserConfig extends Model
{
$userConfig = UserConfig::where('USR_ID', '=', $id)
->where('USC_NAME', '=', $name)
->get()
->first();
if (empty($userConfig)) {
return null;