From: Sven Schöling Date: Mon, 6 May 2013 12:57:06 +0000 (+0200) Subject: Projekte: Attribute aus Bob X-Git-Tag: release-3.2.0beta~467^2~176 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=03f5aaa3c601956206f0c2a142c1e19f6981b326;p=kivitendo-erp.git Projekte: Attribute aus Bob --- diff --git a/SL/DB/Helper/Mappings.pm b/SL/DB/Helper/Mappings.pm index 0008450d6..12a8d171b 100644 --- a/SL/DB/Helper/Mappings.pm +++ b/SL/DB/Helper/Mappings.pm @@ -150,7 +150,12 @@ my %kivitendo_package_names = ( pricegroup => 'pricegroup', printers => 'printer', project => 'project', - project_types => 'ProjectType', + project_participants => 'project_participant', + project_phase_participants => 'project_phase_participant', + project_phases => 'project_phase', + project_roles => 'project_role', + project_status => 'project_status', + project_types => 'project_type', record_links => 'record_link', requirement_spec_acceptance_statuses => 'RequirementSpecAcceptanceStatus', requirement_spec_complexities => 'RequirementSpecComplexity', diff --git a/SL/DB/MetaSetup/Project.pm b/SL/DB/MetaSetup/Project.pm index 51315358c..cef714120 100644 --- a/SL/DB/MetaSetup/Project.pm +++ b/SL/DB/MetaSetup/Project.pm @@ -9,15 +9,24 @@ use base qw(SL::DB::Object); __PACKAGE__->meta->table('project'); __PACKAGE__->meta->columns( - active => { type => 'boolean', default => 'true' }, - customer_id => { type => 'integer' }, - description => { type => 'text' }, - id => { type => 'integer', not_null => 1, sequence => 'id' }, - itime => { type => 'timestamp', default => 'now()' }, - mtime => { type => 'timestamp' }, - project_type_id => { type => 'integer', not_null => 1 }, - projectnumber => { type => 'text' }, - valid => { type => 'boolean', default => 'true' }, + active => { type => 'boolean', default => 'true' }, + billable_customer_id => { type => 'integer' }, + budget_cost => { type => 'numeric', default => '0', not_null => 1, precision => 5, scale => 15 }, + budget_minutes => { type => 'integer', default => '0', not_null => 1 }, + customer_id => { type => 'integer' }, + description => { type => 'text' }, + end_date => { type => 'date' }, + id => { type => 'integer', not_null => 1, sequence => 'id' }, + itime => { type => 'timestamp', default => 'now()' }, + mtime => { type => 'timestamp' }, + order_value => { type => 'numeric', default => '0', not_null => 1, precision => 5, scale => 15 }, + project_status_id => { type => 'integer' }, + project_type_id => { type => 'integer', not_null => 1 }, + projectnumber => { type => 'text' }, + start_date => { type => 'date' }, + timeframe => { type => 'boolean', default => 'false', not_null => 1 }, + type => { type => 'text' }, + valid => { type => 'boolean', default => 'true' }, ); __PACKAGE__->meta->primary_key_columns([ 'id' ]); @@ -36,6 +45,21 @@ __PACKAGE__->meta->foreign_keys( class => 'SL::DB::ProjectType', key_columns => { project_type_id => 'id' }, }, + + billable_customer => { + class => 'SL::DB::Customer', + key_columns => { billable_customer_id => 'id' }, + }, + + customer => { + class => 'SL::DB::Customer', + key_columns => { customer_id => 'id' }, + }, + + project_type => { + class => 'SL::DB::ProjectType', + key_columns => { project_type_id => 'id' }, + }, ); 1; diff --git a/SL/DB/MetaSetup/ProjectParticipant.pm b/SL/DB/MetaSetup/ProjectParticipant.pm new file mode 100644 index 000000000..b58a66302 --- /dev/null +++ b/SL/DB/MetaSetup/ProjectParticipant.pm @@ -0,0 +1,44 @@ +# This file has been auto-generated. Do not modify it; it will be overwritten +# by rose_auto_create_model.pl automatically. +package SL::DB::ProjectParticipant; + +use strict; + +use base qw(SL::DB::Object); + +__PACKAGE__->meta->setup( + table => 'project_participants', + + columns => [ + id => { type => 'serial', not_null => 1 }, + project_id => { type => 'integer', not_null => 1 }, + employee_id => { type => 'integer', not_null => 1 }, + project_role_id => { type => 'integer', not_null => 1 }, + minutes => { type => 'integer', default => '0', not_null => 1 }, + cost_per_hour => { type => 'numeric', precision => 5, scale => 15 }, + itime => { type => 'timestamp', default => '06.05.2013 14:26:18.81159' }, + mtime => { type => 'timestamp' }, + ], + + primary_key_columns => [ 'id' ], + + foreign_keys => [ + employee => { + class => 'SL::DB::Employee', + key_columns => { employee_id => 'id' }, + }, + + project => { + class => 'SL::DB::Project', + key_columns => { project_id => 'id' }, + }, + + project_role => { + class => 'SL::DB::ProjectRole', + key_columns => { project_role_id => 'id' }, + }, + ], +); + +1; +; diff --git a/SL/DB/MetaSetup/ProjectPhaseParticipant.pm b/SL/DB/MetaSetup/ProjectPhaseParticipant.pm new file mode 100644 index 000000000..be9749542 --- /dev/null +++ b/SL/DB/MetaSetup/ProjectPhaseParticipant.pm @@ -0,0 +1,39 @@ +# This file has been auto-generated. Do not modify it; it will be overwritten +# by rose_auto_create_model.pl automatically. +package SL::DB::ProjectPhaseParticipant; + +use strict; + +use base qw(SL::DB::Object); + +__PACKAGE__->meta->setup( + table => 'project_phase_participants', + + columns => [ + id => { type => 'serial', not_null => 1 }, + project_phase_id => { type => 'integer', not_null => 1 }, + employee_id => { type => 'integer', not_null => 1 }, + project_role_id => { type => 'integer', not_null => 1 }, + minutes => { type => 'integer', default => '0', not_null => 1 }, + cost_per_hour => { type => 'numeric', precision => 5, scale => 15 }, + itime => { type => 'timestamp', default => '06.05.2013 14:26:18.81159' }, + mtime => { type => 'timestamp' }, + ], + + primary_key_columns => [ 'id' ], + + foreign_keys => [ + employee => { + class => 'SL::DB::Employee', + key_columns => { employee_id => 'id' }, + }, + + project_role => { + class => 'SL::DB::ProjectRole', + key_columns => { project_role_id => 'id' }, + }, + ], +); + +1; +; diff --git a/SL/DB/MetaSetup/ProjectRole.pm b/SL/DB/MetaSetup/ProjectRole.pm new file mode 100644 index 000000000..f9476a033 --- /dev/null +++ b/SL/DB/MetaSetup/ProjectRole.pm @@ -0,0 +1,25 @@ +# This file has been auto-generated. Do not modify it; it will be overwritten +# by rose_auto_create_model.pl automatically. +package SL::DB::ProjectRole; + +use strict; + +use base qw(SL::DB::Object); + +__PACKAGE__->meta->setup( + table => 'project_roles', + + columns => [ + id => { type => 'serial', not_null => 1 }, + name => { type => 'text', not_null => 1 }, + description => { type => 'text', not_null => 1 }, + position => { type => 'integer', not_null => 1 }, + itime => { type => 'timestamp', default => '06.05.2013 14:26:18.81159' }, + mtime => { type => 'timestamp' }, + ], + + primary_key_columns => [ 'id' ], +); + +1; +; diff --git a/SL/DB/MetaSetup/ProjectStatus.pm b/SL/DB/MetaSetup/ProjectStatus.pm new file mode 100644 index 000000000..dbf77346c --- /dev/null +++ b/SL/DB/MetaSetup/ProjectStatus.pm @@ -0,0 +1,33 @@ +# This file has been auto-generated. Do not modify it; it will be overwritten +# by rose_auto_create_model.pl automatically. +package SL::DB::ProjectStatus; + +use strict; + +use base qw(SL::DB::Object); + +__PACKAGE__->meta->setup( + table => 'project_status', + + columns => [ + id => { type => 'serial', not_null => 1 }, + name => { type => 'text', not_null => 1 }, + description => { type => 'text', not_null => 1 }, + position => { type => 'integer', not_null => 1 }, + itime => { type => 'timestamp', default => '06.05.2013 14:26:18.81159' }, + mtime => { type => 'timestamp' }, + ], + + primary_key_columns => [ 'id' ], + + relationships => [ + project => { + class => 'SL::DB::Project', + column_map => { id => 'project_status_id' }, + type => 'one to many', + }, + ], +); + +1; +; diff --git a/SL/DB/MetaSetup/ProjectType.pm b/SL/DB/MetaSetup/ProjectType.pm index 3d452ccc8..cbe78baa0 100644 --- a/SL/DB/MetaSetup/ProjectType.pm +++ b/SL/DB/MetaSetup/ProjectType.pm @@ -11,6 +11,7 @@ __PACKAGE__->meta->table('project_types'); __PACKAGE__->meta->columns( description => { type => 'text' }, id => { type => 'serial', not_null => 1 }, + internal => { type => 'boolean', default => 'false', not_null => 1 }, position => { type => 'integer', not_null => 1 }, ); diff --git a/SL/DB/ProjectParticipant.pm b/SL/DB/ProjectParticipant.pm new file mode 100644 index 000000000..5b4ada2f0 --- /dev/null +++ b/SL/DB/ProjectParticipant.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::ProjectParticipant; + +use strict; + +use SL::DB::MetaSetup::ProjectParticipant; + +# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all. +__PACKAGE__->meta->make_manager_class; + +1; diff --git a/SL/DB/ProjectPhaseParticipant.pm b/SL/DB/ProjectPhaseParticipant.pm new file mode 100644 index 000000000..67c7939b7 --- /dev/null +++ b/SL/DB/ProjectPhaseParticipant.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::ProjectPhaseParticipant; + +use strict; + +use SL::DB::MetaSetup::ProjectPhaseParticipant; + +# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all. +__PACKAGE__->meta->make_manager_class; + +1; diff --git a/SL/DB/ProjectRole.pm b/SL/DB/ProjectRole.pm new file mode 100644 index 000000000..444d11117 --- /dev/null +++ b/SL/DB/ProjectRole.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::ProjectRole; + +use strict; + +use SL::DB::MetaSetup::ProjectRole; + +# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all. +__PACKAGE__->meta->make_manager_class; + +1; diff --git a/SL/DB/ProjectStatus.pm b/SL/DB/ProjectStatus.pm new file mode 100644 index 000000000..fed4bedc1 --- /dev/null +++ b/SL/DB/ProjectStatus.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::ProjectStatus; + +use strict; + +use SL::DB::MetaSetup::ProjectStatus; + +# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all. +__PACKAGE__->meta->make_manager_class; + +1; diff --git a/sql/Pg-upgrade2/project_bob_attributes.sql b/sql/Pg-upgrade2/project_bob_attributes.sql new file mode 100644 index 000000000..07bcec0d1 --- /dev/null +++ b/sql/Pg-upgrade2/project_bob_attributes.sql @@ -0,0 +1,92 @@ +-- @tag: project_bob_attributes +-- @description: Projekte: Zusätzliche Tabellen und Spalten +-- @depends: project_customer_type_valid +-- @charset: utf-8 + +-- changes over bob: +-- no scon/support_contract values here +-- no include or expclude flags for workload +-- statuses renamed to status (we dont use rails weird plurals) +-- created_at/updated_at renamed to itime/mtime, +-- varchars retyped to text +-- hours (numeric) changed to minutes (integer) since the code already calculates in minutes +-- note: flags changing the behaviour of hours are still called so and not minutes +-- no refcounts. we use adhoc counts to decide wether delete is possible or not +-- no hour_approval +-- nothing relevant to notifications + + + + +CREATE TABLE project_status ( + id SERIAL NOT NULL PRIMARY KEY, + name TEXT NOT NULL, + description TEXT NOT NULL, + position INTEGER NOT NULL, + itime TIMESTAMP DEFAULT 'now()', + mtime TIMESTAMP +); + +ALTER TABLE project ADD COLUMN start_date DATE; +ALTER TABLE project ADD COLUMN end_date DATE; +ALTER TABLE project ADD COLUMN billable_customer_id INTEGER REFERENCES customer(id); +ALTER TABLE project ADD COLUMN budget_cost NUMERIC(15,5) NOT NULL DEFAULT 0; +ALTER TABLE project ADD COLUMN order_value NUMERIC(15,5) NOT NULL DEFAULT 0; +ALTER TABLE project ADD COLUMN budget_minutes INTEGER NOT NULL DEFAULT 0; +ALTER TABLE project ADD COLUMN timeframe BOOLEAN NOT NULL DEFAULT FALSE; +ALTER TABLE project ADD COLUMN project_status_id INTEGER REFERENCES project_status(id); + +ALTER TABLE project_types ADD COLUMN internal BOOLEAN NOT NULL DEFAULT FALSE; + +CREATE TABLE project_phases ( + id SERIAL NOT NULL PRIMARY KEY, + project_id INTEGER REFERENCES project(id), + start_date DATE, + end_date DATE, + name TEXT NOT NULL, + description TEXT NOT NULL, + budget_minutes INTEGER NOT NULL DEFAULT 0, + budget_cost NUMERIC (15,5) NOT NULL DEFAULT 0, + general_minutes INTEGER NOT NULL DEFAULT 0, + general_cost_per_hour NUMERIC (15,5) NOT NULL DEFAULT 0, + itime TIMESTAMP DEFAULT 'now()', + mtime TIMESTAMP +); + +CREATE TABLE project_roles ( + id SERIAL NOT NULL PRIMARY KEY, + name TEXT NOT NULL, + description TEXT NOT NULL, + position INTEGER NOT NULL, + itime TIMESTAMP DEFAULT 'now()', + mtime TIMESTAMP +); + +CREATE TABLE project_participants ( + id SERIAL NOT NULL PRIMARY KEY, + project_id INTEGER NOT NULL REFERENCES project(id), + employee_id INTEGER NOT NULL REFERENCES employee(id), + project_role_id INTEGER NOT NULL REFERENCES project_roles(id), + minutes INTEGER NOT NULL DEFAULT 0, + cost_per_hour NUMERIC (15,5), + itime TIMESTAMP DEFAULT 'now()', + mtime TIMESTAMP +); + +CREATE TABLE project_phase_participants ( + id SERIAL NOT NULL PRIMARY KEY, + project_phase_id INTEGER NOT NULL REFERENCES project_phases(id), + employee_id INTEGER NOT NULL REFERENCES employee(id), + project_role_id INTEGER NOT NULL REFERENCES project_roles(id), + minutes INTEGER NOT NULL DEFAULT 0, + cost_per_hour NUMERIC (15,5), + itime TIMESTAMP DEFAULT 'now()', + mtime TIMESTAMP +); + +CREATE TRIGGER mtime_project_status BEFORE UPDATE ON project_status FOR EACH ROW EXECUTE PROCEDURE set_mtime(); +CREATE TRIGGER mtime_project_phases BEFORE UPDATE ON project_phases FOR EACH ROW EXECUTE PROCEDURE set_mtime(); +CREATE TRIGGER mtime_project_roles BEFORE UPDATE ON project_roles FOR EACH ROW EXECUTE PROCEDURE set_mtime(); +CREATE TRIGGER mtime_project_participants BEFORE UPDATE ON project_participants FOR EACH ROW EXECUTE PROCEDURE set_mtime(); +CREATE TRIGGER mtime_project_phase_paticipants BEFORE UPDATE ON project_phase_participants FOR EACH ROW EXECUTE PROCEDURE set_mtime(); +