Commit 42f70c87 authored by Sebastian Kummer's avatar Sebastian Kummer

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

Merge pull request #176 in ZP/z-push from feature/ZP-844-support-out-of-office-start-and-end to develop

* commit '400f2c12':
  ZP-844 Support Out-Of-Office start and end times.
parents 6e7e6594 400f2c12
...@@ -1135,6 +1135,8 @@ define('PR_EC_BASE' , 0x6700); ...@@ -1135,6 +1135,8 @@ define('PR_EC_BASE' , 0x6700);
define('PR_EC_OUTOFOFFICE' ,mapi_prop_tag(PT_BOOLEAN, PR_EC_BASE+0x60)); define('PR_EC_OUTOFOFFICE' ,mapi_prop_tag(PT_BOOLEAN, PR_EC_BASE+0x60));
define('PR_EC_OUTOFOFFICE_MSG' ,mapi_prop_tag(PT_STRING8, PR_EC_BASE+0x61)); define('PR_EC_OUTOFOFFICE_MSG' ,mapi_prop_tag(PT_STRING8, PR_EC_BASE+0x61));
define('PR_EC_OUTOFOFFICE_SUBJECT' ,mapi_prop_tag(PT_STRING8, PR_EC_BASE+0x62)); define('PR_EC_OUTOFOFFICE_SUBJECT' ,mapi_prop_tag(PT_STRING8, PR_EC_BASE+0x62));
define('PR_EC_OUTOFOFFICE_FROM', mapi_prop_tag(PT_SYSTIME, PR_EC_BASE+0x63));
define('PR_EC_OUTOFOFFICE_UNTIL', mapi_prop_tag(PT_SYSTIME, PR_EC_BASE+0x64));
/* quota support */ /* quota support */
define('PR_QUOTA_WARNING_THRESHOLD' ,mapi_prop_tag(PT_LONG, PR_EC_BASE+0x21)); define('PR_QUOTA_WARNING_THRESHOLD' ,mapi_prop_tag(PT_LONG, PR_EC_BASE+0x21));
......
...@@ -1552,7 +1552,7 @@ class BackendZarafa implements IBackend, ISearchProvider { ...@@ -1552,7 +1552,7 @@ class BackendZarafa implements IBackend, ISearchProvider {
* @return void * @return void
*/ */
private function settingsOOFGEt(&$oof) { private function settingsOOFGEt(&$oof) {
$oofprops = mapi_getprops($this->defaultstore, array(PR_EC_OUTOFOFFICE, PR_EC_OUTOFOFFICE_MSG, PR_EC_OUTOFOFFICE_SUBJECT)); $oofprops = mapi_getprops($this->defaultstore, array(PR_EC_OUTOFOFFICE, PR_EC_OUTOFOFFICE_MSG, PR_EC_OUTOFOFFICE_SUBJECT, PR_EC_OUTOFOFFICE_FROM, PR_EC_OUTOFOFFICE_UNTIL));
$oof->oofstate = SYNC_SETTINGSOOF_DISABLED; $oof->oofstate = SYNC_SETTINGSOOF_DISABLED;
$oof->Status = SYNC_SETTINGSSTATUS_SUCCESS; $oof->Status = SYNC_SETTINGSSTATUS_SUCCESS;
if ($oofprops != false) { if ($oofprops != false) {
...@@ -1565,6 +1565,21 @@ class BackendZarafa implements IBackend, ISearchProvider { ...@@ -1565,6 +1565,21 @@ class BackendZarafa implements IBackend, ISearchProvider {
$oofmessage->bodytype = $oof->bodytype; $oofmessage->bodytype = $oof->bodytype;
unset($oofmessage->appliesToExternal, $oofmessage->appliesToExternalUnknown); unset($oofmessage->appliesToExternal, $oofmessage->appliesToExternalUnknown);
$oof->oofmessage[] = $oofmessage; $oof->oofmessage[] = $oofmessage;
// check whether time based out of office is set
if ($oof->oofstate == SYNC_SETTINGSOOF_GLOBAL) {
if (isset($oofprops[PR_EC_OUTOFOFFICE_FROM]) && isset($oofprops[PR_EC_OUTOFOFFICE_UNTIL]) && ($oofprops[PR_EC_OUTOFOFFICE_FROM] < $oofprops[PR_EC_OUTOFOFFICE_UNTIL]) ) {
$oof->oofstate = SYNC_SETTINGSOOF_TIMEBASED;
$oof->starttime = $oofprops[PR_EC_OUTOFOFFICE_FROM];
$oof->endtime = $oofprops[PR_EC_OUTOFOFFICE_UNTIL];
}
elseif (isset($oofprops[PR_EC_OUTOFOFFICE_FROM]) || isset($oofprops[PR_EC_OUTOFOFFICE_UNTIL]) || ($oofprops[PR_EC_OUTOFOFFICE_FROM] > $oofprops[PR_EC_OUTOFOFFICE_UNTIL])) {
ZLog::Write(LOGLEVEL_WARN, sprintf("Zarafa->settingsOOFGEt(): Time based out of office set but either start time ('%s') or end time ('%s') is missing or end time is before startime.",
(isset($oofprops[PR_EC_OUTOFOFFICE_FROM]) ? date("Y-m-d H:i:s", $oofprops[PR_EC_OUTOFOFFICE_FROM]) : 'empty'),
(isset($oofprops[PR_EC_OUTOFOFFICE_UNTIL]) ? date("Y-m-d H:i:s", $oofprops[PR_EC_OUTOFOFFICE_UNTIL]) : 'empty')));
$oof->Status = SYNC_SETTINGSSTATUS_PROTOCOLLERROR;
}
}
} }
else { else {
ZLog::Write(LOGLEVEL_WARN, "Unable to get out of office information"); ZLog::Write(LOGLEVEL_WARN, "Unable to get out of office information");
...@@ -1593,9 +1608,19 @@ class BackendZarafa implements IBackend, ISearchProvider { ...@@ -1593,9 +1608,19 @@ class BackendZarafa implements IBackend, ISearchProvider {
$props[PR_EC_OUTOFOFFICE_SUBJECT] = "Out of office"; $props[PR_EC_OUTOFOFFICE_SUBJECT] = "Out of office";
} }
} }
if ($oof->oofstate == SYNC_SETTINGSOOF_TIMEBASED) {
if(isset($oof->starttime) && isset($oof->endtime)) {
$props[PR_EC_OUTOFOFFICE_FROM] = $oof->starttime;
$props[PR_EC_OUTOFOFFICE_UNTIL] = $oof->endtime;
}
elseif (isset($oof->starttime) || isset($oof->endtime)) {
$oof->Status = SYNC_SETTINGSSTATUS_PROTOCOLLERROR;
}
}
} }
elseif($oof->oofstate == SYNC_SETTINGSOOF_DISABLED) { elseif($oof->oofstate == SYNC_SETTINGSOOF_DISABLED) {
$props[PR_EC_OUTOFOFFICE] = false; $props[PR_EC_OUTOFOFFICE] = false;
$deleteProps = array(PR_EC_OUTOFOFFICE_FROM, PR_EC_OUTOFOFFICE_UNTIL);
} }
if (!empty($props)) { if (!empty($props)) {
...@@ -1607,6 +1632,10 @@ class BackendZarafa implements IBackend, ISearchProvider { ...@@ -1607,6 +1632,10 @@ class BackendZarafa implements IBackend, ISearchProvider {
} }
} }
if (!empty($deleteProps)) {
@mapi_deleteprops($this->defaultstore, $deleteProps);
}
return true; return true;
} }
......
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