23 require_once DOL_DOCUMENT_ROOT.
'/core/class/commondocgenerator.class.php';
52 include_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
72 function action_create($db, $object, $modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
75 global $conf, $langs, $user;
76 $langs->load(
"action");
80 $srctemplatepath =
'';
85 if (!empty($conf->global->ACTION_EVENT_ADDON_PDF))
87 $modele = $conf->global->ACTION_EVENT_ADDON_PDF;
94 $tmp = explode(
':', $modele, 2);
98 $srctemplatepath = $tmp[1];
102 $file =
''; $classname =
''; $filefound = 0;
103 $dirmodels = array(
'/');
104 if (is_array($conf->modules_parts[
'models'])) $dirmodels = array_merge($dirmodels, $conf->modules_parts[
'models']);
105 foreach ($dirmodels as $reldir)
107 foreach (array(
'doc',
'pdf') as $prefix)
109 $file = $prefix.
"_".$modele.
".modules.php";
112 $file =
dol_buildpath($reldir.
"core/modules/action/doc/".$file, 0);
113 if (file_exists($file))
116 $classname = $prefix.
'_'.$modele;
120 if ($filefound)
break;
128 $obj =
new $classname($db);
132 $sav_charset_output = $outputlangs->charset_output;
133 if ($obj->write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref) > 0)
135 $outputlangs->charset_output = $sav_charset_output;
138 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
143 $outputlangs->charset_output = $sav_charset_output;
148 print $langs->trans(
"Error").
" ".$langs->trans(
"ErrorFileDoesNotExists", $file);
dol_delete_preview($object)
Delete all preview files linked to object instance.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
static liste_modeles($db, $maxfilenamelength=0)
Return list of active generation modules.
dol_strlen($string, $stringencoding= 'UTF-8')
Make a strlen call.
print
Draft customers invoices.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
Parent class for documents generators.
getListOfModels($db, $type, $maxfilenamelength=0)
Return list of activated modules usable for document generation.
Parent class for product models of doc generators.