Skip to content

Commit

Permalink
Fix missing error management after afterPDFCreation hook.
Browse files Browse the repository at this point in the history
Removed dead code
  • Loading branch information
eldy committed Feb 8, 2019
1 parent e2934a6 commit 7625eb7
Show file tree
Hide file tree
Showing 30 changed files with 143 additions and 162 deletions.
5 changes: 5 additions & 0 deletions htdocs/core/modules/action/rapport.pdf.php
Expand Up @@ -188,6 +188,11 @@ function write_file($socid = 0, $catid = 0, $outputlangs = '')
$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 ($reshook < 0)
{
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;
}

if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
Expand Down
5 changes: 5 additions & 0 deletions htdocs/core/modules/bank/doc/pdf_ban.modules.php
Expand Up @@ -253,6 +253,11 @@ function write_file($object, $outputlangs)
$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 ($reshook < 0)
{
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;
}

if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
Expand Down
5 changes: 5 additions & 0 deletions htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php
Expand Up @@ -398,6 +398,11 @@ function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails =
$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 ($reshook < 0)
{
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;
}

if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
Expand Down
5 changes: 5 additions & 0 deletions htdocs/core/modules/cheque/doc/pdf_blochet.class.php
Expand Up @@ -193,6 +193,11 @@ function write_file($object, $_dir, $number, $outputlangs)
$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 ($reshook < 0)
{
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;
}

if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
Expand Down
5 changes: 5 additions & 0 deletions htdocs/core/modules/commande/doc/pdf_einstein.modules.php
Expand Up @@ -626,6 +626,11 @@ function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails =
$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 ($reshook < 0)
{
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;
}

if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
Expand Down
5 changes: 5 additions & 0 deletions htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php
Expand Up @@ -691,6 +691,11 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede
$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 ($reshook < 0)
{
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;
}

if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
Expand Down
5 changes: 5 additions & 0 deletions htdocs/core/modules/contract/doc/pdf_strato.modules.php
Expand Up @@ -475,6 +475,11 @@ function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails =
$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 ($reshook < 0)
{
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;
}

if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
Expand Down
5 changes: 5 additions & 0 deletions htdocs/core/modules/expedition/doc/pdf_merou.modules.php
Expand Up @@ -422,6 +422,11 @@ function write_file(&$object, $outputlangs, $srctemplatepath = '', $hidedetails
$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 ($reshook < 0)
{
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;
}

if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
Expand Down
5 changes: 5 additions & 0 deletions htdocs/core/modules/expedition/doc/pdf_rouget.modules.php
Expand Up @@ -638,6 +638,11 @@ function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails =
$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 ($reshook < 0)
{
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;
}

if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
Expand Down
Expand Up @@ -510,6 +510,11 @@ function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails =
$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 ($reshook < 0)
{
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;
}

if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
Expand Down Expand Up @@ -1023,7 +1028,7 @@ private function tablePayments(&$pdf, $object, $posy, $outputlangs)
if ($num > 0 && $object->paid == 0)
{
$y+=$tab3_height;

$pdf->SetXY($tab3_posx+17, $tab3_top+$y);
$pdf->MultiCell(15, 3, price($totalpaid), 0, 'R', 0);
$pdf->SetXY($tab3_posx+35, $tab3_top+$y);
Expand Down
5 changes: 5 additions & 0 deletions htdocs/core/modules/facture/doc/pdf_crabe.modules.php
Expand Up @@ -755,6 +755,11 @@ function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails =
$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 ($reshook < 0)
{
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;
}

if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
Expand Down
5 changes: 5 additions & 0 deletions htdocs/core/modules/facture/doc/pdf_sponge.modules.php
Expand Up @@ -824,6 +824,11 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede
$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 ($reshook < 0)
{
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;
}

if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
Expand Down
5 changes: 5 additions & 0 deletions htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php
Expand Up @@ -458,6 +458,11 @@ function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails =
$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 ($reshook < 0)
{
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;
}

if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
Expand Down
5 changes: 5 additions & 0 deletions htdocs/core/modules/livraison/doc/pdf_typhon.modules.php
Expand Up @@ -613,6 +613,11 @@ function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails =
$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 ($reshook < 0)
{
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;
}

if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
Expand Down
5 changes: 5 additions & 0 deletions htdocs/core/modules/product/doc/pdf_standard.modules.php
Expand Up @@ -568,6 +568,11 @@ function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $
$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 ($reshook < 0)
{
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;
}

if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
Expand Down
5 changes: 5 additions & 0 deletions htdocs/core/modules/project/doc/pdf_baleine.modules.php
Expand Up @@ -494,6 +494,11 @@ function write_file($object, $outputlangs)
$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 ($reshook < 0)
{
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;
}

if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
Expand Down
5 changes: 5 additions & 0 deletions htdocs/core/modules/project/doc/pdf_beluga.modules.php
Expand Up @@ -646,6 +646,11 @@ function write_file($object, $outputlangs)
$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 ($reshook < 0)
{
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;
}

if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
Expand Down
5 changes: 5 additions & 0 deletions htdocs/core/modules/project/doc/pdf_timespent.modules.php
Expand Up @@ -425,6 +425,11 @@ function write_file($object, $outputlangs)
$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 ($reshook < 0)
{
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;
}

if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
Expand Down
5 changes: 5 additions & 0 deletions htdocs/core/modules/propale/doc/pdf_azur.modules.php
Expand Up @@ -811,6 +811,11 @@ function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails =
$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 ($reshook < 0)
{
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;
}

if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
Expand Down
5 changes: 5 additions & 0 deletions htdocs/core/modules/propale/doc/pdf_cyan.modules.php
Expand Up @@ -852,6 +852,11 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede
$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 ($reshook < 0)
{
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;
}

if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
Expand Down
5 changes: 5 additions & 0 deletions htdocs/core/modules/rapport/pdf_paiement.class.php
Expand Up @@ -326,6 +326,11 @@ function write_file($_dir, $month, $year, $outputlangs)
$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 ($reshook < 0)
{
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;
}

if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
Expand Down
5 changes: 5 additions & 0 deletions htdocs/core/modules/reception/doc/pdf_squille.modules.php
Expand Up @@ -568,6 +568,11 @@ function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails =
$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 ($reshook < 0)
{
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;
}

if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
Expand Down
5 changes: 5 additions & 0 deletions htdocs/core/modules/stock/doc/pdf_standard.modules.php
Expand Up @@ -804,6 +804,11 @@ function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $
$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 ($reshook < 0)
{
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;
}

if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
Expand Down
5 changes: 5 additions & 0 deletions htdocs/core/modules/stock/doc/pdf_stdmovement.modules.php
Expand Up @@ -783,6 +783,11 @@ function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $
$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 ($reshook < 0)
{
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;
}

if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
Expand Down
Expand Up @@ -584,6 +584,11 @@ function write_file($object, $outputlangs = '', $srctemplatepath = '', $hidedeta
$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 ($reshook < 0)
{
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;
}

if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
Expand Down
Expand Up @@ -681,6 +681,11 @@ function write_file($object, $outputlangs = '', $srctemplatepath = '', $hidedeta
$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 ($reshook < 0)
{
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;
}

if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
Expand Down
Expand Up @@ -491,6 +491,11 @@ function write_file($object, $outputlangs = '', $srctemplatepath = '', $hidedeta
$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 ($reshook < 0)
{
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;
}

if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
Expand Down
Expand Up @@ -678,6 +678,11 @@ function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails =
$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 ($reshook < 0)
{
$this->error = $hookmanager->error;
$this->errors = $hookmanager->errors;
}

if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
Expand Down
28 changes: 0 additions & 28 deletions htdocs/datapolicy/class/actions_datapolicy.class.php
Expand Up @@ -319,34 +319,6 @@ function beforePDFCreation($parameters, &$object, &$action)
return $ret;
}

/**
* Execute action
*
* @param array $parameters Array of parameters
* @param Object $pdfhandler PDF builder handler
* @param string $action 'add', 'update', 'view'
* @return int <0 if KO,
* =0 if OK but we want to process standard actions too,
* >0 if OK and we want to replace standard actions.
*/
function afterPDFCreation($parameters, &$pdfhandler, &$action)
{
global $conf, $user, $langs;
global $hookmanager;

$outputlangs = $langs;

$ret = 0;
$deltemp = array();
dol_syslog(get_class($this) . '::executeHooks action=' . $action);

/* print_r($parameters); print_r($object); echo "action: " . $action; */
if (in_array($parameters['currentcontext'], array('somecontext1', 'somecontext2'))) { // do something only for the context 'somecontext1' or 'somecontext2'

}

return $ret;
}

/**
* addMoreActionsButtons
Expand Down

0 comments on commit 7625eb7

Please sign in to comment.