Commit e3d06d1e authored by Manfred Kutas's avatar Manfred Kutas

ZP-1188 Check if OOF expired and disabled it if needed.

Released under the Affero GNU General Public License (AGPL) version 3.
parent b3a40500
...@@ -1737,8 +1737,16 @@ class BackendKopano implements IBackend, ISearchProvider { ...@@ -1737,8 +1737,16 @@ class BackendKopano implements IBackend, ISearchProvider {
$oof->oofmessage[] = $oofmessage; $oof->oofmessage[] = $oofmessage;
// check whether time based out of office is set // check whether time based out of office is set
if ($oof->oofstate == SYNC_SETTINGSOOF_GLOBAL && isset($oofprops[PR_EC_OUTOFOFFICE_FROM]) && isset($oofprops[PR_EC_OUTOFOFFICE_UNTIL])) { if ($oof->oofstate == SYNC_SETTINGSOOF_GLOBAL && isset($oofprops[PR_EC_OUTOFOFFICE_FROM], $oofprops[PR_EC_OUTOFOFFICE_UNTIL])) {
if ($oofprops[PR_EC_OUTOFOFFICE_FROM] < $oofprops[PR_EC_OUTOFOFFICE_UNTIL]) { $now = time();
if ($now > $oofprops[PR_EC_OUTOFOFFICE_FROM] && $now > $oofprops[PR_EC_OUTOFOFFICE_UNTIL]) {
// Out of office is set but the date is in the past. Set the state to disabled.
// @see https://jira.z-hub.io/browse/ZP-1188 for details
$oof->oofstate = SYNC_SETTINGSOOF_DISABLED;
@mapi_deleteprops($this->defaultstore, array(PR_EC_OUTOFOFFICE_FROM, PR_EC_OUTOFOFFICE_UNTIL));
ZLog::Write(LOGLEVEL_INFO, "BackendKopano->settingsOofGet(): Out of office is set but the from and until are in the past. Disabling out of office.");
}
elseif ($oofprops[PR_EC_OUTOFOFFICE_FROM] < $oofprops[PR_EC_OUTOFOFFICE_UNTIL]) {
$oof->oofstate = SYNC_SETTINGSOOF_TIMEBASED; $oof->oofstate = SYNC_SETTINGSOOF_TIMEBASED;
$oof->starttime = $oofprops[PR_EC_OUTOFOFFICE_FROM]; $oof->starttime = $oofprops[PR_EC_OUTOFOFFICE_FROM];
$oof->endtime = $oofprops[PR_EC_OUTOFOFFICE_UNTIL]; $oof->endtime = $oofprops[PR_EC_OUTOFOFFICE_UNTIL];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment