Skip to content

Commit 8caf70a

Browse files
committed
GLPI 9.5 compatibility
Added Export (via massive actions) and Import features Set version to 1.0.3
1 parent 3af694e commit 8caf70a

33 files changed

+7181
-1575
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ See : https://github.com/tomolimo/formvalidation/wiki
1414
See wiki pages https://github.com/tomolimo/formvalidation/wiki
1515

1616
## GLPI compatibility:
17-
Tested with 0.85, 0.90, 9.1, 9.2, 9.3 and 9.4
17+
Tested with 0.85, 0.90, 9.1, 9.2, 9.3, 9.4 and 9.5
1818

ajax/getFormValidations.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444

4545
$is_createitem = 0; // by default
4646

47-
$obj = getItemForItemtype( $_GET['name'] );
47+
$obj = getItemForItemtype( $_GET['itemtype'] );
4848
if ($obj && method_exists($obj, 'getType')) {
4949
if ($_GET['id'] > 0) {
5050
$obj->getFromDB( $_GET['id'] );

ajax/getLocales.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,10 @@
5050
}
5151

5252
// JSON encode all strings that are needed in formvalidation.js
53-
$localization = [
54-
// 'job' => array( 44 => "LANG['job'][44]" ),
55-
// 'common' => array( 17 => "LANG['common'][17]",
56-
// 36 => "LANG['common'][36]")
57-
];
53+
$localization = [];
5854

5955
// add plugin own language strings to $localization
6056
$localization['plugin_formvalidation'] = $LANG['plugin_formvalidation'];
6157

62-
echo json_encode( $localization, JSON_HEX_APOS | JSON_HEX_QUOT );
58+
echo json_encode($localization, JSON_HEX_APOS | JSON_HEX_QUOT);
6359

formvalidation.xml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,14 @@
2424
<author>Olivier Moron </author>
2525
</authors>
2626
<versions>
27-
<version>
28-
<num>0.6.8</num>
29-
<compatibility>9.4</compatibility>
30-
</version>
27+
<version>
28+
<num>1.0.3</num>
29+
<compatibility>9.5</compatibility>
30+
</version>
31+
<version>
32+
<num>0.6.8</num>
33+
<compatibility>9.4</compatibility>
34+
</version>
3135
<version>
3236
<num>0.5.1</num>
3337
<compatibility>9.3</compatibility>

front/config.form.php

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
<?php
2-
3-
include ("../../../inc/includes.php");
4-
// No autoload when plugin is not activated
5-
//require_once('../inc/config.class.php');
6-
7-
$config = new PluginFormvalidationConfig();
8-
if (isset($_REQUEST["update"])) {
9-
$config->check($_REQUEST['id'], UPDATE);
10-
$config->update($_REQUEST);
11-
12-
Html::back();
13-
}
14-
Html::redirect($CFG_GLPI["root_doc"]."/front/config.form.php?forcetab=".
15-
urlencode('PluginFormvalidationConfig$1'));
2+
3+
include ("../../../inc/includes.php");
4+
5+
$config = new PluginFormvalidationConfig();
6+
if (isset($_REQUEST["update"])) {
7+
$config->check($_REQUEST['id'], UPDATE);
8+
$config->update($_REQUEST);
9+
10+
Html::back();
11+
}
12+
Html::redirect($CFG_GLPI["root_doc"]."/front/config.form.php?forcetab=".
13+
urlencode('PluginFormvalidationConfig$1'));

front/form.form.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,6 @@
4848
$form->check($_POST["id"], PURGE);
4949
$form->delete($_POST, 1);
5050

51-
//Event::log($_POST["id"], "change", 4, "maintain",
52-
// //TRANS: %s is the user login
53-
// sprintf(__('%s purges an item'), $_SESSION["glpiname"]));
5451
$form->redirectToList();
5552

5653
} else if (isset($_POST["update"])) {
@@ -59,9 +56,6 @@
5956
$_POST["formula"] = Html::entity_decode_deep( $_POST["formula"] );
6057

6158
$form->update($_POST);
62-
//Event::log($_POST["id"], "change", 4, "maintain",
63-
// //TRANS: %s is the user login
64-
// sprintf(__('%s updates an item'), $_SESSION["glpiname"]));
6559

6660
Html::back();
6761

front/form.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
Html::header(__('Form Validations', 'formvalidation'), $_SERVER['PHP_SELF'], "config", "PluginFormvalidationMenu", "formvalidationform");
66

77
if (Session::haveRight('config', READ) || Session::haveRight("config", UPDATE)) {
8-
//$process=new PluginFormvalidationForm();
98

109
Search::show('PluginFormvalidationForm');
1110

front/formvalidation.backup.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
switch ($action) {
2020
case 'export':
2121
if (isset($_GET['filename'])) {
22-
$file = "../../../files/_tmp/".$_GET['filename'];
22+
$file = GLPI_TMP_DIR."/".$_GET['filename'];
2323
if (file_exists($file)) {
2424
header('Content-type: application/json');
25-
header('Content-Disposition: attachment; filename="'.basename($file).'"');
25+
header('Content-Disposition: attachment; filename="'.$_GET['filename'].'"');
2626
readfile($file);
2727
}
2828
}

front/itemtype.form.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
22
include ('../../../inc/includes.php');
33

4-
$dropdown = new PluginFormvalidationItemtype();
5-
include (GLPI_ROOT . "/front/dropdown.common.form.php");
4+
$dropdown = new PluginFormvalidationItemtype();
5+
include (GLPI_ROOT . "/front/dropdown.common.form.php");

front/itemtype.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
include ('../../../inc/includes.php');
4-
5-
$dropdown = new PluginFormvalidationItemtype();
3+
include ('../../../inc/includes.php');
4+
5+
$dropdown = new PluginFormvalidationItemtype();
66
include (GLPI_ROOT . "/front/dropdown.common.php");

0 commit comments

Comments
 (0)