Unreachable else statement removed, move some conditions to reduce indentation and improve code readability
This commit is contained in:
parent
6d21fd1c46
commit
26eb4729f4
@ -5466,7 +5466,10 @@ abstract class CommonObject
|
|||||||
$parameters = array('modelspath'=>$modelspath, 'modele'=>$modele, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'hidedesc'=>$hidedesc, 'hideref'=>$hideref, 'moreparams'=>$moreparams);
|
$parameters = array('modelspath'=>$modelspath, 'modele'=>$modele, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'hidedesc'=>$hidedesc, 'hideref'=>$hideref, 'moreparams'=>$moreparams);
|
||||||
$reshook = $hookmanager->executeHooks('commonGenerateDocument', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
$reshook = $hookmanager->executeHooks('commonGenerateDocument', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
|
||||||
if (empty($reshook)) {
|
if (!empty($reshook)) {
|
||||||
|
return $reshook;
|
||||||
|
}
|
||||||
|
|
||||||
dol_syslog("commonGenerateDocument modele=".$modele." outputlangs->defaultlang=".(is_object($outputlangs) ? $outputlangs->defaultlang : 'null'));
|
dol_syslog("commonGenerateDocument modele=".$modele." outputlangs->defaultlang=".(is_object($outputlangs) ? $outputlangs->defaultlang : 'null'));
|
||||||
|
|
||||||
if (empty($modele)) {
|
if (empty($modele)) {
|
||||||
@ -5518,8 +5521,14 @@ abstract class CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$filefound) {
|
||||||
|
$this->error = $langs->trans("Error").' Failed to load doc generator with modelpaths='.$modelspath.' - modele='.$modele;
|
||||||
|
$this->errors[] = $this->error;
|
||||||
|
dol_syslog($this->error, LOG_ERR);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
// If generator was found
|
// If generator was found
|
||||||
if ($filefound) {
|
|
||||||
global $db; // Required to solve a conception default making an include of code using $db instead of $this->db just after.
|
global $db; // Required to solve a conception default making an include of code using $db instead of $this->db just after.
|
||||||
|
|
||||||
require_once $file;
|
require_once $file;
|
||||||
@ -5617,21 +5626,6 @@ abstract class CommonObject
|
|||||||
dol_syslog("Error generating document for ".__CLASS__.". Error: ".$obj->error, LOG_ERR);
|
dol_syslog("Error generating document for ".__CLASS__.". Error: ".$obj->error, LOG_ERR);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
if (!$filefound) {
|
|
||||||
$this->error = $langs->trans("Error").' Failed to load doc generator with modelpaths='.$modelspath.' - modele='.$modele;
|
|
||||||
$this->errors[] = $this->error;
|
|
||||||
dol_syslog($this->error, LOG_ERR);
|
|
||||||
} else {
|
|
||||||
$this->error = $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists", $filefound);
|
|
||||||
$this->errors[] = $this->error;
|
|
||||||
dol_syslog($this->error, LOG_ERR);
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return $reshook;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user