PDF second version report on form save

deant

Active Member
Hello to all,

After the form is save I like to create/save two different PDF reports on server (something like Invoice and Packing list). To create/save report Im using form php plugin and part of code from email plugin (function pdfAttachment). Code wokrs well except two issues: does not load or include css files and wont display header and footer...but I can do some work around.

Problem is I can't load data and template for second pdf or more precisely how to load new $controller/$formModel and other stuff for other form e.g. form_22. Form_16 is my "main" form and form_22 is a copy of form_16 (different templates and some other little things).

Suggestions are appreciated. THX
 
In last week I was trying a lot of differnt approaches to store two different pdf templates reports after form submission but no succes. I was sure I can get second pdf report passing link to detail template (e.g.
/index.php?option=com_fabrik&view=details&formid=22&rowid=120&format=pdf) using CURL.

If my link to details is the same as form id (e.g. /index.php?option=com_fabrik&view=details&formid=16&rowid=120&format=pdf) then I get pdf as should be.
If my link to details is not the same as form id (e.g. /index.php?option=com_fabrik&view=details&formid=22&rowid=120&format=pdf) then I get an empty page and file is not created.

PHP:
$formId = $data['listid'];
$rowId = $data['rowid'];

//$url = 'https://XXXX.net/index.php?option=com_fabrik&view=details&formid=22&rowid=' . $rowId . '&format=pdf';
$url = 'https://XXXX.net/index.php?option=com_fabrik&view=details&formid=' . $formId . '&rowid=' . $rowId . '&format=pdf';

    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt ( $ch , CURLOPT_RETURNTRANSFER , 1 );
    $html = curl_exec($ch);
    curl_close($ch);

What Im doing wrong? ...or is out there another solution to create two pfd reports in one form?
 
Do you have public access to your form22, is it working if you copy/paste this link directly in your browser?
Does $data['listid'] contain your formID?

BTW: if you only want to address different PDF-layouts you can do ...formid=16&layout=your-2nd-PDFlayout
 
BTW formid=16&layout=your-2nd-PDFlayout is working just perfect.

Thank you very much. You save me again.
I owe you at least one big chocolate. ;)
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top