[Rt-commit] r4698 - in rtir/branches/1.9-EXPERIMENTAL: .
html/RTIR/Elements
ruz at bestpractical.com
ruz at bestpractical.com
Sun Mar 5 18:59:26 EST 2006
Author: ruz
Date: Sun Mar 5 18:59:26 2006
New Revision: 4698
Modified:
rtir/branches/1.9-EXPERIMENTAL/ (props changed)
rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/EditRTIRField
rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/SelectCustomFieldValue
rtir/branches/1.9-EXPERIMENTAL/lib/RT/IR/Ticket.pm
Log:
r871 at cubic-pc: cubic | 2006-03-06 00:15:03 +0300
* revert CF hack in RTIR, switch user context back to current user
Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/EditRTIRField
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/EditRTIRField (original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/EditRTIRField Sun Mar 5 18:59:26 2006
@@ -22,35 +22,34 @@
%#
%#
%# END LICENSE BLOCK
-% if ($cf->id) {
% if ($cf->Type eq 'FreeformSingle') {
-<input type="hidden" name="<%$Name%>" value="<%$NamePrefix%><%$cf->id%>-Value" />
+<input type="hidden" name="<% $Name %>" value="<% $NamePrefix %><% $cf->id %>-Value" />
% } else {
-<input type="hidden" name="<%$Name%>" value="<%$NamePrefix%><%$cf->id%>-Values" />
+<input type="hidden" name="<% $Name %>" value="<% $NamePrefix %><% $cf->id %>-Values" />
% }
<& /Elements/EditCustomField,
- Object => $TicketObj,
+ Object => $TicketObj,
CustomField => $cf,
- NamePrefix => $NamePrefix,
- Default => $Default,
- Rows => $Rows,
- Cols => $Cols &>
-% }
+ NamePrefix => $NamePrefix,
+ Default => $Default,
+ Rows => $Rows,
+ Cols => $Cols,
+&>
<%INIT>
my $Values;
my $NamePrefix;
-if ($TicketObj) {
+if ( $TicketObj ) {
$QueueObj = $TicketObj->QueueObj;
$NamePrefix = "Object-RT::Ticket-".$TicketObj->Id."-CustomField-";
} else {
$NamePrefix = "Object-RT::Ticket--CustomField-";
}
-# XXX: load as system user since, DutyTeam has no right on CFs
-my $cf = RT::CustomField->new( $RT::SystemUser );
+my $cf = RT::CustomField->new( $session{'CurrentUser'} );
$cf->LoadByNameAndQueue( Queue => $QueueObj->id, Name => "_RTIR_".$Name );
+return unless $cf->id;
</%INIT>
<%ARGS>
Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/SelectCustomFieldValue
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/SelectCustomFieldValue (original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/SelectCustomFieldValue Sun Mar 5 18:59:26 2006
@@ -22,14 +22,12 @@
%#
%#
%# END LICENSE BLOCK
-% if (defined $cf) {
<& /Elements/SelectCustomFieldValue,
CustomField => $cf,
- Name => $FieldName &>
-% }
-
+ Name => $FieldName,
+&>
<%INIT>
-my $cf = RT::CustomField->new($session{'CurrentUser'});
+my $cf = RT::CustomField->new( $session{'CurrentUser'} );
$cf->LoadByNameAndQueue(Queue => $QueueObj->Id, Name => "_RTIR_".$Name);
my $FieldName = "CustomField".$cf->id;
</%INIT>
Modified: rtir/branches/1.9-EXPERIMENTAL/lib/RT/IR/Ticket.pm
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/lib/RT/IR/Ticket.pm (original)
+++ rtir/branches/1.9-EXPERIMENTAL/lib/RT/IR/Ticket.pm Sun Mar 5 18:59:26 2006
@@ -18,14 +18,10 @@
sub FirstCustomFieldValue {
my $ticket = shift;
+ my $field = shift;
return undef unless $ticket->CurrentUserHasRight('ShowTicket');
- my $field = shift;
- my $old_user = $ticket->CurrentUser;
- $ticket->CurrentUser( $RT::SystemUser );
- my $value = $ticket->FirstCustomFieldValue( $field );
- $ticket->CurrentUser( $old_user );
- return $value;
+ return $ticket->FirstCustomFieldValue( $field );
}
1;
More information about the Rt-commit
mailing list