Print button in subpanel

@fab
It means that the entry point doesn’t work.

Sorry, in formLetter I simply replaced

<form id = "popupForm" action = "index.php? entryPoint = formLetter" method = "post">

with

<form id = "popupForm" action = "index.php? entryPoint = formLetterPdf" method = "post">

quite right? If the entrypoint is not considered, how can I resolve? At least in formLetter I opened the Pdf (even if empty).
I saw that (always in formLetter) the part of the code that opens the PDF is this

<div id = "popupDivBack_ara" onclick = "this.style.display = \ 'none \'; document.getElementById (\ 'popupDiv_ara \'). style.display = \ 'none \';" style = "top: 0px; left: 0px; position: fixed; height: 100%; width: 100%; background: # 000000; opacity: 0.5; display: none; vertical-align: middle; text-align: center; z-index: 9998; ">
</div>
<script>
function showPopup () {
var ppd = document.getElementById (\ 'popupDivBack_ara \');
var ppd2 = document.getElementById (\ 'popupDiv_ara \');
if (ppd! = null && ppd2! = null) {
ppd.style.display = \ 'block \';
ppd2.style.display = \ 'block \';
} else {
alert (\ 'Error! \');
}
}
</script> ';

but I don’t see here references to the TEST.pdf page or where I can change something

@fab

  1. The line:
<form id="popupForm" action="index.php?entryPoint=formLetter" method="post">

called the file - modules/AOS_PDF_Templates/formLetterPdf.php
because the file - include/MVC/Controller/entry_point_registry.php
has the line -

...
'formLetter' => array('file' => 'modules/AOS_PDF_Templates/formLetterPdf.php' , 'auth' => true),
...
  1. You should make your entry point.
    I think it can be that:
  • make the file -
    custom/modules/<Module_Name>/action_file_map.php
    with line:
$action_file_map['letterfrompdftest'] = 'custom/modules/<Module_Name>/LetterfromPDFtest.php';
  • make form in detailview with ‘form’ similar to:
<form id="popupForm" action="index.php?action= letterfrompdftest?module=<Module_Name>" method="post">
  • make the file - custom/modules/<module_name>/LetterfromPDFtest.php
    You can use the file - modules/AOS_PDF_Templates/formLetterPdf.php as en EXAMPLE ONLY. You should write your logic pdf file formation.

I followed your instructions step by step, but what now appears when I click on my TEST.pdf is:

Bad data passed in; Return to Home

I tried to have something printed on the screen in formLetterPdf, but nothing appears

@fab
I did a small syntaxes mistake when made “copy/past”. Change the second symbol from ‘?’ on ‘&’ in the part of line:
wrong:

action="index.php?action= letterfrompdftest?module=<Module_Name>"

right:

action="index.php?action=letterfrompdftest&module=<Module_Name>"

Yes, it is clearly a mistake, I should have noticed … in any case I went back to the previous point:
the template appears, I select it but the page is blank.
I think now the changes need to be made in formLetterPdf, but I don’t know where and how.
Don’t have a concrete example? Even just to make a string appear on the screen and start from here.

@fab

  • If you want to print NON SPECIFIC format pdf.
  1. Make template for your module.
  2. Add button to file - custom/modules/<Modules_name>/metadata/detailviewdefs.php
...
          'AOS_GENLET' =>
          array(
            'customCode' => '<input type="button" class="button" onClick="showPopup();" value="{$APP.LBL_PRINT_AS_PDF}">',
          ),
...
  1. Add code to file - custom/modules/<Modules_name>/views/view.detail.php (example: modules/Accounts/views/view.detail.php)
...
        require_once('modules/AOS_PDF_Templates/formLetter.php');
        formLetter::DVPopupHtml('Accounts');
...

Steps 2. and 3. included for selecting templates of your module. I think that the code of the file modules/AOS_PDF_Templates/formLetterPdf.php enough universal but not sure.

  • If you want to print SPECIFIC format pdf. You should do custom entry point including select template in detail view form.

I can’t add the button to detailviewdefs.php because it’s a button in the subpanel menu.

this far I got there:

require_once ('modules / AOS_PDF_Templates / formLetter.php');
formLetter :: DVPopupHtml ('Accounts');

what I am missing now is to modify the formLetterPdf file, so that it contains the lines inside the subpanel, but I don’t know how to do it, for this reason I wanted at least to print on the screen, in the PDF, at least one line to understand where to work

@fab
You should change module name from ‘Accounts’ to your ‘<Module_Name>’ because code of file formLetterPdf.php take ID of your ‘<Module_Name>’ and to search it into DB table of ‘Accounts’.

Yes, I know, I just copied what you wrote me … the form formLetterPdf refers to is correct, it’s my module

@fab
Then I am finished. You should change the file ‘formLetterPdf.php’. I think that it’s enough easy.
When I have problems with code I write information (text and variables) to log file:

$GLOBALS['log']->fatal(get_class()." ". __FUNCTION__." _REQUEST[uid]:\n ".print_r($_REQUEST['uid'],true));

The code work when the log level is ‘Fatal’ .

Okay, thanks anyway … I will try to start from formLetterPdf and try to modify it even if I have not found anything on how to do it, if anyone else has some more news, I would appreciate the help