New: Uniformize odt generation to use hooks like pdf generation
This commit is contained in:
parent
ec664aaa71
commit
de83dc68e1
@ -232,12 +232,16 @@ class doc_generic_order_odt extends ModelePDFCommandes
|
||||
/**
|
||||
* Function to build a document on disk using the generic odt module.
|
||||
*
|
||||
* @param Commande $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
|
||||
* @param Commande $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
|
||||
* @param int $hidedetails Do not show line details
|
||||
* @param int $hidedesc Do not show desc
|
||||
* @param int $hideref Do not show ref
|
||||
* @param object $hookmanager Hookmanager object
|
||||
* @return int 1 if OK, <=0 if KO
|
||||
*/
|
||||
function write_file($object,$outputlangs,$srctemplatepath)
|
||||
function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidedesc=0,$hideref=0,$hookmanager=false)
|
||||
{
|
||||
global $user,$langs,$conf,$mysoc;
|
||||
|
||||
@ -481,6 +485,17 @@ class doc_generic_order_odt extends ModelePDFCommandes
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Add odtgeneration hook
|
||||
if (! is_object($hookmanager))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($this->db);
|
||||
}
|
||||
$hookmanager->initHooks(array('odtgeneration'));
|
||||
$parameters=array('odfHandler'=>$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
|
||||
global $action;
|
||||
$reshook=$hookmanager->executeHooks('beforeODTSave',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
// Write new file
|
||||
//$result=$odfHandler->exportAsAttachedFile('toto');
|
||||
$odfHandler->saveToDisk($file);
|
||||
|
||||
@ -244,12 +244,16 @@ class doc_generic_invoice_odt extends ModelePDFFactures
|
||||
/**
|
||||
* Function to build a document on disk using the generic odt module.
|
||||
*
|
||||
* @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
|
||||
* @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
|
||||
* @param int $hidedetails Do not show line details
|
||||
* @param int $hidedesc Do not show desc
|
||||
* @param int $hideref Do not show ref
|
||||
* @param object $hookmanager Hookmanager object
|
||||
* @return int 1 if OK, <=0 if KO
|
||||
*/
|
||||
function write_file($object,$outputlangs,$srctemplatepath)
|
||||
function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidedesc=0,$hideref=0,$hookmanager=false)
|
||||
{
|
||||
global $user,$langs,$conf,$mysoc;
|
||||
|
||||
@ -440,6 +444,17 @@ class doc_generic_invoice_odt extends ModelePDFFactures
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Add odtgeneration hook
|
||||
if (! is_object($hookmanager))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($this->db);
|
||||
}
|
||||
$hookmanager->initHooks(array('odtgeneration'));
|
||||
$parameters=array('odfHandler'=>$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
|
||||
global $action;
|
||||
$reshook=$hookmanager->executeHooks('beforeODTSave',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
// Write new file
|
||||
//$result=$odfHandler->exportAsAttachedFile('toto');
|
||||
$odfHandler->saveToDisk($file);
|
||||
|
||||
@ -231,12 +231,16 @@ class doc_generic_proposal_odt extends ModelePDFPropales
|
||||
/**
|
||||
* Function to build a document on disk using the generic odt module.
|
||||
*
|
||||
* @param Propale $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
|
||||
* @param Propale $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
|
||||
* @param int $hidedetails Do not show line details
|
||||
* @param int $hidedesc Do not show desc
|
||||
* @param int $hideref Do not show ref
|
||||
* @param object $hookmanager Hookmanager object
|
||||
* @return int 1 if OK, <=0 if KO
|
||||
*/
|
||||
function write_file($object,$outputlangs,$srctemplatepath)
|
||||
function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidedesc=0,$hideref=0,$hookmanager=false)
|
||||
{
|
||||
global $user,$langs,$conf,$mysoc;
|
||||
|
||||
@ -480,6 +484,17 @@ class doc_generic_proposal_odt extends ModelePDFPropales
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Add odtgeneration hook
|
||||
if (! is_object($hookmanager))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($this->db);
|
||||
}
|
||||
$hookmanager->initHooks(array('odtgeneration'));
|
||||
$parameters=array('odfHandler'=>$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
|
||||
global $action;
|
||||
$reshook=$hookmanager->executeHooks('beforeODTSave',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
// Write new file
|
||||
//$result=$odfHandler->exportAsAttachedFile('toto');
|
||||
$odfHandler->saveToDisk($file);
|
||||
|
||||
@ -155,12 +155,16 @@ class doc_generic_odt extends ModeleThirdPartyDoc
|
||||
/**
|
||||
* Function to build a document on disk using the generic odt module.
|
||||
*
|
||||
* @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
|
||||
* @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
|
||||
* @param int $hidedetails Do not show line details
|
||||
* @param int $hidedesc Do not show desc
|
||||
* @param int $hideref Do not show ref
|
||||
* @param object $hookmanager Hookmanager object
|
||||
* @return int 1 if OK, <=0 if KO
|
||||
*/
|
||||
function write_file($object,$outputlangs,$srctemplatepath)
|
||||
function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidedesc=0,$hideref=0,$hookmanager=false)
|
||||
{
|
||||
global $user,$langs,$conf,$mysoc;
|
||||
|
||||
@ -293,6 +297,17 @@ class doc_generic_odt extends ModeleThirdPartyDoc
|
||||
}
|
||||
}
|
||||
|
||||
// Add odtgeneration hook
|
||||
if (! is_object($hookmanager))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($this->db);
|
||||
}
|
||||
$hookmanager->initHooks(array('odtgeneration'));
|
||||
$parameters=array('odfHandler'=>$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
|
||||
global $action;
|
||||
$reshook=$hookmanager->executeHooks('beforeODTSave',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
// Write new file
|
||||
//$result=$odfHandler->exportAsAttachedFile('toto');
|
||||
$odfHandler->saveToDisk($file);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user