X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=rt%2Flib%2FRT%2FURI%2Ffsck_com_rt.pm;h=bb2c188f9f9ed6f272a038cd3c68492f98ff149f;hp=cfe77cdffac4ce55188668fcb30e9cca81675457;hb=9c68254528b6f2c7d8c1921b452fa56064783782;hpb=d39d52aac8f38ea9115628039f0df5aa3ac826de diff --git a/rt/lib/RT/URI/fsck_com_rt.pm b/rt/lib/RT/URI/fsck_com_rt.pm index cfe77cdff..bb2c188f9 100644 --- a/rt/lib/RT/URI/fsck_com_rt.pm +++ b/rt/lib/RT/URI/fsck_com_rt.pm @@ -1,8 +1,8 @@ -# {{{ BEGIN BPS TAGGED BLOCK +# BEGIN BPS TAGGED BLOCK {{{ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) @@ -42,7 +42,7 @@ # works based on those contributions, and sublicense and distribute # those contributions and any derivatives thereof. # -# }}} END BPS TAGGED BLOCK +# END BPS TAGGED BLOCK }}} package RT::URI::fsck_com_rt; use RT::Ticket; @@ -75,7 +75,7 @@ ok (UNIVERSAL::isa($uri,RT::URI::fsck_com_rt), "It's an RT::URI::fsck_com_rt"); ok ($uri->isa('RT::URI::base'), "It's an RT::URI::base"); ok ($uri->isa('RT::Base'), "It's an RT::Base"); -is ($uri->LocalURIPrefix , 'fsck.com-rt://example.com'); +is ($uri->LocalURIPrefix , 'fsck.com-rt://'.$RT::Organization); =end testing @@ -128,7 +128,7 @@ is($uri->LocalURIPrefix. "/ticket/1" , $uri->URIForObject($ticket)); sub URIForObject { my $self = shift; my $obj = shift; - return ($self->LocalURIPrefix."/".$self->ObjectType($obj)."/". $obj->Id); + return ($self->LocalURIPrefix ."/". $self->ObjectType($obj) ."/". $obj->Id); } @@ -143,12 +143,12 @@ sub ParseURI { my $self = shift; my $uri = shift; - if ( $uri =~ /^(\d+)$/ ) { + if ( $uri =~ /^\d+$/ ) { my $ticket = RT::Ticket->new( $self->CurrentUser ); - $ticket->Load($uri); + $ticket->Load( $uri ); $self->{'uri'} = $ticket->URI; $self->{'object'} = $ticket; - return($ticket->id); + return ($ticket->id); } else { $self->{'uri'} = $uri; @@ -156,9 +156,8 @@ sub ParseURI { #If it's a local URI, load the ticket object and return its URI if ( $self->IsLocal ) { - my $local_uri_prefix = $self->LocalURIPrefix; - if ( $self->{'uri'} =~ /^$local_uri_prefix\/(.*?)\/(\d+)$/i ) { + if ( $self->{'uri'} =~ /^\Q$local_uri_prefix\E\/(.*?)\/(\d+)$/i ) { my $type = $1; my $id = $2; @@ -192,9 +191,9 @@ Returns undef otherwise. sub IsLocal { my $self = shift; - my $local_uri_prefix = $self->LocalURIPrefix; - if ($self->{'uri'} =~ /^$local_uri_prefix/i) { - return 1; + my $local_uri_prefix = $self->LocalURIPrefix; + if ( $self->{'uri'} =~ /^\Q$local_uri_prefix/i ) { + return 1; } else { return undef;