Fixing style errors.

This commit is contained in:
stickler-ci 2021-10-24 00:17:18 +00:00
parent fdcb9674d8
commit 61576dad53

View File

@ -19,7 +19,8 @@
/** /**
* This class help you create setup render * This class help you create setup render
*/ */
class formSetup{ class formSetup
{
/** /**
* @var DoliDB Database handler. * @var DoliDB Database handler.
@ -50,8 +51,7 @@ class formSetup{
if ($outputLangs) { if ($outputLangs) {
$this->langs = $outputLangs; $this->langs = $outputLangs;
} } else {
else{
$this->langs = $langs; $this->langs = $langs;
} }
} }
@ -59,7 +59,8 @@ class formSetup{
/** /**
* @return string * @return string
*/ */
public function generateOutput($edit = false){ public function generateOutput($edit = false)
{
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
@ -82,7 +83,8 @@ class formSetup{
* @param bool $edit * @param bool $edit
* @return string * @return string
*/ */
public function generateLineOutput($item, $edit = false){ public function generateLineOutput($item, $edit = false)
{
$out = ''; $out = '';
if ($item->enabled==1) { if ($item->enabled==1) {
@ -99,8 +101,7 @@ class formSetup{
if ($edit) { if ($edit) {
$out.= $item->generateInputField(); $out.= $item->generateInputField();
} } else {
else{
$out.= $item->generateOutputField(); $out.= $item->generateOutputField();
} }
@ -122,7 +123,8 @@ class formSetup{
* @param array $params * @param array $params
* @ * @
*/ */
public function addItemsFromParamsArray($params){ public function addItemsFromParamsArray($params)
{
if (!array($params)) { return false; } if (!array($params)) { return false; }
foreach ($params as $confKey => $param) { foreach ($params as $confKey => $param) {
@ -136,7 +138,8 @@ class formSetup{
* @param string $confKey * @param string $confKey
* @param array $params * @param array $params
*/ */
public function addItemFromParams($confKey, $params){ public function addItemFromParams($confKey, $params)
{
if (empty($confKey) || empty($params['type'])) { return false; } if (empty($confKey) || empty($params['type'])) { return false; }
@ -168,7 +171,6 @@ class formSetup{
return true; return true;
} }
} }
@ -226,17 +228,20 @@ class formSetupItem
$this->confKey = $confKey; $this->confKey = $confKey;
} }
public function getHelpText(){ public function getHelpText()
{
if (!empty($this->helpText)) { return $this->helpText; } if (!empty($this->helpText)) { return $this->helpText; }
return (($this->langs->trans($this->confKey . 'Tooltip') != $this->confKey . 'Tooltip') ? $this->langs->trans($this->confKey . 'Tooltip') : ''); return (($this->langs->trans($this->confKey . 'Tooltip') != $this->confKey . 'Tooltip') ? $this->langs->trans($this->confKey . 'Tooltip') : '');
} }
public function getNameText(){ public function getNameText()
{
if (!empty($this->nameText)) { return $this->nameText; } if (!empty($this->nameText)) { return $this->nameText; }
return (($this->langs->trans($this->confKey) != $this->confKey) ? $this->langs->trans($this->confKey) : $this->langs->trans('MissingTranslationForConfKey', $this->confKey)); return (($this->langs->trans($this->confKey) != $this->confKey) ? $this->langs->trans($this->confKey) : $this->langs->trans('MissingTranslationForConfKey', $this->confKey));
} }
public function generateInputField(){ public function generateInputField()
{
global $conf, $user; global $conf, $user;
if (!empty($this->fieldOverride)) { if (!empty($this->fieldOverride)) {
@ -324,20 +329,21 @@ class formSetupItem
* add error * add error
* @param array|string $errors * @param array|string $errors
*/ */
public function setErrors($errors){ public function setErrors($errors)
{
if (is_array($errors)) { if (is_array($errors)) {
if (!empty($errors)) { if (!empty($errors)) {
foreach ($errors as $error) { foreach ($errors as $error) {
$this->setErrors($error); $this->setErrors($error);
} }
} }
} } elseif (!empty($errors)) {
elseif(!empty($errors)){
$this->errors[] = $errors; $this->errors[] = $errors;
} }
} }
public function generateOutputField(){ public function generateOutputField()
{
global $conf, $user; global $conf, $user;
if (!empty($this->fieldOverride)) { if (!empty($this->fieldOverride)) {
@ -399,5 +405,4 @@ class formSetupItem
return $out; return $out;
} }
} }