2c2 < require "dev_reg_lib_admin_v1_1.pm"; --- > require "reg_lib_admin_v1_1.pm"; 509,519c509 < }elsif($action eq 'reg_comm'){ #### Add ability to Accept/Decline users < if($failed_login == 1){ < print "\n"; < print_admin_login("Your username or password was incorrect."); < }elsif($admin == 0){ < print "\n"; < print_admin_login("You do not have access to this page."); < }else{ < #print_show_reg($org_id); < print_my_communications_history($reg_year); < } --- > 2395,2407d2384 < < function show_comm_email(orgId, userKey, group, tag){ < var loadUrl = "$lib/comm_email.pl?org_id=" + orgId + "&user_key=" + userKey + "&groupto=" + group + "&tag=" + tag + "&ct=reg_comm"; < var caption = ""; < fb.loadAnchor(loadUrl, 'width:800 height:500 floatboxFoobar', caption); < } < < function view_comm_history() { < var action = document.getElementById('action'); < action.value = "reg_comm"; < document.admin_enrollment.submit(); < } < 2993,2994d2969 < my $balance_due = 0; < my $paid_in_full = 0; 2996,3001d2970 < ################################### < # Get total that have a balance due < ################################### < if(($total >0) && ($due > 0)){ < $balance_due = 1; < } 3007d2975 < $balance_due = 1; 3012d2979 < $paid_in_full = 1; 3017c2984 < return ($show_row, $balance_due, $paid_in_full); --- > return $show_row; 3023,3027c2990,2991 < my %users = get_users_by_org($org_id); < my $shown_player_count = 0; < my $total_player_count = 0; < my $balance_due_count = 0; < my $paid_in_full_count = 0; --- > my %users = get_users_by_org($org_id); > my $player_count = 0; 3109c3073 < my ($show_row, $balance_due, $paid_in_full) = get_normal_reg_filter_show_row($total, $due, $filter1_value); --- > my $show_row = get_normal_reg_filter_show_row($total, $due, $filter1_value); 3112,3114c3076 < $shown_player_count++; < $balance_due_count = $balance_due_count + $balance_due; < $paid_in_full_count = $paid_in_full_count + $paid_in_full; --- > $player_count++; 3116d3077 < $total_player_count++; 3121,3128c3082 < my $reg_all_comm_group = $reg_year . "ALL"; < my $reg_bal_due_comm_group = $reg_year . "BalDue"; < my $view_email_regAll = ""; < my $view_email_regBalDue = ""; < my $view_comm_link = "View Communications History"; < #print "
$season_text
Total Records Found: $player_count
" . $table; < < print "
$season_text
" . $view_email_regAll . "Send Email to All Registrants ($total_player_count)
" . $view_email_regBalDue . "Send Email to Registrants with a Balance Due($balance_due_count)
$view_comm_link
Total Records Found: $shown_player_count
" . $table; --- > print "
Total Records Found: $player_count
" . $table; 6716,6852d6669 < sub print_my_communications_history{ < my $reg_year = shift; < print_show_reg_style(); < < print <<__HTML__; < < __HTML__ < print "
\n"; < print <<__HTML__; <
<
< < < < < <
< My Communications History <
< <
< < < __HTML__ < print_reg_sent_email_table($reg_year); < < print <<__HTML__; <
ViewSentSubjectFromToSent Date
<
<
< __HTML__ < < } < ################################################## < # Get the contents of My Communications History < # For Comm Module < ################################################## < sub print_reg_sent_email_table{ < my $reg_year = shift; < #my %user_email_history = get_user_email_history($user_id); < my $dbh = get_dbh(); < ####################################################### < # Need to look at these queries becuase the reg could < # be sent by different users. < ####################################################### < #my %user_data = get_user_data($user_id); < #my %sender_data = get_sender_data($user_id); < my $query = "SELECT a.`Key`, a.`Org_ID`, a.`League_ID`, a.`Team_ID`, a.`Create_Date`, a.`Send_Date`, a.`From_ID`, a.`Subject`, a.`Message`, a.`Context`, a.`Status`, a.`Failed` < FROM `Comm_Email_Message` a, `Comm_Groups` b, `Comm_Group_Email_Link` c < WHERE b.`Group_Type_ID` = '$reg_year' AND b.`Key` = c.`Comm_Group_ID` AND c.`Comm_Email_ID` = a.`Key` < ORDER BY a.`Create_Date` DESC"; < #print "QUERY: $query\n"; < my $sth = $dbh->prepare($query); < $sth->execute(); < my $html = ""; < my $even_odd = 1; < my $row_style = "\"cal_event3\""; < while ( my $results = $sth->fetchrow_hashref ){ < my $to = $sender_data{$results->{Key}}{"TO"}; < my $groups_to = get_group_email_links($results->{Key}); < my $from = $results->{From_ID}; < my %account_info = get_account_info($from); < my $from_name = $account_info{"FIRSTNAME"} . " " . $account_info{"LASTNAME"}; < if($to eq ""){ < $to .= $groups_to; < }else{ < $to .= "," . $groups_to; < } < $to =~ s/\,/\, /g; < if($to =~ m/ALL$/){ < $to = "All Registrants"; < }elsif($to =~ m/BalDue$/){ < $to = "Registrants with Balance Due"; < } < my $view_email_link = ""; < if($even_odd == 1){ < $row_style = "\"cal_events2\""; < $even_odd = 2; < }else{ < $row_style = "\"cal_events3\""; < $even_odd = 1; < } < my $current_status = "Not Sent"; < if($results->{Status} == 1){ < $current_status = "In Progress"; < }elsif($results->{Status} == 2){ < $current_status = "Sent"; < }elsif($results->{Status} == -1){ < $current_status = "Had Error(s)"; < } < $html .= "" . $view_email_link . "view$current_status"; < $html .= "" . $results->{Subject} . "" . $from_name . "" . $to . "" . $results->{Send_Date} . ""; < $html .= ""; < } < $sth->finish(); < $dbh->disconnect; < print $html; < } < sub get_sender_data{ < my $user_id = shift; < my $dbh = get_dbh(); < my $query = "SELECT a.`Key`, b.`Comm_Email_ID`, b.`Comm_Email_Address_ID`, b.`Email_Bounce`, c.`Comm_Email_Address` < FROM `Comm_Email_Message` a, `Comm_Email_Link` b, `Comm_Email_Address` c < WHERE a.`From_ID` = '$user_id' AND a.`Key` = b.`Comm_Email_ID` AND b.`Comm_Email_Address_ID` = c.`Key`"; < my $sth = $dbh->prepare($query); < $sth->execute(); < #print "QUERY: $query
\n"; < my %return_hash; < while ( my $results = $sth->fetchrow_hashref ){ < if(defined($return_hash{$results->{Key}}{"TO"})){ < $return_hash{$results->{Key}}{"TO"} .= "," . $results->{Comm_Email_Address}; < $return_hash{$results->{Key}}{"COUNT"}++; < if($results->{Email_Bounce} == 1){ < $return_hash{$results->{Key}}{"BOUNCE"}++; < } < }else{ < $return_hash{$results->{Key}}{"TO"} = $results->{Comm_Email_Address}; < $return_hash{$results->{Key}}{"COUNT"} = 1; < if($results->{Email_Bounce} == 1){ < $return_hash{$results->{Key}}{"BOUNCE"} = 1; < }else{ < $return_hash{$results->{Key}}{"BOUNCE"} = 0; < } < } < } < $sth->finish(); < $dbh->disconnect; < return %return_hash; < < } <