Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
intranet-core
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
project-open
intranet-core
Commits
749bbdd4
Commit
749bbdd4
authored
Feb 05, 2017
by
Frank Bergmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Integrated upgrade scripts
parent
52063c30
Changes
15
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
2241 additions
and
140 deletions
+2241
-140
01-flat-table-import.sql
import_sql/flat-table-import/01-flat-table-import.sql
+0
-1
intranet-categories.sql
sql/common/intranet-categories.sql
+2
-2
intranet-components.sql
sql/oracle/intranet-components.sql
+6
-6
intranet-audit-create.sql
sql/postgresql/intranet-audit-create.sql
+4
-2
intranet-biz-objects.sql
sql/postgresql/intranet-biz-objects.sql
+1
-1
intranet-categories.sql
sql/postgresql/intranet-categories.sql
+35
-2
intranet-companies.sql
sql/postgresql/intranet-companies.sql
+2
-2
intranet-components.sql
sql/postgresql/intranet-components.sql
+585
-1
intranet-defs.sql
sql/postgresql/intranet-defs.sql
+1
-1
intranet-menus.sql
sql/postgresql/intranet-menus.sql
+968
-41
intranet-openacs-patches.sql
sql/postgresql/intranet-openacs-patches.sql
+516
-0
intranet-permissions.sql
sql/postgresql/intranet-permissions.sql
+3
-9
intranet-projects.sql
sql/postgresql/intranet-projects.sql
+61
-5
intranet-users.sql
sql/postgresql/intranet-users.sql
+57
-66
intranet-views.sql
sql/postgresql/intranet-views.sql
+0
-1
No files found.
import_sql/flat-table-import/01-flat-table-import.sql
View file @
749bbdd4
...
...
@@ -549,7 +549,6 @@ BEGIN
corporate_sponsor = lookup_user(row.corporate_sponsor,
''
import_projects.corporate_sponsor
''
),
on_track_status_id = import_cat(row.on_track_status,
''
Intranet Project On Track Status
''
),
project_budget = row.project_budget::numeric,
project_budget_currency = row.project_budget_currency,
project_budget_hours = row.project_budget_hours::numeric,
start_date = row.start_date::date,
end_date = row.end_date::date,
...
...
sql/common/intranet-categories.sql
View file @
749bbdd4
...
...
@@ -448,8 +448,8 @@ where category = 'Glossary Compilation' and category_type = 'Intranet Project Ty
update
im_categories
set
category_description
=
'Translation project with a sample dynamic workflow (test/demo)'
where
category
=
'Trans Only (Dynamic WF)'
and
category_type
=
'Intranet Project Type'
;
update
im_categories
set
category_description
=
'Generic
consulting
project or any other project based on a Gantt schedule and Gantt tasks'
where
category
=
'
Consulting
Project'
and
category_type
=
'Intranet Project Type'
;
update
im_categories
set
category_description
=
'Generic project or any other project based on a Gantt schedule and Gantt tasks'
where
category
=
'
Gantt
Project'
and
category_type
=
'Intranet Project Type'
;
update
im_categories
set
category_description
=
'Strategic consulting '
where
category
=
'Strategic Consulting'
and
category_type
=
'Intranet Project Type'
;
update
im_categories
set
category_description
=
'Ongoing software maintenance'
...
...
sql/oracle/intranet-components.sql
View file @
749bbdd4
...
...
@@ -208,7 +208,7 @@ begin
--
v_plugin
:
=
im_component_plugin
.
new
(
plugin_name
=>
'Project Members'
,
package_name
=>
'intranet'
,
package_name
=>
'intranet
-core
'
,
page_url
=>
'/intranet/projects/view'
,
location
=>
'right'
,
sort_order
=>
20
,
...
...
@@ -237,7 +237,7 @@ declare
begin
v_plugin
:
=
im_component_plugin
.
new
(
plugin_name
=>
'Office Members'
,
package_name
=>
'intranet'
,
package_name
=>
'intranet
-core
'
,
page_url
=>
'/intranet/offices/view'
,
location
=>
'right'
,
sort_order
=>
20
,
...
...
@@ -268,7 +268,7 @@ begin
-- Office component for CompanyViewPage
v_plugin
:
=
im_component_plugin
.
new
(
plugin_name
=>
'Company Offices'
,
package_name
=>
'intranet'
,
package_name
=>
'intranet
-core
'
,
page_url
=>
'/intranet/companies/view'
,
location
=>
'right'
,
sort_order
=>
30
,
...
...
@@ -292,7 +292,7 @@ begin
-- Office component for UserViewPage
v_plugin
:
=
im_component_plugin
.
new
(
plugin_name
=>
'User Offices'
,
package_name
=>
'intranet'
,
package_name
=>
'intranet
-core
'
,
page_url
=>
'/intranet/users/view'
,
location
=>
'right'
,
sort_order
=>
80
,
...
...
@@ -313,7 +313,7 @@ declare
begin
v_plugin
:
=
im_component_plugin
.
new
(
plugin_name
=>
'Recent Registrations'
,
package_name
=>
'intranet'
,
package_name
=>
'intranet
-core
'
,
page_url
=>
'/intranet/admin/index'
,
location
=>
'right'
,
sort_order
=>
30
,
...
...
@@ -331,7 +331,7 @@ declare
begin
v_plugin
:
=
im_component_plugin
.
new
(
plugin_name
=>
'Home Page Help Blurb'
,
package_name
=>
'intranet'
,
package_name
=>
'intranet
-core
'
,
page_url
=>
'/intranet/index'
,
location
=>
'left'
,
sort_order
=>
10
,
...
...
sql/postgresql/intranet-audit-create.sql
View file @
749bbdd4
...
...
@@ -15,6 +15,8 @@ create table im_audits (
constraint
im_audits_object_nn
not
null
,
audit_object_status_id
integer
,
constraint
im_audits_object_status_fk
references
im_categories
,
audit_action
text
constraint
im_audits_action_ck
check
(
audit_action
in
(
'after_create'
,
'before_update'
,
'after_update'
,
'before_nuke'
,
'view'
,
'baseline'
)),
...
...
@@ -90,7 +92,7 @@ DECLARE
v_expr
text
;
v_result
text
;
BEGIN
v_expr
:
=
p_var_name
||
'
\
\
t([^
\
\
n]*)'
;
v_expr
:
=
p_var_name
||
'
\
t
([^
\n
]*)'
;
select
substring
(
p_audit_value
from
v_expr
)
into
v_result
from
dual
;
IF
''
=
v_result
THEN
v_result
:
=
null
;
END
IF
;
...
...
@@ -119,7 +121,7 @@ BEGIN
aa
.
audit_date
<=
p_audit_date
);
v_expr
:
=
p_var_name
||
'
\
\
t([^
\
\
n]*)'
;
v_expr
:
=
p_var_name
||
'
\
t
([^
\n
]*)'
;
select
substring
(
v_audit_value
from
v_expr
)
into
v_result
from
dual
;
IF
''
=
v_result
THEN
v_result
:
=
null
;
END
IF
;
...
...
sql/postgresql/intranet-biz-objects.sql
View file @
749bbdd4
...
...
@@ -489,7 +489,7 @@ select acs_rel_type__create_type (
'member'
,
-- role_one
0
,
-- min_n_rels_one
null
,
-- max_n_rels_one
'
person
'
,
-- object_type_two
'
acs_object
'
,
-- object_type_two
'member'
,
-- role_two
0
,
-- min_n_rels_two
null
-- max_n_rels_two
...
...
sql/postgresql/intranet-categories.sql
View file @
749bbdd4
...
...
@@ -68,7 +68,8 @@ create table im_categories (
aux_int1
integer
,
aux_int2
integer
,
aux_string1
text
,
aux_string2
text
aux_string2
text
,
visible_tcl
text
);
-- fraber 040320: Don't allow for duplicated entries!
...
...
@@ -239,7 +240,7 @@ BEGIN
end
;
$
body
$
language
'plpgsql'
;
-- Test query
select
im_category_path_to_category
(
83
);
--
select im_category_path_to_category (83);
...
...
@@ -366,6 +367,38 @@ end;$body$ language 'plpgsql';
----------------------------------------------
-- Find a free category_id in a range
--
CREATE
OR
REPLACE
FUNCTION
im_category_find_next_free_id_in_sequence
(
INTEGER
,
INTEGER
)
RETURNS
INTEGER
AS
$
body
$
declare
p_start_seq_id
alias
for
$
1
;
p_stop_seq_id
alias
for
$
2
;
v_count
integer
;
v_category_id
integer
;
begin
-- how many in sequence
select
count
(
*
)
into
v_count
from
im_categories
where
category_id
>
p_start_seq_id
and
category_id
<=
p_stop_seq_id
;
-- none used, return seq_start
IF
0
=
v_count
THEN
return
p_start_seq_id
;
END
IF
;
-- none available in sequence, return 0
IF
v_count
=
(
p_stop_seq_id
-
p_start_seq_id
+
1
)
THEN
return
0
;
END
IF
;
-- there should be at least one free id in sequence, find it:
FOR
i
IN
p_start_seq_id
..
p_stop_seq_id
LOOP
select
count
(
*
)
into
v_category_id
from
im_categories
where
category_id
=
i
;
IF
v_category_id
=
0
THEN
return
i
;
END
IF
;
END
LOOP
;
end
;
$
body
$
LANGUAGE
'plpgsql'
VOLATILE
;
-------------------------------------------------------------
-- Import category definitions common to all DBs
...
...
sql/postgresql/intranet-companies.sql
View file @
749bbdd4
...
...
@@ -323,7 +323,7 @@ create table im_company_employee_rels (
insert
into
acs_rel_types
(
rel_type
,
object_type_one
,
role_one
,
min_n_rels_one
,
max_n_rels_one
,
object_type_two
,
role_two
,
min_n_rels_two
,
max_n_rels_two
object_type_two
,
role_two
,
min_n_rels_two
,
max_n_rels_two
)
values
(
'im_company_employee_rel'
,
'im_company'
,
'employer'
,
'1'
,
NULL
,
...
...
@@ -419,7 +419,7 @@ create table im_key_account_rels (
insert
into
acs_rel_types
(
rel_type
,
object_type_one
,
role_one
,
min_n_rels_one
,
max_n_rels_one
,
object_type_two
,
role_two
,
min_n_rels_two
,
max_n_rels_two
object_type_two
,
role_two
,
min_n_rels_two
,
max_n_rels_two
)
values
(
'im_key_account_rel'
,
'im_company'
,
'company'
,
'1'
,
NULL
,
...
...
sql/postgresql/intranet-components.sql
View file @
749bbdd4
This diff is collapsed.
Click to expand it.
sql/postgresql/intranet-defs.sql
View file @
749bbdd4
...
...
@@ -162,6 +162,7 @@ end;$body$
LANGUAGE
'plpgsql'
;
-- Deal with PostgreSQL 8.4 tighter casting rules
CREATE
OR
REPLACE
FUNCTION
last_day
(
date
)
RETURNS
date
AS
$
body
$
DECLARE
...
...
@@ -173,7 +174,6 @@ begin
return
v_date_out
;
end
;
$
body
$
LANGUAGE
'plpgsql'
;
-- select last_day(to_date('2012-01-20', 'yyyy-mm-dd'));
...
...
sql/postgresql/intranet-menus.sql
View file @
749bbdd4
This diff is collapsed.
Click to expand it.
sql/postgresql/intranet-openacs-patches.sql
View file @
749bbdd4
This diff is collapsed.
Click to expand it.
sql/postgresql/intranet-permissions.sql
View file @
749bbdd4
...
...
@@ -52,7 +52,6 @@ insert into im_biz_object_urls (object_type, url_type, url) values (
'im_profile'
,
'edit'
,
'/admin/groups/one?group_id='
);
-------------------------------------------------------------
-- DB-neutral API for permissions
--
...
...
@@ -328,17 +327,11 @@ DECLARE
v_category_id
integer
;
BEGIN
-- Check that the group does not exist before
select
count
(
*
)
into
n_groups
from
groups
where
group_name
=
v_pretty_name
;
select
count
(
*
)
into
n_groups
from
groups
where
group_name
=
v_pretty_name
;
-- only add the group if it did not exist before...
IF
n_groups
=
0
THEN
v_group_id
:
=
im_profile__new
(
v_pretty_name
,
v_profile_gif
);
v_group_id
:
=
im_profile__new
(
v_pretty_name
,
v_profile_gif
);
v_rel_id
:
=
composition_rel__new
(
null
,
-- rel_id
...
...
@@ -414,6 +407,7 @@ select im_create_profile ('Sales','sales');
select
im_create_profile
(
'HR Managers'
,
'profile'
);
select
im_create_profile
(
'Freelance Managers'
,
'profile'
);
select
im_create_profile
(
'Helpdesk'
,
'computer_key'
);
select
im_create_profile
(
'Skill Profile'
,
'skill_profile'
);
-- Registered Users have fixed ID -1
delete
from
im_profiles
where
profile_id
in
(
-
2
);
...
...
sql/postgresql/intranet-projects.sql
View file @
749bbdd4
...
...
@@ -112,9 +112,6 @@ create table im_projects (
check
(
requires_report_p
in
(
't'
,
'f'
)),
-- Total project budget (top-down planned)
project_budget
float
,
project_budget_currency
char
(
3
)
constraint
im_projects_budget_currency_fk
references
currency_codes
(
iso
),
-- Max number of hours for project.
-- Does not require "view_finance" permission
project_budget_hours
float
,
...
...
@@ -159,7 +156,9 @@ create table im_projects (
-- To be added to the ProjectNewPage via DynField
program_id
integer
constraint
im_projects_program_id
references
im_projects
references
im_projects
,
constraint
im_projects_start_end_chk
check
(
end_date
>=
start_date
)
);
...
...
@@ -537,7 +536,6 @@ END; $body$ LANGUAGE 'plpgsql';
create
or
replace
function
im_project_id_parent_list
(
int4
)
returns
varchar
as
$
body
$
DECLARE
p_project_id
alias
for
$
1
;
...
...
@@ -641,3 +639,61 @@ begin
return
0
;
end
;
$
body
$
language
'plpgsql'
VOLATILE
;
CREATE
OR
REPLACE
FUNCTION
im_project_sub_project_name_path
(
integer
,
boolean
,
boolean
)
RETURNS
character
varying
AS
$
BODY
$
DECLARE
-- Returns a path of project_names -> bottom-up
-- Output of subproject-name itself and top parent project can be surpressed
p_sub_project_id
alias
for
$
1
;
p_exlude_main_project_p
alias
for
$
2
;
p_exlude_sub_project_p
alias
for
$
3
;
v_subproject_id
integer
;
v_parent_id
integer
;
v_project_name
varchar
;
v_ctr
integer
;
v_path
varchar
;
v_slash
varchar
;
BEGIN
v_subproject_id
:
=
p_sub_project_id
;
v_ctr
:
=
0
;
v_path
:
=
''
;
WHILE
v_ctr
<
10
LOOP
select
parent_id
,
project_name
into
v_parent_id
,
v_project_name
from
im_projects
p
where
project_id
=
v_subproject_id
;
IF
v_parent_id
is
not
null
OR
NOT
p_exlude_main_project_p
THEN
v_slash
:
=
'/'
;
IF
''
=
v_project_name
THEN
v_slash
:
=
''
;
RAISE
NOTICE
'v_project_name is empty'
;
END
IF
;
IF
(
v_ctr
=
0
AND
NOT
p_exlude_sub_project_p
)
OR
v_ctr
!=
0
THEN
v_path
:
=
v_project_name
||
v_slash
||
v_path
;
END
IF
;
v_subproject_id
:
=
v_parent_id
;
END
IF
;
IF
v_parent_id
is
null
THEN
EXIT
;
ELSE
v_ctr
:
=
v_ctr
+
1
;
END
IF
;
END
LOOP
;
return
v_path
;
end
;
$
BODY
$
LANGUAGE
'plpgsql'
sql/postgresql/intranet-users.sql
View file @
749bbdd4
...
...
@@ -76,6 +76,7 @@ insert into acs_object_type_tables (object_type,table_name,id_column)
values
(
'user'
,
'users'
,
'user_id'
);
-- Fix bad entries from OpenACS
update
acs_attributes
set
table_name
=
'persons'
...
...
@@ -102,43 +103,43 @@ create table users_contact (
primary
key
constraint
users_contact_pk_fk
references
users
,
home_phone
varchar
(
100
)
,
home_phone
text
,
priv_home_phone
integer
,
work_phone
varchar
(
100
)
,
work_phone
text
,
priv_work_phone
integer
,
cell_phone
varchar
(
100
)
,
cell_phone
text
,
priv_cell_phone
integer
,
pager
varchar
(
100
)
,
pager
text
,
priv_pager
integer
,
fax
varchar
(
100
)
,
fax
text
,
priv_fax
integer
,
-- AOL Instant Messenger
aim_screen_name
varchar
(
50
)
,
aim_screen_name
text
,
priv_aim_screen_name
integer
,
-- MSN Instanet Messenger
msn_screen_name
varchar
(
50
)
,
msn_screen_name
text
,
priv_msn_screen_name
integer
,
-- also ICQ
icq_number
varchar
(
50
)
,
icq_number
text
,
priv_icq_number
integer
,
-- Which address should we mail to?
m_address
char
(
1
)
check
(
m_address
in
(
'w'
,
'h'
)),
-- home address
ha_line1
varchar
(
80
)
,
ha_line2
varchar
(
80
)
,
ha_city
varchar
(
80
)
,
ha_state
varchar
(
80
)
,
ha_postal_code
varchar
(
80
)
,
ha_line1
text
,
ha_line2
text
,
ha_city
text
,
ha_state
text
,
ha_postal_code
text
,
ha_country_code
char
(
2
)
constraint
users_contact_ha_cc_fk
references
country_codes
(
iso
),
priv_ha
integer
,
-- work address
wa_line1
varchar
(
80
)
,
wa_line2
varchar
(
80
)
,
wa_city
varchar
(
80
)
,
wa_state
varchar
(
80
)
,
wa_postal_code
varchar
(
80
)
,
wa_line1
text
,
wa_line2
text
,
wa_city
text
,
wa_state
text
,
wa_postal_code
text
,
wa_country_code
char
(
2
)
constraint
users_contact_wa_cc_fk
references
country_codes
(
iso
),
...
...
@@ -148,56 +149,20 @@ create table users_contact (
current_information
text
);
------------------------------------------------------
-- A unified view on active users
-- (not deleted or banned)
-- A unified view on active users (not deleted or banned)
--
create
or
replace
view
users_active
as
select
u
.
user_id
,
u
.
username
,
u
.
screen_name
,
u
.
last_visit
,
u
.
second_to_last_visit
,
u
.
n_sessions
,
u
.
first_names
,
u
.
last_name
,
c
.
home_phone
,
c
.
priv_home_phone
,
c
.
work_phone
,
c
.
priv_work_phone
,
c
.
cell_phone
,
c
.
priv_cell_phone
,
c
.
pager
,
c
.
priv_pager
,
c
.
fax
,
c
.
priv_fax
,
c
.
aim_screen_name
,
c
.
priv_aim_screen_name
,
c
.
msn_screen_name
,
c
.
priv_msn_screen_name
,
c
.
icq_number
,
c
.
priv_icq_number
,
c
.
m_address
,
c
.
ha_line1
,
c
.
ha_line2
,
c
.
ha_city
,
c
.
ha_state
,
c
.
ha_postal_code
,
c
.
ha_country_code
,
c
.
priv_ha
,
c
.
wa_line1
,
c
.
wa_line2
,
c
.
wa_city
,
c
.
wa_state
,
c
.
wa_postal_code
,
c
.
wa_country_code
,
c
.
priv_wa
,
c
.
note
,
c
.
current_information
from
registered_users
u
left
outer
join
users_contact
c
on
u
.
user_id
=
c
.
user_id
;
u
.
user_id
,
u
.
username
,
u
.
screen_name
,
u
.
last_visit
,
u
.
second_to_last_visit
,
u
.
n_sessions
,
u
.
first_names
,
u
.
last_name
,
c
.
home_phone
,
c
.
priv_home_phone
,
c
.
work_phone
,
c
.
priv_work_phone
,
c
.
cell_phone
,
c
.
priv_cell_phone
,
c
.
pager
,
c
.
priv_pager
,
c
.
fax
,
c
.
priv_fax
,
c
.
aim_screen_name
,
c
.
priv_aim_screen_name
,
c
.
msn_screen_name
,
c
.
priv_msn_screen_name
,
c
.
icq_number
,
c
.
priv_icq_number
,
c
.
m_address
,
c
.
ha_line1
,
c
.
ha_line2
,
c
.
ha_city
,
c
.
ha_state
,
c
.
ha_postal_code
,
c
.
ha_country_code
,
c
.
priv_ha
,
c
.
wa_line1
,
c
.
wa_line2
,
c
.
wa_city
,
c
.
wa_state
,
c
.
wa_postal_code
,
c
.
wa_country_code
,
c
.
priv_wa
,
c
.
note
,
c
.
current_information
from
registered_users
u
left
outer
join
users_contact
c
on
u
.
user_id
=
c
.
user_id
;
-- ToDo: Localize this function for Japanese
...
...
@@ -215,6 +180,34 @@ BEGIN
return
v_full_name
;
END
;
$
body
$
language
'plpgsql'
;
create
or
replace
function
im_name_from_user_id
(
int4
,
int4
)
returns
varchar
as
$
body
$
DECLARE
v_user_id
alias
for
$
1
;
v_name_order
alias
for
$
2
;
v_full_name
varchar
(
8000
);
BEGIN
IF
2
=
v_name_order
THEN
select
last_name
||
' '
||
first_names
into
v_full_name
from
persons
where
person_id
=
v_user_id
;
ELSEIF
3
=
v_name_order
THEN
select
last_name
||
', '
||
first_names
into
v_full_name
from
persons
where
person_id
=
v_user_id
;
ELSE
select
first_names
||
' '
||
last_name
into
v_full_name
from
persons
where
person_id
=
v_user_id
;
END
IF
;
return
v_full_name
;
END
;
$
body
$
language
'plpgsql'
;
create
or
replace
function
im_email_from_user_id
(
integer
)
returns
varchar
as
$
body
$
DECLARE
...
...
@@ -275,8 +268,6 @@ BEGIN
end
;
$
body
$
language
'plpgsql'
;
-------------------------------------------------------------------
-- Categories
-------------------------------------------------------------------
...
...
sql/postgresql/intranet-views.sql
View file @
749bbdd4
...
...
@@ -81,7 +81,6 @@ create table im_view_columns (
create
unique
index
im_view_columns_columns_un
on
im_view_columns
(
view_id
,
column_id
);
create
unique
index
im_view_columns_name_un
on
im_view_columns
(
view_id
,
column_name
);
SELECT
im_category_new
(
1415
,
'Ajax'
,
'Intranet DynView Type'
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment