New: Add hooks to execute code after pdf generation
This commit is contained in:
parent
ae4b871f04
commit
a0855a3867
@ -41,18 +41,17 @@ class FormFile
|
|||||||
*
|
*
|
||||||
* @param DoliDB $DB Database handler
|
* @param DoliDB $DB Database handler
|
||||||
*/
|
*/
|
||||||
function FormFile($DB)
|
function FormFile($db)
|
||||||
{
|
{
|
||||||
$this->db = $DB;
|
$this->db = $db;
|
||||||
|
|
||||||
$this->numoffiles=0;
|
$this->numoffiles=0;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show form to upload a new file
|
* Show form to upload a new file
|
||||||
|
*
|
||||||
* @param url Url
|
* @param url Url
|
||||||
* @param title Title zone (Title or '' or 'none')
|
* @param title Title zone (Title or '' or 'none')
|
||||||
* @param addcancel 1=Add 'Cancel' button
|
* @param addcancel 1=Add 'Cancel' button
|
||||||
|
|||||||
@ -405,6 +405,15 @@ class pdf_crabe extends ModelePDFFactures
|
|||||||
$pdf->Close();
|
$pdf->Close();
|
||||||
|
|
||||||
$pdf->Output($file,'F');
|
$pdf->Output($file,'F');
|
||||||
|
|
||||||
|
// Actions on extra fields (by external module or standard code)
|
||||||
|
include_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php');
|
||||||
|
$hookmanager=new HookManager($this->db);
|
||||||
|
$hookmanager->callHooks(array('pdfgeneration'));
|
||||||
|
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
|
||||||
|
global $action;
|
||||||
|
$reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
|
||||||
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));
|
||||||
|
|
||||||
|
|||||||
@ -108,7 +108,7 @@ class pdf_oursin extends ModelePDFFactures
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to build pdf onto disk
|
* Function to build pdf onto disk
|
||||||
*
|
*
|
||||||
* @param int $object Id of object to generate
|
* @param int $object Id of object to generate
|
||||||
* @param object $outputlangs Lang output object
|
* @param object $outputlangs Lang output object
|
||||||
* @param string $srctemplatepath Full path of source filename for generator using a template file
|
* @param string $srctemplatepath Full path of source filename for generator using a template file
|
||||||
@ -290,6 +290,15 @@ class pdf_oursin extends ModelePDFFactures
|
|||||||
$pdf->Close();
|
$pdf->Close();
|
||||||
|
|
||||||
$pdf->Output($file,'F');
|
$pdf->Output($file,'F');
|
||||||
|
|
||||||
|
// Actions on extra fields (by external module or standard code)
|
||||||
|
include_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php');
|
||||||
|
$hookmanager=new HookManager($this->db);
|
||||||
|
$hookmanager->callHooks(array('pdfgeneration'));
|
||||||
|
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
|
||||||
|
global $action;
|
||||||
|
$reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
|
||||||
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));
|
||||||
|
|
||||||
|
|||||||
@ -383,16 +383,18 @@ class pdf_propale_azur extends ModelePDFPropales
|
|||||||
$pdf->Close();
|
$pdf->Close();
|
||||||
|
|
||||||
$pdf->Output($file,'F');
|
$pdf->Output($file,'F');
|
||||||
|
|
||||||
|
// Actions on extra fields (by external module or standard code)
|
||||||
|
include_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php');
|
||||||
|
$hookmanager=new HookManager($this->db);
|
||||||
|
$hookmanager->callHooks(array('pdfgeneration'));
|
||||||
|
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
|
||||||
|
global $action;
|
||||||
|
$reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
|
||||||
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));
|
||||||
|
|
||||||
// Add external file
|
|
||||||
//$pdfConcat = new concat_pdf();
|
|
||||||
//$pdfConcat->setFiles(array($file, DOL_DOCUMENT_ROOT."/includes/modules/propale/morefile.pdf"));
|
|
||||||
//$pdfConcat->concat();
|
|
||||||
//$pdf->AliasNbPages();
|
|
||||||
//$pdfConcat->Output($file,'F');
|
|
||||||
|
|
||||||
$outputlangs->charset_output=$sav_charset_output;
|
$outputlangs->charset_output=$sav_charset_output;
|
||||||
return 1; // Pas d'erreur
|
return 1; // Pas d'erreur
|
||||||
}
|
}
|
||||||
|
|||||||
@ -102,7 +102,7 @@ class pdf_propale_jaune extends ModelePDFPropales
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to build pdf onto disk
|
* Function to build pdf onto disk
|
||||||
*
|
*
|
||||||
* @param int $object Id of object to generate
|
* @param int $object Id of object to generate
|
||||||
* @param object $outputlangs Lang output object
|
* @param object $outputlangs Lang output object
|
||||||
* @param string $srctemplatepath Full path of source filename for generator using a template file
|
* @param string $srctemplatepath Full path of source filename for generator using a template file
|
||||||
@ -383,16 +383,18 @@ class pdf_propale_jaune extends ModelePDFPropales
|
|||||||
$pdf->Close();
|
$pdf->Close();
|
||||||
|
|
||||||
$pdf->Output($file,'F');
|
$pdf->Output($file,'F');
|
||||||
|
|
||||||
|
// Actions on extra fields (by external module or standard code)
|
||||||
|
include_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php');
|
||||||
|
$hookmanager=new HookManager($this->db);
|
||||||
|
$hookmanager->callHooks(array('pdfgeneration'));
|
||||||
|
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
|
||||||
|
global $action;
|
||||||
|
$reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
|
||||||
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));
|
||||||
|
|
||||||
// Add external file
|
|
||||||
//$pdfConcat = new concat_pdf();
|
|
||||||
//$pdfConcat->setFiles(array($file, DOL_DOCUMENT_ROOT."/includes/modules/propale/morefile.pdf"));
|
|
||||||
//$pdfConcat->concat();
|
|
||||||
//$pdf->AliasNbPages();
|
|
||||||
//$pdfConcat->Output($file,'F');
|
|
||||||
|
|
||||||
$outputlangs->charset_output=$sav_charset_output;
|
$outputlangs->charset_output=$sav_charset_output;
|
||||||
return 1; // Pas d'erreur
|
return 1; // Pas d'erreur
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user