Skip to content

Commit

Permalink
[task #176] Allow to use ODT templates for prososal like it's done
Browse files Browse the repository at this point in the history
  • Loading branch information
hregis committed Jan 5, 2012
1 parent 915bc47 commit 187c54a
Showing 1 changed file with 3 additions and 84 deletions.
87 changes: 3 additions & 84 deletions htdocs/core/modules/propale/modules_propale.php
@@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -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));
return -1;
}


/*
// Positionne modele sur le nom du modele de propale a utiliser
$file = "pdf_".$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_".$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_".$modele.".modules.php";
$file = dol_buildpath($dir.$file);
if (file_exists($file)) $modelisok=1;
}
// Charge le modele
if ($modelisok)
{
$classname = "pdf_".$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;
}
*/
}

?>
?>

0 comments on commit 187c54a

Please sign in to comment.