diff options
author | Christian Pointner <equinox@helsinki.at> | 2016-09-16 00:17:57 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2016-09-16 00:17:57 (GMT) |
commit | 602ab246138ba5d69288ae8bed38c042a517ffc2 (patch) | |
tree | d97abb74441a5b4432a9de87da6dd7f89eac7863 /lib | |
parent | 198e8209aef9ddc02309f3fb90c38fd3d2468b6e (diff) |
added lib function to get group of cart
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/RHRD/rddb.pm | 22 |
1 files changed, 22 insertions, 0 deletions
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) = @_; |