Commit d9ca8dec authored by Frank Bergmann's avatar Frank Bergmann

- Gustaf changes

parent 151c68a6
...@@ -5,7 +5,7 @@ ad_page_contract { ...@@ -5,7 +5,7 @@ ad_page_contract {
@date 2012-03-30 @date 2012-03-30
} }
set current_user_id [ad_maybe_redirect_for_registration] set current_user_id [auth::require_login]
im_company_permissions $current_user_id $company_id view read write admin im_company_permissions $current_user_id $company_id view read write admin
set default_currency [im_parameter -package_id [im_package_cost_id] "DefaultCurrency" "" "EUR"] set default_currency [im_parameter -package_id [im_package_cost_id] "DefaultCurrency" "" "EUR"]
set max_project_name 40 set max_project_name 40
...@@ -47,14 +47,14 @@ foreach project_id [array names project_hash] { ...@@ -47,14 +47,14 @@ foreach project_id [array names project_hash] {
if {![info exists costs($key)]} { set costs($key) 0 } if {![info exists costs($key)]} { set costs($key) 0 }
} }
if {[catch { if {[catch {
set est_profit [expr $costs($project_id-3702) - $costs($project_id-3706) - $costs($project_id-3726) - $costs($project_id-3728)] set est_profit [expr {$costs($project_id-3702) - $costs($project_id-3706) - $costs($project_id-3726) - $costs($project_id-3728)}]
} err_msg]} { } err_msg]} {
ns_log Error "$err_msg" ns_log Error "$err_msg"
set est_profit [lang::message::lookup "" intranet-cost.UnableToCalculateEstimatedProfit "Unable to calculate 'Estimated Profit'"] set est_profit [lang::message::lookup "" intranet-cost.UnableToCalculateEstimatedProfit "Unable to calculate 'Estimated Profit'"]
} }
if {[catch { if {[catch {
set profit [expr $costs($project_id-3700) - $costs($project_id-3704) - $costs($project_id-3718) - $costs($project_id-3722)] set profit [expr {$costs($project_id-3700) - $costs($project_id-3704) - $costs($project_id-3718) - $costs($project_id-3722)}]
set profit_pretty [lc_numeric $profit "%.2f" [lang::user::locale]] set profit_pretty [lc_numeric $profit "%.2f" [lang::user::locale]]
} err_msg]} { } err_msg]} {
ns_log Error "$err_msg" ns_log Error "$err_msg"
......
...@@ -54,13 +54,13 @@ ad_proc -public im_cost_center_permissions {user_id cost_center_id view_var read ...@@ -54,13 +54,13 @@ ad_proc -public im_cost_center_permissions {user_id cost_center_id view_var read
set user_is_admin_p [im_is_user_site_wide_or_intranet_admin $user_id] set user_is_admin_p [im_is_user_site_wide_or_intranet_admin $user_id]
set cc_admin_id [util_memoize [list db_string cc_admin "select manager_id from im_cost_centers where cost_center_id = $cost_center_id" -default ""]] set cc_admin_id [util_memoize [list db_string cc_admin "select manager_id from im_cost_centers where cost_center_id = $cost_center_id" -default ""]]
set user_is_cc_admin_p [expr $user_id == $cc_admin_id] set user_is_cc_admin_p [expr {$user_id == $cc_admin_id}]
# ----------------------------------------------------- # -----------------------------------------------------
# Set the permission as the OR-conjunction of provider and customer # Set the permission as the OR-conjunction of provider and customer
set view 1 set view 1
set read 1 set read 1
set write [expr $user_is_admin_p || $user_is_cc_admin_p] set write [expr {$user_is_admin_p || $user_is_cc_admin_p}]
set admin $write set admin $write
} }
...@@ -250,15 +250,15 @@ ad_proc -public template::widget::im_cost_center_tree { ...@@ -250,15 +250,15 @@ ad_proc -public template::widget::im_cost_center_tree {
set include_empty_pos [lsearch $params include_empty_p] set include_empty_pos [lsearch $params include_empty_p]
if { $include_empty_pos >= 0 } { if { $include_empty_pos >= 0 } {
set include_empty_p [lindex $params [expr $include_empty_pos + 1]] set include_empty_p [lindex $params $include_empty_pos+1]
} }
set department_only_p_pos [lsearch $params department_only_p] set department_only_p_pos [lsearch $params department_only_p]
if { $department_only_p_pos >= 0 } { if { $department_only_p_pos >= 0 } {
set department_only_p [lindex $params [expr $department_only_p_pos + 1]] set department_only_p [lindex $params $department_only_p_pos+1]
} }
set translate_p_pos [lsearch $params translate_p] set translate_p_pos [lsearch $params translate_p]
if { $translate_p_pos >= 0 } { if { $translate_p_pos >= 0 } {
set translate_p [lindex $params [expr $translate_p_pos + 1]] set translate_p [lindex $params $translate_p_pos+1]
} }
} }
......
...@@ -165,8 +165,8 @@ ad_proc -public im_cost_permissions {user_id cost_id view_var read_var write_var ...@@ -165,8 +165,8 @@ ad_proc -public im_cost_permissions {user_id cost_id view_var read_var write_var
set cc_read [im_cost_center_read_p $cost_center_id $cost_type_id $user_id] set cc_read [im_cost_center_read_p $cost_center_id $cost_type_id $user_id]
set cc_write [im_cost_center_write_p $cost_center_id $cost_type_id $user_id] set cc_write [im_cost_center_write_p $cost_center_id $cost_type_id $user_id]
set can_read [expr [im_permission $user_id view_costs] || [im_permission $user_id view_invoices]] set can_read [expr {[im_permission $user_id view_costs] || [im_permission $user_id view_invoices]}]
set can_write [expr [im_permission $user_id add_costs] || [im_permission $user_id add_invoices]] set can_write [expr {[im_permission $user_id add_costs] || [im_permission $user_id add_invoices]}]
# AND-connection with add/view - costs/invoices # AND-connection with add/view - costs/invoices
if {!$can_read} { set cc_read 0 } if {!$can_read} { set cc_read 0 }
...@@ -211,10 +211,10 @@ ad_proc -public im_cost_permissions {user_id cost_id view_var read_var write_var ...@@ -211,10 +211,10 @@ ad_proc -public im_cost_permissions {user_id cost_id view_var read_var write_var
# ----------------------------------------------------- # -----------------------------------------------------
# Set the permission as the OR-conjunction of provider and customer # Set the permission as the OR-conjunction of provider and customer
set view [expr $incust_view || $cust_view || $prov_view || $cc_view] set view [expr {$incust_view || $cust_view || $prov_view || $cc_view}]
set read [expr $incust_read || $cust_read || $prov_read || $cc_read] set read [expr {$incust_read || $cust_read || $prov_read || $cc_read}]
set write [expr $incust_write || $cust_write || $prov_write || $cc_write] set write [expr {$incust_write || $cust_write || $prov_write || $cc_write}]
set admin [expr $incust_admin || $cust_admin || $prov_admin || $cc_admin] set admin [expr {$incust_admin || $cust_admin || $prov_admin || $cc_admin}]
# Limit rights of all users to view & read if they dont # Limit rights of all users to view & read if they dont
# have the expressive permission to "add_costs or add_invoices". # have the expressive permission to "add_costs or add_invoices".
...@@ -235,7 +235,7 @@ ad_proc -public im_cost_type_write_p { ...@@ -235,7 +235,7 @@ ad_proc -public im_cost_type_write_p {
Returns "1" if the user can create costs of type cost_type_id or 0 otherwise Returns "1" if the user can create costs of type cost_type_id or 0 otherwise
} { } {
set create_cost_types [im_cost_type_write_permissions $user_id] set create_cost_types [im_cost_type_write_permissions $user_id]
return [expr [lsearch -exact $create_cost_types $cost_type_id] != -1] return [expr {$cost_type_id in $create_cost_types}]
} }
...@@ -256,7 +256,7 @@ ad_proc -public im_cost_type_write_permissions_helper { ...@@ -256,7 +256,7 @@ ad_proc -public im_cost_type_write_permissions_helper {
write permissions for atleast one Cost Center. write permissions for atleast one Cost Center.
} { } {
# Financial Write permissions are required # Financial Write permissions are required
set can_write [expr [im_permission $user_id add_costs] || [im_permission $user_id add_invoices]] set can_write [expr {[im_permission $user_id add_costs] || [im_permission $user_id add_invoices]}]
if {!$can_write} { return [list] } if {!$can_write} { return [list] }
set result [db_list writable_cost_centers " set result [db_list writable_cost_centers "
...@@ -361,7 +361,7 @@ namespace eval im_cost { ...@@ -361,7 +361,7 @@ namespace eval im_cost {
if {"" == $creation_ip} { set creation_ip [ad_conn peeraddr] } if {"" == $creation_ip} { set creation_ip [ad_conn peeraddr] }
set today [db_string today "select sysdate from dual"] set today [db_string today "select sysdate from dual"]
if [catch { if {[catch {
db_dml insert_costs " db_dml insert_costs "
insert into acs_objects ( insert into acs_objects (
object_id, object_type, context_id, object_id, object_type, context_id,
...@@ -370,7 +370,7 @@ namespace eval im_cost { ...@@ -370,7 +370,7 @@ namespace eval im_cost {
:cost_id, :object_type, null, :cost_id, :object_type, null,
:today, :user_id, :creation_ip :today, :user_id, :creation_ip
)" )"
} errmsg] { } errmsg]} {
ad_return_complaint 1 "<li>Error creating acs_object in im_cost::new<br> ad_return_complaint 1 "<li>Error creating acs_object in im_cost::new<br>
cost_id=$cost_id<br> cost_id=$cost_id<br>
cost_status_id=$cost_status_id<br> cost_status_id=$cost_status_id<br>
...@@ -382,7 +382,7 @@ namespace eval im_cost { ...@@ -382,7 +382,7 @@ namespace eval im_cost {
return return
} }
if [catch { if {[catch {
db_dml insert_costs " db_dml insert_costs "
insert into im_costs ( insert into im_costs (
cost_id, cost_id,
...@@ -400,7 +400,7 @@ namespace eval im_cost { ...@@ -400,7 +400,7 @@ namespace eval im_cost {
:provider_id, :provider_id,
:cost_type_id, :cost_type_id,
:cost_status_id :cost_status_id
)" } errmsg] { )" } errmsg]} {
ad_return_complaint 1 "<li>Error inserting into im_costs as part of im_cost::new<br> ad_return_complaint 1 "<li>Error inserting into im_costs as part of im_cost::new<br>
cost_id=$cost_id<br> cost_id=$cost_id<br>
cost_status_id=$cost_status_id<br> cost_status_id=$cost_status_id<br>
...@@ -550,7 +550,7 @@ ad_proc -public template::widget::im_currencies { element_reference tag_attribut ...@@ -550,7 +550,7 @@ ad_proc -public template::widget::im_currencies { element_reference tag_attribut
set include_empty_pos [lsearch $params include_empty_p] set include_empty_pos [lsearch $params include_empty_p]
if { $include_empty_pos >= 0 } { if { $include_empty_pos >= 0 } {
set include_empty_p [lindex $params [expr $include_empty_pos + 1]] set include_empty_p [lindex $params $include_empty_pos+1]
} }
} }
...@@ -695,7 +695,7 @@ ad_proc im_costs_object_list_component { user_id cost_id return_url } { ...@@ -695,7 +695,7 @@ ad_proc im_costs_object_list_component { user_id cost_id return_url } {
set object_list_html "" set object_list_html ""
db_foreach object_list $object_list_sql { db_foreach object_list $object_list_sql {
append object_list_html " append object_list_html "
<tr $bgcolor([expr $ctr % 2])> <tr $bgcolor([expr {$ctr % 2}])>
<td> <td>
<A href=\"$url$object_id\">$object_name</A> <A href=\"$url$object_id\">$object_name</A>
</td> </td>
...@@ -708,7 +708,7 @@ ad_proc im_costs_object_list_component { user_id cost_id return_url } { ...@@ -708,7 +708,7 @@ ad_proc im_costs_object_list_component { user_id cost_id return_url } {
if {0 == $ctr} { if {0 == $ctr} {
append object_list_html " append object_list_html "
<tr $bgcolor([expr $ctr % 2])> <tr $bgcolor([expr {$ctr % 2}])>
<td><i>No objects found</i></td> <td><i>No objects found</i></td>
</tr>\n" </tr>\n"
} }
...@@ -839,7 +839,7 @@ ad_proc im_company_payment_balance_component { company_id } { ...@@ -839,7 +839,7 @@ ad_proc im_company_payment_balance_component { company_id } {
db_multirow -extend {invoice_url} list_costs_multirow costs_sql $costs_sql { db_multirow -extend {invoice_url} list_costs_multirow costs_sql $costs_sql {
set invoice_url [export_vars -base "/intranet-invoices/view" {{invoice_id $cost_id}}] set invoice_url [export_vars -base "/intranet-invoices/view" {{invoice_id $cost_id}}]
if {"" == $total_converted} { set total_converted 0 } if {"" == $total_converted} { set total_converted 0 }
set costs_sum [expr $costs_sum + $total_converted] set costs_sum [expr {$costs_sum + $total_converted}]
} }
eval [template::adp_compile -string "<listtemplate name=list_costs></listtemplate>"] eval [template::adp_compile -string "<listtemplate name=list_costs></listtemplate>"]
...@@ -891,7 +891,7 @@ ad_proc im_company_payment_balance_component { company_id } { ...@@ -891,7 +891,7 @@ ad_proc im_company_payment_balance_component { company_id } {
set payments_sum 0 set payments_sum 0
db_multirow -extend {invoice_url} list_payments_multirow payments_sql $payments_sql { db_multirow -extend {invoice_url} list_payments_multirow payments_sql $payments_sql {
set payment_url [export_vars -base "/intranet-payments/view" {payment_id}] set payment_url [export_vars -base "/intranet-payments/view" {payment_id}]
set payments_sum [expr $payments_sum + $amount_converted] set payments_sum [expr {$payments_sum + $amount_converted}]
} }
eval [template::adp_compile -string "<listtemplate name=list_payments></listtemplate>"] eval [template::adp_compile -string "<listtemplate name=list_payments></listtemplate>"]
...@@ -1051,7 +1051,7 @@ ad_proc im_costs_base_component { ...@@ -1051,7 +1051,7 @@ ad_proc im_costs_base_component {
db_foreach recent_costs $costs_sql { db_foreach recent_costs $costs_sql {
append cost_html " append cost_html "
<tr$bgcolor([expr $ctr % 2])> <tr$bgcolor([expr {$ctr % 2}])>
<td><a href=\"$url$cost_id\">[string range $cost_name 0 20]</a></td> <td><a href=\"$url$cost_id\">[string range $cost_name 0 20]</a></td>
<td>$cost_type</td> <td>$cost_type</td>
<td>$calculated_due_date</td> <td>$calculated_due_date</td>
...@@ -1068,9 +1068,9 @@ ad_proc im_costs_base_component { ...@@ -1068,9 +1068,9 @@ ad_proc im_costs_base_component {
set company_id $org_company_id set company_id $org_company_id
append cost_html " append cost_html "
<tr$bgcolor([expr $ctr % 2])> <tr$bgcolor([expr {$ctr % 2}])>
<td colspan=$colspan> <td colspan=$colspan>
<a href=\"/intranet-cost/list?[export_vars -url { status_id company_id project_id}]\"> <a href=\"/intranet-cost/[export_vars -base list { status_id company_id project_id}]\">
[_ intranet-cost.more_costs] [_ intranet-cost.more_costs]
</a> </a>
</td> </td>
...@@ -1080,7 +1080,7 @@ ad_proc im_costs_base_component { ...@@ -1080,7 +1080,7 @@ ad_proc im_costs_base_component {
# Add a reasonable message if there are no documents # Add a reasonable message if there are no documents
if {$ctr == 1} { if {$ctr == 1} {
append cost_html " append cost_html "
<tr$bgcolor([expr $ctr % 2])> <tr$bgcolor([expr {$ctr % 2}])>
<td colspan=$colspan align=center> <td colspan=$colspan align=center>
<I>[_ intranet-cost.lt_No_financial_document]</I> <I>[_ intranet-cost.lt_No_financial_document]</I>
</td> </td>
...@@ -1386,7 +1386,7 @@ ad_proc im_costs_project_finance_component { ...@@ -1386,7 +1386,7 @@ ad_proc im_costs_project_finance_component {
if {!$atleast_one_unreadable_p} { if {!$atleast_one_unreadable_p} {
append cost_html " append cost_html "
<tr class=rowplain> <tr class=rowplain>
<td colspan=[expr $colspan-4]>&nbsp;</td> <td colspan=[expr {$colspan-4}]>&nbsp;</td>
<td align='right' colspan=2> <td align='right' colspan=2>
<b><nobr>$subtotals($old_cost_type_id) $default_currency</nobr></b> <b><nobr>$subtotals($old_cost_type_id) $default_currency</nobr></b>
</td> </td>
...@@ -1434,7 +1434,7 @@ ad_proc im_costs_project_finance_component { ...@@ -1434,7 +1434,7 @@ ad_proc im_costs_project_finance_component {
set cost_url_end "</A>" set cost_url_end "</A>"
set amount_unconverted "<nobr>([string trim $amount] $currency)</nobr>" set amount_unconverted "<nobr>([string trim $amount] $currency)</nobr>"
if {[string equal $currency $default_currency]} { set amount_unconverted "" } if {$currency eq $default_currency} { set amount_unconverted "" }
set amount_paid "$payment_amount $default_currency" set amount_paid "$payment_amount $default_currency"
if {"" == $payment_amount} { set amount_paid "" } if {"" == $payment_amount} { set amount_paid "" }
...@@ -1450,7 +1450,7 @@ ad_proc im_costs_project_finance_component { ...@@ -1450,7 +1450,7 @@ ad_proc im_costs_project_finance_component {
} }
append cost_html " append cost_html "
<tr $bgcolor([expr $ctr % 2])> <tr $bgcolor([expr {$ctr % 2}])>
<td><nobr>$cost_url[string range $cost_name 0 30]</A></nobr></td> <td><nobr>$cost_url[string range $cost_name 0 30]</A></nobr></td>
<td>$cost_center_code</td> <td>$cost_center_code</td>
<td>$company_name</td> <td>$company_name</td>
...@@ -1467,7 +1467,7 @@ ad_proc im_costs_project_finance_component { ...@@ -1467,7 +1467,7 @@ ad_proc im_costs_project_finance_component {
if {!$atleast_one_unreadable_p} { if {!$atleast_one_unreadable_p} {
append cost_html " append cost_html "
<tr class=rowplain> <tr class=rowplain>
<td colspan=[expr $colspan-3]>&nbsp;</td> <td colspan=[expr {$colspan-3}]>&nbsp;</td>
<td colspan='99'> <td colspan='99'>
<b>$subtotals($old_cost_type_id) $default_currency</b> <b>$subtotals($old_cost_type_id) $default_currency</b>
</td> </td>
...@@ -1483,7 +1483,7 @@ ad_proc im_costs_project_finance_component { ...@@ -1483,7 +1483,7 @@ ad_proc im_costs_project_finance_component {
# Add a reasonable message if there are no documents # Add a reasonable message if there are no documents
if {$ctr == 1} { if {$ctr == 1} {
append cost_html " append cost_html "
<tr$bgcolor([expr $ctr % 2])> <tr$bgcolor([expr {$ctr % 2}])>
<td colspan=$colspan align=center> <td colspan=$colspan align=center>
<I>[_ intranet-cost.lt_No_financial_document]</I> <I>[_ intranet-cost.lt_No_financial_document]</I>
</td> </td>
...@@ -1514,19 +1514,19 @@ ad_proc im_costs_project_finance_component { ...@@ -1514,19 +1514,19 @@ ad_proc im_costs_project_finance_component {
append hard_cost_html "</tr>\n<tr>\n<td>[_ intranet-cost.Provider_Bills]</td>\n" append hard_cost_html "</tr>\n<tr>\n<td>[_ intranet-cost.Provider_Bills]</td>\n"
set subtotal $subtotals([im_cost_type_bill]) set subtotal $subtotals([im_cost_type_bill])
append hard_cost_html "<td align=right>- $subtotal $default_currency</td>\n" append hard_cost_html "<td align=right>- $subtotal $default_currency</td>\n"
set grand_total [expr $grand_total - $subtotal] set grand_total [expr {$grand_total - $subtotal}]
append hard_cost_html "</tr>\n<tr>\n<td>[_ intranet-cost.Timesheet_Costs]</td>\n" append hard_cost_html "</tr>\n<tr>\n<td>[_ intranet-cost.Timesheet_Costs]</td>\n"
set subtotal $subtotals([im_cost_type_timesheet]) set subtotal $subtotals([im_cost_type_timesheet])
append hard_cost_html "<td align=right>- $subtotal $default_currency</td>\n" append hard_cost_html "<td align=right>- $subtotal $default_currency</td>\n"
set grand_total [expr $grand_total - $subtotal] set grand_total [expr {$grand_total - $subtotal}]
append hard_cost_html "</tr>\n<tr>\n<td>[lang::message::lookup "" intranet-cost.Expenses "Expenses"]</td>\n" append hard_cost_html "</tr>\n<tr>\n<td>[lang::message::lookup "" intranet-cost.Expenses "Expenses"]</td>\n"
set subtotal $subtotals([im_cost_type_expense_bundle]) set subtotal $subtotals([im_cost_type_expense_bundle])
append hard_cost_html "<td align=right>- $subtotal $default_currency</td>\n" append hard_cost_html "<td align=right>- $subtotal $default_currency</td>\n"
set grand_total [expr $grand_total - $subtotal] set grand_total [expr {$grand_total - $subtotal}]
set grand_total [expr round($rounding_factor * $grand_total) / $rounding_factor] set grand_total [expr {round($rounding_factor * $grand_total) / $rounding_factor}]
append hard_cost_html "</tr>\n<tr>\n<td><b>[_ intranet-cost.Grand_Total]</b></td>\n" append hard_cost_html "</tr>\n<tr>\n<td><b>[_ intranet-cost.Grand_Total]</b></td>\n"
append hard_cost_html "<td align=right><b>$grand_total $default_currency</b></td>\n" append hard_cost_html "<td align=right><b>$grand_total $default_currency</b></td>\n"
...@@ -1553,19 +1553,19 @@ ad_proc im_costs_project_finance_component { ...@@ -1553,19 +1553,19 @@ ad_proc im_costs_project_finance_component {
append prelim_cost_html "</tr>\n<tr>\n<td>[_ intranet-cost.Purchase_Orders]</td>\n" append prelim_cost_html "</tr>\n<tr>\n<td>[_ intranet-cost.Purchase_Orders]</td>\n"
set subtotal $subtotals([im_cost_type_po]) set subtotal $subtotals([im_cost_type_po])
append prelim_cost_html "<td align=right>- $subtotal $default_currency</td>\n" append prelim_cost_html "<td align=right>- $subtotal $default_currency</td>\n"
set grand_total [expr $grand_total - $subtotal] set grand_total [expr {$grand_total - $subtotal}]
append prelim_cost_html "</tr>\n<tr>\n<td>[lang::message::lookup "" intranet-cost.Timesheet_Budget "Timesheet Budget"]</td>\n" append prelim_cost_html "</tr>\n<tr>\n<td>[lang::message::lookup "" intranet-cost.Timesheet_Budget "Timesheet Budget"]</td>\n"
set subtotal $subtotals([im_cost_type_timesheet_budget]) set subtotal $subtotals([im_cost_type_timesheet_budget])
append prelim_cost_html "<td align=right>- $subtotal $default_currency</td>\n" append prelim_cost_html "<td align=right>- $subtotal $default_currency</td>\n"
set grand_total [expr $grand_total - $subtotal] set grand_total [expr {$grand_total - $subtotal}]
append prelim_cost_html "</tr>\n<tr>\n<td>[lang::message::lookup "" intranet-cost.Expense_Budget "Expense Budget"]</td>\n" append prelim_cost_html "</tr>\n<tr>\n<td>[lang::message::lookup "" intranet-cost.Expense_Budget "Expense Budget"]</td>\n"
set subtotal $subtotals([im_cost_type_expense_planned]) set subtotal $subtotals([im_cost_type_expense_planned])
append prelim_cost_html "<td align=right>- $subtotal $default_currency</td>\n" append prelim_cost_html "<td align=right>- $subtotal $default_currency</td>\n"
set grand_total [expr $grand_total - $subtotal] set grand_total [expr {$grand_total - $subtotal}]
set grand_total [expr round($rounding_factor * $grand_total) / $rounding_factor] set grand_total [expr {round($rounding_factor * $grand_total) / $rounding_factor}]
append prelim_cost_html "</tr>\n<tr>\n<td><b>[lang::message::lookup "" intranet-cost.Preliminary_Total "Preliminary Total"]</b></td>\n" append prelim_cost_html "</tr>\n<tr>\n<td><b>[lang::message::lookup "" intranet-cost.Preliminary_Total "Preliminary Total"]</b></td>\n"
append prelim_cost_html "<td align=right><b>$grand_total $default_currency</b></td>\n" append prelim_cost_html "<td align=right><b>$grand_total $default_currency</b></td>\n"
append prelim_cost_html "</tr>\n</table>\n" append prelim_cost_html "</tr>\n</table>\n"
...@@ -1644,19 +1644,19 @@ ad_proc im_costs_project_finance_component { ...@@ -1644,19 +1644,19 @@ ad_proc im_costs_project_finance_component {
# set html_provider_links [im_menu_ul_list -package_key intranet-invoices "invoices_providers" $bind_vars] # set html_provider_links [im_menu_ul_list -package_key intranet-invoices "invoices_providers" $bind_vars]
set html_provider_links [im_menu_ul_list "invoices_providers" $bind_vars] set html_provider_links [im_menu_ul_list "invoices_providers" $bind_vars]
if { ![empty_string_p $html_customer_links] || ![empty_string_p $html_provider_links] } { if { $html_customer_links ne "" || $html_provider_links ne "" } {
set admin_html " set admin_html "
<h1>[_ intranet-core.Admin_Links]</h1> <h1>[_ intranet-core.Admin_Links]</h1>
<table> <table>
<tr class=rowplain> <tr class=rowplain>
<td>\n" <td>\n"
if { ![empty_string_p $html_customer_links] } { if { $html_customer_links ne "" } {
append admin_html "<h2>" append admin_html "<h2>"
append admin_html [lang::message::lookup "" intranet-cost.Customer_Links "Customer Actions"] append admin_html [lang::message::lookup "" intranet-cost.Customer_Links "Customer Actions"]
append admin_html "</h2>" append admin_html "</h2>"
append admin_html $html_customer_links append admin_html $html_customer_links
} }
if { ![empty_string_p $html_provider_links] } { if { $html_provider_links ne "" } {
append admin_html "<br><h2>" append admin_html "<br><h2>"
append admin_html [lang::message::lookup "" intranet-cost.Provider_Links "Provider Actions"] append admin_html [lang::message::lookup "" intranet-cost.Provider_Links "Provider Actions"]
append admin_html "</h2>" append admin_html "</h2>"
...@@ -1798,7 +1798,7 @@ ad_proc -public im_cost_status_select { ...@@ -1798,7 +1798,7 @@ ad_proc -public im_cost_status_select {
set options [util_memoize [list im_cost_status_options $include_empty]] set options [util_memoize [list im_cost_status_options $include_empty]]
set result "\n<select name=\"$select_name\">\n" set result "\n<select name=\"$select_name\">\n"
if {[string equal $default ""]} { if {$default eq ""} {
append result "<option value=\"\"> -- Please select -- </option>" append result "<option value=\"\"> -- Please select -- </option>"
} }
...@@ -1811,10 +1811,10 @@ ad_proc -public im_cost_status_select { ...@@ -1811,10 +1811,10 @@ ad_proc -public im_cost_status_select {
} }
set selected "" set selected ""
if { [string equal $default [lindex $option 1]]} { if {$default eq [lindex $option 1]} {
set selected " selected" set selected " selected"
} }
append result "\t<option value=\"[util_quote_double_quotes [lindex $option 1]]\" $selected>" append result "\t<option value=\"[ad_quotehtml [lindex $option 1]]\" $selected>"
append result "$text</option>\n" append result "$text</option>\n"
} }
...@@ -1868,12 +1868,12 @@ ad_proc im_costs_select { ...@@ -1868,12 +1868,12 @@ ad_proc im_costs_select {
1=1 1=1
" "
if { ![empty_string_p $status] } { if { $status ne "" } {
ns_set put $bind_vars status $status ns_set put $bind_vars status $status
append sql " and cost_status_id=(select cost_status_id from im_cost_status where cost_status=:status)" append sql " and cost_status_id=(select cost_status_id from im_cost_status where cost_status=:status)"
} }
if { ![empty_string_p $exclude_status] } { if { $exclude_status ne "" } {
set exclude_string [im_append_list_to_ns_set $bind_vars cost_status_type $exclude_status] set exclude_string [im_append_list_to_ns_set $bind_vars cost_status_type $exclude_status]
append sql " and cost_status_id in (select cost_status_id append sql " and cost_status_id in (select cost_status_id
from im_cost_status from im_cost_status
...@@ -2083,7 +2083,7 @@ ad_proc -public im_cost_update_project_cost_cache { ...@@ -2083,7 +2083,7 @@ ad_proc -public im_cost_update_project_cost_cache {
" "
set ts_budget [db_string ts_budget $planning_ts_hours_sql -default 0.0] set ts_budget [db_string ts_budget $planning_ts_hours_sql -default 0.0]
if {"" == $ts_budget} { set ts_budget 0.0 } if {"" == $ts_budget} { set ts_budget 0.0 }
set ts_budget [expr $ts_budget] set ts_budget [expr {$ts_budget}]
set subtotals(3726) $ts_budget set subtotals(3726) $ts_budget
} else { } else {
...@@ -2100,7 +2100,7 @@ ad_proc -public im_cost_update_project_cost_cache { ...@@ -2100,7 +2100,7 @@ ad_proc -public im_cost_update_project_cost_cache {
# Create a fake timesheet planning entry based on im_project.budget_hours field # Create a fake timesheet planning entry based on im_project.budget_hours field
set budget_hours [db_string budget_hours "select project_budget_hours from im_projects where project_id = :project_id" -default ""] set budget_hours [db_string budget_hours "select project_budget_hours from im_projects where project_id = :project_id" -default ""]
if {"" == $budget_hours} { set budget_hours 0 } if {"" == $budget_hours} { set budget_hours 0 }
set cost_timesheet_planned [expr $budget_hours * $default_hourly_cost] set cost_timesheet_planned [expr {$budget_hours * $default_hourly_cost}]
set subtotals([im_cost_type_timesheet_planned]) $cost_timesheet_planned set subtotals([im_cost_type_timesheet_planned]) $cost_timesheet_planned
} }
......
...@@ -17,7 +17,7 @@ ad_page_contract { ...@@ -17,7 +17,7 @@ ad_page_contract {
{return_url "/intranet-cost/cost-centers/index"} {return_url "/intranet-cost/cost-centers/index"}
} }
set user_id [ad_maybe_redirect_for_registration] set user_id [auth::require_login]
set user_is_admin_p [im_is_user_site_wide_or_intranet_admin $user_id] set user_is_admin_p [im_is_user_site_wide_or_intranet_admin $user_id]
if {!$user_is_admin_p} { if {!$user_is_admin_p} {
ad_return_complaint 1 "You have insufficient privileges to use this page" ad_return_complaint 1 "You have insufficient privileges to use this page"
......
<master src="/packages/intranet-core/www/admin/master"> <master src="/packages/intranet-core/www/admin/master">
<property name="title">@page_title;noquote@</property> <property name="doc(title)">@page_title;literal@</property>
<property name="main_navbar_label">admin</property> <property name="main_navbar_label">admin</property>
<property name="admin_navbar_label">admin_cost_centers</property> <property name="admin_navbar_label">admin_cost_centers</property>
<property name="left_navbar">@left_navbar_html;noquote@</property> <property name="left_navbar">@left_navbar_html;literal@</property>
<h1>@page_title@</h1> <h1>@page_title@</h1>
......
...@@ -17,7 +17,7 @@ ad_page_contract { ...@@ -17,7 +17,7 @@ ad_page_contract {
# Defaults & Security # Defaults & Security
# ------------------------------------------------------ # ------------------------------------------------------
set user_id [ad_maybe_redirect_for_registration] set user_id [auth::require_login]
set user_is_admin_p [im_is_user_site_wide_or_intranet_admin $user_id] set user_is_admin_p [im_is_user_site_wide_or_intranet_admin $user_id]
if {!$user_is_admin_p} { if {!$user_is_admin_p} {
...@@ -126,7 +126,7 @@ db_foreach cost_centers $main_sql { ...@@ -126,7 +126,7 @@ db_foreach cost_centers $main_sql {
} }
append table " append table "
<tr$bgcolor([expr $ctr % 2])> <tr$bgcolor([expr {$ctr % 2}])>
<td><input type=checkbox name=cost_center_id.$cost_center_id></td> <td><input type=checkbox name=cost_center_id.$cost_center_id></td>
<td><nobr>$sub_indent <a href=$cost_center_url?cost_center_id=$cost_center_id&return_url=$return_url>$cost_center_name</a></nobr></td> <td><nobr>$sub_indent <a href=$cost_center_url?cost_center_id=$cost_center_id&return_url=$return_url>$cost_center_name</a></nobr></td>
<td>$cost_center_code</td> <td>$cost_center_code</td>
...@@ -139,7 +139,7 @@ db_foreach cost_centers $main_sql { ...@@ -139,7 +139,7 @@ db_foreach cost_centers $main_sql {
" "
if {{} != $employee_list} { if {{} != $employee_list} {
append table " append table "
<tr$bgcolor([expr $ctr % 2])><td colspan=2 align=right>&nbsp;</td><td colspan=6> <tr$bgcolor([expr {$ctr % 2}])><td colspan=2 align=right>&nbsp;</td><td colspan=6>
[join $employee_list ", "] [join $employee_list ", "]
</td></tr> </td></tr>
" "
...@@ -156,7 +156,7 @@ append left_navbar_html " ...@@ -156,7 +156,7 @@ append left_navbar_html "
<div class='filter-block'> <div class='filter-block'>
<div class='filter-title'>#intranet-cost.AdminCostCenter#</div> <div class='filter-title'>#intranet-cost.AdminCostCenter#</div>
<ul> <ul>
<li><a href=new?[export_vars -url { return_url}]>[lang::message::lookup "" intranet-cost.CreateNewCostCenter "Create new Cost Center"]</a</li> <li><a href=[export_vars -base new { return_url}]>[lang::message::lookup "" intranet-cost.CreateNewCostCenter "Create new Cost Center"]</a</li>
</ul> </ul>
</div> </div>
" "
<master src="../../../intranet-core/www/master"> <master src="../../../intranet-core/www/master">
<property name="title">@page_title@</property> <property name="doc(title)">@page_title;literal@</property>
<property name="context">@context;noquote@</property> <property name="context">@context;literal@</property>
<property name="main_navbar_label">finance</property> <property name="main_navbar_label">finance</property>
<property name="left_navbar">@left_navbar_html;noquote@</property> <property name="left_navbar">@left_navbar_html;literal@</property>
<h2>@page_title@</h2> <h2>@page_title@</h2>
...@@ -10,6 +10,6 @@ ...@@ -10,6 +10,6 @@
<div class="general-message">@message@</div> <div class="general-message">@message@</div>
</if> </if>
<property name="focus">@focus;noquote@</property> <property name="focus">@focus;literal@</property>
<formtemplate id="cost_center"></formtemplate> <formtemplate id="cost_center"></formtemplate>
...@@ -24,7 +24,7 @@ ad_page_contract { ...@@ -24,7 +24,7 @@ ad_page_contract {
# Default & Security # Default & Security
# ------------------------------------------------------------------ # ------------------------------------------------------------------
set user_id [ad_maybe_redirect_for_registration] set user_id [auth::require_login]
set user_is_admin_p [im_is_user_site_wide_or_intranet_admin $user_id] set user_is_admin_p [im_is_user_site_wide_or_intranet_admin $user_id]
if {!$user_is_admin_p} { if {!$user_is_admin_p} {
ad_return_complaint 1 "You have insufficient privileges to use this page" ad_return_complaint 1 "You have insufficient privileges to use this page"
......
<master> <master>
<property name="title">@page_title@</property> <property name="doc(title)">@page_title;literal@</property>
<property name="context">@context@</property> <property name="context">@context;literal@</property>
<include src="/packages/acs-subsite/www/permissions/perm-user-add-include"> <include src="/packages/acs-subsite/www/permissions/perm-user-add-include">
...@@ -22,7 +22,7 @@ ad_page_contract { ...@@ -22,7 +22,7 @@ ad_page_contract {
{submit_save ""} {submit_save ""}
} }
set user_id [ad_maybe_redirect_for_registration] set user_id [auth::require_login]
if {![im_permission $user_id add_costs]} { if {![im_permission $user_id add_costs]} {
ad_return_complaint 1 "<li>You have insufficient privileges to see this page" ad_return_complaint 1 "<li>You have insufficient privileges to see this page"
...@@ -56,9 +56,9 @@ if {"" != $submit_del} { ...@@ -56,9 +56,9 @@ if {"" != $submit_del} {
set otype $object_type($cost_id) set otype $object_type($cost_id)
# ToDo: Security # ToDo: Security
if [catch { if {[catch {
im_exec_dml del_cost_item "${otype}__delete(:cost_id)" im_exec_dml del_cost_item "${otype}__delete(:cost_id)"
} errmsg] { } errmsg]} {
ad_return_complaint 1 "<li>Error deleting cost item #$cost_id of type '$otype':<br> ad_return_complaint 1 "<li>Error deleting cost item #$cost_id of type '$otype':<br>
<pre>$errmsg</pre>" <pre>$errmsg</pre>"
return return
......
<master src="../../../intranet-core/www/master"> <master src="../../../intranet-core/www/master">
<property name="title">@page_title@</property> <property name="doc(title)">@page_title;literal@</property>
<property name="focus">@focus;noquote@</property> <property name="focus">@focus;literal@</property>
<property name="context">@context;noquote@</property> <property name="context">@context;literal@</property>
<property name="main_navbar_label">finance</property> <property name="main_navbar_label">finance</property>
<if @message@ not nil> <if @message@ not nil>
<div class="general-message">@message@</div> <div class="general-message">@message@</div>
</if> </if>
<table cellspacing=1 cellpadding=1 border=0> <table cellspacing="1" cellpadding="1" border="0">
<tr> <tr>
<td valign=top> <td valign="top">
<table cellspacing=1 cellpadding=1 border=0> <table cellspacing="1" cellpadding="1" border="0">
<tr> <tr>
<td class=rowtitle align=center>@page_title@</td> <td class=rowtitle align="center">@page_title@</td>
</tr> </tr>
<tr> <tr>
<td> <td>
...@@ -24,12 +24,12 @@ ...@@ -24,12 +24,12 @@
</table> </table>
</td> </td>
<td valign=top> <td valign="top">
<if "" ne @admin_html@> <if "" ne @admin_html@>
<table cellspacing=1 cellpadding=1 border=0> <table cellspacing="1" cellpadding="1" border="0">
<tr> <tr>
<td class=rowtitle align=center>#intranet-cost.Administration#</td> <td class=rowtitle align="center">#intranet-cost.Administration#</td>
</tr> </tr>
<tr> <tr>
<td> <td>
......
...@@ -24,7 +24,7 @@ ad_page_contract { ...@@ -24,7 +24,7 @@ ad_page_contract {
# Default & Security # Default & Security
# ------------------------------------------------------------------ # ------------------------------------------------------------------
set user_id [ad_maybe_redirect_for_registration] set user_id [auth::require_login]
set page_title "[_ intranet-cost.Edit_Cost]" set page_title "[_ intranet-cost.Edit_Cost]"
set context [im_context_bar $page_title] set context [im_context_bar $page_title]
...@@ -34,7 +34,7 @@ set context [im_context_bar $page_title] ...@@ -34,7 +34,7 @@ set context [im_context_bar $page_title]
# Redirect to sub-type # Redirect to sub-type
# ------------------------------------------------------------------ # ------------------------------------------------------------------
if {[info exists cost_id] && $cost_id != "" && $cost_id != 0 && $form_mode == "display"} { if {[info exists cost_id] && $cost_id ne "" && $cost_id != 0 && $form_mode eq "display"} {
set subtype_sql " set subtype_sql "
select bou.* select bou.*
from acs_objects o, from acs_objects o,
...@@ -80,7 +80,7 @@ set admin_html "" ...@@ -80,7 +80,7 @@ set admin_html ""
# Get everything about the cost # Get everything about the cost
# ------------------------------------------------------------------ # ------------------------------------------------------------------
if {![exists_and_not_null cost_id]} { if {(![info exists cost_id] || $cost_id eq "")} {
# New variable: setup some reasonable defaults # New variable: setup some reasonable defaults
set page_title "[_ intranet-cost.New_Cost_Item]" set page_title "[_ intranet-cost.New_Cost_Item]"
......
<master> <master>
<property name="title">@page_title;noquote@</property> <property name="doc(title)">@page_title;literal@</property>
<property name="main_navbar_label">finance</property> <property name="main_navbar_label">finance</property>
<property name="sub_navbar">@sub_navbar;noquote@</property> <property name="sub_navbar">@sub_navbar;literal@</property>
<property name="left_navbar">@left_navbar_html;noquote@</property> <property name="left_navbar">@left_navbar_html;literal@</property>
<table cellpadding=0 cellspacing=0 border=0 width="100%"> <table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr><td> <tr><td>
<%= [im_component_bay top] %> <%= [im_component_bay top] %>
</td></tr> </td></tr>
</table> </table>
<table cellpadding=0 cellspacing=0 border=0 width="100%"> <table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr> <tr>
<td valign=top> <td valign="top">
<%= [im_component_bay left] %> <%= [im_component_bay left] %>
</td> </td>
<td valign=top> <td valign="top">
<%= [im_component_bay right] %> <%= [im_component_bay right] %>
</td> </td>
</tr> </tr>
</table> </table>
<table cellpadding=0 cellspacing=0 border=0 width="100%"> <table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr><td> <tr><td>
<%= [im_component_bay bottom] %> <%= [im_component_bay bottom] %>
</td></tr> </td></tr>
......
...@@ -14,7 +14,7 @@ ad_page_contract { ...@@ -14,7 +14,7 @@ ad_page_contract {
{ project_id 0 } { project_id 0 }
{ company_id 0 } { company_id 0 }
} }
set user_id [ad_maybe_redirect_for_registration] set user_id [auth::require_login]
set page_title "[_ intranet-cost.Finance_Home]" set page_title "[_ intranet-cost.Finance_Home]"
set context_bar [im_context_bar $page_title] set context_bar [im_context_bar $page_title]
set return_url [im_url_with_query] set return_url [im_url_with_query]
......
<master> <master>
<property name="title">@page_title;noquote@</property> <property name="doc(title)">@page_title;literal@</property>
<property name="main_navbar_label">finance</property> <property name="main_navbar_label">finance</property>
<property name="sub_navbar">@sub_navbar;noquote@</property> <property name="sub_navbar">@sub_navbar;literal@</property>
<property name="left_navbar">@left_navbar_html;noquote@</property> <property name="left_navbar">@left_navbar_html;literal@</property>
<form action="/intranet-cost/costs/cost-action" method="POST"> <form action="/intranet-cost/costs/cost-action" method="POST">
<%= [export_vars -form {company_id cost_id return_url}] %> <%= [export_vars -form {company_id cost_id return_url}] %>
<table width="100%" cellpadding=2 cellspacing=2 border=0> <table width="100%" cellpadding="2" cellspacing="2" border="0">
@table_header_html;noquote@ @table_header_html;noquote@
@table_body_html;noquote@ @table_body_html;noquote@
@table_continuation_html;noquote@ @table_continuation_html;noquote@
......
...@@ -63,7 +63,7 @@ ad_page_contract { ...@@ -63,7 +63,7 @@ ad_page_contract {
# --------------------------------------------------------------- # ---------------------------------------------------------------
# User id already verified by filters # User id already verified by filters
set user_id [ad_maybe_redirect_for_registration] set user_id [auth::require_login]
set page_title "[_ intranet-cost.Cost_Items]" set page_title "[_ intranet-cost.Cost_Items]"
set context_bar [im_context_bar $page_title] set context_bar [im_context_bar $page_title]
set page_focus "im_header_form.keywords" set page_focus "im_header_form.keywords"
...@@ -79,10 +79,10 @@ if {![im_permission $user_id view_costs]} { ...@@ -79,10 +79,10 @@ if {![im_permission $user_id view_costs]} {
return return
} }
if { [empty_string_p $how_many] || $how_many < 1 } { if { $how_many eq "" || $how_many < 1 } {
set how_many [im_parameter -package_id [im_package_core_id] NumberResultsPerPage "" 50] set how_many [im_parameter -package_id [im_package_core_id] NumberResultsPerPage "" 50]
} }
set end_idx [expr $start_idx + $how_many - 1] set end_idx [expr {$start_idx + $how_many - 1}]
if {0 != $project_id && "" != $project_id} { if {0 != $project_id && "" != $project_id} {
set company_id [db_string company_from_project "select company_id from im_projects where project_id = :project_id" -default 0] set company_id [db_string company_from_project "select company_id from im_projects where project_id = :project_id" -default 0]
...@@ -130,10 +130,10 @@ db_foreach column_list_sql $column_sql { ...@@ -130,10 +130,10 @@ db_foreach column_list_sql $column_sql {
# --------------------------------------------------------------- # ---------------------------------------------------------------
set criteria [list] set criteria [list]
if { ![empty_string_p $cost_status_id] && $cost_status_id > 0 } { if { $cost_status_id ne "" && $cost_status_id > 0 } {
lappend criteria "c.cost_status_id in ([join [im_sub_categories $cost_status_id] ","])" lappend criteria "c.cost_status_id in ([join [im_sub_categories $cost_status_id] ","])"
} }
if { ![empty_string_p $cost_type_id] && $cost_type_id != 0 } { if { $cost_type_id ne "" && $cost_type_id != 0 } {
lappend criteria "c.cost_type_id in ([join [im_sub_categories $cost_type_id] ","])" lappend criteria "c.cost_type_id in ([join [im_sub_categories $cost_type_id] ","])"
} }
if {$customer_id} { if {$customer_id} {
...@@ -174,7 +174,7 @@ if {"" != $project_id && 0 != $project_id} { ...@@ -174,7 +174,7 @@ if {"" != $project_id && 0 != $project_id} {
if { ![empty_string_p $letter] && [string compare $letter "ALL"] != 0 && [string compare $letter "SCROLL"] != 0 } { if { $letter ne "" && $letter ne "ALL" && $letter ne "SCROLL" } {
lappend criteria "im_first_letter_default_to_a(cust.company_name)=:letter" lappend criteria "im_first_letter_default_to_a(cust.company_name)=:letter"
} }
...@@ -217,7 +217,7 @@ switch $order_by { ...@@ -217,7 +217,7 @@ switch $order_by {
} }
set where_clause [join $criteria " and\n "] set where_clause [join $criteria " and\n "]
if { ![empty_string_p $where_clause] } { if { $where_clause ne "" } {
set where_clause " and $where_clause" set where_clause " and $where_clause"
} }
...@@ -314,7 +314,7 @@ set filter_html " ...@@ -314,7 +314,7 @@ set filter_html "
# --------------------------------------------------------------- # ---------------------------------------------------------------
# Set up colspan to be the number of headers + 1 for the # column # Set up colspan to be the number of headers + 1 for the # column
set colspan [expr [llength $column_headers] + 1] set colspan [expr {[llength $column_headers] + 1}]
set table_header_html "" set table_header_html ""
#<tr> #<tr>
...@@ -328,13 +328,13 @@ set table_header_html "" ...@@ -328,13 +328,13 @@ set table_header_html ""
# #
set url "$local_url?" set url "$local_url?"
set query_string [export_ns_set_vars url [list order_by]] set query_string [export_ns_set_vars url [list order_by]]
if { ![empty_string_p $query_string] } { if { $query_string ne "" } {
append url "$query_string&" append url "$query_string&"
} }
append table_header_html "<tr>\n" append table_header_html "<tr>\n"
foreach col $column_headers { foreach col $column_headers {
if { [string compare $order_by $col] == 0 } { if { $order_by eq $col } {
append table_header_html " <td class=rowtitle>$col</td>\n" append table_header_html " <td class=rowtitle>$col</td>\n"
} else { } else {
append table_header_html " <td class=rowtitle><a href=\"${url}order_by=[ns_urlencode $col]\">$col</a></td>\n" append table_header_html " <td class=rowtitle><a href=\"${url}order_by=[ns_urlencode $col]\">$col</a></td>\n"
...@@ -354,7 +354,7 @@ set ctr 0 ...@@ -354,7 +354,7 @@ set ctr 0
set idx $start_idx set idx $start_idx
db_foreach costs_info_query {} { db_foreach costs_info_query {} {
set url [im_maybe_prepend_http $url] set url [im_maybe_prepend_http $url]
if { [empty_string_p $url] } { if { $url eq "" } {
set url_string "&nbsp;" set url_string "&nbsp;"
} else { } else {
set url_string "<a href=\"$url\">$url</a>" set url_string "<a href=\"$url\">$url</a>"
...@@ -364,7 +364,7 @@ db_foreach costs_info_query {} { ...@@ -364,7 +364,7 @@ db_foreach costs_info_query {} {
if {"" == $amount} { set currency "" } if {"" == $amount} { set currency "" }
# Append together a line of data based on the "column_vars" parameter list # Append together a line of data based on the "column_vars" parameter list
append table_body_html "<tr$bgcolor([expr $ctr % 2])>\n" append table_body_html "<tr$bgcolor([expr {$ctr % 2}])>\n"
foreach column_var $column_vars { foreach column_var $column_vars {
append table_body_html "\t<td valign=top>" append table_body_html "\t<td valign=top>"
set cmd "append table_body_html $column_var" set cmd "append table_body_html $column_var"
...@@ -381,7 +381,7 @@ db_foreach costs_info_query {} { ...@@ -381,7 +381,7 @@ db_foreach costs_info_query {} {
} }
# Show a reasonable message when there are no result rows: # Show a reasonable message when there are no result rows:
if { [empty_string_p $table_body_html] } { if { $table_body_html eq "" } {
set table_body_html " set table_body_html "
<tr><td colspan=$colspan><ul><li><b> <tr><td colspan=$colspan><ul><li><b>
[_ intranet-cost.lt_There_are_currently_n] [_ intranet-cost.lt_There_are_currently_n]
...@@ -391,7 +391,7 @@ if { [empty_string_p $table_body_html] } { ...@@ -391,7 +391,7 @@ if { [empty_string_p $table_body_html] } {
if { $ctr == $how_many && $end_idx < $total_in_limited } { if { $ctr == $how_many && $end_idx < $total_in_limited } {
# This means that there are rows that we decided not to return # This means that there are rows that we decided not to return
# Include a link to go to the next page # Include a link to go to the next page
set next_start_idx [expr $end_idx + 1] set next_start_idx [expr {$end_idx + 1}]
set next_page_url "$local_url?start_idx=$next_start_idx&[export_ns_set_vars url [list start_idx]]" set next_page_url "$local_url?start_idx=$next_start_idx&[export_ns_set_vars url [list start_idx]]"
} else { } else {
set next_page_url "" set next_page_url ""
...@@ -400,7 +400,7 @@ if { $ctr == $how_many && $end_idx < $total_in_limited } { ...@@ -400,7 +400,7 @@ if { $ctr == $how_many && $end_idx < $total_in_limited } {
if { $start_idx > 0 } { if { $start_idx > 0 } {
# This means we didn't start with the first row - there is # This means we didn't start with the first row - there is
# at least 1 previous row. add a previous page link # at least 1 previous row. add a previous page link
set previous_start_idx [expr $start_idx - $how_many] set previous_start_idx [expr {$start_idx - $how_many}]
if { $previous_start_idx < 0 } { set previous_start_idx 0 } if { $previous_start_idx < 0 } { set previous_start_idx 0 }
set previous_page_url "$local_url?start_idx=$previous_start_idx&[export_ns_set_vars url [list start_idx]]" set previous_page_url "$local_url?start_idx=$previous_start_idx&[export_ns_set_vars url [list start_idx]]"
} else { } else {
...@@ -415,7 +415,7 @@ if { $start_idx > 0 } { ...@@ -415,7 +415,7 @@ if { $start_idx > 0 } {
# => include a link to go to the next page # => include a link to go to the next page
# #
if {$ctr==$how_many && $total_in_limited > 0 && $end_idx < $total_in_limited} { if {$ctr==$how_many && $total_in_limited > 0 && $end_idx < $total_in_limited} {
set next_start_idx [expr $end_idx + 1] set next_start_idx [expr {$end_idx + 1}]
set next_page "<a href=$local_url?start_idx=$next_start_idx&[export_ns_set_vars url [list start_idx]]>[_ intranet-cost.Next_Page]</a>" set next_page "<a href=$local_url?start_idx=$next_start_idx&[export_ns_set_vars url [list start_idx]]>[_ intranet-cost.Next_Page]</a>"
} else { } else {
set next_page "" set next_page ""
...@@ -426,7 +426,7 @@ if {$ctr==$how_many && $total_in_limited > 0 && $end_idx < $total_in_limited} { ...@@ -426,7 +426,7 @@ if {$ctr==$how_many && $total_in_limited > 0 && $end_idx < $total_in_limited} {
# => add a previous page link # => add a previous page link
# #
if { $start_idx > 0 } { if { $start_idx > 0 } {
set previous_start_idx [expr $start_idx - $how_many] set previous_start_idx [expr {$start_idx - $how_many}]
if { $previous_start_idx < 0 } { set previous_start_idx 0 } if { $previous_start_idx < 0 } { set previous_start_idx 0 }
set previous_page "<a href=$local_url?start_idx=$previous_start_idx&[export_ns_set_vars url [list start_idx]]>[_ intranet-cost.Previous_Page]</a>" set previous_page "<a href=$local_url?start_idx=$previous_start_idx&[export_ns_set_vars url [list start_idx]]>[_ intranet-cost.Previous_Page]</a>"
} else { } else {
...@@ -442,7 +442,7 @@ set table_continuation_html " ...@@ -442,7 +442,7 @@ set table_continuation_html "
set button_html " set button_html "
<tr> <tr>
<td colspan=[expr $colspan - 3]></td> <td colspan=[expr {$colspan - 3}]></td>
<td align=center> <td align=center>
<input type=submit name=submit_save value='[_ intranet-cost.Save]'> <input type=submit name=submit_save value='[_ intranet-cost.Save]'>
</td> </td>
......
<master src="../../../intranet-core/www/master"> <master src="../../../intranet-core/www/master">
<property name="title">#intranet-cost.Absences#</property> <property name="doc(title)">#intranet-cost.Absences#</property>
<property name="context">#intranet-cost.context#</property> <property name="context">#intranet-cost.context#</property>
<property name="main_navbar_label">finance</property> <property name="main_navbar_label">finance</property>
<br> <br>
<%= [im_costs_navbar "none" "/intranet/invoices/index" "" "" [list] "costs_rep"] %> <%= [im_costs_navbar "none" "/intranet/invoices/index" "" "" [list] "costs_rep"] %>
<table width="100%" cellpadding=2 cellspacing=2 border=0> <table width="100%" cellpadding="2" cellspacing="2" border="0">
<%= $table_header_html %> <%= $table_header_html %>
<%= $table_body_html %> <%= $table_body_html %>
<%= $table_continuation_html %> <%= $table_continuation_html %>
......
...@@ -26,7 +26,7 @@ ad_page_contract { ...@@ -26,7 +26,7 @@ ad_page_contract {
# Defaults & Security # Defaults & Security
# --------------------------------------------------------------- # ---------------------------------------------------------------
set user_id [ad_maybe_redirect_for_registration] set user_id [auth::require_login]
set subsite_id [ad_conn subsite_id] set subsite_id [ad_conn subsite_id]
set bgcolor(0) " class=roweven " set bgcolor(0) " class=roweven "
set bgcolor(1) " class=rowodd " set bgcolor(1) " class=rowodd "
...@@ -95,7 +95,7 @@ where start_block >= rc.start_date ...@@ -95,7 +95,7 @@ where start_block >= rc.start_date
db_foreach all_start_blocks $all_start_blocks_sql { db_foreach all_start_blocks $all_start_blocks_sql {
set key "$rep_cost_id:$start_block" set key "$rep_cost_id:$start_block"
# Fill the field with a link to create a new cost item # Fill the field with a link to create a new cost item
set blocks($key) "<a href='$cost_create_url?[export_vars -url { rep_cost_id start_block return_url}]'>([_ intranet-cost.create])</a>" set blocks($key) "<a href='[export_vars -base $cost_create_url { rep_cost_id start_block return_url}]'>([_ intranet-cost.create])</a>"
ns_log Notice "/intranet-cos/rep-costs/index: key=$key" ns_log Notice "/intranet-cos/rep-costs/index: key=$key"
} }
...@@ -145,7 +145,7 @@ foreach cost_tuple $repeating_cost_ids { ...@@ -145,7 +145,7 @@ foreach cost_tuple $repeating_cost_ids {
set cost_id [lindex $cost_tuple 0] set cost_id [lindex $cost_tuple 0]
set cost_name [lindex $cost_tuple 1] set cost_name [lindex $cost_tuple 1]
append table_body_html "<tr $bgcolor([expr $ctr % 2])>\n" append table_body_html "<tr $bgcolor([expr {$ctr % 2}])>\n"
append table_body_html "<td><a href=new?rep_cost_id=$rep_cost_id&form_mode=display>$cost_name</a></td>\n" append table_body_html "<td><a href=new?rep_cost_id=$rep_cost_id&form_mode=display>$cost_name</a></td>\n"
for {set month 1} {$month <= $report_months} {incr month} { for {set month 1} {$month <= $report_months} {incr month} {
......
<master src="../../../intranet-core/www/master"> <master src="../../../intranet-core/www/master">
<property name="title">@page_title@</property> <property name="doc(title)">@page_title;literal@</property>
<property name="context">@context;noquote@</property> <property name="context">@context;literal@</property>
<property name="main_navbar_label">finance</property> <property name="main_navbar_label">finance</property>
<h2>@page_title@</h2> <h2>@page_title@</h2>
...@@ -9,6 +9,6 @@ ...@@ -9,6 +9,6 @@
<div class="general-message">@message@</div> <div class="general-message">@message@</div>
</if> </if>
<property name="focus">@focus;noquote@</property> <property name="focus">@focus;literal@</property>
<formtemplate id="cost"></formtemplate> <formtemplate id="cost"></formtemplate>
...@@ -20,7 +20,7 @@ ad_page_contract { ...@@ -20,7 +20,7 @@ ad_page_contract {
# Default & Security # Default & Security
# ------------------------------------------------------------------ # ------------------------------------------------------------------
set user_id [ad_maybe_redirect_for_registration] set user_id [auth::require_login]
set page_title [lang::message::lookup "" intranet-cost.Create_Repeating_Cost_Item "Create Repeating Cost Item"] set page_title [lang::message::lookup "" intranet-cost.Create_Repeating_Cost_Item "Create Repeating Cost Item"]
set context [im_context_bar $page_title] set context [im_context_bar $page_title]
set today [db_string birthday_today "select to_char(sysdate,'YYYY-MM-DD') from dual"] set today [db_string birthday_today "select to_char(sysdate,'YYYY-MM-DD') from dual"]
...@@ -72,9 +72,9 @@ append cost_name " - $start_block" ...@@ -72,9 +72,9 @@ append cost_name " - $start_block"
set cost_id [im_new_object_id] set cost_id [im_new_object_id]
set cause_object_id $rep_cost_id set cause_object_id $rep_cost_id
set effective_date $start_block set effective_date $start_block
if {![exists_and_not_null payment_days]} { set payment_days 0 } if {(![info exists payment_days] || $payment_days eq "")} { set payment_days 0 }
if {![exists_and_not_null tax]} { set tax 0 } if {(![info exists tax] || $tax eq "")} { set tax 0 }
if {![exists_and_not_null vat]} { set vat 0 } if {(![info exists vat] || $vat eq "")} { set vat 0 }
set project_options [im_project_options] set project_options [im_project_options]
set customer_options [im_company_options -include_empty_p 0 -status "Active" -type "CustOrIntl"] set customer_options [im_company_options -include_empty_p 0 -status "Active" -type "CustOrIntl"]
......
<master src="../../../intranet-core/www/master"> <master src="../../../intranet-core/www/master">
<property name="title">@page_title@</property> <property name="doc(title)">@page_title;literal@</property>
<property name="context">@context;noquote@</property> <property name="context">@context;literal@</property>
<property name="main_navbar_label">finance</property> <property name="main_navbar_label">finance</property>
<h2>@page_title@</h2> <h2>@page_title@</h2>
...@@ -9,6 +9,6 @@ ...@@ -9,6 +9,6 @@
<div class="general-message">@message@</div> <div class="general-message">@message@</div>
</if> </if>
<property name="focus">@focus;noquote@</property> <property name="focus">@focus;literal@</property>
<formtemplate id="cost"></formtemplate> <formtemplate id="cost"></formtemplate>
...@@ -24,7 +24,7 @@ ad_page_contract { ...@@ -24,7 +24,7 @@ ad_page_contract {
# Default & Security # Default & Security
# ------------------------------------------------------------------ # ------------------------------------------------------------------
set user_id [ad_maybe_redirect_for_registration] set user_id [auth::require_login]
set page_title "<#_ Edit Repeating Cost#>" set page_title "<#_ Edit Repeating Cost#>"
set context [im_context_bar $page_title] set context [im_context_bar $page_title]
set today [db_string birthday_today "select sysdate from dual"] set today [db_string birthday_today "select sysdate from dual"]
...@@ -42,7 +42,7 @@ set focus "cost.var_name" ...@@ -42,7 +42,7 @@ set focus "cost.var_name"
# Get everything about the cost # Get everything about the cost
# ------------------------------------------------------------------ # ------------------------------------------------------------------
if {![exists_and_not_null rep_cost_id]} { if {(![info exists rep_cost_id] || $rep_cost_id eq "")} {
# New variable: setup some reasonable defaults # New variable: setup some reasonable defaults
set page_title "<#_ New Repeating Cost Item#>" set page_title "<#_ New Repeating Cost Item#>"
......
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