Commit eb0e0eae authored by Johan Cwiklinski's avatar Johan Cwiklinski

Merge branch '9.5/bugfixes'

parents 1326b147 c7d1d24f
......@@ -51,10 +51,6 @@ commands:
- restore_cache:
keys:
- composer-cache-{{ .Environment.CIRCLE_JOB }}
- restore_cache:
keys:
- composer-install-{{ .Environment.CIRCLE_JOB }}-{{ checksum "composer.lock" }}
- composer-install-{{ .Environment.CIRCLE_JOB }}
- restore_cache:
keys:
- npm-cache-{{ .Environment.CIRCLE_JOB }}
......@@ -64,17 +60,13 @@ commands:
composer --version
echo "node version: $(node --version)"
echo "npm version: $(npm --version)"
sed -e '/"php":/d' -i composer.json
perl -i -0 -p -e 's/,?\s*"platform"\:\s*\{[^\}]*}//i' composer.json
mv composer.lock composer.lock.bak
bin/console dependencies install --ci
- save_cache:
key: composer-cache-{{ .Environment.CIRCLE_JOB }}-{{ epoch }}
paths:
- /home/circleci/.composer/cache/
- save_cache:
key: composer-install-{{ .Environment.CIRCLE_JOB }}-{{ checksum "composer.lock.bak" }}
paths:
- ./vendor
- save_cache:
key: npm-cache-{{ .Environment.CIRCLE_JOB }}-{{ epoch }}
paths:
......
......@@ -518,7 +518,7 @@ $ curl -X GET \
-H 'Content-Type: application/json' \
-H "Session-Token: 83af7e620c83a50a18d3eac2f6ed05a3ca0bea62" \
-H "App-Token: f7g3csp8mgatg5ebc5elnazakw20i9fyev1qopya7" \
'http://path/to/glpi/apirest.php/Computer/71?expand_drodpowns=true'
'http://path/to/glpi/apirest.php/Computer/71?expand_dropdowns=true'
< 200 OK
< {
......@@ -613,9 +613,9 @@ $ curl -X GET \
-H 'Content-Type: application/json' \
-H "Session-Token: 83af7e620c83a50a18d3eac2f6ed05a3ca0bea62" \
-H "App-Token: f7g3csp8mgatg5ebc5elnazakw20i9fyev1qopya7" \
'http://path/to/glpi/apirest.php/Computer/?expand_drodpowns=true'
'http://path/to/glpi/apirest.php/Computer/?expand_dropdowns=true'
< 200 OK
< 206 OK
< Content-Range: 0-50/200
< Accept-Range: 990
< [
......
......@@ -52,11 +52,23 @@ if (isset($_SERVER['argv']) && ['dependencies', 'install'] === array_slice($_SER
}
chdir(dirname(__FILE__, 2));
passthru($composer_command);
passthru($npm_command);
$exit_code = 0;
passthru($composer_command, $exit_code);
if ($exit_code > 0) {
exit($exit_code);
}
passthru($npm_command, $exit_code);
if ($exit_code > 0) {
exit($exit_code);
}
file_put_contents('.package.hash', sha1_file('package-lock.json'));
passthru('npm run-script build-dev');
exit();
passthru('npm run-script build-dev', $exit_code);
exit($exit_code);
}
// If "config-dir" option is used in command line, defines GLPI_CONFIG_DIR with its value
......
......@@ -240,14 +240,18 @@ class APIRest extends API {
$range = [0, $_SESSION['glpilist_limit']];
if (isset($this->parameters['range'])) {
$range = explode("-", $this->parameters['range']);
// fix end range
if ($range[1] > $totalcount - 1) {
$range[1] = $totalcount - 1;
}
if ($range[1] - $range[0] + 1 < $totalcount) {
$code = 206; // partial content
}
}
// fix end range
if ($range[1] > $totalcount - 1) {
$range[1] = $totalcount - 1;
}
// trigger partial content return code
if ($range[1] - $range[0] + 1 < $totalcount) {
$code = 206; // partial content
}
$additionalheaders["Accept-Range"] = $itemtype." ".Toolbox::get_max_input_vars();
if ($totalcount > 0) {
$additionalheaders["Content-Range"] = implode('-', $range)."/".$totalcount;
......
......@@ -176,14 +176,18 @@ class APIXmlrpc extends API {
$range = [0, $_SESSION['glpilist_limit']];
if (isset($this->parameters['range'])) {
$range = explode("-", $this->parameters['range']);
// fix end range
if ($range[1] > $totalcount - 1) {
$range[1] = $totalcount - 1;
}
if ($range[1] - $range[0] + 1 < $totalcount) {
$code = 206; // partial content
}
}
// fix end range
if ($range[1] > $totalcount - 1) {
$range[1] = $totalcount - 1;
}
// trigger partial content return code
if ($range[1] - $range[0] + 1 < $totalcount) {
$code = 206; // partial content
}
$additionalheaders = [];
$additionalheaders["Accept-Range"] = $this->parameters['itemtype']." ".
Toolbox::get_max_input_vars();
......
......@@ -4248,6 +4248,14 @@ class CommonDBTM extends CommonGLPI {
* @return string the string to display
**/
static function getSpecificValueToDisplay($field, $values, array $options = []) {
switch ($field) {
case '_virtual_datacenter_position':
if (method_exists(static::class, 'getDcBreadcrumbSpecificValueToDisplay')) {
return static::getDcBreadcrumbSpecificValueToDisplay($values['id']);
}
}
return '';
}
......
......@@ -786,6 +786,8 @@ class Computer extends CommonDBTM {
$tab = array_merge($tab, ComputerAntivirus::rawSearchOptionsToAdd());
$tab = array_merge($tab, Datacenter::rawSearchOptionsToAdd(get_class($this)));
return $tab;
}
......
......@@ -139,6 +139,29 @@ class Datacenter extends CommonDBTM {
return $tab;
}
static public function rawSearchOptionsToAdd($itemtype) {
return [
[
'id' => 'datacenter',
'name' => _n('Data center', 'Data centers', Session::getPluralNumber())
],
[
'id' => '175',
'table' => $itemtype::getTable(),
'field' => '_virtual_datacenter_position', // virtual field
'additionalfields' => [
'id',
'name'
],
'name' => __('Data center position'),
'datatype' => 'specific',
'nosearch' => true,
'massiveaction' => false
],
];
}
static function getAdditionalMenuLinks() {
$links = [];
if (static::canView()) {
......
......@@ -40,11 +40,11 @@ if (!defined('GLPI_ROOT')) {
trait DCBreadcrumb {
/**
* Get datacenter breadcrumb elements
* Get datacenter element breadcrumb
*
* @return array
*/
public function getDcBreadcrumb() :array {
protected function getDcBreadcrumb() {
global $CFG_GLPI;
$item = $this;
......@@ -102,8 +102,9 @@ trait DCBreadcrumb {
*
* @return void
*/
function showDcBreadcrumb() {
protected function showDcBreadcrumb() {
$breadcrumb = $this->getDcBreadcrumb();
if (count($breadcrumb)) {
echo "<tr class='tab_bg_1'>
<td>" . __('Data center position') . "</td>
......@@ -168,4 +169,23 @@ trait DCBreadcrumb {
return $found;
}
/**
* Specific value for "Data center position".
*
* @return array
*/
protected static function getDcBreadcrumbSpecificValueToDisplay($items_id) {
$item = new static();
if ($item->getFromDB($items_id)) {
$breadcrumb = $item->getDcBreadcrumb();
if (count($breadcrumb) > 0) {
return implode(' > ', array_reverse($item->getDcBreadcrumb()));
}
}
return '&nbsp;';
}
}
......@@ -304,6 +304,8 @@ class DCRoom extends CommonDBTM {
$tab = array_merge($tab, Notepad::rawSearchOptionsToAdd());
$tab = array_merge($tab, Datacenter::rawSearchOptionsToAdd(get_class($this)));
return $tab;
}
......
......@@ -324,6 +324,8 @@ class Enclosure extends CommonDBTM {
$tab = array_merge($tab, Notepad::rawSearchOptionsToAdd());
$tab = array_merge($tab, Datacenter::rawSearchOptionsToAdd(get_class($this)));
return $tab;
}
......
......@@ -241,6 +241,33 @@ class Location extends CommonTreeDropdown {
'datatype' => 'text'
];
$tab[] = [
'id' => '15',
'table' => 'glpi_locations',
'field' => 'address',
'name' => __('Address'),
'massiveaction' => false,
'datatype' => 'string'
];
$tab[] = [
'id' => '17',
'table' => 'glpi_locations',
'field' => 'postcode',
'name' => __('Postal code'),
'massiveaction' => true,
'datatype' => 'string'
];
$tab[] = [
'id' => '18',
'table' => 'glpi_locations',
'field' => 'town',
'name' => __('Town'),
'massiveaction' => true,
'datatype' => 'string'
];
$tab[] = [
'id' => '21',
'table' => 'glpi_locations',
......
......@@ -632,6 +632,8 @@ class Monitor extends CommonDBTM {
$tab = array_merge($tab, Notepad::rawSearchOptionsToAdd());
$tab = array_merge($tab, Datacenter::rawSearchOptionsToAdd(get_class($this)));
return $tab;
}
......
......@@ -670,6 +670,8 @@ class NetworkEquipment extends CommonDBTM {
$tab = array_merge($tab, Item_Devices::rawSearchOptionsToAdd(get_class($this)));
$tab = array_merge($tab, Datacenter::rawSearchOptionsToAdd(get_class($this)));
return $tab;
}
}
......@@ -320,6 +320,8 @@ class PDU extends CommonDBTM {
'datatype' => 'dropdown'
];
$tab = array_merge($tab, Datacenter::rawSearchOptionsToAdd(get_class($this)));
return $tab;
}
......
......@@ -541,6 +541,8 @@ class Peripheral extends CommonDBTM {
$tab = array_merge($tab, Notepad::rawSearchOptionsToAdd());
$tab = array_merge($tab, Datacenter::rawSearchOptionsToAdd(get_class($this)));
return $tab;
}
}
......@@ -486,6 +486,8 @@ class Rack extends CommonDBTM {
$tab = array_merge($tab, Notepad::rawSearchOptionsToAdd());
$tab = array_merge($tab, Datacenter::rawSearchOptionsToAdd(get_class($this)));
return $tab;
}
......
......@@ -848,7 +848,7 @@ abstract class APIBaseClass extends \atoum {
$data = $this->query('getItems',
['itemtype' => 'Config',
'headers' => ['Session-Token' => $this->session_token],
'query' => ['expand_dropdowns' => true]]);
'query' => ['expand_dropdowns' => true]], 206);
$this->variable($data)->isNotFalse();
$this->array($data)->hasKey('headers');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment