Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
GLPI
glpi
Commits
d3db2649
Commit
d3db2649
authored
May 02, 2019
by
Johan Cwiklinski
Committed by
Johan Cwiklinski
May 02, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename getAllDatasFromTable and deprecate raw order
parent
083f73c2
Changes
44
Hide whitespace changes
Inline
Side-by-side
Showing
44 changed files
with
186 additions
and
126 deletions
+186
-126
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
-2
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
+15
-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
+1
-1
inc/tickettemplate.class.php
inc/tickettemplate.class.php
+4
-4
install/update_0723_078.php
install/update_0723_078.php
+5
-4
install/update_0782_080.php
install/update_0782_080.php
+1
-1
install/update_078_0781.php
install/update_078_0781.php
+1
-1
install/update_080_0801.php
install/update_080_0801.php
+2
-2
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 @
d3db2649
...
...
@@ -29,6 +29,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 @
d3db2649
...
...
@@ -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
(),
...
...
@@ -1048,7 +1048,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 @
d3db2649
...
...
@@ -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 @
d3db2649
...
...
@@ -2641,7 +2641,7 @@ class AuthLDAP extends CommonDBTM {
* @return array
*/
static
function
getLdapServers
()
{
return
getAllData
s
FromTable
(
'glpi_authldaps'
,
[
],
false
,
'
`
is_default
`
DESC'
);
return
getAllDataFromTable
(
'glpi_authldaps'
,
[
'ORDER'
=>
'is_default DESC'
]
);
}
...
...
inc/blacklist.class.php
View file @
d3db2649
...
...
@@ -247,10 +247,10 @@ class Blacklist extends CommonDropdown {
**/
static
function
getBlacklistedItems
(
$type
)
{
$data
s
=
getAllData
s
FromTable
(
'glpi_blacklists'
,
[
'type'
=>
$type
]);
$data
=
getAllDataFromTable
(
'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 @
d3db2649
...
...
@@ -828,7 +828,7 @@ class Budget extends CommonDropdown{
echo
"</tr>"
;
// get all entities ordered by names
$allentities
=
getAllData
s
FromTable
(
'glpi_entities'
,
[
],
true
,
'completename'
);
$allentities
=
getAllDataFromTable
(
'glpi_entities'
,
[
'ORDER'
=>
'completename'
],
true
);
foreach
(
array_keys
(
$allentities
)
as
$entity
)
{
if
(
isset
(
$entities_values
[
$entity
]))
{
...
...
inc/calendarsegment.class.php
View file @
d3db2649
...
...
@@ -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 @
d3db2649
...
...
@@ -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 @
d3db2649
...
...
@@ -3789,7 +3789,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 @
d3db2649
...
...
@@ -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 @
d3db2649
...
...
@@ -244,7 +244,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'
])
...
...
@@ -323,13 +323,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 @
d3db2649
...
...
@@ -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 @
d3db2649
...
...
@@ -399,45 +399,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 c
ondition
!');
$c
ondition
[
'ORDER'
]
=
$order
;
// Deprecated use case
Toolbox
::
Deprecated
(
'Order should be defined in c
riteria
!'
);
$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 @
d3db2649
...
...
@@ -1490,7 +1490,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'
]);
...
...
@@ -1558,7 +1559,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'
]);
...
...
@@ -2782,7 +2783,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 @
d3db2649
...
...
@@ -411,7 +411,7 @@ class Item_Ticket extends CommonDBRelation{
self
::
dropdownMyDevices
(
$dev_user_id
,
$ticket
->
fields
[
"entities_id"
],
null
,
0
,
[
'tickets_id'
=>
$instID
]);
}
$data
=
array_keys
(
getAllData
s
FromTable
(
'glpi_items_tickets'
));
$data
=
array_keys
(
getAllDataFromTable
(
'glpi_items_tickets'
));
$used
=
[];
if
(
!
empty
(
$data
))
{
foreach
(
$data
as
$val
)
{
...
...
@@ -1045,11 +1045,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 @
d3db2649
...
...
@@ -1946,7 +1946,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 @
d3db2649
...
...
@@ -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 @
d3db2649
...
...
@@ -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 @
d3db2649
...
...
@@ -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 @
d3db2649
...
...
@@ -1207,7 +1207,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
=
[];
...
...
@@ -1316,12 +1321,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
)
{
...
...
@@ -1354,11 +1358,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 @
d3db2649
...
...
@@ -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 @
d3db2649
...
...
@@ -314,7 +314,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
))
{
...
...
@@ -333,7 +333,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
=
[];
...
...
@@ -372,7 +377,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
)
{
...
...
@@ -414,7 +424,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
)
{
...
...
@@ -488,7 +498,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 @
d3db2649
...
...
@@ -290,7 +290,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
))
{
...
...
@@ -309,7 +309,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
=
[];
...
...
@@ -363,7 +368,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
))
{
...
...
@@ -439,7 +444,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 @
d3db2649
...
...
@@ -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'
]
]
);
$current
=
current
(
$replysolved
);
$data
[
'##ticket.solution.approval.description##'
]
=
$current
[
'content'
];
$data
[
'##ticket.solution.approval.date##'
]
=
Html
::
convDateTime
(
$current
[
'date'
]);
...
...
@@ -463,7 +468,13 @@ class NotificationTargetTicket extends NotificationTargetCommonITILObject {