@@ -35,11 +35,28 @@ public function onConstruct()
35
35
$ this ->model = new Roles ();
36
36
37
37
//get the list of roes for the systems + my company
38
+ $ companyTotalRoles = Roles::count ([
39
+ 'conditions ' => 'apps_id = :apps_id: AND companies_id = :companies_id: ' ,
40
+ 'bind ' => [
41
+ 'apps_id ' => $ this ->acl ->getApp ()->getId (),
42
+ 'companies_id ' => $ this ->userData ->currentCompanyId (),
43
+ ]
44
+ ]);
45
+
38
46
$ this ->additionalSearchFields = [
39
47
['is_deleted ' , ': ' , '0 ' ],
40
- ['apps_id ' , ': ' , Apps:: CANVAS_DEFAULT_APP_ID . ' | ' . $ this ->acl ->getApp ()->getId ()],
41
- ['companies_id ' , ': ' , ' 1| ' . $ this ->userData ->currentCompanyId ()],
48
+ ['apps_id ' , ': ' , $ this ->acl ->getApp ()->getId ()],
49
+ ['companies_id ' , ': ' , $ this ->userData ->currentCompanyId ()],
42
50
];
51
+
52
+ if ($ companyTotalRoles === 0 ) {
53
+ $ this ->additionalSearchFields = [
54
+ ['is_deleted ' , ': ' , '0 ' ],
55
+ ['apps_id ' , ': ' , Apps::CANVAS_DEFAULT_APP_ID ],
56
+ ['companies_id ' , ': ' , 1 ],
57
+ ['is_default ' , ': ' , 1 ],
58
+ ];
59
+ }
43
60
}
44
61
45
62
/**
0 commit comments