[LON-CAPA-cvs] cvs: modules /msu localenroll.pm
raeburn
raeburn at source.lon-capa.org
Thu Aug 8 06:41:21 EDT 2024
raeburn Thu Aug 8 10:41:21 2024 EDT
Modified files:
/modules/msu localenroll.pm
Log:
- Switch to use new views: RO_ClassList_CS_View and RO_Instructor_CS_View
instead of legacy views: RO_ClassList and RO_CLIFMS
-------------- next part --------------
Index: modules/msu/localenroll.pm
diff -u modules/msu/localenroll.pm:1.95 modules/msu/localenroll.pm:1.96
--- modules/msu/localenroll.pm:1.95 Tue Jul 16 13:01:25 2024
+++ modules/msu/localenroll.pm Thu Aug 8 10:41:21 2024
@@ -1,6 +1,6 @@
# functions to glue school database system into Lon-CAPA for
# automated enrollment
-# $Id: localenroll.pm,v 1.95 2024/07/16 13:01:25 raeburn Exp $
+# $Id: localenroll.pm,v 1.96 2024/08/08 10:41:21 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -190,7 +190,7 @@
$subj =~tr/a-z/A-Z/;
$crse =~tr/a-z/A-Z/;
$sec =~s/^_//;
- my $sth = $dbh->prepare("SELECT Pid,Pilot_Id,Student_Name,Student_Preferred_First_Name,Sctn_Crdt_Hours FROM RO_ClassList WHERE (Term_Code = '$sem' AND Subj_Code = '$subj' AND Crse_Code = '$crse' AND Sctn_Code = '$sec') ORDER BY Student_Name");
+ my $sth = $dbh->prepare("SELECT Pid,Pilot_Id,Student_Name,Student_Preferred_First_Name,Sctn_Crdt_Hours FROM RO_ClassList_CS_View WHERE (Term_Code = '$sem' AND Subj_Code = '$subj' AND Crse_Code = '$crse' AND Sctn_Code = '$sec') ORDER BY Student_Name");
$sth->execute();
while ( my($pid,$pilot,$name,$first,$credits) = $sth->fetchrow_array ) {
if ($pilot =~ /^\w{2,8}$/) {
@@ -314,7 +314,7 @@
my $quotedterm = $dbh3->quote($term);
my $sth;
if ($database eq 'RO') {
- $sth = $dbh3->prepare("SELECT DISTINCT(Sctn_Code) FROM RO_CLIFMS WHERE (Subj_Code = $quotedsubj AND Crse_Code = $quotedcrse AND Term_Code = $quotedterm) ORDER BY Sctn_Code");
+ $sth = $dbh3->prepare("SELECT DISTINCT(Sctn_Code) FROM RO_Instructor_CS_View WHERE (Subj_Code = $quotedsubj AND Crse_Code = $quotedcrse AND Term_Code = $quotedterm) ORDER BY Sctn_Code");
} elsif ($database eq 'SISCS') {
$sth = $dbh3->prepare( "SELECT CLASS_SECTION FROM R_CLASSSCHEDULE_RV WHERE (SUBJECT = $quotedsubj AND CRSE_CODE = $quotedcrse AND TERM_DESCRSHORT = $quotedterm) ORDER BY CLASS_SECTION ");
} else {
@@ -388,8 +388,8 @@
($dbhlc,$dbflaglc) = &connect_DB('LC');
}
if ($dbflag) {
-# Check if owner is in CLIFMS for this course
- my $clifmscount = $dbh->selectrow_array("SELECT count(*) FROM RO_CLIFMS WHERE Term_Code='$term' AND Subj_Code='$subj' AND Crse_Code='$crse' AND Sctn_Code='$sec' AND MSUNetID='$owner' AND ($recordtype)");
+# Check if owner is in RO_Instructor_CS_View for this course
+ my $clifmscount = $dbh->selectrow_array("SELECT count(*) FROM RO_Instructor_CS_View WHERE Term_Code='$term' AND Subj_Code='$subj' AND Crse_Code='$crse' AND Sctn_Code='$sec' AND MSUNetID='$owner' AND ($recordtype)");
if ($clifmscount > 0) {
if ($dbflaglc) {
my $loncount = $dbhlc->selectrow_array("SELECT count(*) FROM LONCAPA WHERE Term_Code='$term' AND Subj_Code='$subj' AND Crse_Code='$crse' AND Sctn_Code='$sec' AND MSUNetID='$owner'");
@@ -410,7 +410,7 @@
my $coowner = $1;
my $coownerdom = $2;
if (($coowner !~ /\W/) && ($coownerdom eq $dom)) {
- # Is co-owner in CLIFMS for course?
+ # Is co-owner in RO_Instructor_CS_View for course?
unless (grep(/^\Q$coowner\E$/, at netids)) {
push(@netids,$coowner);
}
@@ -419,7 +419,7 @@
}
if (@netids > 0) {
foreach my $coowner (@netids) {
- my $clifmscoowner = $dbh->selectrow_array("SELECT count(*) FROM RO_CLIFMS WHERE Term_Code='$term' AND Subj_Code='$subj' AND Crse_Code='$crse' AND Sctn_Code='$sec' AND MSUNetID='$coowner' AND ($recordtype)");
+ my $clifmscoowner = $dbh->selectrow_array("SELECT count(*) FROM RO_Instructor_CS_View WHERE Term_Code='$term' AND Subj_Code='$subj' AND Crse_Code='$crse' AND Sctn_Code='$sec' AND MSUNetID='$coowner' AND ($recordtype)");
if ($clifmscoowner > 0) {
if ($dbflaglc) {
my $loncoowner = $dbhlc->selectrow_array("SELECT count(*) FROM LONCAPA WHERE Term_Code='$term' AND Subj_Code='$subj' AND Crse_Code='$crse' AND Sctn_Code='$sec' AND MSUNetID='$coowner'");
@@ -437,7 +437,7 @@
unless ($outcome eq 'ok') {
my ($check_clifms,$error);
#
-# is the owner or any co-owners not in CLIFMS for this term, subject, course, section instance
+# is the owner or any co-owners not in RO_Instructor_CS_View for this term, subject, course, section instance
# a department administrator for the subject and course number for the relevant time period.
#
if (&is_dept_administrator($sem,$yr,$subj,$crse,$owner,$dbh,\$error)) {
@@ -483,9 +483,9 @@
unless ($outcome eq 'ok') {
if (@netids > 0) {
my $coownstr = join(',', at netids);
- $outcome = "Inclusion of enrollment could not be established for the course section $course_id because neither the owner ($owner) or co-owners ($coownstr) of this LON-CAPA course are not included in CLIFMS as instructional faculty for the requested semester, course and section. Please contact the administrator of the department that controls course $course_id and ask for $owner to be added as faculty or supervisor.";
+ $outcome = "Inclusion of enrollment could not be established for the course section $course_id because neither the owner ($owner) or co-owners ($coownstr) of this LON-CAPA course are not included in RO_Instructor_CS_View as instructional faculty for the requested semester, course and section. Please contact the administrator of the department that controls course $course_id and ask for $owner to be added as faculty or supervisor.";
} else {
- $outcome = "Inclusion of enrollment could not be established for the course section $course_id because the owner ($owner) of this LON-CAPA course is not included in CLIFMS as instructional faculty for the requested semester, course and section. Please contact the administrator of the department that controls course $course_id and ask for $owner to be added as faculty or supervisor.";
+ $outcome = "Inclusion of enrollment could not be established for the course section $course_id because the owner ($owner) of this LON-CAPA course is not included in RO_Instructor_CS_View as instructional faculty for the requested semester, course and section. Please contact the administrator of the department that controls course $course_id and ask for $owner to be added as faculty or supervisor.";
}
}
}
@@ -574,7 +574,7 @@
my $quotedsec = $dbh3->quote($sec);
my $count;
if ($database eq 'RO') {
- $count = $dbh3->selectrow_array( "SELECT count(*) FROM RO_CLIFMS WHERE (Subj_Code = $quotedsubj AND Crse_Code = $quotedcrse AND Sctn_Code = $quotedsec AND Term_Code = $quotedterm)" );
+ $count = $dbh3->selectrow_array( "SELECT count(*) FROM RO_Instructor_CS_View WHERE (Subj_Code = $quotedsubj AND Crse_Code = $quotedcrse AND Sctn_Code = $quotedsec AND Term_Code = $quotedterm)" );
} elsif ($database eq 'SISCS') {
$count = $dbh3->selectrow_array( "SELECT count(*) FROM R_CLASSSCHEDULE_RV WHERE SUBJECT = $quotedsubj AND CRSE_CODE = $quotedcrse AND CLASS_SECTION = $quotedsec AND TERM_DESCRSHORT = $quotedterm ");
} else {
@@ -631,15 +631,15 @@
$database = 'RO';
($dbh,$dbflag) = &connect_DB($database);
if ($dbflag) {
-# Check if instructor is in CLIFMS for this course
+# Check if instructor is in RO_Instructor_CS_View for this course
eval {
- my $clifmscount = $dbh->selectrow_array("SELECT count(*) FROM RO_CLIFMS WHERE Term_Code='$term' AND Subj_Code='$subj' AND Crse_Code='$crse' AND MSUNetID='$ownername' AND ($recordtype)");
+ my $clifmscount = $dbh->selectrow_array("SELECT count(*) FROM RO_Instructor_CS_View WHERE Term_Code='$term' AND Subj_Code='$subj' AND Crse_Code='$crse' AND MSUNetID='$ownername' AND ($recordtype)");
if ($clifmscount > 0) {
$outcome = 'valid';
}
};
if ($@) {
- $outcome = "There was a problem connecting to the CLIFMS database, so the course number could not be validated.";
+ $outcome = "There was a problem connecting to the RO_Instructor_CS_View database, so the course number could not be validated.";
}
unless ($outcome eq 'valid') {
# Check if instructor is a Dept. Administrator
@@ -681,7 +681,7 @@
my $quotedterm = $dbh->quote($term);
my $count;
if ($database eq 'RO') {
- $count = $dbh->selectrow_array( "SELECT count(*) FROM RO_CLIFMS WHERE (Subj_Code = $quotedsubj AND Crse_Code = $quotedcrse AND Term_Code = $quotedterm)" );
+ $count = $dbh->selectrow_array( "SELECT count(*) FROM RO_Instructor_CS_View WHERE (Subj_Code = $quotedsubj AND Crse_Code = $quotedcrse AND Term_Code = $quotedterm)" );
} elsif ($database eq 'SISCS') {
$count = $dbh->selectrow_array( "SELECT count(*) FROM R_CLASSSCHEDULE_RV WHERE SUBJECT = $quotedsubj AND CRSE_CODE = $quotedcrse AND TERM_DESCRSHORT = $quotedterm ");
} else {
@@ -698,7 +698,7 @@
my $title;
if ($database eq 'RO') {
eval {
- $title = $dbh->selectrow_array( "SELECT DISTINCT(Title) FROM RO_ClassList WHERE (Subj_Code = $quotedsubj AND Crse_Code= $quotedcrse AND Term_Code = $quotedterm)" );
+ $title = $dbh->selectrow_array( "SELECT DISTINCT(Title) FROM RO_ClassList_CS_View WHERE (Subj_Code = $quotedsubj AND Crse_Code= $quotedcrse AND Term_Code = $quotedterm)" );
};
} elsif ($database eq 'SISCS') {
my $crsdate;
@@ -734,7 +734,7 @@
my $quotedterm = $dbh->quote($term);
my $credsth;
if ($database eq 'RO') {
- $credsth = $dbh->prepare("SELECT DISTINCT(Sctn_Crdt_Hours) FROM RO_ClassList WHERE (Subj_Code = $quotedsubj AND Crse_Code = $quotedcrse AND Term_Code = $quotedterm)");
+ $credsth = $dbh->prepare("SELECT DISTINCT(Sctn_Crdt_Hours) FROM RO_ClassList_CS_View WHERE (Subj_Code = $quotedsubj AND Crse_Code = $quotedcrse AND Term_Code = $quotedterm)");
} elsif ($database eq 'SISCS') {
$credsth = $dbh->prepare("SELECT UNITS_MAXIMUM FROM R_CLASSSCHEDULE_RV WHERE SUBJECT = $quotedsubj AND CRSE_CODE = $quotedcrse AND TERM_DESCRSHORT = $quotedterm");
} else {
@@ -1019,7 +1019,7 @@
eval {
my $sth;
if ($database eq 'RO') {
- $sth = $dbh->prepare("SELECT DISTINCT(Subj_Code) FROM RO_CLIFMS ORDER BY Subj_Code");
+ $sth = $dbh->prepare("SELECT DISTINCT(Subj_Code) FROM RO_Instructor_CS_View ORDER BY Subj_Code");
} elsif ($database eq 'SIS') {
$sth = $dbh->prepare("SELECT DISTINCT(Subj_Code) FROM SISCRSS");
} else {
@@ -1149,7 +1149,7 @@
$crse =~tr/a-z/A-Z/;
$sec =~s/^_//;
eval {
- my $sth = $dbh->prepare("SELECT Pid,Pilot_Id FROM RO_ClassList WHERE Term_Code = '$term' AND Subj_Code = '$subj' AND Crse_Code = '$crse' AND Sctn_Code = '$sec' ORDER BY Pid");
+ my $sth = $dbh->prepare("SELECT Pid,Pilot_Id FROM RO_ClassList_CS_View WHERE Term_Code = '$term' AND Subj_Code = '$subj' AND Crse_Code = '$crse' AND Sctn_Code = '$sec' ORDER BY Pid");
$sth->execute();
while ( my($pid,$pilot,$name) = $sth->fetchrow_array ) {
$pid =~ s/^1(\d{8})$/A$1/;
@@ -1305,7 +1305,7 @@
} else {
$recordtype = qq(Record_Type='1' OR Record_Type='2' OR Record_Type ='3' OR Record_Type = '9');
}
- my $statement = "SELECT MSUNetID FROM RO_CLIFMS WHERE Term_Code='$term' AND Subj_Code='$subj' AND Crse_Code='$crse' AND Sctn_Code='$sec' AND ($recordtype)";
+ my $statement = "SELECT MSUNetID FROM RO_Instructor_CS_View WHERE Term_Code='$term' AND Subj_Code='$subj' AND Crse_Code='$crse' AND Sctn_Code='$sec' AND ($recordtype)";
my $sth = $dbh->prepare("$statement");
$sth->execute();
while ( my ($uname) = $sth->fetchrow_array ) {
@@ -1339,8 +1339,8 @@
my @order = ('ro','cs');
my %tables = (
ro => {
- Faculty => 'RO_CLIFMS',
- Student => 'RO_ClassList',
+ Faculty => 'RO_Instructor_CS_View',
+ Student => 'RO_ClassList_CS_View',
},
cs => {
Faculty => 'R_CLASSINSTRUCTORS_RV',
@@ -1355,8 +1355,8 @@
},
);
my %table_to_affiliation = (
- RO_CLIFMS => 'Faculty',
- RO_ClassList => 'Student',
+ RO_Instructor_CS_View => 'Faculty',
+ RO_ClassList_CS_View => 'Student',
R_CLASSINSTRUCTORS_RV => 'Faculty',
FACULTY_VU => 'Faculty',
STAFF_VU => 'Staff',
@@ -2015,7 +2015,7 @@
$statement .= ' WHERE '.$condition{$key};
}
} elsif ($key eq 'ro') {
- if ($table eq 'RO_CLIFMS') {
+ if ($table eq 'RO_Instructor_CS_View') {
$statement = "SELECT DISTINCT MSUNetId,Emp_Id,PID,Name,Record_Type,Term_Seq_Id FROM $table";
if ($condition{$key}{$table_to_key{$table}}) {
$statement .= " WHERE (($condition{$key}{$table_to_key{$table}}) AND (Record_Type = '1' OR Record_Type = 'PI'))";
@@ -2052,7 +2052,7 @@
$name =~ s/^\s+//;
$name =~ s/\s+$//;
($last,$given) = split(/\,/,$name,2);
- if ($table eq 'RO_CLIFMS') {
+ if ($table eq 'RO_Instructor_CS_View') {
if ($rest[0] =~ /^Z\d{8}$/) {
$pid = $rest[0];
} elsif ($pid eq $uname) {
@@ -2129,7 +2129,7 @@
$last =~ s/^(Mc)(\w)/$1\u$2/;
}
}
- unless ((($key eq 'ro') && ($table eq 'RO_ClassList')) || ($ldap_checked{$uname})) {
+ unless ((($key eq 'ro') && ($table eq 'RO_ClassList_CS_View')) || ($ldap_checked{$uname})) {
unless (ref($instusers->{$uname}) eq 'HASH') {
if (ref($ldap_users->{$uname}) eq 'HASH') {
$instusers->{$uname} = $ldap_users->{$uname};
More information about the LON-CAPA-cvs
mailing list