summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rwxr-xr-xutils/rd-show69
1 files changed, 40 insertions, 29 deletions
diff --git a/utils/rd-show b/utils/rd-show
index 7a2736c..17286e9 100755
--- a/utils/rd-show
+++ b/utils/rd-show
@@ -73,6 +73,45 @@ sub show
return 0;
}
+
+
+sub add__create_group
+{
+ my ($dbh, $groupname) = @_;
+
+ print " > '" . $groupname . "' does not exist - creating it .. ";
+ my ($cnt, $status, $errorstring) = RHRD::rddb::add_group($dbh, $groupname);
+ unless(defined $cnt) {
+ print STDERR $status . ": " . $errorstring . "\n";
+ return undef;
+ }
+ print int($cnt) . " rows affected\n";
+
+ (my $low_cart, my $high_cart, $errorstring) = RHRD::rddb::get_shows_next_free_slot($dbh);
+ if(!$low_cart) {
+ print $high_cart . ": " . $errorstring . "\n";
+ return undef;
+ }
+ print " using carts " . $low_cart . " - " . $high_cart . " for new group .. ";
+
+ ($cnt, $status, $errorstring) = RHRD::rddb::set_group_carts($dbh, $groupname, $low_cart, $high_cart, 1, 'Y');
+ unless(defined $cnt) {
+ print STDERR $status . ": " . $errorstring . "\n";
+ return undef;
+ }
+ print int($cnt) . " rows affected\n";
+
+ print " enabling reports .. ";
+ ($cnt, $status, $errorstring) = RHRD::rddb::set_group_reports($dbh, $groupname, 'Y', 'Y', 'Y');
+ unless(defined $cnt) {
+ print STDERR $status . ": " . $errorstring . "\n";
+ return undef;
+ }
+ print int($cnt) . " rows affected\n";
+
+ return $low_cart;
+}
+
sub add__get_group_carts
{
my ($dbh, $groupname, $num_carts) = @_;
@@ -90,35 +129,7 @@ sub add__get_group_carts
# find free range in group which is big enough for $num_carts carts
} else {
- print " > '" . $groupname . "' does not exist - creating it .. ";
- (my $cnt, $status, $errorstring) = RHRD::rddb::add_group($dbh, $groupname);
- unless(defined $cnt) {
- print STDERR $status . ": " . $errorstring . "\n";
- return undef;
- }
- print int($cnt) . " rows affected\n";
-
- ($low_cart, my $high_cart, $errorstring) = RHRD::rddb::get_shows_next_free_slot($dbh);
- if(!$low_cart) {
- print $high_cart . ": " . $errorstring . "\n";
- return undef;
- }
- print " using carts " . $low_cart . " - " . $high_cart . " for new group .. ";
-
- ($cnt, $status, $errorstring) = RHRD::rddb::set_group_carts($dbh, $groupname, $low_cart, $high_cart, 1, 'Y');
- unless(defined $cnt) {
- print STDERR $status . ": " . $errorstring . "\n";
- return undef;
- }
- print int($cnt) . " rows affected\n";
-
- print " enabling reports .. ";
- ($cnt, $status, $errorstring) = RHRD::rddb::set_group_reports($dbh, $groupname, 'Y', 'Y', 'Y');
- unless(defined $cnt) {
- print STDERR $status . ": " . $errorstring . "\n";
- return undef;
- }
- print int($cnt) . " rows affected\n";
+ $low_cart = add__create_group($dbh, $groupname);
}
return $low_cart;