[LON-CAPA-cvs] cvs: modules /msu localenroll.pm
raeburn
raeburn at source.lon-capa.org
Tue Feb 22 20:27:28 EST 2022
raeburn Wed Feb 23 01:27:28 2022 EDT
Modified files:
/modules/msu localenroll.pm
Log:
- Integration with MSU campus information systems
Skip table queries if there are no conditions because search term does
not match the appropriate regexp.
Index: modules/msu/localenroll.pm
diff -u modules/msu/localenroll.pm:1.90 modules/msu/localenroll.pm:1.91
--- modules/msu/localenroll.pm:1.90 Sat Jan 29 14:52:37 2022
+++ modules/msu/localenroll.pm Wed Feb 23 01:27:27 2022
@@ -1,6 +1,6 @@
# functions to glue school database system into Lon-CAPA for
# automated enrollment
-# $Id: localenroll.pm,v 1.90 2022/01/29 14:52:37 raeburn Exp $
+# $Id: localenroll.pm,v 1.91 2022/02/23 01:27:27 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1399,9 +1399,11 @@
} elsif (@connected) {
my (%ldap_users,%counts,%condition);
&get_query_condition(\%dbh,\%dbflag,$srchby,$key,undef,\%condition);
- &query_user_tables(\%dbflag,\%dbh,\%srchtables,\%affiliation_by_table,
- $instusers,$instids,undef,\%ldap_users,\%counts,
- \%condition,$stoponmatch);
+ if (keys(%condition)) {
+ &query_user_tables(\%dbflag,\%dbh,\%srchtables,\%affiliation_by_table,
+ $instusers,$instids,undef,\%ldap_users,\%counts,
+ \%condition,$stoponmatch);
+ }
}
}
$outcome = 'ok';
@@ -1452,9 +1454,13 @@
if (@connected) {
my (%counts,%condition);
&get_query_condition(\%dbh,\%dbflag,$srchby,$srchterm,$srchtype,\%condition);
- $outcome = &query_user_tables(\%dbflag,\%dbh,\%srchtables,\%affiliation_by_table,
- $instusers,$instids,undef,\%ldap_users,\%counts,
- \%condition,$stoponmatch);
+ if (keys(%condition)) {
+ $outcome = &query_user_tables(\%dbflag,\%dbh,\%srchtables,\%affiliation_by_table,
+ $instusers,$instids,undef,\%ldap_users,\%counts,
+ \%condition,$stoponmatch);
+ } else {
+ $outcome = 'ok';
+ }
foreach my $conn (@connected) {
if ($dbflag{$conn}) {
&disconnect_DB($dbh{$conn});
@@ -1471,9 +1477,6 @@
return unless ((ref($dbh) eq 'HASH') &&
(ref($dbflag) eq 'HASH') &&
(ref($condition) eq 'HASH'));
- $condition->{hr} = '';
- $condition->{ro} = {};
- $condition->{cs} = {};
if ($srchby eq 'uname') {
if ($srchterm =~ /^\w{2,8}$/) {
$condition->{'hr'} = "MSUNetID";
More information about the LON-CAPA-cvs
mailing list