--- /dev/null
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::ContactDepartment;
+
+use strict;
+
+use SL::DB::MetaSetup::ContactDepartment;
+use SL::DB::Manager::ContactDepartment;
+
+__PACKAGE__->meta->initialize;
+
+1;
use SL::DB::Business;
use SL::DB::Chart;
use SL::DB::Contact;
+use SL::DB::ContactDepartment;
use SL::DB::ContactTitle;
use SL::DB::CsvImportProfile;
use SL::DB::CsvImportProfileSetting;
bin => 'bin',
business => 'business',
chart => 'chart',
+ contact_departments => 'contact_department',
contact_titles => 'contact_title',
contacts => 'contact',
customer => 'customer',
--- /dev/null
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::Manager::ContactDepartment;
+
+use strict;
+
+use parent qw(SL::DB::Helper::Manager);
+
+sub object_class { 'SL::DB::ContactDepartment' }
+
+__PACKAGE__->make_manager_methods;
+
+1;
--- /dev/null
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::ContactDepartment;
+
+use strict;
+
+use parent qw(SL::DB::Object);
+
+__PACKAGE__->meta->table('contact_departments');
+
+__PACKAGE__->meta->columns(
+ description => { type => 'text', not_null => 1 },
+ id => { type => 'serial', not_null => 1 },
+);
+
+__PACKAGE__->meta->primary_key_columns([ 'id' ]);
+
+__PACKAGE__->meta->unique_keys([ 'description' ]);
+
+1;
+;
--- /dev/null
+-- @tag: contact_departments_own_table
+-- @description: Eigene Tabelle für Abteilungen bei Ansprechpersonen
+-- @depends: release_3_5_5
+
+CREATE TABLE contact_departments (
+ id SERIAL,
+ description TEXT NOT NULL,
+ PRIMARY KEY (id),
+ UNIQUE (description)
+);
+
+UPDATE contacts SET cp_abteilung = trim(cp_abteilung) WHERE cp_abteilung NOT LIKE trim(cp_abteilung);
+
+INSERT INTO contact_departments (description)
+ SELECT DISTINCT cp_abteilung FROM contacts WHERE cp_abteilung IS NOT NULL AND cp_abteilung NOT LIKE '' ORDER BY cp_abteilung;