From: Bernd Bleßmann Date: Tue, 17 Nov 2020 12:41:54 +0000 (+0100) Subject: Zeiterfassung: Tabellen und Rose X-Git-Tag: kivitendo-mebil_0.1-0~9^2~343 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=385bc4be4a927753ba4f1c7a426ede8fbed67123;p=kivitendo-erp.git Zeiterfassung: Tabellen und Rose --- diff --git a/SL/DB/Helper/ALL.pm b/SL/DB/Helper/ALL.pm index 006a389db..30ae80282 100644 --- a/SL/DB/Helper/ALL.pm +++ b/SL/DB/Helper/ALL.pm @@ -134,6 +134,8 @@ use SL::DB::Tax; use SL::DB::TaxKey; use SL::DB::TaxZone; use SL::DB::TaxzoneChart; +use SL::DB::TimeRecording; +use SL::DB::TimeRecordingType; use SL::DB::TodoUserConfig; use SL::DB::TransferType; use SL::DB::Translation; diff --git a/SL/DB/Helper/Mappings.pm b/SL/DB/Helper/Mappings.pm index da931f9c8..4abed608a 100644 --- a/SL/DB/Helper/Mappings.pm +++ b/SL/DB/Helper/Mappings.pm @@ -214,6 +214,8 @@ my %kivitendo_package_names = ( taxkeys => 'tax_key', tax_zones => 'tax_zone', taxzone_charts => 'taxzone_chart', + time_recording_types => 'time_recording_type', + time_recordings => 'time_recording', todo_user_config => 'todo_user_config', transfer_type => 'transfer_type', translation => 'translation', diff --git a/SL/DB/Manager/TimeRecording.pm b/SL/DB/Manager/TimeRecording.pm new file mode 100644 index 000000000..f0c7f429e --- /dev/null +++ b/SL/DB/Manager/TimeRecording.pm @@ -0,0 +1,14 @@ +# 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::TimeRecording; + +use strict; + +use parent qw(SL::DB::Helper::Manager); + +sub object_class { 'SL::DB::TimeRecording' } + +__PACKAGE__->make_manager_methods; + +1; diff --git a/SL/DB/Manager/TimeRecordingType.pm b/SL/DB/Manager/TimeRecordingType.pm new file mode 100644 index 000000000..9d7593ef0 --- /dev/null +++ b/SL/DB/Manager/TimeRecordingType.pm @@ -0,0 +1,14 @@ +# 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::TimeRecordingType; + +use strict; + +use parent qw(SL::DB::Helper::Manager); + +sub object_class { 'SL::DB::TimeRecordingType' } + +__PACKAGE__->make_manager_methods; + +1; diff --git a/SL/DB/MetaSetup/TimeRecording.pm b/SL/DB/MetaSetup/TimeRecording.pm new file mode 100644 index 000000000..518a03710 --- /dev/null +++ b/SL/DB/MetaSetup/TimeRecording.pm @@ -0,0 +1,57 @@ +# This file has been auto-generated. Do not modify it; it will be overwritten +# by rose_auto_create_model.pl automatically. +package SL::DB::TimeRecording; + +use strict; + +use parent qw(SL::DB::Object); + +__PACKAGE__->meta->table('time_recordings'); + +__PACKAGE__->meta->columns( + customer_id => { type => 'integer', not_null => 1 }, + description => { type => 'text', not_null => 1 }, + employee_id => { type => 'integer', not_null => 1 }, + end_time => { type => 'timestamp' }, + id => { type => 'serial', not_null => 1 }, + itime => { type => 'timestamp', default => 'now()', not_null => 1 }, + mtime => { type => 'timestamp', default => 'now()', not_null => 1 }, + project_id => { type => 'integer' }, + staff_member_id => { type => 'integer', not_null => 1 }, + start_time => { type => 'timestamp', not_null => 1 }, + type_id => { type => 'integer' }, +); + +__PACKAGE__->meta->primary_key_columns([ 'id' ]); + +__PACKAGE__->meta->allow_inline_column_values(1); + +__PACKAGE__->meta->foreign_keys( + customer => { + class => 'SL::DB::Customer', + key_columns => { customer_id => 'id' }, + }, + + employee => { + class => 'SL::DB::Employee', + key_columns => { employee_id => 'id' }, + }, + + project => { + class => 'SL::DB::Project', + key_columns => { project_id => 'id' }, + }, + + staff_member => { + class => 'SL::DB::Employee', + key_columns => { staff_member_id => 'id' }, + }, + + type => { + class => 'SL::DB::TimeRecordingType', + key_columns => { type_id => 'id' }, + }, +); + +1; +; diff --git a/SL/DB/MetaSetup/TimeRecordingType.pm b/SL/DB/MetaSetup/TimeRecordingType.pm new file mode 100644 index 000000000..2852d46fe --- /dev/null +++ b/SL/DB/MetaSetup/TimeRecordingType.pm @@ -0,0 +1,22 @@ +# This file has been auto-generated. Do not modify it; it will be overwritten +# by rose_auto_create_model.pl automatically. +package SL::DB::TimeRecordingType; + +use strict; + +use parent qw(SL::DB::Object); + +__PACKAGE__->meta->table('time_recording_types'); + +__PACKAGE__->meta->columns( + abbreviation => { type => 'text', not_null => 1 }, + description => { type => 'text' }, + id => { type => 'serial', not_null => 1 }, + obsolete => { type => 'boolean', default => 'false', not_null => 1 }, + position => { type => 'integer', not_null => 1 }, +); + +__PACKAGE__->meta->primary_key_columns([ 'id' ]); + +1; +; diff --git a/SL/DB/TimeRecording.pm b/SL/DB/TimeRecording.pm new file mode 100644 index 000000000..341e572b2 --- /dev/null +++ b/SL/DB/TimeRecording.pm @@ -0,0 +1,13 @@ +# 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::TimeRecording; + +use strict; + +use SL::DB::MetaSetup::TimeRecording; +use SL::DB::Manager::TimeRecording; + +__PACKAGE__->meta->initialize; + +1; diff --git a/SL/DB/TimeRecordingType.pm b/SL/DB/TimeRecordingType.pm new file mode 100644 index 000000000..bc9d2c05c --- /dev/null +++ b/SL/DB/TimeRecordingType.pm @@ -0,0 +1,13 @@ +# 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::TimeRecordingType; + +use strict; + +use SL::DB::MetaSetup::TimeRecordingType; +use SL::DB::Manager::TimeRecordingType; + +__PACKAGE__->meta->initialize; + +1; diff --git a/sql/Pg-upgrade2/time_recordings.sql b/sql/Pg-upgrade2/time_recordings.sql new file mode 100644 index 000000000..ccbf329cc --- /dev/null +++ b/sql/Pg-upgrade2/time_recordings.sql @@ -0,0 +1,35 @@ +-- @tag: time_recordings +-- @description: Tabellen zur Zeiterfassung +-- @depends: release_3_5_6_1 + +CREATE TABLE time_recording_types ( + id SERIAL, + abbreviation TEXT NOT NULL, + description TEXT, + position INTEGER NOT NULL, + obsolete BOOLEAN NOT NULL DEFAULT false, + PRIMARY KEY (id) +); + +CREATE TABLE time_recordings ( + id SERIAL, + customer_id INTEGER NOT NULL, + project_id INTEGER, + start_time TIMESTAMP NOT NULL, + end_time TIMESTAMP, + type_id INTEGER, + description TEXT NOT NULL, + staff_member_id INTEGER NOT NULL, + employee_id INTEGER NOT NULL, + itime TIMESTAMP NOT NULL DEFAULT now(), + mtime TIMESTAMP NOT NULL DEFAULT now(), + + PRIMARY KEY (id), + FOREIGN KEY (customer_id) REFERENCES customer (id), + FOREIGN KEY (staff_member_id) REFERENCES employee (id), + FOREIGN KEY (employee_id) REFERENCES employee (id), + FOREIGN KEY (project_id) REFERENCES project (id), + FOREIGN KEY (type_id) REFERENCES time_recording_types (id) +); + +CREATE TRIGGER mtime_time_recordings BEFORE UPDATE ON time_recordings FOR EACH ROW EXECUTE PROCEDURE set_mtime();