From 602ab246138ba5d69288ae8bed38c042a517ffc2 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Fri, 16 Sep 2016 02:17:57 +0200 Subject: added lib function to get group of cart diff --git a/lib/RHRD/rddb.pm b/lib/RHRD/rddb.pm index 26dcc12..5c7c26d 100755 --- a/lib/RHRD/rddb.pm +++ b/lib/RHRD/rddb.pm @@ -197,6 +197,28 @@ sub get_next_free_slot return ($low_cart, $high_cart); } +sub get_cart_group +{ + my ($ctx, $cart) = @_; + + my $sql = qq{select GROUP_NAME from CART where NUMBER = ?;}; + + my $sth = $ctx->{'dbh'}->prepare($sql) + or return (undef, 'ERROR', "Database Error: " . $ctx->{'dbh'}->errstr); + + $sth->execute($cart) + or return (undef, 'ERROR', "Database Error: " . $sth->errstr); + + my ($groupname) = $sth->fetchrow_array(); + $sth->finish(); + + unless(defined($groupname)) { + return (undef, 'ERROR', "cart not found"); + } + + return ($groupname, 'OK', 'success'); +} + sub set_cut_evergreen { my ($ctx, $cart, $cut, $value) = @_; -- cgit v0.10.2