summaryrefslogtreecommitdiff
path: root/rt/lib
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2015-12-10 01:01:21 -0800
committerMark Wells <mark@freeside.biz>2015-12-10 01:01:21 -0800
commit1b821166888962897d6f4b0c87acb00d6b9f392d (patch)
tree7f8a46cd8b6188db70cccdde514ef834b221384b /rt/lib
parent5f2c6bcae77fc9c1b723bae954ef09547da712ee (diff)
fix some problems with creation of subtask tickets, #34061
Diffstat (limited to 'rt/lib')
-rw-r--r--rt/lib/RT/Condition/CustomFieldEquals.pm7
-rw-r--r--rt/lib/RT/Template_Vendor.pm34
2 files changed, 38 insertions, 3 deletions
diff --git a/rt/lib/RT/Condition/CustomFieldEquals.pm b/rt/lib/RT/Condition/CustomFieldEquals.pm
index 69dedcbca..8ebf94b2b 100644
--- a/rt/lib/RT/Condition/CustomFieldEquals.pm
+++ b/rt/lib/RT/Condition/CustomFieldEquals.pm
@@ -28,9 +28,10 @@ sub IsApplicable {
if ($trans->Type eq 'CustomField') {
my $cf = RT::CustomField->new($self->CurrentUser);
$cf->Load($field);
- return $trans->Field == $cf->Id
- and ($trans->NewValue eq $value)
- and ($trans->OldValue ne $value)
+ return ( $trans->Field == $cf->Id
+ and $trans->NewValue eq $value
+ and $trans->OldValue ne $value
+ );
}
return undef;
}
diff --git a/rt/lib/RT/Template_Vendor.pm b/rt/lib/RT/Template_Vendor.pm
new file mode 100644
index 000000000..f1a276c3d
--- /dev/null
+++ b/rt/lib/RT/Template_Vendor.pm
@@ -0,0 +1,34 @@
+package RT::Template;
+
+=item LoadByName
+
+Takes Name and Queue arguments. Tries to load queue specific template
+first, then global. If Queue argument is omitted then global template
+is tried, not template with the name in any queue.
+
+=cut
+
+sub LoadByName {
+ my $self = shift;
+ my %args = (
+ Queue => undef,
+ Name => undef,
+ @_
+ );
+ my $queue = $args{'Queue'};
+ if ( blessed $queue ) {
+ $queue = $queue->id;
+ } elsif ( defined $queue and $queue =~ /\D/ ) {
+ my $tmp = RT::Queue->new( $self->CurrentUser );
+ $tmp->Load($queue);
+ $queue = $tmp->id;
+ }
+
+ return $self->LoadGlobalTemplate( $args{'Name'} ) unless $queue;
+
+ $self->LoadQueueTemplate( Queue => $queue, Name => $args{'Name'} );
+ return $self->id if $self->id;
+ return $self->LoadGlobalTemplate( $args{'Name'} );
+}
+
+1;