[LON-CAPA-cvs] cvs: loncom(version_2_9_X) /interface loncreateuser.pm

raeburn raeburn@source.lon-capa.org
Wed, 14 Apr 2010 19:46:57 -0000


raeburn		Wed Apr 14 19:46:57 2010 EDT

  Modified files:              (Branch: version_2_9_X)
    /loncom/interface	loncreateuser.pm 
  Log:
  - Backport 1.338, 1.339.
  
  
Index: loncom/interface/loncreateuser.pm
diff -u loncom/interface/loncreateuser.pm:1.295.2.31 loncom/interface/loncreateuser.pm:1.295.2.32
--- loncom/interface/loncreateuser.pm:1.295.2.31	Tue Mar 23 16:44:46 2010
+++ loncom/interface/loncreateuser.pm	Wed Apr 14 19:46:56 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Create a user
 #
-# $Id: loncreateuser.pm,v 1.295.2.31 2010/03/23 16:44:46 raeburn Exp $
+# $Id: loncreateuser.pm,v 1.295.2.32 2010/04/14 19:46:56 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2574,7 +2574,8 @@
         }
         my ($quotachanged,$oldportfolioquota,$newportfolioquota,$oldinststatus,
             $newinststatus,$oldisdefault,$newisdefault,%oldsettings,
-            %oldsettingstext,%newsettings,%newsettingstext,@disporder);
+            %oldsettingstext,%newsettings,%newsettingstext,@disporder,
+            $olddefquota,$oldsettingstatus,$newdefquota,$newsettingstatus);
         @disporder = ('inststatus');
         if ($env{'request.role.domain'} eq $env{'form.ccdomain'}) {
             push(@disporder,'requestcourses');
@@ -2582,8 +2583,10 @@
             push(@disporder,'reqcrsotherdom');
         }
         push(@disporder,('quota','tools'));
-        my ($defquota,$settingstatus) =
+        $oldinststatus = $userenv{'inststatus'};
+        ($olddefquota,$oldsettingstatus) =
             &Apache::loncommon::default_quota($env{'form.ccdomain'},$oldinststatus);
+        ($newdefquota,$newsettingstatus) = ($olddefquota,$oldsettingstatus);
         my %canshow;
         if (&Apache::lonnet::allowed('mpq',$env{'form.ccdomain'})) {
             $canshow{'quota'} = 1;
@@ -2600,7 +2603,6 @@
             $canshow{'inststatus'} = 1;
         }
         my (%changeHash,%changed);
-        $oldinststatus = $userenv{'inststatus'};
         if ($oldinststatus eq '') {
             $oldsettings{'inststatus'} = $othertitle;
         } else {
@@ -2620,6 +2622,8 @@
                     $changeHash{'inststatus'} = $newinststatus;
                     if ($newinststatus ne $oldinststatus) {
                         $changed{'inststatus'} = $newinststatus;
+                        ($newdefquota,$newsettingstatus) =
+                            &Apache::loncommon::default_quota($env{'form.ccdomain'},$newinststatus);
                     }
                     if (ref($usertypes) eq 'HASH') {
                         $newsettings{'inststatus'} = join(', ',map{ $usertypes->{$_}; } (@inststatuses));
@@ -2633,6 +2637,8 @@
                 $newsettings{'inststatus'} = $othertitle;
                 if ($newinststatus ne $oldinststatus) {
                     $changed{'inststatus'} = $changeHash{'inststatus'};
+                    ($newdefquota,$newsettingstatus) =
+                        &Apache::loncommon::default_quota($env{'form.ccdomain'},$newinststatus);
                 }
             }
         } elsif ($context ne 'selfcreate') {
@@ -2655,12 +2661,12 @@
                     }
                 } else {
                     $changed{'quota'} = &quota_admin('',\%changeHash);
-                    $newportfolioquota = $defquota;
+                    $newportfolioquota = $newdefquota;
                     $newisdefault = 1;
                 }
             } else {
                 $oldisdefault = 1;
-                $oldportfolioquota = $defquota;
+                $oldportfolioquota = $olddefquota;
                 if ($env{'form.customquota'} == 1) {
                     if ($env{'form.portfolioquota'} eq '') {
                         $newportfolioquota = 0;
@@ -2670,15 +2676,15 @@
                     }
                     $changed{'quota'} = &quota_admin($newportfolioquota,\%changeHash);
                 } else {
-                    $newportfolioquota = $defquota;
+                    $newportfolioquota = $newdefquota;
                     $newisdefault = 1;
                 }
             }
             if ($oldisdefault) {
-                $oldsettingstext{'quota'} = &get_defaultquota_text($settingstatus);
+                $oldsettingstext{'quota'} = &get_defaultquota_text($oldsettingstatus);
             }
             if ($newisdefault) {
-                $newsettingstext{'quota'} = &get_defaultquota_text($settingstatus);
+                $newsettingstext{'quota'} = &get_defaultquota_text($newsettingstatus);
             }
             &tool_changes('tools',\@usertools,\%oldsettings,\%oldsettingstext,\%userenv,
                           \%changeHash,\%changed,\%newsettings,\%newsettingstext);