[Rt-commit] rt branch, 4.0/context-on-custom-fields, updated. rt-4.0.4-43-g60b87f3
Ruslan Zakirov
ruz at bestpractical.com
Fri Nov 25 10:02:47 EST 2011
The branch, 4.0/context-on-custom-fields has been updated
via 60b87f3fd27abeeb48d55971d14bf7ca940e566a (commit)
from 31ecb9d5852632d09c0a9506e0c36ff3bd04806c (commit)
Summary of changes:
lib/RT/CustomField.pm | 4 ++++
lib/RT/Interface/Web.pm | 1 +
lib/RT/Transaction.pm | 1 +
3 files changed, 6 insertions(+), 0 deletions(-)
- Log -----------------------------------------------------------------
commit 60b87f3fd27abeeb48d55971d14bf7ca940e566a
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Fri Nov 25 19:02:02 2011 +0400
add context to custom fields
diff --git a/lib/RT/CustomField.pm b/lib/RT/CustomField.pm
index 820f6ee..338cccaa 100644
--- a/lib/RT/CustomField.pm
+++ b/lib/RT/CustomField.pm
@@ -469,6 +469,8 @@ sub LoadByName {
my $QueueObj = RT::Queue->new( $self->CurrentUser );
$QueueObj->Load( $args{'Queue'} );
$args{'Queue'} = $QueueObj->Id;
+ $self->SetContextObject( $QueueObj )
+ unless $self->ContextObject;
}
# XXX - really naive implementation. Slow. - not really. still just one query
@@ -1693,6 +1695,7 @@ sub SetBasedOn {
unless defined $value and length $value;
my $cf = RT::CustomField->new( $self->CurrentUser );
+ $cf->SetContextObject( $self->ContextObject );
$cf->Load( ref $value ? $value->id : $value );
return (0, "Permission denied")
@@ -1710,6 +1713,7 @@ sub BasedOnObj {
my $self = shift;
my $obj = RT::CustomField->new( $self->CurrentUser );
+ $obj->SetContextObject( $self->ContextObject );
if ( $self->BasedOn ) {
$obj->Load( $self->BasedOn );
}
diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index 1c3f758..878d074 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -1355,6 +1355,7 @@ sub CreateTicket {
my $cfid = $1;
my $cf = RT::CustomField->new( $session{'CurrentUser'} );
+ $cf->SetContextObject( $Queue );
$cf->Load($cfid);
unless ( $cf->id ) {
$RT::Logger->error( "Couldn't load custom field #" . $cfid );
diff --git a/lib/RT/Transaction.pm b/lib/RT/Transaction.pm
index 94e46e3..bd30bc7 100644
--- a/lib/RT/Transaction.pm
+++ b/lib/RT/Transaction.pm
@@ -708,6 +708,7 @@ sub BriefDescription {
if ( $self->Field ) {
my $cf = RT::CustomField->new( $self->CurrentUser );
+ $cf->SetContextObject( $self->Object );
$cf->Load( $self->Field );
$field = $cf->Name();
$field = $self->loc('a custom field') if !defined($field);
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list