Commit 7cfc6271 authored by Johan Cwiklinski's avatar Johan Cwiklinski

Merge branch '9.5/bugfixes'

parents 3760040a adfc9541
......@@ -78,7 +78,7 @@ if (isset($_GET['node'])) {
$nodes[] = $path;
}
} else { // standard node
$node_id = $_GET['node'];
$node_id = preg_replace('/r$/', '', $_GET['node']);
$iterator = $DB->request([
'SELECT' => [
'ent.id',
......
......@@ -3326,13 +3326,7 @@ abstract class CommonITILObject extends CommonDBTM {
'name' => __('Time to resolve exceedeed'),
'datatype' => 'bool',
'massiveaction' => false,
'computation' =>
'IF(' . $DB->quoteName('TABLE.time_to_resolve') . ' IS NOT NULL
AND ' . $DB->quoteName('TABLE.status') . ' <> 4
AND (' . $DB->quoteName('TABLE.solvedate') . ' > ' . $DB->quoteName('TABLE.time_to_resolve') . '
OR (' . $DB->quoteName('TABLE.solvedate') . ' IS NULL
AND ' . $DB->quoteName('TABLE.time_to_resolve') . ' < NOW())),
1, 0)'
'computation' => self::generateSLAOLAComputation('time_to_resolve')
];
$tab[] = [
......@@ -3789,6 +3783,34 @@ abstract class CommonITILObject extends CommonDBTM {
return $tab;
}
static function generateSLAOLAComputation($type, $table = "TABLE") {
global $DB;
switch ($type) {
case 'internal_time_to_own':
case 'time_to_own':
return 'IF('.$DB->quoteName($table.'.'.$type).' IS NOT NULL
AND '.$DB->quoteName($table.'.status').' <> '.self::WAITING.'
AND ('.$DB->quoteName($table.'.takeintoaccount_delay_stat').'
> TIME_TO_SEC(TIMEDIFF('.$DB->quoteName($table.'.'.$type).',
'.$DB->quoteName($table.'.date').'))
OR ('.$DB->quoteName($table.'.takeintoaccount_delay_stat').' = 0
AND '.$DB->quoteName($table.'.'.$type).' < NOW())),
1, 0)';
break;
case 'internal_time_to_resolve':
case 'time_to_resolve':
return 'IF(' . $DB->quoteName($table.'.'.$type) . ' IS NOT NULL
AND ' . $DB->quoteName($table.'.status') . ' <> 4
AND (' . $DB->quoteName($table.'.solvedate') . ' > ' . $DB->quoteName($table.'.'.$type) . '
OR (' . $DB->quoteName($table.'.solvedate') . ' IS NULL
AND ' . $DB->quoteName($table.'.'.$type) . ' < NOW())),
1, 0)';
break;
}
}
/**
* Get status icon
*
......
......@@ -39,6 +39,7 @@ use CommonITILActor;
use CommonITILValidation;
use CommonTreeDropdown;
use DBConnection;
use CommonITILObject;
use Group;
use Group_Ticket;
use Problem;
......@@ -269,10 +270,10 @@ class Provider extends CommonGLPI {
$query_criteria['WHERE']+= [
"$table.status" => Ticket::getNotSolvedStatusArray(),
'OR' => [
'time_to_resolve' => ['<', new QueryExpression('NOW()')],
'time_to_own' => ['<', new QueryExpression('NOW()')],
'internal_time_to_own' => ['<', new QueryExpression('NOW()')],
'internal_time_to_resolve' => ['<', new QueryExpression('NOW()')],
CommonITILObject::generateSLAOLAComputation('time_to_resolve', 'glpi_tickets'),
CommonITILObject::generateSLAOLAComputation('internal_time_to_resolve', 'glpi_tickets'),
CommonITILObject::generateSLAOLAComputation('time_to_own', 'glpi_tickets'),
CommonITILObject::generateSLAOLAComputation('internal_time_to_own', 'glpi_tickets'),
]
];
break;
......
......@@ -3886,7 +3886,7 @@ JS;
// init editor
tinyMCE.init({
language_url: '$language_url',
invalid_elements: 'form,iframe,script,@[onclick|ondblclick|'
invalid_elements: 'form,object,embed,iframe,script,@[onclick|ondblclick|'
+ 'onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|'
+ 'onkeydown|onkeyup]',
browser_spellcheck: true,
......
......@@ -672,7 +672,7 @@ class Item_Ticket extends CommonItilObject_Item {
'WHERE' => [
'groups_id' => $groups
] + getEntitiesRestrictCriteria($itemtable, '', $entity_restrict, $item->maybeRecursive()),
'ORDER' => 'name'
'ORDER' => $item->getNameField()
];
if ($item->maybeDeleted()) {
......
......@@ -2745,14 +2745,7 @@ class Ticket extends CommonITILObject {
'name' => __('Time to own exceedeed'),
'datatype' => 'bool',
'massiveaction' => false,
'computation' => 'IF('.$DB->quoteName('TABLE.time_to_own').' IS NOT NULL
AND '.$DB->quoteName('TABLE.status').' <> '.self::WAITING.'
AND ('.$DB->quoteName('TABLE.takeintoaccount_delay_stat').'
> TIME_TO_SEC(TIMEDIFF('.$DB->quoteName('TABLE.time_to_own').',
'.$DB->quoteName('TABLE.date').'))
OR ('.$DB->quoteName('TABLE.takeintoaccount_delay_stat').' = 0
AND '.$DB->quoteName('TABLE.time_to_own').' < NOW())),
1, 0)'
'computation' => self::generateSLAOLAComputation('time_to_own')
];
$tab[] = [
......@@ -2783,12 +2776,7 @@ class Ticket extends CommonITILObject {
'name' => __('Internal time to resolve exceedeed'),
'datatype' => 'bool',
'massiveaction' => false,
'computation' => 'IF('.$DB->quoteName('TABLE.internal_time_to_resolve').' IS NOT NULL
AND '.$DB->quoteName('TABLE.status').' <> 4
AND ('.$DB->quoteName('TABLE.solvedate').' > '.$DB->quoteName('TABLE.internal_time_to_resolve').'
OR ('.$DB->quoteName('TABLE.solvedate').' IS NULL
AND '.$DB->quoteName('TABLE.internal_time_to_resolve').' < NOW())),
1, 0)'
'computation' => self::generateSLAOLAComputation('internal_time_to_resolve')
];
$tab[] = [
......@@ -2819,14 +2807,7 @@ class Ticket extends CommonITILObject {
'name' => __('Internal time to own exceedeed'),
'datatype' => 'bool',
'massiveaction' => false,
'computation' => 'IF('.$DB->quoteName('TABLE.internal_time_to_own').' IS NOT NULL
AND '.$DB->quoteName('TABLE.status').' <> '.self::WAITING.'
AND ('.$DB->quoteName('TABLE.takeintoaccount_delay_stat').'
> TIME_TO_SEC(TIMEDIFF('.$DB->quoteName('TABLE.internal_time_to_own').',
'.$DB->quoteName('TABLE.date').'))
OR ('.$DB->quoteName('TABLE.takeintoaccount_delay_stat').' = 0
AND '.$DB->quoteName('TABLE.internal_time_to_own').' < NOW())),
1, 0)'
'computation' => self::generateSLAOLAComputation('internal_time_to_own')
];
$max_date = '99999999';
......
Return-Path: normal@glpi-project.org
Received: from 192.168.1.3 (LHLO mail.glpi-project.org) (192.168.1.3)
by mail.glpi-project.org with LMTP; Thu, 7 Jun 2018 12:05:51 +0200
(CEST)
Received: from mail.glpi-project.org (localhost [127.0.0.1])
by mail.glpi-project.org (Postfix) with ESMTP id 6E50A7E807FE
for <unittests@glpi-project.org>; Thu, 7 Jun 2018 12:05:51 +0200 (CEST)
Received: from localhost (localhost [127.0.0.1])
by mail.glpi-project.org (Postfix) with ESMTP id 5C15F7E80423
for <unittests@glpi-project.org>; Thu, 7 Jun 2018 12:05:51 +0200 (CEST)
Received: from mail.glpi-project.org ([127.0.0.1])
by localhost (mail.glpi-project.org [127.0.0.1]) (amavisd-new, port 10026)
with ESMTP id zZ35QyFtsE9R for <unittests@glpi-project.org>;
Thu, 7 Jun 2018 12:05:51 +0200 (CEST)
Received: from mail.glpi-project.org (localhost [127.0.0.1])
by mail.glpi-project.org (Postfix) with ESMTP id 214627E807E8
for <unittests@glpi-project.org>; Thu, 7 Jun 2018 12:05:51 +0200 (CEST)
Date: Thu, 7 Jun 2018 12:05:51 +0200 (CEST)
From: Normal User <normal@glpi-project.org>
To: GLPI debug <unittests@glpi-project.org>
Message-ID: <1695134010.1757889.1528365951040.JavaMail.zimbra@glpi-project.org>
In-Reply-To: <1954034179.1757759.1528365914864.JavaMail.zimbra@glpi-project.org>
Subject: Attachement having filename using RFC5987 (single line)
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="----=_Part_1757883_1359581901.1528365951028"
------=_Part_1757883_1359581901.1528365951028
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Attached image has special chars in its filename
------=_Part_1757883_1359581901.1528365951028
Content-Type: multipart/related;
boundary="----=_Part_1757884_1267006027.1528365951028"
------=_Part_1757884_1267006027.1528365951028
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 7bit
<html>
<body>
Attached image has special chars in its filename
<img src="cid:6f1f48de7c56cc3412e74008ad9f7c640091f5e3@zimbra">
</body>
</html>
------=_Part_1757884_1267006027.1528365951028
Content-Type: image/gif;
name="=?UTF-8?B?MjAtc3BlYyVDMyVBRmFsJTI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AAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEA
AAAh+QQEAAAAACwAAAAABQAFAAAICwABCBxIsKBBggEBADs=
------=_Part_1757884_1267006027.1528365951028--
------=_Part_1757883_1359581901.1528365951028--
......@@ -333,6 +333,7 @@ class MailCollector extends DbTestCase {
'This is a mail without subject.', // No subject = name is set using ticket contents
'Image tag splitted on multiple lines',
'Attachement having filename using RFC5987 (multiple lines)',
'Attachement having filename using RFC5987 (single line)',
'Mono-part HTML message',
]
],
......@@ -399,6 +400,7 @@ class MailCollector extends DbTestCase {
'15-image001.png',
'18-blank.gif',
'19-ʂǷèɕɩɐɫ ȼɦâʁȿ.gif',
'20-specïal chars.gif',
];
$iterator = $DB->request(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment