Mailing List Archive

[svn] r1417 - in rt/branches/3.3-TESTING: . lib/RT
Author: jesse
Date: Fri Sep 3 19:24:32 2004
New Revision: 1417

Modified:
rt/branches/3.3-TESTING/ (props changed)
rt/branches/3.3-TESTING/lib/RT/Record.pm
rt/branches/3.3-TESTING/lib/RT/Ticket_Overlay.pm
Log:
r10151@tinbook: jesse | 2004-09-03T23:24:09.414496Z
minor library cleanups


Modified: rt/branches/3.3-TESTING/lib/RT/Record.pm
==============================================================================
--- rt/branches/3.3-TESTING/lib/RT/Record.pm (original)
+++ rt/branches/3.3-TESTING/lib/RT/Record.pm Fri Sep 3 19:24:32 2004
@@ -1366,7 +1366,7 @@

=head2 Transactions

- Returns an RT::Transactions object of all transactions on this ticket
+ Returns an RT::Transactions object of all transactions on this record object

=cut

@@ -1378,12 +1378,12 @@

#If the user has no rights, return an empty object
$transactions->Limit(
- FIELD => 'ObjectId',
- VALUE => $self->id,
+ FIELD => 'ObjectId',
+ VALUE => $self->id,
);
$transactions->Limit(
- FIELD => 'ObjectType',
- VALUE => ref($self),
+ FIELD => 'ObjectType',
+ VALUE => ref($self),
);

return ($transactions);
@@ -1679,9 +1679,9 @@

=item CustomFieldValues FIELD

-Return a ObjectCustomFieldValues object of all values of CustomField FIELD for this ticket.
-Takes a field id.
+Return a ObjectCustomFieldValues object of all values of the CustomField whose id is FIELD for this ticket.

+Returns an RT::ObjectCustomFieldValues object

=cut

@@ -1691,16 +1691,13 @@

my $cf_values = RT::ObjectCustomFieldValues->new( $self->CurrentUser );
$cf_values->LimitToObject($self);
- $cf_values->OrderBy( FIELD => 'id' );
+ $cf_values->OrderBy( FIELD => 'id', ORDER => 'ASC' );

- if (length $field) {
- $field =~ /^\d+$/ or die "LoadByNameAndQueue impossible for Record.pm";
- my $cf = RT::CustomField->new($self->CurrentUser);
- $cf->LoadById($field);
- $cf_values->LimitToCustomField($cf->id);
+ if ( length $field ) {
+ $field =~ /^\d+$/ or die "LoadByNameAndQueue impossible for Record.pm";
+ my $cf = RT::CustomField->new( $self->CurrentUser );
+ $cf_values->LimitToCustomField( $field);
}
-
- # @values is a CustomFieldValues object;
return ($cf_values);
}


Modified: rt/branches/3.3-TESTING/lib/RT/Ticket_Overlay.pm
==============================================================================
--- rt/branches/3.3-TESTING/lib/RT/Ticket_Overlay.pm (original)
+++ rt/branches/3.3-TESTING/lib/RT/Ticket_Overlay.pm Fri Sep 3 19:24:32 2004
@@ -749,170 +749,6 @@

# }}}

-# {{{ sub CreateFromEmailMessage
-
-
-=head2 CreateFromEmailMessage { Message, Queue, ExtractActorFromHeaders }
-
-This code replaces what was once a large part of the email gateway.
-It takes an email message as a parameter, parses out the sender, subject
-and a MIME object. It then creates a ticket based on those attributes
-
-=cut
-
-sub CreateFromEmailMessage {
- my $self = shift;
- my %args = ( Message => undef,
- Queue => undef,
- ExtractActorFromSender => undef,
- @_ );
-
-
- # Pull out requestor
-
- # Pull out Cc?
-
- #
-
-
-}
-
-# }}}
-
-
-# {{{ CreateFrom822
-
-=head2 FORMAT
-
-CreateTickets uses the template as a template for an ordered set of tickets
-to create. The basic format is as follows:
-
-
- ===Create-Ticket: identifier
- Param: Value
- Param2: Value
- Param3: Value
- Content: Blah
- blah
- blah
- ENDOFCONTENT
-=head2 Acceptable fields
-
-A complete list of acceptable fields for this beastie:
-
-
- * Queue => Name or id# of a queue
- Subject => A text string
- Status => A valid status. defaults to 'new'
-
- Due => Dates can be specified in seconds since the epoch
- to be handled literally or in a semi-free textual
- format which RT will attempt to parse.
- Starts =>
- Started =>
- Resolved =>
- Owner => Username or id of an RT user who can and should own
- this ticket
- + Requestor => Email address
- + Cc => Email address
- + AdminCc => Email address
- TimeWorked =>
- TimeEstimated =>
- TimeLeft =>
- InitialPriority =>
- FinalPriority =>
- Type =>
- + DependsOn =>
- + DependedOnBy =>
- + RefersTo =>
- + ReferredToBy =>
- + Members =>
- + MemberOf =>
- Content => content. Can extend to multiple lines. Everything
- within a template after a Content: header is treated
- as content until we hit a line containing only
- ENDOFCONTENT
- ContentType => the content-type of the Content field
- CustomField-<id#> => custom field value
-
-Fields marked with an * are required.
-
-Fields marked with a + man have multiple values, simply
-by repeating the fieldname on a new line with an additional value.
-
-
-When parsed, field names are converted to lowercase and have -s stripped.
-Refers-To, RefersTo, refersto, refers-to and r-e-f-er-s-tO will all
-be treated as the same thing.
-
-
-=begin testing
-
-use_ok(RT::Ticket);
-
-=end testing
-
-
-=cut
-
-sub CreateFrom822 {
- my $self = shift;
- my $content = shift;
-
-
-
- my %args = $self->_Parse822HeadersForAttributes($content);
-
- # Now we have a %args to work with.
- # Make sure we have at least the minimum set of
- # reasonable data and do our thang
- my $ticket = RT::Ticket->new($RT::SystemUser);
-
- my %ticketargs = (
- Queue => $args{'queue'},
- Subject => $args{'subject'},
- Status => $args{'status'},
- Due => $args{'due'},
- Starts => $args{'starts'},
- Started => $args{'started'},
- Resolved => $args{'resolved'},
- Owner => $args{'owner'},
- Requestor => $args{'requestor'},
- Cc => $args{'cc'},
- AdminCc => $args{'admincc'},
- TimeWorked => $args{'timeworked'},
- TimeEstimated => $args{'timeestimated'},
- TimeLeft => $args{'timeleft'},
- InitialPriority => $args{'initialpriority'},
- FinalPriority => $args{'finalpriority'},
- Type => $args{'type'},
- DependsOn => $args{'dependson'},
- DependedOnBy => $args{'dependedonby'},
- RefersTo => $args{'refersto'},
- ReferredToBy => $args{'referredtoby'},
- Members => $args{'members'},
- MemberOf => $args{'memberof'},
- MIMEObj => $args{'mimeobj'}
- );
-
- # Add custom field entries to %ticketargs.
- # TODO: allow named custom fields
- map {
- /^customfield-(\d+)$/
- && ( $ticketargs{ "CustomField-" . $1 } = $args{$_} );
- } keys(%args);
-
- my ( $id, $transid, $msg ) = $ticket->Create(%ticketargs);
- unless ($id) {
- $RT::Logger->error( "Couldn't create a related ticket for "
- . $self->TicketObj->Id . " "
- . $msg );
- }
-
- return (1);
-}
-
-# }}}

# {{{ UpdateFrom822

@@ -1338,7 +1174,6 @@

# }}}

-
# {{{ Routines dealing with watchers.

# {{{ _CreateTicketGroups
@@ -3656,27 +3491,49 @@

# }}}

+
+# {{{ TransactionCustomFields
+
+=head2 TransactionCustomFields
+
+ Returns the custom fields that transactions on tickets will ahve.
+
+=cut
+
sub TransactionCustomFields {
my $self = shift;
return $self->QueueObj->TicketTransactionCustomFields;
}

+# }}}
+
+# {{{ sub CustomFieldValues
+
+=head2 CustomFieldValues
+
# Do name => id mapping (if needed) before falling back to
# RT::Record's CustomFieldValues
+
+See L<RT::Record>
+
+=cut
+
sub CustomFieldValues {
- my $self = shift;
+ my $self = shift;
my $field = shift;
- unless ($field =~ /^\d+$/) {
- my $cf = RT::CustomField->new($self->CurrentUser);
- $cf->LoadByNameAndQueue(Name => $field, Queue => $self->QueueObj->Id);
- unless( $cf->id ) {
- $cf->LoadByNameAndQueue(Name => $field, Queue => '0');
+ unless ( $field =~ /^\d+$/ ) {
+ my $cf = RT::CustomField->new( $self->CurrentUser );
+ $cf->LoadByNameAndQueue( Name => $field, Queue => $self->QueueObj->Id );
+ unless ( $cf->id ) {
+ $cf->LoadByNameAndQueue( Name => $field, Queue => '0' );
}
- $field = $cf->id;
+ $field = $cf->id;
}
return $self->SUPER::CustomFieldValues($field);
}

+# }}}
+
sub _LookupTypes {
"RT::Queue-RT::Ticket";
}
_______________________________________________
Rt-commit mailing list
Rt-commit@lists.bestpractical.com
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-commit