Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
intranet-timesheet2-tasks
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-timesheet2-tasks
Commits
074bb8c8
Commit
074bb8c8
authored
Jan 11, 2007
by
Frank Bergmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- fixed bad select statement
parent
a880546e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
79 additions
and
27 deletions
+79
-27
intranet-timesheet2-tasks-procs.tcl
tcl/intranet-timesheet2-tasks-procs.tcl
+79
-27
No files found.
tcl/intranet-timesheet2-tasks-procs.tcl
View file @
074bb8c8
...
...
@@ -117,20 +117,24 @@ ad_proc -public im_timesheet_task_list_component {
return
""
}
}
# Check vertical permissions -
# Is this user allowed to see TS stuff at all?
#
if {![im_permission $user_id "view_timesheet_tasks"
]
}
{
#
return ""
#
}
if
{
!
[
im_permission
$user
_id
"view_timesheet_tasks"
]}
{
return
""
}
# Check horizontal permissions -
# Is the user allowed to see this project?
im_project_permissions
$user
_id
$restrict
_to_project_id view read write admin
if
{
!$read && !
[
im_permission
$user
_id view_timesheet_tasks_all
]}
{
return
""
}
# Check for Timesheet tasks of a certain status.
# The status_id is only available in the previous screen.
# Very Ugly!!
upvar subproject_status_id subproject_status_id
if
{
!
[
info
exists subproject_status_id
]}
{
set subproject_status_id 0
}
if
{
""
==
$subproject
_status_id
}
{
set subproject_status_id 0
}
set subproject_sql
""
if
{
$subproject
_status_id
}
{
set subproject_sql
"and p.project_status_id in (
...
...
@@ -176,17 +180,13 @@ ad_proc -public im_timesheet_task_list_component {
set column_vars
[
list
]
set column_sql
"
select
column_name,
select column_name,
column_render_tcl,
visible_for
from
im_view_columns
where
view_id=:view_id
from im_view_columns
where view_id=:view_id
and group_id is null
order by
sort_order
order by sort_order
"
db_foreach column_list_sql
$column
_sql
{
...
...
@@ -197,8 +197,8 @@ ad_proc -public im_timesheet_task_list_component {
}
ns_log Notice
"im_timesheet_task_component: column_headers=
$column
_headers"
# -------- Compile the list of parameters to pass-through-------
# -------- Compile the list of parameters to pass-through-------
set form_vars
[
ns_conn form
]
if
{
""
==
$form
_vars
}
{
set form_vars
[
ns_set create
]
}
...
...
@@ -209,13 +209,11 @@ ad_proc -public im_timesheet_task_list_component {
ns_set put
$bind
_vars
$var
$value
ns_log Notice
"im_timesheet_task_component:
$var
<-
$value
"
}
else
{
set value
[
ns_set get
$form
_vars
$var
]
if
{
!
[
string
equal
""
$value
]}
{
ns_set put
$bind
_vars
$var
$value
ns_log Notice
"im_timesheet_task_component:
$var
<-
$value
"
}
}
}
...
...
@@ -232,8 +230,8 @@ ad_proc -public im_timesheet_task_list_component {
}
set pass_through_vars_html
[
join
$params
"&"
]
# ---------------------- Format Header ----------------------------------
# ---------------------- Format Header ----------------------------------
# Set up colspan to be the number of headers + 1 for the # column
set colspan
[
expr
[
llength
$column
_headers
]
+ 1
]
...
...
@@ -242,19 +240,16 @@ ad_proc -public im_timesheet_task_list_component {
#
set table_header_html
"<tr>
\n
"
foreach col
$column
_headers
{
set cmd_eval
""
ns_log Notice
"im_timesheet_task_component: eval=
$cmd
_eval
$col
"
set cmd
"set cmd_eval
$col
"
eval
$cmd
append table_header_html
" <td class=rowtitle>
$cmd
_eval</td>
\n
"
}
append table_header_html
"</tr>
\n
"
# ---------------------- Build the SQL query ---------------------------
set order_by_clause
"order by p.project_nr, t.task_id"
set order_by_clause_ext
"order by project_nr, task_id"
switch
$order
_by
{
...
...
@@ -301,6 +296,28 @@ ad_proc -public im_timesheet_task_list_component {
set restriction_clause
"and
$restriction
_clause"
}
# ---------------------- Inner Permission Query -------------------------
# Check permissions for showing subprojects
set children_perm_sql
"
(select p.*
from im_projects p,
acs_rels r
where r.object_id_one = p.project_id
and r.object_id_two = :user_id
)
"
if
{[
im_permission
$user
_id
"view_projects_all"
]}
{
set children_perm_sql
"
(select t.*
from im_projects t
where
$project
_restriction
)
"
}
set projects_perm_sql
"
(select
t.*
...
...
@@ -322,15 +339,50 @@ ad_proc -public im_timesheet_task_list_component {
"
}
set ttt
{
select
t.*,
p.project_id,
p.project_name,
p.project_nr,
p.note,
cc.cost_center_name,
cc.cost_center_code,
im_category_from_id
(
t.task_type_id
)
as task_type,
im_category_from_id
(
t.task_status_id
)
as task_status,
im_category_from_id
(
t.uom_id
)
as uom,
im_material_nr_from_id
(
t.material_id
)
as material_nr,
to_char
(
t.percent_completed, '999990'
)
as percent_completed_rounded
children.project_id as subproject_id,
children.project_nr as subproject_nr,
children.project_name as subproject_name,
im_category_from_id
(
children.project_status_id
)
as subproject_status,
im_category_from_id
(
children.project_type_id
)
as subproject_type,
tree_level
(
children.tree_sortkey
)
-
tree_level
(
parent.tree_sortkey
)
as subproject_level
from
im_projects parent,
$perm
_sql children
where
children.project_type_id not in
([
im_project_type_task
])
$subproject
_status_sql
and children.tree_sortkey between parent.tree_sortkey and tree_right
(
parent.tree_sortkey
)
and parent.project_id = :super_project_id
order by children.tree_sortkey
}
# ---------------------- Get the SQL Query -------------------------
set task_statement
[
db_qd_get_fullname
"task_query"
0
]
set task_sql_uneval
[
db_qd_replace_sql
$task
_statement
{}]
set task_sql
[
expr
"
\"
$task
_sql_uneval
\"
"
]
# ---------------------- Limit query to MAX rows -------------------------
# We can't get around counting in advance if we want to be able to
# sort inside the table on the page for only those rows in the query
# results
...
...
@@ -344,8 +396,8 @@ ad_proc -public im_timesheet_task_list_component {
set remaining_items
[
expr
$total
_in_limited -
$start
_idx -
$max
_entries_per_page
]
ns_log Notice
"im_timesheet_task_component: total_in_limited=
$total
_in_limited, remaining_items=
$remaining
_items"
# ---------------------- Format the body -------------------------------
set table_body_html
""
set ctr 0
set idx
$start
_idx
...
...
@@ -356,6 +408,8 @@ ad_proc -public im_timesheet_task_list_component {
# Compatibility...
set description
$note
set new_task_url
"/intranet-timesheet2-tasks/new?
[
export_url_vars project_id return_url
]
"
# insert intermediate headers for every project!!!
if
{
$include
_subprojects
}
{
if
{
$old
_project_id !=
$project
_id
}
{
...
...
@@ -369,9 +423,7 @@ ad_proc -public im_timesheet_task_list_component {
$project
_name
</A>
</td>
<td align=right>
<a href=
\"
/intranet-timesheet2-tasks/new?
[
export_url_vars project_id return_url
]
\"
>Add a new task</a>
</td>
<td align=right><a href=
\"
$new
_task_url
\"
>Add a new task</a></td>
</tr>
</table>
</td></tr>
\n
"
...
...
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