Merge branch 'master' into web-components

This commit is contained in:
nathan 2021-11-08 09:23:48 -07:00
commit f4ad6c6dbc
7 changed files with 45 additions and 19 deletions

View File

@ -291,7 +291,7 @@ class admin_config
// make everything readonly and remove save/apply button, if user has not rights to store config
if ($GLOBALS['egw']->acl->check('site_config_acce',2,'admin'))
{
$readonlys[__ALL__] = true;
$readonlys['__ALL__'] = true;
$readonlys['cancel'] = false;
}

View File

@ -612,6 +612,20 @@ class Accounts
$account['account_firstname'] , $account['account_lastname'], $account_id);
}
/**
* Return formatted username for Links, does NOT throw if $account_id is not int
*
* @param $account_id
*/
static function title($account_id)
{
if (empty($account_id) || !is_numeric($account_id) && !($id = self::getInstance()->name2id($account_id)))
{
return '#'.$account_id;
}
return self::username($id ?? $account_id);
}
/**
* Format an email address according to the system standard
*

View File

@ -154,7 +154,7 @@ class Link extends Link\Storage
'name' => 'Accounts',
'icon' => 'addressbook/accounts',
'query' => 'EGroupware\\Api\\Accounts::link_query',
'title' => 'EGroupware\\Api\\Accounts::username',
'title' => 'EGroupware\\Api\\Accounts::title',
'view' => array('menuaction'=>'addressbook.addressbook_ui.view','ajax'=>'true'),
'view_id' => 'account_id'
),
@ -914,7 +914,12 @@ class Link extends Link\Storage
}
else
{
$title = self::title($app,$id); // no titles method --> fallback to query each link separate
try {
$title = self::title($app, $id); // no titles method --> fallback to query each link separate
}
catch (\Throwable $e) {
$title = lang('Error').': '.$e->getMessage();
}
}
}
$titles[$id] = $title;

View File

@ -396,7 +396,7 @@ class Sharing
$class = strpos($status, '404') === 0 ? 'EGroupware\Api\Exception\NotFound' :
(strpos($status, '401') === 0 ? 'EGroupware\Api\Exception\NoPermission' :
'EGroupware\Api\Exception');
throw new $class($message, $status);
throw new $class($message, (int)$status);
}
/**

View File

@ -1663,6 +1663,14 @@ ORDER BY cal_user_type, cal_usre_id
// check if recurrence enddate was adjusted
if(isset($event['recur_enddate']))
{
if (is_object($event['recur_enddate']))
{
$event['recur_enddate'] = Api\DateTime::user2server($event['recur_enddate'], 'ts');
}
if (is_object($old_repeats['recur_enddate']))
{
$old_repeats['recur_enddate'] = Api\DateTime::user2server($old_repeats['recur_enddate'], 'ts');
}
// recurrences need to be truncated
if((int)$event['recur_enddate'] > 0 &&
((int)$old_repeats['recur_enddate'] == 0 || (int)$old_repeats['recur_enddate'] > (int)$event['recur_enddate'])

View File

@ -55,7 +55,7 @@ class calendar_uiforms extends calendar_ui
/**
* default locking time for entries, that are opened by another user
*
* @var locktime in seconds
* @var int lock time in seconds
*/
var $locktime_default=1;
@ -262,7 +262,7 @@ class calendar_uiforms extends calendar_ui
);
}
return array(
$ret = array(
'participant_types' => $participant_types,
'participants' => $participants,
'owner' => $owner,
@ -278,6 +278,7 @@ class calendar_uiforms extends calendar_ui
'videoconference' => !empty($_GET['videoconference']),
'##notify_externals' => !empty($_GET['videoconference']) ? 'yes' : $this->cal_prefs['notify_externals'],
);
return $ret;
}
/**
@ -1872,7 +1873,7 @@ class calendar_uiforms extends calendar_ui
if ($event['recur_type'] != MCAL_RECUR_NONE)
{
$readonlys['recur_exception'] = !count($content['recur_exception']); // otherwise we get a delete button
$readonlys['recur_exception'] = empty($content['recur_exception']); // otherwise we get a delete button
//$onclick =& $etpl->get_cell_attribute('button[delete]','onclick');
//$onclick = str_replace('Delete this event','Delete this series of recuring events',$onclick);
}
@ -2843,7 +2844,7 @@ class calendar_uiforms extends calendar_ui
#error_log(__METHOD__.print_r($content,true));
if (is_numeric($cal_id = $content ? $content : $_REQUEST['cal_id']))
{
if (!($ical =& $boical->exportVCal(array($cal_id),'2.0','PUBLISH',false)))
if (!($ical = $boical->exportVCal(array($cal_id),'2.0','PUBLISH',false)))
{
$msg = lang('Permission denied');
@ -2872,7 +2873,7 @@ class calendar_uiforms extends calendar_ui
}
else
{
$ical =& $boical->exportVCal($events,'2.0','PUBLISH',false);
$ical = $boical->exportVCal($events,'2.0','PUBLISH',false);
Api\Header\Content::type($content['file'] ? $content['file'] : 'event.ics','text/calendar',bytes($ical));
echo $ical;
exit();

View File

@ -387,18 +387,16 @@ class importexport_export_csv implements importexport_iface_export_record
$record->$name = '';
}
}
foreach($fields['select-account'] ?? [] as $name) {
foreach($fields['select-account'] ?? [] as $name)
{
// Compare against null to deal with empty arrays
if ($record->$name !== null) {
if(is_array($record->$name)) {
$names = array();
foreach($record->$name as $_name) {
$names[] = Api\Accounts::username($_name);
}
$record->$name = implode(', ', $names);
} else {
$record->$name = Api\Accounts::username($record->$name);
if ($record->$name !== null)
{
$names = array();
foreach((array)$record->$name as $_name) {
$names[] = Api\Accounts::title((int)$_name ?: $_name);
}
$record->$name = implode(', ', $names);
}
else
{