Skip to content

Commit

Permalink
Qual: Uniformize code. Trigger PROJECT_BUILDDOC is removed because
Browse files Browse the repository at this point in the history
building a doc is not a business event. For technical action after
creation of a pdf, hook "afterPDFCreation" must be used instead.
  • Loading branch information
eldy committed Aug 19, 2014
1 parent 30d4a7f commit a26a7ce
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
2 changes: 2 additions & 0 deletions ChangeLog
Expand Up @@ -87,6 +87,8 @@ Dolibarr better:
- Changed the way parameters are provided to scripts sync_xxx_ldap2dolibarr.php
- Some field into database wwere renamed from "libelle" to "label".
- Table llx_c_pays were renamed into llx_c_country.
- Trigger PROJECT_BUILDDOC is removed. Building a doc is not a business event. For action after
creation of a pdf, hook "afterPDFCreation" must be used instead.


***** ChangeLog for 3.6 compared to 3.5.* *****
Expand Down
7 changes: 0 additions & 7 deletions htdocs/core/modules/project/modules_project.php
Expand Up @@ -225,13 +225,6 @@ function project_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0,
// Success in building document. We build meta file.
dol_meta_create($object);

// Appel des triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($db);
$result=$interface->run_triggers('PROJECT_BUILDDOC',$object,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers

return 1;
}
else
Expand Down
12 changes: 12 additions & 0 deletions htdocs/core/modules/project/pdf/pdf_baleine.modules.php
Expand Up @@ -295,6 +295,18 @@ function write_file($object,$outputlangs)
$pdf->Close();

$pdf->Output($file,'F');

// Add pdfgeneration hook
if (! is_object($hookmanager))
{
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($this->db);
}
$hookmanager->initHooks(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))
@chmod($file, octdec($conf->global->MAIN_UMASK));

Expand Down

0 comments on commit a26a7ce

Please sign in to comment.