mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-27 08:19:45 +01:00
Get rid of a bunch of warnings in Entry & subclasses
This commit is contained in:
parent
27bf68f66b
commit
8ed5c2aa7e
@ -78,13 +78,13 @@ class Contact extends Entry
|
||||
'__default__' => array(
|
||||
'options' => array(
|
||||
'bday' => array('type' => 'date', 'options' => 'Y-m-d'),
|
||||
'owner' => array('type' => 'select-account', 'options' => ''),
|
||||
'modifier' => array('type' => 'select-account', 'options' => ''),
|
||||
'creator' => array('type' => 'select-account', 'options' => ''),
|
||||
'modifed' => array('type' => 'date-time', 'options' => ''),
|
||||
'created' => array('type' => 'date-time', 'options' => ''),
|
||||
'cat_id' => array('type' => 'select-cat', 'options' => ''),
|
||||
'__default__' => array('type' => 'label', 'options' => ''),
|
||||
'owner' => array('type' => 'select-account'),
|
||||
'modifier' => array('type' => 'select-account'),
|
||||
'creator' => array('type' => 'select-account'),
|
||||
'modifed' => array('type' => 'date-time'),
|
||||
'created' => array('type' => 'date-time'),
|
||||
'cat_id' => array('type' => 'select-cat'),
|
||||
'__default__' => array('type' => 'label'),
|
||||
),
|
||||
'noLang' => true,
|
||||
),
|
||||
|
@ -69,7 +69,7 @@ abstract class Entry extends Transformer
|
||||
|
||||
$form_name = self::form_name($cname, $this->id);
|
||||
$prefixed_id = (substr($this->id, 0, 1) == self::ID_PREFIX ? $this->id : self::ID_PREFIX . $this->id);
|
||||
$data_id = $attrs['value'] ? self::form_name($cname, $attrs['value']) : self::form_name($cname, $prefixed_id);
|
||||
$data_id = !empty($attrs['value']) ? self::form_name($cname, $attrs['value']) : self::form_name($cname, $prefixed_id);
|
||||
|
||||
// No need to proceed
|
||||
if(!$data_id) return;
|
||||
@ -151,9 +151,9 @@ abstract class Entry extends Transformer
|
||||
$value =& $data;
|
||||
if(!is_array($value)) return $value;
|
||||
|
||||
foreach(array($attrs['field']) + explode(':',$attrs['alternate_fields']) as $field)
|
||||
foreach(array($attrs['field']) + explode(':', ($attrs['alternate_fields'] ?? '')) as $field)
|
||||
{
|
||||
if($value[$field])
|
||||
if(!empty($value[$field]))
|
||||
{
|
||||
return $value[$field];
|
||||
}
|
||||
@ -175,12 +175,12 @@ abstract class Entry extends Transformer
|
||||
*/
|
||||
protected function customfield($attrs, &$data)
|
||||
{
|
||||
list($app, $type) = explode('-',$attrs['type']);
|
||||
$data_id = $attrs['value'] ?: $attrs['id'];
|
||||
list($app, $type) = explode('-', $attrs['type']);
|
||||
$data_id = isset($attrs['value']) ? $attrs['value'] : $attrs['id'];
|
||||
$id = is_array($data) ? static::get_array($data, $data_id) : $data;
|
||||
if(!$app || !$type || !$GLOBALS['egw_info']['apps'][$app] || !$id ||
|
||||
// Simple CF, already there
|
||||
$data[$attrs['field']]
|
||||
isset($data[$attrs['field']])
|
||||
)
|
||||
{
|
||||
return;
|
||||
@ -194,7 +194,7 @@ abstract class Entry extends Transformer
|
||||
$merge = new $classname();
|
||||
$replacement_field = '$$'.$attrs['field'].'$$';
|
||||
$replacements = $merge->get_app_replacements($app, $id, $replacement_field);
|
||||
$data[$attrs['field']] = $replacements[$replacement_field];
|
||||
$data[$attrs['field']] = $replacements[$replacement_field] ?? '';
|
||||
}
|
||||
catch(\Exception $e)
|
||||
{
|
||||
@ -212,7 +212,7 @@ abstract class Entry extends Transformer
|
||||
protected function regex($attrs, &$data)
|
||||
{
|
||||
$value =& $this->get_data_field($attrs, $data);
|
||||
if(!$attrs['regex'] || !$value)
|
||||
if(!isset($attrs['regex']) || !$value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -219,15 +219,18 @@ abstract class Transformer extends Etemplate\Widget
|
||||
elseif(is_array($action))
|
||||
{
|
||||
// case matches --> run all actions
|
||||
if (isset($action[$attrs[$attr]]) || !isset($action[$attrs[$attr]]) && isset($action['__default__']))
|
||||
if(isset($attrs[$attr]) && isset($action[$attrs[$attr]]) || (!isset($attrs[$attr]) || !isset($action[$attrs[$attr]])) && isset($action['__default__']))
|
||||
{
|
||||
$actions = isset($action[$attrs[$attr]]) ? $action[$attrs[$attr]] : $action['__default__'];
|
||||
$actions = isset($attrs[$attr]) && isset($action[$attrs[$attr]]) ? $action[$attrs[$attr]] : $action['__default__'];
|
||||
if(!is_array($actions))
|
||||
{
|
||||
$attrs[$attr] = $actions;
|
||||
$actions = array($attr => $actions);
|
||||
}
|
||||
if (self::DEBUG) error_log(__METHOD__."(attr='$attr', action=".array2string($action).") attrs['$attr']=='{$attrs[$attr]}' --> running actions");
|
||||
if(self::DEBUG)
|
||||
{
|
||||
error_log(__METHOD__ . "(attr='$attr', action=" . array2string($action) . ") attrs['$attr']=='{$attrs[$attr]}' --> running actions");
|
||||
}
|
||||
foreach($actions as $attr => $action)
|
||||
{
|
||||
$this->action($attr, $action, $attrs);
|
||||
|
Loading…
Reference in New Issue
Block a user