Diff for /loncom/enrollment/Enrollment.pm between versions 1.44 and 1.48

version 1.44, 2013/03/01 05:20:01 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 613  sub create_newuser { Line 619  sub create_newuser {
                         if ($start > 0) {                          if ($start > 0) {
                             $access_start = localtime($start)                              $access_start = localtime($start)
                         }                          }
                         $body = &mt('You have been enrolled in the LON-CAPA system at your institution, because you are a registered student in a class which is using the LON-CAPA couse management and online homework system.')."\n\n".&mt("You should log-in to the system using the following credentials:\nusername: [_1]\npassword: [_2]",$uname,$authparam)."\n\n".&mt('The URL you should use to access the LON-CAPA system at your institution is: ').$portalurl."\n\n".&mt('When you log-in you will be able to access the LON-CAPA course for [_1] - [_2] starting [_3].',$$courseinfo{'description'},$$courseinfo{'inst_code'},$access_start)."\n";                          $body =
                               &mt('You have been enrolled in the LON-CAPA system at your institution, because you are a registered student in a class which is using the LON-CAPA course management and online homework system.')."\n\n"
                              .&mt("You should log-in to the system using the following credentials:\nusername: [_1]\npassword: [_2]",$uname,$authparam)."\n\n"
                              .&mt('The URL you should use to access the LON-CAPA system at your institution is: ').$portalurl."\n\n"
                              .&mt('When you log-in you will be able to access the LON-CAPA course for [_1] - [_2] starting [_3].',$$courseinfo{'description'},$$courseinfo{'inst_code'},$access_start)."\n";
                     }                      }
                     &Apache::lonmsg::sendemail($emailaddr,$subject,$body);                      &Apache::lonmsg::sendemail($emailaddr,$subject,$body);
                 }                  }
Line 647  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;
                                                                                                                                                                       

Removed from v.1.44  
changed lines
  Added in v.1.48


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>