Index: openacs-4/packages/contacts/lib/contact-complaint-form.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/contact-complaint-form.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/contacts/lib/contact-complaint-form.adp 8 Aug 2005 21:50:57 -0000 1.1 @@ -0,0 +1 @@ + \ No newline at end of file Index: openacs-4/packages/contacts/lib/contact-complaint-form.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/contact-complaint-form.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/contacts/lib/contact-complaint-form.tcl 8 Aug 2005 21:50:57 -0000 1.1 @@ -0,0 +1,142 @@ + + +if { ![info exist customer_id] || ![info exist supplier_id] } { + set user_options [list] + db_foreach get_users { } { + lappend user_options [list $fullname $user_id] + } +} + +if { ![info exist return_url] } { + set return_url [get_referrer] +} + + +ad_form -name complaint_form -form { + complaint_id:key + {title:text(text) + {label "Title:"} + } + {return_url:text(hidden) + {value $return_url} + } +} + +if { ![info exist customer_id] } { + ad_form -extend -name complaint_form -form { + {customer_id:text(select) + {label "Customer:"} + {options $user_options} + } + } +} else { + acs_user::get -user_id $customer_id -array customer_info + ad_form -extend -name complaint_form -form { + {customer_id:text(hidden) + {value $customer_id} + } + {customer:text(inform),optional + {label "Customer:"} + {value "$customer_info(first_names) $customer_info(last_name)"} + } + } +} + +if { ![info exist supplier_id]} { + ad_form -extend -name complaint_form -form { + {supplier_id:text(select) + {label "Supplier:"} + {options $user_options} + } + } +} else { + acs_user::get -user_id $supplier_id -array supplier_info + ad_form -extend -name complaint_form -form { + {supplier_id:text(hidden) + {value $supplier_id} + } + {supplier:text(inform),optional + {label "Supplier:"} + {value "$supplier_info(first_names) $supplier_info(last_name)"} + } + } +} + +ad_form -extend -name complaint_form -form { + {turnover:text(text) + {label "Turnover:"} + {html {size 10}} + } + {percent:text(text) + {label "Percent:"} + {html {size 2}} + {after_html "%"} + } +} + +if { ![info exist project_id] } { + set project_options [list] + db_foreach get_projects { } { + set project_name [pm::project::name -project_item_id $project_item_id] + lappend project_options [list $project_name $project_item_id] + } + ad_form -extend -name complaint_form -form { + {object_id:text(select) + {label "Project:"} + {options $project_options} + } + } +} else { + ad_form -extend -name complaint_form -form { + {object_id:text(hidden) + {value $object_id} + } + {project:text(inform) + {label "Object:"} + {value [pm::project::name -project_item_id $object_id]} + } + } +} + +ad_form -extend -name complaint_form -form { + {paid:text(text) + {label "Paid:"} + {html {size 10}} + } + {description:text(textarea) + {label "Description:"} + {html {rows 10 cols 30}} + } +} -new_data { + + contact::complaint::new \ + -customer_id $customer_id \ + -title $title \ + -turnover $turnover \ + -percent $percent \ + -description $description \ + -supplier_id $supplier_id \ + -paid $paid \ + -object_id $object_id + +} -edit_data { + + contact::complaint::new \ + -complaint_id $complaint_id \ + -customer_id $customer_id \ + -title $title \ + -turnover $turnover \ + -percent $percent \ + -description $description \ + -supplier_id $supplier_id \ + -paid $paid \ + -object_id $object_id + +} -edit_request { + + db_1row get_revision_info { } + +} -after_submit { + ad_returnredirect $return_url +} + Index: openacs-4/packages/contacts/lib/contact-complaint-form.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/contact-complaint-form.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/contacts/lib/contact-complaint-form.xql 8 Aug 2005 21:50:57 -0000 1.1 @@ -0,0 +1,43 @@ + + + + + + + select + user_id, + first_names ||' '|| last_name as fullname + from + cc_users + order by + last_name asc + + + + + + select + item_id as project_item_id + from + cr_items + where + content_type = 'pm_project' + + + + + + select + cct.*, + cr.title, + cr.description + from + contact_complaint_tracking cct, + cr_revisions cr + where + complaint_id = :complaint_id + and revision_id = :complaint_id + + + + \ No newline at end of file Index: openacs-4/packages/contacts/lib/contact-complaint-list.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/contact-complaint-list.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/contacts/lib/contact-complaint-list.adp 8 Aug 2005 21:50:57 -0000 1.1 @@ -0,0 +1,13 @@ + + + + + +
+ + + +
+ + + Index: openacs-4/packages/contacts/lib/contact-complaint-list.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/contact-complaint-list.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/contacts/lib/contact-complaint-list.tcl 8 Aug 2005 21:50:57 -0000 1.1 @@ -0,0 +1,65 @@ +ad_page_contract { + Shows a list template with information about contact_complaint_tracking table + + @author Miguel Marin (miguelmarin@viaro.net) + @author www.viaro.net www.viaro.net + @creation-date 2005-08-05 +} { + customer_id:optional + supplier_id:optional +} + + +set elements [list \ + title [list label "Title"]\ + customer [list label "Customer"]\ + supplier [list label "Supplier"]\ + turnover [list label "Turnover"]\ + percent [list label "Percent"]\ + state [list label "State"]\ + object_id [list label "Object ID"]\ + description [list label "Description"]\ + ] + +set customer_list [list] +set supplier_list [list] + +db_foreach get_users { } { + if { [string equal [lsearch $customer_list [list $customer $c_id]] "-1"] } { + lappend customer_list [list "$customer" $c_id] + } + if { [string equal [lsearch $supplier_list [list $supplier $s_id]] "-1"] } { + lappend supplier_list [list "$supplier" $s_id] + } +} + +template::list::create \ + -name complaint \ + -multirow complaint \ + -key complaint_id \ + -filters { + customer_id { + label "Customer" + values { $customer_list } + where_clause { + customer_id = :customer_id + } + } + supplier_id { + label "Supplier" + values { $supplier_list } + where_clause { + supplier_id = :supplier_id + } + } + } \ + -elements $elements + + +db_multirow -extend { customer supplier title description } complaint get_complaints { } { + acs_user::get -user_id $customer_id -array customer_info + acs_user::get -user_id $supplier_id -array supplier_info + set customer "$customer_info(first_names) $customer_info(last_name)" + set supplier "$supplier_info(first_names) $supplier_info(last_name)" + db_1row get_revision_info { } +} Index: openacs-4/packages/contacts/lib/contact-complaint-list.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/contact-complaint-list.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/contacts/lib/contact-complaint-list.xql 8 Aug 2005 21:50:57 -0000 1.1 @@ -0,0 +1,41 @@ + + + + + + + select + * + from + contact_complaint_tracking + where + 1 = 1 + [template::list::filter_where_clauses -and -name complaint] + + + + + + select + distinct cct.customer_id as c_id, + cct.supplier_id as s_id, + ( select first_names ||' '|| last_name from cc_users where user_id = customer_id) as customer, + ( select first_names ||' '|| last_name from cc_users where user_id = supplier_id) as supplier + from + contact_complaint_tracking cct + + + + + + select + title, + description + from + cr_revisions + where + revision_id = :complaint_id + + + + \ No newline at end of file