Example #1
0
 function preDisplay()
 {
     $this->sugarpdfBean = SugarpdfFactory::loadSugarpdf($this->sugarpdf, $this->module, $this->bean, $this->view_object_map);
     // ACL control
     if (!empty($this->bean) && !$this->bean->ACLAccess($this->sugarpdfBean->aclAction)) {
         ACLController::displayNoAccess(true);
         sugar_cleanup(true);
     }
     if (isset($this->errors)) {
         $this->sugarpdfBean->errors = $this->errors;
     }
 }
Example #2
0
 /**
  * This is a private function which just helps the getSugarpdf function generate the
  * proper Tcpdf object
  *
  * @return a valid Sugarpdf
  */
 function _buildFromFile($file, &$bean, $sugarpdf_object_map, $type, $module)
 {
     require_once $file;
     //try ModuleSugarpdfType first then try SugarpdfType if that fails then use Sugarpdf
     $class = ucfirst($module) . 'Sugarpdf' . ucfirst($type);
     if (!class_exists($class)) {
         $class = 'Sugarpdf' . ucfirst($type);
         if (!class_exists($class)) {
             return new Sugarpdf($bean, $sugarpdf_object_map);
         }
     }
     return SugarpdfFactory::_buildClass($class, $bean, $sugarpdf_object_map);
 }
 /**
  * Get the base64 contents of a quote pdf.
  *
  * @param string $session   - Session ID returned by a previous call to login.
  * @param string $quote_id
  * @param string $pdf_format Either Standard or Invoice
  */
 function get_quotes_pdf($session, $quote_id, $pdf_format = 'Standard')
 {
     $GLOBALS['log']->info('Begin: SugarWebServiceImpl->get_quotes_pdf');
     global $beanList, $beanFiles;
     global $sugar_config, $current_language;
     $error = new SoapError();
     $output_list = array();
     if (!self::$helperObject->checkSessionAndModuleAccess($session, 'invalid_session', '', '', '', $error)) {
         $error->set_error('invalid_login');
         $GLOBALS['log']->info('End: SugarWebServiceImpl->get_report_pdf');
         return;
     }
     require_once 'include/Sugarpdf/SugarpdfFactory.php';
     $bean = BeanFactory::getBean('Quotes', $quote_id);
     $sugarpdfBean = SugarpdfFactory::loadSugarpdf($pdf_format, 'Quotes', $bean, array());
     $sugarpdfBean->process();
     $pdfContents = $sugarpdfBean->Output('', 'S');
     $pdfContents = base64_encode($pdfContents);
     return array('file_contents' => $pdfContents);
 }