Skip to content

Commit

Permalink
Add default value for calls to LookupType
Browse files Browse the repository at this point in the history
If upgrading from 4.4.1 or previous and the database has a custom role
the 4.4.2 upgrade step fails as the 5.0.4 code expects the LookupType
column to exist in the database.

Adding a default value for calls to LookupType ensures if there is no
result the code defaults to the only possible value for older databases.
  • Loading branch information
bkembreeBPS committed Aug 24, 2023
1 parent 0072407 commit b11c355
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/RT/Record/Role/LookupType.pm
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ Returns a localized description of the LookupType of this record

sub FriendlyLookupType {
my $self = shift;
my $lookup = shift || $self->LookupType;
my $lookup = shift || ( $self->LookupType || 'RT::Queue-RT::Ticket' );

my $class = blessed($self) || $self;

Expand Down Expand Up @@ -208,7 +208,7 @@ object.

sub RecordClassFromLookupType {
my $self = shift;
my $type = shift || $self->LookupType;
my $type = shift || ( $self->LookupType || 'RT::Queue-RT::Ticket');
my ($class) = ($type =~ /^([^-]+)/);
unless ( $class ) {
if (blessed($self) and $self->LookupType eq $type) {
Expand Down Expand Up @@ -237,7 +237,7 @@ object.

sub ObjectTypeFromLookupType {
my $self = shift;
my $type = shift || $self->LookupType;
my $type = shift || ( $self->LookupType || 'RT::Queue-RT::Ticket' );
my ($class) = ($type =~ /([^-]+)$/);
unless ( $class ) {
if (blessed($self) and $self->LookupType eq $type) {
Expand Down

0 comments on commit b11c355

Please sign in to comment.