Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
glpi
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Packages & Registries
Packages & Registries
Package Registry
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
GLPI
glpi
Commits
8acc08f6
Commit
8acc08f6
authored
Jan 12, 2021
by
Stanislas KITA
Committed by
Johan Cwiklinski
Jan 12, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(dashaboard): new filter 'my groups'
parent
db1fa648
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
30 deletions
+36
-30
inc/dashboard/filter.class.php
inc/dashboard/filter.class.php
+1
-2
inc/dashboard/provider.class.php
inc/dashboard/provider.class.php
+35
-28
No files found.
inc/dashboard/filter.class.php
View file @
8acc08f6
...
...
@@ -150,7 +150,7 @@ JAVASCRIPT;
}
static
function
group_tech
(
string
$value
=
"0"
):
string
{
return
self
::
dropdown
(
$value
,
'group_tech'
,
Group
::
class
);
return
self
::
dropdown
(
$value
,
'group_tech'
,
Group
::
class
,
[
'toadd'
=>
[
-
1
=>
__
(
"My groups"
)]]
);
}
static
function
user_tech
(
string
$value
=
"0"
):
string
{
...
...
@@ -195,7 +195,6 @@ JAVASCRIPT;
return
$js
.
self
::
field
(
$fieldname
,
$field
,
$label
,
$value
>
0
);
}
/**
* Get generic HTML for a filter
*
...
...
inc/dashboard/provider.class.php
View file @
8acc08f6
...
...
@@ -1290,36 +1290,44 @@ class Provider extends CommonGLPI {
];
}
if
(
isset
(
$apply_filters
[
'group_tech'
])
&&
(
int
)
$apply_filters
[
'group_tech'
]
>
0
)
{
if
(
isset
(
$apply_filters
[
'group_tech'
]))
{
if
(
$DB
->
fieldExists
(
$table
,
'groups_id_tech'
))
{
$where
+=
[
"
$table
.groups_id_tech"
=>
(
int
)
$apply_filters
[
'group_tech'
]
];
}
else
if
(
in_array
(
$table
,
[
Ticket
::
getTable
(),
Change
::
getTable
(),
Problem
::
getTable
(),
]))
{
$itemtype
=
getItemTypeForTable
(
$table
);
$main_item
=
getItemForItemtype
(
$itemtype
);
$grouplink
=
$main_item
->
grouplinkclass
;
$gl_table
=
$grouplink
::
getTable
();
$fk
=
$main_item
->
getForeignKeyField
();
$groups_id
=
null
;
if
((
int
)
$apply_filters
[
'group_tech'
]
>
0
)
{
$groups_id
=
(
int
)
$apply_filters
[
'group_tech'
];
}
else
if
((
int
)
$apply_filters
[
'group_tech'
]
==
-
1
)
{
$groups_id
=
$_SESSION
[
'glpigroups'
];
}
$join
+=
[
"
$gl_table
as gl"
=>
[
'ON'
=>
[
'gl'
=>
$fk
,
$table
=>
'id'
,
if
(
$groups_id
!=
null
)
{
if
(
$DB
->
fieldExists
(
$table
,
'groups_id_tech'
))
{
$where
+=
[
"
$table
.groups_id_tech"
=>
$groups_id
];
}
else
if
(
in_array
(
$table
,
[
Ticket
::
getTable
(),
Change
::
getTable
(),
Problem
::
getTable
(),
]))
{
$itemtype
=
getItemTypeForTable
(
$table
);
$main_item
=
getItemForItemtype
(
$itemtype
);
$grouplink
=
$main_item
->
grouplinkclass
;
$gl_table
=
$grouplink
::
getTable
();
$fk
=
$main_item
->
getForeignKeyField
();
$join
+=
[
"
$gl_table
as gl"
=>
[
'ON'
=>
[
'gl'
=>
$fk
,
$table
=>
'id'
,
]
]
]
];
$where
+=
[
"gl.type"
=>
\
CommonITILActor
::
ASSIGN
,
"gl.groups_id"
=>
(
int
)
$apply_filters
[
'group_tech'
]
];
]
;
$where
+=
[
"gl.type"
=>
\
CommonITILActor
::
ASSIGN
,
"gl.groups_id"
=>
$groups_id
];
}
}
}
...
...
@@ -1367,7 +1375,6 @@ class Provider extends CommonGLPI {
return
$criteria
;
}
private
static
function
getDatesCriteria
(
string
$field
=
""
,
array
$dates
=
[]):
array
{
$begin
=
strtotime
(
$dates
[
0
]);
$end
=
strtotime
(
$dates
[
1
]);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment