I am writing a custom dhandler for a CMMS/Work Order system based on
RT/AT.

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.

Everything is working when I store my template document on the file
system..  ie. my $file = dirname($m->current_comp->source_file) .
'/MaintenanceWO.odt';

But I want to get the template document from an Asset Custom Field.

>From outside of RT, and using LWP::Simple - I can do this - which works:

  my $asset = RTx::AssetTracker::Asset->new($RT::SystemUser);
  my $cf = RT::CustomFieldValue->new($RT::SystemUser);

  $asset->Load("WO Template");
  $cf = $asset->CustomFieldValues("File")->First;

  my $id = $cf->Id;

  my $url = RT->Config->Get('WebPath') .
"/Download/CustomFieldValue/".$cf->Id.'/'.$cf->Content;
  getstore($url,"/tmp/temp.odt");


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.

I tried appending "?user=rtuser&pass=rtpassword" to the url, but no
luck.

Within RT itself, is there a "LWP::Simple::getstore" equivalent??

Or perhaps more easily put:  How do you extract a file from a custom
field and store it on the local file system?

Thanks,

-Bob
_______________________________________________
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: [email protected]


Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at http://rtbook.bestpractical.com

Reply via email to