From 2e08f6565148dd748826e47fe45d4c9a9c79ff95 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Fri, 16 Sep 2016 00:57:15 +0200 Subject: added lib function to change the value of evergreens diff --git a/lib/RHRD/rddb.pm b/lib/RHRD/rddb.pm index 228f76c..26dcc12 100755 --- a/lib/RHRD/rddb.pm +++ b/lib/RHRD/rddb.pm @@ -197,6 +197,30 @@ sub get_next_free_slot return ($low_cart, $high_cart); } +sub set_cut_evergreen +{ + my ($ctx, $cart, $cut, $value) = @_; + + my $cut_name = sprintf("%06d_%03d", $cart, $cut); + if($value && $value ne 'N') { + $value = 'Y'; + } else { + $value = 'N'; + } + + my $sql = qq{update CUTS set EVERGREEN = ? where CUT_NAME = ?;}; + + my $sth = $ctx->{'dbh'}->prepare($sql) + or return (undef, 'ERROR', "Database Error: " . $ctx->{'dbh'}->errstr); + + my $cnt = $sth->execute($value, $cut_name) + or return (undef, 'ERROR', "Database Error: " . $sth->errstr); + + $sth->finish(); + + return ($cnt, 'OK', 'success'); +} + sub check_log_exists { my ($ctx, $logname) = @_; -- cgit v0.10.2