[LON-CAPA-cvs] cvs: modules /msu localenroll.pm
raeburn
raeburn at source.lon-capa.org
Thu Nov 20 00:51:58 EST 2025
raeburn Thu Nov 20 05:51:58 2025 EDT
Modified files:
/modules/msu localenroll.pm
Log:
- Information about MSU Dept. Administrators ceased to be available from
LONCAPA_DeptAdministrators table after switch to use RO_Instructor_CS_View.
-------------- next part --------------
Index: modules/msu/localenroll.pm
diff -u modules/msu/localenroll.pm:1.97 modules/msu/localenroll.pm:1.98
--- modules/msu/localenroll.pm:1.97 Thu Aug 8 13:45:31 2024
+++ modules/msu/localenroll.pm Thu Nov 20 05:51:58 2025
@@ -1,6 +1,6 @@
# functions to glue school database system into Lon-CAPA for
# automated enrollment
-# $Id: localenroll.pm,v 1.97 2024/08/08 13:45:31 raeburn Exp $
+# $Id: localenroll.pm,v 1.98 2025/11/20 05:51:58 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -141,42 +141,6 @@
}
}
}
- unless ($canuse) {
- # Check if the owner or any of the co-owner(s) is a Dept. Administrator
- my $check_clifms;
- if ($class =~ /^([suf]s)(\d{2})(\w{2,4})(\d{3,4}[A-Za-z]?)(\d{3}|_[A-Za-z0-9]{1,5})$/) {
- my ($sem,$yr,$subj,$crse,$sec) = ($1,$2,$3,$4,$5);
- $sem =~tr/a-z/A-Z/;
- $subj =~tr/a-z/A-Z/;
- $crse =~tr/a-z/A-Z/;
- $sec =~s/^_//;
- my ($check_clifms,$error);
- if (&is_dept_administrator($sem,$yr,$subj,$crse,$owner,$dbh,\$error)) {
- $check_clifms = 1;
- } elsif (@coowners) {
- foreach my $coowner (@coowners) {
- if (&is_dept_administrator($sem,$yr,$subj,$crse,$owner,$dbh,\$error)) {
- $check_clifms = 1;
- last;
- }
- }
- }
- if ($check_clifms) {
- my $term = $sem.$yr;
- my @instructors = &get_inst_instructors($term,$subj,$crse,$sec,$dbh);
- if (@instructors) {
- if ($dbhlc) {
- foreach my $user (@instructors) {
- my $sth = $dbhlc->prepare("INSERT IGNORE INTO LONCAPA (Term_Code, Subj_Code, Crse_Code, Sctn_Code, MSUNetId) VALUES ('$term','$subj','$crse','$sec','$user') ");
- $sth->execute;
- $sth->finish;
- }
- $canuse = 1;
- }
- }
- }
- }
- }
if ($canuse) {
my $xmlfile = $xmlstem.$class."_classlist.xml";
open(FILE, ">$xmlfile");
@@ -422,52 +386,6 @@
}
}
unless ($outcome eq 'ok') {
- my ($check_clifms,$error);
-#
-# 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)) {
- 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'");
- if ($loncount == 0) {
- my $sthad = $dbhlc->prepare("INSERT INTO LONCAPA (Term_Code, Subj_Code, Crse_Code, Sctn_Code, MSUNetId) VALUES ('$term','$subj','$crse','$sec','$owner') ");
- $sthad->execute;
- $sthad->finish;
- }
- }
- $outcome = 'ok';
- } else {
- if (@netids > 0) {
- foreach my $coowner (@netids) {
- if (&is_dept_administrator($sem,$yr,$subj,$crse,$coowner,$dbh,\$error)) {
- 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='$coowner'");
- if ($loncount == 0) {
- my $sthcoad = $dbhlc->prepare("INSERT INTO LONCAPA (Term_Code, Subj_Code, Crse_Code, Sctn_Code, MSUNetId) VALUES ('$term','$subj','$crse','$sec','$coowner') ");
- $sthcoad->execute;
- $sthcoad->finish;
- }
- }
- $outcome = 'ok';
- }
- }
- }
- }
- if ($outcome eq 'ok') {
- my @instructors = &get_inst_instructors($term,$subj,$crse,$sec,$dbh);
- if (@instructors) {
- if ($dbflaglc) {
- foreach my $user (@instructors) {
- my $sth = $dbhlc->prepare("INSERT IGNORE INTO LONCAPA (Term_Code, Subj_Code, Crse_Code, Sctn_Code, MSUNetId) VALUES ('$term','$subj','$crse','$sec','$user') ");
- $sth->execute;
- $sth->finish;
- }
- }
- }
- }
- }
- 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 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.";
@@ -629,18 +547,9 @@
$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
- my $error;
- if (&is_dept_administrator($sem,$yr,$subj,$crse,$ownername,$dbh,\$error)) {
- $outcome = 'valid';
- } elsif ($error) {
- $outcome = $error;
- }
- }
- unless ($outcome) {
$outcome = "There was no match in the MSU $database database to the combination of semester ($term), subject ($subj), course number ($crse) for the specified owner ($ownername).";
}
- }
+ }
} else {
$outcome = "The username provided for the course owner did not conform to the format used for MSU NetIDs.";
}
@@ -1249,38 +1158,6 @@
return $sectioncheck;
}
-sub is_dept_administrator {
- my ($sem,$yr,$subj,$crse,$owner,$dbh,$error) = @_;
- my $outcome;
- my $term = $sem.$yr;
- if ($dbh) {
- eval {
- my $seqid = &semyr_to_seqid($term,$sem,$yr);
- my $admincount = 0;
- my $adminsth = $dbh->prepare("SELECT Start_Term_Seq_Id,End_Term_Seq_Id FROM LONCAPA_DeptAdministrators WHERE subj_code = '$subj' AND crse_code = '$crse' AND PilotID = '$owner'");
- $adminsth->execute();
- while (my($start_seqid,$end_seqid) = $adminsth->fetchrow_array ) {
- $start_seqid =~ s/^0//;
- $end_seqid =~ s/^0//;
- if (($seqid >= $start_seqid) &&
- ($seqid <= $end_seqid)) {
- $admincount ++;
- }
- }
- $adminsth->finish;
- if ($admincount > 0) {
- $outcome = 'valid';
- }
- };
- if ($@) {
- if (ref($error)) {
- $$error = "There was a problem connecting to the DepartmentAdministrators database.";
- }
- }
- }
- return $outcome;
-}
-
sub get_inst_instructors {
my ($term,$subj,$crse,$sec,$dbh) = @_;
my @in_clifms;
More information about the LON-CAPA-cvs
mailing list