X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Flib%2FRT%2FRecord.pm;h=8664e2867dfd0dc98c52fa77144ec245dabbafcd;hb=63a268637b2d51a8766412617724b9436439deb6;hp=262bd208a76581efcae43f62301d990677789430;hpb=2dfda73eeb3eae2d4f894099754794ef07d060dd;p=freeside.git diff --git a/rt/lib/RT/Record.pm b/rt/lib/RT/Record.pm index 262bd208a..8664e2867 100755 --- a/rt/lib/RT/Record.pm +++ b/rt/lib/RT/Record.pm @@ -74,6 +74,7 @@ our @ISA; use base qw(RT::Base); use RT::Date; +use RT::I18N; use RT::User; use RT::Attributes; use DBIx::SearchBuilder::Record::Cachable; @@ -862,6 +863,7 @@ sub _DecodeLOB { elsif ( $ContentEncoding && $ContentEncoding ne 'none' ) { return ( $self->loc( "Unknown ContentEncoding [_1]", $ContentEncoding ) ); } + if ( RT::I18N::IsTextualContentType($ContentType) ) { $Content = Encode::decode_utf8($Content) unless Encode::is_utf8($Content); } @@ -1231,8 +1233,37 @@ sub DependsOn { # }}} +# {{{ Customers + +=head2 Customers + + This returns an RT::Links object which references all the customers that this object is a member of. + +=cut + +sub Customers { + my( $self, %opt ) = @_; + my $Debug = $opt{'Debug'}; + + unless ( $self->{'Customers'} ) { + $self->{'Customers'} = $self->MemberOf->Clone; + $self->{'Customers'}->Limit( + FIELD => 'Target', + OPERATOR => 'STARTSWITH', + VALUE => 'freeside://freeside/cust_main/', + ); + } + + warn "->Customers method called on $self; returning ". + ref($self->{'Customers'}). ' object' + if $Debug; + + return $self->{'Customers'}; +} + +# }}} # {{{ sub _Links