projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
import rt 3.4.6
[freeside.git]
/
rt
/
lib
/
RT
/
Base.pm
diff --git
a/rt/lib/RT/Base.pm
b/rt/lib/RT/Base.pm
index
03b50e6
..
f329221
100644
(file)
--- a/
rt/lib/RT/Base.pm
+++ b/
rt/lib/RT/Base.pm
@@
-1,8
+1,8
@@
-#
{{{ BEGIN BPS TAGGED BLOCK
+#
BEGIN BPS TAGGED BLOCK {{{
#
# COPYRIGHT:
#
#
# COPYRIGHT:
#
-# This software is Copyright (c) 1996-200
4
Best Practical Solutions, LLC
+# This software is Copyright (c) 1996-200
5
Best Practical Solutions, LLC
# <jesse@bestpractical.com>
#
# (Except where explicitly superseded by other copyright notices)
# <jesse@bestpractical.com>
#
# (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.
#
# 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::Base;
use Carp;
use Scalar::Util;
package RT::Base;
use Carp;
use Scalar::Util;
@@
-52,9
+52,18
@@
use vars qw(@EXPORT);
@EXPORT=qw(loc CurrentUser);
@EXPORT=qw(loc CurrentUser);
-=head1 FUNCTIONS
+=head1 NAME
+
+RT::Base
+
+=head1 SYNOPSIS
+=head1 DESCRIPTION
+
+=head1 FUNCTIONS
+
+=cut
# {{{ sub CurrentUser
# {{{ sub CurrentUser
@@
-72,6
+81,9
@@
sub CurrentUser {
if (@_) {
$self->{'original_user'} = $self->{'user'};
$self->{'user'} = shift;
if (@_) {
$self->{'original_user'} = $self->{'user'};
$self->{'user'} = shift;
+ # We need to weaken the CurrentUser ($self->{'user'}) reference
+ # if the object in question is the currentuser object.
+ # This avoids memory leaks.
Scalar::Util::weaken($self->{'user'}) if (ref($self->{'user'}) &&
$self->{'user'} == $self );
}
Scalar::Util::weaken($self->{'user'}) if (ref($self->{'user'}) &&
$self->{'user'} == $self );
}
@@
-79,7
+91,6
@@
sub CurrentUser {
unless ( ref( $self->{'user'}) ) {
$RT::Logger->err( "$self was created without a CurrentUser\n" . Carp::cluck() );
return (0);
unless ( ref( $self->{'user'}) ) {
$RT::Logger->err( "$self was created without a CurrentUser\n" . Carp::cluck() );
return (0);
- die;
}
return ( $self->{'user'} );
}
}
return ( $self->{'user'} );
}
@@
-98,7
+109,7
@@
sub OriginalUser {
}
}
-=
item
loc LOC_STRING
+=
head2
loc LOC_STRING
l is a method which takes a loc string
to this object's CurrentUser->LanguageHandle for localization.
l is a method which takes a loc string
to this object's CurrentUser->LanguageHandle for localization.
@@
-125,6
+136,18
@@
sub loc {
}
}
}
}
+sub loc_fuzzy {
+ my $self = shift;
+ if (my $user = $self->OriginalUser) {
+ return $user->loc_fuzzy(@_);
+ }
+ else {
+ use Carp;
+ Carp::confess("No currentuser");
+ return ("Critical error:$self has no CurrentUser", $self);
+ }
+}
+
eval "require RT::Base_Vendor";
die $@ if ($@ && $@ !~ qr{^Can't locate RT/Base_Vendor.pm});
eval "require RT::Base_Local";
eval "require RT::Base_Vendor";
die $@ if ($@ && $@ !~ qr{^Can't locate RT/Base_Vendor.pm});
eval "require RT::Base_Local";