| 47 |
- |
1 |
#!/usr/bin/perl
|
|
|
2 |
|
|
|
3 |
use strict;
|
|
|
4 |
use cPanelUserConfig;
|
|
|
5 |
use RollerCon;
|
|
|
6 |
use tableViewer;
|
|
|
7 |
use DateTime;
|
|
|
8 |
use HTML::Tiny;
|
|
|
9 |
my $h = HTML::Tiny->new( mode => 'html' );
|
|
|
10 |
|
|
|
11 |
my $dt = DateTime->today;
|
|
|
12 |
my $day = $dt->day_name;
|
|
|
13 |
my $date = $dt->date;
|
| 189 |
- |
14 |
my $year = $dt->year;
|
| 47 |
- |
15 |
|
|
|
16 |
my $dbh = getDBConnection ();
|
|
|
17 |
my $DEPT = getDepartments ();
|
|
|
18 |
|
|
|
19 |
my $RCidListQuery=<<endRCidListQuery;
|
|
|
20 |
select distinct RCid from (
|
|
|
21 |
select distinct RCid from v_shift where year(date) = year(curdate()) and dept <> "PER" and dept <> "CLA" union
|
|
|
22 |
select distinct RCid from v_shift_announcer where year(date) = year(curdate()) union
|
|
|
23 |
select distinct RCid from v_shift_officiating where year(date) = year(curdate())
|
|
|
24 |
) t1
|
|
|
25 |
where RCid <> ''
|
|
|
26 |
order by cast(RCid as unsigned)
|
|
|
27 |
endRCidListQuery
|
|
|
28 |
my $sth1 = $dbh->prepare($RCidListQuery);
|
|
|
29 |
|
|
|
30 |
my $SchedQuery=<<endSchedQuery;
|
|
|
31 |
select * from (
|
|
|
32 |
select id, date, dayofweek, location, time, volhours, dept, role, '' as teams from v_shift where year(date) = year(curdate()) and RCid = ? and dept <> "PER" and dept <> "CLA" union
|
|
|
33 |
select id, date, dayofweek, track as location, time, volhours, "ANN" as dept, role, teams from v_shift_announcer where year(date) = year(curdate()) and RCid = ? union
|
|
|
34 |
select id, date, dayofweek, track as location, time, volhours, "OFF" as dept, role, teams from v_shift_officiating where year(date) = year(curdate()) and RCid = ?
|
|
|
35 |
) temp
|
|
|
36 |
order by date, time
|
|
|
37 |
endSchedQuery
|
|
|
38 |
my $sth2 = $dbh->prepare($SchedQuery);
|
|
|
39 |
|
|
|
40 |
$sth1->execute();
|
|
|
41 |
while (my ($RCid) = $sth1->fetchrow_array()) {
|
|
|
42 |
my $email = getUserEmail($RCid);
|
|
|
43 |
my $dname = getUserDerbyName($RCid);
|
|
|
44 |
my @shifts = ();
|
|
|
45 |
my $hours;
|
|
|
46 |
|
|
|
47 |
$sth2->execute($RCid, $RCid, $RCid);
|
|
|
48 |
while (my $S = $sth2->fetchrow_hashref()) {
|
|
|
49 |
push @shifts, $S;
|
|
|
50 |
$hours += $S->{volhours};
|
|
|
51 |
}
|
|
|
52 |
|
|
|
53 |
my $message = $h->p ("Greetings $dname,", "Thanks for all your hard work at RollerCon. Here are the volunteer hours we captured for you:");
|
|
|
54 |
|
|
|
55 |
$message .= $h->table ([
|
|
|
56 |
map { $h->tr ([ $h->td ( $_->{date},
|
|
|
57 |
$_->{dayofweek},
|
|
|
58 |
$_->{time},
|
|
|
59 |
$_->{volhours}." hr(s)",
|
|
|
60 |
$DEPT->{$_->{dept}},
|
|
|
61 |
$_->{role},
|
|
|
62 |
$_->{teams} ) ]) } @shifts
|
|
|
63 |
]);
|
|
|
64 |
$message .= $h->b ($hours." TOTAL HOURS");
|
|
|
65 |
# foreach (@shifts) {
|
|
|
66 |
# $message .= join " ", $_->{date}, sprintf ("%-9s", $_->{dayofweek}), $_->{time}, sprintf ("%-12s", $_->{volhours}." hr(s)"), $DEPT->{$_->{dept}}, $_->{role}, $_->{teams}."\n";
|
|
|
67 |
# $message .= "$_->{date} $_->{dayofweek} $_->{time} $_->{volhours} hr(s) $DEPT->{$_->{dept}} $_->{role} $_->{teams}\n";
|
|
|
68 |
# }
|
|
|
69 |
|
|
|
70 |
$message .= $h->p (
|
| 186 |
- |
71 |
"Do you see any discrepancies? If so, please <b>forward this email</b> (do not reply) <i>before</i> September 30th to: rollerconstaffing\@gmail.com, rollercon\@gmail.com<br>\n...and then in the body of the email tell us why we're updating your hours.",
|
| 112 |
- |
72 |
"We'll update our records, and you will see the updates on your user profile page in VORC. Emails received after September 29th can't be updated in VORC, so maybe take care of it right now - it's a quick email!",
|
| 53 |
bgadell |
73 |
"Then in October, we'll send out free / discounted info for next year's RollerCon to the email you listed in your profile in ".$h->a ({ href=>"https://volunteers.rollercon.com/schedule/" }, "VORC").". Thanks again. You're the one who keeps RollerCon rolling!!!!",
|
| 47 |
- |
74 |
$h->a ({ href=>"https://rollercon.com/help-wanted/" }, "More about freebies & discounts"),
|
|
|
75 |
$h->hr.$h->p ({ style=>"text-align:center" }, $h->b ("Volunteer Compensation")).$h->hr,
|
|
|
76 |
"All RollerCon volunteers get cool stuff at RollerCon, including a raffle ticket, limited-edition volunteer-only tee (while they last), and other schwag, snacks, goodwill and more every year, plus cool stuff from our sponsors.",
|
|
|
77 |
$h->ul ([
|
|
|
78 |
$h->li (
|
| 187 |
- |
79 |
$h->b ("5-19 hours")." qualifies you for a discounted pass that can be redeemed at a lower price than we ever sell until June.",
|
|
|
80 |
$h->b ("20 hours and over")." gets you a free pass plus all the other stuff above."
|
| 47 |
- |
81 |
)
|
|
|
82 |
]),
|
|
|
83 |
$h->br,
|
|
|
84 |
"--RollerCon HQ".$h->br.'rollercon@gmail.com'.$h->br."rollercon.com"
|
|
|
85 |
);
|
|
|
86 |
|
|
|
87 |
|
|
|
88 |
# $message .= "\n$hours TOTAL HOURS\n\nAgain, thank you for volunteering at RollerCon.\n\n-RollerCon Leadership Team";
|
|
|
89 |
|
| 189 |
- |
90 |
my $subject = $dname."'s $year RollerCon Volunteer Hours Summary";
|
| 47 |
- |
91 |
|
| 186 |
- |
92 |
print "Emailing $RCid. $dname ($email)...\n";
|
| 47 |
- |
93 |
use RCMailer;
|
|
|
94 |
EmailUser($email, $subject, $message);
|
|
|
95 |
sleep (15);
|
|
|
96 |
}
|
|
|
97 |
|
| 156 |
- |
98 |
print "\ndone.\n\n";
|