[freeside-commits] freeside/rt/lib/RT Record.pm, 1.3, 1.4 Ticket_Overlay.pm, 1.1.1.9, 1.2
Ivan,,,
ivan at wavetail.420.am
Sun Mar 23 20:08:02 PDT 2008
Update of /home/cvs/cvsroot/freeside/rt/lib/RT
In directory wavetail.420.am:/tmp/cvs-serv11878/lib/RT
Modified Files:
Record.pm Ticket_Overlay.pm
Log Message:
woo! final part of #1160! yup, auto-associating tickets with customers now. whew!
Index: Ticket_Overlay.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/rt/lib/RT/Ticket_Overlay.pm,v
retrieving revision 1.1.1.9
retrieving revision 1.2
diff -u -d -r1.1.1.9 -r1.2
--- Ticket_Overlay.pm 2 Mar 2008 04:08:42 -0000 1.1.1.9
+++ Ticket_Overlay.pm 24 Mar 2008 03:08:00 -0000 1.2
@@ -716,6 +716,43 @@
# }}}
+ # {{{ Deal with auto-customer association
+
+ #unless we already have (a) customer(s)...
+ unless ( $self->Customers->Count ) {
+
+ #find any requestors with customer targets
+
+ my %cust_target = ();
+
+ my @Requestors =
+ grep { $_->Customers->Count }
+ @{ $self->Requestors->UserMembersObj->ItemsArrayRef };
+
+ foreach my $Requestor ( @Requestors ) {
+ foreach my $cust_link ( @{ $Requestor->Customers->ItemsArrayRef } ) {
+ $cust_target{ $cust_link->Target } = 1;
+ }
+ }
+
+ #and then auto-associate this ticket with those customers
+
+ foreach my $cust_target ( keys %cust_target ) {
+
+ my @link = ( 'Type' => 'MemberOf',
+ #'Target' => "freeside://freeside/cust_main/$custnum",
+ 'Target' => $cust_target,
+ );
+
+ my( $val, $msg ) = $self->AddLink(@link);
+ push @non_fatal_errors, $msg;
+
+ }
+
+ }
+
+ # }}}
+
# {{{ Add all the custom fields
foreach my $arg ( keys %args ) {
Index: Record.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/rt/lib/RT/Record.pm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- Record.pm 24 Mar 2008 01:28:09 -0000 1.3
+++ Record.pm 24 Mar 2008 03:07:59 -0000 1.4
@@ -74,6 +74,7 @@
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 @@
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);
}
More information about the freeside-commits
mailing list