From a3929659aeb4a4bfc55e858a941e46f0ab2ba12a Mon Sep 17 00:00:00 2001
From: Gerhard Gonter <ggonter@gmail.com>
Date: Thu, 30 Apr 2015 19:26:23 +0200
Subject: [PATCH] work with custom values

---
 lib/Redmine/DB/MySQL.pm | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/lib/Redmine/DB/MySQL.pm b/lib/Redmine/DB/MySQL.pm
index cd49e17..76862ac 100644
--- a/lib/Redmine/DB/MySQL.pm
+++ b/lib/Redmine/DB/MySQL.pm
@@ -98,6 +98,31 @@ sub get_all_x
   $tt;
 }
 
+sub fetch_custom
+{
+  my $db= shift;
+  my $cfid= shift;
+  my $cfty= shift || 'Issue';
+
+  my $res= $db->get_all_x ('custom_values',
+      [ "custom_field_id=? and customized_type=? and value<>''", $cfid, $cfty ]);
+  $res;
+}
+
+sub insert_custom
+{
+  my $db= shift;
+  my $cfid= shift;
+  my $cfty= shift || 'Issue';
+  my $cfref= shift;
+  my $cfval= shift;
+
+  my $res= $db->insert ('custom_values',
+      { customized_type => $cfty, customized_id => $cfref,
+        custom_field_id => $cfid, value => $cfval, } );
+  $res;
+}
+
 sub insert
 {
   my $self= shift;
-- 
GitLab