diff options
author | Christian Pointner <equinox@spreadspace.org> | 2015-10-09 17:03:10 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2015-10-09 17:03:10 (GMT) |
commit | c6c891b3921dce1cb3575e67a6f45f0fb24f722d (patch) | |
tree | a2f747eea6c2f51ceea679a93c2f3740aefa2ff7 /utils/rhrd-show | |
parent | 91a5a9072f82cef110535917a4601f14ddd9fa31 (diff) |
improved show deletion
Diffstat (limited to 'utils/rhrd-show')
-rwxr-xr-x | utils/rhrd-show | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/utils/rhrd-show b/utils/rhrd-show index 7cb8422..f2a6aed 100755 --- a/utils/rhrd-show +++ b/utils/rhrd-show @@ -181,14 +181,30 @@ sub remove { my ($ctx, $show_id) = @_; + my ($group, $status, $errorstring) = RHRD::rddb::get_show_group($ctx, $show_id); + unless(defined $group) { + print STDERR $status . ": " . $errorstring . "\n"; + return 1; + } + my @results = RHRD::rddb::remove_show($ctx, $show_id); if(!defined $results[0] && defined $results[2]) { - print STDERR "$results[2]\n"; + print STDERR $results[1] . ": " . $results[2] . "\n"; return 1; } for my $href (@results) { print int($href->{cnt}) . " " . $href->{name} . " deleted\n"; } + + my @carts = RHRD::rddb::get_show_group_carts_used($ctx, $group); + if(!defined $carts[0] && defined $carts[1]) { + print STDERR $carts[1] . ": " . $carts[2] . "\n"; + return 1; + } + if(scalar @carts == 0) { + print "group '" . $group . "' is now empty .. you should probably remove it!\n"; + } + return 0; } |