Commit a5206cb4 authored by Sebastian Kummer's avatar Sebastian Kummer

Merge pull request #502 in ZP/z-push from...

Merge pull request #502 in ZP/z-push from bugfix/ZP-1188-check-if-oof-expired-and-disabled to develop

* commit 'f9b61c2a':
  ZP-1188 Check if OOF expired and disabled it if needed.
  ZP-1188 Check if OOF expired and disabled it if needed.
parents b3a40500 f9b61c2a
...@@ -1737,8 +1737,17 @@ class BackendKopano implements IBackend, ISearchProvider { ...@@ -1737,8 +1737,17 @@ 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_setprops($this->defaultstore, array(PR_EC_OUTOFOFFICE => false));
@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