[LON-CAPA-cvs] cvs: loncom /automation batchcreatecourse.pm

raeburn lon-capa-cvs@mail.lon-capa.org
Mon, 11 Jul 2005 20:02:03 -0000


raeburn		Mon Jul 11 16:02:03 2005 EDT

  Modified files:              
    /loncom/automation	batchcreatecourse.pm 
  Log:
  Pass %courseinfo by ref. Minor ordering change to improve readability.
  
  
Index: loncom/automation/batchcreatecourse.pm
diff -u loncom/automation/batchcreatecourse.pm:1.5 loncom/automation/batchcreatecourse.pm:1.6
--- loncom/automation/batchcreatecourse.pm:1.5	Wed Jun  1 15:20:32 2005
+++ loncom/automation/batchcreatecourse.pm	Mon Jul 11 16:02:02 2005
@@ -1,5 +1,5 @@
 #
-# $Id: batchcreatecourse.pm,v 1.5 2005/06/01 19:20:32 raeburn Exp $
+# $Id: batchcreatecourse.pm,v 1.6 2005/07/11 20:02:02 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -436,12 +436,13 @@
                     'linefeed' => $linefeed,
                     'role' => 'cc',
                    };
-        $outcome = &LONCAPA::Enrollment::create_newuser($ownerargs,$logmsg,$newusermsg,$enrollcount,$addresult,$longroles,$courseinfo);
+        $outcome = &LONCAPA::Enrollment::create_newuser($ownerargs,$logmsg,$newusermsg,$enrollcount,$addresult,$longroles,\%courseinfo);
     } else {
         $outcome = 'ok';
     }
 
-    my $courseargs = {
+    if ($outcome eq 'ok') {
+        my $courseargs = {
                ccuname => $$details{$num}{'owner'},
                ccdomain => $$details{$num}{'domain'},
                cdescr => $$details{$num}{'title'},
@@ -479,7 +480,6 @@
                firstres => $firstres
                };
 
-    if ($outcome eq 'ok') {
         my %host_servers = &Apache::loncommon::get_library_servers($cdom);
         if (! exists($host_servers{$$details{$num}{'coursehome'}})) {
             $$logmsg .= &mt('Invalid home server for course').': '.$$details{$num}{'coursehome'};
@@ -529,7 +529,7 @@
                     'linefeed' => $linefeed,
                     'role' => $$details{$num}{'users'}{$userkey}{'roles'}[0], 
                    };
-                $outcome = &LONCAPA::Enrollment::create_newuser($userargs,$logmsg,$newusermsg,$enrollcount,$addresult,$longroles,$courseinfo);
+                $outcome = &LONCAPA::Enrollment::create_newuser($userargs,$logmsg,$newusermsg,$enrollcount,$addresult,$longroles,\%courseinfo);
 # now add other roles and other sections.
                 if ($outcome eq 'ok') {
                     if (($firstrole ne 'st') && (@{$$details{$num}{'users'}{$userkey}{$firstrole}{'usec'}} > 1)) {