Skip to content

Commit 8e6c1b8

Browse files
committed
Fix links with GLPI
Bump version
1 parent 6154894 commit 8e6c1b8

File tree

6 files changed

+23
-6
lines changed

6 files changed

+23
-6
lines changed

hook.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,8 @@ function plugin_manageentities_install()
323323
}
324324
}
325325

326+
$DB->runFile(PLUGIN_MANAGEENTITIES_DIR . "/install/sql/update-4.1.4.sql");
327+
326328
$rep_files_manageentities = GLPI_PLUGIN_DOC_DIR . "/manageentities";
327329
if (!is_dir($rep_files_manageentities)) {
328330
mkdir($rep_files_manageentities);

install/sql/update-4.1.3.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
UPDATE `glpi_displaypreferences` SET `itemtype` = 'GlpiPlugin\\Manageentities\\Directhelpdesk' WHERE `glpi_displaypreferences`.`itemtype` = 'PluginManageentitiesDirecthelpdesk';
2+
UPDATE `glpi_displaypreferences` SET `itemtype` = 'GlpiPlugin\\Manageentities\\Contractday' WHERE `glpi_displaypreferences`.`itemtype` = 'PluginManageentitiesContractday';
3+
UPDATE `glpi_displaypreferences` SET `itemtype` = 'GlpiPlugin\\Manageentities\\CriType' WHERE `glpi_displaypreferences`.`itemtype` = 'PluginManageentitiesCriType';

install/sql/update-4.1.4.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
UPDATE `glpi_documents_items` SET `itemtype` = 'GlpiPlugin\\Manageentities\\Company' WHERE `itemtype` = 'PluginManageentitiesCompany';

manageentities.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@
2121
<author>Infotel</author>
2222
</authors>
2323
<versions>
24+
<version>
25+
<num>4.1.4</num>
26+
<compatibility>~11.0</compatibility>
27+
<download_url>https://github.com/InfotelGLPI/manageentities/releases/download/4.1.4/glpi-manageentities-4.1.4.tar.bz2</download_url>
28+
</version>
2429
<version>
2530
<num>4.1.3</num>
2631
<compatibility>~11.0</compatibility>

setup.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
--------------------------------------------------------------------------
2828
*/
2929

30-
define('PLUGIN_MANAGEENTITIES_VERSION', '4.1.3');
30+
define('PLUGIN_MANAGEENTITIES_VERSION', '4.1.4');
3131

3232
global $CFG_GLPI;
3333

@@ -173,9 +173,12 @@ function plugin_init_manageentities()
173173
// $PLUGIN_HOOKS[Hooks::ADD_JAVASCRIPT]['manageentities'][] = 'scripts/manageentities_load_scripts.js';
174174
// }
175175
$PLUGIN_HOOKS['post_init']['manageentities'] = 'plugin_manageentities_postinit';
176-
177-
$PLUGIN_HOOKS[Hooks::PRE_ITEM_FORM]['manageentities'] = [Contract::class, 'preItemForm'];
178-
$PLUGIN_HOOKS[Hooks::PRE_ITEM_LIST]['manageentities'] = [Contract::class, 'preItemForm'];
176+
if (Session::haveRightsOr('plugin_manageentities', [READ, UPDATE])
177+
&& isset($_SESSION['glpiactiveprofile']['interface'])
178+
&& $_SESSION['glpiactiveprofile']['interface'] == 'central') {
179+
$PLUGIN_HOOKS[Hooks::PRE_ITEM_FORM]['manageentities'] = [Contract::class, 'preItemForm'];
180+
$PLUGIN_HOOKS[Hooks::PRE_ITEM_LIST]['manageentities'] = [Contract::class, 'preItemForm'];
181+
}
179182
}
180183
}
181184

src/Contract.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,8 @@ function displayAlertforEntity($instID)
497497
],
498498
'WHERE' => [
499499
'glpi_contracts.is_deleted' => 0,
500-
$this->getTable() . '.entities_id' => $instID
500+
'NOT' => [$this->getTable() . '.date_signature' => null],
501+
'glpi_contracts.entities_id' => $instID
501502
],
502503
'ORDERBY' => [
503504
'glpi_contracts.begin_date',
@@ -766,7 +767,9 @@ static public function preItemForm($params)
766767
$entities_id = $item->fields['entities_id'];
767768
}
768769
$out = "";
769-
if (isset($entities_id)) {
770+
if (isset($entities_id)
771+
&& $_SESSION['glpiactiveprofile']['interface'] == 'central'
772+
&& Session::haveRight('plugin_manageentities', UPDATE)) {
770773
// $sons = getSonsOf("glpi_entities", $entities_id);
771774
// if (count($sons) > 1) {
772775
// return false;

0 commit comments

Comments
 (0)