mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-28 04:30:08 +02:00
Renamed config env to TABLE_PARTS_DEFAULT_COLUMNS and updated documentation
This commit is contained in:
parent
1369091b90
commit
79262972aa
7 changed files with 14 additions and 9 deletions
|
@ -76,7 +76,8 @@ class ColumnSortHelper
|
|||
* be visible by default. If a column is not listed here, it will be hidden by default.
|
||||
* @return void
|
||||
*/
|
||||
public function applyVisibilityAndConfigureColumns(DataTable $dataTable, string|array $visible_columns): void
|
||||
public function applyVisibilityAndConfigureColumns(DataTable $dataTable, string|array $visible_columns,
|
||||
string $config_var_name): void
|
||||
{
|
||||
//If the config is given as a string, convert it to an array first
|
||||
if (!is_array($visible_columns)) {
|
||||
|
@ -96,12 +97,12 @@ class ColumnSortHelper
|
|||
//Afterwards the columns, which should be visible by default
|
||||
foreach ($visible_columns as $col_id) {
|
||||
if (!isset($this->columns[$col_id]) || !$this->columns[$col_id]['visibility_configurable']) {
|
||||
$this->logger->warning("Configuration option TABLE_PART_DEFAULT_COLUMNS specify invalid column '$col_id'. Column is skipped.");
|
||||
$this->logger->warning("Configuration option $config_var_name specify invalid column '$col_id'. Column is skipped.");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (in_array($col_id, $processed_columns, true)) {
|
||||
$this->logger->warning("Configuration option TABLE_PART_DEFAULT_COLUMNS specify column '$col_id' multiple time. Only first occurrence is used.");
|
||||
$this->logger->warning("Configuration option $config_var_name specify column '$col_id' multiple time. Only first occurrence is used.");
|
||||
continue;
|
||||
}
|
||||
$this->addColumnEntry($dataTable, $this->columns[$col_id], true);
|
||||
|
|
|
@ -167,7 +167,7 @@ final class PartsDataTable implements DataTableTypeInterface
|
|||
|
||||
return implode('<br>', $tmp);
|
||||
},
|
||||
]);
|
||||
], alias: 'storage_location');
|
||||
}
|
||||
|
||||
$this->csh->add('amount', TextColumn::class, [
|
||||
|
@ -280,7 +280,7 @@ final class PartsDataTable implements DataTableTypeInterface
|
|||
]);
|
||||
|
||||
//Apply the user configured order and visibility and add the columns to the table
|
||||
$this->csh->applyVisibilityAndConfigureColumns($dataTable, $this->visible_columns);
|
||||
$this->csh->applyVisibilityAndConfigureColumns($dataTable, $this->visible_columns, "TABLE_PARTS_DEFAULT_COLUMNS");
|
||||
|
||||
$dataTable->addOrderBy('name')
|
||||
->createAdapter(TwoStepORMAdapater::class, [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue