[prev in list] [next in list] [prev in thread] [next in thread]
List: rt-commit
Subject: [Rt-commit] rt branch, admin_ui,
From: sunnavy () bestpractical ! com
Date: 2009-12-31 6:06:13
Message-ID: 20091231060614.E0A7D4D80DE () diesel ! bestpractical ! com
[Download RAW message or body]
The branch, admin_ui has been updated
via 1f17f60457531b647cbb324994f197c79c4b9702 (commit)
from 23ff91a07289c546a831a1a188cae2a5b77880b3 (commit)
Summary of changes:
lib/RT/Action/WithCustomFields.pm | 40 +++++++++++++++++++++++++++++++++++++
1 files changed, 40 insertions(+), 0 deletions(-)
- Log -----------------------------------------------------------------
commit 1f17f60457531b647cbb324994f197c79c4b9702
Author: sunnavy <sunnavy@bestpractical.com>
Date: Thu Dec 31 14:06:03 2009 +0800
_add_custom_field_values stuff
diff --git a/lib/RT/Action/WithCustomFields.pm b/lib/RT/Action/WithCustomFields.pm
index 0f802cc..a95d197 100644
--- a/lib/RT/Action/WithCustomFields.pm
+++ b/lib/RT/Action/WithCustomFields.pm
@@ -66,5 +66,45 @@ sub _setup_custom_field {
return \%args;
}
+sub _add_custom_field_values {
+ my $self = shift;
+
+ my @args = grep { /^cf_\d+$/ } $self->argument_names;
+ for my $arg (@args) {
+ my $id;
+ $id = $1 if $arg =~ /^cf_(\d+)$/; # this always happens
+ $self->_add_custom_field_value(
+ field => $1,
+ value => $self->argument_value($arg)
+ );
+
+ }
+}
+
+sub _add_custom_field_value {
+ my $self = shift;
+ my %args = @_;
+ my $field = $args{field};
+ my $value = $args{value};
+
+ my @values = ref $value eq 'ARRAY' ? @$value : $value;
+ for my $value (@values) {
+ if ( UNIVERSAL::isa( $value, 'Jifty::Web::FileUpload' ) ) {
+ $self->record->add_custom_field_value(
+ field => $field,
+ value => $value->filename,
+ large_content => $value->content,
+ content_type => $value->content_type,
+ );
+ }
+ else {
+ $self->record->add_custom_field_value(
+ field => $field,
+ value => $value,
+ );
+ }
+ }
+}
+
1;
-----------------------------------------------------------------------
_______________________________________________
Rt-commit mailing list
Rt-commit@lists.bestpractical.com
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-commit
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic