*/ require_once 'modules/AOS_PDF_Templates/templateParser.php'; #[\AllowDynamicProperties] class aowTemplateParser extends templateParser { public static function parse_template($string, $bean_arr) { global $beanList; $person = []; foreach ($bean_arr as $bean_name => $bean_id) { $focus = BeanFactory::getBean($bean_name, $bean_id); if (!$focus->fetched_row) { // We do not want the cached version for a newly created bean, as some data such as date fields and // auto increment fields will only be correct after a retrieve operation BeanFactory::unregisterBean($bean_name, $bean_id); $focus = BeanFactory::getBean($bean_name, $bean_id); } $string = aowTemplateParser::parse_template_bean($string, strtolower($beanList[$bean_name]), $focus); if($focus instanceof Person){ $person[] = $focus; } } if (!empty($person)) { $focus = $person[0]; } else { $focus = BeanFactory::newBean('Contacts'); } $string = aowTemplateParser::parse_template_bean($string, 'contact', $focus); return $string; } }