[ task #176 ] Allow to use ODT templates for prososal like it's done
for invoices. Working
This commit is contained in:
parent
7d9b5a7545
commit
283bb8e766
@ -233,87 +233,6 @@ function propale_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0,
|
|||||||
dol_print_error('',$langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$dir.$file));
|
dol_print_error('',$langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$dir.$file));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
// Positionne modele sur le nom du modele de propale a utiliser
|
|
||||||
$file = "pdf_propale_".$modele.".modules.php";
|
|
||||||
|
|
||||||
// On verifie l'emplacement du modele
|
|
||||||
$file = dol_buildpath($dir.$file);
|
|
||||||
|
|
||||||
if ($modele && file_exists($file)) $modelisok=1;
|
|
||||||
|
|
||||||
// Si model pas encore bon
|
|
||||||
if (! $modelisok)
|
|
||||||
{
|
|
||||||
if ($conf->global->PROPALE_ADDON_PDF) $modele = $conf->global->PROPALE_ADDON_PDF;
|
|
||||||
$file = "pdf_propale_".$modele.".modules.php";
|
|
||||||
// On verifie l'emplacement du modele
|
|
||||||
$file = dol_buildpath($dir.$file);
|
|
||||||
if (file_exists($file)) $modelisok=1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Si model pas encore bon
|
|
||||||
if (! $modelisok)
|
|
||||||
{
|
|
||||||
$liste=ModelePDFPropales::liste_modeles($db);
|
|
||||||
$modele=key($liste); // Renvoie premiere valeur de cle trouve dans le tableau
|
|
||||||
$file = "pdf_propale_".$modele.".modules.php";
|
|
||||||
$file = dol_buildpath($dir.$file);
|
|
||||||
if (file_exists($file)) $modelisok=1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Charge le modele
|
|
||||||
if ($modelisok)
|
|
||||||
{
|
|
||||||
$classname = "pdf_propale_".$modele;
|
|
||||||
require_once($file);
|
|
||||||
|
|
||||||
$obj = new $classname($db);
|
|
||||||
|
|
||||||
// We save charset_output to restore it because write_file can change it if needed for
|
|
||||||
// output format that does not support UTF8.
|
|
||||||
$sav_charset_output=$outputlangs->charset_output;
|
|
||||||
if ($obj->write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref, $hookmanager) > 0)
|
|
||||||
{
|
|
||||||
$outputlangs->charset_output=$sav_charset_output;
|
|
||||||
|
|
||||||
// we delete preview files
|
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
|
|
||||||
dol_delete_preview($object);
|
|
||||||
|
|
||||||
// Appel des triggers
|
|
||||||
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
|
|
||||||
$interface=new Interfaces($db);
|
|
||||||
$result=$interface->run_triggers('PROPAL_BUILDDOC',$object,$user,$langs,$conf);
|
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$outputlangs->charset_output=$sav_charset_output;
|
|
||||||
dol_syslog("modules_propale::propale_pdf_create error");
|
|
||||||
dol_print_error($db,$obj->error);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (! $conf->global->PROPALE_ADDON_PDF)
|
|
||||||
{
|
|
||||||
print $langs->trans("Error")." ".$langs->trans("Error_PROPALE_ADDON_PDF_NotDefined");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user