Commit 5a336f58 authored by Johan Cwiklinski's avatar Johan Cwiklinski

Merge branch '9.5/bugfixes'

parents 2470d68d 133ccf23
......@@ -72,6 +72,8 @@ The present file will list all changes made to the project; according to the
- `DBMysql::isMySQLStrictMode()`
- `getAllDatasFromTable` renamed to `getAllDataFromTable()`
- Usage of `$order` parameter in `getAllDataFromTable()` (`DbUtils::getAllDataFromTable()`)
- All `TicketTemplate` classes has been renamed to `ITILTemplate`
- `Ticket::getTicketTemplateToUse()` renamed to `Ticket::getITILTemplateToUse()`
#### Removed
......
<?php
/**
* ---------------------------------------------------------------------
* GLPI - Gestionnaire Libre de Parc Informatique
* Copyright (C) 2015-2018 Teclib' and contributors.
*
* http://glpi-project.org
*
* based on GLPI - Gestionnaire Libre de Parc Informatique
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
*
* ---------------------------------------------------------------------
*
* LICENSE
*
* This file is part of GLPI.
*
* GLPI is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* GLPI is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GLPI. If not, see <http://www.gnu.org/licenses/>.
* ---------------------------------------------------------------------
*/
/**
* @since 9.5
*/
$AJAX_INCLUDE = 1;
include ('../inc/includes.php');
header("Content-Type: application/json; charset=UTF-8");
Html::header_nocache();
Session::checkLoginUser();
if (isset($_POST['itilfollowuptemplates_id'])
&& $_POST['itilfollowuptemplates_id'] > 0) {
$template = new ITILFollowupTemplate();
$template->getFromDB($_POST['itilfollowuptemplates_id']);
$template->fields = array_map('html_entity_decode', $template->fields);
echo json_encode($template->fields);
}
<?php
/**
* ---------------------------------------------------------------------
* GLPI - Gestionnaire Libre de Parc Informatique
* Copyright (C) 2015-2018 Teclib' and contributors.
*
* http://glpi-project.org
*
* based on GLPI - Gestionnaire Libre de Parc Informatique
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
*
* ---------------------------------------------------------------------
*
* LICENSE
*
* This file is part of GLPI.
*
* GLPI is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* GLPI is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GLPI. If not, see <http://www.gnu.org/licenses/>.
* ---------------------------------------------------------------------
*/
/**
* @since 9.5
*/
include ('../inc/includes.php');
$dropdown = new ITILFollowupTemplate();
include (GLPI_ROOT . "/front/dropdown.common.form.php");
<?php
/**
* ---------------------------------------------------------------------
* GLPI - Gestionnaire Libre de Parc Informatique
* Copyright (C) 2015-2018 Teclib' and contributors.
*
* http://glpi-project.org
*
* based on GLPI - Gestionnaire Libre de Parc Informatique
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
*
* ---------------------------------------------------------------------
*
* LICENSE
*
* This file is part of GLPI.
*
* GLPI is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* GLPI is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GLPI. If not, see <http://www.gnu.org/licenses/>.
* ---------------------------------------------------------------------
*/
/**
* @since 9.5
*/
include ('../inc/includes.php');
$dropdown = new ITILFollowupTemplate();
include (GLPI_ROOT . "/front/dropdown.common.php");
......@@ -32,5 +32,5 @@
include ('../inc/includes.php');
$dropdown = new TicketTemplate();
$dropdown = new ITILTemplate();
include (GLPI_ROOT . "/front/dropdown.common.form.php");
......@@ -32,5 +32,5 @@
include ('../inc/includes.php');
$dropdown = new TicketTemplate();
$dropdown = new ITILTemplate();
include (GLPI_ROOT . "/front/dropdown.common.php");
......@@ -34,15 +34,15 @@ use Glpi\Event;
include ('../inc/includes.php');
Session ::checkRight('tickettemplate', UPDATE);
Session ::checkRight('itiltemplate', UPDATE);
$item = new TicketTemplateHiddenField();
$item = new ITILTemplateHiddenField();
if (isset($_POST["add"])) {
$item->check(-1, UPDATE, $_POST);
if ($item->add($_POST)) {
Event::log($_POST["tickettemplates_id"], "tickettemplate", 4, "maintain",
Event::log($_POST["itiltemplates_id"], "itiltemplate", 4, "maintain",
//TRANS: %s is the user login
sprintf(__('%s adds hidden field'), $_SESSION["glpiname"]));
}
......
......@@ -34,15 +34,15 @@ use Glpi\Event;
include ('../inc/includes.php');
Session ::checkRight('tickettemplate', UPDATE);
Session ::checkRight('itiltemplate', UPDATE);
$item = new TicketTemplateMandatoryField();
$item = new ITILTemplateMandatoryField();
if (isset($_POST["add"])) {
$item->check(-1, UPDATE, $_POST);
if ($item->add($_POST)) {
Event::log($_POST["tickettemplates_id"], "tickettemplate", 4, "maintain",
Event::log($_POST["itiltemplates_id"], "itiltemplate", 4, "maintain",
//TRANS: %s is the user login
sprintf(__('%s adds mandatory field'), $_SESSION["glpiname"]));
}
......
......@@ -34,9 +34,9 @@ use Glpi\Event;
include ('../inc/includes.php');
Session ::checkRight('tickettemplate', UPDATE);
Session ::checkRight('itiltemplate', UPDATE);
$item = new TicketTemplatePredefinedField();
$item = new ITILTemplatePredefinedField();
// Use masiveaction system to manage add value
if (isset($_POST["massiveaction"])) {
......@@ -45,7 +45,7 @@ if (isset($_POST["massiveaction"])) {
$_POST['items_tickets_id'] = $_POST['items_tickets_id']."_".$_POST['add_items_id'];
}
if ($item->add($_POST)) {
Event::log($_POST["tickettemplates_id"], "tickettemplate", 4, "maintain",
Event::log($_POST["itiltemplates_id"], "itiltemplate", 4, "maintain",
//TRANS: %s is the user login
sprintf(__('%s adds predefined field'), $_SESSION["glpiname"]));
}
......
......@@ -1234,7 +1234,7 @@ abstract class API extends CommonGLPI {
// filter with entity
if ($item->isEntityAssign()
// some CommonDBChild classes may not have entities_id fields and isEntityAssign still return true (like TicketTemplateMandatoryField)
// some CommonDBChild classes may not have entities_id fields and isEntityAssign still return true (like ITILTemplateMandatoryField)
&& array_key_exists('entities_id', $item->fields)) {
$where.= " AND (". getEntitiesRestrictRequest("",
$itemtype::getTable(),
......
......@@ -268,6 +268,17 @@ function glpi_autoload($classname) {
return false;
}
//@since 9.5.0 -- WILL BE REMOVED IN FUTURE RELEASE
$deprecateds = [
'TicketTempate',
'TicketTemplateHiddenField',
'TicketTemplateMandatoryField',
'TicketTemplatePredefinedField'
];
if (in_array($classname, $deprecateds)) {
Toolbox::deprecated("$classname has been dropped from GLPI.");
}
if ($classname === 'phpCAS'
&& file_exists(stream_resolve_include_path("CAS.php"))) {
include_once('CAS.php');
......
......@@ -2526,9 +2526,9 @@ abstract class CommonITILObject extends CommonDBTM {
$mandatory = '';
// For ticket templates : mandatories
if (($itemtype == 'Ticket')
&& isset($options['_tickettemplate'])) {
$mandatory = $options['_tickettemplate']->getMandatoryMark("_groups_id_".$typename);
if ($options['_tickettemplate']->isMandatoryField("_groups_id_".$typename)
&& isset($options['_itiltemplate'])) {
$mandatory = $options['_itiltemplate']->getMandatoryMark("_groups_id_".$typename);
if ($options['_itiltemplate']->isMandatoryField("_groups_id_".$typename)
&& isset($this->groups[$type]) && (count($this->groups[$type])==1)) {
$candelete = false;
}
......@@ -2583,9 +2583,9 @@ abstract class CommonITILObject extends CommonDBTM {
$mandatory = '';
// For ticket templates : mandatories
if (($itemtype == 'Ticket')
&& isset($options['_tickettemplate'])) {
$mandatory = $options['_tickettemplate']->getMandatoryMark("_suppliers_id_".$typename);
if ($options['_tickettemplate']->isMandatoryField("_suppliers_id_".$typename)
&& isset($options['_itiltemplate'])) {
$mandatory = $options['_itiltemplate']->getMandatoryMark("_suppliers_id_".$typename);
if ($options['_itiltemplate']->isMandatoryField("_suppliers_id_".$typename)
&& isset($this->suppliers[$type]) && (count($this->suppliers[$type])==1)) {
$candelete = false;
}
......@@ -3645,9 +3645,9 @@ abstract class CommonITILObject extends CommonDBTM {
$mandatory = '';
// For ticket templates : mandatories
if (($itemtype == 'Ticket')
&& isset($options['_tickettemplate'])) {
$mandatory = $options['_tickettemplate']->getMandatoryMark("_users_id_".$typename);
if ($options['_tickettemplate']->isMandatoryField("_users_id_".$typename)
&& isset($options['_itiltemplate'])) {
$mandatory = $options['_itiltemplate']->getMandatoryMark("_users_id_".$typename);
if ($options['_itiltemplate']->isMandatoryField("_users_id_".$typename)
&& isset($this->users[$type]) && (count($this->users[$type])==1)) {
$candelete = false;
}
......@@ -3819,8 +3819,8 @@ abstract class CommonITILObject extends CommonDBTM {
echo self::getActorIcon('user', $type);
// For ticket templates : mandatories
if (($itemtype == 'Ticket')
&& isset($options['_tickettemplate'])) {
echo $options['_tickettemplate']->getMandatoryMark("_users_id_".$typename);
&& isset($options['_itiltemplate'])) {
echo $options['_itiltemplate']->getMandatoryMark("_users_id_".$typename);
}
echo "&nbsp;";
......@@ -3983,8 +3983,8 @@ abstract class CommonITILObject extends CommonDBTM {
echo self::getActorIcon('supplier', 'assign');
// For ticket templates : mandatories
if (($itemtype == 'Ticket')
&& isset($options['_tickettemplate'])) {
echo $options['_tickettemplate']->getMandatoryMark("_suppliers_id_assign");
&& isset($options['_itiltemplate'])) {
echo $options['_itiltemplate']->getMandatoryMark("_suppliers_id_assign");
}
echo "&nbsp;";
......@@ -4080,8 +4080,8 @@ abstract class CommonITILObject extends CommonDBTM {
'_users_id_assign', '_groups_id_assign',
'_suppliers_id_assign'] as $f) {
$is_hidden[$f] = false;
if (isset($options['_tickettemplate'])
&& $options['_tickettemplate']->isHiddenField($f)) {
if (isset($options['_itiltemplate'])
&& $options['_itiltemplate']->isHiddenField($f)) {
$is_hidden[$f] = true;
}
}
......@@ -4187,8 +4187,8 @@ abstract class CommonITILObject extends CommonDBTM {
&& !$is_hidden['_groups_id_requester']) {
echo self::getActorIcon('group', CommonITILActor::REQUESTER);
/// For ticket templates : mandatories
if (isset($options['_tickettemplate'])) {
echo $options['_tickettemplate']->getMandatoryMark('_groups_id_requester');
if (isset($options['_itiltemplate'])) {
echo $options['_itiltemplate']->getMandatoryMark('_groups_id_requester');
}
echo "&nbsp;";
......@@ -4281,8 +4281,8 @@ abstract class CommonITILObject extends CommonDBTM {
&& !$is_hidden['_groups_id_observer']) {
echo self::getActorIcon('group', CommonITILActor::OBSERVER);
/// For ticket templates : mandatories
if (isset($options['_tickettemplate'])) {
echo $options['_tickettemplate']->getMandatoryMark('_groups_id_observer');
if (isset($options['_itiltemplate'])) {
echo $options['_itiltemplate']->getMandatoryMark('_groups_id_observer');
}
echo "&nbsp;";
......@@ -4393,8 +4393,8 @@ abstract class CommonITILObject extends CommonDBTM {
&& $this->isAllowedStatus(CommonITILObject::INCOMING, CommonITILObject::ASSIGNED)) {
echo self::getActorIcon('group', CommonITILActor::ASSIGN);
/// For ticket templates : mandatories
if (isset($options['_tickettemplate'])) {
echo $options['_tickettemplate']->getMandatoryMark('_groups_id_assign');
if (isset($options['_itiltemplate'])) {
echo $options['_itiltemplate']->getMandatoryMark('_groups_id_assign');
}
echo "&nbsp;";
$rand = mt_rand();
......
......@@ -494,15 +494,16 @@ $CFG_GLPI['javascript'] = [
'config' => [
'config' => ['colorpicker'],
'commondropdown' => [
'ProjectState' => ['colorpicker'],
'SolutionTemplate' => ['tinymce']
'ProjectState' => ['colorpicker'],
'SolutionTemplate' => ['tinymce'],
'ITILFollowupTemplate' => ['tinymce']
],
'notification' => [
'notificationtemplate' => ['tinymce']
]
],
'admin' => ['colorpicker', 'clipboard'],
'preference'=> ['colorpicker', 'clipboard'],
'admin' => ['colorpicker', 'clipboard'],
'preference' => ['colorpicker', 'clipboard'],
'self-service' => ['colorpicker', 'tinymce']
];
......
......@@ -1553,6 +1553,9 @@ class Document extends CommonDBTM {
return false;
}
if (extension_loaded('exif')) {
if (filesize($file) < 12) {
return false;
}
$etype = exif_imagetype($file);
return in_array($etype, [IMAGETYPE_JPEG, IMAGETYPE_GIF, IMAGETYPE_PNG, IMAGETYPE_BMP]);
} else {
......
......@@ -153,7 +153,7 @@ class Document_Item extends CommonDBRelation{
$ticket = new Ticket();
$ticket->getFromDB($this->fields['items_id']);
$tt = $ticket->getTicketTemplateToUse(0, $ticket->fields['type'],
$tt = $ticket->getITILTemplateToUse(0, $ticket->fields['type'],
$ticket->fields['itilcategories_id'],
$ticket->fields['entities_id']);
......
......@@ -834,6 +834,8 @@ class Dropdown {
Session::getPluralNumber()),
'RequestType' => _n('Request source', 'Request sources',
Session::getPluralNumber()),
'ITILFollowupTemplate' => _n('Followup template', 'Followup templates',
Session::getPluralNumber()),
'SolutionTemplate' => _n('Solution template',
'Solution templates',
Session::getPluralNumber()),
......
......@@ -103,7 +103,7 @@ class Entity extends CommonTreeDropdown {
'autoclose_delay', 'inquest_config',
'inquest_rate', 'inquest_delay',
'inquest_duration','inquest_URL',
'max_closedate', 'tickettemplates_id',
'max_closedate', 'itiltemplates_id',
'suppliers_as_private'],
// Configuration
'config'
......@@ -911,7 +911,7 @@ class Entity extends CommonTreeDropdown {
$tab[] = [
'id' => '47',
'table' => $this->getTable(),
'field' => 'tickettemplates_id', // not a dropdown because of special value
'field' => 'itiltemplates_id', // not a dropdown because of special value
'name' => _n('Ticket template', 'Ticket templates', 1),
'massiveaction' => false,
'nosearch' => true,
......@@ -2270,18 +2270,18 @@ class Entity extends CommonTreeDropdown {
$toadd = [self::CONFIG_PARENT => __('Inheritance of the parent entity')];
}
$options = ['value' => $entity->fields["tickettemplates_id"],
$options = ['value' => $entity->fields["itiltemplates_id"],
'entity' => $ID,
'toadd' => $toadd];
TicketTemplate::dropdown($options);
ITILTemplate::dropdown($options);
if (($entity->fields["tickettemplates_id"] == self::CONFIG_PARENT)
if (($entity->fields["itiltemplates_id"] == self::CONFIG_PARENT)
&& ($ID != 0)) {
echo "<font class='green'>&nbsp;&nbsp;";
$tt = new TicketTemplate();
$tid = self::getUsedConfig('tickettemplates_id', $ID, '', 0);
$tt = new ITILTemplate();
$tid = self::getUsedConfig('itiltemplates_id', $ID, '', 0);
if (!$tid) {
echo Dropdown::EMPTY_VALUE;
} else if ($tt->getFromDB($tid)) {
......@@ -2887,11 +2887,11 @@ class Entity extends CommonTreeDropdown {
}
return Dropdown::getDropdownName('glpi_entities', $values[$field]);
case 'tickettemplates_id' :
case 'itiltemplates_id' :
if ($values[$field] == self::CONFIG_PARENT) {
return __('Inheritance of the parent entity');
}
return Dropdown::getDropdownName('glpi_tickettemplates', $values[$field]);
return Dropdown::getDropdownName('glpi_itiltemplates', $values[$field]);
case 'calendars_id' :
switch ($values[$field]) {
......
......@@ -226,9 +226,9 @@ class Item_Ticket extends CommonDBRelation{
}
// Get ticket template
$tt = new TicketTemplate();
if (isset($options['_tickettemplate'])) {
$tt = $options['_tickettemplate'];
$tt = new ITILTemplate();
if (isset($options['_itiltemplate'])) {
$tt = $options['_itiltemplate'];
if (isset($tt->fields['id'])) {
$opt['templates_id'] = $tt->fields['id'];
}
......
......@@ -87,11 +87,11 @@ class ITILCategory extends CommonTreeDropdown {
'label' => __('Visible for a change'),
'type' => 'bool',
'list' => true],
['name' => 'tickettemplates_id_demand',
['name' => 'itiltemplates_id_demand',
'label' => __('Template for a request'),
'type' => 'dropdownValue',
'list' => true],
['name' => 'tickettemplates_id_incident',
['name' => 'itiltemplates_id_incident',
'label' => __('Template for an incident'),
'type' => 'dropdownValue',
'list' => true],
......@@ -129,18 +129,18 @@ class ITILCategory extends CommonTreeDropdown {
$tab[] = [
'id' => '72',
'table' => 'glpi_tickettemplates',
'table' => 'glpi_itiltemplates',
'field' => 'name',
'linkfield' => 'tickettemplates_id_demand',
'linkfield' => 'itiltemplates_id_demand',
'name' => __('Template for a request'),
'datatype' => 'dropdown'
];
$tab[] = [
'id' => '73',
'table' => 'glpi_tickettemplates',
'table' => 'glpi_itiltemplates',
'field' => 'name',
'linkfield' => 'tickettemplates_id_incident',
'linkfield' => 'itiltemplates_id_incident',
'name' => __('Template for an incident'),
'datatype' => 'dropdown'
];
......@@ -266,7 +266,7 @@ class ITILCategory extends CommonTreeDropdown {
if (Session::haveRight(self::$rightname, READ)) {
switch ($item->getType()) {
case 'TicketTemplate' :
case 'ITILTemplate' :
$ong[1] = $this->getTypeName(Session::getPluralNumber());
return $ong;
}
......@@ -277,18 +277,18 @@ class ITILCategory extends CommonTreeDropdown {
static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0) {
if ($item->getType() == 'TicketTemplate') {
self::showForTicketTemplate($item, $withtemplate);
if ($item->getType() == 'ITILTemplate') {
self::showForITILTemplate($item, $withtemplate);
}
return parent::displayTabContentForItem($item, $tabnum, $withtemplate);
}
/**
* @param $tt TicketTemplate object
* @param $tt ITILTemplate object
* @param $withtemplate (default 0)
**/
static function showForTicketTemplate(TicketTemplate $tt, $withtemplate = 0) {
static function showForITILTemplate(ITILTemplate $tt, $withtemplate = 0) {
global $DB, $CFG_GLPI;
$itilcategory = new self();
......@@ -307,8 +307,8 @@ class ITILCategory extends CommonTreeDropdown {
'FROM' => 'glpi_itilcategories',
'WHERE' => [
'OR' => [
'tickettemplates_id_incident' => $ID,
'tickettemplates_id_demand' => $ID
'itiltemplates_id_incident' => $ID,
'itiltemplates_id_demand' => $ID
]
],
'ORDER' => 'name'
......@@ -333,7 +333,7 @@ class ITILCategory extends CommonTreeDropdown {
echo "<tr class='tab_bg_2'>";
$itilcategory->getFromDB($data['id']);
echo "<td>".$itilcategory->getLink(['comments' => true])."</td>";
if ($data['tickettemplates_id_incident'] == $ID) {
if ($data['itiltemplates_id_incident'] == $ID) {
echo "<td class='center'>
<img src='".$CFG_GLPI["root_doc"]."/pics/ok.png' alt=\"".__('OK').
"\" width='14' height='14'>
......@@ -342,7 +342,7 @@ class ITILCategory extends CommonTreeDropdown {
} else {
echo "<td>&nbsp;</td>";
}
if ($data['tickettemplates_id_demand'] == $ID) {
if ($data['itiltemplates_id_demand'] == $ID) {
echo "<td class='center'>
<img src='".$CFG_GLPI["root_doc"]."/pics/ok.png' alt=\"".__('OK').
"\" width='14' height='14'>
......
......@@ -706,6 +706,7 @@ class ITILFollowup extends CommonDBChild {
* - item Object : the ITILObject parent
**/
function showForm($ID, $options = []) {
global $CFG_GLPI;
if ($this->isNewItem()) {
$this->getEmpty();
......@@ -756,8 +757,7 @@ class ITILFollowup extends CommonDBChild {
if ($tech) {
$this->showFormHeader($options);
$rand = mt_rand();
$rand_text = mt_rand();
$rand = mt_rand();
$content_id = "content$rand";
echo "<tr class='tab_bg_1'>";
......@@ -765,7 +765,7 @@ class ITILFollowup extends CommonDBChild {
Html::textarea(['name' => 'content',
'value' => $this->fields["content"],
'rand' => $rand_text,
'rand' => $rand,
'editor_id' => $content_id,
'enable_fileupload' => true,
'enable_richtext' => true,
......@@ -791,18 +791,61 @@ class ITILFollowup extends CommonDBChild {
echo "<tr class='tab_bg_1'></tr>";
echo "<tr class='tab_bg_1' style='vertical-align: top'>";
echo "<td colspan='4'>";
echo "<div class='fa-label'>
<i class='fas fa-reply fa-fw'
title='"._n('Followup template', 'Followup templates', 2)."'></i>";
$this->fields['itilfollowuptemplates_id'] = 0;
ITILFollowupTemplate::dropdown([
'value' => $this->fields['itilfollowuptemplates_id'],
'entity' => $this->getEntityID(),
'on_change' => "itilfollowuptemplate_update$rand(this.value)"
]);
echo "</div>";
$ajax_url = $CFG_GLPI["root_doc"]."/ajax/itilfollowup.php";
$JS = <<<JAVASCRIPT
function itilfollowuptemplate_update{$rand}(value) {
$.ajax({
url: '{$ajax_url}',
type: 'POST',
data: {
itilfollowuptemplates_id: value
}
}).done(function(data) {
var requesttypes_id = isNaN(parseInt(data.requesttypes_id))
? 0
: parseInt(data.requesttypes_id);
// set textarea content
$("#{$content_id}").html(data.content);
// set also tinmyce (if enabled)
if (tasktinymce = tinymce.get("{$content_id}")) {
tasktinymce.setContent(data.content);
}
// set category
$("#dropdown_requesttypes_id{$rand}").trigger("setValue", requesttypes_id);
// set is_private
$("#is_privateswitch{$rand}")
.prop("checked", data.is_private == "0"
? false
: true);
});
}
JAVASCRIPT;
echo Html::scriptBlock($JS);
echo "<div class='fa-label'>
<i class='fas fa-inbox fa-fw'
title='".__('Source of followup')."'></i>";
RequestType::dropdown([
'value' => $this->fields["requesttypes_id"],
'condition' => ['is_active' => 1, 'is_itilfollowup' => 1]
'condition' => ['is_active' => 1, 'is_itilfollowup' => 1],
'rand' => $rand,
]);
echo "</div>";
echo "<div class='fa-label'>
<i class='fas fa-lock fa-fw' title='".__('Private')."'></i>";
$rand = mt_rand();
echo "<span class='switch pager_controls'>
<label for='is_privateswitch$rand' title='".__('Private')."'>
<input type='hidden' name='is_private' value='0'>
......
<?php
/**
* ---------------------------------------------------------------------
* GLPI - Gestionnaire Libre de Parc Informatique
* Copyright (C) 2015-2018 Teclib' and contributors.
*
* http://glpi-project.org
*
* based on GLPI - Gestionnaire Libre de Parc Informatique
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
*
* ---------------------------------------------------------------------
*
* LICENSE
*
* This file is part of GLPI.
*
* GLPI is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* GLPI is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GLPI. If not, see <http://www.gnu.org/licenses/>.
* ---------------------------------------------------------------------
*/
if (!defined('GLPI_ROOT')) {
die("Sorry. You can't access this file directly");
}
/**
* Template for followups
* @since 9.5
**/
class ITILFollowupTemplate extends CommonDropdown {
// From CommonDBTM
public $dohistory = true;
public $can_be_translated = true;
static function getTypeName($nb = 0) {
return _n('Followup template', 'Followup templates', $nb);
}
function getAdditionalFields() {
return [
[
'name' => 'content',
'label' => __('Content'),
'type' => 'tinymce',
], [
'name' => 'requesttypes_id',