[ bug #85 ] Facture sur modèle ODT

This commit is contained in:
Laurent Destailleur 2011-10-18 03:47:20 +02:00
parent 81d93563af
commit 20d5927922
2 changed files with 22 additions and 13 deletions

View File

@ -234,10 +234,11 @@ class doc_generic_invoice_odt extends ModelePDFFactures
/**
* Function to build a document on disk using the generic odt module.
* @param object Object source to build document
* @param outputlangs Lang output object
* @param srctemplatepath Full path of source filename for generator using a template file
* @return int 1 if OK, <=0 if KO
*
* @param Facture $object Object source to build document
* @param Translate $outputlangs Lang output object
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @return int 1 if OK, <=0 if KO
*/
function write_file($object,$outputlangs,$srctemplatepath)
{
@ -274,8 +275,8 @@ class doc_generic_invoice_odt extends ModelePDFFactures
}
}
$objectref = dol_sanitizeFileName($object->ref);
$dir = $conf->facture->dir_output;
$objectref = dol_sanitizeFileName($object->ref);
if (! preg_match('/specimen/i',$objectref)) $dir.= "/" . $objectref;
$file = $dir . "/" . $objectref . ".odt";
@ -293,6 +294,9 @@ class doc_generic_invoice_odt extends ModelePDFFactures
//print "srctemplatepath=".$srctemplatepath; // Src filename
$newfile=basename($srctemplatepath);
$newfiletmp=preg_replace('/\.odt/i','',$newfile);
$newfiletmp=preg_replace('/template_/i','',$newfiletmp);
$newfiletmp=preg_replace('/modele_/i','',$newfiletmp);
$newfiletmp=$objectref.'_'.$newfiletmp;
//$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt';
$file=$dir.'/'.$newfiletmp.'.odt';
//print "newdir=".$dir;

View File

@ -75,8 +75,11 @@ class doc_generic_odt extends ModeleThirdPartyDoc
}
/** \brief Return description of a module
* \return string Description
/**
* Return description of a module
*
* @param Translate $langs Object language
* @return string Description
*/
function info($langs)
{
@ -152,10 +155,11 @@ class doc_generic_odt extends ModeleThirdPartyDoc
/**
* Function to build a document on disk using the generic odt module.
* @param object Object source to build document
* @param outputlangs Lang output object
* @param srctemplatepath Full path of source filename for generator using a template file
* @return int 1 if OK, <=0 if KO
*
* @param Societe $object Object source to build document
* @param Translate $outputlangs Lang output object
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @return int 1 if OK, <=0 if KO
*/
function write_file($object,$outputlangs,$srctemplatepath)
{
@ -192,10 +196,9 @@ class doc_generic_odt extends ModeleThirdPartyDoc
}
}
$objectref = dol_sanitizeFileName($object->id);
$dir = $conf->societe->dir_output;
$objectref = dol_sanitizeFileName($object->id);
if (! preg_match('/specimen/i',$objectref)) $dir.= "/" . $objectref;
$file = $dir . "/" . $objectref . ".odt";
if (! file_exists($dir))
{
@ -211,6 +214,8 @@ class doc_generic_odt extends ModeleThirdPartyDoc
//print "srctemplatepath=".$srctemplatepath; // Src filename
$newfile=basename($srctemplatepath);
$newfiletmp=preg_replace('/\.odt/i','',$newfile);
$newfiletmp=preg_replace('/template_/i','',$newfiletmp);
$newfiletmp=preg_replace('/modele_/i','',$newfiletmp);
$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt';
//print "newdir=".$dir;
//print "newfile=".$newfile;