Commit caf5c6e5 authored by Frank Bergmann's avatar Frank Bergmann
parents dd50b246 0be8a220
SELECT acs_log__debug('/packages/intranet-cost/sql/postgresql/upgrade/upgrade-5.1.0.0.0-5.1.0.0.1.sql','');
-- There was en error in the creation of the im_costs_project_idx.
-- The index was there with the right name, but indexing cost_type_id.
drop index if exists im_costs_project_idx;
create index im_costs_project_idx on im_costs(project_id);
......@@ -435,11 +435,7 @@ ad_proc -public im_cc_read_p {
if {0 == $user_id} { set user_id [ad_conn user_id] }
if {0 == $cost_center_id} { set cost_center_id [im_cost_center_company] }
if {0 != $cost_type_id} {
set privilege [util_memoize [list db_string priv "
select read_privilege
from im_cost_types
where cost_type_id in (select * from im_sub_categories($cost_type_id))
" -default ""]]
set privilege [util_memoize [list db_string priv "select read_privilege from im_cost_types where cost_type_id = $cost_type_id" -default ""]]
}
if {"" == $privilege} { set privilege "fi_read_all" }
......@@ -471,11 +467,7 @@ ad_proc -public im_cc_write_p {
if {0 == $user_id} { set user_id [ad_conn user_id] }
if {0 == $cost_center_id} { set cost_center_id [im_cost_center_company] }
if {0 != $cost_type_id} {
set privilege [util_memoize [list db_string priv "
select write_privilege
from im_cost_types
where cost_type_id in (select * from im_sub_categories($cost_type_id))
" -default ""]]
set privilege [util_memoize [list db_string priv "select write_privilege from im_cost_types where cost_type_id = $cost_type_id" -default ""]]
}
if {"" == $privilege} { set privilege "fi_write_all" }
......@@ -516,7 +508,7 @@ ad_proc -public im_cost_center_write_p_helper {
return [db_string cc_perms "
select im_object_permission_p(:cost_center_id, :user_id, ct.write_privilege)
from im_cost_types ct
where ct.cost_type_id in (select * from im_sub_categories(:cost_type_id))
where ct.cost_type_id = :cost_type_id
" -default "f"]
}
......
This diff is collapsed.
......@@ -28,17 +28,4 @@
</querytext>
</fullquery>
<fullquery name="cost_center_context_update">
<querytext>
update acs_objects set
context_id = :parent_id
where object_id = :cost_center_id;
</querytext>
</fullquery>
</queryset>
......@@ -111,9 +111,16 @@ ad_form -extend -name cost_center -on_request {
ad_script_abort
}
# 2023-03-13 fraber: context_id passes permissions
# from super cost-centers down the hierarchy, so
# this update is necessary.
# 2014-02-20 fraber: Generates a strange error.
# Why was this necessary in the first place?
# db_dml cost_center_context_update {}
db_dml cost_center_context_update {
update acs_objects set
context_id = :parent_id
where object_id = :cost_center_id
}
im_dynfield::attribute_store \
-object_type "im_cost_center" \
......@@ -147,9 +154,16 @@ ad_form -extend -name cost_center -on_request {
ad_script_abort
}
# 2023-03-13 fraber: context_id passes permissions
# from super cost-centers down the hierarchy, so
# this update is necessary.
# 2014-02-20 fraber: Generates a strange error.
# Why was this necessary in the first place?
# db_dml cost_center_context_update {}
db_dml cost_center_context_update {
update acs_objects set
context_id = :parent_id
where object_id = :cost_center_id
}
im_dynfield::attribute_store \
-object_type "im_cost_center" \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment