X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=rt%2Flib%2FRT%2FTransaction.pm;h=44175d49fb83b89fe23bdee538dc4fedce64de1f;hp=781c9e422487da22f223124257dc097a013a7476;hb=7322f2afedcc2f427e997d1535a503613a83f088;hpb=ae14e320388fa5e7f400bff1c251ef885b7952e6 diff --git a/rt/lib/RT/Transaction.pm b/rt/lib/RT/Transaction.pm index 781c9e422..44175d49f 100755 --- a/rt/lib/RT/Transaction.pm +++ b/rt/lib/RT/Transaction.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2015 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2016 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) @@ -314,11 +314,25 @@ sub Message { +=head2 HasContent + +Returns whether this transaction has attached mime objects. + +=cut + +sub HasContent { + my $self = shift; + my $type = $PreferredContentType || ''; + return !!$self->ContentObj( $type ? ( Type => $type) : () ); +} + + + =head2 Content PARAMHASH If this transaction has attached mime objects, returns the body of the first textual part (as defined in RT::I18N::IsTextualContentType). Otherwise, -returns undef. +returns the message "This transaction appears to have no content". Takes a paramhash. If the $args{'Quote'} parameter is set, wraps this message at $args{'Wrap'}. $args{'Wrap'} defaults to $RT::MessageBoxWidth - 2 or 70. @@ -342,8 +356,8 @@ sub Content { ); my $content; - if ( my $content_obj = - $self->ContentObj( $args{Type} ? ( Type => $args{Type} ) : () ) ) + if ( my $content_obj = + $self->ContentObj( $args{Type} ? ( Type => $args{Type}) : () ) ) { $content = $content_obj->Content ||''; @@ -863,11 +877,11 @@ sub _FormatUser { }, Enabled => sub { my $self = shift; - return ( "[_1] enabled", $self->FriendlyObjectType ); #loc() + return ( "[_1] enabled", $self->Field ? $self->loc($self->Field) : $self->FriendlyObjectType ); #loc() }, Disabled => sub { my $self = shift; - return ( "[_1] disabled", $self->FriendlyObjectType ); #loc() + return ( "[_1] disabled", $self->Field ? $self->loc($self->Field) : $self->FriendlyObjectType ); #loc() }, Status => sub { my $self = shift; @@ -1188,11 +1202,11 @@ sub _FormatUser { my $q2 = RT::Queue->new( $self->CurrentUser ); $q2->Load( $self->NewValue ); return ("[_1] changed from [_2] to [_3]", - $self->loc($self->Field) , $q1->Name , $q2->Name); #loc() + $self->loc($self->Field), $q1->Name // '#'.$q1->id, $q2->Name // '#'.$q2->id); #loc() } # Write the date/time change at local time: - elsif ($self->Field =~ /Due|Starts|Started|Told|WillResolve/) { + elsif ($self->Field =~ /^(?:Due|Starts|Started|Told|WillResolve)$/) { my $t1 = RT::Date->new($self->CurrentUser); $t1->Set(Format => 'ISO', Value => $self->NewValue); my $t2 = RT::Date->new($self->CurrentUser); @@ -1262,34 +1276,46 @@ sub _FormatUser { my $self = shift; my $ticket = RT::Ticket->new($self->CurrentUser); $ticket->Load($self->NewValue); - my $subject = [ - \'id, \'">', $ticket->Subject, \'' - ]; - return ("Reminder '[_1]' added", $subject); #loc() + if ( $ticket->CurrentUserHasRight('ShowTicket') ) { + my $subject = [ + \'id, \'">', $ticket->Subject, \'' + ]; + return ("Reminder '[_1]' added", $subject); #loc() + } else { + return ("Reminder added"); #loc() + } }, OpenReminder => sub { my $self = shift; my $ticket = RT::Ticket->new($self->CurrentUser); $ticket->Load($self->NewValue); - my $subject = [ - \'id, \'">', $ticket->Subject, \'' - ]; - return ("Reminder '[_1]' reopened", $subject); #loc() + if ( $ticket->CurrentUserHasRight('ShowTicket') ) { + my $subject = [ + \'id, \'">', $ticket->Subject, \'' + ]; + return ("Reminder '[_1]' reopened", $subject); #loc() + } else { + return ("Reminder reopened"); #loc() + } }, ResolveReminder => sub { my $self = shift; my $ticket = RT::Ticket->new($self->CurrentUser); $ticket->Load($self->NewValue); - my $subject = [ - \'id, \'">', $ticket->Subject, \'' - ]; - return ("Reminder '[_1]' completed", $subject); #loc() + if ( $ticket->CurrentUserHasRight('ShowTicket') ) { + my $subject = [ + \'id, \'">', $ticket->Subject, \'' + ]; + return ("Reminder '[_1]' completed", $subject); #loc() + } else { + return ("Reminder completed"); #loc() + } } );