[Rt-commit] rt branch, 3.999-trunk, updated. 8814ab85c98071b46cdb4f27ee5a6e230d0235df
sartak at bestpractical.com
sartak at bestpractical.com
Fri Dec 4 05:01:05 EST 2009
The branch, 3.999-trunk has been updated
via 8814ab85c98071b46cdb4f27ee5a6e230d0235df (commit)
from cfdb26fb40e96ae180dae46c75816738f2919543 (commit)
Summary of changes:
lib/RT/Model/Ticket.pm | 35 +++++++++++++++++------------------
1 files changed, 17 insertions(+), 18 deletions(-)
- Log -----------------------------------------------------------------
commit 8814ab85c98071b46cdb4f27ee5a6e230d0235df
Author: Shawn M Moore <sartak at bestpractical.com>
Date: Fri Dec 4 05:00:50 2009 -0500
Factor out most of canonicalize_*_priority into a method
diff --git a/lib/RT/Model/Ticket.pm b/lib/RT/Model/Ticket.pm
index 9cf8569..fca4371 100755
--- a/lib/RT/Model/Ticket.pm
+++ b/lib/RT/Model/Ticket.pm
@@ -901,6 +901,19 @@ sub canonicalize_told {
return RT::DateTime->new_unset;
}
+sub _canonicalize_priority {
+ my $self = shift;
+ my $method = shift;
+ my $value = shift;
+ my $other = shift;
+
+ return $value if defined $value;
+
+ my $queue_obj = RT::Model::Queue->load($self->queue_id || $other->{queue});
+
+ return $queue_obj->$method || 0;
+}
+
=head2 canonicalize_initial_priority
Fallback to the queue's initial priority if available, or 0.
@@ -908,15 +921,8 @@ Fallback to the queue's initial priority if available, or 0.
=cut
sub canonicalize_initial_priority {
- my $self = shift;
- my $initial = shift;
- my $other = shift;
-
- return $initial if defined $initial;
-
- my $queue_obj = RT::Model::Queue->load($self->queue_id || $other->{queue});
-
- return $queue_obj->initial_priority || 0;
+ my $self = shift;
+ $self->_canonicalize_priority('initial_priority', @_);
}
=head2 canonicalize_final_priority
@@ -926,15 +932,8 @@ Fallback to the queue's final priority if available, or 0.
=cut
sub canonicalize_final_priority {
- my $self = shift;
- my $final = shift;
- my $other = shift;
-
- return $final if defined $final;
-
- my $queue_obj = RT::Model::Queue->load($self->queue_id || $other->{queue});
-
- return $queue_obj->final_priority || 0;
+ my $self = shift;
+ $self->_canonicalize_priority('final_priority', @_);
}
=head2 canonicalize_priority
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list