[Rt-commit] rt branch, 4.0/force-lc-ticket-type, created. rt-4.0.4-146-g0a6cc95
Jim Brandt
jbrandt at bestpractical.com
Fri Apr 20 16:25:34 EDT 2012
The branch, 4.0/force-lc-ticket-type has been created
at 0a6cc95c3c64faf8cfd56630c8f9217f9b274b9b (commit)
- Log -----------------------------------------------------------------
commit 0a6cc95c3c64faf8cfd56630c8f9217f9b274b9b
Author: Jason May <jasonmay at bestpractical.com>
Date: Tue Dec 20 14:20:14 2011 -0500
Force ticket types to be lowercase
This should fix issues that arise when users create a template
that sets a ticket type to uppercase 'Approval'
rather than what RT wants, which is 'approval'.
diff --git a/lib/RT/Ticket.pm b/lib/RT/Ticket.pm
index 316fbff..9454ce6 100644
--- a/lib/RT/Ticket.pm
+++ b/lib/RT/Ticket.pm
@@ -472,7 +472,7 @@ sub Create {
TimeWorked => $args{'TimeWorked'},
TimeEstimated => $args{'TimeEstimated'},
TimeLeft => $args{'TimeLeft'},
- Type => $args{'Type'},
+ Type => lc $args{'Type'},
Starts => $Starts->ISO,
Started => $Started->ISO,
Resolved => $Resolved->ISO,
@@ -717,6 +717,13 @@ sub Create {
}
}
+sub SetType {
+ my $self = shift;
+ my $value = shift;
+
+ # Force lowercase
+ return $self->_Set(Field => 'Type', Value => lc($value), @_);
+}
diff --git a/t/api/ticket.t b/t/api/ticket.t
index 92c8a85..b02aa68 100644
--- a/t/api/ticket.t
+++ b/t/api/ticket.t
@@ -2,7 +2,7 @@
use strict;
use warnings;
use RT;
-use RT::Test tests => 87;
+use RT::Test tests => 88;
{
@@ -254,3 +254,19 @@ ok(!$id,$msg);
}
+diag("Test ticket types with different cases");
+{
+my $t = RT::Ticket->new(RT->SystemUser);
+$t->Create(
+ Queue => 'general',
+ Subject => 'type test 1',
+ Type => 'Ticket',
+);
+my $t2 = RT::Ticket->new(RT->SystemUser);
+$t2->Create(
+ Queue => 'general',
+ Subject => 'type test 2',
+ Type => 'ticket',
+);
+is($t->Type, $t2->Type, "Ticket types are lowercased, therefore identical");
+}
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list