summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2015-09-29 01:17:03 (GMT)
committerChristian Pointner <equinox@spreadspace.org>2015-09-29 01:17:03 (GMT)
commit15db57fb8eb839f48763394f73709a1d5952131b (patch)
tree81c6cfe7c262d088e8fc69e0158f88fde3a7bd81
parent59bd1cedd11b6337259578cc15319da5d52e6d22 (diff)
added type filter for list dropboxes
-rwxr-xr-xlib/RHRD/rddb.pm8
-rwxr-xr-xtest/get-dropboxes5
-rwxr-xr-xutils/rd-group10
3 files changed, 13 insertions, 10 deletions
diff --git a/lib/RHRD/rddb.pm b/lib/RHRD/rddb.pm
index 8fc2b3c..09b307b 100755
--- a/lib/RHRD/rddb.pm
+++ b/lib/RHRD/rddb.pm
@@ -643,7 +643,7 @@ sub get_showtitle_and_log
$sth->finish();
unless(defined $title) {
- return (undef, undef, 'ERROR', "Show with ID=" . $showid . " not found!")
+ return (undef, undef, 'ERROR', "Show with ID=" . $showid . " not found!")
}
unless(defined $macros) {
return (undef, undef, 'ERROR', "Show with ID=" . $showid . " has no macro!");
@@ -659,7 +659,7 @@ sub get_showtitle_and_log
sub get_dropboxes
{
- my ($dbh, $username, $groupname) = @_;
+ my ($dbh, $username, $groupname, $type) = @_;
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) {
@@ -680,6 +680,7 @@ sub get_dropboxes
my @allowed_dbs;
while(my ($group, $to_cart, $normlevel, $trimlevel, $params, $lowcart, $highcart, $groupdesc) = $sth->fetchrow_array()) {
my @p = split(';', $params);
+ next if (defined $type && $type ne $p[0]);
my $entry = {};
$entry->{'GROUP'} = $group;
@@ -760,8 +761,6 @@ sub get_show_carts
return @carts;
}
-return 1;
-
sub get_shows_cart_range
{
my ($dbh) = @_;
@@ -803,3 +802,4 @@ sub get_jingles_next_free_slot
}
################################# END ####################################
+return 1;
diff --git a/test/get-dropboxes b/test/get-dropboxes
index abff8d9..b8a5266 100755
--- a/test/get-dropboxes
+++ b/test/get-dropboxes
@@ -28,11 +28,14 @@ use RHRD::rddb;
my $username = $ARGV[0];
my $groupname = $ARGV[1];
+$groupname = undef if (defined($groupname) && $groupname eq '');
+my $type = $ARGV[2];
+
my @dropboxes = ();
my ($dbh, $status, $errorstring) = RHRD::rddb::opendb();
if(defined $dbh) {
- @dropboxes = RHRD::rddb::get_dropboxes($dbh, $username, $groupname);
+ @dropboxes = RHRD::rddb::get_dropboxes($dbh, $username, $groupname, $type);
if(!defined $dropboxes[0] && defined $dropboxes[1]) {
print STDERR "$dropboxes[1]: $dropboxes[2]";
RHRD::rddb::closedb($dbh);
diff --git a/utils/rd-group b/utils/rd-group
index 72c39e9..c72e7d2 100755
--- a/utils/rd-group
+++ b/utils/rd-group
@@ -31,11 +31,11 @@ if ($> != 0 ) {
my $num_args = $#ARGV + 1;
if ($num_args < 2) {
- print STDERR "Usage: rd-group ( (check|remove|get-members|get-carts|get-reports) <groupname> |\n" .
- " add <groupname> [ <description> ] |\n" .
- " (add-member|remove-member|is-member) <groupname> <user> |\n" .
- " set-carts <groupname> [ <low> [ <high> [ <type> [ <enforce range> ]]] |\n" .
- " set-reports <groupname> [ <nownext> [ <traffic> [ <music> ]]] )\n";
+ print STDERR "Usage: rd-group (check|remove|get-members|get-carts|get-reports) <groupname>\n" .
+ " rd-group add <groupname> [ <description> ]\n" .
+ " rd-group (add-member|remove-member|is-member) <groupname> <user>\n" .
+ " rd-group set-carts <groupname> [ <low> [ <high> [ <type> [ <enforce range> ]]]\n" .
+ " rd-group set-reports <groupname> [ <nownext> [ <traffic> [ <music> ]]]\n";
exit 1;
}