[Rt-commit] r17910 - in rt/3.999/branches/merge_to_3.8.2: .
sunnavy at bestpractical.com
sunnavy at bestpractical.com
Sun Jan 25 21:38:10 EST 2009
Author: sunnavy
Date: Sun Jan 25 21:38:06 2009
New Revision: 17910
Modified:
rt/3.999/branches/merge_to_3.8.2/ (props changed)
rt/3.999/branches/merge_to_3.8.2/lib/RT/Model/Transaction.pm
Log:
r19012 at sunnavys-mb: sunnavy | 2009-01-26 10:35:02 +0800
merged lib/RT/Model/Transaction.pm
Modified: rt/3.999/branches/merge_to_3.8.2/lib/RT/Model/Transaction.pm
==============================================================================
--- rt/3.999/branches/merge_to_3.8.2/lib/RT/Model/Transaction.pm (original)
+++ rt/3.999/branches/merge_to_3.8.2/lib/RT/Model/Transaction.pm Sun Jan 25 21:38:06 2009
@@ -303,6 +303,8 @@
use RT::Model::AttachmentCollection;
use RT::Model::ScripCollection;
+use RT::Ruleset;
+
use HTML::FormatText;
use HTML::TreeBuilder;
@@ -380,9 +382,23 @@
ticket => $args{'object_id'},
transaction => $self->id,
);
+
+ # Entry point of the rule system
+ my $ticket = RT::Model::Ticket->new( current_user => RT->system_user );
+ $ticket->load( $args{'object_id'} );
+ my $rules = RT::Ruleset->find_all_rules(
+ Stage => 'TransactionCreate',
+ type => $args{'type'},
+ ticket_obj => $ticket,
+ transaction_obj => $self,
+ );
+
+
if ( $commit_scrips ) {
Jifty->log->debug( 'About to commit scrips for transaction #' . $self->id );
$self->{'scrips'}->commit;
+ RT::Ruleset->commitRules($rules);
+
} else {
Jifty->log->debug( 'Skipping commit of scrips for transaction #' . $self->id );
}
@@ -476,10 +492,11 @@
Takes a paramhash. If the $args{'Quote'} parameter is set, wraps this message
at $args{'Wrap'}. $args{'Wrap'} defaults to 70.
-If $args{'type'} is set to C<text/html>, plain texts are upgraded to HTML.
-Otherwise, HTML texts are downgraded to plain text. If $args{'type'} is
-missing, it defaults to the value of C<$RT::Model::Transaction::Preferredcontent_type>,
-if that's missing too, defaults to 'text/plain'.
+If $args{'type'} is set to C<text/html>, this will return an HTML
+part of the message, if available. Otherwise it looks for a text/plain
+part. If $args{'type'} is missing, it defaults to the value of
+C<$RT::Transaction::Preferredcontent_type>, if that's missing too,
+defaults to 'text/plain'.
=cut
@@ -493,7 +510,7 @@
);
my $content;
- if ( my $content_obj = $self->content_obj ) {
+ if ( my $content_obj = $self->content_obj( type => $args{type} ) ) {
$content = $content_obj->content || '';
if ( lc $content_obj->content_type eq 'text/html' ) {
@@ -575,6 +592,10 @@
sub content_obj {
my $self = shift;
+ my %args = (
+ type => $Preferredcontent_type || 'text/plain',
+ @_
+ );
# If we don't have any content, return undef now.
# Get the set of toplevel attachments to this transaction.
@@ -590,7 +611,7 @@
elsif ( $Attachment->content_type =~ '^multipart/' ) {
my $plain_parts = $Attachment->children;
- $plain_parts->content_type( value => ( $Preferredcontent_type || 'text/plain' ) );
+ $plain_parts->content_type( value => $args{type} );
$plain_parts->limit_not_empty;
# If we actully found a part, return its content
More information about the Rt-commit
mailing list