Fix mass merging must read only PDF generated for REF.
This commit is contained in:
parent
d3c95e030b
commit
70cbaeb423
@ -429,7 +429,7 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se
|
|||||||
}
|
}
|
||||||
|
|
||||||
$arrayofinclusion=array();
|
$arrayofinclusion=array();
|
||||||
foreach($listofobjectref as $tmppdf) $arrayofinclusion[]=preg_quote($tmppdf.'.pdf','/');
|
foreach($listofobjectref as $tmppdf) $arrayofinclusion[]='^'.preg_quote($tmppdf.'.pdf','/').'$';
|
||||||
$listoffiles = dol_dir_list($uploaddir,'all',1,implode('|',$arrayofinclusion),'\.meta$|\.png','date',SORT_DESC,0,true);
|
$listoffiles = dol_dir_list($uploaddir,'all',1,implode('|',$arrayofinclusion),'\.meta$|\.png','date',SORT_DESC,0,true);
|
||||||
|
|
||||||
// build list of files with full path
|
// build list of files with full path
|
||||||
@ -505,8 +505,8 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se
|
|||||||
$pdf=pdf_getInstance();
|
$pdf=pdf_getInstance();
|
||||||
if (class_exists('TCPDF'))
|
if (class_exists('TCPDF'))
|
||||||
{
|
{
|
||||||
$pdf->setPrintHeader(false);
|
$pdf->setPrintHeader(false);
|
||||||
$pdf->setPrintFooter(false);
|
$pdf->setPrintFooter(false);
|
||||||
}
|
}
|
||||||
$pdf->SetFont(pdf_getPDFFont($outputlangs));
|
$pdf->SetFont(pdf_getPDFFont($outputlangs));
|
||||||
|
|
||||||
@ -515,15 +515,15 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se
|
|||||||
// Add all others
|
// Add all others
|
||||||
foreach($files as $file)
|
foreach($files as $file)
|
||||||
{
|
{
|
||||||
// Charge un document PDF depuis un fichier.
|
// Charge un document PDF depuis un fichier.
|
||||||
$pagecount = $pdf->setSourceFile($file);
|
$pagecount = $pdf->setSourceFile($file);
|
||||||
for ($i = 1; $i <= $pagecount; $i++)
|
for ($i = 1; $i <= $pagecount; $i++)
|
||||||
{
|
{
|
||||||
$tplidx = $pdf->importPage($i);
|
$tplidx = $pdf->importPage($i);
|
||||||
$s = $pdf->getTemplatesize($tplidx);
|
$s = $pdf->getTemplatesize($tplidx);
|
||||||
$pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L');
|
$pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L');
|
||||||
$pdf->useTemplate($tplidx);
|
$pdf->useTemplate($tplidx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create output dir if not exists
|
// Create output dir if not exists
|
||||||
@ -536,18 +536,18 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se
|
|||||||
// Save merged file
|
// Save merged file
|
||||||
if ($filter=='paye:0')
|
if ($filter=='paye:0')
|
||||||
{
|
{
|
||||||
if ($option=='late') $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))).'_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Late")));
|
if ($option=='late') $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))).'_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Late")));
|
||||||
else $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid")));
|
else $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid")));
|
||||||
}
|
}
|
||||||
if ($year) $filename.='_'.$year;
|
if ($year) $filename.='_'.$year;
|
||||||
if ($month) $filename.='_'.$month;
|
if ($month) $filename.='_'.$month;
|
||||||
if ($pagecount)
|
if ($pagecount)
|
||||||
{
|
{
|
||||||
$now=dol_now();
|
$now=dol_now();
|
||||||
$file=$diroutputmassaction.'/'.$filename.'_'.dol_print_date($now,'dayhourlog').'.pdf';
|
$file=$diroutputmassaction.'/'.$filename.'_'.dol_print_date($now,'dayhourlog').'.pdf';
|
||||||
$pdf->Output($file,'F');
|
$pdf->Output($file,'F');
|
||||||
if (! empty($conf->global->MAIN_UMASK))
|
if (! empty($conf->global->MAIN_UMASK))
|
||||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||||
|
|
||||||
$langs->load("exports");
|
$langs->load("exports");
|
||||||
setEventMessages($langs->trans('FileSuccessfullyBuilt',$filename.'_'.dol_print_date($now,'dayhourlog')), null, 'mesgs');
|
setEventMessages($langs->trans('FileSuccessfullyBuilt',$filename.'_'.dol_print_date($now,'dayhourlog')), null, 'mesgs');
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user