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
d45be5cf
Commit
d45be5cf
authored
May 02, 2019
by
Johan Cwiklinski
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '9.5/bugfixes'
parents
9d79e84a
89f6b75c
Changes
41
Hide whitespace changes
Inline
Side-by-side
Showing
41 changed files
with
193 additions
and
127 deletions
+193
-127
CHANGELOG.md
CHANGELOG.md
+2
-0
inc/api.class.php
inc/api.class.php
+2
-2
inc/auth.class.php
inc/auth.class.php
+3
-3
inc/authldap.class.php
inc/authldap.class.php
+1
-1
inc/blacklist.class.php
inc/blacklist.class.php
+3
-3
inc/budget.class.php
inc/budget.class.php
+1
-1
inc/calendarsegment.class.php
inc/calendarsegment.class.php
+1
-1
inc/commondbtm.class.php
inc/commondbtm.class.php
+1
-1
inc/commonitilobject.class.php
inc/commonitilobject.class.php
+1
-1
inc/commonitilvalidation.class.php
inc/commonitilvalidation.class.php
+1
-1
inc/computervirtualmachine.class.php
inc/computervirtualmachine.class.php
+8
-7
inc/db.function.php
inc/db.function.php
+22
-3
inc/dbutils.class.php
inc/dbutils.class.php
+15
-14
inc/entity.class.php
inc/entity.class.php
+5
-3
inc/item_ticket.class.php
inc/item_ticket.class.php
+3
-9
inc/mailcollector.class.php
inc/mailcollector.class.php
+1
-1
inc/notificationeventabstract.class.php
inc/notificationeventabstract.class.php
+1
-1
inc/notificationtarget.class.php
inc/notificationtarget.class.php
+2
-2
inc/notificationtargetchange.class.php
inc/notificationtargetchange.class.php
+8
-8
inc/notificationtargetcommonitilobject.class.php
inc/notificationtargetcommonitilobject.class.php
+16
-12
inc/notificationtargetproblem.class.php
inc/notificationtargetproblem.class.php
+3
-3
inc/notificationtargetproject.class.php
inc/notificationtargetproject.class.php
+15
-5
inc/notificationtargetprojecttask.class.php
inc/notificationtargetprojecttask.class.php
+9
-4
inc/notificationtargetticket.class.php
inc/notificationtargetticket.class.php
+14
-4
inc/notificationtemplatetranslation.class.php
inc/notificationtemplatetranslation.class.php
+1
-1
inc/objectlock.class.php
inc/objectlock.class.php
+1
-1
inc/plugin.class.php
inc/plugin.class.php
+2
-2
inc/profile_user.class.php
inc/profile_user.class.php
+1
-1
inc/ruleaction.class.php
inc/ruleaction.class.php
+2
-2
inc/ruledictionnaryprintercollection.class.php
inc/ruledictionnaryprintercollection.class.php
+5
-3
inc/ruleright.class.php
inc/ruleright.class.php
+2
-1
inc/stat.class.php
inc/stat.class.php
+17
-2
inc/tickettemplate.class.php
inc/tickettemplate.class.php
+4
-4
install/update_080_0801.php
install/update_080_0801.php
+1
-1
status.php
status.php
+4
-4
tests/functionnal/DbUtils.php
tests/functionnal/DbUtils.php
+4
-4
tests/functionnal/Networkport.php
tests/functionnal/Networkport.php
+5
-5
tests/functionnal/NotificationEventAjax.php
tests/functionnal/NotificationEventAjax.php
+2
-2
tests/functionnal/NotificationMailing.php
tests/functionnal/NotificationMailing.php
+1
-1
tests/functionnal/RuleSoftwareCategoryCollection.php
tests/functionnal/RuleSoftwareCategoryCollection.php
+1
-1
tests/functionnal/Search.php
tests/functionnal/Search.php
+2
-2
No files found.
CHANGELOG.md
View file @
d45be5cf
...
...
@@ -63,6 +63,8 @@ The present file will list all changes made to the project; according to the
-
`DBMysql::affected_rows()`
-
`DBMysql::free_result()`
-
`DBMysql::isMySQLStrictMode()`
-
`getAllDatasFromTable`
renamed to
`getAllDataFromTable()`
-
Usage of
`$order`
parameter in
`getAllDataFromTable()`
(
`DbUtils::getAllDataFromTable()`
)
## [9.4.2] unreleased
...
...
inc/api.class.php
View file @
d45be5cf
...
...
@@ -553,7 +553,7 @@ abstract class API extends CommonGLPI {
&&
in_array
(
$itemtype
,
Item_Devices
::
getConcernedItems
()))
{
$all_devices
=
[];
foreach
(
Item_Devices
::
getItemAffinities
(
$item
->
getType
())
as
$device_type
)
{
$found_devices
=
getAllData
s
FromTable
(
$found_devices
=
getAllDataFromTable
(
$device_type
::
getTable
(),
[
'items_id'
=>
$item
->
getID
(),
'itemtype'
=>
$item
->
getType
(),
...
...
@@ -1035,7 +1035,7 @@ abstract class API extends CommonGLPI {
if
(
!
Session
::
haveRight
(
$itemtype
::
$rightname
,
READNOTE
))
{
$fields
[
'_logs'
]
=
self
::
arrayRightError
();
}
else
{
$fields
[
'_logs'
]
=
getAllData
s
FromTable
(
$fields
[
'_logs'
]
=
getAllDataFromTable
(
"glpi_logs"
,
[
'items_id'
=>
$item
->
getID
(),
'itemtype'
=>
$item
->
getType
()
...
...
inc/auth.class.php
View file @
d45be5cf
...
...
@@ -568,8 +568,8 @@ class Auth extends CommonGLPI {
//Return all the authentication methods in an array
$this
->
authtypes
=
[
'ldap'
=>
getAllData
s
FromTable
(
'glpi_authldaps'
),
'mail'
=>
getAllData
s
FromTable
(
'glpi_authmails'
)
'ldap'
=>
getAllDataFromTable
(
'glpi_authldaps'
),
'mail'
=>
getAllDataFromTable
(
'glpi_authmails'
)
];
}
...
...
@@ -654,7 +654,7 @@ class Auth extends CommonGLPI {
$ldapservers
[]
=
$authldap
->
fields
;
}
}
else
{
// User has never beeen authenticated : try all active ldap server to find the right one
foreach
(
getAllData
s
FromTable
(
'glpi_authldaps'
,
[
'is_active'
=>
1
])
as
$ldap_config
)
{
foreach
(
getAllDataFromTable
(
'glpi_authldaps'
,
[
'is_active'
=>
1
])
as
$ldap_config
)
{
$ldapservers
[]
=
$ldap_config
;
}
}
...
...
inc/authldap.class.php
View file @
d45be5cf
...
...
@@ -2639,7 +2639,7 @@ class AuthLDAP extends CommonDBTM {
* @return array
*/
static
function
getLdapServers
()
{
return
getAllData
sFromTable
(
'glpi_authldaps'
,
[],
false
,
'`is_default` DESC'
);
return
getAllData
FromTable
(
'glpi_authldaps'
,
[
'ORDER'
=>
'is_default DESC'
]
);
}
...
...
inc/blacklist.class.php
View file @
d45be5cf
...
...
@@ -247,10 +247,10 @@ class Blacklist extends CommonDropdown {
**/
static
function
getBlacklistedItems
(
$type
)
{
$data
s
=
getAllDatas
FromTable
(
'glpi_blacklists'
,
[
'type'
=>
$type
]);
$data
=
getAllData
FromTable
(
'glpi_blacklists'
,
[
'type'
=>
$type
]);
$items
=
[];
if
(
count
(
$data
s
))
{
foreach
(
$data
s
as
$val
)
{
if
(
count
(
$data
))
{
foreach
(
$data
as
$val
)
{
$items
[]
=
$val
[
'value'
];
}
}
...
...
inc/budget.class.php
View file @
d45be5cf
...
...
@@ -828,7 +828,7 @@ class Budget extends CommonDropdown{
echo
"</tr>"
;
// get all entities ordered by names
$allentities
=
getAllData
sFromTable
(
'glpi_entities'
,
[],
true
,
'completename'
);
$allentities
=
getAllData
FromTable
(
'glpi_entities'
,
[
'ORDER'
=>
'completename'
],
true
);
foreach
(
array_keys
(
$allentities
)
as
$entity
)
{
if
(
isset
(
$entities_values
[
$entity
]))
{
...
...
inc/calendarsegment.class.php
View file @
d45be5cf
...
...
@@ -135,7 +135,7 @@ class CalendarSegment extends CommonDBChild {
static
function
getSegmentsBetween
(
$calendars_id
,
$begin_day
,
$begin_time
,
$end_day
,
$end_time
)
{
// Do not check hour if day before the end day of after the begin day
return
getAllData
s
FromTable
(
return
getAllDataFromTable
(
'glpi_calendarsegments'
,
[
'calendars_id'
=>
$calendars_id
,
[
'day'
=>
[
'>='
,
$begin_day
]],
...
...
inc/commondbtm.class.php
View file @
d45be5cf
...
...
@@ -4241,7 +4241,7 @@ class CommonDBTM extends CommonGLPI {
$message
[
$field
]
=
$this
->
input
[
$field
];
}
$doubles
=
getAllData
s
FromTable
(
$this
->
getTable
(),
$where
);
$doubles
=
getAllDataFromTable
(
$this
->
getTable
(),
$where
);
$message_text
=
$this
->
getUnicityErrorMessage
(
$message
,
$fields
,
$doubles
);
if
(
$p
[
'unicity_error_message'
])
{
if
(
!
$fields
[
'action_refuse'
])
{
...
...
inc/commonitilobject.class.php
View file @
d45be5cf
...
...
@@ -3785,7 +3785,7 @@ abstract class CommonITILObject extends CommonDBTM {
?
$options
[
'entities_id'
]
:
$options
[
'entity_restrict'
])];
//only for active ldap and corresponding right
$ldap_methods
=
getAllData
s
FromTable
(
'glpi_authldaps'
,
[
'is_active'
=>
1
]);
$ldap_methods
=
getAllDataFromTable
(
'glpi_authldaps'
,
[
'is_active'
=>
1
]);
if
(
count
(
$ldap_methods
)
&&
Session
::
haveRight
(
'user'
,
User
::
IMPORTEXTAUTHUSERS
))
{
$params
[
'ldap_import'
]
=
true
;
...
...
inc/commonitilvalidation.class.php
View file @
d45be5cf
...
...
@@ -1391,7 +1391,7 @@ abstract class CommonITILValidation extends CommonDBChild {
$statuses
=
[
self
::
ACCEPTED
=>
0
,
self
::
WAITING
=>
0
,
self
::
REFUSED
=>
0
];
$validations
=
getAllData
s
FromTable
(
$validations
=
getAllDataFromTable
(
static
::
getTable
(),
[
static
::
$items_id
=>
$item
->
getID
()
]
...
...
inc/computervirtualmachine.class.php
View file @
d45be5cf
...
...
@@ -245,7 +245,7 @@ class ComputerVirtualMachine extends CommonDBChild {
echo
"<div class='center'>"
;
if
(
isset
(
$comp
->
fields
[
'uuid'
])
&&
(
$comp
->
fields
[
'uuid'
]
!=
''
))
{
$hosts
=
getAllData
s
FromTable
(
$hosts
=
getAllDataFromTable
(
self
::
getTable
(),
[
'RAW'
=>
[
'LOWER(uuid)'
=>
self
::
getUUIDRestrictCriteria
(
$comp
->
fields
[
'uuid'
])
...
...
@@ -324,13 +324,14 @@ class ComputerVirtualMachine extends CommonDBChild {
echo
"<div class='center'>"
;
$virtualmachines
=
getAllData
s
FromTable
(
$virtualmachines
=
getAllDataFromTable
(
self
::
getTable
(),
[
'computers_id'
=>
$ID
,
'is_deleted'
=>
0
],
false
,
'name'
'WHERE'
=>
[
'computers_id'
=>
$ID
,
'is_deleted'
=>
0
],
'ORDER'
=>
'name'
]
);
echo
"<table class='tab_cadre_fixehov'>"
;
...
...
inc/db.function.php
View file @
d45be5cf
...
...
@@ -223,7 +223,7 @@ function countElementsInTableForEntity($table, $entity, $condition = [], $recurs
/**
* Get data
s
from a table in an array :
* Get data from a table in an array :
* CAUTION TO USE ONLY FOR SMALL TABLES OR USING A STRICT CONDITION
*
* @param string $table table name
...
...
@@ -232,12 +232,31 @@ function countElementsInTableForEntity($table, $entity, $condition = [], $recurs
* @param string $order result order (default '')
*
* @return array containing all the datas
*
* @deprecated 9.5.0
**/
function
getAllDatasFromTable
(
$table
,
$condition
=
[],
$usecache
=
false
,
$order
=
''
)
{
$dbu
=
new
DbUtils
(
);
return
$dbu
->
getAllDataFromTable
(
$table
,
$condition
,
$usecache
,
$order
);
Toolbox
::
deprecated
(
'Use getAllDataFromTable()'
);
return
getAllDataFromTable
(
$table
,
$condition
,
$usecache
,
$order
);
}
/**
* Get data from a table in an array :
* CAUTION TO USE ONLY FOR SMALL TABLES OR USING A STRICT CONDITION
*
* @param string $table table name
* @param array $criteria condition to use (default [])
* @param boolean $usecache Use cache (false by default)
* @param string $order result order (default '')
*
* @return array containing all the datas
*
* @since 9.5.0
**/
function
getAllDataFromTable
(
$table
,
$criteria
=
[],
$usecache
=
false
,
$order
=
''
)
{
$dbu
=
new
DbUtils
();
return
$dbu
->
getAllDataFromTable
(
$table
,
$criteria
,
$usecache
,
$order
);
}
/**
* Get the Name of the element of a Dropdown Tree table
*
...
...
inc/dbutils.class.php
View file @
d45be5cf
...
...
@@ -400,45 +400,46 @@ final class DbUtils {
}
/**
* Get data
s
from a table in an array :
* Get data from a table in an array :
* CAUTION TO USE ONLY FOR SMALL TABLES OR USING A STRICT CONDITION
*
* @param string $table
Table name
* @param array $c
ondition Condition to use (default '') or array of
criteria
* @param boolean $usecache
Use cache (false by default)
* @param string $order
Result order (default '')
* @param string $table Table name
* @param array $c
riteria Request
criteria
* @param boolean $usecache Use cache (false by default)
* @param string $order Result order (default '')
*
* @return array containing all the datas
*/
public
function
getAllDataFromTable
(
$table
,
$c
ondition
=
[],
$usecache
=
false
,
$order
=
''
)
{
public
function
getAllDataFromTable
(
$table
,
$c
riteria
=
[],
$usecache
=
false
,
$order
=
''
)
{
global
$DB
;
static
$cache
=
[];
if
(
empty
(
$c
ondition
)
&&
empty
(
$order
)
&&
$usecache
&&
isset
(
$cache
[
$table
]))
{
if
(
empty
(
$c
riteria
)
&&
empty
(
$order
)
&&
$usecache
&&
isset
(
$cache
[
$table
]))
{
return
$cache
[
$table
];
}
$data
=
[];
if
(
!
is_array
(
$condition
))
{
if
(
empty
(
$condition
))
{
$condition
=
[];
if
(
!
is_array
(
$criteria
))
{
Toolbox
::
Deprecated
(
'Criteria must be an array!'
);
if
(
empty
(
$criteria
))
{
$criteria
=
[];
}
}
if
(
!
empty
(
$order
))
{
//Toolbox::Deprecated('Order should be defined in condition
!');
$c
ondition
[
'ORDER'
]
=
$order
;
// Deprecated use case
Toolbox
::
Deprecated
(
'Order should be defined in criteria
!'
);
$c
riteria
[
'ORDER'
]
=
$order
;
// Deprecated use case
}
$iterator
=
$DB
->
request
(
$table
,
$c
ondition
);
$iterator
=
$DB
->
request
(
$table
,
$c
riteria
);
while
(
$row
=
$iterator
->
next
())
{
$data
[
$row
[
'id'
]]
=
$row
;
}
if
(
empty
(
$c
ondition
)
&&
empty
(
$order
)
&&
$usecache
)
{
if
(
empty
(
$c
riteria
)
&&
empty
(
$order
)
&&
$usecache
)
{
$cache
[
$table
]
=
$data
;
}
return
$data
;
...
...
inc/entity.class.php
View file @
d45be5cf
...
...
@@ -1498,7 +1498,8 @@ class Entity extends CommonTreeDropdown {
$options
[
self
::
CONFIG_PARENT
]
=
__
(
'Inheritance of the parent entity'
);
}
foreach
(
getAllDatasFromTable
(
'glpi_states'
)
as
$state
)
{
$states
=
getAllDataFromTable
(
'glpi_states'
);
foreach
(
$states
as
$state
)
{
$options
[
Infocom
::
ON_STATUS_CHANGE
.
'_'
.
$state
[
'id'
]]
//TRANS: %s is the name of the state
=
sprintf
(
__
(
'Fill when shifting to state %s'
),
$state
[
'name'
]);
...
...
@@ -1566,7 +1567,7 @@ class Entity extends CommonTreeDropdown {
$options
[
self
::
CONFIG_PARENT
]
=
__
(
'Inheritance of the parent entity'
);
}
foreach
(
getAllDatasFromTable
(
'glpi_states'
)
as
$state
)
{
foreach
(
$states
as
$state
)
{
$options
[
Infocom
::
ON_STATUS_CHANGE
.
'_'
.
$state
[
'id'
]]
//TRANS: %s is the name of the state
=
sprintf
(
__
(
'Fill when shifting to state %s'
),
$state
[
'name'
]);
...
...
@@ -2790,7 +2791,8 @@ class Entity extends CommonTreeDropdown {
case
'autofill_decommission_date'
:
$tab
[
0
]
=
__
(
'No autofill'
);
$tab
[
self
::
CONFIG_PARENT
]
=
__
(
'Inheritance of the parent entity'
);
foreach
(
getAllDatasFromTable
(
'glpi_states'
)
as
$state
)
{
$states
=
getAllDataFromTable
(
'glpi_states'
);
foreach
(
$states
as
$state
)
{
$tab
[
Infocom
::
ON_STATUS_CHANGE
.
'_'
.
$state
[
'id'
]]
//TRANS: %s is the name of the state
=
sprintf
(
__
(
'Fill when shifting to state %s'
),
$state
[
'name'
]);
...
...
inc/item_ticket.class.php
View file @
d45be5cf
...
...
@@ -411,14 +411,7 @@ class Item_Ticket extends CommonDBRelation{
self
::
dropdownMyDevices
(
$dev_user_id
,
$ticket
->
fields
[
"entities_id"
],
null
,
0
,
[
'tickets_id'
=>
$instID
]);
}
$data
=
array_keys
(
getAllDatasFromTable
(
'glpi_items_tickets'
));
$used
=
[];
if
(
!
empty
(
$data
))
{
foreach
(
$data
as
$val
)
{
$used
[
$val
[
'itemtype'
]]
=
$val
[
'id'
];
}
}
$data
=
array_keys
(
getAllDataFromTable
(
'glpi_items_tickets'
));
self
::
dropdownAllDevices
(
"itemtype"
,
null
,
0
,
1
,
$dev_user_id
,
$ticket
->
fields
[
"entities_id"
],
[
'tickets_id'
=>
$instID
,
'used'
=>
$used
,
'rand'
=>
$rand
]);
echo
"<span id='item_ticket_selection_information
$rand
'></span>"
;
echo
"</td><td class='center' width='30%'>"
;
...
...
@@ -1059,11 +1052,12 @@ class Item_Ticket extends CommonDBRelation{
* Return used items for a ticket
*
* @param type $tickets_id
*
* @return type
*/
static
function
getUsedItems
(
$tickets_id
)
{
$data
=
getAllData
s
FromTable
(
'glpi_items_tickets'
,
[
'tickets_id'
=>
$tickets_id
]);
$data
=
getAllDataFromTable
(
'glpi_items_tickets'
,
[
'tickets_id'
=>
$tickets_id
]);
$used
=
[];
if
(
!
empty
(
$data
))
{
foreach
(
$data
as
$val
)
{
...
...
inc/mailcollector.class.php
View file @
d45be5cf
...
...
@@ -1806,7 +1806,7 @@ class MailCollector extends CommonDBTM {
$buttons
[
"notimportedemail.php"
]
=
__
(
'List of not imported emails'
);
}
$errors
=
getAllData
s
FromTable
(
$this
->
getTable
(),
[
'errors'
=>
[
'>'
,
0
]]);
$errors
=
getAllDataFromTable
(
$this
->
getTable
(),
[
'errors'
=>
[
'>'
,
0
]]);
$message
=
''
;
if
(
count
(
$errors
))
{
$servers
=
[];
...
...
inc/notificationeventabstract.class.php
View file @
d45be5cf
...
...
@@ -70,7 +70,7 @@ abstract class NotificationEventAbstract {
}
$notprocessed
=
[];
$targets
=
getAllData
s
FromTable
(
$targets
=
getAllDataFromTable
(
'glpi_notificationtargets'
,
[
'notifications_id'
=>
$data
[
'id'
]]
);
...
...
inc/notificationtarget.class.php
View file @
d45be5cf
...
...
@@ -330,7 +330,7 @@ class NotificationTarget extends CommonDBChild {
list
(
$type
,
$id
)
=
explode
(
'_'
,
$key
);
$values
[
$key
]
=
$this
->
notification_targets_labels
[
$type
][
$id
];
}
$targets
=
getAllData
s
FromTable
(
$targets
=
getAllDataFromTable
(
self
::
getTable
(),
[
'notifications_id'
=>
$notifications_id
]
...
...
@@ -376,7 +376,7 @@ class NotificationTarget extends CommonDBChild {
if
(
!
isset
(
$input
[
'notifications_id'
]))
{
return
;
}
$targets
=
getAllData
s
FromTable
(
$targets
=
getAllDataFromTable
(
self
::
getTable
(),
[
'notifications_id'
=>
$input
[
'notifications_id'
]
]
...
...
inc/notificationtargetchange.class.php
View file @
d45be5cf
...
...
@@ -89,7 +89,7 @@ class NotificationTargetChange extends NotificationTargetCommonITILObject {
// Complex mode
if
(
!
$simple
)
{
$restrict
=
[
'changes_id'
=>
$item
->
getField
(
'id'
)];
$tickets
=
getAllData
s
FromTable
(
'glpi_changes_tickets'
,
$restrict
);
$tickets
=
getAllDataFromTable
(
'glpi_changes_tickets'
,
$restrict
);
$data
[
'tickets'
]
=
[];
if
(
count
(
$tickets
))
{
...
...
@@ -111,7 +111,7 @@ class NotificationTargetChange extends NotificationTargetCommonITILObject {
$data
[
'##change.numberoftickets##'
]
=
count
(
$data
[
'tickets'
]);
$problems
=
getAllData
s
FromTable
(
'glpi_changes_problems'
,
$restrict
);
$problems
=
getAllDataFromTable
(
'glpi_changes_problems'
,
$restrict
);
$data
[
'problems'
]
=
[];
if
(
count
(
$problems
))
{
...
...
@@ -138,7 +138,7 @@ class NotificationTargetChange extends NotificationTargetCommonITILObject {
$data
[
'##change.numberofproblems##'
]
=
count
(
$data
[
'problems'
]);
$items
=
getAllData
s
FromTable
(
'glpi_changes_items'
,
$restrict
);
$items
=
getAllDataFromTable
(
'glpi_changes_items'
,
$restrict
);
$data
[
'items'
]
=
[];
if
(
count
(
$items
))
{
...
...
@@ -199,11 +199,11 @@ class NotificationTargetChange extends NotificationTargetCommonITILObject {
$restrict
[
'glpi_changevalidations.id'
]
=
$options
[
'validation_id'
];
}
$validations
=
getAllData
s
FromTable
(
'glpi_changevalidations'
,
$restrict
,
false
,
[
'submission_date DESC'
,
'id ASC'
]
$validations
=
getAllDataFromTable
(
'glpi_changevalidations'
,
[
'WHERE'
=>
$restrict
,
'ORDER'
=>
[
'submission_date DESC'
,
'id ASC'
]
]
);
$data
[
'validations'
]
=
[];
foreach
(
$validations
as
$validation
)
{
...
...
inc/notificationtargetcommonitilobject.class.php
View file @
d45be5cf
...
...
@@ -1236,7 +1236,12 @@ abstract class NotificationTargetCommonITILObject extends NotificationTarget {
$followup_restrict
[
'itemtype'
]
=
$objettype
;
//Followup infos
$followups
=
getAllDatasFromTable
(
'glpi_itilfollowups'
,
$followup_restrict
,
false
,
[
'date_mod DESC'
,
'id ASC'
]);
$followups
=
getAllDataFromTable
(
'glpi_itilfollowups'
,
[
'WHERE'
=>
$followup_restrict
,
'ORDER'
=>
[
'date_mod DESC'
,
'id ASC'
]
]
);
$data
[
'followups'
]
=
[];
foreach
(
$followups
as
$followup
)
{
$tmp
=
[];
...
...
@@ -1345,12 +1350,11 @@ abstract class NotificationTargetCommonITILObject extends NotificationTarget {
$data
[
"##
$objettype
.costtime##"
]
=
$costs
[
'costtime'
];
$data
[
"##
$objettype
.totalcost##"
]
=
$costs
[
'totalcost'
];
$costs
=
getAllDatasFromTable
(
getTableForItemType
(
$costtype
),
[
$item
->
getForeignKeyField
()
=>
$item
->
getField
(
'id'
)],
false
,
[
'begin_date DESC'
,
'id ASC'
]
$costs
=
getAllDataFromTable
(
getTableForItemType
(
$costtype
),
[
'WHERE'
=>
[
$item
->
getForeignKeyField
()
=>
$item
->
getField
(
'id'
)],
'ORDER'
=>
[
'begin_date DESC'
,
'id ASC'
]
]
);
$data
[
'costs'
]
=
[];
foreach
(
$costs
as
$cost
)
{
...
...
@@ -1383,11 +1387,11 @@ abstract class NotificationTargetCommonITILObject extends NotificationTarget {
$restrict
[
'is_private'
]
=
0
;
}
$tasks
=
getAllData
s
FromTable
(
$taskobj
->
getTable
(),
$restrict
,
false
,
[
'date_mod DESC'
,
'id ASC'
]
$tasks
=
getAllDataFromTable
(
$taskobj
->
getTable
(),
[
'WHERE'
=>
$restrict
,
'ORDER'
=>
[
'date_mod DESC'
,
'id ASC'
]
]
);
$data
[
'tasks'
]
=
[];
foreach
(
$tasks
as
$task
)
{
...
...
inc/notificationtargetproblem.class.php
View file @
d45be5cf
...
...
@@ -72,7 +72,7 @@ class NotificationTargetProblem extends NotificationTargetCommonITILObject {
// Complex mode
if
(
!
$simple
)
{
$restrict
=
[
'problems_id'
=>
$item
->
getField
(
'id'
)];
$tickets
=
getAllData
s
FromTable
(
'glpi_problems_tickets'
,
$restrict
);
$tickets
=
getAllDataFromTable
(
'glpi_problems_tickets'
,
$restrict
);
$data
[
'tickets'
]
=
[];
if
(
count
(
$tickets
))
{
...
...
@@ -100,7 +100,7 @@ class NotificationTargetProblem extends NotificationTargetCommonITILObject {
$data
[
'##problem.numberoftickets##'
]
=
count
(
$data
[
'tickets'
]);
$changes
=
getAllData
s
FromTable
(
'glpi_changes_problems'
,
$restrict
);
$changes
=
getAllDataFromTable
(
'glpi_changes_problems'
,
$restrict
);
$data
[
'changes'
]
=
[];
if
(
count
(
$changes
))
{
...
...
@@ -127,7 +127,7 @@ class NotificationTargetProblem extends NotificationTargetCommonITILObject {
$data
[
'##problem.numberofchanges##'
]
=
count
(
$data
[
'changes'
]);
$items
=
getAllData
s
FromTable
(
'glpi_items_problems'
,
$restrict
);
$items
=
getAllDataFromTable
(
'glpi_items_problems'
,
$restrict
);
$data
[
'items'
]
=
[];
if
(
count
(
$items
))
{
...
...
inc/notificationtargetproject.class.php
View file @
d45be5cf
...
...
@@ -333,7 +333,7 @@ class NotificationTargetProject extends NotificationTarget {
}
// Team infos
$restrict
=
[
'projects_id'
=>
$item
->
getField
(
'id'
)];
$items
=
getAllData
s
FromTable
(
'glpi_projectteams'
,
$restrict
);
$items
=
getAllDataFromTable
(
'glpi_projectteams'
,
$restrict
);
$this
->
data
[
'teammembers'
]
=
[];
if
(
count
(
$items
))
{
...
...
@@ -352,7 +352,12 @@ class NotificationTargetProject extends NotificationTarget {
$this
->
data
[
'##project.numberofteammembers##'
]
=
count
(
$this
->
data
[
'teammembers'
]);
// Task infos
$tasks
=
getAllDatasFromTable
(
'glpi_projecttasks'
,
$restrict
,
false
,
[
'date DESC'
,
'id ASC'
]);
$tasks
=
getAllDataFromTable
(
'glpi_projecttasks'
,
[
'WHERE'
=>
$restrict
,
'ORDER'
=>
[
'date DESC'
,
'id ASC'
]
]
);
$this
->
data
[
'tasks'
]
=
[];
foreach
(
$tasks
as
$task
)
{
$tmp
=
[];
...
...
@@ -391,7 +396,12 @@ class NotificationTargetProject extends NotificationTarget {
$this
->
data
[
"##project.numberoftasks##"
]
=
count
(
$this
->
data
[
'tasks'
]);
//costs infos
$costs
=
getAllDatasFromTable
(
'glpi_projectcosts'
,
$restrict
,
false
,
[
'begin_date DESC'
,
'id ASC'
]);
$costs
=
getAllDataFromTable
(
'glpi_projectcosts'
,
[
'WHERE'
=>
$restrict
,
'ORDER'
=>
[
'begin_date DESC'
,
'id ASC'
]
]
);
$this
->
data
[
'costs'
]
=
[];
$this
->
data
[
"##project.totalcost##"
]
=
0
;
foreach
(
$costs
as
$cost
)
{
...
...
@@ -433,7 +443,7 @@ class NotificationTargetProject extends NotificationTarget {
'projects_id'
=>
$item
->
getField
(
'id'
),
'itemtype'
=>
$itemtype
,
];
$link_items
=
getAllData
s
FromTable
(
Itil_Project
::
getTable
(),
$restrict
);
$link_items
=
getAllDataFromTable
(
Itil_Project
::
getTable
(),
$restrict
);
if
(
count
(
$link_items
))
{
$nitem
=
new
$itemtype
();
foreach
(
$link_items
as
$data
)
{
...
...
@@ -507,7 +517,7 @@ class NotificationTargetProject extends NotificationTarget {
=
count
(
$this
->
data
[
'documents'
]);
// Items infos
$items
=
getAllData
s
FromTable
(
'glpi_items_projects'
,
$restrict
);
$items
=
getAllDataFromTable
(
'glpi_items_projects'
,
$restrict
);
$this
->
data
[
'items'
]
=
[];
if
(
count
(
$items
))
{
...
...
inc/notificationtargetprojecttask.class.php
View file @
d45be5cf
...
...
@@ -310,7 +310,7 @@ class NotificationTargetProjectTask extends NotificationTarget {
// Team infos
$restrict
=
[
'projecttasks_id'
=>
$item
->
getField
(
'id'
)];
$order
=
[
'date DESC'
,
'id ASC'
];
$items
=
getAllData
s
FromTable
(
'glpi_projecttaskteams'
,
$restrict
);
$items
=
getAllDataFromTable
(
'glpi_projecttaskteams'
,
$restrict
);
$this
->
data
[
'teammembers'
]
=
[];
if
(
count
(
$items
))
{
...
...
@@ -329,7 +329,12 @@ class NotificationTargetProjectTask extends NotificationTarget {
$this
->
data
[
'##projecttask.numberofteammembers##'
]
=
count
(
$this
->
data
[
'teammembers'
]);
// Task infos
$tasks
=
getAllDatasFromTable
(
'glpi_projecttasks'
,
$restrict
,
false
,
$order
);
$tasks
=
getAllDataFromTable
(
'glpi_projecttasks'
,
[
'WHERE'
=>
$restrict
,
'ORDER'
=>
$order
]
);
$this
->
data
[
'tasks'
]
=
[];
foreach
(
$tasks
as
$task
)
{
$tmp
=
[];
...
...
@@ -383,7 +388,7 @@ class NotificationTargetProjectTask extends NotificationTarget {
$this
->
data
[
"##projecttask.numberoflogs##"
]
=
count
(
$this
->
data
[
'log'
]);
// Tickets infos
$tickets
=
getAllData
s
FromTable
(
'glpi_projecttasks_tickets'
,
$restrict
);
$tickets
=
getAllDataFromTable
(
'glpi_projecttasks_tickets'
,
$restrict
);
$this
->
data
[
'tickets'
]
=
[];
if
(
count
(
$tickets
))
{
...
...
@@ -459,7 +464,7 @@ class NotificationTargetProjectTask extends NotificationTarget {
=
count
(
$this
->
data
[
'documents'
]);
// Items infos
$items
=
getAllData
s
FromTable
(
'glpi_items_projects'
,
$restrict
);
$items
=
getAllDataFromTable
(
'glpi_items_projects'
,
$restrict
);
$this
->
getTags
();
foreach
(
$this
->
tag_descriptions
[
NotificationTarget
::
TAG_LANGUAGE
]
as
$tag
=>
$values
)
{
...
...
inc/notificationtargetticket.class.php
View file @
d45be5cf
...
...
@@ -391,7 +391,7 @@ class NotificationTargetTicket extends NotificationTargetCommonITILObject {
$data
[
'##ticket.numberoflinkedtickets##'
]
=
count
(
$data
[
'linkedtickets'
]);
$restrict
=
[
'tickets_id'
=>
$item
->
getField
(
'id'
)];
$problems
=
getAllData
s
FromTable
(
'glpi_problems_tickets'
,
$restrict
);
$problems
=
getAllDataFromTable
(
'glpi_problems_tickets'
,
$restrict
);
$data
[
'problems'
]
=
[];
if
(
count
(
$problems
))
{
$problem
=
new
Problem
();
...
...
@@ -418,7 +418,7 @@ class NotificationTargetTicket extends NotificationTargetCommonITILObject {
$data
[
'##ticket.numberofproblems##'
]
=
count
(
$data
[
'problems'
]);
$changes
=
getAllData
s
FromTable
(
'glpi_changes_tickets'
,
$restrict
);
$changes
=
getAllDataFromTable
(
'glpi_changes_tickets'
,
$restrict
);
$data
[
'changes'
]
=
[];
if
(
count
(
$changes
))
{
$change
=
new
Change
();
...
...
@@ -450,7 +450,12 @@ class NotificationTargetTicket extends NotificationTargetCommonITILObject {
'itemtype'
=>
'Ticket'
,
'items_id'
=>
$item
->
getField
(
'id'
)
];
$replysolved
=
getAllDatasFromTable
(
'glpi_itilfollowups'
,
$solution_restrict
,
false
,
[
'date_mod DESC'
,
'id ASC'
]);
$replysolved
=
getAllDataFromTable
(
'glpi_itilfollowups'
,
[
'WHERE'
=>
$solution_restrict
,
'ORDER'
=>
[
'date_mod DESC'
,
'id ASC'
]
]