//Added by Yesha 25-02-2019 public function lat_get_quotation_pdf($record_id, $pdf_type) { global $db,$app_list_strings, $sugar_config, $current_user, $timedate, $beanList, $beanFiles; $module_name = "EQM_Quotation"; $bean = BeanFactory::getBean($module_name, $record_id); if($bean->id == null){ $return['quotation_pdf_attachment']["filename"] = "Record Not found!"; $return['quotation_pdf_attachment']["file"] = ""; }else{ require_once('include/Sugarpdf/SugarpdfFactory.php'); // $bean = new Quote(); // $bean->retrieve($quote_id); $sugarpdfBean = SugarpdfFactory::loadSugarpdf($pdf_type, $module_name, $bean, array() ); $sugarpdfBean->process(); $fileName = $sugarpdfBean->fileName; // $pdfContents = $sugarpdfBean->Output('','S'); $tmp = $sugarpdfBean->Output('','S'); $badoutput = ob_get_contents(); if(strlen($badoutput) > 0) { ob_end_clean(); } file_put_contents("upload://$fileName", ltrim($tmp)); $pdfContents = base64_encode($tmp); $return['quotation_pdf_attachment']["filename"] = $fileName; $return['quotation_pdf_attachment']["file"] = $pdfContents; } return $this->replace_null_to_blank($return); }