[Rt-devel] AT Design advice sought
Todd Chapman
rt at chaka.net
Sun Feb 20 18:20:44 EST 2005
Jesse, do you have an opinion?
On Thu, Feb 17, 2005 at 06:46:21PM -0500, Todd Chapman wrote:
> Still looking for advice on this, but I have a solution
> that is working (option 2). I defined Ticket_Vendor.pm like so:
>
> package RT::Ticket;
>
> use strict;
> no warnings qw(redefine);
>
> my $Orig_AddLink = \&_AddLink;
>
> *_AddLink = sub {
>
> my $self = shift;
> my ($linkid, $msg) = $Orig_AddLink->($self, @_);
>
> return ($linkid, $msg) unless $linkid;
>
> my $linkObj = RT::Link->new( $self->CurrentUser );
> my ($LinkId, $Msg) = $linkObj->Load($linkid);
>
> $LinkId or return ($linkid, $msg);
>
> my $TargetObj = $linkObj->TargetObj();
> my $BaseObj = $linkObj->BaseObj();
>
> return ($linkid, $msg) unless (ref $BaseObj eq 'RT::Ticket');
>
> if (ref $TargetObj eq 'RTx::AssetTracker::Asset') {
>
> $TargetObj->_NewTransaction(
> Type => 'TicketLink',
> NewValue => $BaseObj->Id,
> );
>
> }
>
> return ($linkid, $msg);
>
> };
>
> 1;
>
> The only catch is that I had to patch RT to always return
> the link id from _AddLink, which is probably the way it
> should be. If not, I'll have to come up with another solution.
>
> -Todd
>
> _______________________________________________
> Rt-devel mailing list
> Rt-devel at lists.bestpractical.com
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-devel
More information about the Rt-devel
mailing list