version 1.45, 2013/07/24 18:21:49
|
version 1.48, 2016/06/03 01:22:36
|
Line 61 sub update_LC {
|
Line 61 sub update_LC {
|
my @activestudents = (); |
my @activestudents = (); |
my @excludedstudents = (); |
my @excludedstudents = (); |
my $currlist; |
my $currlist; |
|
my $now = time; |
foreach my $uname (keys %{$roster} ) { |
foreach my $uname (keys %{$roster} ) { |
if ($uname =~ m/^(.+):$dom$/) { |
if ($uname =~ m/^(.+):$dom$/) { |
if ($$roster{$uname}[$status] eq "Active") { |
if ($$roster{$uname}[$status] eq "Active") { |
Line 196 sub update_LC {
|
Line 197 sub update_LC {
|
} |
} |
} |
} |
|
|
# Explicitly allow access to creation/modification of students if called as an automated process. |
# Explicitly allow access to creation/modification of students and group membership changes |
|
# when called as an automated process. |
if ($context eq 'automated') { |
if ($context eq 'automated') { |
$env{'allowed.cst'}='F'; |
$env{'allowed.cst'}='F'; |
|
$env{'allowed.mdg'}='F'; |
} |
} |
|
|
# Compare IDs with existing LON-CAPA enrollment for this class |
# Compare IDs with existing LON-CAPA enrollment for this class |
Line 229 sub update_LC {
|
Line 232 sub update_LC {
|
my $drop_reply = &Apache::lonnet::modifystudent($dom,$uname,'','','',undef,undef,undef,undef,$$currlist{$uname}[$sec],time,undef,undef,undef,undef,'auto','',$cid,'',$context); |
my $drop_reply = &Apache::lonnet::modifystudent($dom,$uname,'','','',undef,undef,undef,undef,$$currlist{$uname}[$sec],time,undef,undef,undef,undef,'auto','',$cid,'',$context); |
# re-enroll as auto student |
# re-enroll as auto student |
if ($drop_reply !~ /^ok/) { |
if ($drop_reply !~ /^ok/) { |
$$logmsg .= &mt('An error occured during the attempt to convert [_1] from a manual type to an auto type student - [_2].',$uname,$drop_reply).$linefeed; |
$$logmsg .= &mt('An error occurred during the attempt to convert [_1] from a manual type to an auto type student - [_2].',$uname,$drop_reply).$linefeed; |
} else { |
} else { |
# re-enroll as auto student |
# re-enroll as auto student |
my ($auth,$authparam,$first,$middle,$last,$gene,$usec,$end,$start,$emailaddr,$pid,$emailenc); |
my ($auth,$authparam,$first,$middle,$last,$gene,$usec,$end,$start,$emailaddr,$pid,$emailenc); |
Line 339 sub update_LC {
|
Line 342 sub update_LC {
|
my ($auth,$authparam,$first,$middle,$last,$gene,$usec,$end,$start,$emailaddr,$pid,$emailenc,$credithours); |
my ($auth,$authparam,$first,$middle,$last,$gene,$usec,$end,$start,$emailaddr,$pid,$emailenc,$credithours); |
&prepare_add($authtype,$autharg,$enddate,$startdate,\@stuinfo,\%place,\$dom,\$uname,\$auth,\$authparam,\$first,\$middle,\$last,\$gene,\$usec,\$end,\$start,\$emailaddr,\$pid,\$emailenc); |
&prepare_add($authtype,$autharg,$enddate,$startdate,\@stuinfo,\%place,\$dom,\$uname,\$auth,\$authparam,\$first,\$middle,\$last,\$gene,\$usec,\$end,\$start,\$emailaddr,\$pid,\$emailenc); |
# Check for existing account in this LON-CAPA domain for this username |
# Check for existing account in this LON-CAPA domain for this username |
|
next if (($end) && ($end < $now)); |
my $uhome=&Apache::lonnet::homeserver($uname,$dom); |
my $uhome=&Apache::lonnet::homeserver($uname,$dom); |
if ($uhome eq 'no_host') { # User does not exist |
if ($uhome eq 'no_host') { # User does not exist |
my $args = {'auth' => $auth, |
my $args = {'auth' => $auth, |
Line 429 sub update_LC {
|
Line 433 sub update_LC {
|
} elsif (@saved == 0) { |
} elsif (@saved == 0) { |
my $drop_reply = &Apache::lonnet::modifystudent($dom,$uname,'','','',undef,undef,undef,undef,$$currlist{$uname}[$sec],time,undef,undef,undef,undef,'auto','',$cid,'',$context); |
my $drop_reply = &Apache::lonnet::modifystudent($dom,$uname,'','','',undef,undef,undef,undef,$$currlist{$uname}[$sec],time,undef,undef,undef,undef,'auto','',$cid,'',$context); |
if ($drop_reply !~ /^ok/) { |
if ($drop_reply !~ /^ok/) { |
$$logmsg .= &mt('An error occured during the attempt to expire the [_1] from the old section [_2] - [_3].',$uname,$$currlist{$uname}[$sec],$drop_reply).$linefeed; |
$$logmsg .= &mt('An error occurred during the attempt to expire the [_1] from the old section [_2] - [_3].',$uname,$$currlist{$uname}[$sec],$drop_reply).$linefeed; |
} else { |
} else { |
$dropcount ++; |
$dropcount ++; |
my %userenv = &Apache::lonnet::get('environment',['firstname','lastname','id'],$dom,$uname); |
my %userenv = &Apache::lonnet::get('environment',['firstname','lastname','id'],$dom,$uname); |
Line 444 sub update_LC {
|
Line 448 sub update_LC {
|
} |
} |
} |
} |
|
|
# Terminated explictly allowed access to student creation/modification |
# Terminated explictly allowed access to student creation/modification |
|
# and group membership changes |
if ($context eq 'automated') { |
if ($context eq 'automated') { |
delete($env{'allowed.cst'}); |
delete($env{'allowed.cst'}); |
|
delete($env{'allowed.mdg'}); |
} |
} |
if ($enrollcount > 0) { |
if ($enrollcount > 0) { |
if ($context eq "updatenow") { |
if ($context eq "updatenow") { |
Line 651 sub prepare_add {
|
Line 657 sub prepare_add {
|
$$start = $$stuinfo[ $$place{'startdate'} ]; |
$$start = $$stuinfo[ $$place{'startdate'} ]; |
$$emailaddr = $$stuinfo[ $$place{'email'} ]; |
$$emailaddr = $$stuinfo[ $$place{'email'} ]; |
$$pid = $$stuinfo[ $$place{'studentID'} ]; |
$$pid = $$stuinfo[ $$place{'studentID'} ]; |
|
|
# remove non alphanumeric values from section |
# remove non alphanumeric values from section |
$$usec =~ s/\W//g; |
$$usec =~ s/\W//g; |
|
|