PDF Template - checkbox, multiselect and radio field fixes

Has anyone noticed when you generate a pdf with a checkbox field it doesn’t display as a checkbox? it displays as a 1 or a 0, similar issue with multiselect fields and radio buttons, they show the system label instead of the display label, we have had this bug fixed, its not upgrade safe, but it corrects the issues with how it displays, when you generate a pdf, i have included the code below and a zip of the file.

Go to ROOT/modules/AOS_PDF_Templates/templateParser.php


$repl_arr[$key."_".$field_def['name']] = implode(', ', unencodeMultienum($focus->$field_def['name']));

and replace it with

// Modification by simbasys START 
 			                	//Commented by simbasys on 27 March 2015  
 								//$repl_arr[$key."_".$field_def['name']] = implode(', ', unencodeMultienum($focus->$field_def['name'])); 
 								$value = unencodeMultienum($focus->$field_def['name']); 
 								foreach($value as $val){ 
 									$returnVal = translate($field_def['options'],$field_def['module'],$val); 
 										array_push( $cell, translate($field_def['options'],$field_def['module'],$val)); 
 								$repl_arr[$key."_".$field_def['name']] = implode(", ",$cell); 
 							}else if( $field_def['type'] == 'radioenum' ){ 
 			                	$repl_arr[$key."_".$field_def['name']] = translate($field_def['options'],$focus->module_dir,$focus->$field_def['name']);	 ; 
 			                }else if( $field_def['type'] == 'bool' ){ 
 			                	$focus->$field_def['name'] == "0"   || $focus->$field_def['name'] == "off" 
 			                		? $val = '' 
 			                		: $val = "checked='checked'"; 
 			                	$repl_arr[$key."_".$field_def['name']] = 	"<input type='checkbox' value='yes' {$val}/>"; 
 			                } // Simbasys : END 

Thanks to Alpesh Savaliya for coding the fix.

1 Like

We had just send a pull request in SuiteCRM repository to fix the issue with multiselect.
We will update it with the fix for checkbox and radio field … and dynamic enum.


Hi TealSteam,

Thanks for posting it here , TealSteam, Glad to help you.