From: Bernd Bleßmann Date: Fri, 8 May 2020 15:08:25 +0000 (+0200) Subject: Abteilungen bei Ansprechpersonen: SimpleSettings-Controller zum Editieren X-Git-Tag: release-3.5.6.1~201 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=30d53fc86a48efdd6f613c571afad322d5f11b39;p=kivitendo-erp.git Abteilungen bei Ansprechpersonen: SimpleSettings-Controller zum Editieren --- diff --git a/SL/Controller/SimpleSystemSetting.pm b/SL/Controller/SimpleSystemSetting.pm index 96fe5edb7..aaca8e9bd 100644 --- a/SL/Controller/SimpleSystemSetting.pm +++ b/SL/Controller/SimpleSystemSetting.pm @@ -56,6 +56,16 @@ my %supported_types = ( ], }, + contact_department => { + class => 'ContactDepartment', + auth => 'config', + titles => { + list => t8('Contact Departments'), + add => t8('Add department'), + edit => t8('Edit department'), + }, + }, + contact_title => { class => 'ContactTitle', auth => 'config', diff --git a/SL/DB/ContactDepartment.pm b/SL/DB/ContactDepartment.pm index a7645b1fc..8a6d2bd3b 100644 --- a/SL/DB/ContactDepartment.pm +++ b/SL/DB/ContactDepartment.pm @@ -5,9 +5,18 @@ package SL::DB::ContactDepartment; use strict; +use SL::Util qw(trim); + use SL::DB::MetaSetup::ContactDepartment; use SL::DB::Manager::ContactDepartment; __PACKAGE__->meta->initialize; +__PACKAGE__->before_save('_before_save_trim_content'); + +sub _before_save_trim_content { + $_[0]->description(trim($_[0]->description)); + return 1; +} + 1; diff --git a/SL/DB/Manager/ContactDepartment.pm b/SL/DB/Manager/ContactDepartment.pm index f545f650c..ed1b1b4a0 100644 --- a/SL/DB/Manager/ContactDepartment.pm +++ b/SL/DB/Manager/ContactDepartment.pm @@ -7,8 +7,17 @@ use strict; use parent qw(SL::DB::Helper::Manager); +use SL::DB::Helper::Sorted; + sub object_class { 'SL::DB::ContactDepartment' } __PACKAGE__->make_manager_methods; +sub _sort_spec { + return ( default => [ 'description', 1 ], + columns => { SIMPLE => 'ALL', + map { ( $_ => "lower(contact_departments.$_)" ) } qw(description) + }); +} + 1; diff --git a/locale/de/all b/locale/de/all index d7c8e7249..ea5f995d3 100755 --- a/locale/de/all +++ b/locale/de/all @@ -667,6 +667,7 @@ $self->{texts} = { 'Confirm!' => 'Bestätigen Sie!', 'Confirmation' => 'Auftragsbestätigung', 'Contact' => 'Kontakt', + 'Contact Departments' => 'Abteilungen von Ansprechpersonen', 'Contact Person' => 'Ansprechperson', 'Contact Person (database ID)' => 'Ansprechperson (Datenbank-ID)', 'Contact Person (name)' => 'Ansprechperson (Name)', diff --git a/locale/en/all b/locale/en/all index 4ef9a6398..a3d1900e1 100644 --- a/locale/en/all +++ b/locale/en/all @@ -667,6 +667,7 @@ $self->{texts} = { 'Confirm!' => '', 'Confirmation' => '', 'Contact' => '', + 'Contact Departments' => '', 'Contact Person' => '', 'Contact Person (database ID)' => '', 'Contact Person (name)' => '', diff --git a/menus/user/00-erp.yaml b/menus/user/00-erp.yaml index 068bd698f..b56a7b905 100644 --- a/menus/user/00-erp.yaml +++ b/menus/user/00-erp.yaml @@ -1189,6 +1189,13 @@ params: action: SimpleSystemSetting/list type: contact_title +- parent: system + id: system_contact_departments + name: Contact Departments + order: 1430 + params: + action: SimpleSystemSetting/list + type: contact_department - parent: system id: system_project_types name: Project Types