[LON-CAPA-cvs] cvs: loncom /lonnet/perl lonnet.pm
raeburn
raeburn at source.lon-capa.org
Wed Dec 14 11:16:51 EST 2011
raeburn Wed Dec 14 16:16:51 2011 EDT
Modified files:
/loncom/lonnet/perl lonnet.pm
Log:
- Rollback change in classlist.db in lonnet::modify_student_enrollment()
if lonnet::assignrole() could not be completed.
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.1147 loncom/lonnet/perl/lonnet.pm:1.1148
--- loncom/lonnet/perl/lonnet.pm:1.1147 Mon Dec 5 01:14:21 2011
+++ loncom/lonnet/perl/lonnet.pm Wed Dec 14 16:16:50 2011
@@ -1,7 +1,7 @@
# The LearningOnline Network
# TCP networking package
#
-# $Id: lonnet.pm,v 1.1147 2011/12/05 01:14:21 raeburn Exp $
+# $Id: lonnet.pm,v 1.1148 2011/12/14 16:16:50 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -7515,14 +7515,16 @@
$uid = $tmp{'id'} if (!defined($uid) || $uid eq '');
}
my $fullname = &format_name($first,$middle,$last,$gene,'lastname');
+ my $user = "$uname:$udom";
+ my %old_entry = &Apache::lonnet::get('classlist',[$user],$cdom,$cnum);
my $reply=cput('classlist',
- {"$uname:$udom" =>
+ {$user =>
join(':',$end,$start,$uid,$usec,$fullname,$type,$locktype) },
$cdom,$cnum);
- unless (($reply eq 'ok') || ($reply eq 'delayed')) {
+ if (($reply eq 'ok') || ($reply eq 'delayed')) {
+ &devalidate_getsection_cache($udom,$uname,$cid);
+ } else {
return 'error: '.$reply;
- } else {
- &devalidate_getsection_cache($udom,$uname,$cid);
}
# Add student role to user
my $uurl='/'.$cid;
@@ -7530,7 +7532,16 @@
if ($usec) {
$uurl.='/'.$usec;
}
- return &assignrole($udom,$uname,$uurl,'st',$end,$start,undef,$selfenroll,$context);
+ my $result = &assignrole($udom,$uname,$uurl,'st',$end,$start,undef,
+ $selfenroll,$context);
+ if ($result ne 'ok') {
+ if ($old_entry{$user} ne '') {
+ $reply = &cput('classlist',\%old_entry,$cdom,$cnum);
+ } else {
+ $reply = &del('classlist',[$user],$cdom,$cnum);
+ }
+ }
+ return $result;
}
sub format_name {
More information about the LON-CAPA-cvs
mailing list