# BEGIN BPS TAGGED BLOCK {{{
-#
+#
# COPYRIGHT:
-#
-# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC
-# <jesse@bestpractical.com>
-#
+#
+# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC
+# <sales@bestpractical.com>
+#
# (Except where explicitly superseded by other copyright notices)
-#
-#
+#
+#
# LICENSE:
-#
+#
# This work is made available to you under the terms of Version 2 of
# the GNU General Public License. A copy of that license should have
# been provided with this software, but in any event can be snarfed
# from www.gnu.org.
-#
+#
# This work is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 or visit their web page on the internet at
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
-#
-#
+#
+#
# CONTRIBUTION SUBMISSION POLICY:
-#
+#
# (The following paragraph is not intended to limit the rights granted
# to you to modify and distribute this software under the terms of
# the GNU General Public License and is only of importance to you if
# you choose to contribute your changes and enhancements to the
# community by submitting them to Best Practical Solutions, LLC.)
-#
+#
# By intentionally submitting any modifications, corrections or
# derivatives to this work, or any other work intended for use with
# Request Tracker, to Best Practical Solutions, LLC, you confirm that
# royalty-free, perpetual, license to use, copy, create derivative
# works based on those contributions, and sublicense and distribute
# those contributions and any derivatives thereof.
-#
+#
# END BPS TAGGED BLOCK }}}
# {{{ Front Material
use RT::Reminders;
use RT::URI::fsck_com_rt;
use RT::URI;
+use RT::URI::freeside;
use MIME::Entity;
the ticket id to be linked to as a value (or a URI when linking to other objects).
Multiple links of the same type can be created by passing an array ref. For example:
- Parent => 45,
+ Parents => 45,
DependsOn => [ 15, 22 ],
RefersTo => 'http://www.bestpractical.com',
}
}
+ $args{'Subject'} =~ s/\n//g;
+
$RT::Handle->BeginTransaction();
my %params = (
);
# Parameters passed in during an import that we probably don't want to touch, otherwise
- foreach my $attr qw(id Creator Created LastUpdated LastUpdatedBy) {
+ foreach my $attr (qw(id Creator Created LastUpdated LastUpdatedBy)) {
$params{$attr} = $args{$attr} if $args{$attr};
}
# Delete null integer parameters
foreach my $attr
- qw(TimeWorked TimeLeft TimeEstimated InitialPriority FinalPriority)
+ (qw(TimeWorked TimeLeft TimeEstimated InitialPriority FinalPriority))
{
delete $params{$attr}
unless ( exists $params{$attr} && $params{$attr} );
if ( $self->Id && $Trans ) {
- $TransObj->UpdateCustomFields(ARGSRef => \%args);
+ #$TransObj->UpdateCustomFields(ARGSRef => \%args);
+ $TransObj->UpdateCustomFields(%args);
$RT::Logger->info( "Ticket " . $self->Id . " created in queue '" . $QueueObj->Name . "' by " . $self->CurrentUser->Name );
$ErrStr = $self->loc( "Ticket [_1] created in queue '[_2]'", $self->Id, $QueueObj->Name );
}
- foreach my $date qw(due starts started resolved) {
+ foreach my $date (qw(due starts started resolved)) {
my $dateobj = RT::Date->new($RT::SystemUser);
if ( defined ($args{$date}) and $args{$date} =~ /^\d+$/ ) {
$dateobj->Set( Format => 'unix', Value => $args{$date} );
$self->OwnerGroup->_AddMember( PrincipalId => $Owner->PrincipalId );
- my $watcher;
- foreach $watcher ( @{ $args{'Cc'} } ) {
+ foreach my $watcher ( @{ $args{'Cc'} } ) {
$self->_AddWatcher( Type => 'Cc', Email => $watcher, Silent => 1 );
}
- foreach $watcher ( @{ $args{'AdminCc'} } ) {
+ foreach my $watcher ( @{ $args{'AdminCc'} } ) {
$self->_AddWatcher( Type => 'AdminCc', Email => $watcher,
Silent => 1 );
}
- foreach $watcher ( @{ $args{'Requestor'} } ) {
+ foreach my $watcher ( @{ $args{'Requestor'} } ) {
$self->_AddWatcher( Type => 'Requestor', Email => $watcher,
Silent => 1 );
}
}
}
else {
- $RT::Logger->warn("$self -> DeleteWatcher got passed a bogus type");
+ $RT::Logger->warning("$self -> DeleteWatcher got passed a bogus type");
return ( 0,
$self->loc('Error in parameters to Ticket->DeleteWatcher') );
}
return ($queue_obj);
}
+sub SetSubject {
+ my $self = shift;
+ my $value = shift;
+ $value =~ s/\n//g;
+ return $self->_Set( Field => 'Subject', Value => $value );
+}
+
# }}}
# }}}
NoteType => 'Correspond',
TimeTaken => 0,
CommitScrips => 1,
+ CustomFields => {},
@_
);
TimeTaken => $args{'TimeTaken'},
MIMEObj => $args{'MIMEObj'},
CommitScrips => $args{'CommitScrips'},
+ CustomFields => $args{'CustomFields'},
);
unless ($Trans) {
my $links = $self->{ $cache_key }
= RT::Links->new( $self->CurrentUser );
unless ( $self->CurrentUserHasRight('ShowTicket') ) {
- $links->Limit( FIELD => 'id', VALUE => 0 );
+ $links->Limit( FIELD => 'id', VALUE => 0, SUBCLAUSE => 'acl' );
return $links;
}
- # without this you will also get RT::User(s) instead of tickets!
- if ($field == 'Base' and $type == 'MemberOf') {
- my $rtname = RT->Config->Get('rtname');
- $links->Limit(
- FIELD => 'Base',
- OPERATOR => 'STARTSWITH',
- VALUE => "fsck.com-rt://$rtname/ticket/",
- );
- }
-
# Maybe this ticket is a merge ticket
- my $limit_on = 'Local'. $field;
+ #my $limit_on = 'Local'. $field;
# at least to myself
$links->Limit(
- FIELD => $limit_on,
- VALUE => $self->id,
+ FIELD => $field, #$limit_on,
+ OPERATOR => 'MATCHES',
+ VALUE => 'fsck.com-rt://%/ticket/'. $self->id,
ENTRYAGGREGATOR => 'OR',
);
$links->Limit(
- FIELD => $limit_on,
- VALUE => $_,
+ FIELD => $field, #$limit_on,
+ OPERATOR => 'MATCHES',
+ VALUE => 'fsck.com-rt://%/ticket/'. $_,
ENTRYAGGREGATOR => 'OR',
) foreach $self->Merged;
$links->Limit(
}
# Update time fields
- foreach my $type qw(TimeEstimated TimeWorked TimeLeft) {
+ foreach my $type (qw(TimeEstimated TimeWorked TimeLeft)) {
my $mutator = "Set$type";
$MergeInto->$mutator(
}
#add all of this ticket's watchers to that ticket.
- foreach my $watcher_type qw(Requestors Cc AdminCc) {
+ foreach my $watcher_type (qw(Requestors Cc AdminCc)) {
my $people = $self->$watcher_type->MembersObj;
my $addwatcher_type = $watcher_type;
my $batch = $self->TransactionBatch;
my %seen;
- my $types = join ',', grep !$seen{$_}++, grep defined, map $_->Type, grep defined, @{$batch};
+ my $types = join ',', grep !$seen{$_}++, grep defined, map $_->__Value('Type'), grep defined, @{$batch};
require RT::Scrips;
RT::Scrips->new($RT::SystemUser)->Apply(
# }}}
+=head2 CurrentUserCanSee
+
+Returns true if the current user can see the ticket, using ShowTicket
+
+=cut
+
+sub CurrentUserCanSee {
+ my $self = shift;
+ return $self->CurrentUserHasRight('ShowTicket');
+}
+
# {{{ sub HasRight
=head2 HasRight
sub TransactionCustomFields {
my $self = shift;
- return $self->QueueObj->TicketTransactionCustomFields;
+ my $cfs = $self->QueueObj->TicketTransactionCustomFields;
+ $cfs->SetContextObject( $self );
+ return $cfs;
}
# }}}