Commit 09881be9 authored by Frank Bergmann's avatar Frank Bergmann

Cleaned up translation, whitespaces

parent 80b81907
......@@ -15,7 +15,7 @@
ad_page_contract {
Calendar format display of user's hours with links
Calendar format display of user's hours with links
to log more hours, if the user is looking at him/
herself
......@@ -25,7 +25,7 @@ ad_page_contract {
@param user_id the user for whom we're viewing hours. Defaults to currently logged in user.
@param project_id The user group for which we're viewing hours. Defaults to all groups.
@param return_url Return URL
@author Michael Bryzek (mbryzek@arsdigita.com)
@author Frank Bergmann (frank.bergmann@project-open.com)
@author Klaus Hofeditz (klaus.hofeditz@project-open.com)
......@@ -41,7 +41,7 @@ ad_page_contract {
}
# Decision FB on 160624: Disregard for now:
# Clean up data in case WF cases have been OCdeleted in WF Admin Panel.
# Clean up data in case WF cases have been deleted in WF Admin Panel.
# conf_object will not be removed and hours are shown as 'to be confirmed'.
# db_dml sql "update im_hours set conf_object_id = null where conf_object_id not in (select object_id from wf_cases)"
# db_dml sql "delete from im_timesheet_conf_objects where conf_id not in (select object_id from wf_cases)"
......@@ -60,8 +60,8 @@ set break_l10n [lang::message::lookup "" intranet-attendance-management.Break "B
set hour_l10n [lang::message::lookup "" intranet-core.Hour_abbrev "h"]
switch $user_id_from_search {
"" - all - mine - direct_reports - employees - customers - providers {
set user_id_from_search $current_user_id
"" - all - mine - direct_reports - employees - customers - providers {
set user_id_from_search $current_user_id
}
default {
# Is the user allowed to log hours for another user?
......@@ -70,11 +70,11 @@ switch $user_id_from_search {
set reportees [im_user_direct_reports_ids -user_id $current_user_id]
if {[lsearch $reportees $user_id_from_search] < 0} {
# User not in reportees - reset to current user
set user_id_from_search $current_user_id
set user_id_from_search $current_user_id
}
} else {
# The user has no permission to log hours for others
set user_id_from_search $current_user_id
set user_id_from_search $current_user_id
}
}
}
......@@ -107,23 +107,23 @@ set attendance_management_installed_p [im_table_exists im_attendance_intervals]
set header_days_of_week "";
# Patch: http://sourceforge.net/projects/project-open/forums/forum/295937/topic/3324310
for { set i $start_day } { $i < 7 } { incr i } {
if { $i ==0 } { append header_days_of_week "[_ intranet-timesheet2.Sunday] " }
if { $i ==1 } { append header_days_of_week "[_ intranet-timesheet2.Monday] " }
if { $i ==2 } { append header_days_of_week "[_ intranet-timesheet2.Tuesday] " }
if { $i ==3 } { append header_days_of_week "[_ intranet-timesheet2.Wednesday] " }
if { $i ==4 } { append header_days_of_week "[_ intranet-timesheet2.Thursday] " }
if { $i ==5 } { append header_days_of_week "[_ intranet-timesheet2.Friday] " }
if { $i ==6 } { append header_days_of_week "[_ intranet-timesheet2.Saturday] " }
for {set i $start_day} {$i < 7} {incr i} {
if {$i ==0} { append header_days_of_week "[_ intranet-timesheet2.Sunday] " }
if {$i ==1} { append header_days_of_week "[_ intranet-timesheet2.Monday] " }
if {$i ==2} { append header_days_of_week "[_ intranet-timesheet2.Tuesday] " }
if {$i ==3} { append header_days_of_week "[_ intranet-timesheet2.Wednesday] " }
if {$i ==4} { append header_days_of_week "[_ intranet-timesheet2.Thursday] " }
if {$i ==5} { append header_days_of_week "[_ intranet-timesheet2.Friday] " }
if {$i ==6} { append header_days_of_week "[_ intranet-timesheet2.Saturday] " }
}
for { set i 0 } { $i < $start_day } { incr i } {
if { $i ==0 } { append header_days_of_week "[_ intranet-timesheet2.Sunday] " }
if { $i ==1 } { append header_days_of_week "[_ intranet-timesheet2.Monday] " }
if { $i ==2 } { append header_days_of_week "[_ intranet-timesheet2.Tuesday] " }
if { $i ==3 } { append header_days_of_week "[_ intranet-timesheet2.Wednesday] " }
if { $i ==4 } { append header_days_of_week "[_ intranet-timesheet2.Thursday] " }
if { $i ==5 } { append header_days_of_week "[_ intranet-timesheet2.Friday] " }
if { $i ==6 } { append header_days_of_week "[_ intranet-timesheet2.Saturday] " }
for {set i 0} {$i < $start_day} {incr i} {
if {$i ==0} { append header_days_of_week "[_ intranet-timesheet2.Sunday] " }
if {$i ==1} { append header_days_of_week "[_ intranet-timesheet2.Monday] " }
if {$i ==2} { append header_days_of_week "[_ intranet-timesheet2.Tuesday] " }
if {$i ==3} { append header_days_of_week "[_ intranet-timesheet2.Wednesday] " }
if {$i ==4} { append header_days_of_week "[_ intranet-timesheet2.Thursday] " }
if {$i ==5} { append header_days_of_week "[_ intranet-timesheet2.Friday] " }
if {$i ==6} { append header_days_of_week "[_ intranet-timesheet2.Saturday] " }
}
set weekly_logging_days [parameter::get_from_package_key -package_key intranet-timesheet2 -parameter TimesheetWeeklyLoggingDays -default "0 1 2 3 4 5 6"]
......@@ -131,7 +131,7 @@ set weekly_logging_days [parameter::get_from_package_key -package_key intranet-t
# ---------------------------------
# Date Logic: We are working with "YYYY-MM-DD" dates in this page.
if {"" == $date } {
if {"" == $date} {
if {"" != $julian_date} {
set date [db_string julian_date_select "select to_char( to_date(:julian_date,'J'), 'YYYY-MM-DD') from dual"]
} else {
......@@ -141,7 +141,7 @@ if {"" == $date } {
set julian_date [db_string conv "select to_char(:date::date, 'J')"]
# Set last day of month:
# Set last day of month:
set last_day_of_month_ansi [db_string get_last_day_month "select date_trunc('month',add_months(:date,1))::date - 1" -default 0]
set first_day_of_month_ansi [db_string get_first_day_month "select date_trunc('month', '$date'::DATE)::date" -default 0]
set first_day_of_month_julian [db_string fdom_julian "select to_char(:first_day_of_month_ansi::date, 'J')"]
......@@ -163,7 +163,7 @@ set menu_links_html [im_menu_ul_list -no_uls 1 "timesheet_hours_new_admin" $bind
# Enable the functionality to confirm timesheet hours?
set confirm_timesheet_hours_p 0
if { "" != [parameter::get -package_id [apm_package_id_from_key intranet-timesheet2-workflow] -parameter "DefaultWorkflowKey" -default ""] } {
if {"" != [parameter::get -package_id [apm_package_id_from_key intranet-timesheet2-workflow] -parameter "DefaultWorkflowKey" -default ""]} {
set confirm_timesheet_hours_p 1
}
......@@ -199,7 +199,7 @@ if {$attendance_management_installed_p} {
92100 {
# Work Attendance
set v 0.0
if {[info exists att_work_hash($attendance_start_julian)]} { set v $att_work_hash($attendance_start_julian) }
if {[info exists att_work_hash($attendance_start_julian)]} { set v $att_work_hash($attendance_start_julian)}
set v [expr $v + $duration_hours]
set att_work_hash($attendance_start_julian) $v
set attendance_work [expr $attendance_work + $duration_hours;]
......@@ -207,7 +207,7 @@ if {$attendance_management_installed_p} {
92110 {
# Break
set v 0.0
if {[info exists att_break_hash($attendance_start_julian)]} { set v $att_break_hash($attendance_start_julian) }
if {[info exists att_break_hash($attendance_start_julian)]} { set v $att_break_hash($attendance_start_julian)}
set v [expr $v + $duration_hours]
set att_break_hash($attendance_start_julian) $v
set attendance_break [expr $attendance_break + $duration_hours;]
......@@ -231,13 +231,13 @@ calendar_get_info_from_db $date
# --------------------------------------------------------------
# Grab all the hours from im_hours
set sql "
select to_char(day, 'J') as julian_date,
select to_char(day, 'J') as julian_date,
sum(hours) as hours
from im_hours
where user_id = :user_id_from_search
and day between to_date(:first_julian_date, 'J') and to_date(:last_julian_date, 'J')
and day between to_date(:first_julian_date, 'J') and to_date(:last_julian_date, 'J')
$project_restriction
group by
group by
to_char(day, 'J')
"
db_foreach hours_logged $sql {
......@@ -257,46 +257,47 @@ set absence_list [absence_list_for_user_and_time_period $user_id_from_search $fi
set absence_index 0
set curr_absence ""
# Column counter runs from 1 to 7
# Column counter runs from 1 to 7
set column_ctr 1
# Counter for weekday -> need to correspond with weekly_logging_days
if { 1 == $start_day } {
# Week starts with Monday
set week_day 1
if {1 == $start_day} {
# Week starts with Monday
set week_day 1
} else {
# Week starts with Sunday
set week_day 0
# Week starts with Sunday
set week_day 0
}
# Helper to determine location of last WF confirm button -> last day shown or last day of month
# Helper to determine location of last WF confirm button -> last day shown or last day of month
set show_last_confirm_button_p 1
set timesheet_entry_blocked_p 0
# And now fill in information for every day of the month
for { set current_date $first_julian_date} { $current_date <= $last_julian_date } { incr current_date } {
set current_date_ansi [dt_julian_to_ansi $current_date]
for {set current_date $first_julian_date} {$current_date <= $last_julian_date} {incr current_date} {
set current_date_ansi [dt_julian_to_ansi $current_date]
if { $confirm_timesheet_hours_p } {
if {$confirm_timesheet_hours_p} {
set no_ts_approval_wf_sql "
select count(*)
from im_hours
where conf_object_id is not null
and day::text like '%[string range $current_date_ansi 0 9]%'
select count(*)
from im_hours
where conf_object_id is not null
and day::text like '%[string range $current_date_ansi 0 9]%'
and user_id = :current_user_id
"
set no_ts_approval_wf [db_string workflow_started_p $no_ts_approval_wf_sql -default "0"]
if {$confirm_timesheet_hours_p && ("monthly" in $confirmation_period || "weekly" in $confirmation_period) && 0 != $no_ts_approval_wf } {
if {$confirm_timesheet_hours_p && ("monthly" in $confirmation_period || "weekly" in $confirmation_period) && 0 != $no_ts_approval_wf} {
# ns_log Notice "TS: Entry blocked: Date: $current_date_ansi; Number: $no_ts_approval_wf; $no_ts_approval_wf_sql"
set timesheet_entry_blocked_p 1
set timesheet_entry_blocked_p 1
}
}
# -------------------------------------------------------------------------
# User's hours for the day
set hours ""
if { [info exists users_hours($current_date)] && $users_hours($current_date) ne "" } {
if {[info exists users_hours($current_date)] && $users_hours($current_date) ne ""} {
set hours "$users_hours($current_date) [lang::message::lookup "" intranet-timesheet2.hours "hours"]"
set hours_for_this_week [expr {$hours_for_this_week + $users_hours($current_date)}]
......@@ -307,11 +308,11 @@ for { set current_date $first_julian_date} { $current_date <= $last_julian_date
}
} else {
if { $timesheet_entry_blocked_p } {
if {$timesheet_entry_blocked_p} {
set hours "<span class='log_hours'>[lang::message::lookup "" intranet-timesheet2.Nolog_Workflow_In_Progress "0 hours"]</span>"
} else {
if { [string first $week_day $weekly_logging_days] != -1 } {
set hours "<span class='log_hours'>[_ intranet-timesheet2.log_hours]</span>"
if {[string first $week_day $weekly_logging_days] != -1} {
set hours "<span class='log_hours'>[lang::message::lookup "" intranet-timesheet2.Log_hours "Log hours"]</span>"
}
}
}
......@@ -319,7 +320,7 @@ for { set current_date $first_julian_date} { $current_date <= $last_julian_date
if {![info exists unconfirmed_hours($current_date)]} { set unconfirmed_hours($current_date) "" }
if {"" == $unconfirmed_hours($current_date)} { set unconfirmed_hours($current_date) 0 }
# Sum up unconfirmed_hours - KH: 160624: This might be broken and it seems that vars are not being used.
# Sum up unconfirmed_hours - KH: 160624: This might be broken and it seems that vars are not being used.
set unconfirmed_hours_for_this_week [expr {$unconfirmed_hours_for_this_week + $unconfirmed_hours($current_date)}]
set unconfirmed_hours_for_this_month [expr {$unconfirmed_hours_for_this_month + $unconfirmed_hours($current_date)}]
......@@ -329,13 +330,13 @@ for { set current_date $first_julian_date} { $current_date <= $last_julian_date
set hours_url [export_vars -base "$hours_base_url/new" {user_id_from_search {julian_date $current_date} show_week_p return_url project_id project_id}]
if { [string first $week_day $weekly_logging_days] != -1 } {
if {[string first $week_day $weekly_logging_days] != -1} {
set hours "<a href=$hours_url>$hours</a>"
} else {
set hours "$hours"
}
if {$column_ctr == 1 && $show_link_log_hours_for_week_p } {
if {$column_ctr == 1 && $show_link_log_hours_for_week_p} {
set log_hours_for_the_week_html "<br>
<a href=[export_vars -base "$hours_base_url/new" {user_id_from_search {julian_date $current_date} {show_week_p 1} return_url}]
><span class='log_hours'>[lang::message::lookup "" intranet-timesheet2.Log_hours_for_the_week "Log hours for the week"]</span></a>
......@@ -344,9 +345,9 @@ for { set current_date $first_julian_date} { $current_date <= $last_julian_date
set log_hours_for_the_week_html ""
}
if { [info exists users_hours($current_date)] } {
if { [info exists unconfirmed_hours($current_date)] && $confirm_timesheet_hours_p } {
set no_unconfirmed_hours [get_unconfirmed_hours_for_period $user_id_from_search $current_date $current_date]
if {[info exists users_hours($current_date)]} {
if {[info exists unconfirmed_hours($current_date)] && $confirm_timesheet_hours_p} {
set no_unconfirmed_hours [get_unconfirmed_hours_for_period $user_id_from_search $current_date $current_date]
if {0 == $no_unconfirmed_hours || "" == $no_unconfirmed_hours} {
set wf_actice_case_sql "
select count(*)
......@@ -357,13 +358,13 @@ for { set current_date $first_julian_date} { $current_date <= $last_julian_date
h.user_id = :user_id_from_search
"
set no_wf_cases [db_string no_wf_cases $wf_actice_case_sql]
if { $no_wf_cases > 0 } {
if {$no_wf_cases > 0} {
set html "<span id='hours_confirmed_yellow'>$hours</span>$curr_absence$log_hours_for_the_week_html"
} else {
set html "<span id='hours_confirmed_green'>$hours</span>$curr_absence$log_hours_for_the_week_html"
}
} else {
set html "${hours}${curr_absence}<br>"
set html "${hours}${curr_absence}<br>"
if {$confirm_timesheet_hours_p} {
append html "[lang::message::lookup "" intranet-timesheet2.ToConfirm "To confirm"]:&nbsp;"
append html "<span id='hours_confirmed_red'>${no_unconfirmed_hours}&nbsp;[_ intranet-timesheet2.hours]</span>"
......@@ -378,29 +379,29 @@ for { set current_date $first_julian_date} { $current_date <= $last_julian_date
}
# Weekly total
if {($column_ctr == 7 || 0 && $current_date_ansi == $last_day_of_month_ansi) && $show_last_confirm_button_p } {
if {($column_ctr == 7 || 0 && $current_date_ansi == $last_day_of_month_ansi) && $show_last_confirm_button_p} {
append html "<br>
<a href=[export_vars -base "week" {{julian_date $current_date} user_id_from_search}]
>[_ intranet-timesheet2.Week_total_1] [format "%.2f" [expr {double(round(100*$hours_for_this_week))/100}]]</a>
"
if { $current_date_ansi == $last_day_of_month_ansi} { set show_last_confirm_button_p 0 }
if {$current_date_ansi == $last_day_of_month_ansi} { set show_last_confirm_button_p 0 }
# Include link for weekly TS confirmation
# Monthly confirmation_period not supported yet, always assume weekly
# if { $confirmation_period eq "weekly" && $confirm_timesheet_hours_p } {}
# if {$confirmation_period eq "weekly" && $confirm_timesheet_hours_p} {}
if {$confirm_timesheet_hours_p} {
if { !$fill_up_first_last_row_p } {
if {!$fill_up_first_last_row_p} {
set start_date_julian_wf [eval_wf_start_date $current_date $column_ctr]
set end_date_julian_wf $current_date
} else {
set start_date_julian_wf [expr {$current_date - 6}]
set end_date_julian_wf $current_date
set end_date_julian_wf $current_date
}
set no_unconfirmed_hours [get_unconfirmed_hours_for_period $user_id_from_search $start_date_julian_wf $end_date_julian_wf]
if {$confirm_timesheet_hours_p && (0 < $no_unconfirmed_hours || "" != $no_unconfirmed_hours) && ("weekly" in $confirmation_period) } {
set conf_url [export_vars -base $base_url_confirm_wf { {user_id $user_id_from_search} {start_date_julian $start_date_julian_wf} {end_date_julian $end_date_julian_wf } return_url}]
if {$confirm_timesheet_hours_p && (0 < $no_unconfirmed_hours || "" != $no_unconfirmed_hours) && ("weekly" in $confirmation_period)} {
set conf_url [export_vars -base $base_url_confirm_wf {{user_id $user_id_from_search} {start_date_julian $start_date_julian_wf} {end_date_julian $end_date_julian_wf} return_url}]
set button_txt [lang::message::lookup "" intranet-timesheet2.Confirm_weekly_hours "Confirm hours for this week"]
append html "<p>&nbsp;</p><a href='$conf_url' class=button>$button_txt</a>"
}
......@@ -428,18 +429,18 @@ for { set current_date $first_julian_date} { $current_date <= $last_julian_date
package_name = 'intranet-attendance-management'
"
} err_msg]} {
ad_return_complaint 1 "<b>Error locating the attendance portlet</b>:
ad_return_complaint 1 "<b>Error locating the attendance portlet</b>:
There is no portlet named 'Attendance Management' of package 'intranet-attendance-management'.<br>"
}
set work_url [export_vars -base $page_url {{view_name "component"} plugin_id {julian $current_date}}]
# Calculate the actual work/break time
set work 0
if {[info exists att_work_hash($current_date)]} {
set work [expr round(10.0 * $att_work_hash($current_date)) / 10.0]
if {[info exists att_work_hash($current_date)]} {
set work [expr round(10.0 * $att_work_hash($current_date)) / 10.0]
}
set break ""
if {[info exists att_break_hash($current_date)]} {
if {[info exists att_break_hash($current_date)]} {
set break [expr round(10.0 * $att_break_hash($current_date)) / 10.0]
}
......@@ -452,11 +453,11 @@ for { set current_date $first_julian_date} { $current_date <= $last_julian_date
# Write out lines for work and break
set line_items [list]
if {"" ne $work} {
if {"" ne $work} {
lappend line_items "<a href=$work_url target=_>$color_html $work_l10n: ${work}${hour_l10n}$color_html_end</a>"
}
if {"" ne $break} {
lappend line_items "$break_l10n: ${break}${hour_l10n}"
if {"" ne $break} {
lappend line_items "$break_l10n: ${break}${hour_l10n}"
}
if {[llength $line_items] > 0} {
append html "<br>[join $line_items ",<br> "]"
......@@ -468,38 +469,36 @@ for { set current_date $first_julian_date} { $current_date <= $last_julian_date
# Comparison at the end of the month
if {$current_date_ansi == $last_day_of_month_ansi} {
append html "<br>Attend. month: [expr round(10.0 * $attendance_work) / 10.0]${hour_l10n}"
}
}
}
# Monthly hour approval request
if { $current_date_ansi == $last_day_of_month_ansi && ("monthly" in $confirmation_period) } {
if {$current_date_ansi == $last_day_of_month_ansi && ("monthly" in $confirmation_period)} {
set start_date_month_julian [dt_ansi_to_julian_single_arg $first_day_of_month_ansi]
set end_date_month_julian [dt_ansi_to_julian_single_arg $last_day_of_month_ansi]
set conf_url [export_vars -base $base_url_confirm_wf { {user_id $user_id_from_search} {start_date_julian $start_date_month_julian } {end_date_julian $end_date_month_julian} return_url } ]
set conf_url [export_vars -base $base_url_confirm_wf {{user_id $user_id_from_search} {start_date_julian $start_date_month_julian} {end_date_julian $end_date_month_julian} return_url} ]
set button_txt [lang::message::lookup "" intranet-timesheet2.Confirm_monthly_hours "Confirm hours for this month"]
append html "<p>&nbsp;</p><a href='$conf_url' class=button>$button_txt</a>"
}
}
ns_set put $calendar_details $current_date "$html<br>&nbsp;"
# we keep track of the day of the week we are on
incr column_ctr
incr week_day
incr week_day
if { $column_ctr > 7 } {
if {$column_ctr > 7} {
set column_ctr 1
set hours_for_this_week 0.0
set unconfirmed_hours_for_this_week 0.0
}
# Weekday needs to be in range [0..6]
if { $week_day > 6 } {
set week_day 0
if {$week_day > 6} {
set week_day 0
}
set curr_absence ""
......@@ -508,14 +507,14 @@ for { set current_date $first_julian_date} { $current_date <= $last_julian_date
}
set prev_month_template "
<font color=white>&lt;</font>
<font color=white>&lt;</font>
<a href=\"[export_vars -base index {user_id_from_search}]&date=\$ansi_date\">
<font color=white>\[_ intranet-timesheet2.$prev_month_name] </font>
</a>"
set next_month_template "
<a href=\"[export_vars -base index {user_id_from_search}]&date=\$ansi_date\">
<font color=white>\[_ intranet-timesheet2.$next_month_name]</font>
</a>
</a>
<font color=white>&gt;</font>"
set day_bgcolor "#efefef"
......@@ -569,7 +568,7 @@ set left_navbar_html "
</div>
<form action='$hours_base_url/index' method=GET>
[export_vars -form {show_week_p}]
[export_vars -form {show_week_p}]
<table border=0 cellpadding=1 cellspacing=1>
<tr>
<td>[lang::message::lookup "" intranet-core.Date "Date"]</td>
......@@ -652,4 +651,3 @@ if {"" ne $admin_html} {
</div><ul>$admin_html</ul></div>
"
}
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