[Rt-commit] r19910 - in rtir/2.5/trunk: etc html/RTIR html/RTIR/Incident/Elements html/RTIR/Reporting lib/RT lib/RT/Action lib/RT/IR t/constituency
ruz at bestpractical.com
ruz at bestpractical.com
Thu Jun 4 19:57:00 EDT 2009
Author: ruz
Date: Thu Jun 4 19:57:00 2009
New Revision: 19910
Modified:
rtir/2.5/trunk/etc/RTIR_Config.pm
rtir/2.5/trunk/html/RTIR/Create.html
rtir/2.5/trunk/html/RTIR/Incident/Elements/Create
rtir/2.5/trunk/html/RTIR/Incident/Elements/ReplyForm
rtir/2.5/trunk/html/RTIR/Reporting/index.html
rtir/2.5/trunk/lib/RT/Action/RTIR_SetConstituency.pm
rtir/2.5/trunk/lib/RT/Action/RTIR_SetIncidentResolution.pm
rtir/2.5/trunk/lib/RT/IR.pm
rtir/2.5/trunk/lib/RT/IR/AdministrationTutorial.pod
rtir/2.5/trunk/lib/RT/IR/Tutorial.pod
rtir/2.5/trunk/t/constituency/basics.t
rtir/2.5/trunk/t/constituency/email.t
rtir/2.5/trunk/t/constituency/email_outgoing.t
rtir/2.5/trunk/t/mail/skip_notification.t
Log:
* replace many options with a new one option to handle default values
of custom fields - %RTIR_CustomFieldDefaults. Required to make proper
backwards compatible handling of old options using RT's custom fields'
editor.
Modified: rtir/2.5/trunk/etc/RTIR_Config.pm
==============================================================================
--- rtir/2.5/trunk/etc/RTIR_Config.pm (original)
+++ rtir/2.5/trunk/etc/RTIR_Config.pm Thu Jun 4 19:57:00 2009
@@ -6,12 +6,12 @@
# Set the name of the RTIR application.
-Set($rtirname , RT->Config->Get('rtname') );
+Set($rtirname, RT->Config->Get('rtname') );
# By default, RT only displays text attachments inline up to the first 16k
# RTIR will display them no matter how long they are
#
-Set($MaxInlineBody,0);
+Set($MaxInlineBody, 0);
# Set the number of days a message awaiting an external response
# may be inactive before the ticket becomes overdue
@@ -54,25 +54,29 @@
# Set the defaults for RTIR custom fields
# default values are case-sensitive
-Set($_RTIR_SLA_inhours_default, "Full service");
-Set($_RTIR_SLA_outofhours_default, "Full service: out of hours");
-Set($_RTIR_HowReported_default, "Email");
-Set($_RTIR_ReporterType_default, "");
-Set($_RTIR_IP_default, "");
-Set($_RTIR_Netmask_default, "");
-Set($_RTIR_Port_default, "");
-Set($_RTIR_WhereBlocked_default, "");
-Set($_RTIR_Function_default, "");
-Set($_RTIR_Classification_default, "");
-Set($_RTIR_Description_default, "");
-Set($_RTIR_Resolution_resolved_default, "successfully resolved");
-Set($_RTIR_Resolution_rejected_default, "no resolution reached");
+Set( %RTIR_CustomFieldsDefaults,
+ SLA => {
+ InHours => 'Full service',
+ OutOfHours => 'Full service: out of hours',
+ },
+ HowReported => "",
+ ReporterType => "",
+ IP => "",
+ Netmask => "",
+ Port => "",
+ WhereBlocked => "",
+ Function => "",
+ Classification => "",
+ Description => "",
+ Resolution => {
+ resolved => "successfully resolved",
+ rejected => "no resolution reached",
+ },
+ Constituency => 'EDUNET',
+);
# Constituency behaviour
# read more about constituencies in lib/RT/IR/Constituency.pod
-#
-# default value
-Set( $_RTIR_Constituency_default, "EDUNET" );
# Constituency propagation algorithm
# valid values are 'no', 'inherit', 'reject'
Modified: rtir/2.5/trunk/html/RTIR/Create.html
==============================================================================
--- rtir/2.5/trunk/html/RTIR/Create.html (original)
+++ rtir/2.5/trunk/html/RTIR/Create.html Thu Jun 4 19:57:00 2009
@@ -151,7 +151,7 @@
% my $default;
% $default = $IncidentObj->FirstCustomFieldValue('Constituency') if $Incident;
% $default ||= RT::IR::DefaultConstituency( $QueueObj );
-% $default ||= scalar RT->Config->Get('_RTIR_Constituency_default');
+% $default ||= scalar RT->Config->Get('RTIR_CustomFieldsDefaults')->{'Constituency'};
<& /RTIR/Elements/EditRTIRField,
QueueObj => $QueueObj,
Name => 'Constituency',
@@ -170,7 +170,8 @@
<td colspan="3">
<& /Ticket/Elements/EditCustomFields,
TicketObj => $TicketObj,
- QueueObj => $QueueObj &>
+ QueueObj => $QueueObj,
+ &>
</td>
</tr>
Modified: rtir/2.5/trunk/html/RTIR/Incident/Elements/Create
==============================================================================
--- rtir/2.5/trunk/html/RTIR/Incident/Elements/Create (original)
+++ rtir/2.5/trunk/html/RTIR/Incident/Elements/Create Thu Jun 4 19:57:00 2009
@@ -34,7 +34,7 @@
% my $default;
% $default = $ChildObj->FirstCustomFieldValue('Constituency') if $ChildObj;
% $default ||= RT::IR::DefaultConstituency( $QueueObj );
-% $default ||= scalar RT->Config->Get('_RTIR_Constituency_default');
+% $default ||= scalar RT->Config->Get('RTIR_CustomFieldsDefaults')->{'Constituency'};
<& /RTIR/Elements/EditRTIRField,
QueueObj => $QueueObj,
Name => 'Constituency',
Modified: rtir/2.5/trunk/html/RTIR/Incident/Elements/ReplyForm
==============================================================================
--- rtir/2.5/trunk/html/RTIR/Incident/Elements/ReplyForm (original)
+++ rtir/2.5/trunk/html/RTIR/Incident/Elements/ReplyForm Thu Jun 4 19:57:00 2009
@@ -24,7 +24,7 @@
Name => 'Resolution',
Default => (
$TicketObj->FirstCustomFieldValue('Resolution') ||
- scalar RT->Config->Get("Resolution_". $Status ."_default")
+ RT->Config->Get('RTIR_CustomFieldsDefaults')->{'Resolution'}{$Status}
),
Rows => 1,
&></td></tr>
Modified: rtir/2.5/trunk/html/RTIR/Reporting/index.html
==============================================================================
--- rtir/2.5/trunk/html/RTIR/Reporting/index.html (original)
+++ rtir/2.5/trunk/html/RTIR/Reporting/index.html Thu Jun 4 19:57:00 2009
@@ -38,7 +38,7 @@
<& /RTIR/Elements/EditRTIRField,
QueueObj => $QueueObj,
Name => 'Constituency',
- Default => scalar RT->Config->Get('_RTIR_Constituency_default'),
+ Default => RT->Config->Get('RTIR_CustomFieldsDefaults')->{'Constituency'},
Rows => 1
&>
</td>
Modified: rtir/2.5/trunk/lib/RT/Action/RTIR_SetConstituency.pm
==============================================================================
--- rtir/2.5/trunk/lib/RT/Action/RTIR_SetConstituency.pm (original)
+++ rtir/2.5/trunk/lib/RT/Action/RTIR_SetConstituency.pm Thu Jun 4 19:57:00 2009
@@ -110,7 +110,7 @@
}
}
$value ||= $self->GetConstituencyFromAttachment;
- $value ||= RT->Config->Get('_RTIR_Constituency_default');
+ $value ||= RT->Config->Get('RTIR_CustomFieldsDefaults')->{'Constituency'};
return undef if ($current||'') eq ($value||'');
my ($status, $msg) = $ticket->AddCustomFieldValue(
Modified: rtir/2.5/trunk/lib/RT/Action/RTIR_SetIncidentResolution.pm
==============================================================================
--- rtir/2.5/trunk/lib/RT/Action/RTIR_SetIncidentResolution.pm (original)
+++ rtir/2.5/trunk/lib/RT/Action/RTIR_SetIncidentResolution.pm Thu Jun 4 19:57:00 2009
@@ -38,7 +38,7 @@
return 1 unless $t->QueueObj->IsInactiveStatus( $status );
- my $value = RT->Config->Get("_RTIR_Resolution_${status}_default");
+ my $value = RT->Config->Get('RTIR_CustomFieldsDefaults')->{'Resolution'}{$status};
return 1 unless $value;
return 1 if $t->FirstCustomFieldValue( $cf->id );
Modified: rtir/2.5/trunk/lib/RT/IR.pm
==============================================================================
--- rtir/2.5/trunk/lib/RT/IR.pm (original)
+++ rtir/2.5/trunk/lib/RT/IR.pm Thu Jun 4 19:57:00 2009
@@ -115,8 +115,7 @@
Returns an object of L<Business::SLA> class or class defined in SLAModule
config option.
-See also the following options: SLAModule, _RTIR_SLA_inhours_default,
-_RTIR_SLA_outofhours_default and SLA.
+See also the following options: SLAModule, RTIR_CustomFieldsDefaults and SLA.
=cut
@@ -125,9 +124,8 @@
my $class = RT->Config->Get('SLAModule') || 'Business::SLA';
my $SLAObj = $class->new();
-
- $SLAObj->SetInHoursDefault( RT->Config->Get('_RTIR_SLA_inhours_default') );
- $SLAObj->SetOutOfHoursDefault( RT->Config->Get('_RTIR_SLA_outofhours_default') );
+ $SLAObj->SetInHoursDefault( RT->Config->Get('RTIR_CustomFieldsDefaults')->{'SLA'}{'InHours'} );
+ $SLAObj->SetOutOfHoursDefault( RT->Config->Get('RTIR_CustomFieldsDefaults')->{'SLA'}{'OutOfHours'} );
my $bh = RT::IR::BusinessHours();
$SLAObj->SetBusinessHours($bh);
@@ -242,7 +240,7 @@
next unless $pqueue->HasRight( Principal => $queue->CurrentUser, Right => "ShowTicket" );
push @values, substr $pqueue->__Value('Name'), length("$name - ");
}
- my $default = RT->Config->Get('_RTIR_Constituency_default') || '';
+ my $default = RT->Config->Get('RTIR_CustomFieldsDefaults')->{'Constituency'} || '';
return $default if grep lc $_ eq lc $default, @values;
return shift @values;
}
@@ -567,7 +565,7 @@
$value = $tmp;
$RT::Logger->debug("Found Constituency '$tmp' in email") if $tmp;
}
- $value ||= RT->Config->Get('_RTIR_Constituency_default');
+ $value ||= RT->Config->Get('RTIR_CustomFieldsDefaults')->{'Constituency'};
return unless $value;
my @res = $ticket->Create(
Modified: rtir/2.5/trunk/lib/RT/IR/AdministrationTutorial.pod
==============================================================================
--- rtir/2.5/trunk/lib/RT/IR/AdministrationTutorial.pod (original)
+++ rtir/2.5/trunk/lib/RT/IR/AdministrationTutorial.pod Thu Jun 4 19:57:00 2009
@@ -246,7 +246,7 @@
Inactive Status to an Active Status, the Resolution Custom Field
is removed. If it is changed from an Active Status to an Inactive Status
and the Resolution Custom Field wasn't set manually, it is set
-to the value of _RTIR_Resolution_(rejected|resolved)_default in your
+to the value according %RTIR_CustomFieldsDefaults in your
F<RTIR_Config.pm>.
=item NotifyOnClose
Modified: rtir/2.5/trunk/lib/RT/IR/Tutorial.pod
==============================================================================
--- rtir/2.5/trunk/lib/RT/IR/Tutorial.pod (original)
+++ rtir/2.5/trunk/lib/RT/IR/Tutorial.pod Thu Jun 4 19:57:00 2009
@@ -198,7 +198,7 @@
children grouped by queue. You can select children with checkboxes, only
children you've selected will be rejected, resolved or removed.
-Resolution of the Incident is set according to C<$_RTIR_Resolution_rejected_default>
+Resolution of the Incident is set according to C<%RTIR_CustomFieldsDefaults>
config option and by default its value is "no resolution reached", however,
you can choose any value you'd like to.
Modified: rtir/2.5/trunk/t/constituency/basics.t
==============================================================================
--- rtir/2.5/trunk/t/constituency/basics.t (original)
+++ rtir/2.5/trunk/t/constituency/basics.t Thu Jun 4 19:57:00 2009
@@ -54,7 +54,7 @@
diag "check that there is no option to set 'no value' on create" if $ENV{'TEST_VERBOSE'};
{
- my $default = RT->Config->Get('_RTIR_Constituency_default');
+ my $default = RT->Config->Get('RTIR_CustomFieldsDefaults')->{'Constituency'};
foreach my $queue( 'Incidents', 'Incident Reports', 'Investigations', 'Blocks' ) {
diag "'$queue' queue" if $ENV{'TEST_VERBOSE'};
Modified: rtir/2.5/trunk/t/constituency/email.t
==============================================================================
--- rtir/2.5/trunk/t/constituency/email.t (original)
+++ rtir/2.5/trunk/t/constituency/email.t Thu Jun 4 19:57:00 2009
@@ -31,7 +31,7 @@
diag "create a ticket via gate" if $ENV{'TEST_VERBOSE'};
{
my $i = 0;
- my $val = RT->Config->Get('_RTIR_Constituency_default'); # we have one default
+ my $val = RT->Config->Get('RTIR_CustomFieldsDefaults')->{'Constituency'}; # we have one default
foreach my $queue( 'Incidents', 'Incident Reports', 'Investigations', 'Blocks' ) {
diag "create a ticket in the '$queue' queue" if $ENV{'TEST_VERBOSE'};
@@ -61,7 +61,7 @@
{
my $i = 0;
- my $default = RT->Config->Get('_RTIR_Constituency_default');
+ my $default = RT->Config->Get('RTIR_CustomFieldsDefaults')->{'Constituency'};
my $val = (grep lc($_) ne lc($default), @values)[0];
ok $val, 'find not default value';
Modified: rtir/2.5/trunk/t/constituency/email_outgoing.t
==============================================================================
--- rtir/2.5/trunk/t/constituency/email_outgoing.t (original)
+++ rtir/2.5/trunk/t/constituency/email_outgoing.t Thu Jun 4 19:57:00 2009
@@ -6,7 +6,7 @@
use lib "t/lib";
use RT::IR::Test tests => 36;
-RT->Config->Set( '_RTIR_Constituency_default' => 'EDUNET' );
+RT->Config->Get('RTIR_CustomFieldsDefaults')->{'Constituency'} = 'EDUNET';
my ($queue_ir, $queue_ir_edunet, $queue_ir_govnet);
diag "create or update queues";
Modified: rtir/2.5/trunk/t/mail/skip_notification.t
==============================================================================
--- rtir/2.5/trunk/t/mail/skip_notification.t (original)
+++ rtir/2.5/trunk/t/mail/skip_notification.t Thu Jun 4 19:57:00 2009
@@ -6,7 +6,7 @@
use lib "t/lib";
use RT::IR::Test tests => 19;
-RT->Config->Set( '_RTIR_Constituency_default' => 'EDUNET' );
+RT->Config->Get('RTIR_CustomFieldsDefaults')->{'Constituency'} = 'EDUNET';
RT::Test->set_mail_catcher;
More information about the Rt-commit
mailing list