Suitecrm - PHP code in pdf format

I want to add php code to my pdf template. Here is my use case

First, I have a dropdown on my own module: sample screenshot

Then what I want to have is my pdf template, I want to have a php condition base for my dropdown value like

if($client_type == "renewal") echo "x"; else echo "y";

      

Is it possible?

+3


source to share


1 answer


You can add a placeholder to your pdf template like:

%%renewal_value%%

      



Then you can work out your desired value as described, but instead of iterating over the value, use str_replace

$bean = BeanFactory::getBean('AOS_PDF_Templates', 'some-id');
$value = ($client_type == "renewal") "x": "y";
str_replace('%%renewal_value%%', $value, $bean->description);

      

+1


source







All Articles