Commit 655d49c7 authored by Frank Bergmann's avatar Frank Bergmann

cosine #5773: Changed check for date of absence created

parent 0712e068
......@@ -8,7 +8,7 @@
<singleton-p>t</singleton-p>
<auto-mount>intranet-timesheet2</auto-mount>
<version name="5.1.0.0.1" url="https://www.project-open.net/download/apm/intranet-timesheet2-5.1.0.0.1.apm">
<version name="5.1.0.0.2" url="https://www.project-open.net/download/apm/intranet-timesheet2-5.1.0.0.2.apm">
<owner url="mailto:frank.bergmann@project-open.com">Frank Bergmann</owner>
<release-date>2004-02-07</release-date>
<vendor url="https://www.project-open.com/">]project-open[</vendor>
......@@ -71,6 +71,7 @@
<parameter scope="instance" datatype="number" min_n_values="1" max_n_values="1" name="TimesheetProjectNrMaxLength" default="12" description="Should we cut down the nr (short name) of a task or ticket in the timesheet entry page to a maximum size? Default is 12, 0 disables this feature."/>
<parameter scope="instance" datatype="string" min_n_values="1" max_n_values="1" name="CustomHoursActionHashFunction" default="" description="Hook/callback in intranet-timesheet2/new-2 function to perform on the 'action hash' of update/delete/create actions resulting from the entry of hours by the user. For example, cosine has a 'im_cust_cosine_veto_action_hash' custom function to veto entries if prices are not set correctly. "/>
<parameter datatype="number" min_n_values="1" max_n_values="1" name="AbsenceAutogenerateTitleTemplate" default="" description="Should the system automatically generate the title of an absence? An non-empty string will be treated as a template, you can use the variables absence_id, absence_type, absence_owner, absence_start_date and absence_end_date at the moment, prefixed by a dollar so that it can be evaluated as a string using TCL 'eval'. Example (without single quotes): '$absence_type from $absence_start_date to $absence_end_date by $absence_owner'"/>
<parameter scope="instance" datatype="number" min_n_values="1" max_n_values="1" name="AbsenceSincePastDays" default="100" description="Should we allow users to create absences in the past? Default is 100 for 100 days. A value of 0 means that absences can only be requested for today and the future."/>
</parameters>
</version>
</package>
......@@ -45,6 +45,7 @@ set date_time_format "YYYY MM DD"
set absence_type [lang::message::lookup "" intranet-timesheet2.Absence "Absence"]
set duration_default_uom [parameter::get_from_package_key -package_key "intranet-timesheet2" -parameter "AbsenceDefaultDurationUnit" -default "days"]
set absence_since_past_days [parameter::get_from_package_key -package_key "intranet-timesheet2" -parameter "AbsenceSincePastDays" -default 100]
# Autogenerate the absence title using a template?
# absence_id, absence_type, absence_user, absence_start_date and absence_end_date at the moment, prefixed by a dollar so that it can be evaluated as a string using TCL 'eval'."/>
......@@ -411,13 +412,14 @@ ad_form -extend -name absence -on_request {
{
start_date
{ [lindex $start_date 0] >= [db_string this_year "select extract(year from now())"] || $user_admin_p }
"You can not create new absences for the last year or earlier.<br>
Please contact your administrator for exceptions."
{ [db_string pastday "select to_date('[lrange $start_date 0 2]', 'YYYY MM DD') > now()::date - 100"] eq "t" || $user_admin_p }
"You can not create new absences starting more than $absence_since_past_days in the past."
}
} -new_data {
# { [lindex $start_date 0] >= [db_string this_year "select extract(year from now())"] || $user_admin_p }
set start_date_sql [template::util::date get_property sql_timestamp $start_date]
set end_date_sql [template::util::date get_property sql_timestamp $end_date]
......
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