mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-06 01:28:19 +01:00
NEW Can define the text on tooltip on a yesno check.
This commit is contained in:
@@ -2844,7 +2844,7 @@ while ($i < $imaxinloop) {
|
|||||||
if (!empty($arrayfields['c.facture']['checked'])) {
|
if (!empty($arrayfields['c.facture']['checked'])) {
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
if ($obj->billed) {
|
if ($obj->billed) {
|
||||||
print yn($obj->billed, 4);
|
print yn($obj->billed, $langs->trans("Billed"));
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (!$i) {
|
if (!$i) {
|
||||||
|
|||||||
@@ -7735,11 +7735,11 @@ function get_default_localtax($thirdparty_seller, $thirdparty_buyer, $local, $id
|
|||||||
* Return yes or no in current language
|
* Return yes or no in current language
|
||||||
*
|
*
|
||||||
* @param int<0, 1>|'yes'|'true'|'no'|'false' $yesno Value to test (1, 'yes', 'true' or 0, 'no', 'false')
|
* @param int<0, 1>|'yes'|'true'|'no'|'false' $yesno Value to test (1, 'yes', 'true' or 0, 'no', 'false')
|
||||||
* @param integer $case 1=Yes/No, 0=yes/no, 2=Disabled checkbox, 3=Disabled checkbox + Yes/No
|
* @param integer|string $format 1=Yes/No, 0=yes/no, 2=Disabled checkbox, 3=Disabled checkbox + Yes/No, 4 or Text=Use picto
|
||||||
* @param int $color 0=texte only, 1=Text is formatted with a color font style ('ok' or 'error'), 2=Text is formatted with 'ok' color.
|
* @param int $color 0=texte only, 1=Text is formatted with a color font style ('ok' or 'error'), 2=Text is formatted with 'ok' color.
|
||||||
* @return string HTML string
|
* @return string HTML string
|
||||||
*/
|
*/
|
||||||
function yn($yesno, $case = 1, $color = 0)
|
function yn($yesno, $format = 1, $color = 0)
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
@@ -7747,33 +7747,33 @@ function yn($yesno, $case = 1, $color = 0)
|
|||||||
$classname = '';
|
$classname = '';
|
||||||
if ($yesno == 1 || (isset($yesno) && (strtolower($yesno) == 'yes' || strtolower($yesno) == 'true'))) { // To set to 'no' before the test because of the '== 0'
|
if ($yesno == 1 || (isset($yesno) && (strtolower($yesno) == 'yes' || strtolower($yesno) == 'true'))) { // To set to 'no' before the test because of the '== 0'
|
||||||
$result = $langs->trans('yes');
|
$result = $langs->trans('yes');
|
||||||
if ($case == 1 || $case == 3) {
|
if ($format == 1 || $format == 3) {
|
||||||
$result = $langs->trans("Yes");
|
$result = $langs->trans("Yes");
|
||||||
}
|
}
|
||||||
if ($case == 2) {
|
if ($format == 2) {
|
||||||
$result = '<input type="checkbox" value="1" checked disabled>';
|
$result = '<input type="checkbox" value="1" checked disabled>';
|
||||||
}
|
}
|
||||||
if ($case == 3) {
|
if ($format == 3) {
|
||||||
$result = '<input type="checkbox" value="1" checked disabled> '.$result;
|
$result = '<input type="checkbox" value="1" checked disabled> '.$result;
|
||||||
}
|
}
|
||||||
if ($case == 4) {
|
if ($format == 4 || !is_numeric($format)) {
|
||||||
$result = img_picto('check', 'check');
|
$result = img_picto(is_numeric($format) ? '' : $format, 'check');
|
||||||
}
|
}
|
||||||
|
|
||||||
$classname = 'ok';
|
$classname = 'ok';
|
||||||
} elseif ($yesno == 0 || strtolower($yesno) == 'no' || strtolower($yesno) == 'false') {
|
} elseif ($yesno == 0 || strtolower($yesno) == 'no' || strtolower($yesno) == 'false') {
|
||||||
$result = $langs->trans("no");
|
$result = $langs->trans("no");
|
||||||
if ($case == 1 || $case == 3) {
|
if ($format == 1 || $format == 3) {
|
||||||
$result = $langs->trans("No");
|
$result = $langs->trans("No");
|
||||||
}
|
}
|
||||||
if ($case == 2) {
|
if ($format == 2) {
|
||||||
$result = '<input type="checkbox" value="0" disabled>';
|
$result = '<input type="checkbox" value="0" disabled>';
|
||||||
}
|
}
|
||||||
if ($case == 3) {
|
if ($format == 3) {
|
||||||
$result = '<input type="checkbox" value="0" disabled> '.$result;
|
$result = '<input type="checkbox" value="0" disabled> '.$result;
|
||||||
}
|
}
|
||||||
if ($case == 4) {
|
if ($format == 4 || !is_numeric($format)) {
|
||||||
$result = img_picto('uncheck', 'uncheck');
|
$result = img_picto(is_numeric($format) ? '' : $format, 'uncheck');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($color == 2) {
|
if ($color == 2) {
|
||||||
|
|||||||
Reference in New Issue
Block a user