Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Suitecrm - php code in pdf template

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

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

Then what I want to have is on my pdf template, I want to have php condition base on the value of my dropdown e.g

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

Will this be possible?

like image 719
Erwin Daez Avatar asked Dec 05 '25 10:12

Erwin Daez


1 Answers

You could add a placeholder in the pdf template, for example:

%%renewal_value%%

Then you can work out your required value like you described, but rather than echoing 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);
like image 83
johnmccuk Avatar answered Dec 09 '25 02:12

johnmccuk



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!