Diff for /loncom/enrollment/Enrollment.pm between versions 1.53 and 1.58

version 1.53, 2019/05/14 13:39:18 version 1.58, 2022/02/03 17:37:57
Line 25 Line 25
 #  #
 package LONCAPA::Enrollment;  package LONCAPA::Enrollment;
   
   use lib '/home/httpd/lib/perl';
 use Apache::loncoursedata;  use Apache::loncoursedata;
 use Apache::lonnet;  use Apache::lonnet;
 use Apache::loncommon();  use Apache::loncommon();
Line 35  use HTML::Parser; Line 36  use HTML::Parser;
 use LONCAPA::Configuration;  use LONCAPA::Configuration;
 use Math::Random;  use Math::Random;
 use Time::Local;  use Time::Local;
 use lib '/home/httpd/lib/perl';  
   
 use strict;  use strict;
   
 sub update_LC {  sub update_LC {
     my ($dom,$crs,$adds,$drops,$startdate,$enddate,$authtype,$autharg,      my ($dom,$crs,$adds,$drops,$startdate,$enddate,$authtype,$autharg,
         $showcredits,$defaultcredits,$autofailsafe,$classesref,$groupref,          $showcredits,$defaultcredits,$autofailsafe,$failsafe,$classesref,
         $logmsg,$newusermsg,$context,$phototypes) = @_;          $groupref,$logmsg,$newusermsg,$context,$phototypes) = @_;
 # Get institutional code and title of this class  # Get institutional code and title of this class
     my %courseinfo = ();      my %courseinfo = ();
     &get_courseinfo($dom,$crs,\%courseinfo);      &get_courseinfo($dom,$crs,\%courseinfo);
Line 331  sub update_LC { Line 331  sub update_LC {
                     }                      }
                 }                  }
 # Check for institutional section change  # Check for institutional section change
                 if (($$currlist{$uname}[$instidx] ne $instsec) && (!$added)) {                  if (($$currlist{$uname}[$instidx] ne $instsec) && (!$added) && ($$currlist{$uname}[$type] eq "auto")) {
                     my $modify_instsec_result =                      my $modify_instsec_result =
                         &Apache::lonnet::modify_student_enrollment($dom,$uname,undef,undef,undef,undef,undef,$stuinfo[ $place{groupID} ],$enddate,$startdate,'auto','',$cid,'',$context,$credits,$instsec);                          &Apache::lonnet::modify_student_enrollment($dom,$uname,undef,undef,undef,undef,undef,$stuinfo[ $place{groupID} ],$enddate,$startdate,'auto','',$cid,'',$context,$credits,$instsec);
                     if ($modify_instsec_result =~ /^ok/) {                      if ($modify_instsec_result =~ /^ok/) {
Line 452  sub update_LC { Line 452  sub update_LC {
 # Check enrollment count for institutional section of student to be dropped   # Check enrollment count for institutional section of student to be dropped 
                         if ($$currlist{$uname}[$instidx]) {                          if ($$currlist{$uname}[$instidx]) {
                             if (exists($classcount{$$currlist{$uname}[$instidx]})) {                              if (exists($classcount{$$currlist{$uname}[$instidx]})) {
                                 if ($classcount{$$currlist{$uname}[$instidx]} == 0) {                                  if ($failsafe eq 'any') { 
                                     if ($autofailsafe) {                                      if ($autofailsafe) {
                                         push(@{$delaydrops{$$currlist{$uname}[$instidx]}},$uname);                                              push(@{$delaydrops{$$currlist{$uname}[$instidx]}},$uname);
                                         next;                                          next;
                                     }                                      }
                                   } else {
                                       unless ($failsafe eq 'off') {
                                           if ($classcount{$$currlist{$uname}[$instidx]} == 0) {
                                               if ($autofailsafe) {
                                                   push(@{$delaydrops{$$currlist{$uname}[$instidx]}},$uname);
                                                   next;
                                               }
                                           }
                                       }
                                 }                                  }
                             }                              }
                         }                          }
Line 479  sub update_LC { Line 488  sub update_LC {
             foreach my $class (keys(%delaydrops)) {              foreach my $class (keys(%delaydrops)) {
                 if (ref($delaydrops{$class}) eq 'ARRAY') {                  if (ref($delaydrops{$class}) eq 'ARRAY') {
                     if ($autofailsafe < scalar(@{$delaydrops{$class}})) {                      if ($autofailsafe < scalar(@{$delaydrops{$class}})) {
                         $$logmsg .= &mt('The following students were not expired from the old section [_1] because the enrollment count retrieved for that institutional section was zero, and the number of students with roles to expire exceeded the failsafe threshold of [_2]:',$class,$autofailsafe);                          if ($failsafe eq 'any') {
                               $$logmsg .= &mt('The following students were not expired from the old section [_1] because the number of students with roles to expire exceeded the failsafe threshold of [_2], set to apply when the enrollment retrieved for an institutional section is zero or greater:',$class,$autofailsafe);
                           } else {
                               $$logmsg .= &mt('The following students were not expired from the old section [_1] because the enrollment count retrieved for that institutional section was zero, and the number of students with roles to expire exceeded the failsafe threshold of [_2]:',$class,$autofailsafe);
                           }
                         if ($context eq "updatenow") {                          if ($context eq "updatenow") {
                             $$logmsg .= '<br />'.join('<br />',@{$delaydrops{$class}}).$linefeed;                               $$logmsg .= '<br />'.join('<br />',@{$delaydrops{$class}}).$linefeed; 
                         } elsif ($context eq "automated") {                          } elsif ($context eq "automated") {
Line 566  sub create_newuser { Line 579  sub create_newuser {
     my $pid = $args->{'pid'};      my $pid = $args->{'pid'};
     my $first = $args->{'first'};      my $first = $args->{'first'};
     my $middle = $args->{'middle'};      my $middle = $args->{'middle'};
     my $last = $args->{'last'} ;      my $last = $args->{'last'};
     my $gene = $args->{'gene'};      my $gene = $args->{'gene'};
     my $usec = $args->{'usec'};      my $usec = $args->{'usec'};
     my $end = $args->{'end'};      my $end = $args->{'end'};
Line 955  sub create_password { Line 968  sub create_password {
     my ($udom) = @_;      my ($udom) = @_;
     my %passwdconf = &Apache::lonnet::get_passwdconf($udom);      my %passwdconf = &Apache::lonnet::get_passwdconf($udom);
     my ($min,$max,@chars);      my ($min,$max,@chars);
       $min = $Apache::lonnet::passwdmin;
     if (ref($passwdconf{'chars'}) eq 'ARRAY') {      if (ref($passwdconf{'chars'}) eq 'ARRAY') {
         if ($passwdconf{'min'} =~ /^\d+$/) {          if ($passwdconf{'min'} =~ /^\d+$/) {
             $min = $passwdconf{'min'};              if ($passwdconf{'min'} > $min) {
                   $min = $passwdconf{'min'};
               }
         }          }
         if ($passwdconf{'max'} =~ /^\d+$/) {          if ($passwdconf{'max'} =~ /^\d+$/) {
             $max = $passwdconf{'max'};              $max = $passwdconf{'max'};

Removed from v.1.53  
changed lines
  Added in v.1.58


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