<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.18.3">
</HEAD>
<BODY>
I am writing a custom dhandler for a CMMS/Work Order system based on RT/AT.<BR>
<BR>
Essentially I have a Work Order Template (an OpenOffice ODT file with user-defined fields) that I populate with custom fields from an RT Ticket using command-line XMLstarlet tool.<BR>
<BR>
Everything is working when I store my template document on the file system.. ie. my $file = dirname($m->current_comp->source_file) . '/MaintenanceWO.odt';<BR>
<BR>
But I want to get the template document from an Asset Custom Field.<BR>
<BR>
>From outside of RT, and using LWP::Simple - I can do this - which works:<BR>
<BR>
my $asset = RTx::AssetTracker::Asset->new($RT::SystemUser);<BR>
my $cf = RT::CustomFieldValue->new($RT::SystemUser);<BR>
<BR>
$asset->Load("WO Template");<BR>
$cf = $asset->CustomFieldValues("File")->First;<BR>
<BR>
my $id = $cf->Id;<BR>
<BR>
my $url = RT->Config->Get('WebPath') . "/Download/CustomFieldValue/".$cf->Id.'/'.$cf->Content;<BR>
getstore($url,"/tmp/temp.odt");<BR>
<BR>
<BR>
Unfortunately from within the dhandler it does not work. There are authentication issues.. ie. it returns the RT login html instead of the template document.<BR>
<BR>
I tried appending "?user=rtuser&pass=rtpassword" to the url, but no luck.<BR>
<BR>
Within RT itself, is there a "LWP::Simple::getstore" equivalent??<BR>
<BR>
Or perhaps more easily put: How do you extract a file from a custom field and store it on the local file system?<BR>
<BR>
Thanks,<BR>
<BR>
-Bob
</BODY>
</HTML>