im_customers_comments

one of the documented procedures in this installation of the ACS
Usage:
im_customers_comments   db   { coverage "" }   { report_date "" }   { purpose "" }
What it does:
Returns a string that gives a list of customer profiles that have had correspondences - comments - addedto them with in the period of the coverage date from the report date
Defined in: /web/philip/tcl/intranet-status-report-defs.tcl

Source code:



    if { [empty_string_p $report_date] } {
	set report_date [database_to_tcl_string $db "select sysdate from dual"] 
    }

    set selection [ns_db select $db  "select u.user_id, first_names, last_name, 
                    general_comments.content, general_comments.html_p, user_groups.group_name,
                    im_projects.group_id, comment_date, one_line, comment_id
               from users_active u, general_comments, im_projects, user_groups
              where u.user_id =general_comments.user_id
                and im_projects.group_id = general_comments.on_what_id
                and on_which_table = 'user_groups'
                and comment_date > to_date('$report_date', 'YYYY-MM-DD') - $coverage
                and user_groups.group_id=im_projects.group_id
              order by lower(group_name), comment_date"]

    set return_list [list]
    set return_url "[im_url]/customers/view.tcl?[export_url_vars group_id]"
    while {[ns_db getrow $db $selection]} {
	set_variables_after_query
	
	if {$purpose == "web_display"} {
	    lappend return_list "<a href=/general-comments/view-one.tcl?[export_url_vars comment_id]&item=[ns_urlencode $group_name]&[export_url_vars return_url]>$one_line</a> -  <a href=[im_url_stub]/project-info.tcl?[export_url_vars project_id]>$name</a> by <a href=[im_url_stub]/users/view.tcl?[export_url_vars user_id]>$first_names $last_name</a> on [util_IllustraDatetoPrettyDate $comment_date]<br>
	    
	    [util_maybe_convert_to_html $content $html_p]
	    "
	} else {
    
	    lappend return_list "$one_line - $name by $first_names $last_name on [util_IllustraDatetoPrettyDate $comment_date]
	    \n
	    [util_striphtml $content]
	    
	    -- [im_url]/project-info.tcl?[export_url_vars project_id]
	    "
	}
    }

    set end_date [database_to_tcl_string $db "select sysdate-$coverage from dual"]
    
    if {[llength $return_list] == 0} {
	return "No customer correspondences in period [util_IllustraDatetoPrettyDate $end_date] -  [util_IllustraDatetoPrettyDate $report_date].\n"
    }
    
    if {$purpose == "web_display"} {
	return "<ul><li>[join $return_list "<li>"]</ul>"
    } else {
	return "\n [join $return_list "\n"] "
    }


philg@mit.edu