From fc983fa65c63ab1116f05ba3a77e25fc9f4cb826 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 1 Apr 2019 18:46:13 +0200 Subject: [PATCH] Move a function into functions2.lib.php --- htdocs/core/lib/functions.lib.php | 35 ------------------------------ htdocs/core/lib/functions2.lib.php | 35 ++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 22ee559f700..916e46c6ab5 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5212,41 +5212,6 @@ function yn($yesno, $case = 1, $color = 0) return $result; } -/** - * Return automatic or manual in current language - * - * @param string $automaticmanual Value to test (1, 'automatic', 'true' or 0, 'manual', 'false') - * @param integer $case 1=Yes/No, 0=yes/no, 2=Disabled checkbox, 3=Disabled checkbox + Automatic/Manual - * @param int $color 0=texte only, 1=Text is formated with a color font style ('ok' or 'error'), 2=Text is formated with 'ok' color. - * @return string HTML string - */ -function am($automaticmanual, $case = 1, $color = 0) -{ - global $langs; - $result='unknown'; $classname=''; - if ($automaticmanual == 1 || strtolower($automaticmanual) == 'automatic' || strtolower($automaticmanual) == 'true') // A mettre avant test sur no a cause du == 0 - { - $result=$langs->trans('automatic'); - if ($case == 1 || $case == 3) $result=$langs->trans("Automatic"); - if ($case == 2) $result=''; - if ($case == 3) $result=' '.$result; - - $classname='ok'; - } - elseif ($yesno == 0 || strtolower($automaticmanual) == 'manual' || strtolower($automaticmanual) == 'false') - { - $result=$langs->trans("manual"); - if ($case == 1 || $case == 3) $result=$langs->trans("Manual"); - if ($case == 2) $result=''; - if ($case == 3) $result=' '.$result; - - if ($color == 2) $classname='ok'; - else $classname='error'; - } - if ($color) return ''.$result.''; - return $result; -} - /** * Return a path to have a the directory according to object where files are stored. * New usage: $conf->module->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 1, $object, $modulepart) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 118fab5ebe6..616f0bed7db 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -2437,3 +2437,38 @@ function random_color($min = 0, $max = 255) { return random_color_part($min, $max) . random_color_part($min, $max) . random_color_part($min, $max); } + +/** + * Return automatic or manual in current language + * + * @param string $automaticmanual Value to test (1, 'automatic', 'true' or 0, 'manual', 'false') + * @param integer $case 1=Yes/No, 0=yes/no, 2=Disabled checkbox, 3=Disabled checkbox + Automatic/Manual + * @param int $color 0=texte only, 1=Text is formated with a color font style ('ok' or 'error'), 2=Text is formated with 'ok' color. + * @return string HTML string + */ +function autoOrMamual($automaticmanual, $case = 1, $color = 0) +{ + global $langs; + $result='unknown'; $classname=''; + if ($automaticmanual == 1 || strtolower($automaticmanual) == 'automatic' || strtolower($automaticmanual) == 'true') // A mettre avant test sur no a cause du == 0 + { + $result=$langs->trans('automatic'); + if ($case == 1 || $case == 3) $result=$langs->trans("Automatic"); + if ($case == 2) $result=''; + if ($case == 3) $result=' '.$result; + + $classname='ok'; + } + elseif ($yesno == 0 || strtolower($automaticmanual) == 'manual' || strtolower($automaticmanual) == 'false') + { + $result=$langs->trans("manual"); + if ($case == 1 || $case == 3) $result=$langs->trans("Manual"); + if ($case == 2) $result=''; + if ($case == 3) $result=' '.$result; + + if ($color == 2) $classname='ok'; + else $classname='error'; + } + if ($color) return ''.$result.''; + return $result; +}