Skip to content
This repository was archived by the owner on Aug 9, 2021. It is now read-only.

Commit dc7d2ce

Browse files
authored
Merge branch 'develop' into feature/402_simcard_pin
2 parents 5335b58 + 26c0dcc commit dc7d2ce

File tree

7 files changed

+74
-36
lines changed

7 files changed

+74
-36
lines changed

.travis.yml

+8-7
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ env:
88
- FI_SOURCE="https://github.com/fusioninventory/fusioninventory-for-glpi"
99
- CS=7.2
1010
- DBNAME=glpitest
11+
- AFTER_SUCCESS_BRANCH=9.3/bugfixes
1112
- secure: Y9sG3lZ3Fn3t5BXvcMJQxWsdSUVQgF4M08E6oouYrRc95HEj3ZwZOqp6Df58u8CQFA0EKJyvCBLn8UicvHGMKAD0RwGLBdSP4Ji9gJRZkyMZi79awSshdva/c8dqVQrRd4asuTNQfcagVJpNDnY8sYusw504JUilK3vFVp+39nNZUkcvT69NGVIlXzgHTYinBkVuqDhf5eVtcLcaESLEshrg+5ZERdm+0KifdJVREzhicJxofnmTl/wBsIP7XiQqspljf2/SxLqreGmWXYXUfqIwIOVtsd9fkZChQCz8USC7P427tH6styRDYuMCtvA9b/T/XacSdKFbuDezff3NbIM3b5BebDyCrOK5MGSOdRUY5RuyZN4R5LjePUE++9QNCUPeDSkfb23v0VfuqXIRAxfdtik517GzFy6O7/e6FU1msVZlGQED7Uek9nqnupj+0lIq+99Jcm1UCNJu1NTL2Tv80XXqySaxyE4Sedq/FiYAsy1bo2cg2367I2b4FhFXaJCKkFHcdjHXAeurkRy/brSPhBNoOO5/GA3RepUErgly4P8TLZqHNZv8rgMUoQ88sdwDyXG7dY4UwWiTlCkxMBTqBqJanlTMA9zn2bYyMDioTGnA7+VYAA8cddjFOMVrmmuFJ+YV2x1+5B5qd+Wt8RPwcPQDyqaiN5amb1HGeMA=
1213
matrix:
13-
- GLPI_BRANCH=9.2.1 FI_BRANCH=glpi9.2+1.0
14+
- GLPI_BRANCH=9.2.1 FI_BRANCH=glpi9.2+2.0
1415
- GLPI_BRANCH=9.2/bugfixes FI_BRANCH=glpi9.2+2.0
1516
- GLPI_BRANCH=9.3.0 FI_BRANCH=glpi9.3+1.0
1617
- GLPI_BRANCH=9.3/bugfixes FI_BRANCH=glpi9.3+1.0
@@ -33,17 +34,17 @@ before_install:
3334
before_script:
3435
- "./tests/before_script.sh"
3536
script:
37+
- if [ "${TRAVIS_PHP_VERSION:0:3}" = "$CS" ] && [ "$GLPI_BRANCH" = "$AFTER_SUCCESS_BRANCH" ]; then COVERAGE="--nccfc CommonTreeDropdown CommonDropdown CommonDBTM CommonGLPI"; else COVERAGE="-ncc"; fi
3638
- vendor/bin/atoum -ft -bf tests/bootstrap.php -d tests/suite-install -ncc
3739
- #php scripts/mqtt.php --tests > /dev/null 2>&1 &
38-
- vendor/bin/atoum -ft -bf tests/bootstrap.php -d tests/suite-unit --nccfc CommonTreeDropdown CommonDropdown CommonDBTM CommonGLPI
39-
- vendor/bin/atoum -ft -bf tests/bootstrap.php -d tests/suite-integration -mcn 1 --nccfc CommonTreeDropdown CommonDropdown CommonDBTM CommonGLPI
40+
- vendor/bin/atoum -ft -bf tests/bootstrap.php -d tests/suite-unit $COVERAGE
41+
- vendor/bin/atoum -ft -bf tests/bootstrap.php -d tests/suite-integration -mcn 1 $COVERAGE
4042
- vendor/bin/atoum -ft -bf tests/bootstrap.php -d tests/suite-uninstall -ncc
41-
- if [[ ${TRAVIS_PHP_VERSION:0:3} == "$CS" ]] && [ "$GLPI_BRANCH" = "9.3/bugfixes" ]; then vendor/bin/phpcs -p --standard=vendor/glpi-project/coding-standard/GlpiStandard/ *.php install/ inc/ front/ ajax/ tests/; fi
43+
- if [ ${TRAVIS_PHP_VERSION:0:3} == "$CS" ] && [ "$GLPI_BRANCH" = "$AFTER_SUCCESS_BRANCH" ]; then vendor/bin/phpcs -p --standard=vendor/glpi-project/coding-standard/GlpiStandard/ *.php install/ inc/ front/ ajax/ tests/; fi
4244

4345
after_success:
44-
# let's update the documentation
45-
- if [ ${TRAVIS_PHP_VERSION:0:3} == "$CS" ] && [ "$GLPI_BRANCH" = "9.2/bugfixes" ]; then tests/update_locales.sh; fi
46-
- if [ ${TRAVIS_PHP_VERSION:0:3} == "$CS" ] && [ "$GLPI_BRANCH" = "9.2/bugfixes" ]; then .github/push_ghpages.sh; fi
46+
# let's update the documentation and locales
47+
- if [ ${TRAVIS_PHP_VERSION:0:3} == "$CS" ] && [ "$GLPI_BRANCH" = "$AFTER_SUCCESS_BRANCH" ]; then tests/after_success.sh; fi
4748

4849
cache:
4950
directories:

inc/agent.class.php

+7-1
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,7 @@ public function getSearchOptionsNew() {
823823
'table' => $this->getTable(),
824824
'field' => 'mdm_type',
825825
'name' => __('MDM type', 'flyvemdm'),
826-
'datatype' => 'bool',
826+
'datatype' => 'specific',
827827
'massiveaction' => false
828828
];
829829

@@ -1986,6 +1986,12 @@ public static function getSpecificValueToDisplay($field, $values, array $options
19861986
return $output;
19871987
}
19881988
break;
1989+
case 'mdm_type':
1990+
if (!isAPI()) {
1991+
$enumtypes = self::getEnumMdmType();
1992+
return $enumtypes[$values[$field]];
1993+
}
1994+
break;
19891995
}
19901996
return parent::getSpecificValueToDisplay($field, $values, $options);
19911997
}

install/upgrade/update_to_dev.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ function plugin_flyvemdm_update_to_dev(Migration $migration) {
178178
$migration->changeField($table, 'plugin_flyvemdm_fleets_id', 'items_id_applied', 'integer');
179179
$migration->dropKey($table, 'plugin_flyvemdm_fleets_id');
180180
$migration->addField($table, 'itemtype_applied', 'string', ['after' => 'id']);
181-
$migration->addKey($table, 'FK_applied', ['itemtype_applied', 'items_id_applied']);
181+
$migration->addKey($table, ['itemtype_applied', 'items_id_applied'], 'FK_applied');
182182
// All tasks already created were applied on fleets
183183
$migration->addPostQuery("UPDATE `$table` SET `itemtype_applied` = 'PluginFlyvemdmFleet'");
184184
$migration->executeMigration();

.github/push_ghpages.sh renamed to tests/after_success.sh

+22-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,27 @@
11
#!/bin/sh
2-
# please set the $GH_TOKEN in your travis dashboard
2+
#
3+
# After success script for Travis CI
4+
#
5+
6+
# please keep tasks strongly separated,
7+
# no matter they have the same if block
38

9+
# please set $TX_USER and $TX_TOKEN in your travis dashboard
10+
if [ "$TRAVIS_BRANCH" = "develop" ] && [ "$TRAVIS_PULL_REQUEST" = false ]; then
11+
echo "updating source language"
12+
sudo apt install transifex-client
13+
echo "[https://www.transifex.com]" > ~/.transifexrc
14+
echo "api_hostname = https://api.transifex.com" >> ~/.transifexrc
15+
echo "hostname = https://www.transifex.com" >> ~/.transifexrc
16+
echo "token = ${TX_TOKEN}" >> ~/.transifexrc
17+
echo "password = ${TX_TOKEN}" >> ~/.transifexrc
18+
echo "username = ${TX_USER}" >> ~/.transifexrc
19+
php vendor/bin/robo locales:send
20+
else
21+
echo "skipping source language update"
22+
fi
23+
24+
# please set the $GH_TOKEN in your travis dashboard
425
if [ "$TRAVIS_BRANCH" = "develop" ] && [ "$TRAVIS_PULL_REQUEST" = false ]; then
526
#wget http://get.sensiolabs.org/sami.phar -O "$HOME/bin/sami.phar"
627
# setup_git only for the main repo and not forks

tests/suite-unit/PluginFlyvemdmEntityConfig.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public function providerPrepareInputForUpdate() {
116116
[],
117117
[
118118
'You are not allowed to change the device limit',
119-
'You are not allowed to download URL of the MDM agent',
119+
'You are not allowed to change the download URL of the MDM agent',
120120
'You are not allowed to change the invitation token life',
121121
]
122122
]

tests/update_locales.sh

-17
This file was deleted.

tools/cli_install.php

+35-8
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,19 @@
3939
cli_install.php
4040
4141
Usage:
42-
cli_install.php [--as-user USER] [--api-user-token APITOKEN] [--enable-api ] [--enable-email ] [ --tests ] [--dev]
42+
cli_install.php [--as-user USER] [--api-user-token APITOKEN] [--enable-api ] [--enable-email ] [ --tests ] [--dev] [--mqtt-address MQTTADDRESS] [--mqtt-internal-address MQTTINTERNALADDRESS] [--mqtt-port MQTTPORT] [--mqtt-port-tls MQTTPORTTLS]
4343
4444
Options:
45-
--as-user USER Do install/upgrade as specified USER. If not provided, 'glpi' user will be used
46-
--api-user-token APITOKEN APITOKEN
47-
--enable-api Enable GLPI's API
48-
--enable-email Enable GLPI's email notification
49-
--tests Use GLPI test database
50-
--dev Change the Agent download URL for the Beta testing url
45+
--as-user USER Do install/upgrade as specified USER. If not provided, 'glpi' user will be used
46+
--api-user-token APITOKEN APITOKEN
47+
--enable-api Enable GLPI's API
48+
--enable-email Enable GLPI's email notification
49+
--tests Use GLPI test database
50+
--dev Change the Agent download URL for the Beta testing url
51+
--mqtt-address MQTTADDRESS Sets the address for Mosquitto MQTTADDRESS. This parameter can be [ IP Address/Hostname ]
52+
--mqtt-internal-address MQTTINTERNALADDRESS Sets the Internal address for Mosquitto MQTTINTERNALADDRESS. This parameter can be [ IP Address/Hostname ]
53+
--mqtt-port MQTTPORT Sets the Listen Port for Mosquitto MQTTPORT
54+
--mqtt-port-tls MQTTPORTTLS Sets the Listen Port TLS for Mosquitto MQTTPORTTLS
5155
5256
DOC;
5357

@@ -91,6 +95,29 @@
9195
$CFG_GLPI = $config + $CFG_GLPI;
9296
}
9397

98+
// Setup plugin configuration
99+
$pluginConfig = [];
100+
if (isset($args['--mqtt-address']) && $args['--mqtt-address'] !== false) {
101+
$pluginConfig = [
102+
'mqtt_broker_address' => $args['--mqtt-address']
103+
];
104+
}
105+
if (isset($args['--mqtt-internal-address']) && $args['--mqtt-internal-address'] !== false) {
106+
$pluginConfig = [
107+
'mqtt_broker_internal_address' => $args['--mqtt-internal-address']
108+
];
109+
}
110+
if (isset($args['--mqtt-port']) && $args['--mqtt-port'] !== false) {
111+
$pluginConfig = [
112+
'mqtt_broker_port' => $args['--mqtt-port']
113+
];
114+
}
115+
if (isset($args['--mqtt-port-tls']) && $args['--mqtt-port-tls'] !== false) {
116+
$pluginConfig = [
117+
'mqtt_broker_tls_port' => $args['--mqtt-port-tls']
118+
];
119+
}
120+
94121
// Init debug variable
95122
$_SESSION['glpi_use_mode'] = Session::DEBUG_MODE;
96123
$_SESSION['glpilanguage'] = "en_GB";
@@ -168,6 +195,7 @@
168195
'download_url' => PLUGIN_FLYVEMDM_AGENT_BETA_DOWNLOAD_URL
169196
]);
170197
}
198+
Config::setConfigurationValues('flyvemdm', $pluginConfig);
171199

172200
// Enable the plugin
173201
print("Activating Plugin...\n");
@@ -182,4 +210,3 @@
182210
print("Loading Plugin...\n");
183211
$plugin->load("flyvemdm");
184212
print("Load Done...\n");
185-

0 commit comments

Comments
 (0)