diff --git a/README.md b/README.md
index d48d7c6..bf9ed34 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,5 @@
# Services
-GLPI ITIL Services project
+GLPI Services project
The goal of this plugin is to associate servers, devices, printers, ... to a specific service based on ITIL concepts.
diff --git a/ajax/dropdownTypeServices.php b/ajax/dropdownTypeServices.php
index ac0c27a..1d1ebff 100644
--- a/ajax/dropdownTypeServices.php
+++ b/ajax/dropdownTypeServices.php
@@ -27,13 +27,13 @@
--------------------------------------------------------------------------
*/
-if (strpos($_SERVER['PHP_SELF'],"dropdownTypeServices.php")) {
- include ('../../../inc/includes.php');
+if (strpos($_SERVER['PHP_SELF'], "dropdownTypeServices.php")) {
+ include('../../../inc/includes.php');
header("Content-Type: text/html; charset=UTF-8");
Html::header_nocache();
}
-Session::checkLoginUser();
-//Session::checkCentralAccess();
+//Session::checkLoginUser();
+Session::checkCentralAccess();
// Make a select box
if (isset($_POST["servicetype"])) {
@@ -43,8 +43,8 @@
if (isset($_POST['used']) && is_array($_POST['used']) && (count($_POST['used']) > 0)) {
$query = "SELECT `id`
FROM `glpi_plugin_services_services`
- WHERE `id` IN (".implode(',',$_POST['used']).")
- AND `plugin_services_servicetypes_id` = '".$_POST["servicetype"]."'";
+ WHERE `id` IN (" . implode(',', $_POST['used']) . ")
+ AND `plugin_services_servicetypes_id` = '" . $_POST["servicetype"] . "'";
foreach ($DB->request($query) AS $data) {
$used[$data['id']] = $data['id'];
@@ -52,12 +52,11 @@
}
Dropdown::show('PluginServicesService',
- array('name' => $_POST['myname'],
+ ['name' => $_POST['myname'],
'used' => $used,
'width' => '50%',
'entity' => $_POST['entity'],
'rand' => $_POST['rand'],
- 'condition' => "glpi_plugin_services_services.plugin_services_servicetypes_id='".$_POST["servicetype"]."'"));
+ 'condition' => ["glpi_plugin_services_services.plugin_services_servicetypes_id"=>$_POST["servicetype"]]]);
}
-?>
\ No newline at end of file
diff --git a/front/service.form.php b/front/service.form.php
index 238f930..9e4d484 100644
--- a/front/service.form.php
+++ b/front/service.form.php
@@ -41,6 +41,15 @@
if (isset($_POST["add"])) {
$web->check(-1,CREATE,$_POST);
+ if (isset($_POST['plugin_services_services_id']) && $_POST['plugin_services_services_id'] != '0') {
+ // copy parent's value to child
+ $web->getFromDB($_POST['plugin_services_services_id']);
+ foreach ($web->fields as $key => $value) {
+ if ($key != 'id' && !isset($_POST[$key])) {
+ $_POST[$key] = $value;
+ }
+ }
+ }
$newID= $web->add($_POST);
if ($_SESSION['glpibackcreated']) {
Html::redirect($web->getFormURL()."?id=".$newID);
@@ -109,4 +118,4 @@
Html::footer();
}
-?>
\ No newline at end of file
+?>
diff --git a/front/service.php b/front/service.php
index d4dec63..16e8ffd 100644
--- a/front/service.php
+++ b/front/service.php
@@ -2,40 +2,39 @@
/*
* @version $Id: HEADER 15930 2011-10-30 15:47:55Z tsmr $
-------------------------------------------------------------------------
- Services plugin for GLPI
- Copyright (C) 2003-2011 by the Services Development Team.
+ webapplications plugin for GLPI
+ Copyright (C) 2009-2016 by the services Development Team.
- https://forge.indepnet.net/projects/services
+ https://github.com/InfotelGLPI/services
-------------------------------------------------------------------------
LICENSE
-
- This file is part of Services.
- Services is free software; you can redistribute it and/or modify
+ This file is part of services.
+
+ services 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.
- Services is distributed in the hope that it will be useful,
+ services 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 Services. If not, see .
+ along with services. If not, see .
--------------------------------------------------------------------------
*/
-include ('../../../inc/includes.php');
+include('../../../inc/includes.php');
//check environment meta-plugin installation for change header
$plugin = new Plugin();
if ($plugin->isActivated("environment")) {
- Html::header(PluginServicesService::getTypeName(2)
- ,'',"plugins","pluginenvironmentdisplay","services");
-}else {
- Html::header(PluginServicesService::getTypeName(2), '', "plugins","pluginservicesmenu");
+ Html::header(PluginServicesService::getTypeName(2), '', "assets", "pluginenvironmentdisplay", "services");
+} else {
+ Html::header(PluginServicesService::getTypeName(2), '', "plugins", "pluginservicesmenu");
}
$web = new PluginServicesService();
@@ -45,9 +44,7 @@
Search::show("PluginServicesService");
} else {
-
+
Html::displayRightError();
}
Html::footer();
-
-?>
\ No newline at end of file
diff --git a/front/servicedrsolutiontype.form.php b/front/servicedrsolutiontype.form.php
new file mode 100644
index 0000000..fbc92a7
--- /dev/null
+++ b/front/servicedrsolutiontype.form.php
@@ -0,0 +1,35 @@
+.
+ --------------------------------------------------------------------------
+ */
+
+include ('../../../inc/includes.php');
+
+$dropdown = new PluginServicesServiceDrSolutionType();
+include (GLPI_ROOT . "/front/dropdown.common.form.php");
+
+?>
\ No newline at end of file
diff --git a/front/servicedrsolutiontype.php b/front/servicedrsolutiontype.php
new file mode 100644
index 0000000..5273358
--- /dev/null
+++ b/front/servicedrsolutiontype.php
@@ -0,0 +1,35 @@
+.
+ --------------------------------------------------------------------------
+ */
+
+include ('../../../inc/includes.php');
+
+$dropdown = new PluginServicesServiceDrSolutionType();
+include (GLPI_ROOT . "/front/dropdown.common.php");
+
+?>
\ No newline at end of file
diff --git a/front/servicedrtesttype.form.php b/front/servicedrtesttype.form.php
new file mode 100644
index 0000000..ec230e5
--- /dev/null
+++ b/front/servicedrtesttype.form.php
@@ -0,0 +1,35 @@
+.
+ --------------------------------------------------------------------------
+ */
+
+include ('../../../inc/includes.php');
+
+$dropdown = new PluginServicesServiceDrTestType();
+include (GLPI_ROOT . "/front/dropdown.common.form.php");
+
+?>
\ No newline at end of file
diff --git a/front/servicedrtesttype.php b/front/servicedrtesttype.php
new file mode 100644
index 0000000..543c4bb
--- /dev/null
+++ b/front/servicedrtesttype.php
@@ -0,0 +1,35 @@
+.
+ --------------------------------------------------------------------------
+ */
+
+include ('../../../inc/includes.php');
+
+$dropdown = new PluginServicesServiceDrTestType();
+include (GLPI_ROOT . "/front/dropdown.common.php");
+
+?>
\ No newline at end of file
diff --git a/front/serviceitowner.form.php b/front/serviceitowner.form.php
new file mode 100644
index 0000000..e8bc351
--- /dev/null
+++ b/front/serviceitowner.form.php
@@ -0,0 +1,35 @@
+.
+ --------------------------------------------------------------------------
+ */
+
+include ('../../../inc/includes.php');
+
+$dropdown = new PluginServicesServiceItowner();
+include (GLPI_ROOT . "/front/dropdown.common.form.php");
+
+?>
\ No newline at end of file
diff --git a/front/serviceitowner.php b/front/serviceitowner.php
new file mode 100644
index 0000000..2f0edcd
--- /dev/null
+++ b/front/serviceitowner.php
@@ -0,0 +1,35 @@
+.
+ --------------------------------------------------------------------------
+ */
+
+include ('../../../inc/includes.php');
+
+$dropdown = new PluginServicesServiceItowner();
+include (GLPI_ROOT . "/front/dropdown.common.php");
+
+?>
\ No newline at end of file
diff --git a/hook.php b/hook.php
index 6f83a27..9e6b303 100644
--- a/hook.php
+++ b/hook.php
@@ -4,24 +4,19 @@
-------------------------------------------------------------------------
Services plugin for GLPI
Copyright (C) 2003-2011 by the Services Development Team.
-
https://forge.indepnet.net/projects/services
-------------------------------------------------------------------------
-
LICENSE
This file is part of Services.
-
Services 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.
-
Services 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 Services. If not, see .
--------------------------------------------------------------------------
@@ -371,24 +366,20 @@ function plugin_services_MassiveActions($type) {
if (in_array($type,PluginServicesService::getTypes(true))) {
return array('PluginServicesService'.MassiveAction::CLASS_ACTION_SEPARATOR.'plugin_services_add_item' =>
- __('Associate a ITIL Service', 'ITIL Services'));
+ __('Associate a TC Service', 'TC Services'));
}
return array();
}
/*
function plugin_services_MassiveActionsDisplay($options=array()) {
-
$web = new PluginServicesService();
-
if (in_array($options['itemtype'], PluginServicesService::getTypes(true))) {
$web->dropdownWebApplications("plugin_services_services_id");
echo "";
}
return "";
}
-
-
function plugin_services_MassiveActionsProcess($data) {
$web_item = new PluginServicesService_Item();
@@ -396,7 +387,6 @@ function plugin_services_MassiveActionsProcess($data) {
$res = array('ok' => 0,
'ko' => 0,
'noright' => 0);
-
switch ($data['action']) {
case "plugin_services_add_item":
foreach ($data["item"] as $key => $val) {
diff --git a/inc/menu.class.php b/inc/menu.class.php
index f89c2f6..99847c1 100644
--- a/inc/menu.class.php
+++ b/inc/menu.class.php
@@ -1,65 +1,68 @@
.
+ along with services. If not, see .
--------------------------------------------------------------------------
*/
-// ----------------------------------------------------------------------
-// Original Author of file:
-// Purpose of file:
-// ----------------------------------------------------------------------
-
-
+/**
+ * Class PluginServicesMenu
+ */
class PluginServicesMenu extends CommonGLPI {
static $rightname = 'plugin_services';
+ /**
+ * @return translated
+ */
static function getMenuName() {
- return _n('ITIL Service', 'ITIL Services', 2, 'services');
+ return _n('TC Service', 'TC Services', 2, 'services');
}
+ /**
+ * @return array
+ */
static function getMenuContent() {
- global $CFG_GLPI;
- $menu = array();
- $menu['title'] = self::getMenuName();
- $menu['page'] = "/plugins/services/front/service.php";
- $menu['links']['search'] = PluginServicesService::getSearchURL(false);
+ $menu = [];
+ $menu['title'] = self::getMenuName();
+ $menu['page'] = "/plugins/services/front/service.php";
+ $menu['links']['search'] = PluginServicesService::getSearchURL(false);
if (PluginServicesService::canCreate()) {
- $menu['links']['add'] = PluginServicesService::getFormURL(false);
+ $menu['links']['add'] = PluginServicesService::getFormURL(false);
}
return $menu;
}
static function removeRightsFromSession() {
- if (isset($_SESSION['glpimenu']['tools']['types']['PluginServicesMenu'])) {
- unset($_SESSION['glpimenu']['tools']['types']['PluginServicesMenu']);
+ if (isset($_SESSION['glpimenu']['plugins']['types']['PluginServicesMenu'])) {
+ unset($_SESSION['glpimenu']['plugins']['types']['PluginServicesMenu']);
}
- if (isset($_SESSION['glpimenu']['tools']['content']['pluginservicesmenu'])) {
- unset($_SESSION['glpimenu']['tools']['content']['pluginservicesmenu']);
+ if (isset($_SESSION['glpimenu']['plugins']['content']['pluginservicesmenu'])) {
+ unset($_SESSION['glpimenu']['plugins']['content']['pluginservicesmenu']);
}
}
-}
\ No newline at end of file
+}
diff --git a/inc/profile.class.php b/inc/profile.class.php
index 619b0df..8b4dfdb 100644
--- a/inc/profile.class.php
+++ b/inc/profile.class.php
@@ -2,28 +2,28 @@
/*
* @version $Id: HEADER 15930 2011-10-30 15:47:55Z tsmr $
-------------------------------------------------------------------------
- Services plugin for GLPI
- Copyright (C) 2003-2011 by the Services Development Team.
+ webapplications plugin for GLPI
+ Copyright (C) 2009-2016 by the webapplications Development Team.
- https://forge.indepnet.net/projects/services
+ https://github.com/InfotelGLPI/services
-------------------------------------------------------------------------
LICENSE
-
- This file is part of Services.
- Services is free software; you can redistribute it and/or modify
+ This file is part of services.
+
+ services 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.
- Services is distributed in the hope that it will be useful,
+ services 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 Services. If not, see .
+ along with services. If not, see .
--------------------------------------------------------------------------
*/
@@ -31,55 +31,76 @@
die("Sorry. You can't access directly to this file");
}
+/**
+ * Class PluginServicesProfile
+ */
class PluginServicesProfile extends Profile {
static $rightname = "profile";
- function getTabNameForItem(CommonGLPI $item, $withtemplate=0) {
+ /**
+ * @param CommonGLPI $item
+ * @param int $withtemplate
+ *
+ * @return string|translated
+ */
+ function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) {
- if ($item->getType()=='Profile') {
- return PluginServicesService::getTypeName(2);
+ if ($item->getType() == 'Profile') {
+ return PluginServicesService::getTypeName(2);
}
return '';
}
- static function displayTabContentForItem(CommonGLPI $item, $tabnum=1, $withtemplate=0) {
- global $CFG_GLPI;
+ /**
+ * @param CommonGLPI $item
+ * @param int $tabnum
+ * @param int $withtemplate
+ *
+ * @return bool
+ */
+ static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0) {
- if ($item->getType()=='Profile') {
- $ID = $item->getID();
+ if ($item->getType() == 'Profile') {
+ $ID = $item->getID();
$prof = new self();
- self::addDefaultProfileInfos($ID,
- array('plugin_services' => 0,
- 'plugin_services_open_ticket' => 0));
+ self::addDefaultProfileInfos($ID,
+ ['plugin_services' => 0,
+ 'plugin_services_open_ticket' => 0]);
$prof->showForm($ID);
}
return true;
}
-
+
+ /**
+ * @param $ID
+ */
static function createFirstAccess($ID) {
//85
self::addDefaultProfileInfos($ID,
- array('plugin_services' => 127,
- 'plugin_services_open_ticket' => 1), true);
+ ['plugin_services' => 127,
+ 'plugin_services_open_ticket' => 1], true);
}
-
- /**
- * @param $profile
- **/
+
+ /**
+ * @param $profiles_id
+ * @param $rights
+ * @param bool $drop_existing
+ *
+ * @internal param $profile
+ */
static function addDefaultProfileInfos($profiles_id, $rights, $drop_existing = false) {
- global $DB;
-
+ $dbu = new DbUtils();
$profileRight = new ProfileRight();
foreach ($rights as $right => $value) {
- if (countElementsInTable('glpi_profilerights',
- "`profiles_id`='$profiles_id' AND `name`='$right'") && $drop_existing) {
- $profileRight->deleteByCriteria(array('profiles_id' => $profiles_id, 'name' => $right));
+ if ($dbu->countElementsInTable('glpi_profilerights',
+ ["profiles_id" => $profiles_id, "name" => $right]) && $drop_existing) {
+ $profileRight->deleteByCriteria(['profiles_id' => $profiles_id, 'name' => $right]);
}
- if (!countElementsInTable('glpi_profilerights',
- "`profiles_id`='$profiles_id' AND `name`='$right'")) {
+ if (!$dbu->countElementsInTable('glpi_profilerights',
+ ["profiles_id" => $profiles_id, "name" => $right])) {
$myright['profiles_id'] = $profiles_id;
$myright['name'] = $right;
$myright['rights'] = $value;
@@ -95,76 +116,87 @@ static function addDefaultProfileInfos($profiles_id, $rights, $drop_existing = f
/**
* Show profile form
*
- * @param $items_id integer id of the profile
- * @param $target value url of target
+ * @param int $profiles_id
+ * @param bool $openform
+ * @param bool $closeform
*
* @return nothing
- **/
- function showForm($profiles_id=0, $openform=TRUE, $closeform=TRUE) {
+ * @internal param int $items_id id of the profile
+ * @internal param value $target url of target
+ */
+ function showForm($profiles_id = 0, $openform = true, $closeform = true) {
echo "
";
- if (($canedit = Session::haveRightsOr(self::$rightname, array(CREATE, UPDATE, PURGE)))
+ if (($canedit = Session::haveRightsOr(self::$rightname, [CREATE, UPDATE, PURGE]))
&& $openform) {
$profile = new Profile();
- echo "