diff options
author | Christian Pointner <equinox@spreadspace.org> | 2015-09-27 03:16:04 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2015-09-27 03:16:04 (GMT) |
commit | 222541ee6348f21a0b8107bebb3701422614ba88 (patch) | |
tree | 7329a6df0424df69b38ad8e570cb93ff754b7005 /lib | |
parent | b8b6d19d27ba5847ef9d93cd1d13f724a850b020 (diff) |
get_dropboxes can now look optionally look for a specific group
Diffstat (limited to 'lib')
-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()) { |