--- loncom/interface/lonpopulate.pm 2016/11/09 00:48:52 1.85 +++ loncom/interface/lonpopulate.pm 2021/03/31 02:19:59 1.86 @@ -1,5 +1,5 @@ # automated enrollment configuration handler -# $Id: lonpopulate.pm,v 1.85 2016/11/09 00:48:52 raeburn Exp $ +# $Id: lonpopulate.pm,v 1.86 2021/03/31 02:19:59 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -2149,14 +2149,27 @@ sub print_crosslistings_response { next; } } - my $coursecheck = + my $coursecheck = &Apache::lonnet::auto_validate_courseID($crs,$dom,$env{"form.$xl"}); if ($coursecheck eq 'ok') { my $addcheck = ''; $addcheck = &Apache::lonnet::auto_new_course($crs,$dom,$env{"form.$xl"},$owner,$coowners); - if ($addcheck eq 'ok') { - push(@xlists,$env{"form.$xl"}.":".$env{"form.$lc_sec"}); - } else { + unless ($addcheck eq 'ok') { + if ($coowners) { + foreach my $user (split(/,/,$coowners)) { + if ($user =~ /^($match_username):($match_domain)$/) { + if (&Apache::lonnet::auto_validate_inst_crosslist($crs,$dom,$coursecode, + $env{"form.$xl"},$user) eq 'valid') { + $addcheck = 'ok'; + last; + } + } + } + } + } + if ($addcheck eq 'ok') { + push(@xlists,$env{"form.$xl"}.":".$env{"form.$lc_sec"}); + } else { push(@badowner,$env{"form.$xl"}.":".$env{"form.$lc_sec"}); } } else {