Plural to single convertion in "formLetterPdf.php" script prevents "Generate Letter" in Opportunities module

Hi,

In “modules/AOS_PDF_Templates/formLetterPdf.php” script, plural to single module name convertion is not correct and it prevents “Generate Letter” action in Opportunities Module.

$module_type_create = rtrim($module_type,‘s’);

Works fine for “Lead(s)”, “Account(s)”, “Contact(s)”, and all other which plural is made by appending an “s”, but not for Opportinity(ies).

PHP Fatal error: Class ‘Opportunitie’ not found in modules/AOS_PDF_Templates/formLetterPdf.php on line 39…

Regards,

Vitor Monteiro

Hi Vitor,

Thank you for highlighting this issue.

Regards,

Will.

Hi there, i have a little problem, i get this error when i try to implement PDF to Cases module

Fatal error: Class ‘Case’ not found in /modules/AOS_PDF_Templates/formLetterPdf.php on line 39

this is what i have in view.detail.php

require_once(‘modules/AOS_PDF_Templates/formLetter.php’);
formLetter::DVPopupHtml(‘Cases’);

is there any way to fix this?
Thx for your answer

in modules/AOS_PDF_Templates/formLetterPdf.php

change this :-

$module_type = $_REQUEST['module'];
$module_type_create = rtrim($module_type,'s');
$module_type_low = strtolower($module_type);
$module = new $module_type_create();

to something like

global $beanFiles, $beanList;
$module_type = $_REQUEST['module'];
require_once($beanFiles[$beanList[$module_type]]);
$module = new $beanList[$bean_name];
3 Likes

Hi, first off all thank you so much for your reply,
If i make the that change i get another error from all modules that i try to generate pdfs

Fatal error: Class name must be a valid object or a string in modules/AOS_PDF_Templates/formLetterPdf.php on line 46

global $beanFiles, $beanList;
$module_type = $_REQUEST[‘module’];
require_once($beanFiles[$beanList[$module_type]]);

line 46: $module = new $beanList[$bean_name];

1 Like

replace $bean_name with $module_type

2 Likes

Working perfect, thank you very much for your help :cheer: :cheer: :woohoo: :woohoo: :woohoo: