[Rt-commit] rt branch, 4.6/priority-as-string, repushed
Craig Kaiser
craig at bestpractical.com
Tue Aug 14 09:17:12 EDT 2018
The branch 4.6/priority-as-string was deleted and repushed:
was 056cf567fa2781a6c65f4f945e4817fdbdc799c2
now 87984768e07489ec601c4db6eac8c164486c98f8
1: 056cf567f ! 1: 87984768e Core RT::Extension::PriorityAsString
@@ -35,7 +35,7 @@
+
+=cut
+
-+Set(%DefaultPriorityAsString, Low => 0, Medium => 50, High => 100);
++Set(%PriorityAsString, Low => 0, Medium => 50, High => 100);
+
+=item C<%PriorityAsStringOrder>
+
@@ -72,55 +72,9 @@
+
+=cut
+
-+Set(%PriorityAsStringQueues,
-+ General => { Low => 0, Medium => 50, High => 100 },
-+);
-+
=back
=head1 Assets
-
-diff --git a/lib/RT/Config.pm b/lib/RT/Config.pm
---- a/lib/RT/Config.pm
-+++ b/lib/RT/Config.pm
-@@
- ServiceAgreements => {
- Type => 'HASH',
- },
-+
-+ PriorityAsStringQueues => {
-+ Type => 'HASH',
-+ PostLoadCheck => sub {
-+ my $self = shift;
-+
-+ my $numerical_priority = $self->Get('NumericalPriority');
-+ my %default_config = $self->Get('DefaultPriorityAsString');
-+ my %user_config = $self->Get('PriorityAsString') || ();
-+ my %config = $self->Get('PriorityAsStringQueues');
-+
-+ if ($numerical_priority) {
-+ %default_config = undef;
-+ } elsif (%user_config) {
-+ %default_config = %user_config;
-+ }
-+
-+ my $queues = RT::Queues->new(RT->SystemUser);
-+ $queues->Limit(
-+ FIELD => 'Name',
-+ OPERATOR => 'IS NOT',
-+ VALUE => '___Approvals',
-+ );
-+ my @queue_configs = keys %config;
-+ while (my $queue = $queues->Next) {
-+ $config{$queue->Name} = {%default_config} unless defined $config{$queue->Name};
-+ }
-+
-+ $self->Set( 'PriorityAsStringQueues', %config );
-+ },
-+ },
- );
- my %OPTIONS = ();
- my @LOADED_CONFIGS = ();
diff --git a/lib/RT/Ticket.pm b/lib/RT/Ticket.pm
--- a/lib/RT/Ticket.pm
@@ -292,9 +246,9 @@
+
+if ($PriorityStringMap) {
+ %map = %{$PriorityStringMap};
-+} elsif ($QueueObj) {
++} elsif ($QueueObj and ! RT->Config->Get('NumericalPriority')) {
+ my %config = RT->Config->Get('PriorityAsStringQueues');
-+ %map = %{$config{$QueueObj->Name}};
++ %map = $config{$QueueObj->Name} ? %{$config{$QueueObj->Name}} : RT->Config->Get('PriorityAsString');
+}
+
+if (%map) {
More information about the rt-commit
mailing list