[LON-CAPA-cvs] cvs: loncom /interface lonpopulate.pm

raeburn raeburn at source.lon-capa.org
Fri Aug 20 17:16:13 EDT 2021


raeburn		Fri Aug 20 21:16:13 2021 EDT

  Modified files:              
    /loncom/interface	lonpopulate.pm 
  Log:
  - Support customization in localenroll.pm to eliminate ambiguity in extraction
    of institutional section from institutional course section for automated
    enrollment.
  
  
Index: loncom/interface/lonpopulate.pm
diff -u loncom/interface/lonpopulate.pm:1.88 loncom/interface/lonpopulate.pm:1.89
--- loncom/interface/lonpopulate.pm:1.88	Sun Jun 20 22:44:23 2021
+++ loncom/interface/lonpopulate.pm	Fri Aug 20 21:16:13 2021
@@ -1,5 +1,5 @@
 # automated enrollment configuration handler
-# $Id: lonpopulate.pm,v 1.88 2021/06/20 22:44:23 raeburn Exp $
+# $Id: lonpopulate.pm,v 1.89 2021/08/20 21:16:13 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2443,7 +2443,15 @@
 		    push(@sections,$secentry);
 		    $seccount ++;
 		} else {
-		    my $newsec = $coursecode.$env{"form.$secnum"};
+                    my $newsec;
+                    my $crskey = $crs.':'.$coursecode;
+                    my %formattedsec = &Apache::lonnet::auto_instsec_reformat($dom,'clutter',
+                                                                  {$crskey => [$env{"form.$secnum"}]});
+                    if (ref($formattedsec{$crskey}) eq 'ARRAY') {
+                        $newsec = $coursecode.$formattedsec{$crskey}->[0];
+                    } else {
+                        $newsec = $coursecode.$env{"form.$secnum"};
+                    }
 		    my $coursecheck = &Apache::lonnet::auto_validate_courseID($crs,$dom,$newsec);
 		    if ($coursecheck eq 'ok') {
 			my $addcheck = &Apache::lonnet::auto_new_course($crs,$dom,$newsec,$owner,$coowners);
@@ -2631,7 +2639,15 @@
                         push(@matchgroup,$env{"form.$sec"}.":".$env{"form.$lc_sec"});
                         next;
                     }
-		    my $newsec = $coursecode.$env{"form.$sec"};
+                    my $newsec;
+                    my $crskey = $crs.':'.$coursecode;
+                    my %formattedsec = &Apache::lonnet::auto_instsec_reformat($dom,'clutter',
+                                                                  {$crskey => [$env{"form.$sec"}]});
+                    if (ref($formattedsec{$crskey}) eq 'ARRAY') {
+                        $newsec = $coursecode.$formattedsec{$crskey}->[0];
+                    } else {
+                        $newsec = $coursecode.$env{"form.$sec"};
+                    }
 		    my $coursecheck = &Apache::lonnet::auto_validate_courseID($crs,$dom,$newsec);
 		    if ($coursecheck eq 'ok') {
 			my $addcheck = &Apache::lonnet::auto_new_course($crs,$dom,$newsec,$owner,$coowners);




More information about the LON-CAPA-cvs mailing list