[Rt-commit] r10655 - in rt/branches/3.999-DANGEROUS: lib/RT/Model lib/RT/ScripAction
ruz at bestpractical.com
ruz at bestpractical.com
Fri Feb 1 11:38:53 EST 2008
Author: ruz
Date: Fri Feb 1 11:38:13 2008
New Revision: 10655
Modified:
rt/branches/3.999-DANGEROUS/lib/RT/Model/Template.pm
rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/CreateTickets.pm
rt/branches/3.999-DANGEROUS/t/api/action-createtickets.t
Log:
* fix t/api/action-createtickets.t and template model
Modified: rt/branches/3.999-DANGEROUS/lib/RT/Model/Template.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Model/Template.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Model/Template.pm Fri Feb 1 11:38:13 2008
@@ -42,12 +42,12 @@
TranslationOf => max_length is 11,
type is 'int(11)', default is '0';
column content => type is 'blob', default is '';
- column LastUpdated => type is 'datetime', default is '';
+ column last_updated => type is 'datetime', default is '';
column
last_updated_by => max_length is 11,
type is 'int(11)', default is '0';
- column Creator => max_length is 11, type is 'int(11)', default is '0';
- column Created => type is 'datetime', default is '';
+ column creator => max_length is 11, type is 'int(11)', default is '0';
+ column created => type is 'datetime', default is '';
};
@@ -351,7 +351,7 @@
# with it
$content =~ s/^(.*)$/$1/;
my $template = Text::Template->new(
- type => 'STRING',
+ TYPE => 'STRING',
SOURCE => $content
);
Modified: rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/CreateTickets.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/CreateTickets.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/CreateTickets.pm Fri Feb 1 11:38:13 2008
@@ -58,10 +58,8 @@
=head1 name
- RT::ScripAction::CreateTickets
-
-Create one or more tickets according to an externally supplied template.
-
+RT::ScripAction::CreateTickets - Create one or more tickets according
+to an externally supplied template.
=head1 SYNOPSIS
@@ -326,7 +324,7 @@
}
$self->parse(
- Content => $self->template_obj->content,
+ content => $self->template_obj->content,
_ActiveContent => 1
);
return 1;
@@ -431,16 +429,16 @@
my @attribs = qw(
subject
final_priority
- Priority
+ priority
time_estimated
time_worked
time_left
- Status
- Queue
- Due
+ status
+ queue
+ due
starts
Started
- Resolved
+ resolved
);
my $id = $template_id;
@@ -546,7 +544,7 @@
sub parse {
my $self = shift;
my %args = (
- Content => undef,
+ content => undef,
queue => undef,
Requestor => undef,
_ActiveContent => undef,
@@ -560,9 +558,9 @@
$self->{'UsePerlTextTemplate'} = 0;
}
- if ( substr( $args{'Content'}, 0, 3 ) eq '===' ) {
+ if ( substr( $args{'content'}, 0, 3 ) eq '===' ) {
$self->_parse_multiline_template(%args);
- } elsif ( $args{'Content'} =~ /(?:\t|,)/i ) {
+ } elsif ( $args{'content'} =~ /(?:\t|,)/i ) {
$self->_parse_xsv_template(%args);
}
@@ -585,7 +583,7 @@
my $template_id;
my ( $queue, $requestor );
Jifty->log->debug("Line: ===");
- foreach my $line ( split( /\n/, $args{'Content'} ) ) {
+ foreach my $line ( split( /\n/, $args{'content'} ) ) {
$line =~ s/\r$//;
Jifty->log->debug("Line: $line");
if ( $line =~ /^===/ ) {
@@ -657,7 +655,7 @@
"Workflow: evaluating\n$self->{templates}{$template_id}");
my $template = Text::Template->new(
- type => 'STRING',
+ TYPE => 'STRING',
SOURCE => $content
);
@@ -755,12 +753,12 @@
my %ticketargs = (
queue => $args{'queue'},
subject => $args{'subject'},
- Status => $args{'status'} || 'new',
- Due => $args{'due'},
+ status => $args{'status'} || 'new',
+ due => $args{'due'},
starts => $args{'starts'},
- Started => $args{'started'},
+ started => $args{'started'},
resolved => $args{'resolved'},
- Owner => $args{'owner'},
+ owner => $args{'owner'},
Requestor => $args{'requestor'},
Cc => $args{'cc'},
AdminCc => $args{'admincc'},
@@ -820,7 +818,7 @@
my %args = (@_);
use Regexp::Common qw(delimited);
- my ( $first, $content ) = split( /\r?\n/, $args{'Content'}, 2 );
+ my ( $first, $content ) = split( /\r?\n/, $args{'content'}, 2 );
my $delimiter;
if ( $first =~ /\t/ ) {
@@ -896,7 +894,7 @@
|| $field =~ /^Data$/i
|| $field =~ /^Message$/i )
{
- $field = 'Content';
+ $field = 'content';
} elsif ( $field =~ /^Summary$/i ) {
$field = 'subject';
} elsif ( $field =~ /^Queue$/i ) {
@@ -916,7 +914,7 @@
$template .= ( defined $value ? $value : "" );
$template .= "\n";
$template .= "ENDOFCONTENT\n"
- if $field =~ /^Content$/i;
+ if $field =~ /^content$/i;
}
}
Modified: rt/branches/3.999-DANGEROUS/t/api/action-createtickets.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/api/action-createtickets.t (original)
+++ rt/branches/3.999-DANGEROUS/t/api/action-createtickets.t Fri Feb 1 11:38:13 2008
@@ -48,7 +48,7 @@
like ($approvals , qr/Content/, "Read in the approvals template");
my $apptemp = RT::Model::Template->new(current_user => RT->system_user);
-$apptemp->create( Content => $approvals, name => "Approvals", queue => "0");
+$apptemp->create( content => $approvals, name => "Approvals", queue => "0");
ok ($apptemp->id);
@@ -86,7 +86,7 @@
# comma-delimited templates
my $commas = <<"EOF";
-id,Queue,subject,Owner,Content
+id,Queue,Subject,Owner,Content
ticket1,General,"foo, bar",root,blah
ticket2,General,foo bar,root,blah
ticket3,General,foo' bar,root,blah'boo
@@ -96,7 +96,7 @@
# Comma delimited templates with missing data
my $sparse_commas = <<"EOF";
-id,Queue,subject,Owner,Requestor
+id,Queue,Subject,Owner,Requestor
ticket14,General,,,bobby
ticket15,General,,,tommy
ticket16,General,,suzie,tommy
@@ -108,7 +108,7 @@
# tab-delimited templates
my $tabs = <<"EOF";
-id\tQueue\tsubject\tOwner\tContent
+id\tQueue\tSubject\tOwner\tContent
ticket10\tGeneral\t"foo' bar"\troot\tblah'
ticket11\tGeneral\tfoo, bar\troot\tblah
ticket12\tGeneral\tfoo' bar\troot\tblah'boo
@@ -222,9 +222,9 @@
-$action->parse(Content =>$commas);
-$action->parse(Content =>$sparse_commas);
-$action->parse(Content => $tabs);
+$action->parse(content =>$commas);
+$action->parse(content =>$sparse_commas);
+$action->parse(content => $tabs);
my %got;
foreach (@{ $action->{'CreateTickets'} }) {
More information about the Rt-commit
mailing list