X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=rt%2Flib%2FRT%2FApproval%2FRule%2FPassed.pm;h=53d09a195cb1441d72445c67623a57f132feafbb;hp=1618e6e8fa01ae6c6539e7fb905a095323644f29;hb=9aee669886202be7035e6c6049fc71bc99dd3013;hpb=fc6209f398899f0211cfcedeb81a3cd65e04a941 diff --git a/rt/lib/RT/Approval/Rule/Passed.pm b/rt/lib/RT/Approval/Rule/Passed.pm index 1618e6e8f..53d09a195 100644 --- a/rt/lib/RT/Approval/Rule/Passed.pm +++ b/rt/lib/RT/Approval/Rule/Passed.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2015 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) @@ -62,13 +62,7 @@ sub Prepare { sub Commit { my $self = shift; - my $note; - my $t = $self->TicketObj->Transactions; - - while ( my $o = $t->Next ) { - next unless $o->Type eq 'Correspond'; - $note .= $o->Content . "\n" if $o->ContentObj; - } + my $note = $self->GetNotes; my ($top) = $self->TicketObj->AllDependedOnBy( Type => 'ticket' ); my $links = $self->TicketObj->DependedOnBy; @@ -86,7 +80,8 @@ sub Commit { } } - $obj->SetStatus( Status => 'open', Force => 1 ); + $obj->SetStatus( Status => $obj->FirstActiveStatus, Force => 1 ) + if $obj->FirstActiveStatus; } my $passed = !$top->HasUnresolvedDependencies( Type => 'approval' ); @@ -101,6 +96,11 @@ sub Commit { $top->Correspond( MIMEObj => $template->MIMEObj ); if ($passed) { + my $new_status = $top->LifecycleObj->DefaultStatus('approved') || 'open'; + if ( $new_status ne $top->Status ) { + $top->SetStatus( $new_status ); + } + $self->RunScripAction('Notify Owner', 'Approval Ready for Owner', TicketObj => $top); } @@ -108,4 +108,19 @@ sub Commit { return; } +sub GetNotes { + my $self = shift; + my $t = $self->TicketObj->Transactions; + my $note = ''; + + while ( my $o = $t->Next ) { + next unless $o->Type eq 'Correspond'; + $note .= $o->Content . "\n" if $o->ContentObj; + } + return $note; + +} + +RT::Base->_ImportOverlays(); + 1;