Rev 180 | Blame | Compare with Previous | Last modification | View Log | RSS feed
#!/usr/bin/perluse strict;use cPanelUserConfig;use RollerCon;use WebDB;use DBI;my $dbh = WebDB::connect ();my $add_boop = $dbh->prepare ("insert into assignment (Gid, role, RCid) values (?, ?, ?)");while (my $input = <>) {my ($wbid, $MVPid, $date, $start_time, @name) = split /,/, $input;my $name = join ",", @name;$name =~ s/\s+$//;# warn "FOUND: $wbid, $MVPid, $date, $start_time, @name";# Get the RCidmy ($RCid) = $dbh->selectrow_array ("select RCid from v_official where MVPid = ?", undef, $MVPid);warn "ERROR: No RCid found for MVPid [$MVPid]" and next unless $RCid;# Get the class locationmy ($location) = $dbh->selectrow_array ("select location from class where date = ? and start_time = ? and name = ?", undef, $date, $start_time, $name);warn "ERROR: No Location Found for [$date, $start_time, $name]" and next unless $location;# Get the class id and role idmy ($class_id, $role) = $dbh->selectrow_array ("select id, concat('CLA-', max(cast(substring_index(role, '-', -1) as UNSIGNED)) +1) as role, count(role) from v_class_signup_new where date = ? and start_time = ? and location = ?", undef, $date, $start_time, $location);warn "ERROR: Unable to calculuate RoleID for [$date, $start_time, $location]" and next unless ($class_id and $role);# print "executing [$class_id, $role, $RCid, $wbid]\n" and next;# Add the scann$add_boop->execute ($class_id, $role, $RCid);warn "DBERROR: " .$dbh->errstr unless !$dbh->errstr;}