Commit 8726f828 authored by Frank Bergmann's avatar Frank Bergmann

- LuP Extensions:

  Now includes bulk-actions on the projects referenced by an invoice
parent 881e086f
......@@ -412,19 +412,12 @@ ad_proc im_invoices_object_list_component { user_id invoice_id read write return
default { set extra_url "" }
}
append object_list_html "
<tr $bgcolor([expr $ctr % 2])>
<td>
<A href=\"$url$object_id$extra_url\">$object_name</A>
</td>\n"
append object_list_html "<tr $bgcolor([expr $ctr % 2])>\n"
if {$write} {
append object_list_html "
<td>
<input type=checkbox name=object_ids.$object_id>
</td>\n"
append object_list_html "<td><input type=checkbox name=object_ids.$object_id></td>\n"
}
append object_list_html "
</tr>\n"
append object_list_html "<td><A href=\"$url$object_id$extra_url\">$object_name</A></td>\n"
append object_list_html "</tr>\n"
incr ctr
}
......@@ -435,6 +428,7 @@ ad_proc im_invoices_object_list_component { user_id invoice_id read write return
</tr>\n"
}
set return_url [im_url_with_query]
set return_html "
<form action=invoice-association-action method=post>
[export_form_vars invoice_id return_url]
......@@ -447,12 +441,12 @@ ad_proc im_invoices_object_list_component { user_id invoice_id read write return
if {$write} {
append return_html "
<tr>
<td align=right>
<input type=submit name=add_project_action value='[_ intranet-invoices.Add_a_Project]'>
</A>
</td>
<td>
<input type=submit name=del_action value='[_ intranet-invoices.Del]'>
<td align=left colspan=2>
<select name=action>
<option value='set_invoiced'>[lang::message::lookup "" intranet-invoices.Set_to_invoiced "Set to invoiced"]</option>
<option value='delete'>[_ intranet-core.Delete]</option>
<option value='add_project'>[_ intranet-invoices.Add_a_Project]</option>
<input type=submit value='[_ intranet-core.Apply]'>
</td>
</tr>\n"
}
......
......@@ -21,12 +21,13 @@ ad_page_contract {
{ invoice_id:integer 0 }
{ project_id:integer 0 }
{ customer_id:integer 0 }
{ del_action "" }
{ add_project_action "" }
{ action "" }
{ object_ids:array,optional }
{ return_url "/intranet-invoices/" }
}
# ad_return_complaint 1 "action=$action, invoice_id=$invoice_id, project_id=$project_id, object_ids=[array get object_ids], return_url=$return_url"
# ---------------------------------------------------------------
# Security
# ---------------------------------------------------------------
......@@ -44,7 +45,6 @@ if {!$write_p} {
# ---------------------------------------------------------------
set page_focus "im_header_form.keywords"
set bgcolor(0) " class=roweven"
set bgcolor(1) " class=rowodd"
set required_field "<font color=red size=+1><B>*</B></font>"
......@@ -53,11 +53,12 @@ set cost_type [db_string cost_type "select im_category_from_id(cost_type_id) fro
set page_title [lang::message::lookup "" intranet-invoices.Associate_cost_type_with_project "Associate %cost_type% with a Project"]
set context_bar [im_context_bar [list /intranet/invoices/ "Finance"] $page_title]
# ---------------------------------------------------------------
# Del-Action: Delete the selected associated objects
# Delete Action: Delete the selected associated objects
# ---------------------------------------------------------------
if {"" != $del_action && [info exists object_ids]} {
if {"delete" == $action} {
foreach object_id [array names object_ids] {
ns_log Notice "intranet-invoices/invoice-associtation-action: deleting object_id=$object_id"
db_exec_plsql delete_association {}
......@@ -86,8 +87,29 @@ if {"" != $del_action && [info exists object_ids]} {
ad_abort_script
}
# ---------------------------------------------------------------
# Set to Invoiced Action
# ---------------------------------------------------------------
if {"set_invoiced" == $action} {
foreach object_id [array names object_ids] {
ns_log Notice "intranet-invoices/invoice-associtation-action: set_invoiced: object_id=$object_id"
db_dml set_invoiced "
update im_projects
set project_status_id = [im_project_status_invoiced]
where project_id = :object_id
"
}
ad_returnredirect $return_url
ad_abort_script
}
# ---------------------------------------------------------------
# Get everything about the invoice
# Add Project Action
# ---------------------------------------------------------------
set customer_id_org $customer_id
......
......@@ -45,6 +45,11 @@ set user_locale [lang::user::locale]
set locale $user_locale
set page_title ""
set gen_vars ""
set blurb ""
set notify_vars ""
set url ""
# Security is defered after getting the invoice information
# from the database, because the customer's users should
# be able to see this invoice even if they don't have any
......@@ -1591,3 +1596,4 @@ if { "" != $err_mess } {
set err_mess [lang::message::lookup "" $err_mess "Document Nr. not available anymore, please note and verify newly assigned number"]
}
set admin_p 1
\ No newline at end of file
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