* Resources: new setting what to show in title beside name: short description (default), location or inventory number

This commit is contained in:
ralf 2025-03-04 16:36:22 +01:00
parent 687440cc9a
commit 678997c397
4 changed files with 36 additions and 9 deletions

View File

@ -889,7 +889,7 @@ class resources_bo
} }
/** /**
* get title for an infolog entry identified by $res_id * Get title for a resource entry identified by $res_id
* *
* @author Cornelius Weiss <egw@von-und-zu-weiss.de> * @author Cornelius Weiss <egw@von-und-zu-weiss.de>
* @param int|array $resource * @param int|array $resource
@ -905,17 +905,18 @@ class resources_bo
{ {
return false; return false;
} }
return $resource['name']. ($resource['short_description'] ? ', ['.$resource['short_description'].']':''); $show = $resource[$GLOBALS['egw_info']['user']['preferences']['title_show'] ?? 'short_description'];
return $resource['name'].(!empty($show) ? ' ('.$show.')' : '');
} }
/** /**
* Columns displayed in title (or required for ACL) * Columns displayed in title (or required for ACL)
* *
*/ */
const TITLE_COLS = 'res_id,name,short_description,cat_id'; const TITLE_COLS = ['res_id', 'name', 'cat_id'];
/** /**
* get title for multiple contacts identified by $ids * Get title for multiple resources identified by $ids
* *
* Is called as hook to participate in the linking. * Is called as hook to participate in the linking.
* *
@ -925,7 +926,8 @@ class resources_bo
function link_titles(array $ids) function link_titles(array $ids)
{ {
$titles = array(); $titles = array();
if (($resources =& $this->so->search(array('res_id' => $ids),self::TITLE_COLS))) if (($resources =& $this->so->search(array('res_id' => $ids),
array_merge(self::TITLE_COLS, [$GLOBALS['egw_info']['user']['preferences']['title_show'] ?? 'short_description']))))
{ {
foreach($resources as $resource) foreach($resources as $resource)
{ {

View File

@ -200,9 +200,23 @@ class resources_hooks
*/ */
static function settings() static function settings()
{ {
$settings[] = array( $settings = [[
'type' => 'section', 'type' => 'section',
'title' => lang('Data exchange settings'), 'title' => lang('General settings'),
'no_lang' => true,
'xmlrpc' => False,
'admin' => False
]];
$settings[] = array(
'type' => 'select',
'name' => 'title_show',
'label' => lang('Show in title (beside name)'),
'default' => 'short_description',
'values' => [
'short_description' => lang('short description'),
'location' => lang('location'),
'inventory_number' => lang('inventory number'),
],
'no_lang' => true, 'no_lang' => true,
'xmlrpc' => False, 'xmlrpc' => False,
'admin' => False 'admin' => False
@ -211,6 +225,13 @@ class resources_hooks
// Merge print // Merge print
if($GLOBALS['egw_info']['user']['apps']['filemanager']) if($GLOBALS['egw_info']['user']['apps']['filemanager'])
{ {
$settings[] = array(
'type' => 'section',
'title' => lang('Data exchange settings'),
'no_lang' => true,
'xmlrpc' => False,
'admin' => False
);
$merge = new resources_merge(); $merge = new resources_merge();
$settings += $merge->merge_preferences(); $settings += $merge->merge_preferences();
} }

View File

@ -35,6 +35,7 @@ create new accessory for this resource resources de Neues Zubehör zu dieser Res
create new links resources de Neue Verknüpfung erstellen create new links resources de Neue Verknüpfung erstellen
custom etemplate for the contactform resources de Benutzerdefiniertes eTemlate für das Kontaktformular custom etemplate for the contactform resources de Benutzerdefiniertes eTemlate für das Kontaktformular
custom fields resources de Benutzerdefinierte Felder custom fields resources de Benutzerdefinierte Felder
data exchange settings common de Einstellungen für den Datenaustausch
days resources de Tage days resources de Tage
delete accessories of selected resources too? resources de Auch Zubehör der ausgewählten Ressourcen löschen? delete accessories of selected resources too? resources de Auch Zubehör der ausgewählten Ressourcen löschen?
delete selected resources resources de Ausgewählte Ressourcen löschen delete selected resources resources de Ausgewählte Ressourcen löschen
@ -134,6 +135,7 @@ select/deselect all resources de Alle auswählen / Auswahl aufheben
short description resources de Kurzbeschreibung short description resources de Kurzbeschreibung
short description of resource resources de Kurzbeschreibung der Ressource short description of resource resources de Kurzbeschreibung der Ressource
show calendar of resource resources de Kalender der Ressource anzeigen show calendar of resource resources de Kalender der Ressource anzeigen
show in title (beside name) resources de Im Titel anzeigen (neben dem Namen)
simple reservation of a single item resources de Einfache Reservierung eines einzelnen Elements simple reservation of a single item resources de Einfache Reservierung eines einzelnen Elements
something went wrong by deleting resource resources de Beim Löschen der Ressource gab es ein Problem! something went wrong by deleting resource resources de Beim Löschen der Ressource gab es ein Problem!
something went wrong by saving resource resources de Beim Speichern der Ressource gab es ein Problem! something went wrong by saving resource resources de Beim Speichern der Ressource gab es ein Problem!

View File

@ -35,6 +35,7 @@ create new accessory for this resource resources en Create new accessory for thi
create new links resources en Create new links create new links resources en Create new links
custom etemplate for the contactform resources en Custom eTemplate for the contactform custom etemplate for the contactform resources en Custom eTemplate for the contactform
custom fields resources en Custom Fields custom fields resources en Custom Fields
data exchange settings common en Data exchange settings
days resources en Days days resources en Days
delete accessories of selected resources too? resources en Delete accessories of selected resources too? delete accessories of selected resources too? resources en Delete accessories of selected resources too?
delete selected resources resources en Delete selected resources delete selected resources resources en Delete selected resources
@ -135,6 +136,7 @@ select/deselect all resources en Select/deselect all
short description resources en Short description short description resources en Short description
short description of resource resources en Short description of resource short description of resource resources en Short description of resource
show calendar of resource resources en Show calendar of resource show calendar of resource resources en Show calendar of resource
show in title (beside name) resources en Show in title (beside name)
simple reservation of a single item resources en Simple reservation of a single item simple reservation of a single item resources en Simple reservation of a single item
something went wrong by deleting resource resources en Error deleting resource! something went wrong by deleting resource resources en Error deleting resource!
something went wrong by saving resource resources en Error saving resource! something went wrong by saving resource resources en Error saving resource!