Subversion Repositories ORC

Rev

Blame | Last modification | View Log | RSS feed

#!/usr/bin/perl

use strict;
use cPanelUserConfig;
use RollerCon;
use tableViewer;
use DateTime;

my $dt = DateTime->today;
my $day = $dt->day_name;
my $date = $dt->date;

my $dbh = getDBConnection();
my $sth1 = $dbh->prepare("select distinct RCid from (select distinct RCId from v_shift where date = date(now()) union select distinct RCid from v_shift_announcer where date = date(now()) union select distinct RCid from v_shift_officiating where date = date(now())) t1  where RCid != '' order by RCid");
my $sth2 = $dbh->prepare("select * from (select id, date, dayofweek, location, time, role, '' as teams, type from v_shift where RCid = ? union select id, date, dayofweek, track as location, time, role, teams, gtype as type from v_shift_announcer where RCid = ? union select id, date, dayofweek, track as location, time, role, teams, gtype as type from v_shift_officiating where RCid = ?) temp where date = date(now()) order by date, time");

$sth1->execute();
while (my ($RCid) = $sth1->fetchrow_array()) {
        my $email = getUserEmail($RCid);
        my $dname = getUserDerbyName($RCid);
        my @shifts = ();
        
        $sth2->execute($RCid, $RCid, $RCid);
        while (my $S = $sth2->fetchrow_hashref()) {
                push @shifts, $S;
        }
        
        my $message=<<term1;
Greetings $dname,

Here is your RollerCon Volunteer (and MVP Class) schedule for today, $day, $date.

Please note that it is very important to fulfill your assigned shifts.  It is too late to drop today's shifts in the scheduling tool.  If you find you are unable to work a shift, please notify an On Duty Lead from the department you are scheduled to work (or VCI) at least 30 minutes before your shift.  Anyone who "No Show; No Calls" is at risk of losing the rest of their assigned shifts, being barred from volunteering for the rest of this year and/or beyond, and even possibly losing their badge.  (That's how big of a deal it is!)  But of course we know a lovely person such as yourself would never do that.  Right?

Well, here's what you've got:

term1

        foreach (@shifts) {
                $message .= "$_->{date} $_->{dayofweek} $_->{location}  $_->{time}      $_->{role}      $_->{teams}\n";
        }

        $message .= "\n\nAgain, thank you for volunteering at RollerCon.\n\n-RollerCon Leadership Team";
        
        my $subject = "$dname's RollerCon $day Volunteer (or MVP Class) Schedule";
        
        use RCMailer;
        EmailUser($email, $subject, $message);
#       print "DEBUG: Emailing $email here...\n";
}