Skip to content

Commit

Permalink
V 1.0.1 sql install correct
Browse files Browse the repository at this point in the history
- Correct install sql path
- Correct hook support error
  • Loading branch information
bacus99 committed Feb 23, 2017
1 parent 420e4ca commit 642915e
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 18 deletions.
87 changes: 77 additions & 10 deletions hook.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function plugin_services_install() {
$update = false;
if (TableExists("glpi_plugin_services_services")){

$DB->runFile(GLPI_ROOT ."/plugins/services/sql/empty-2.0.0.sql");
$DB->runFile(GLPI_ROOT ."/plugins/services/sql/empty-1.0.0.sql");

} /* else {
Expand Down Expand Up @@ -128,7 +128,7 @@ function plugin_services_uninstall() {
$tables = array("glpi_plugin_services_services",
"glpi_plugin_services_servicetypes",
"glpi_plugin_services_servicesupports",
//"glpi_plugin_services_serviceservertypes",
"glpi_plugin_services_serviceservertypes",
"glpi_plugin_services_servicetiers",
"glpi_plugin_services_services_items");

Expand Down Expand Up @@ -166,7 +166,7 @@ function plugin_services_uninstall() {
}


// Define dropdown relations
/* // Define dropdown relations
function plugin_services_getDatabaseRelations() {
$plugin = new Plugin();
Expand All @@ -178,9 +178,9 @@ function plugin_services_getDatabaseRelations() {
"glpi_plugin_services_servicesupports"
=> array("glpi_plugin_services_services"
=> "plugin_services_servicesupports_id"),
/* "glpi_plugin_services_serviceservertypes"
"glpi_plugin_services_serviceservertypes"
=> array("glpi_plugin_services_services"
=>"plugin_services_serviceservertypes_id"), */
=>"plugin_services_serviceservertypes_id"),
"glpi_plugin_services_servicetiers"
=> array("glpi_plugin_services_services"
=>"plugin_services_servicetiers_id"),
Expand All @@ -203,8 +203,41 @@ function plugin_services_getDatabaseRelations() {
"glpi_plugin_services_servicesupports" => "entities_id"));
}
return array();
}
} */
// Define dropdown relations
function plugin_services_getDatabaseRelations() {

$plugin = new Plugin();

if ($plugin->isActivated("services")) {
return array("glpi_plugin_services_servicetypes"
=> array("glpi_plugin_services_services"
=> "plugin_services_servicetypes_id"),
"glpi_plugin_services_serviceservertypes"
=> array("glpi_plugin_services_services"
=>"plugin_services_serviceservertypes_id"),
"glpi_plugin_services_servicetechnics"
=> array("glpi_plugin_services_services"
=>"plugin_services_servicetechnics_id"),
"glpi_users"
=> array("glpi_plugin_services_services" => "users_id_tech"),
"glpi_groups"
=> array("glpi_plugin_services_services" => "groups_id_tech"),
"glpi_suppliers"
=> array("glpi_plugin_services_services" => "suppliers_id"),
"glpi_manufacturers"
=> array("glpi_plugin_services_services" => "manufacturers_id"),
"glpi_locations"
=> array("glpi_plugin_services_services" => "locations_id"),
"glpi_plugin_services_services"
=> array("glpi_plugin_services_services_items"
=> "plugin_services_services_id"),
"glpi_entities"
=> array("glpi_plugin_services_services" => "entities_id",
"glpi_plugin_services_servicetypes" => "entities_id"));
}
return array();
}

// Define Dropdown tables to be manage in GLPI :
function plugin_services_getDropdown() {
Expand Down Expand Up @@ -240,6 +273,40 @@ function plugin_services_getAddSearchOptions($itemtype) {

$sopt = array();

if (in_array($itemtype, PluginServicesService::getTypes(true))) {

if (Session::haveRight("plugin_services", READ)) {
$sopt[1310]['table'] = 'glpi_plugin_services_services';
$sopt[1310]['field'] = 'name';
$sopt[1310]['name'] = PluginServicesService::getTypeName(2)." - ".
__('Name');
$sopt[1310]['forcegroupby'] = true;
$sopt[1310]['datatype'] = 'itemlink';
$sopt[1310]['massiveaction'] = false;
$sopt[1310]['itemlink_type'] = 'PluginServicesService';
$sopt[1310]['joinparams'] = array('beforejoin'
=> array('table' => 'glpi_plugin_services_services_items',
'joinparams' => array('jointype' => 'itemtype_item')));

$sopt[1311]['table'] = 'glpi_plugin_services_servicetypes';
$sopt[1311]['field'] = 'name';
$sopt[1311]['name'] = PluginServicesService::getTypeName(2)." - ".
PluginServicesServiceType::getTypeName(1);
$sopt[1311]['forcegroupby'] = true;
$sopt[1311]['datatype'] = 'dropdown';
$sopt[1311]['massiveaction'] = false;
$sopt[1311]['joinparams'] = array('beforejoin' => array(
array('table' => 'glpi_plugin_services_services',
'joinparams' => $sopt[1310]['joinparams'])));
}
}

return $sopt;
}
/* function plugin_services_getAddSearchOptions($itemtype) {
$sopt = array();
if (in_array($itemtype, PluginServicesService::getTypes(true))) {
if (Session::haveRight("plugin_services", READ)) {
Expand All @@ -264,20 +331,20 @@ function plugin_services_getAddSearchOptions($itemtype) {
array('table' => 'glpi_plugin_services_services',
'joinparams' => $sopt[1310]['joinparams'])));
$sopt[1312]['table'] = 'glpi_plugin_services_servicesupport';
/* $sopt[1312]['table'] = 'glpi_plugin_services_servicesupports';
$sopt[1312]['field'] = 'name';
$sopt[1312]['name'] = PluginServicesService::getTypeName(2)." - ". PluginServicesServiceSupport::getTypeName(1);
$sopt[1312]['forcegroupby'] = true;
$sopt[1312]['datatype'] = 'dropdown';
$sopt[1312]['massiveaction'] = false;
$sopt[1312]['joinparams'] = array('beforejoin' => array(
array('table' => 'glpi_plugin_services_services',
'joinparams' => $sopt[1310]['joinparams'])));
}
'joinparams' => $sopt[1310]['joinparams']))); */
/* }
}
return $sopt;
}
} */

//display custom fields in the search
function plugin_services_giveItem($type, $ID, $data, $num) {
Expand Down
4 changes: 2 additions & 2 deletions inc/service.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ function getSearchOptions() {
$tab[115]['datatype'] = 'dropdown';
$tab[115]['right'] = 'interface';

// Service Support time
// Service support time
$tab[120]['table'] = 'glpi_plugin_services_servicesupports';
$tab[120]['field'] = 'name';
$tab[120]['name'] = PluginServicesServiceSupport::getTypeName(1);
Expand Down Expand Up @@ -363,7 +363,7 @@ function showForm($ID, $options=array()) {
Html::autocompletionTextField($this,"name");
echo "</td>";

//support of services
//time of services
echo "<td>".PluginServicesServiceSupport::getTypeName(1)."</td>";
echo "<td>";
Dropdown::show('PluginServicesServiceSupport',
Expand Down
4 changes: 2 additions & 2 deletions inc/service_item.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -888,7 +888,7 @@ static function PdfFromItems(PluginPdfSimplePDF $pdf, CommonGLPI $item){
}
}

static function displayTabContentForPDF(PluginPdfSimplePDF $pdf, CommonGLPI $item, $tab) {
/* static function displayTabContentForPDF(PluginPdfSimplePDF $pdf, CommonGLPI $item, $tab) {
if ($item->getType()=='PluginServicesService') {
self::ItemsPdf($pdf, $item);
Expand All @@ -898,7 +898,7 @@ static function displayTabContentForPDF(PluginPdfSimplePDF $pdf, CommonGLPI $ite
return false;
}
return true;
}
} */

}
?>
4 changes: 2 additions & 2 deletions inc/servicesupport.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class PluginServicesServiceSupport extends CommonDropdown {

static function getTypeName($nb=0) {

return _n('Support Period','Support Periods',$nb, 'services');
return _n('Support Period','Support Periods',$nb, 'Support Periods');
}

static function transfer($ID, $entity) {
Expand All @@ -49,7 +49,7 @@ static function transfer($ID, $entity) {
// Not already transfer
// Search init item
$query = "SELECT *
FROM `glpi_plugin_services_servicesupport`
FROM `glpi_plugin_services_servicesupports`
WHERE `id` = '$ID'";

if ($result=$DB->query($query)) {
Expand Down
2 changes: 1 addition & 1 deletion services.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ This plugin allow adding informations to services based on ITIL concepts (DR, Ow
</authors>
<versions>
<version>
<num>1.0.0</num>
<num>1.0.1</num>
<compatibility>0.85</compatibility>
<compatibility>0.90</compatibility>
<compatibility>9.1</compatibility>
Expand Down
2 changes: 1 addition & 1 deletion setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function plugin_init_services() {
function plugin_version_services() {

return array('name' => _n('ITIL Service' , 'ITIL Services' ,2, 'services'),
'version' => '1.0.0',
'version' => '1.0.1',
'license' => 'GPLv2+',
'author' => "Christian Bernard, based on WebApplications plugin",
'minGlpiVersion' => '9.1');
Expand Down

0 comments on commit 642915e

Please sign in to comment.