Avoid some warnings caused by using foreach() over null

This commit is contained in:
nathangray 2020-03-11 09:25:24 -06:00
parent 625c3eb73c
commit 458a40c792
4 changed files with 24 additions and 21 deletions

View File

@ -465,10 +465,10 @@ class SharingBase extends LoggedInTest
$_SERVER['HTTP_HOST'] = 'localhost'; $_SERVER['HTTP_HOST'] = 'localhost';
$share = $this->createShare($path, $mode, $extra); $share = $this->createShare($path, $mode, $extra);
$link = Vfs\Sharing::share2link($share); $link = Vfs\Sharing::share2link($share);
echo __METHOD__ . " link: $link\n";
if(static::LOG_LEVEL) if(static::LOG_LEVEL)
{ {
echo __METHOD__ . " link: $link\n";
echo __METHOD__ . " share: " . array2string($share) . "\n"; echo __METHOD__ . " share: " . array2string($share) . "\n";
} }

View File

@ -12,8 +12,8 @@
*/ */
use EGroupware\Api; use EGroupware\Api;
use EGroupware\Api\Link;
use EGroupware\Api\Acl; use EGroupware\Api\Acl;
use EGroupware\Api\Link;
if (!defined('ACL_TYPE_IDENTIFER')) // used to mark ACL-values for the debug_message methode if (!defined('ACL_TYPE_IDENTIFER')) // used to mark ACL-values for the debug_message methode
{ {
@ -417,7 +417,7 @@ class calendar_bo
function enum_groups(&$event) function enum_groups(&$event)
{ {
$added = 0; $added = 0;
foreach(array_keys($event['participants']) as $uid) foreach (array_keys((array)$event['participants']) as $uid)
{ {
if (is_numeric($uid) && $GLOBALS['egw']->accounts->get_type($uid) == 'g' && if (is_numeric($uid) && $GLOBALS['egw']->accounts->get_type($uid) == 'g' &&
($members = $GLOBALS['egw']->accounts->members($uid, true))) ($members = $GLOBALS['egw']->accounts->members($uid, true)))

View File

@ -12,8 +12,8 @@
*/ */
use EGroupware\Api; use EGroupware\Api;
use EGroupware\Api\Link;
use EGroupware\Api\Acl; use EGroupware\Api\Acl;
use EGroupware\Api\Link;
// types of messsages send by calendar_boupdate::send_update // types of messsages send by calendar_boupdate::send_update
define('MSG_DELETED',0); define('MSG_DELETED',0);
@ -547,7 +547,7 @@ class calendar_boupdate extends calendar_bo
//echo "<p>calendar_boupdate::check4update() new participants = ".print_r($new_event['participants'],true).", old participants =".print_r($old_event['participants'],true)."</p>\n"; //echo "<p>calendar_boupdate::check4update() new participants = ".print_r($new_event['participants'],true).", old participants =".print_r($old_event['participants'],true)."</p>\n";
// Find modified and deleted participants ... // Find modified and deleted participants ...
foreach($old_event['participants'] as $old_userid => $old_status) foreach ((array)$old_event['participants'] as $old_userid => $old_status)
{ {
if (isset($new_event['participants'][$old_userid])) if (isset($new_event['participants'][$old_userid]))
{ {

View File

@ -11,8 +11,8 @@
*/ */
use EGroupware\Api; use EGroupware\Api;
use EGroupware\Api\Link;
use EGroupware\Api\Acl; use EGroupware\Api\Acl;
use EGroupware\Api\Link;
include_once(EGW_INCLUDE_ROOT.'/projectmanager/inc/class.datasource.inc.php'); include_once(EGW_INCLUDE_ROOT.'/projectmanager/inc/class.datasource.inc.php');
@ -95,11 +95,14 @@ class calendar_datasource extends datasource
if (!is_array($this->pm_config)) if (!is_array($this->pm_config))
{ {
$this->pm_config = Api\Config::read('projectmanager'); $this->pm_config = Api\Config::read('projectmanager');
if (!$this->pm_config['hours_per_workday']) $this->pm_config['hours_per_workday'] = 8; if (!$this->pm_config['hours_per_workday'])
{
$this->pm_config['hours_per_workday'] = 8;
}
} }
$ds['pe_planned_time'] -= $nights * 60 * (24 - $this->pm_config['hours_per_workday']); $ds['pe_planned_time'] -= $nights * 60 * (24 - $this->pm_config['hours_per_workday']);
} }
foreach($data['participants'] as $uid => $status) foreach ((array)$data['participants'] as $uid => $status)
{ {
if ($status != 'R' && is_numeric($uid)) // only users for now if ($status != 'R' && is_numeric($uid)) // only users for now
{ {