2
0
forked from Wavyzz/dolibarr
This commit is contained in:
Laurent Destailleur
2022-12-09 15:57:18 +01:00
parent 91f5fe1320
commit a07193ef4b
3 changed files with 46 additions and 15 deletions

View File

@@ -279,13 +279,13 @@ while ($i <= $MAXAGENDA) {
print '</td>';
// Calendar active by default
print '<td class="nowrap right">';
if ($conf->use_javascript_ajax) {
if (!empty($conf->use_javascript_ajax)) {
print ajax_constantonoff('AGENDA_EXT_ACTIVEBYDEFAULT' . $key);
} else {
if (empty($conf->global->{$default})) {
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=set_AGENDA_EXT_ACTIVEBYDEFAULT' . $key . '&token='.newToken().'">' . img_picto($langs->trans("Enabled"), 'on') . '</a>';
} else {
if (getDolGlobalString($default)) {
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=del_AGENDA_EXT_ACTIVEBYDEFAULT' . $key . '&token='.newToken().'">' . img_picto($langs->trans("Disabled"), 'off') . '</a>';
} else {
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=set_AGENDA_EXT_ACTIVEBYDEFAULT' . $key . '&token='.newToken().'">' . img_picto($langs->trans("Enabled"), 'on') . '</a>';
}
}
print '</td>';

View File

@@ -274,7 +274,7 @@ if (empty($conf->global->AGENDA_DISABLE_EXT)) {
$color = 'AGENDA_EXT_COLOR'.$i;
$default = 'AGENDA_EXT_ACTIVEBYDEFAULT'.$i;
$buggedfile = 'AGENDA_EXT_BUGGEDFILE'.$i;
if (!empty($conf->global->$source) && !empty($conf->global->$name)) {
if (getDolGlobalString($source) && getDolGlobalString($name)) {
// Note: $conf->global->buggedfile can be empty or 'uselocalandtznodaylight' or 'uselocalandtzdaylight'
$listofextcals[] = array(
'src' => getDolGlobalString($source),
@@ -299,14 +299,14 @@ if (empty($user->conf->AGENDA_DISABLE_EXT)) {
$enabled = 'AGENDA_EXT_ENABLED_'.$user->id.'_'.$i;
$default = 'AGENDA_EXT_ACTIVEBYDEFAULT_'.$user->id.'_'.$i;
$buggedfile = 'AGENDA_EXT_BUGGEDFILE_'.$user->id.'_'.$i;
if (!empty($user->conf->$source) && !empty($user->conf->$name)) {
if (getDolUserString($source) && getDolUserString($name)) {
// Note: $conf->global->buggedfile can be empty or 'uselocalandtznodaylight' or 'uselocalandtzdaylight'
$listofextcals[] = array(
'src' => $user->conf->$source,
'name' => dol_string_nohtmltag($user->conf->$name),
'src' => getDolUserString($source),
'name' => dol_string_nohtmltag(getDolUserString($name)),
'offsettz' => (int) (empty($user->conf->$offsettz) ? 0 : $user->conf->$offsettz),
'color' => dol_string_nohtmltag($user->conf->$color),
'default' => dol_string_nohtmltag($user->conf->$default),
'color' => dol_string_nohtmltag(getDolUserString($color)),
'default' => dol_string_nohtmltag(getDolUserString($default)),
'buggedfile' => dol_string_nohtmltag(isset($user->conf->buggedfile) ? $user->conf->buggedfile : '')
);
}
@@ -1287,7 +1287,7 @@ if (count($listofextcals)) {
}
// Transparency (see https://www.kanzaki.com/docs/ical/transp.html)
if ($icalevent['TRANSP']) {
if (!empty($icalevent['TRANSP'])) {
if ($icalevent['TRANSP'] == "TRANSPARENT") {
$event->transparency = 0; // 0 = available / free
}

View File

@@ -73,6 +73,7 @@ if (!function_exists('utf8_decode')) {
/**
* Return dolibarr global constant string value
*
* @param string $key key to return value, return '' if not set
* @param string $default value to return
* @return string
@@ -86,6 +87,7 @@ function getDolGlobalString($key, $default = '')
/**
* Return dolibarr global constant int value
*
* @param string $key key to return value, return 0 if not set
* @param int $default value to return
* @return int
@@ -97,8 +99,37 @@ function getDolGlobalInt($key, $default = 0)
return (int) (empty($conf->global->$key) ? $default : $conf->global->$key);
}
/**
* Return dolibarr user constant string value
*
* @param string $key key to return value, return '' if not set
* @param string $default value to return
* @return string
*/
function getDolUserString($key, $default = '')
{
global $user;
// return $conf->global->$key ?? $default;
return (string) (empty($user->conf->$key) ? $default : $user->conf->$key);
}
/**
* Return dolibarr user constant int value
*
* @param string $key key to return value, return 0 if not set
* @param int $default value to return
* @return int
*/
function getDolUserInt($key, $default = 0)
{
global $user;
// return $conf->global->$key ?? $default;
return (int) (empty($user->conf->$key) ? $default : $user->conf->$key);
}
/**
* Is Dolibarr module enabled
*
* @param string $module module name to check
* @return int
*/