[Rt-commit] rt branch, admin_ui, updated. 1f17f60457531b647cbb324994f197c79c4b9702
sunnavy at bestpractical.com
sunnavy at bestpractical.com
Thu Dec 31 01:06:13 EST 2009
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 at 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;
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list