Merge pull request #13901 from atm-maxime/fix_cron_globals
Fix cron globals reload, missing mysoc and langs
This commit is contained in:
commit
ca14f9a0fa
@ -191,11 +191,12 @@ if (is_array($qualifiedjobs) && (count($qualifiedjobs)>0))
|
|||||||
// Force reload of setup for the current entity
|
// Force reload of setup for the current entity
|
||||||
if ($line->entity != $conf->entity)
|
if ($line->entity != $conf->entity)
|
||||||
{
|
{
|
||||||
dol_syslog("cron_run_jobs.php we work on another entity so we reload user and conf", LOG_DEBUG);
|
dol_syslog("cron_run_jobs.php we work on another entity so we reload mysoc, langs, user and conf", LOG_DEBUG);
|
||||||
echo " -> we change entity so we reload user and conf";
|
echo " -> we change entity so we reload mysoc, langs, user and conf";
|
||||||
|
|
||||||
$conf->entity = (empty($line->entity)?1:$line->entity);
|
$conf->entity = (empty($line->entity)?1:$line->entity);
|
||||||
$conf->setValues($db); // This make also the $mc->setValues($conf); that reload $mc->sharings
|
$conf->setValues($db); // This make also the $mc->setValues($conf); that reload $mc->sharings
|
||||||
|
$mysoc->setMysoc($conf);
|
||||||
|
|
||||||
// Force recheck that user is ok for the entity to process and reload permission for entity
|
// Force recheck that user is ok for the entity to process and reload permission for entity
|
||||||
if ($conf->entity != $user->entity && $user->entity != 0)
|
if ($conf->entity != $user->entity && $user->entity != 0)
|
||||||
@ -218,6 +219,11 @@ if (is_array($qualifiedjobs) && (count($qualifiedjobs)>0))
|
|||||||
}
|
}
|
||||||
$user->getrights();
|
$user->getrights();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reload langs
|
||||||
|
$langcode = (empty($conf->global->MAIN_LANG_DEFAULT)?'auto':$conf->global->MAIN_LANG_DEFAULT);
|
||||||
|
if (! empty($user->conf->MAIN_LANG_DEFAULT)) $langcode = $user->conf->MAIN_LANG_DEFAULT;
|
||||||
|
if ($langs->getDefaultLang() != $langcode) $langs->setDefaultLang($langcode);
|
||||||
}
|
}
|
||||||
|
|
||||||
//If date_next_jobs is less of current date, execute the program, and store the execution time of the next execution in database
|
//If date_next_jobs is less of current date, execute the program, and store the execution time of the next execution in database
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user