Merge remote-tracking branch 'upstream/3.0.1.7' into 3.0.1.7-Gmail

This commit is contained in:
Dante
2015-12-04 11:41:17 -04:00
22 changed files with 259 additions and 71 deletions

View File

@@ -458,8 +458,8 @@ class Consolidated
$dataTask = $oDyna->load($dyn_uid);
if ($dataTask['DYN_VERSION'] > 0) {
G::LoadClass("pmDynaform");
$pmDyna = new \pmDynaform(array('APP_DATA' => array()));
$pmDyna->fields["CURRENT_DYNAFORM"] = $dyn_uid;
$_SESSION['PROCESS'] = $pro_uid;
$pmDyna = new \pmDynaform(array('APP_DATA' => array(), "CURRENT_DYNAFORM" => $dyn_uid));
$json = G::json_decode($dataTask["DYN_CONTENT"]);
$pmDyna->jsonr($json);
$fieldsDyna = $json->items[0]->items;

View File

@@ -147,7 +147,8 @@ class NotificationDevice
* @author Ronald Quenta <ronald.quenta@processmaker.com>
*
*/
public function routeCaseNotification($currentUserId, $processId, $currentTaskId, $appFields, $aTasks, $nextIndex)
public function routeCaseNotification($currentUserId, $processId, $currentTaskId, $appFields, $aTasks,
$nextIndex, $currentDelIndex)
{
try {
$response = array();
@@ -166,7 +167,7 @@ class NotificationDevice
$delIndex = null;
foreach ($nextIndex as $nIndex) {
if($aTask['TAS_UID'] == $nIndex['TAS_UID']){
if ($aTask['TAS_UID'] == $nIndex['TAS_UID']) {
$delIndex = $nIndex['DEL_INDEX'];
break;
}
@@ -184,10 +185,9 @@ class NotificationDevice
);
if ($userIds) {
$oNoti = new \NotificationDevice();
$devices = array();
if (is_array($userIds)){
if (is_array($userIds)) {
$devices = $oNoti->loadUsersArrayId($userIds);
} else {
$devices = $oNoti->loadByUsersId($userIds);
@@ -210,13 +210,15 @@ class NotificationDevice
break;
}
}
if (count($devicesAppleIds) > 0) {
$isExistNextNotifications = $oNoti->isExistNextNotification($appFields['APP_UID'],
$currentDelIndex);
if (count($devicesAppleIds) > 0 && $isExistNextNotifications) {
$oNotification = new PushMessageIOS();
$oNotification->setSettingNotification();
$oNotification->setDevices($devicesAppleIds);
$response['apple'] = $oNotification->send($message, $data);
}
if (count($devicesAndroidIds) > 0) {
if (count($devicesAndroidIds) > 0 && $isExistNextNotifications) {
$oNotification = new PushMessageAndroid();
$oNotification->setSettingNotification();
$oNotification->setDevices($devicesAndroidIds);

View File

@@ -112,7 +112,7 @@ class PushMessageIOS
$fp = stream_socket_client($this->url, $err, $errstr, 60, STREAM_CLIENT_CONNECT | STREAM_CLIENT_PERSISTENT, $ctx);
if (!$fp) {
throw (new \Exception( G::LoadTranslation( 'ID_FAILED' ).': ' ."$err $errstr"));
throw (new \Exception( \G::LoadTranslation( 'ID_FAILED' ).': ' ."$err $errstr"));
} else {
//echo 'Apple service is online. ' . '<br />';
}

View File

@@ -30,24 +30,33 @@ class DateTime
/**
* Get Time Zone ID by Time Zone Offset
*
* @param int $offset Time Zone Offset
* @param int $offset Time Zone Offset
* @param bool $flagAllResults Flag which sets include all the results
*
* @return string Return the Time Zone ID; UTC ID otherwise
* @return mixed Return the Time Zone ID; UTC ID otherwise
*/
public function getTimeZoneIdByTimeZoneOffset($offset)
public function getTimeZoneIdByTimeZoneOffset($offset, $flagAllResults = true)
{
try {
$timeZoneId = ($flagAllResults)? [] : '';
foreach (\DateTimeZone::listIdentifiers() as $value) {
$timeZoneOffset = $this->getTimeZoneOffsetByTimeZoneId($value);
if ($timeZoneOffset !== false && $timeZoneOffset == $offset) {
//Return
return $value;
if ($flagAllResults) {
$timeZoneId[] = $value;
} else {
$timeZoneId = $value;
break;
}
}
}
$timeZoneId = (!empty($timeZoneId))? $timeZoneId : (($flagAllResults)? ['UTC'] : 'UTC');
//Return
return 'UTC';
return $timeZoneId;
} catch (\Exception $e) {
throw $e;
}
@@ -75,7 +84,31 @@ class DateTime
$offset = (($sign == '+')? '' : '-') . (($h * 60 * 60) + ($m * 60)); //Convert UTC Offset to seconds
//Return
return $this->getTimeZoneIdByTimeZoneOffset((int)($offset));
return $this->getTimeZoneIdByTimeZoneOffset((int)($offset), false);
} catch (\Exception $e) {
throw $e;
}
}
/**
* Get UTC Offset by Time Zone Offset
*
* @param int $offset Time Zone Offset
*
* @return string Return the UTC Offset
*/
public function getUtcOffsetByTimeZoneOffset($offset)
{
try {
$sign = ($offset >= 0)? '+' : '-';
$offset = abs($offset) / 60; //Convert seconds to minutes
$h = floor($offset / 60);
$m = $offset - ($h * 60);
//Return
return $sign . sprintf('%02d:%02d', $h, $m);
} catch (\Exception $e) {
throw $e;
}