Use MAIN_DOC_USE_TIMING on invoices (odt)

This commit is contained in:
jfefe 2013-04-24 17:13:47 +02:00
parent e1120dfe08
commit 9ea1f2c4ed

View File

@ -336,12 +336,24 @@ class doc_generic_invoice_odt extends ModelePDFFactures
{ {
//print "srctemplatepath=".$srctemplatepath; // Src filename //print "srctemplatepath=".$srctemplatepath; // Src filename
$newfile=basename($srctemplatepath); $newfile=basename($srctemplatepath);
$newfiletmp=preg_replace('/\.odt/i','',$newfile); $newfiletmp=preg_replace('/\.od(t|s)/i','',$newfile);
$newfiletmp=preg_replace('/template_/i','',$newfiletmp); $newfiletmp=preg_replace('/template_/i','',$newfiletmp);
$newfiletmp=preg_replace('/modele_/i','',$newfiletmp); $newfiletmp=preg_replace('/modele_/i','',$newfiletmp);
$newfiletmp=$objectref.'_'.$newfiletmp; $newfiletmp=$objectref.'_'.$newfiletmp;
// Get extension (ods or odt)
$newfileformat=substr($newfile, strrpos($newfile, '.')+1);
if ( ! empty($conf->global->MAIN_DOC_USE_TIMING))
{
$filename=$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.'.$newfileformat;
}
else
{
$filename=$newfiletmp.'.'.$newfileformat;
}
$file=$dir.'/'.$filename;
//$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt'; //$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt';
$file=$dir.'/'.$newfiletmp.'.odt';
//print "newdir=".$dir; //print "newdir=".$dir;
//print "newfile=".$newfile; //print "newfile=".$newfile;
//print "file=".$file; //print "file=".$file;