diff options
Diffstat (limited to 'lib/RHRD')
-rwxr-xr-x | lib/RHRD/rddb.pm | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/RHRD/rddb.pm b/lib/RHRD/rddb.pm index a052080..a337557 100755 --- a/lib/RHRD/rddb.pm +++ b/lib/RHRD/rddb.pm @@ -567,15 +567,23 @@ sub get_showtitle_and_log sub get_dropboxes { - my ($dbh, $username) = @_; + my ($dbh, $username, $groupname) = @_; my $sql = qq{select USER_PERMS.GROUP_NAME,DROPBOXES.TO_CART,DROPBOXES.NORMALIZATION_LEVEL,DROPBOXES.AUTOTRIM_LEVEL,DROPBOXES.SET_USER_DEFINED,GROUPS.DEFAULT_LOW_CART,GROUPS.DEFAULT_HIGH_CART,GROUPS.DESCRIPTION from USER_PERMS, DROPBOXES, GROUPS where USER_PERMS.USER_NAME=? and DROPBOXES.GROUP_NAME=USER_PERMS.GROUP_NAME and DROPBOXES.GROUP_NAME=GROUPS.NAME and DROPBOXES.STATION_NAME=?;}; + if(defined $groupname) { + $sql = qq{select USER_PERMS.GROUP_NAME,DROPBOXES.TO_CART,DROPBOXES.NORMALIZATION_LEVEL,DROPBOXES.AUTOTRIM_LEVEL,DROPBOXES.SET_USER_DEFINED,GROUPS.DEFAULT_LOW_CART,GROUPS.DEFAULT_HIGH_CART,GROUPS.DESCRIPTION from USER_PERMS, DROPBOXES, GROUPS where USER_PERMS.USER_NAME=? and DROPBOXES.GROUP_NAME=USER_PERMS.GROUP_NAME and DROPBOXES.GROUP_NAME=GROUPS.NAME and DROPBOXES.STATION_NAME=? and GROUPS.NAME=?;}; + } my $sth = $dbh->prepare($sql) or return (undef, 'ERROR', "Database Error: " . $dbh->errstr); - $sth->execute($username, DROPBOX_PSEUDO_STATION_NAME) - or return (undef, 'ERROR', "Database Error: " . $sth->errstr); + if(defined $groupname) { + $sth->execute($username, DROPBOX_PSEUDO_STATION_NAME, $groupname) + or return (undef, 'ERROR', "Database Error: " . $sth->errstr); + } else { + $sth->execute($username, DROPBOX_PSEUDO_STATION_NAME) + or return (undef, 'ERROR', "Database Error: " . $sth->errstr); + } my @allowed_dbs; while(my ($group, $to_cart, $normlevel, $trimlevel, $params, $lowcart, $highcart, $groupdesc) = $sth->fetchrow_array()) { |