/**
  * load the correct Tcpdf
  * @param string $type Tcpdf Type
  * @return valid Tcpdf
  */
 function loadSugarpdf($type = 'default', $module, $bean = null, $sugarpdf_object_map = array())
 {
     $type = strtolower(basename($type));
     //SugarpdfFactory::_loadConfig($sugarpdf, $type);
     //first let's check if the module handles this Tcpdf
     $sugarpdf = null;
     $path = '/sugarpdf/sugarpdf.' . $type . '.php';
     if (file_exists('custom/modules/' . $module . $path)) {
         $sugarpdf = SugarpdfFactory::_buildFromFile('custom/modules/' . $module . $path, $bean, $sugarpdf_object_map, $type, $module);
     } else {
         if (file_exists('modules/' . $module . $path)) {
             $sugarpdf = SugarpdfFactory::_buildFromFile('modules/' . $module . $path, $bean, $sugarpdf_object_map, $type, $module);
         } else {
             if (file_exists('custom/include/Sugarpdf' . $path)) {
                 $sugarpdf = SugarpdfFactory::_buildFromFile('custom/include/Sugarpdf' . $path, $bean, $sugarpdf_object_map, $type, $module);
             } else {
                 //if the module does not handle this Sugarpdf, then check if Sugar handles it OOTB
                 $file = 'include/Sugarpdf' . $path;
                 if (file_exists($file)) {
                     //it appears Sugar does have the proper logic for this file.
                     $sugarpdf = SugarpdfFactory::_buildFromFile($file, $bean, $sugarpdf_object_map, $type, $module);
                 }
             }
         }
     }
     // Default to Sugarpdf if still nothing found/built
     if (!isset($sugarpdf)) {
         $sugarpdf = new Sugarpdf($bean, $sugarpdf_object_map);
     }
     return $sugarpdf;
 }
Пример #2
0
 /**
  * load the correct Tcpdf
  * @param string $type Tcpdf Type
  * @return valid Tcpdf
  */
 function loadSugarpdf($type = 'default', $module, $bean = null, $sugarpdf_object_map = array())
 {
     $type = strtolower(basename($type));
     //first let's check if the module handles this Tcpdf
     $sugarpdf = null;
     $path = '/sugarpdf/sugarpdf.' . $type . '.php';
     $pdf_file = SugarAutoLoader::existingCustomOne('include/Sugarpdf' . $path, 'modules/' . $module . $path);
     if ($pdf_file) {
         $sugarpdf = SugarpdfFactory::_buildFromFile($pdf_file, $bean, $sugarpdf_object_map, $type, $module);
     }
     // Default to Sugarpdf if still nothing found/built
     if (!isset($sugarpdf)) {
         $sugarpdf = new Sugarpdf($bean, $sugarpdf_object_map);
     }
     return $sugarpdf;
 }