Skip to content
Browse files

Added missing files

  • Loading branch information...
1 parent 3224d08 commit 856e80ad1c5648455578ebd08f781cac9315c7b3 @sussdorff sussdorff committed Feb 11, 2012
View
30 sql/postgresql/upgrade/upgrade-4.0.1.0.2-4.0.1.0.3.sql
@@ -0,0 +1,30 @@
+--
+-- packages/intranet-timesheet2-tasks/sql/postgresql/upgrade/upgrade-4.0.1.0.2-4.0.1.0.3.sql
+--
+-- Copyright (c) 2011, cognovís GmbH, Hamburg, Germany
+-- This program is free software: you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation, either version 3 of the License, or
+-- (at your option) any later version.
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program. If not, see <http://www.gnu.org/licenses/>.
+--
+-- @author Malte Sussdorff (malte.sussdorff@cognovis.de)
+-- @creation-date 2011-04-18
+-- @cvs-id $Id$
+--
+
+SELECT acs_log__debug('/packages/intranet-timesheet2-tasks/sql/postgresql/upgrade/upgrade-4.0.1.0.2-4.0.1.0.3.sql','');
+
+update im_view_columns set column_name = '#intranet-timesheet2-tasks.CC#' where column_id = 91006;
+update im_view_columns set column_name = '#intranet-timesheet2-tasks.Start#' where column_id = 91007;
+update im_view_columns set column_name = '#intranet-timesheet2-tasks.End#' where column_id = 91008;
+update im_view_columns set column_name = '#intranet-timesheet2-tasks.Plan#' where column_id = 91010;
+update im_view_columns set column_name = '#intranet-timesheet2-tasks.Status#' where column_id = 91018;
+update im_view_columns set column_name = '#intranet-timesheet2-tasks.Log#' where column_id = 91014;
+update im_view_columns set column_name = '#intranet-timesheet2-tasks.Done#' where column_id = 91021
View
172 sql/postgresql/upgrade/upgrade-4.0.1.0.3-4.0.1.0.4.sql
@@ -0,0 +1,172 @@
+-- upgrade-4.0.1.0.3-4.0.1.0.4.sql
+SELECT acs_log__debug('/packages/intranet-timesheet2-tasks/sql/postgresql/upgrade/upgrade-4.0.1.0.3-4.0.1.0.4.sql','') from dual;
+
+
+-- Remove im_timesheet_task dynfield attributes: project_status_id and project_type_id
+
+CREATE OR REPLACE FUNCTION inline_0 ()
+RETURNS integer AS '
+DECLARE
+ v_attribute_id integer;
+ v_count integer;
+BEGIN
+ SELECT ida.attribute_id INTO v_attribute_id FROM im_dynfield_attributes ida, acs_attributes aa
+ WHERE ida.acs_attribute_id = aa.attribute_id AND aa.object_type = ''im_timesheet_task'' AND aa.attribute_name = ''project_status_id'';
+
+ PERFORM im_dynfield_attribute__del(v_attribute_id);
+
+
+ SELECT ida.attribute_id INTO v_attribute_id FROM im_dynfield_attributes ida, acs_attributes aa
+ WHERE ida.acs_attribute_id = aa.attribute_id AND aa.object_type = ''im_timesheet_task'' AND aa.attribute_name = ''project_type_id'';
+
+ PERFORM im_dynfield_attribute__del(v_attribute_id);
+
+ RETURN 0;
+END;' language 'plpgsql';
+
+SELECT inline_0();
+DROP FUNCTION inline_0();
+
+
+-- Add New im_timesheet_task dynfield attributes: task_status_id and task_type_id
+
+--task_status_id
+CREATE OR REPLACE FUNCTION inline_4 ()
+RETURNS integer AS '
+DECLARE
+ v_attribute_id integer;
+ v_count integer;
+
+BEGIN
+ PERFORM im_dynfield_widget__new (
+ null,
+ ''im_dynfield_widget'',
+ now(),
+ null,
+ null,
+ null,
+ ''task_status'',
+ ''Task Status'',
+ ''Task Status'',
+ 10007,
+ ''integer'',
+ ''generic_tcl'',
+ ''integer'',
+ ''{custom {category_type "Intranet Timesheet Task Status"}}'',
+ ''im_name_from_id''
+ );
+
+ SELECT ida.attribute_id INTO v_attribute_id FROM im_dynfield_attributes ida, acs_attributes aa
+ WHERE ida.acs_attribute_id = aa.attribute_id AND aa.object_type = ''im_timesheet_task'' AND aa.attribute_name = ''task_status_id'';
+
+ IF v_attribute_id > 0 THEN
+ UPDATE acs_attributes SET pretty_name = ''Task Status'', pretty_plural = ''Task Status'', min_n_values = 1, sort_order = 4
+ WHERE attribute_id = (SELECT acs_attribute_id FROM im_dynfield_attributes WHERE attribute_id = v_attribute_id);
+
+ UPDATE im_dynfield_attributes SET widget_name = ''task_status'', also_hard_coded_p = ''f'' WHERE attribute_id = v_attribute_id;
+ ELSE
+ v_attribute_id := im_dynfield_attribute_new (
+ ''im_timesheet_task'',
+ ''task_status_id'',
+ ''Task Status'',
+ ''task_status'',
+ ''integer'',
+ ''t'',
+ 4,
+ ''f'',
+ ''im_timesheet_tasks''
+ );
+
+ -- Add column on table im_timesheet_tasks
+ ALTER TABLE im_timesheet_tasks ADD COLUMN task_status_id integer;
+ END IF;
+
+ RETURN 0;
+END;' language 'plpgsql';
+
+
+SELECT inline_4 ();
+DROP FUNCTION inline_4 ();
+
+-- task_type_id
+CREATE OR REPLACE FUNCTION inline_5 ()
+RETURNS integer AS '
+DECLARE
+ v_attribute_id integer;
+ v_count integer;
+
+BEGIN
+ PERFORM im_dynfield_widget__new (
+ null,
+ ''im_dynfield_widget'',
+ now(),
+ null,
+ null,
+ null,
+ ''task_type'',
+ ''Task Type'',
+ ''Task Types'',
+ 10007,
+ ''integer'',
+ ''generic_tcl'',
+ ''integer'',
+ ''{custom {category_type "Intranet Timesheet Task Type"}}'',
+ ''im_name_from_id''
+ );
+
+ SELECT ida.attribute_id INTO v_attribute_id FROM im_dynfield_attributes ida, acs_attributes aa
+ WHERE ida.acs_attribute_id = aa.attribute_id AND aa.object_type = ''im_timesheet_task'' AND aa.attribute_name = ''task_type_id'';
+
+ IF v_attribute_id > 0 THEN
+ UPDATE acs_attributes SET pretty_name = ''Task Type'', pretty_plural = ''Task Type'', min_n_values = 1, sort_order = 5
+ WHERE attribute_id = (SELECT acs_attribute_id FROM im_dynfield_attributes WHERE attribute_id = v_attribute_id);
+
+ UPDATE im_dynfield_attributes SET widget_name = ''task_type'', also_hard_coded_p = ''f'' WHERE attribute_id = v_attribute_id;
+
+ ELSE
+ v_attribute_id := im_dynfield_attribute_new (
+ ''im_timesheet_task'',
+ ''task_type_id'',
+ ''Task Type'',
+ ''task_type'',
+ ''integer'',
+ ''f'',
+ 5,
+ ''f'',
+ ''im_timesheet_tasks''
+ );
+ -- Add column on table im_timesheet_tasks
+ ALTER TABLE im_timesheet_tasks ADD COLUMN task_type_id integer;
+ END IF;
+
+
+ SELECT count(*) INTO v_count FROM im_dynfield_type_attribute_map
+ WHERE attribute_id = v_attribute_id AND (object_type_id = 100 OR object_type_id = 9500);
+
+ -- Set default object_type_id for tasks as 9500 instead of 100
+ IF v_count = 0 THEN
+ INSERT INTO im_dynfield_type_attribute_map
+ (attribute_id, object_type_id, display_mode, help_text, section_heading, default_value, required_p)
+ VALUES
+ (v_attribute_id, 9500, ''none'', null, null, null, ''t'');
+ ELSE
+ UPDATE im_dynfield_type_attribute_map SET object_type_id = 9500, display_mode = ''none'', required_p = ''t'' WHERE attribute_id = v_attribute_id AND object_type_id = 100;
+ END IF;
+
+ RETURN 0;
+END;' language 'plpgsql';
+
+
+SELECT inline_5 ();
+DROP FUNCTION inline_5 ();
+
+
+-- Task Status Category "Closed"
+SELECT im_category_new (9601,'Closed','Intranet Timesheet Task Status');
+
+UPDATE im_timesheet_tasks SET task_type_id = 9500;
+
+UPDATE im_timesheet_tasks SET task_status_id = 9600 where task_id in (select project_id from im_projects where project_status_id = 76);
+UPDATE im_timesheet_tasks SET task_status_id = 9601 where task_id in (select project_id from im_projects where project_status_id = 81);
+
+UPDATE im_menus SET url = '/intranet-timesheet2-tasks/index?view_name=im_timesheet_task_list&task_status_id=9600' WHERE package_name = 'intranet-timesheet2-tasks' AND label = 'project_timesheet_task' AND name = 'Tasks';
View
88 sql/postgresql/upgrade/upgrade-4.0.1.0.4-4.0.1.0.5.sql
@@ -0,0 +1,88 @@
+--
+--
+--
+-- Copyright (c) 2011, cognovís GmbH, Hamburg, Germany
+-- This program is free software: you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation, either version 3 of the License, or
+-- (at your option) any later version.
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program. If not, see <http://www.gnu.org/licenses/>.
+--
+-- @author Malte Sussdorff (malte.sussdorff@cognovis.de)
+-- @creation-date 2011-06-24
+-- @cvs-id $Id$
+--
+
+SELECT acs_log__debug('/packages/intranet-timesheet2-tasks/sql/postgresql/upgrade/upgrade-4.0.1.0.4-4.0.1.0.5.sql','');
+
+create or replace function im_timesheet_task__new (
+ integer, varchar, timestamptz, integer, varchar, integer,
+ varchar, varchar, integer, integer, integer, integer, integer, integer, varchar
+) returns integer as '
+declare
+ p_task_id alias for $1; -- timesheet task_id default null
+ p_object_type alias for $2; -- object_type default ''im_timesheet task''
+ p_creation_date alias for $3; -- creation_date default now()
+ p_creation_user alias for $4; -- creation_user
+ p_creation_ip alias for $5; -- creation_ip default null
+ p_context_id alias for $6; -- context_id default null
+
+ p_task_nr alias for $7;
+ p_task_name alias for $8;
+ p_project_id alias for $9;
+ p_material_id alias for $10;
+ p_cost_center_id alias for $11;
+ p_uom_id alias for $12;
+ p_task_type_id alias for $13;
+ p_task_status_id alias for $14;
+ p_description alias for $15;
+
+ v_task_id integer;
+ v_company_id integer;
+begin
+ select p.company_id into v_company_id from im_projects p
+ where p.project_id = p_project_id;
+
+ v_task_id := im_project__new (
+ p_task_id, -- object_id
+ p_object_type, -- object_type
+ p_creation_date, -- creation_date
+ p_creation_user, -- creation_user
+ p_creation_ip, -- creation_ip
+ p_context_id, -- context_id
+
+ p_task_name, -- project_name
+ p_task_nr, -- project_nr
+ p_task_nr, -- project_path
+ p_project_id, -- parent_id
+ v_company_id, -- company_id
+ 100, -- project_type
+ 76 -- project_status
+ );
+
+ update im_projects
+ set description = p_description
+ where project_id = v_task_id;
+
+ insert into im_timesheet_tasks (
+ task_id,
+ material_id,
+ uom_id,
+ cost_center_id
+ ) values (
+ v_task_id,
+ p_material_id,
+ p_uom_id,
+ p_cost_center_id
+ );
+
+ return v_task_id;
+end;' language 'plpgsql';
+
+
View
92 sql/postgresql/upgrade/upgrade-4.0.1.0.5-4.0.1.0.6.sql
@@ -0,0 +1,92 @@
+--
+-- packages/intranet-timesheet2-tasks/sql/postgresql/upgrade/upgrade-4.0.1.0.5-4.0.1.0.6.sql
+--
+-- Copyright (c) 2011, cognovís GmbH, Hamburg, Germany
+-- This program is free software: you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation, either version 3 of the License, or
+-- (at your option) any later version.
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program. If not, see <http://www.gnu.org/licenses/>.
+--
+-- @author Malte Sussdorff (malte.sussdorff@cognovis.de)
+-- @creation-date 2011-08-08
+--
+
+SELECT acs_log__debug('/packages/intranet-timesheet2-tasks/sql/postgresql/upgrade/upgrade-4.0.1.0.5-4.0.1.0.6.sql','');
+
+update acs_object_types set status_column = 'task_status_id', type_column = 'task_type_id', status_type_table = 'im_timesheet_tasks' where object_type = 'im_timesheet_task';
+update im_timesheet_tasks set task_type_id = 9500 where task_type_id is null;
+
+create or replace function im_timesheet_task__new (
+ integer, varchar, timestamptz, integer, varchar, integer,
+ varchar, varchar, integer, integer, integer, integer, integer, integer, varchar
+) returns integer as '
+declare
+ p_task_id alias for $1; -- timesheet task_id default null
+ p_object_type alias for $2; -- object_type default ''im_timesheet task''
+ p_creation_date alias for $3; -- creation_date default now()
+ p_creation_user alias for $4; -- creation_user
+ p_creation_ip alias for $5; -- creation_ip default null
+ p_context_id alias for $6; -- context_id default null
+
+ p_task_nr alias for $7;
+ p_task_name alias for $8;
+ p_project_id alias for $9;
+ p_material_id alias for $10;
+ p_cost_center_id alias for $11;
+ p_uom_id alias for $12;
+ p_task_type_id alias for $13;
+ p_task_status_id alias for $14;
+ p_description alias for $15;
+
+ v_task_id integer;
+ v_company_id integer;
+begin
+ select p.company_id into v_company_id from im_projects p
+ where p.project_id = p_project_id;
+
+ v_task_id := im_project__new (
+ p_task_id, -- object_id
+ p_object_type, -- object_type
+ p_creation_date, -- creation_date
+ p_creation_user, -- creation_user
+ p_creation_ip, -- creation_ip
+ p_context_id, -- context_id
+
+ p_task_name, -- project_name
+ p_task_nr, -- project_nr
+ p_task_nr, -- project_path
+ p_project_id, -- parent_id
+ v_company_id, -- company_id
+ 100, -- project_type
+ 76 -- project_status
+ );
+
+ update im_projects
+ set description = p_description
+ where project_id = v_task_id;
+
+ insert into im_timesheet_tasks (
+ task_id,
+ material_id,
+ uom_id,
+ cost_center_id,
+ task_type_id,
+ task_status_id
+ ) values (
+ v_task_id,
+ p_material_id,
+ p_uom_id,
+ p_cost_center_id,
+ p_task_type_id,
+ p_task_status_id
+ );
+
+ return v_task_id;
+end;' language 'plpgsql';

0 comments on commit 856e80a

Please sign in to comment.
Something went wrong with that request. Please try again.