[LON-CAPA-cvs] cvs: loncom /enrollment Autoenroll.pl

raeburn raeburn@source.lon-capa.org
Sun, 04 Jan 2009 05:52:58 -0000


raeburn		Sun Jan  4 05:52:58 2009 EDT

  Modified files:              
    /loncom/enrollment	Autoenroll.pl 
  Log:
  - Rename hash ref: $settings as $domsettings (clarifies distinction from %settings).
  - Set $env{'form.can_reply'} to N so if an e-mail message is generated when a LON-CAPA message is sent to recipients in notifylist, it will include a "Do not reply" message.   
  
  
Index: loncom/enrollment/Autoenroll.pl
diff -u loncom/enrollment/Autoenroll.pl:1.29 loncom/enrollment/Autoenroll.pl:1.30
--- loncom/enrollment/Autoenroll.pl:1.29	Wed Jan  2 03:39:50 2008
+++ loncom/enrollment/Autoenroll.pl	Sun Jan  4 05:52:58 2009
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 #
 #Automated Enrollment script
-# $Id: Autoenroll.pl,v 1.29 2008/01/02 03:39:50 raeburn Exp $
+# $Id: Autoenroll.pl,v 1.30 2009/01/04 05:52:58 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -52,12 +52,12 @@
     foreach my $dom (@domains) {
         #only run if configured to
         my $run_enroll = 0;
-        my $settings;
+        my $domsettings;
         my %domconfig =
             &Apache::lonnet::get_dom('configuration',['autoenroll'],$dom);
         if (ref($domconfig{'autoenroll'}) eq 'HASH') {
-            $settings = $domconfig{'autoenroll'};
-            if ($settings->{'run'} eq '1') {
+            $domsettings = $domconfig{'autoenroll'};
+            if ($domsettings->{'run'} eq '1') {
                 $run_enroll = 1;
             }
         } else {
@@ -167,13 +167,14 @@
                                     $ownerdom = $dom;
                                 }
                             }
-                            if (($settings->{'sender_uname'} ne '') && 
-                                ($settings->{'sender_domain'} ne '')) {
-                                $env{'user.name'} = $settings->{'sender_uname'};
-                                $env{'user.domain'} = $settings->{'sender_domain'};
-                            } else {
-                                $env{'user.name'} = $ownername;
-                                $env{'user.domain'} = $ownerdom;
+                            $env{'user.name'} = $ownername;
+                            $env{'user.domain'} = $ownerdom;
+                            if (ref($domsettings) eq 'HASH') {
+                                if (($domsettings->{'sender_uname'} ne '') && 
+                                    ($domsettings->{'sender_domain'} ne '')) {
+                                    $env{'user.name'} = $settings->{'sender_uname'};
+                                    $env{'user.domain'} = $settings->{'sender_domain'};
+                                }
                             }
                             if ($enrollvar{$crs}{notifylist}  eq '') {
                                 if ($newusermsg ne '') {
@@ -184,6 +185,7 @@
                                     }
                                 }
                             } else {
+                                $env{'form.can_reply'} = 'N';
                                 my $msgcc;
 # Send message about enrollment changes to notifylist.
                                 $env{'user.home'} = &Apache::lonnet::homeserver($env{'user.name'},$env{'user.domain'});
@@ -223,6 +225,7 @@
                                     my $status =  
                                         &Apache::lonmsg::user_normal_msg($ccname,$ccdom,$subject,$message,undef,undef,undef,undef,\%sentmessage,undef,undef,undef,1,$recipid);
                                 }
+                                delete($env{'form.can_reply'});
                             }
                             delete($env{'user.name'});
                             delete($env{'user.home'});