--- loncom/interface/loncreatecourse.pm 2005/11/15 20:17:00 1.84 +++ loncom/interface/loncreatecourse.pm 2006/01/16 23:11:50 1.85 @@ -1,7 +1,7 @@ # The LearningOnline Network # Create a course # -# $Id: loncreatecourse.pm,v 1.84 2005/11/15 20:17:00 albertel Exp $ +# $Id: loncreatecourse.pm,v 1.85 2006/01/16 23:11:50 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -159,6 +159,14 @@ sub copyresourcedb { my %newdata=(); undef %newdata; my $startdate=$data{$origcrsid.'.0.opendate'}; + if (!$startdate) { + # now global start date for assements try the enrollment start + my %start=&Apache::lonnet::get('environment', + ['default_enrollment_start_date'], + $origcrsdata{'domain'},$origcrsdata{'num'}); + + $startdate = $start{'default_enrollment_start_date'}; + } my $today=time; my $delta=0; if ($startdate) { @@ -193,7 +201,13 @@ sub copyresourcedb { $thiskey=~s/^$origcrsid/$newcrsid/; $newdata{$thiskey}=$data{$_}; if ($data{$_.'.type'}=~/^date_(start|end)$/) { - $newdata{$thiskey}=$newdata{$thiskey}+$delta; + if ($delta > 0) { + $newdata{$thiskey}=$newdata{$thiskey}+$delta; + } else { + # no delta, it's unlikely we want the old dates and times + delete($newdata{$thiskey}); + delete($newdata{$thiskey.'.type'}); + } } } return &Apache::lonnet::put