From 679854b8bbc65d112071111bbd7f34a6a481fb30 Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Tue, 4 Jun 2013 00:21:24 -0700 Subject: RT 4.0.13 --- rt/lib/RT.pm | 63 ++++++- rt/lib/RT/ACE.pm | 5 +- rt/lib/RT/ACL.pm | 2 +- rt/lib/RT/Action.pm | 2 +- rt/lib/RT/Action/AutoOpen.pm | 2 +- rt/lib/RT/Action/Autoreply.pm | 4 +- rt/lib/RT/Action/CreateTickets.pm | 173 ++++++++++---------- rt/lib/RT/Action/EscalatePriority.pm | 3 +- rt/lib/RT/Action/ExtractSubjectTag.pm | 41 ++++- rt/lib/RT/Action/LinearEscalate.pm | 2 +- rt/lib/RT/Action/Notify.pm | 2 +- rt/lib/RT/Action/NotifyAsComment.pm | 2 +- rt/lib/RT/Action/NotifyGroup.pm | 2 +- rt/lib/RT/Action/NotifyGroupAsComment.pm | 2 +- rt/lib/RT/Action/RecordComment.pm | 3 +- rt/lib/RT/Action/RecordCorrespondence.pm | 5 +- rt/lib/RT/Action/SendEmail.pm | 2 +- rt/lib/RT/Action/SetPriority.pm | 3 +- rt/lib/RT/Action/SetStatus.pm | 2 +- rt/lib/RT/Action/UserDefined.pm | 3 +- rt/lib/RT/Approval.pm | 2 +- rt/lib/RT/Approval/Rule.pm | 2 +- rt/lib/RT/Approval/Rule/Created.pm | 2 +- rt/lib/RT/Approval/Rule/NewPending.pm | 2 +- rt/lib/RT/Approval/Rule/Passed.pm | 2 +- rt/lib/RT/Approval/Rule/Rejected.pm | 2 +- rt/lib/RT/Article.pm | 16 +- rt/lib/RT/Articles.pm | 2 +- rt/lib/RT/Attachment.pm | 8 +- rt/lib/RT/Attachments.pm | 2 +- rt/lib/RT/Attribute.pm | 2 +- rt/lib/RT/Attributes.pm | 2 +- rt/lib/RT/Base.pm | 2 +- rt/lib/RT/CachedGroupMember.pm | 2 +- rt/lib/RT/CachedGroupMembers.pm | 2 +- rt/lib/RT/Class.pm | 6 +- rt/lib/RT/Classes.pm | 2 +- rt/lib/RT/Condition.pm | 2 +- rt/lib/RT/Condition/AnyTransaction.pm | 3 +- rt/lib/RT/Condition/BeforeDue.pm | 3 +- rt/lib/RT/Condition/CloseTicket.pm | 2 +- rt/lib/RT/Condition/Overdue.pm | 3 +- rt/lib/RT/Condition/OwnerChange.pm | 3 +- rt/lib/RT/Condition/PriorityChange.pm | 3 +- rt/lib/RT/Condition/PriorityExceeds.pm | 3 +- rt/lib/RT/Condition/QueueChange.pm | 3 +- rt/lib/RT/Condition/ReopenTicket.pm | 2 +- rt/lib/RT/Condition/StatusChange.pm | 3 +- rt/lib/RT/Condition/UserDefined.pm | 3 +- rt/lib/RT/Config.pm | 30 ++-- rt/lib/RT/Crypt/GnuPG.pm | 22 ++- rt/lib/RT/CurrentUser.pm | 11 +- rt/lib/RT/CustomField.pm | 17 +- rt/lib/RT/CustomFieldValue.pm | 2 +- rt/lib/RT/CustomFieldValues.pm | 2 +- rt/lib/RT/CustomFieldValues/External.pm | 4 +- rt/lib/RT/CustomFieldValues/Groups.pm | 2 +- rt/lib/RT/CustomFields.pm | 2 +- rt/lib/RT/Dashboard.pm | 4 +- rt/lib/RT/Dashboard/Mailer.pm | 45 ++++- rt/lib/RT/Dashboards.pm | 3 +- rt/lib/RT/Date.pm | 2 +- rt/lib/RT/EmailParser.pm | 112 ++++++++----- rt/lib/RT/Generated.pm | 4 +- rt/lib/RT/Generated.pm.in | 2 +- rt/lib/RT/Graph/Tickets.pm | 2 +- rt/lib/RT/Group.pm | 9 +- rt/lib/RT/GroupMember.pm | 2 +- rt/lib/RT/GroupMembers.pm | 2 +- rt/lib/RT/Groups.pm | 6 +- rt/lib/RT/Handle.pm | 37 +++-- rt/lib/RT/I18N.pm | 58 +++++-- rt/lib/RT/I18N/cs.pm | 2 +- rt/lib/RT/I18N/i_default.pm | 2 +- rt/lib/RT/I18N/ru.pm | 2 +- rt/lib/RT/Installer.pm | 9 +- rt/lib/RT/Interface/CLI.pm | 5 +- rt/lib/RT/Interface/Email.pm | 45 +++-- rt/lib/RT/Interface/Email/Auth/GnuPG.pm | 2 +- rt/lib/RT/Interface/Email/Auth/MailFrom.pm | 9 +- rt/lib/RT/Interface/REST.pm | 5 +- rt/lib/RT/Interface/Web.pm | 236 ++++++++++++++++++++------- rt/lib/RT/Interface/Web/Handler.pm | 44 ++++- rt/lib/RT/Interface/Web/Menu.pm | 57 ++++++- rt/lib/RT/Interface/Web/QueryBuilder.pm | 2 +- rt/lib/RT/Interface/Web/QueryBuilder/Tree.pm | 2 +- rt/lib/RT/Interface/Web/Request.pm | 23 ++- rt/lib/RT/Interface/Web/Session.pm | 10 +- rt/lib/RT/Lifecycle.pm | 142 ++++++++++++---- rt/lib/RT/Link.pm | 45 ++--- rt/lib/RT/Links.pm | 2 +- rt/lib/RT/ObjectClass.pm | 2 +- rt/lib/RT/ObjectClasses.pm | 2 +- rt/lib/RT/ObjectCustomField.pm | 2 +- rt/lib/RT/ObjectCustomFieldValue.pm | 2 +- rt/lib/RT/ObjectCustomFieldValues.pm | 6 +- rt/lib/RT/ObjectCustomFields.pm | 2 +- rt/lib/RT/ObjectTopic.pm | 15 +- rt/lib/RT/ObjectTopics.pm | 2 +- rt/lib/RT/Plugin.pm | 2 +- rt/lib/RT/Pod/HTML.pm | 104 +++++++++++- rt/lib/RT/Pod/HTMLBatch.pm | 48 ++++++ rt/lib/RT/Pod/Search.pm | 48 ++++++ rt/lib/RT/Principal.pm | 2 +- rt/lib/RT/Principals.pm | 2 +- rt/lib/RT/Queue.pm | 40 +++-- rt/lib/RT/Queues.pm | 2 +- rt/lib/RT/Record.pm | 65 +++++--- rt/lib/RT/Reminders.pm | 12 +- rt/lib/RT/Report/Tickets.pm | 39 +++-- rt/lib/RT/Report/Tickets/Entry.pm | 2 +- rt/lib/RT/Rule.pm | 2 +- rt/lib/RT/Ruleset.pm | 2 +- rt/lib/RT/SQL.pm | 4 +- rt/lib/RT/SavedSearch.pm | 26 ++- rt/lib/RT/SavedSearches.pm | 3 +- rt/lib/RT/Scrip.pm | 10 +- rt/lib/RT/ScripAction.pm | 2 +- rt/lib/RT/ScripActions.pm | 2 +- rt/lib/RT/ScripCondition.pm | 6 +- rt/lib/RT/ScripConditions.pm | 2 +- rt/lib/RT/Scrips.pm | 2 +- rt/lib/RT/Search.pm | 2 +- rt/lib/RT/Search/ActiveTicketsInQueue.pm | 3 +- rt/lib/RT/Search/FromSQL.pm | 3 +- rt/lib/RT/Search/Googleish.pm | 4 +- rt/lib/RT/SearchBuilder.pm | 4 +- rt/lib/RT/SharedSetting.pm | 6 +- rt/lib/RT/SharedSettings.pm | 3 +- rt/lib/RT/Shredder.pm | 4 +- rt/lib/RT/Shredder/ACE.pm | 2 +- rt/lib/RT/Shredder/Attachment.pm | 2 +- rt/lib/RT/Shredder/CachedGroupMember.pm | 2 +- rt/lib/RT/Shredder/Constants.pm | 2 +- rt/lib/RT/Shredder/CustomField.pm | 2 +- rt/lib/RT/Shredder/CustomFieldValue.pm | 2 +- rt/lib/RT/Shredder/Dependencies.pm | 3 +- rt/lib/RT/Shredder/Dependency.pm | 3 +- rt/lib/RT/Shredder/Exceptions.pm | 2 +- rt/lib/RT/Shredder/Group.pm | 2 +- rt/lib/RT/Shredder/GroupMember.pm | 2 +- rt/lib/RT/Shredder/Link.pm | 2 +- rt/lib/RT/Shredder/ObjectCustomFieldValue.pm | 2 +- rt/lib/RT/Shredder/POD.pm | 2 +- rt/lib/RT/Shredder/Plugin.pm | 2 +- rt/lib/RT/Shredder/Plugin/Attachments.pm | 2 +- rt/lib/RT/Shredder/Plugin/Base.pm | 2 +- rt/lib/RT/Shredder/Plugin/Base/Dump.pm | 2 +- rt/lib/RT/Shredder/Plugin/Base/Search.pm | 2 +- rt/lib/RT/Shredder/Plugin/Objects.pm | 2 +- rt/lib/RT/Shredder/Plugin/SQLDump.pm | 2 +- rt/lib/RT/Shredder/Plugin/Summary.pm | 2 +- rt/lib/RT/Shredder/Plugin/Tickets.pm | 2 +- rt/lib/RT/Shredder/Plugin/Users.pm | 2 +- rt/lib/RT/Shredder/Principal.pm | 2 +- rt/lib/RT/Shredder/Queue.pm | 2 +- rt/lib/RT/Shredder/Record.pm | 2 +- rt/lib/RT/Shredder/Scrip.pm | 2 +- rt/lib/RT/Shredder/ScripAction.pm | 2 +- rt/lib/RT/Shredder/ScripCondition.pm | 2 +- rt/lib/RT/Shredder/Template.pm | 2 +- rt/lib/RT/Shredder/Ticket.pm | 2 +- rt/lib/RT/Shredder/Transaction.pm | 2 +- rt/lib/RT/Shredder/User.pm | 2 +- rt/lib/RT/Squish.pm | 2 +- rt/lib/RT/Squish/CSS.pm | 2 +- rt/lib/RT/Squish/JS.pm | 2 +- rt/lib/RT/System.pm | 2 +- rt/lib/RT/Template.pm | 6 +- rt/lib/RT/Templates.pm | 2 +- rt/lib/RT/Test.pm | 110 +++++++++++-- rt/lib/RT/Test/Apache.pm | 2 +- rt/lib/RT/Test/Email.pm | 2 +- rt/lib/RT/Test/GnuPG.pm | 7 +- rt/lib/RT/Test/Web.pm | 2 +- rt/lib/RT/Ticket.pm | 119 +++++++++----- rt/lib/RT/Tickets.pm | 93 ++++++----- rt/lib/RT/Tickets_SQL.pm | 11 +- rt/lib/RT/Topic.pm | 2 +- rt/lib/RT/Topics.pm | 3 +- rt/lib/RT/Transaction.pm | 75 +++++---- rt/lib/RT/Transactions.pm | 2 +- rt/lib/RT/URI.pm | 2 +- rt/lib/RT/URI/a.pm | 2 +- rt/lib/RT/URI/base.pm | 3 +- rt/lib/RT/URI/fsck_com_article.pm | 2 +- rt/lib/RT/URI/fsck_com_rt.pm | 2 +- rt/lib/RT/URI/t.pm | 2 +- rt/lib/RT/User.pm | 63 +++++-- rt/lib/RT/Users.pm | 4 +- rt/lib/RT/Util.pm | 2 +- 191 files changed, 1754 insertions(+), 769 deletions(-) (limited to 'rt/lib') diff --git a/rt/lib/RT.pm b/rt/lib/RT.pm index 4372a564d..da60ef77d 100644 --- a/rt/lib/RT.pm +++ b/rt/lib/RT.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) @@ -83,12 +83,56 @@ RT - Request Tracker =head1 SYNOPSIS -A fully featured request tracker package +A fully featured request tracker package. + +This documentation describes the point-of-entry for RT's Perl API. To learn +more about what RT is and what it can do for you, visit +L. =head1 DESCRIPTION =head2 INITIALIZATION +If you're using RT's Perl libraries, you need to initialize RT before using any +of the modules. + +You have the option of handling the timing of config loading and the actual +init sequence yourself with: + + use RT; + BEGIN { + RT->LoadConfig; + RT->Init; + } + +or you can let RT do it all: + + use RT -init; + +This second method is particular useful when writing one-liners to interact with RT: + + perl -MRT=-init -e '...' + +The first method is necessary if you need to delay or conditionalize +initialization or if you want to fiddle with C<< RT->Config >> between loading +the config files and initializing the RT environment. + +=cut + +{ + my $DID_IMPORT_INIT; + sub import { + my $class = shift; + my $action = shift || ''; + + if ($action eq "-init" and not $DID_IMPORT_INIT) { + $class->LoadConfig; + $class->Init; + $DID_IMPORT_INIT = 1; + } + } +} + =head2 LoadConfig Load RT's config file. First, the site configuration file @@ -316,6 +360,16 @@ sub InitLogging { InitSignalHandlers(%arg); } +{ # Work around bug in Log::Dispatch < 2.30, wherein the short forms + # of ->warn, ->err, and ->crit do not usefully propagate out, unlike + # ->warning, ->error, and ->critical + package Log::Dispatch; + no warnings 'redefine'; + sub warn { shift->warning(@_) } + sub err { shift->error(@_) } + sub crit { shift->critical(@_) } +} + sub InitSignalHandlers { my %arg = @_; @@ -336,6 +390,11 @@ sub InitSignalHandlers { unshift @_, $RT::Logger, qw(level warning message); goto &Log::Dispatch::log; } + # Return value is used only by RT::Test to filter warnings from + # reaching the Test::NoWarnings catcher. If Log::Dispatch::log() ever + # starts returning 'IGNORE', we'll need to switch to something more + # clever. I don't expect that to happen. + return 'IGNORE'; }; #When we call die, trap it and log->crit with the value of the die. diff --git a/rt/lib/RT/ACE.pm b/rt/lib/RT/ACE.pm index ae3eda42b..c752aa2dc 100755 --- a/rt/lib/RT/ACE.pm +++ b/rt/lib/RT/ACE.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) @@ -285,7 +285,8 @@ sub Create { ObjectId => $args{'ObjectId'}, ); if ( $self->Id ) { - return ( 0, $self->loc('That principal already has that right') ); + return ( 0, $self->loc('[_1] already has that right', + $princ_obj->Object->Name) ); } my $id = $self->SUPER::Create( PrincipalId => $princ_obj->id, diff --git a/rt/lib/RT/ACL.pm b/rt/lib/RT/ACL.pm index 49a7f1d64..d1e0df5ad 100755 --- a/rt/lib/RT/ACL.pm +++ b/rt/lib/RT/ACL.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) diff --git a/rt/lib/RT/Action.pm b/rt/lib/RT/Action.pm index 23ff82dec..dc10d0da6 100755 --- a/rt/lib/RT/Action.pm +++ b/rt/lib/RT/Action.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) diff --git a/rt/lib/RT/Action/AutoOpen.pm b/rt/lib/RT/Action/AutoOpen.pm index 5f96e0649..8566c62d5 100644 --- a/rt/lib/RT/Action/AutoOpen.pm +++ b/rt/lib/RT/Action/AutoOpen.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) diff --git a/rt/lib/RT/Action/Autoreply.pm b/rt/lib/RT/Action/Autoreply.pm index cde874e45..89b7536fa 100755 --- a/rt/lib/RT/Action/Autoreply.pm +++ b/rt/lib/RT/Action/Autoreply.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) @@ -87,7 +87,7 @@ sub SetRecipients { =head2 SetReturnAddress -Set this message\'s return address to the apropriate queue address +Set this message's return address to the apropriate queue address =cut diff --git a/rt/lib/RT/Action/CreateTickets.pm b/rt/lib/RT/Action/CreateTickets.pm index efd2bdaf6..80308020f 100644 --- a/rt/lib/RT/Action/CreateTickets.pm +++ b/rt/lib/RT/Action/CreateTickets.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) @@ -56,14 +56,11 @@ use MIME::Entity; =head1 NAME - RT::Action::CreateTickets - -Create one or more tickets according to an externally supplied template. - +RT::Action::CreateTickets - Create one or more tickets according to an externally supplied template =head1 SYNOPSIS - ===Create-Ticket codereview + ===Create-Ticket: codereview Subject: Code review for {$Tickets{'TOP'}->Subject} Depended-On-By: TOP Content: Someone has created a ticket. you should review and approve it, @@ -72,18 +69,14 @@ Create one or more tickets according to an externally supplied template. =head1 DESCRIPTION +The CreateTickets ScripAction allows you to create automated workflows in RT, +creating new tickets in response to actions and conditions from other +tickets. -Using the "CreateTickets" ScripAction and mandatory dependencies, RT now has -the ability to model complex workflow. When a ticket is created in a queue -that has a "CreateTickets" scripaction, that ScripAction parses its "Template" - - - -=head2 FORMAT - -CreateTickets uses the template as a template for an ordered set of tickets -to create. The basic format is as follows: +=head2 Format +CreateTickets uses the RT template configured in the scrip as a template +for an ordered set of tickets to create. The basic format is as follows: ===Create-Ticket: identifier Param: Value @@ -98,19 +91,24 @@ to create. The basic format is as follows: Content: Blah ENDOFCONTENT - -Each ===Create-Ticket: section is evaluated as its own -Text::Template object, which means that you can embed snippets -of perl inside the Text::Template using {} delimiters, but that -such sections absolutely can not span a ===Create-Ticket boundary. - -After each ticket is created, it's stuffed into a hash called %Tickets -so as to be available during the creation of other tickets during the -same ScripAction, using the key 'create-identifier', where -C is the id you put after C<===Create-Ticket:>. The hash +As shown, you can put one or more C<===Create-Ticket:> sections in +a template. Each C<===Create-Ticket:> section is evaluated as its own +L object, which means that you can embed snippets +of Perl inside the L using C<{}> delimiters, but that +such sections absolutely can not span a C<===Create-Ticket:> boundary. + +Note that each C must come right after the C on the same +line. The C param can extend over multiple lines, but the text +of the first line must start right after C. Don't try to start +your C section with a newline. + +After each ticket is created, it's stuffed into a hash called C<%Tickets> +making it available during the creation of other tickets during the +same ScripAction. The hash key for each ticket is C, +where C<[identifier]> is the value you put after C<===Create-Ticket:>. The hash is prepopulated with the ticket which triggered the ScripAction as -$Tickets{'TOP'}; you can also access that ticket using the shorthand -TOP. +C<$Tickets{'TOP'}>. You can also access that ticket using the shorthand +C. A simple example: @@ -121,22 +119,20 @@ A simple example: so they can finish their work ENDOFCONTENT - - -A convoluted example +A convoluted example: ===Create-Ticket: approval { # Find out who the administrators of the group called "HR" # of which the creator of this ticket is a member my $name = "HR"; - + my $groups = RT::Groups->new(RT->SystemUser); $groups->LimitToUserDefinedGroups(); $groups->Limit(FIELD => "Name", OPERATOR => "=", VALUE => "$name"); $groups->WithMember($TransactionObj->CreatorObj->Id); - + my $groupid = $groups->First->Id; - + my $adminccs = RT::Users->new(RT->SystemUser); $adminccs->WhoHaveRight( Right => "AdminGroup", @@ -145,10 +141,10 @@ A convoluted example IncludeSuperusers => 0, IncludeSubgroupMembers => 0, ); - - my @admins; + + our @admins; while (my $admin = $adminccs->Next) { - push (@admins, $admin->EmailAddress); + push (@admins, $admin->EmailAddress); } } Queue: ___Approvals @@ -170,50 +166,51 @@ A convoluted example Refers-To: {$Tickets{"create-approval"}->Id} Queue: ___Approvals Content-Type: text/plain - Content: - Your approval is requred for this ticket, too. + Content: Your approval is requred for this ticket, too. ENDOFCONTENT - -=head2 Acceptable fields -A complete list of acceptable fields for this beastie: +As shown above, you can include a block with Perl code to set up some +values for the new tickets. If you want to access a variable in the +template section after the block, you must scope it with C rather +than C. Just as with other RT templates, you can also include +Perl code in the template sections using C<{}>. +=head2 Acceptable Fields + +A complete list of acceptable fields: * Queue => Name or id# of a queue Subject => A text string - ! Status => A valid status. defaults to 'new' + ! 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 + Starts => + Started => + Resolved => + Owner => Username or id of an RT user who can and should own this ticket; forces the owner if necessary + Requestor => Email address - + Cc => Email address - + AdminCc => Email address + + Cc => Email address + + AdminCc => Email address + RequestorGroup => Group name + CcGroup => Group name + AdminCcGroup => Group name - TimeWorked => - TimeEstimated => - TimeLeft => - InitialPriority => - FinalPriority => - Type => - +! DependsOn => + TimeWorked => + TimeEstimated => + TimeLeft => + InitialPriority => + FinalPriority => + Type => + +! DependsOn => +! DependedOnBy => +! RefersTo => - +! ReferredToBy => + +! ReferredToBy => +! Members => - +! MemberOf => - Content => content. Can extend to multiple lines. Everything + +! 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 + as content until we hit a line containing only ENDOFCONTENT ContentType => the content-type of the Content field. Defaults to 'text/plain' @@ -225,31 +222,22 @@ A complete list of acceptable fields for this beastie: CF-name => custom field value CustomField-name => custom field value -Fields marked with an * are required. +Fields marked with an C<*> are required. -Fields marked with a + may have multiple values, simply +Fields marked with a C<+> may have multiple values, simply by repeating the fieldname on a new line with an additional value. -Fields marked with a ! are postponed to be processed after all -tickets in the same actions are created. Except for 'Status', those -field can also take a ticket name within the same action (i.e. -the identifiers after ===Create-Ticket), instead of raw Ticket ID +Fields marked with a C have processing postponed until after all +tickets in the same actions are created. Except for C, those +fields can also take a ticket name within the same action (i.e. +the identifiers after C<===Create-Ticket:>), instead of raw ticket ID numbers. -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. - - +When parsed, field names are converted to lowercase and have hyphens stripped. +C, C, C, C and C will +all be treated as the same thing. - -=head1 AUTHOR - -Jesse Vincent - -=head1 SEE ALSO - -perl(1). +=head1 METHODS =cut @@ -537,12 +525,16 @@ sub UpdateByTemplate { return @results; } -=head2 Parse TEMPLATE_CONTENT, DEFAULT_QUEUE, DEFAULT_REQEUESTOR ACTIVE +=head2 Parse + +Takes (in order) template content, a default queue, a default requestor, and +active (a boolean flag). -Parse a template from TEMPLATE_CONTENT +Parses a template in the template content, defaulting queue and requestor if +unspecified in the template to the values provided as arguments. -If $active is set to true, then we'll use Text::Template to parse the templates, -allowing you to embed active perl in your templates. +If the active flag is true, then we'll use L to parse the +templates, allowing you to embed active Perl in your templates. =cut @@ -576,9 +568,9 @@ sub Parse { Parses mulitline templates. Things like: - ===Create-Ticket ... + ===Create-Ticket: ... -Takes the same arguments as Parse +Takes the same arguments as L. =cut @@ -834,9 +826,10 @@ sub ParseLines { } -=head2 _ParseXSVTemplate +=head2 _ParseXSVTemplate -Parses a tab or comma delimited template. Should only ever be called by Parse +Parses a tab or comma delimited template. Should only ever be called by +L. =cut diff --git a/rt/lib/RT/Action/EscalatePriority.pm b/rt/lib/RT/Action/EscalatePriority.pm index cb19b4f41..1300b4fe3 100644 --- a/rt/lib/RT/Action/EscalatePriority.pm +++ b/rt/lib/RT/Action/EscalatePriority.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) @@ -78,6 +78,7 @@ package RT::Action::EscalatePriority; use base 'RT::Action'; use strict; +use warnings; #Do what we need to do and send it out. diff --git a/rt/lib/RT/Action/ExtractSubjectTag.pm b/rt/lib/RT/Action/ExtractSubjectTag.pm index a4d6458cb..6a3898e74 100644 --- a/rt/lib/RT/Action/ExtractSubjectTag.pm +++ b/rt/lib/RT/Action/ExtractSubjectTag.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) @@ -46,9 +46,48 @@ # # END BPS TAGGED BLOCK }}} +=head1 NAME + + RT::Action::ExtractSubjectTag + +=head1 DESCRIPTION + +ExtractSubjectTag is a ScripAction which allows ticket bonding between +two RT instances or between RT and other Ticket systems like Siebel +or Remedy. + +By default this ScripAction is set up to run on every transaction on +every Correspondence. + +One can configure this ScripActions behaviour by changing the +global C<$ExtractSubjectTagMatch> in C. + +If a transaction's subject matches this regexp, we append the match +tag to the ticket's current subject. This helps ensure that +further communication on the ticket will include the remote +system's subject tag. + +If you modify this code, be careful not to remove the code where it +ensures that it only examines remote systems' tags. + +=head1 EXAMPLE + +As an example, Siebel will set their subject tag to something +like: + + B<[SR ID:1-554]> + +To record this tag in the local ticket's subject, we need to change +ExtractSubjectTagMatch to something like: + + Set($ExtractSubjectTagMatch, qr/\[[^\]]+[#:][0-9-]+\]/); + +=cut + package RT::Action::ExtractSubjectTag; use base 'RT::Action'; use strict; +use warnings; sub Describe { my $self = shift; diff --git a/rt/lib/RT/Action/LinearEscalate.pm b/rt/lib/RT/Action/LinearEscalate.pm index 0a0825e82..13913e6cd 100755 --- a/rt/lib/RT/Action/LinearEscalate.pm +++ b/rt/lib/RT/Action/LinearEscalate.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) diff --git a/rt/lib/RT/Action/Notify.pm b/rt/lib/RT/Action/Notify.pm index f1aef4092..3553cbc39 100755 --- a/rt/lib/RT/Action/Notify.pm +++ b/rt/lib/RT/Action/Notify.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) diff --git a/rt/lib/RT/Action/NotifyAsComment.pm b/rt/lib/RT/Action/NotifyAsComment.pm index b62f55599..0016a364a 100755 --- a/rt/lib/RT/Action/NotifyAsComment.pm +++ b/rt/lib/RT/Action/NotifyAsComment.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) diff --git a/rt/lib/RT/Action/NotifyGroup.pm b/rt/lib/RT/Action/NotifyGroup.pm index 5e7076f39..1dece60a3 100644 --- a/rt/lib/RT/Action/NotifyGroup.pm +++ b/rt/lib/RT/Action/NotifyGroup.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) diff --git a/rt/lib/RT/Action/NotifyGroupAsComment.pm b/rt/lib/RT/Action/NotifyGroupAsComment.pm index 151189033..cf6952aff 100644 --- a/rt/lib/RT/Action/NotifyGroupAsComment.pm +++ b/rt/lib/RT/Action/NotifyGroupAsComment.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) diff --git a/rt/lib/RT/Action/RecordComment.pm b/rt/lib/RT/Action/RecordComment.pm index 62832a5f4..a384af347 100644 --- a/rt/lib/RT/Action/RecordComment.pm +++ b/rt/lib/RT/Action/RecordComment.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) @@ -49,6 +49,7 @@ package RT::Action::RecordComment; use base 'RT::Action'; use strict; +use warnings; =head1 NAME diff --git a/rt/lib/RT/Action/RecordCorrespondence.pm b/rt/lib/RT/Action/RecordCorrespondence.pm index 2faa56019..cc21503de 100644 --- a/rt/lib/RT/Action/RecordCorrespondence.pm +++ b/rt/lib/RT/Action/RecordCorrespondence.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) @@ -49,12 +49,13 @@ package RT::Action::RecordCorrespondence; use base 'RT::Action'; use strict; +use warnings; =head1 NAME RT::Action::RecordCorrespondence - An Action which can be used from an external tool, or in any situation where a ticket transaction has not -been started, to make a comment on the ticket. +been started, to create a correspondence on the ticket. =head1 SYNOPSIS diff --git a/rt/lib/RT/Action/SendEmail.pm b/rt/lib/RT/Action/SendEmail.pm index 1e6607eb4..0a52904dd 100755 --- a/rt/lib/RT/Action/SendEmail.pm +++ b/rt/lib/RT/Action/SendEmail.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) diff --git a/rt/lib/RT/Action/SetPriority.pm b/rt/lib/RT/Action/SetPriority.pm index 783d57dd8..2043532f7 100644 --- a/rt/lib/RT/Action/SetPriority.pm +++ b/rt/lib/RT/Action/SetPriority.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) @@ -50,6 +50,7 @@ package RT::Action::SetPriority; use base 'RT::Action'; use strict; +use warnings; #Do what we need to do and send it out. diff --git a/rt/lib/RT/Action/SetStatus.pm b/rt/lib/RT/Action/SetStatus.pm index f52d401cc..be00396ce 100644 --- a/rt/lib/RT/Action/SetStatus.pm +++ b/rt/lib/RT/Action/SetStatus.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) diff --git a/rt/lib/RT/Action/UserDefined.pm b/rt/lib/RT/Action/UserDefined.pm index 1bad2bedd..b259323d7 100644 --- a/rt/lib/RT/Action/UserDefined.pm +++ b/rt/lib/RT/Action/UserDefined.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) @@ -50,6 +50,7 @@ package RT::Action::UserDefined; use base 'RT::Action'; use strict; +use warnings; =head2 Prepare diff --git a/rt/lib/RT/Approval.pm b/rt/lib/RT/Approval.pm index 6a519c1f7..dc60222a8 100644 --- a/rt/lib/RT/Approval.pm +++ b/rt/lib/RT/Approval.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) diff --git a/rt/lib/RT/Approval/Rule.pm b/rt/lib/RT/Approval/Rule.pm index 85526c1d8..6892f41ec 100644 --- a/rt/lib/RT/Approval/Rule.pm +++ b/rt/lib/RT/Approval/Rule.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) diff --git a/rt/lib/RT/Approval/Rule/Created.pm b/rt/lib/RT/Approval/Rule/Created.pm index cd4519c2e..8fcaeb273 100644 --- a/rt/lib/RT/Approval/Rule/Created.pm +++ b/rt/lib/RT/Approval/Rule/Created.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) diff --git a/rt/lib/RT/Approval/Rule/NewPending.pm b/rt/lib/RT/Approval/Rule/NewPending.pm index d2ba3ac4e..97d3cfbb5 100644 --- a/rt/lib/RT/Approval/Rule/NewPending.pm +++ b/rt/lib/RT/Approval/Rule/NewPending.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) diff --git a/rt/lib/RT/Approval/Rule/Passed.pm b/rt/lib/RT/Approval/Rule/Passed.pm index 000a8dc62..acc49161f 100644 --- a/rt/lib/RT/Approval/Rule/Passed.pm +++ b/rt/lib/RT/Approval/Rule/Passed.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) diff --git a/rt/lib/RT/Approval/Rule/Rejected.pm b/rt/lib/RT/Approval/Rule/Rejected.pm index b22df5c2d..0a025684f 100644 --- a/rt/lib/RT/Approval/Rule/Rejected.pm +++ b/rt/lib/RT/Approval/Rule/Rejected.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) diff --git a/rt/lib/RT/Article.pm b/rt/lib/RT/Article.pm index 678aa1177..ec1ae3cae 100644 --- a/rt/lib/RT/Article.pm +++ b/rt/lib/RT/Article.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) @@ -399,9 +399,8 @@ sub AddLink { # Check that we're actually getting a valid URI my $uri_obj = RT::URI->new( $self->CurrentUser ); - $uri_obj->FromURI( $args{'Target'}||$args{'Base'} ); - unless ( $uri_obj->Resolver && $uri_obj->Scheme ) { - my $msg = $self->loc( "Couldn't resolve '[_1]' into a Link.", $args{'Target'} ); + unless ( $uri_obj->FromURI( $args{'Target'}||$args{'Base'} )) { + my $msg = $self->loc( "Couldn't resolve '[_1]' into a Link.", $args{'Target'} || $args{'Base'} ); $RT::Logger->warning( $msg ); return( 0, $msg ); } @@ -611,15 +610,6 @@ sub CustomFieldLookupType { "RT::Class-RT::Article"; } -# _LookupId is the id of the toplevel type object the customfield is joined to -# in this case, that's an RT::Class. - -sub _LookupId { - my $self = shift; - return $self->ClassObj->id; - -} - =head2 LoadByInclude Field Value Takes the name of a form field from "Include Article" diff --git a/rt/lib/RT/Articles.pm b/rt/lib/RT/Articles.pm index 47d0ebea2..d69eabf82 100644 --- a/rt/lib/RT/Articles.pm +++ b/rt/lib/RT/Articles.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) diff --git a/rt/lib/RT/Attachment.pm b/rt/lib/RT/Attachment.pm index f1d9a6342..54217b32b 100755 --- a/rt/lib/RT/Attachment.pm +++ b/rt/lib/RT/Attachment.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) @@ -266,7 +266,7 @@ sub ParentObj { =head2 Children Returns an L object which is preloaded with -all attachments objects with this attachment\'s Id as their +all attachments objects with this attachment's Id as their C. =cut @@ -499,12 +499,14 @@ L objects. =cut +our @ADDRESS_HEADERS = qw(From To Cc Bcc RT-Send-Cc RT-Send-Bcc); + sub Addresses { my $self = shift; my %data = (); my $current_user_address = lc $self->CurrentUser->EmailAddress; - foreach my $hdr (qw(From To Cc Bcc RT-Send-Cc RT-Send-Bcc)) { + foreach my $hdr (@ADDRESS_HEADERS) { my @Addresses; my $line = $self->GetHeader($hdr); diff --git a/rt/lib/RT/Attachments.pm b/rt/lib/RT/Attachments.pm index 2bdbc244c..5b087a493 100755 --- a/rt/lib/RT/Attachments.pm +++ b/rt/lib/RT/Attachments.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) diff --git a/rt/lib/RT/Attribute.pm b/rt/lib/RT/Attribute.pm index cd0b54e33..10971a279 100644 --- a/rt/lib/RT/Attribute.pm +++ b/rt/lib/RT/Attribute.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) diff --git a/rt/lib/RT/Attributes.pm b/rt/lib/RT/Attributes.pm index fcbd0b1b4..9c18c1a0f 100644 --- a/rt/lib/RT/Attributes.pm +++ b/rt/lib/RT/Attributes.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) diff --git a/rt/lib/RT/Base.pm b/rt/lib/RT/Base.pm index 2aae60e9e..403c318b4 100644 --- a/rt/lib/RT/Base.pm +++ b/rt/lib/RT/Base.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) diff --git a/rt/lib/RT/CachedGroupMember.pm b/rt/lib/RT/CachedGroupMember.pm index 4c05852de..b334d4d6c 100644 --- a/rt/lib/RT/CachedGroupMember.pm +++ b/rt/lib/RT/CachedGroupMember.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) diff --git a/rt/lib/RT/CachedGroupMembers.pm b/rt/lib/RT/CachedGroupMembers.pm index f76fc5dac..4d8f356fb 100644 --- a/rt/lib/RT/CachedGroupMembers.pm +++ b/rt/lib/RT/CachedGroupMembers.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) diff --git a/rt/lib/RT/Class.pm b/rt/lib/RT/Class.pm index 3906b9fed..dfe8eb386 100644 --- a/rt/lib/RT/Class.pm +++ b/rt/lib/RT/Class.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) @@ -94,7 +94,7 @@ $RIGHTS = { AdminClass => 'Modify metadata and custom fields for this class', #loc_pair AdminTopics => 'Modify topic hierarchy associated with this class', #loc_pair ShowACL => 'Display Access Control List', #loc_pair - ModifyACL => 'Modify Access Control List', #loc_pair + ModifyACL => 'Create, modify and delete Access Control List entries', #loc_pair DeleteArticle => 'Delete articles in this class', #loc_pair }; @@ -218,7 +218,7 @@ sub ValidateName { return undef unless ($newval); my $obj = RT::Class->new($RT::SystemUser); $obj->Load($newval); - return undef if ( $obj->Id ); + return undef if $obj->id && ( !$self->id || $self->id != $obj->id ); return $self->SUPER::ValidateName($newval); } diff --git a/rt/lib/RT/Classes.pm b/rt/lib/RT/Classes.pm index 37dc411e8..60122c7eb 100644 --- a/rt/lib/RT/Classes.pm +++ b/rt/lib/RT/Classes.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) diff --git a/rt/lib/RT/Condition.pm b/rt/lib/RT/Condition.pm index f50d64d51..07518151f 100755 --- a/rt/lib/RT/Condition.pm +++ b/rt/lib/RT/Condition.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) diff --git a/rt/lib/RT/Condition/AnyTransaction.pm b/rt/lib/RT/Condition/AnyTransaction.pm index 73eea2b9e..2c9129c0f 100644 --- a/rt/lib/RT/Condition/AnyTransaction.pm +++ b/rt/lib/RT/Condition/AnyTransaction.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) @@ -50,6 +50,7 @@ package RT::Condition::AnyTransaction; use base 'RT::Condition'; use strict; +use warnings; =head2 IsApplicable diff --git a/rt/lib/RT/Condition/BeforeDue.pm b/rt/lib/RT/Condition/BeforeDue.pm index 11c40e6f5..8df73cacd 100644 --- a/rt/lib/RT/Condition/BeforeDue.pm +++ b/rt/lib/RT/Condition/BeforeDue.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) @@ -52,6 +52,7 @@ use base 'RT::Condition'; use RT::Date; use strict; +use warnings; sub IsApplicable { my $self = shift; diff --git a/rt/lib/RT/Condition/CloseTicket.pm b/rt/lib/RT/Condition/CloseTicket.pm index 60d5bbe26..bdeaf2d5d 100644 --- a/rt/lib/RT/Condition/CloseTicket.pm +++ b/rt/lib/RT/Condition/CloseTicket.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) diff --git a/rt/lib/RT/Condition/Overdue.pm b/rt/lib/RT/Condition/Overdue.pm index 3bf79a117..547aea25b 100644 --- a/rt/lib/RT/Condition/Overdue.pm +++ b/rt/lib/RT/Condition/Overdue.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) @@ -59,6 +59,7 @@ Returns true if the ticket we're operating on is overdue package RT::Condition::Overdue; use base 'RT::Condition'; use strict; +use warnings; =head2 IsApplicable diff --git a/rt/lib/RT/Condition/OwnerChange.pm b/rt/lib/RT/Condition/OwnerChange.pm index 4643791e3..85005482c 100644 --- a/rt/lib/RT/Condition/OwnerChange.pm +++ b/rt/lib/RT/Condition/OwnerChange.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) @@ -49,6 +49,7 @@ package RT::Condition::OwnerChange; use base 'RT::Condition'; use strict; +use warnings; =head2 IsApplicable diff --git a/rt/lib/RT/Condition/PriorityChange.pm b/rt/lib/RT/Condition/PriorityChange.pm index aa00e609d..a600453a3 100644 --- a/rt/lib/RT/Condition/PriorityChange.pm +++ b/rt/lib/RT/Condition/PriorityChange.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) @@ -49,6 +49,7 @@ package RT::Condition::PriorityChange; use base 'RT::Condition'; use strict; +use warnings; =head2 IsApplicable diff --git a/rt/lib/RT/Condition/PriorityExceeds.pm b/rt/lib/RT/Condition/PriorityExceeds.pm index 17943cf51..a28d6df15 100644 --- a/rt/lib/RT/Condition/PriorityExceeds.pm +++ b/rt/lib/RT/Condition/PriorityExceeds.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) @@ -49,6 +49,7 @@ package RT::Condition::PriorityExceeds; use base 'RT::Condition'; use strict; +use warnings; =head2 IsApplicable diff --git a/rt/lib/RT/Condition/QueueChange.pm b/rt/lib/RT/Condition/QueueChange.pm index 69eea18d8..ba7a8a495 100644 --- a/rt/lib/RT/Condition/QueueChange.pm +++ b/rt/lib/RT/Condition/QueueChange.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) @@ -49,6 +49,7 @@ package RT::Condition::QueueChange; use base 'RT::Condition'; use strict; +use warnings; =head2 IsApplicable diff --git a/rt/lib/RT/Condition/ReopenTicket.pm b/rt/lib/RT/Condition/ReopenTicket.pm index 70722218f..a057e401d 100644 --- a/rt/lib/RT/Condition/ReopenTicket.pm +++ b/rt/lib/RT/Condition/ReopenTicket.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) diff --git a/rt/lib/RT/Condition/StatusChange.pm b/rt/lib/RT/Condition/StatusChange.pm index 10d882e8f..e84915d19 100644 --- a/rt/lib/RT/Condition/StatusChange.pm +++ b/rt/lib/RT/Condition/StatusChange.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) @@ -49,6 +49,7 @@ package RT::Condition::StatusChange; use base 'RT::Condition'; use strict; +use warnings; =head2 DESCRIPTION diff --git a/rt/lib/RT/Condition/UserDefined.pm b/rt/lib/RT/Condition/UserDefined.pm index 8ed5e5c15..1abee67f2 100644 --- a/rt/lib/RT/Condition/UserDefined.pm +++ b/rt/lib/RT/Condition/UserDefined.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) @@ -49,6 +49,7 @@ package RT::Condition::UserDefined; use base 'RT::Condition'; use strict; +use warnings; =head2 IsApplicable diff --git a/rt/lib/RT/Config.pm b/rt/lib/RT/Config.pm index 014c76468..0c04b9191 100644 --- a/rt/lib/RT/Config.pm +++ b/rt/lib/RT/Config.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) @@ -303,15 +303,6 @@ our %META = ( }, # User overridable options for RT at a glance - DefaultSummaryRows => { - Section => 'RT at a glance', #loc - Overridable => 1, - SortOrder => 1, - Widget => '/Widgets/Form/Integer', - WidgetArguments => { - Description => 'Number of search results', #loc - }, - }, HomePageRefreshInterval => { Section => 'RT at a glance', #loc Overridable => 1, @@ -446,10 +437,13 @@ our %META = ( Description => 'Date format', #loc Callback => sub { my $ret = { Values => [], ValuesLabel => {}}; my $date = RT::Date->new($HTML::Mason::Commands::session{'CurrentUser'}); - $date->Set; + $date->SetToNow; foreach my $value ($date->Formatters) { push @{$ret->{Values}}, $value; - $ret->{ValuesLabel}{$value} = $date->$value(); + $ret->{ValuesLabel}{$value} = $date->Get( + Format => $value, + Timezone => 'user', + ); } return $ret; }, @@ -1215,7 +1209,7 @@ sub SetFromConfig { # if the entry has a trailing '::' then # it is a link to another name space if ( substr( $k, -2 ) eq '::') { - $name = $self->__GetNameByRef( $ref, $k ); + $name = $self->__GetNameByRef( $ref, $pack eq 'main::'? $k : $pack.$k ); return $name if $name; } @@ -1230,13 +1224,19 @@ sub SetFromConfig { # Otherwie 5.10 goes boom. maybe we should skip any # reference next if ref($entry) eq 'SCALAR' || ref($entry) eq 'REF'; - my $entry_ref = *{$entry}{ ref($ref) }; + + my $ref_type = ref($ref); + + # regex/arrayref/hashref/coderef are stored in SCALAR glob + $ref_type = 'SCALAR' if $ref_type eq 'REF'; + + my $entry_ref = *{$entry}{ $ref_type }; next unless $entry_ref; # if references are equal then we've found if ( $entry_ref == $ref ) { $last_pack = $pack; - return ( $REF_SYMBOLS{ ref($ref) } || '*' ) . $pack . $k; + return ( $REF_SYMBOLS{ $ref_type } || '*' ) . $pack . $k; } } return ''; diff --git a/rt/lib/RT/Crypt/GnuPG.pm b/rt/lib/RT/Crypt/GnuPG.pm index 233047820..6164a4241 100644 --- a/rt/lib/RT/Crypt/GnuPG.pm +++ b/rt/lib/RT/Crypt/GnuPG.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) @@ -905,11 +905,25 @@ sub FindProtectedParts { # sense) unnecessarily applies a base64 transfer encoding to PGP # mail (whose content is already base64-encoded). if ( $entity->bodyhandle->is_encoded and $entity->head->mime_encoding ) { - pipe( my ($read_decoded, $write_decoded) ); my $decoder = MIME::Decoder->new( $entity->head->mime_encoding ); if ($decoder) { - eval { $decoder->decode($io, $write_decoded) }; - $io = $read_decoded; + local $@; + eval { + my $buf = ''; + open my $fh, '>', \$buf + or die "Couldn't open scalar for writing: $!"; + binmode $fh, ":raw"; + $decoder->decode($io, $fh); + close $fh or die "Couldn't close scalar: $!"; + + open $fh, '<', \$buf + or die "Couldn't re-open scalar for reading: $!"; + binmode $fh, ":raw"; + $io = $fh; + 1; + } or do { + $RT::Logger->error("Couldn't decode body: $@"); + } } } diff --git a/rt/lib/RT/CurrentUser.pm b/rt/lib/RT/CurrentUser.pm index 7d24779bf..fa0d4ca7a 100755 --- a/rt/lib/RT/CurrentUser.pm +++ b/rt/lib/RT/CurrentUser.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) @@ -240,9 +240,12 @@ sub loc { my $handle = $self->LanguageHandle; if (@_ == 1) { - # pre-scan the lexicon hashes to return _AUTO keys verbatim, - # to keep locstrings containing '[' and '~' from tripping over Maketext - return $_[0] unless grep exists $_->{$_[0]}, @{ $handle->_lex_refs }; + # If we have no [_1] replacements, and the key does not appear + # in the lexicon, unescape (using ~) and return it verbatim, as + # an optimization. + my $unescaped = $_[0]; + $unescaped =~ s!~(.)!$1!g; + return $unescaped unless grep exists $_->{$_[0]}, @{ $handle->_lex_refs }; } return $handle->maketext(@_); diff --git a/rt/lib/RT/CustomField.pm b/rt/lib/RT/CustomField.pm index 8d16c1fe1..01b4970c4 100644 --- a/rt/lib/RT/CustomField.pm +++ b/rt/lib/RT/CustomField.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) @@ -710,7 +710,7 @@ sub ValidateValuesClass { my $self = shift; my $class = shift; - return 1 if !defined $class || $class eq 'RT::CustomFieldValues'; + return 1 if !$class || $class eq 'RT::CustomFieldValues'; return 1 if grep $class eq $_, RT->Config->Get('CustomFieldValuesSources'); return undef; } @@ -1556,9 +1556,8 @@ sub _CanonicalizeValueDate { my $DateObj = RT::Date->new( $self->CurrentUser ); $DateObj->Set( Format => 'unknown', Value => $args->{'Content'}, - Timezone => 'UTC', ); - $args->{'Content'} = $DateObj->Date( Timezone => 'UTC' ); + $args->{'Content'} = $DateObj->Date( Timezone => 'user' ); } =head2 MatchPattern STRING @@ -1666,14 +1665,13 @@ sub ValuesForObject { my $object = shift; my $values = RT::ObjectCustomFieldValues->new($self->CurrentUser); - unless ($self->CurrentUserHasRight('SeeCustomField')) { + unless ($self->id and $self->CurrentUserHasRight('SeeCustomField')) { # Return an empty object if they have no rights to see + $values->Limit( FIELD => "id", VALUE => 0, SUBCLAUSE => "ACL" ); return ($values); } - - + $values->LimitToCustomField($self->Id); - $values->LimitToEnabled(); $values->LimitToObject($object); return ($values); @@ -1690,6 +1688,7 @@ Examples: 'RT::Queue-RT::Ticket-RT::Transaction' => "Ticket Transactions", # loc 'RT::User' => "Users", # loc 'RT::Group' => "Groups", # loc + 'RT::Queue' => "Queues", # loc This is a class method. @@ -2103,6 +2102,8 @@ sub _CoreAccessible { {read => 1, write => 1, sql_type => -4, length => 0, is_blob => 1, is_numeric => 0, type => 'text', default => ''}, Repeated => {read => 1, write => 1, sql_type => 5, length => 6, is_blob => 0, is_numeric => 1, type => 'smallint(6)', default => '0'}, + ValuesClass => + {read => 1, write => 1, sql_type => 12, length => 64, is_blob => 0, is_numeric => 0, type => 'varchar(64)', default => ''}, BasedOn => {read => 1, write => 1, sql_type => 4, length => 11, is_blob => 0, is_numeric => 1, type => 'int(11)', default => ''}, Description => diff --git a/rt/lib/RT/CustomFieldValue.pm b/rt/lib/RT/CustomFieldValue.pm index 26df55ae4..6dffc3455 100644 --- a/rt/lib/RT/CustomFieldValue.pm +++ b/rt/lib/RT/CustomFieldValue.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) diff --git a/rt/lib/RT/CustomFieldValues.pm b/rt/lib/RT/CustomFieldValues.pm index 90a163702..e3380b7e5 100644 --- a/rt/lib/RT/CustomFieldValues.pm +++ b/rt/lib/RT/CustomFieldValues.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) diff --git a/rt/lib/RT/CustomFieldValues/External.pm b/rt/lib/RT/CustomFieldValues/External.pm index 61125146f..e6bf2f87d 100644 --- a/rt/lib/RT/CustomFieldValues/External.pm +++ b/rt/lib/RT/CustomFieldValues/External.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) @@ -82,7 +82,7 @@ C. =head1 SEE ALSO -L +F =cut diff --git a/rt/lib/RT/CustomFieldValues/Groups.pm b/rt/lib/RT/CustomFieldValues/Groups.pm index 2519e2917..feeeadbd7 100644 --- a/rt/lib/RT/CustomFieldValues/Groups.pm +++ b/rt/lib/RT/CustomFieldValues/Groups.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) diff --git a/rt/lib/RT/CustomFields.pm b/rt/lib/RT/CustomFields.pm index d4a5bc740..017018ef4 100644 --- a/rt/lib/RT/CustomFields.pm +++ b/rt/lib/RT/CustomFields.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) diff --git a/rt/lib/RT/Dashboard.pm b/rt/lib/RT/Dashboard.pm index 2e2bbc489..349864e12 100644 --- a/rt/lib/RT/Dashboard.pm +++ b/rt/lib/RT/Dashboard.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) @@ -109,7 +109,7 @@ An object of this class is called "dashboard" =cut -sub ObjectName { "dashboard" } +sub ObjectName { "dashboard" } # loc sub SaveAttribute { my $self = shift; diff --git a/rt/lib/RT/Dashboard/Mailer.pm b/rt/lib/RT/Dashboard/Mailer.pm index 40b53b111..9d28c4942 100644 --- a/rt/lib/RT/Dashboard/Mailer.pm +++ b/rt/lib/RT/Dashboard/Mailer.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) @@ -59,6 +59,7 @@ use RT::Dashboard; use RT::Interface::Web::Handler; use RT::Interface::Web; use File::Temp 'tempdir'; +use HTML::Scrubber; sub MailDashboards { my $self = shift; @@ -248,6 +249,8 @@ SUMMARY } } + $content = ScrubContent($content); + $RT::Logger->debug("Got ".length($content)." characters of output."); $content = HTML::RewriteAttributes::Links->rewrite( @@ -393,7 +396,7 @@ sub BuildEmail { Type => $mimetype, Encoding => $encoding, Disposition => 'inline', - Name => $filename, + Name => RT::Interface::Email::EncodeToMIME( String => $filename ), 'Content-Id' => $cid_of{$uri}, ); @@ -408,9 +411,9 @@ sub BuildEmail { ); my $entity = MIME::Entity->build( - From => $args{From}, - To => $args{To}, - Subject => $args{Subject}, + From => Encode::encode_utf8($args{From}), + To => Encode::encode_utf8($args{To}), + Subject => RT::Interface::Email::EncodeToMIME( String => $args{Subject} ), Type => "multipart/mixed", ); @@ -462,6 +465,33 @@ sub BuildEmail { } } +{ + my $scrubber; + + sub _scrubber { + unless ($scrubber) { + $scrubber = HTML::Scrubber->new; + # Allow everything by default, except JS attributes ... + $scrubber->default( + 1 => { + '*' => 1, + map { ("on$_" => 0) } + qw(blur change click dblclick error focus keydown keypress keyup load + mousedown mousemove mouseout mouseover mouseup reset select submit unload) + } + ); + # ... and