diff options
author | Christian Pointner <equinox@helsinki.at> | 2016-09-15 22:57:15 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2016-09-15 22:57:15 (GMT) |
commit | 2e08f6565148dd748826e47fe45d4c9a9c79ff95 (patch) | |
tree | 47ee3b1cccf00bc061398f78a192400e8ee319a2 /lib/RHRD | |
parent | 7547ca99a5fcad19e6004b9d0135c3290834e7e6 (diff) |
added lib function to change the value of evergreens
Diffstat (limited to 'lib/RHRD')
-rwxr-xr-x | lib/RHRD/rddb.pm | 24 |
1 files changed, 24 insertions, 0 deletions
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) = @_; |