diff --git a/CHANGELOG.md b/CHANGELOG.md index 441b4e5621c..968944f1fa7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -270,6 +270,7 @@ The present file will list all changes made to the project; according to the - `NetworkName::getInternetNameFromID()` - `NetworkPort::getNetworkPortInstantiationsWithNames()` - `NetworkPort::resetConnections()` +- `OlaLevel::showForSLA()`. Replaced by `LevelAgreementLevel::showForLA()`. - `PlanningExternalEvent::addVisibilityRestrict()` - `Plugin::migrateItemType()` - `ProfileRight::updateProfileRightAsOtherRight()` @@ -298,7 +299,7 @@ The present file will list all changes made to the project; according to the - `Search::sylk_clean()` - `SlaLevel::showForSLA()`. Replaced by `LevelAgreementLevel::showForLA()`. - `SLM::setTicketCalendar()` -- `OlaLevel::showForSLA()`. Replaced by `LevelAgreementLevel::showForLA()`. +- `SoftwareLicense::getSonsOf()` - `Toolbox::canUseCas()` - `Toolbox::checkValidReferer()` - `Toolbox::clean_cross_side_scripting_deep()` diff --git a/src/Html.php b/src/Html.php index f7c61a00b97..c7f01171c69 100644 --- a/src/Html.php +++ b/src/Html.php @@ -839,8 +839,8 @@ public static function getConfirmationOnActionScript($string, $additionalactions * * @since 0.85 * - * @param $id HTML ID of the progress bar - * @param $options array progress status + * @param string $id HTML ID of the progress bar + * @param array $options progress status options * - create do we have to create it ? * - message add or change the message * - percent current level @@ -850,7 +850,6 @@ public static function getConfirmationOnActionScript($string, $additionalactions **/ public static function progressBar($id, array $options = []) { - $params = [ 'create' => false, 'message' => null, @@ -938,17 +937,21 @@ public static function progressBar($id, array $options = []) * Create a Dynamic Progress Bar * * @param string $msg initial message (under the bar) + * @param array $options See {@link Html::progressBar()} for available options (excluding message) * - * @return void + * @return string|void **/ - public static function createProgressBar($msg = " ") + public static function createProgressBar($msg = null, array $options = []) { + $options = array_replace([ + 'create' => true, + 'display' => true + ], $options); + $options['message'] = $msg; - $options = ['create' => true]; - if ($msg != " ") { - $options['message'] = $msg; + if (!$options['display']) { + return self::progressBar('doaction_progress', $options); } - self::progressBar('doaction_progress', $options); } diff --git a/src/Item_SoftwareVersion.php b/src/Item_SoftwareVersion.php index cf751096ff2..99341a7b42d 100644 --- a/src/Item_SoftwareVersion.php +++ b/src/Item_SoftwareVersion.php @@ -482,7 +482,7 @@ private static function showInstallations($searchID, $crit) $order = "ASC"; } - if (isset($_GET["sort"]) && !empty($_GET["sort"]) && isset($refcolumns[$_GET["sort"]])) { + if (!empty($_GET["sort"]) && isset($refcolumns[$_GET["sort"]])) { // manage several param like location,compname : order first $tmp = explode(",", $_GET["sort"]); $sort = "`" . implode("` $order,`", $tmp) . "`"; diff --git a/src/Software.php b/src/Software.php index bdf574f3f9e..2bf7205e5d4 100644 --- a/src/Software.php +++ b/src/Software.php @@ -229,7 +229,7 @@ public function getSpecificMassiveActions($checkitem = null) ) { $actions[__CLASS__ . MassiveAction::CLASS_ACTION_SEPARATOR . 'compute_software_category'] = "" . - __('Recalculate the category'); + __s('Recalculate the category'); } if ( @@ -238,7 +238,7 @@ public function getSpecificMassiveActions($checkitem = null) ) { $actions[__CLASS__ . MassiveAction::CLASS_ACTION_SEPARATOR . 'replay_dictionnary'] = "" . - __('Replay the dictionary rules'); + __s('Replay the dictionary rules'); } if ($isadmin) { @@ -890,9 +890,7 @@ public function showMergeCandidates() $ID = $this->getField('id'); $this->check($ID, UPDATE); - $rand = mt_rand(); - echo "
"; $iterator = $DB->request([ 'SELECT' => [ 'glpi_softwares.id', @@ -923,46 +921,45 @@ public function showMergeCandidates() ]); $nb = count($iterator); - if ($nb) { - $link = Toolbox::getItemTypeFormURL('Software'); - Html::openMassiveActionsForm('mass' . __CLASS__ . $rand); - $massiveactionparams - = ['num_displayed' => min($_SESSION['glpilist_limit'], $nb), - 'container' => 'mass' . __CLASS__ . $rand, - 'specific_actions' - => [__CLASS__ . MassiveAction::CLASS_ACTION_SEPARATOR . 'merge' - => __('Merge') - ], - 'item' => $this - ]; - Html::showMassiveActions($massiveactionparams); - - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - - foreach ($iterator as $data) { - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo "\n"; - } - echo "
"; - echo Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand); - echo "" . __('Name') . "" . Entity::getTypeName(1) . "" . _n('Installation', 'Installations', Session::getPluralNumber()) . "" . SoftwareLicense::getTypeName(Session::getPluralNumber()) . "
" . Html::getMassiveActionCheckBox(__CLASS__, $data["id"]) . "" . $data["name"] . "" . $data["entity"] . "" . Item_SoftwareVersion::countForSoftware($data["id"]) . "" . SoftwareLicense::countForSoftware($data["id"]) . "
\n"; - $massiveactionparams['ontop'] = false; - Html::showMassiveActions($massiveactionparams); - Html::closeForm(); - } else { - echo __('No item found'); + $entries = []; + $software = new self(); + foreach ($iterator as $data) { + $software->getFromDB($data["id"]); + $entries[] = [ + 'name' => $software->getLink(), + 'entity' => $data["entity"], + 'installations' => Item_SoftwareVersion::countForSoftware($data["id"]), + 'licenses' => SoftwareLicense::countForSoftware($data["id"]) + ]; } - echo "
"; + TemplateRenderer::getInstance()->display('components/datatable.html.twig', [ + 'is_tab' => true, + 'nopager' => true, + 'nofilter' => true, + 'nosort' => true, + 'columns' => [ + 'name' => __('Name'), + 'entity' => Entity::getTypeName(1), + 'installations' => _n('Installation', 'Installations', Session::getPluralNumber()), + 'licenses' => SoftwareLicense::getTypeName(Session::getPluralNumber()) + ], + 'formatters' => [ + 'name' => 'raw_html', + ], + 'entries' => $entries, + 'total_number' => count($entries), + 'filtered_number' => count($entries), + 'showmassiveactions' => true, + 'massiveactionparams' => [ + 'num_displayed' => count($entries), + 'container' => 'mass' . static::class . mt_rand(), + 'specific_actions' => [ + __CLASS__ . MassiveAction::CLASS_ACTION_SEPARATOR . 'merge' => __('Merge') + ], + 'item' => $this + ] + ]); } /** @@ -981,16 +978,26 @@ public function merge($item, $html = true) $ID = $this->getField('id'); if ($html) { - echo "
"; - echo ""; - echo "
" . __('Merging') . "
"; - Html::createProgressBar(__('Work in progress...')); - echo "
\n"; + $twig_params = [ + 'merge_msg' => __('Merging'), + 'progress' => Html::progressBar('doaction_progress', [ + 'message' =>__('Work in progress...'), + 'create' => true, + 'display' => false + ]) + ]; + // language=Twig + echo TemplateRenderer::getInstance()->renderFromStringTemplate(<< + {{ fields.htmlField('', progress, merge_msg) }} + +TWIG, $twig_params); } $item = array_keys($item); - // Search for software version + // Search for software version $req = $DB->request(['FROM' => "glpi_softwareversions", 'WHERE' => ["softwares_id" => $item]]); $i = 0; diff --git a/src/SoftwareLicense.php b/src/SoftwareLicense.php index cf66cc056f1..160bedea931 100644 --- a/src/SoftwareLicense.php +++ b/src/SoftwareLicense.php @@ -902,14 +902,18 @@ public static function showForSoftware(Software $software) $license = new self(); if (!$software->can($softwares_id, READ)) { - return false; + return; } - $columns = ['name' => __('Name'), + $columns = [ + 'name' => __('Name'), 'entity' => Entity::getTypeName(1), 'serial' => __('Serial number'), 'number' => _x('quantity', 'Number'), - '_affected' => __('Affected items'), + '_affected' => [ + 'label' => __('Affected items'), + 'nosort' => true, + ], 'typename' => _n('Type', 'Types', 1), 'buyname' => __('Purchase version'), 'usename' => __('Version in use'), @@ -926,14 +930,13 @@ public static function showForSoftware(Software $software) if (!empty($_GET["sort"]) && isset($columns[$_GET["sort"]])) { $sort = $_GET["sort"]; } else { - $sort = ["entity $order", "name $order"]; + $sort = 'name'; } - // Righ type is enough. Can add a License on a software we have Read access + // Right type is enough. Can add a License on a software we have Read access $canedit = Software::canUpdate(); - $showmassiveactions = $canedit; - // Total Number of events + // Total Number of events $number = countElementsInTable( "glpi_softwarelicenses", [ @@ -941,26 +944,20 @@ public static function showForSoftware(Software $software) 'glpi_softwarelicenses.is_template' => 0, ] + getEntitiesRestrictCriteria('glpi_softwarelicenses', '', '', true) ); - echo "
"; - - Session::initNavigateListItems( - 'SoftwareLicense', - //TRANS : %1$s is the itemtype name, %2$s is the name of the item (used for headings of a list) - sprintf( - __('%1$s = %2$s'), - Software::getTypeName(1), - $software->getName() - ) - ); if ($canedit) { - echo ""; + $twig_params = [ + 'btn_msg' => _x('button', 'Add a license'), + 'softwares_id' => $softwares_id, + ]; + // language=Twig + echo TemplateRenderer::getInstance()->renderFromStringTemplate(<< + {{ btn_msg }} +
+TWIG, $twig_params); } - $rand = mt_rand(); $iterator = $DB->request([ 'SELECT' => [ 'glpi_softwarelicenses.*', @@ -1007,134 +1004,87 @@ public static function showForSoftware(Software $software) 'glpi_softwarelicenses.softwares_id' => $softwares_id, 'glpi_softwarelicenses.is_template' => 0 ] + getEntitiesRestrictCriteria('glpi_softwarelicenses', '', '', true), - 'ORDERBY' => $sort, - 'START' => (int)$start, + 'ORDERBY' => "$sort $order", + 'START' => $start, 'LIMIT' => (int)$_SESSION['glpilist_limit'] ]); - $num_displayed = count($iterator); - - if ($num_displayed) { - // Display the pager - Html::printAjaxPager(self::getTypeName(Session::getPluralNumber()), $start, $number); - if ($showmassiveactions) { - Html::openMassiveActionsForm('mass' . __CLASS__ . $rand); - $massiveactionparams - = ['num_displayed' - => min($_SESSION['glpilist_limit'], $num_displayed), - 'container' - => 'mass' . __CLASS__ . $rand, - 'extraparams' - => ['options' - => ['glpi_softwareversions.name' - => ['condition' - => $DB->quoteName("glpi_softwareversions.softwares_id") . " - = $softwares_id" - ], - 'glpi_softwarelicenses.name' - => ['itemlink_as_string' => true] - ] - ] - ]; - Html::showMassiveActions($massiveactionparams); + $tot_assoc = 0; + $tot = 0; + $entries = []; + foreach ($iterator as $data) { + $license->getFromResultSet($data); + $expired = true; + if ( + is_null($data['expire']) + || ($data['expire'] > date('Y-m-d')) + ) { + $expired = false; } - - echo ""; - - $header_begin = ""; - } else { - $header_end .= "" . - "$val"; + $nb_assoc = Item_SoftwareLicense::countForLicense($data['id']); + $tot_assoc += $nb_assoc; + + if ($data['number'] < 0) { + // One unlimited license, total is unlimited + $tot = -1; + } else if ($tot >= 0) { + // Expired licenses do not count + if (!$expired) { + // Not unlimited, add the current number + $tot += $data['number']; } } - - $header_end .= "\n"; - echo $header_begin . $header_top . $header_end; - - $tot_assoc = 0; - $tot = 0; - foreach ($iterator as $data) { - Session::addToNavigateListItems('SoftwareLicense', $data['id']); - $expired = true; - if ( - is_null($data['expire']) - || ($data['expire'] > date('Y-m-d')) - ) { - $expired = false; - } - echo ""; - - if ($license->canEdit($data['id'])) { - echo ""; - } else { - echo ""; - } - - echo ""; - - if (isset($columns['entity'])) { - echo ""; - } - echo ""; - echo ""; - $nb_assoc = Item_SoftwareLicense::countForLicense($data['id']); - $tot_assoc += $nb_assoc; - $color = ($data['is_valid'] ? 'green' : 'red'); - - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - - if ($data['number'] < 0) { - // One illimited license, total is illimited - $tot = -1; - } else if ($tot >= 0) { - // Expire license not count - if (!$expired) { - // Not illimited, add the current number - $tot += $data['number']; - } - } - } - echo ""; - echo ""; - echo ""; - $color = ($software->fields['is_valid'] ? 'green' : 'red'); - echo ""; - echo ""; - echo "
"; - $header_top = Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand); - $header_end = ''; - - foreach ($columns as $key => $val) { - // Non order column - if ($key[0] == '_') { - $header_end .= "$val
" . Html::getMassiveActionCheckBox(__CLASS__, $data["id"]) . " "; - echo $license->getLink(['complete' => true, 'comments' => true]); - echo ""; - echo $data['entity']; - echo "" . $data['serial'] . "" . - (($data['number'] > 0) ? $data['number'] : __('Unlimited')) . "" . $nb_assoc . "" . $data['typename'] . "" . $data['buyname'] . "" . $data['usename'] . "" . Html::convDate($data['expire']) . "" . $data['statename'] . "
" . __('Total') . "" . (($tot > 0) ? $tot . "" : __('Unlimited')) . - "" . $tot_assoc . "
\n"; - - if ($showmassiveactions) { - $massiveactionparams['ontop'] = false; - Html::showMassiveActions($massiveactionparams); - - Html::closeForm(); - } - Html::printAjaxPager(self::getTypeName(Session::getPluralNumber()), $start, $number); - } else { - echo "
" . __('No item found') . "
"; + $entries[] = [ + 'itemtype' => self::class, + 'id' => $data['id'], + 'row_class' => $expired ? 'table-danger' : '', + 'name' => $license->getLink(['complete' => true, 'comments' => true]), + 'entity' => $data['entity'], + 'serial' => $data['serial'], + 'number' => ($data['number'] > 0) ? $data['number'] : __('Unlimited'), + '_affected' => '' . $nb_assoc . '', + 'typename' => $data['typename'], + 'buyname' => $data['buyname'], + 'usename' => $data['usename'], + 'expire' => $data['expire'], + 'statename' => $data['statename'] + ]; } - echo ""; + TemplateRenderer::getInstance()->display('components/datatable.html.twig', [ + 'is_tab' => true, + 'start' => $start, + 'limit' => $_SESSION["glpilist_limit"], + 'sort' => $sort, + 'order' => $order, + 'nofilter' => true, + 'columns' => $columns, + 'formatters' => [ + 'name' => 'raw_html', + '_affected' => 'raw_html', + 'expire' => 'date', + ], + 'footers' => [ + ['', __('Total'), (($tot > 0) ? $tot . "" : __('Unlimited')), $tot_assoc, '', '', '', '', ''] + ], + 'footer_class' => 'fw-bold', + 'entries' => $entries, + 'total_number' => $number, + 'filtered_number' => count($entries), + 'showmassiveactions' => $canedit, + 'massiveactionparams' => [ + 'num_displayed' => count($entries), + 'container' => 'mass' . static::class . mt_rand(), + 'extraparams' => [ + 'options' => [ + 'glpi_softwareversions.name' => [ + 'condition' => $DB::quoteName("glpi_softwareversions.softwares_id") . " = $softwares_id" + ], + 'glpi_softwarelicenses.name' => ['itemlink_as_string' => true] + ] + ] + ] + ]); } /** @@ -1213,72 +1163,12 @@ public static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $ if ($item::class === Software::class && self::canView()) { self::showForSoftware($item); } else if ($item::class === self::class && self::canView()) { - self::getSonsOf($item); + $item->showChildren(); return true; } return true; } - public static function getSonsOf($item) - { - /** @var \DBmysql $DB */ - global $DB; - $entity_assign = $item->isEntityAssign(); - $nb = 0; - $ID = $item->getID(); - - echo "
"; - echo ""; - echo ""; - - $header = ""; - if ($entity_assign) { - $header .= ""; - } - - $header .= ""; - $header .= "\n"; - echo $header; - - $fk = $item->getForeignKeyField(); - $crit = [$fk => $ID, - 'ORDER' => 'name' - ]; - - if ($entity_assign) { - if ($fk == 'entities_id') { - $crit['id'] = $_SESSION['glpiactiveentities']; - $crit['id'] += $_SESSION['glpiparententities']; - } else { - foreach ($_SESSION['glpiactiveentities'] as $key => $value) { - $crit['entities_id'][$key] = (string)$value; - } - } - } - $nb = 0; - - foreach ($DB->request($item->getTable(), $crit) as $data) { - $nb++; - echo ""; - echo ""; - if ($entity_assign) { - echo ""; - } - - echo ""; - echo "\n"; - } - if ($nb) { - echo $header; - } - echo "
" . sprintf( - __('Sons of %s'), - $item->getTreeLink() - ); - echo "
" . __('Name') . "" . Entity::getTypeName(1) . "" . __('Comments') . "
" . $data['name'] . "" . Dropdown::getDropdownName("glpi_entities", $data["entities_id"]) . "" . $data['comment'] . "
\n"; - } - public static function getIcon() { return "ti ti-key"; diff --git a/src/SoftwareVersion.php b/src/SoftwareVersion.php index 0c91d6d7b61..40ded3dee2f 100644 --- a/src/SoftwareVersion.php +++ b/src/SoftwareVersion.php @@ -33,6 +33,8 @@ * --------------------------------------------------------------------- */ +use Glpi\Application\View\TemplateRenderer; + /** * SoftwareVersion Class **/ @@ -109,37 +111,6 @@ public function showForm($ID, array $options = []) $this->check(-1, CREATE, $options); } - $this->showFormHeader($options); - - echo "" . _n('Software', 'Software', Session::getPluralNumber()) . ""; - echo ""; - if (static::isNewID($ID)) { - echo ""; - } - echo "" . - Dropdown::getDropdownName("glpi_softwares", $softwares_id) . ""; - echo ""; - echo "" . __('Comments') . ""; - echo ""; - echo ""; - - echo "" . __('Name') . ""; - echo ""; - echo Html::input('name', ['value' => $this->fields['name']]); - echo ""; - - echo "" . OperatingSystem::getTypeName(1) . ""; - OperatingSystem::dropdown(['value' => $this->fields["operatingsystems_id"]]); - echo "\n"; - - echo "" . __('Status') . ""; - State::dropdown(['value' => $this->fields["states_id"], - 'entity' => $this->fields["entities_id"], - 'condition' => $this->getStateVisibilityCriteria() - ]); - echo "\n"; - // Only count softwareversions_id_buy (don't care of softwareversions_id_use if no installation) if ( (SoftwareLicense::countForVersion($ID) > 0) @@ -148,8 +119,25 @@ public function showForm($ID, array $options = []) $options['candel'] = false; } - $this->showFormButtons($options); - + $twig_params = [ + 'item' => $this, + 'softwares_id' => $softwares_id, + 'params' => $options + ]; + // language=Twig + echo TemplateRenderer::getInstance()->renderFromStringTemplate(<< + {% endif %} + {{ fields.htmlField('', get_item_link('Software', softwares_id), 'Software'|itemtype_name()) }} + {{ parent() }} + {{ fields.dropdownField('OperatingSystem', 'operatingsystems_id', item.fields['operatingsystems_id'], 'OperatingSystem'|itemtype_name()) }} + {% endblock %} +TWIG, $twig_params); return true; } @@ -296,30 +284,36 @@ public static function showForSoftware(Software $soft) $softwares_id = $soft->getField('id'); if (!$soft->can($softwares_id, READ)) { - return false; + return; } $canedit = $soft->canEdit($softwares_id); - echo "
"; - if ($canedit) { - echo ""; + $twig_params = [ + 'btn_msg' => _x('button', 'Add a version'), + 'softwares_id' => $softwares_id, + ]; + // language=Twig + echo TemplateRenderer::getInstance()->renderFromStringTemplate(<< + {{ btn_msg }} +
+TWIG, $twig_params); } + $sv_table = self::getTable(); + $state_table = State::getTable(); $iterator = $DB->request([ - 'SELECT' => [ - 'glpi_softwareversions.*', - 'glpi_states.name AS sname' + 'SELECT' => [ + "$sv_table.*", + "$state_table.name AS sname" ], - 'FROM' => 'glpi_softwareversions', + 'FROM' => $sv_table, 'LEFT JOIN' => [ - State::getTable() => [ + $state_table => [ 'ON' => [ - 'glpi_softwareversions' => 'states_id', - State::getTable() => 'id' + $sv_table => 'states_id', + $state_table => 'id' ] ] ], @@ -329,61 +323,56 @@ public static function showForSoftware(Software $soft) 'ORDERBY' => 'name' ]); - Session::initNavigateListItems( - 'SoftwareVersion', - //TRANS : %1$s is the itemtype name, - // %2$s is the name of the item (used for headings of a list) - sprintf( - __('%1$s = %2$s'), - Software::getTypeName(1), - $soft->getName() - ) - ); - - if (count($iterator)) { - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo "\n"; - - $tot = 0; - foreach ($iterator as $data) { - Session::addToNavigateListItems('SoftwareVersion', $data['id']); - $nb = Item_SoftwareVersion::countForVersion($data['id']); - - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo "\n"; - - $tot += $nb; - } - - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo "
" . self::getTypeName(Session::getPluralNumber()) . "" . __('Status') . "" . OperatingSystem::getTypeName(1) . "" . _n('Architecture', 'Architectures', 1) . "" . _n('Installation', 'Installations', Session::getPluralNumber()) . "" . __('Comments') . "
"; - echo $data['name'] . (empty($data['name']) ? "(" . $data['id'] . ")" : "") . "" . $data['sname'] . "" . Dropdown::getDropdownName( - 'glpi_operatingsystems', - $data['operatingsystems_id'] - ); - echo "{$data['arch']}$nb" . nl2br($data['comment'] ?? "") . "
" . __('Total') . "$tot
"; - } else { - echo ""; - echo ""; - echo "
" . __('No item found') . "
\n"; + $tot = 0; + $entries = []; + $sv = new self(); + foreach ($iterator as $data) { + $sv->getFromResultSet($data); + $nb = Item_SoftwareVersion::countForVersion($data['id']); + + $tot += $nb; + $entries[] = [ + 'itemtype' => self::class, + 'id' => $sv->getID(), + 'version' => $sv->getLink(), + 'status' => $data['sname'], + 'os' => Dropdown::getDropdownName('glpi_operatingsystems', $data['operatingsystems_id']), + 'arch' => $data['arch'], + 'installations' => $nb, + 'comments' => nl2br(htmlspecialchars($data['comment'] ?? '')) + ]; } - echo ""; + TemplateRenderer::getInstance()->display('components/datatable.html.twig', [ + 'is_tab' => true, + 'nopager' => true, + 'nofilter' => true, + 'nosort' => true, + 'columns' => [ + 'version' => self::getTypeName(Session::getPluralNumber()), + 'status' => __('Status'), + 'os' => OperatingSystem::getTypeName(1), + 'arch' => _n('Architecture', 'Architectures', 1), + 'installations' => _n('Installation', 'Installations', Session::getPluralNumber()), + 'comments' => __('Comments') + ], + 'formatters' => [ + 'version' => 'raw_html', + 'comments' => 'raw_html', + ], + 'footers' => [ + ['', '', '', __('Total'), $tot, ''] + ], + 'footer_class' => 'fw-bold', + 'entries' => $entries, + 'total_number' => count($entries), + 'filtered_number' => count($entries), + 'showmassiveactions' => $canedit, + 'massiveactionparams' => [ + 'num_displayed' => count($entries), + 'container' => 'mass' . static::class . mt_rand(), + ] + ]); } public function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) diff --git a/templates/components/datatable.html.twig b/templates/components/datatable.html.twig index fbe81802cda..b0944009f1b 100644 --- a/templates/components/datatable.html.twig +++ b/templates/components/datatable.html.twig @@ -36,8 +36,12 @@ {% if super_header is defined and super_header is not empty %} + {% set super_header_label = super_header is array ? super_header['label'] : super_header %} + {% set super_header_raw = super_header is array ? super_header['is_raw'] : false %} - + {% endif %}
{{ super_header }} + {{ super_header_raw ? super_header_label|raw : super_header_label }} +