Skip to content

Commit e92ee90

Browse files
authored
Merge pull request #159 from tomolimo/4.0/bugfixes
Changed EOL to CRLF
2 parents eeac86f + 78ead76 commit e92ee90

36 files changed

Lines changed: 2016 additions & 2016 deletions
Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
1-
---
2-
name: Bug report
3-
about: Create a report to help us improve
4-
title: ''
5-
labels: ''
6-
assignees: ''
7-
8-
---
9-
10-
**Describe the bug**
11-
A clear and concise description of what the bug is.
12-
13-
**To Reproduce**
14-
Steps to reproduce the behavior:
15-
1. Go to '...'
16-
2. Click on '....'
17-
3. Scroll down to '....'
18-
4. See error
19-
20-
**Expected behavior**
21-
A clear and concise description of what you expected to happen.
22-
23-
**Screenshots**
24-
If applicable, add screenshots to help explain your problem.
25-
26-
**Desktop (please complete the following information):**
27-
- OS: [e.g. iOS]
28-
- Browser [e.g. chrome, safari]
29-
- Version [e.g. 22]
30-
31-
**Smartphone (please complete the following information):**
32-
- Device: [e.g. iPhone6]
33-
- OS: [e.g. iOS8.1]
34-
- Browser [e.g. stock browser, safari]
35-
- Version [e.g. 22]
36-
37-
**Additional context**
38-
Add any other context about the problem here.
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior:
15+
1. Go to '...'
16+
2. Click on '....'
17+
3. Scroll down to '....'
18+
4. See error
19+
20+
**Expected behavior**
21+
A clear and concise description of what you expected to happen.
22+
23+
**Screenshots**
24+
If applicable, add screenshots to help explain your problem.
25+
26+
**Desktop (please complete the following information):**
27+
- OS: [e.g. iOS]
28+
- Browser [e.g. chrome, safari]
29+
- Version [e.g. 22]
30+
31+
**Smartphone (please complete the following information):**
32+
- Device: [e.g. iPhone6]
33+
- OS: [e.g. iOS8.1]
34+
- Browser [e.g. stock browser, safari]
35+
- Version [e.g. 22]
36+
37+
**Additional context**
38+
Add any other context about the problem here.
Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
---
2-
name: Feature request
3-
about: Suggest an idea for this project
4-
title: ''
5-
labels: ''
6-
assignees: ''
7-
8-
---
9-
10-
**Is your feature request related to a problem? Please describe.**
11-
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12-
13-
**Describe the solution you'd like**
14-
A clear and concise description of what you want to happen.
15-
16-
**Describe alternatives you've considered**
17-
A clear and concise description of any alternative solutions or features you've considered.
18-
19-
**Additional context**
20-
Add any other context or screenshots about the feature request here.
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
Add any other context or screenshots about the feature request here.

ajax/asynchronousdatas.php

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,47 @@
1-
<?php
2-
if (strpos($_SERVER['PHP_SELF'], "asynchronousdatas.php")) {
3-
$AJAX_INCLUDE = 1;
4-
define('GLPI_ROOT', '../../..');
5-
include (GLPI_ROOT."/inc/includes.php");
6-
Html::header_nocache();
7-
}
8-
9-
if (!defined('GLPI_ROOT')) {
10-
die("Can not access directly to this file");
11-
}
12-
13-
include_once dirname(__FILE__)."/../inc/crontaskaction.class.php";
14-
if (isset( $_SERVER['REQUEST_METHOD'] ) && $_SERVER['REQUEST_METHOD']=='OPTIONS') {
15-
header("Access-Control-Allow-Origin: *");
16-
header("Access-Control-Allow-Methods: POST");
17-
header("Access-Control-Allow-Headers: Content-Type");
18-
} else {
19-
header("Access-Control-Allow-Origin: *");
20-
header("Content-Type: application/json; charset=UTF-8");
21-
22-
if (isset($_SERVER['REQUEST_METHOD'])) {
23-
switch ($_SERVER['REQUEST_METHOD']) {
24-
case 'POST' :
25-
$request_body = file_get_contents('php://input');
26-
$datas = json_decode($request_body, true);
27-
28-
$asyncdata = new PluginProcessmakerCrontaskaction;
29-
if (isset($datas['id']) && $asyncdata->getFromDB( $datas['id'] ) && $asyncdata->fields['state'] == PluginProcessmakerCrontaskaction::WAITING_DATA) {
30-
$initialdatas = json_decode($asyncdata->fields['postdata'], true);
31-
$initialdatas['form'] = array_merge( $initialdatas['form'], $datas['form'] );
32-
$postdata = json_encode($initialdatas, JSON_HEX_APOS | JSON_HEX_QUOT | JSON_UNESCAPED_UNICODE);
33-
$asyncdata->update( [ 'id' => $datas['id'], 'state' => PluginProcessmakerCrontaskaction::DATA_READY, 'postdata' => $postdata ] );
34-
$ret = [ 'code' => '0', 'message' => 'Done' ];
35-
} else {
36-
$ret = [ 'code' => '2', 'message' => 'Case is not existing, or state is not WAITING_DATA' ];
37-
}
38-
39-
break;
40-
default:
41-
$ret = [ 'code' => '1', 'message' => 'Method '.$_SERVER['REQUEST_METHOD'].' not supported' ];
42-
}
43-
44-
echo json_encode( $ret, JSON_HEX_APOS | JSON_HEX_QUOT );
45-
46-
}
47-
}
1+
<?php
2+
if (strpos($_SERVER['PHP_SELF'], "asynchronousdatas.php")) {
3+
$AJAX_INCLUDE = 1;
4+
define('GLPI_ROOT', '../../..');
5+
include (GLPI_ROOT."/inc/includes.php");
6+
Html::header_nocache();
7+
}
8+
9+
if (!defined('GLPI_ROOT')) {
10+
die("Can not access directly to this file");
11+
}
12+
13+
include_once dirname(__FILE__)."/../inc/crontaskaction.class.php";
14+
if (isset( $_SERVER['REQUEST_METHOD'] ) && $_SERVER['REQUEST_METHOD']=='OPTIONS') {
15+
header("Access-Control-Allow-Origin: *");
16+
header("Access-Control-Allow-Methods: POST");
17+
header("Access-Control-Allow-Headers: Content-Type");
18+
} else {
19+
header("Access-Control-Allow-Origin: *");
20+
header("Content-Type: application/json; charset=UTF-8");
21+
22+
if (isset($_SERVER['REQUEST_METHOD'])) {
23+
switch ($_SERVER['REQUEST_METHOD']) {
24+
case 'POST' :
25+
$request_body = file_get_contents('php://input');
26+
$datas = json_decode($request_body, true);
27+
28+
$asyncdata = new PluginProcessmakerCrontaskaction;
29+
if (isset($datas['id']) && $asyncdata->getFromDB( $datas['id'] ) && $asyncdata->fields['state'] == PluginProcessmakerCrontaskaction::WAITING_DATA) {
30+
$initialdatas = json_decode($asyncdata->fields['postdata'], true);
31+
$initialdatas['form'] = array_merge( $initialdatas['form'], $datas['form'] );
32+
$postdata = json_encode($initialdatas, JSON_HEX_APOS | JSON_HEX_QUOT | JSON_UNESCAPED_UNICODE);
33+
$asyncdata->update( [ 'id' => $datas['id'], 'state' => PluginProcessmakerCrontaskaction::DATA_READY, 'postdata' => $postdata ] );
34+
$ret = [ 'code' => '0', 'message' => 'Done' ];
35+
} else {
36+
$ret = [ 'code' => '2', 'message' => 'Case is not existing, or state is not WAITING_DATA' ];
37+
}
38+
39+
break;
40+
default:
41+
$ret = [ 'code' => '1', 'message' => 'Method '.$_SERVER['REQUEST_METHOD'].' not supported' ];
42+
}
43+
44+
echo json_encode( $ret, JSON_HEX_APOS | JSON_HEX_QUOT );
45+
46+
}
47+
}

ajax/dropdownProcesses.php

Lines changed: 89 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,89 @@
1-
<?php
2-
3-
// ----------------------------------------------------------------------
4-
// Original Author of file: Olivier Moron
5-
// Purpose of file: to return list of processes which can be started by end-user
6-
// ----------------------------------------------------------------------
7-
8-
// Direct access to file
9-
if (strpos($_SERVER['PHP_SELF'], "dropdownProcesses.php")) {
10-
include ("../../../inc/includes.php");
11-
header("Content-Type: text/html; charset=UTF-8");
12-
Html::header_nocache();
13-
}
14-
15-
if (!defined('GLPI_ROOT')) {
16-
die("Can not access directly to this file");
17-
}
18-
19-
20-
Session::checkLoginUser();
21-
22-
if (isset($_REQUEST["entity_restrict"])
23-
&& !is_array($_REQUEST["entity_restrict"])
24-
&& (substr($_REQUEST["entity_restrict"], 0, 1) === '[')
25-
&& (substr($_REQUEST["entity_restrict"], -1) === ']')) {
26-
$_REQUEST["entity_restrict"] = json_decode($_REQUEST["entity_restrict"]);
27-
$_REQUEST["entity_restrict"] = $_REQUEST["entity_restrict"][0];
28-
}
29-
30-
// Security
31-
if (!($item = getItemForItemtype($_REQUEST['itemtype']))) {
32-
exit();
33-
}
34-
35-
$one_item = -1;
36-
if (isset($_POST['_one_id'])) {
37-
$one_item = $_POST['_one_id'];
38-
}
39-
// Count real items returned
40-
$count = 0;
41-
42-
if (!isset($_REQUEST['emptylabel']) || ($_REQUEST['emptylabel'] == '')) {
43-
$_REQUEST['emptylabel'] = Dropdown::EMPTY_VALUE;
44-
}
45-
46-
$search="";
47-
if (!empty($_REQUEST['searchText'])) {
48-
$search = ['LIKE', Search::makeTextSearchValue($_REQUEST['searchText'])];
49-
}
50-
51-
$processes = [];
52-
53-
// Empty search text : display first
54-
if (empty($_REQUEST['searchText'])) {
55-
if ($_REQUEST['display_emptychoice']) {
56-
if (($one_item < 0) || ($one_item == 0)) {
57-
array_push($processes, ['id' => 0,
58-
'text' => $_REQUEST['emptylabel']]);
59-
}
60-
}
61-
}
62-
63-
$processall = (isset($_REQUEST['specific_tags']['process_restrict']) && !$_REQUEST['specific_tags']['process_restrict']);
64-
$count_cases_per_item = isset($_REQUEST['specific_tags']['count_cases_per_item']) ? $_REQUEST['specific_tags']['count_cases_per_item'] : [];
65-
66-
$result = PluginProcessmakerProcess::getSqlSearchResult(false, $search);
67-
68-
//if ($DB->numrows($result)) {
69-
// while ($data = $DB->fetch_array($result)) {
70-
//if ($result->numrows()) {
71-
foreach ($result as $data) {
72-
$process_entities = PluginProcessmakerProcess::getEntitiesForProfileByProcess($data["id"], $_SESSION['glpiactiveprofile']['id'], true);
73-
$can_add = $data['max_cases_per_item'] == 0 || !isset($count_cases_per_item[$data["id"]]) || $count_cases_per_item[$data["id"]] < $data['max_cases_per_item'];
74-
if ($processall
75-
|| ($data['maintenance'] != 1
76-
&& in_array( $_REQUEST["entity_restrict"], $process_entities)
77-
&& $can_add) ) {
78-
79-
array_push( $processes, ['id' => $data["id"],
80-
'text' => $data["name"]
81-
]);
82-
$count++;
83-
}
84-
}
85-
//}
86-
87-
$ret['results'] = $processes;
88-
$ret['count'] = $count;
89-
echo json_encode($ret);
1+
<?php
2+
3+
// ----------------------------------------------------------------------
4+
// Original Author of file: Olivier Moron
5+
// Purpose of file: to return list of processes which can be started by end-user
6+
// ----------------------------------------------------------------------
7+
8+
// Direct access to file
9+
if (strpos($_SERVER['PHP_SELF'], "dropdownProcesses.php")) {
10+
include ("../../../inc/includes.php");
11+
header("Content-Type: text/html; charset=UTF-8");
12+
Html::header_nocache();
13+
}
14+
15+
if (!defined('GLPI_ROOT')) {
16+
die("Can not access directly to this file");
17+
}
18+
19+
20+
Session::checkLoginUser();
21+
22+
if (isset($_REQUEST["entity_restrict"])
23+
&& !is_array($_REQUEST["entity_restrict"])
24+
&& (substr($_REQUEST["entity_restrict"], 0, 1) === '[')
25+
&& (substr($_REQUEST["entity_restrict"], -1) === ']')) {
26+
$_REQUEST["entity_restrict"] = json_decode($_REQUEST["entity_restrict"]);
27+
$_REQUEST["entity_restrict"] = $_REQUEST["entity_restrict"][0];
28+
}
29+
30+
// Security
31+
if (!($item = getItemForItemtype($_REQUEST['itemtype']))) {
32+
exit();
33+
}
34+
35+
$one_item = -1;
36+
if (isset($_POST['_one_id'])) {
37+
$one_item = $_POST['_one_id'];
38+
}
39+
// Count real items returned
40+
$count = 0;
41+
42+
if (!isset($_REQUEST['emptylabel']) || ($_REQUEST['emptylabel'] == '')) {
43+
$_REQUEST['emptylabel'] = Dropdown::EMPTY_VALUE;
44+
}
45+
46+
$search="";
47+
if (!empty($_REQUEST['searchText'])) {
48+
$search = ['LIKE', Search::makeTextSearchValue($_REQUEST['searchText'])];
49+
}
50+
51+
$processes = [];
52+
53+
// Empty search text : display first
54+
if (empty($_REQUEST['searchText'])) {
55+
if ($_REQUEST['display_emptychoice']) {
56+
if (($one_item < 0) || ($one_item == 0)) {
57+
array_push($processes, ['id' => 0,
58+
'text' => $_REQUEST['emptylabel']]);
59+
}
60+
}
61+
}
62+
63+
$processall = (isset($_REQUEST['specific_tags']['process_restrict']) && !$_REQUEST['specific_tags']['process_restrict']);
64+
$count_cases_per_item = isset($_REQUEST['specific_tags']['count_cases_per_item']) ? $_REQUEST['specific_tags']['count_cases_per_item'] : [];
65+
66+
$result = PluginProcessmakerProcess::getSqlSearchResult(false, $search);
67+
68+
//if ($DB->numrows($result)) {
69+
// while ($data = $DB->fetch_array($result)) {
70+
//if ($result->numrows()) {
71+
foreach ($result as $data) {
72+
$process_entities = PluginProcessmakerProcess::getEntitiesForProfileByProcess($data["id"], $_SESSION['glpiactiveprofile']['id'], true);
73+
$can_add = $data['max_cases_per_item'] == 0 || !isset($count_cases_per_item[$data["id"]]) || $count_cases_per_item[$data["id"]] < $data['max_cases_per_item'];
74+
if ($processall
75+
|| ($data['maintenance'] != 1
76+
&& in_array( $_REQUEST["entity_restrict"], $process_entities)
77+
&& $can_add) ) {
78+
79+
array_push( $processes, ['id' => $data["id"],
80+
'text' => $data["name"]
81+
]);
82+
$count++;
83+
}
84+
}
85+
//}
86+
87+
$ret['results'] = $processes;
88+
$ret['count'] = $count;
89+
echo json_encode($ret);

0 commit comments

Comments
 (0)