mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-12 08:58:30 +01:00
PHP 8 fixes
This commit is contained in:
parent
02c3feb95d
commit
868135775c
@ -164,7 +164,7 @@ class addressbook_groupdav extends Api\CalDAV\Handler
|
||||
|
||||
if (isset($nresults))
|
||||
{
|
||||
$files['files'] = $this->propfind_callback($path, $filter, array(0, (int)$nresults));
|
||||
$files['files'] = $this->propfind_callback2($path, $filter, array(0, (int)$nresults));
|
||||
|
||||
// hack to support limit with sync-collection report: contacts are returned in modified ASC order (oldest first)
|
||||
// if limit is smaller then full result, return modified-1 as sync-token, so client requests next chunk incl. modified
|
||||
@ -184,14 +184,28 @@ class addressbook_groupdav extends Api\CalDAV\Handler
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for profind iterator
|
||||
* Callback for propfind iterator
|
||||
*
|
||||
* @param string $path
|
||||
* @param array& $filter
|
||||
* @param array|boolean $start =false false=return all or array(start,num)
|
||||
* @return array with "files" array with values for keys path and props
|
||||
*/
|
||||
function &propfind_callback($path,array &$filter,$start=false,$report_not_found_multiget_ids=true)
|
||||
function &propfind_callback($path, array $filter, $start=false)
|
||||
{
|
||||
return $this->propfind_callback2($path, $filter, $start);
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for propfind iterator with ability to skip reporting not found ids
|
||||
*
|
||||
* @param string $path
|
||||
* @param array& $filter
|
||||
* @param array|boolean $start =false false=return all or array(start,num)
|
||||
* @param boolean $report_not_found_multiget_ids=true
|
||||
* @return array with "files" array with values for keys path and props
|
||||
*/
|
||||
function &propfind_callback2($path, array &$filter, $start=false, $report_not_found_multiget_ids=true)
|
||||
{
|
||||
//error_log(__METHOD__."('$path', ".array2string($filter).", ".array2string($start).", $report_not_found_multiget_ids)");
|
||||
$starttime = microtime(true);
|
||||
@ -299,7 +313,7 @@ class addressbook_groupdav extends Api\CalDAV\Handler
|
||||
if ($sync_collection_report) $token_was = $this->sync_collection_token;
|
||||
self::$path_attr = 'id';
|
||||
self::$path_extension = '.vcf';
|
||||
$files = array_merge($files, $this->propfind_callback($path, $accounts_filter, false, false));
|
||||
$files = array_merge($files, $this->propfind_callback2($path, $accounts_filter, false, false));
|
||||
self::$path_attr = 'carddav_name';
|
||||
self::$path_extension = '';
|
||||
if ($sync_collection_report && $token_was > $this->sync_collection_token)
|
||||
|
@ -59,7 +59,7 @@ class addressbook_hooks
|
||||
'link' => "javascript:egw.open('','$appname','add')"
|
||||
),
|
||||
'Advanced search' => "javascript:egw_openWindowCentered2('".
|
||||
Egw::link('/index.php',array('menuaction' => 'addressbook.addressbook_ui.search'),false).
|
||||
Egw::link('/index.php',array('menuaction' => 'addressbook.addressbook_ui.extSearch'),false).
|
||||
"','_blank',870,610,'yes')",
|
||||
'Placeholders' => Egw::link('/index.php','menuaction=api.EGroupware\\Api\\Contacts\\Merge.show_replacements')
|
||||
);
|
||||
|
@ -67,12 +67,11 @@ class addressbook_import_contacts_csv extends importexport_basic_import_csv {
|
||||
|
||||
/**
|
||||
* imports entries according to given definition object.
|
||||
* @param resource $_stream
|
||||
* @param string $_charset
|
||||
* @param definition $_definition
|
||||
* @param importexport_definition $definition
|
||||
* @param importexport_import_csv|null $import_csv
|
||||
*/
|
||||
public function init(importexport_definition &$_definition ) {
|
||||
|
||||
protected function init(importexport_definition $definition, importexport_import_csv $import_csv = null)
|
||||
{
|
||||
// fetch the addressbook bo
|
||||
$this->bocontacts = new addressbook_bo();
|
||||
|
||||
|
@ -26,7 +26,7 @@ use EGroupware\Kanban\Hooks;
|
||||
class addressbook_ui extends addressbook_bo
|
||||
{
|
||||
public $public_functions = array(
|
||||
'search' => True,
|
||||
'extSearch' => True,
|
||||
'edit' => True,
|
||||
'view' => True,
|
||||
'index' => True,
|
||||
@ -3301,7 +3301,7 @@ class addressbook_ui extends addressbook_bo
|
||||
* @param array $_content
|
||||
* @return string
|
||||
*/
|
||||
function search($_content=array())
|
||||
function extSearch($_content=array())
|
||||
{
|
||||
if(!empty($_content))
|
||||
{
|
||||
@ -3481,7 +3481,7 @@ class addressbook_ui extends addressbook_bo
|
||||
* Migrate contacts to or from LDAP (called by Admin >> Addressbook >> Site configuration (Admin only)
|
||||
*
|
||||
*/
|
||||
function migrate2ldap()
|
||||
function migrate2ldap($type=null)
|
||||
{
|
||||
$GLOBALS['egw_info']['flags']['app_header'] = lang('Addressbook').' - '.lang('Migration to LDAP');
|
||||
echo $GLOBALS['egw']->framework->header();
|
||||
@ -3493,7 +3493,7 @@ class addressbook_ui extends addressbook_bo
|
||||
}
|
||||
else
|
||||
{
|
||||
parent::migrate2ldap($_GET['type']);
|
||||
parent::migrate2ldap($type ?? $_GET['type']);
|
||||
echo '<p style="margin-top: 20px;"><b>'.lang('Migration finished')."</b></p>\n";
|
||||
}
|
||||
echo $GLOBALS['egw']->framework->footer();
|
||||
|
@ -31,7 +31,7 @@ class admin_asyncservice
|
||||
|
||||
echo $GLOBALS['egw']->framework->header();
|
||||
|
||||
$async = $GLOBALS['egw']->asyncservice; // use an own instance, as we might set debug=True
|
||||
$async = new Api\Asyncservice(); // use an own instance, as we might set debug=True
|
||||
|
||||
$async->debug = !!$_POST['debug'];
|
||||
|
||||
|
@ -146,11 +146,11 @@ class admin_customfields
|
||||
// Handle incoming - types, options, etc.
|
||||
if($this->manage_content_types)
|
||||
{
|
||||
if(count($this->content_types) == 0)
|
||||
if(empty($this->content_types))
|
||||
{
|
||||
$this->content_types = Api\Config::get_content_types($this->appname);
|
||||
}
|
||||
if (count($this->content_types)==0)
|
||||
if (empty($this->content_types))
|
||||
{
|
||||
// if you define your default types of your app with the search_link hook, they are available here, if no types were found
|
||||
$this->content_types = (array)Api\Link::get_registry($this->appname,'default_types');
|
||||
|
@ -659,7 +659,7 @@ class Asyncservice
|
||||
$webserver = posix_getpwuid(posix_getuid ());
|
||||
echo '<p>'.lang("You need to add the webserver user '%1' to the group '%2'.",$webserver['name'],$group['name'])."</p>\n"; }
|
||||
}
|
||||
if (($fd = popen('/bin/sh -c "type -p '.$name.'"','r')))
|
||||
if (function_exists('popen') && ($fd = popen('/bin/sh -c "type -p '.$name.'"','r')))
|
||||
{
|
||||
$this->$name = fgets($fd,256);
|
||||
@pclose($fd);
|
||||
@ -707,7 +707,7 @@ class Asyncservice
|
||||
}
|
||||
$times = False;
|
||||
$other_cronlines = array();
|
||||
if (($crontab = popen('/bin/sh -c "'.$this->crontab.' -l" 2>&1','r')) !== False)
|
||||
if (function_exists('popen') && ($crontab = popen('/bin/sh -c "'.$this->crontab.' -l" 2>&1','r')) !== False)
|
||||
{
|
||||
$n = 0;
|
||||
while ($line = fgets($crontab,256))
|
||||
@ -762,7 +762,7 @@ class Asyncservice
|
||||
$other_cronlines = array();
|
||||
$this->installed($other_cronlines); // find other installed cronlines
|
||||
|
||||
if (($crontab = popen('/bin/sh -c "'.$this->crontab.' -" 2>&1','w')) !== False)
|
||||
if (function_exists('popen') && ($crontab = popen('/bin/sh -c "'.$this->crontab.' -" 2>&1','w')) !== False)
|
||||
{
|
||||
foreach ($other_cronlines as $cronline)
|
||||
{
|
||||
|
@ -76,9 +76,6 @@ class Cache extends Etemplate\Request
|
||||
{
|
||||
$this->id = $_id ? $_id : self::request_id();
|
||||
//error_log(__METHOD__."($_id) this->id=$this->id");
|
||||
|
||||
// hack to quiten IDE Warning for not calling parent::__construct, which we can not!
|
||||
if (false) parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -96,9 +93,10 @@ class Cache extends Etemplate\Request
|
||||
* Factory method to get a new request object or the one for an existing request
|
||||
*
|
||||
* @param string $id =null
|
||||
* @return Request|boolean the object or false if $id is not found
|
||||
* @param bool $handle_not_found =true true: handle not found by trying to redirect, false: just return null
|
||||
* @return Request|null null if Request not found and $handle_not_found === false
|
||||
*/
|
||||
static function read($id=null)
|
||||
public static function read($id=null, $handle_not_found=true)
|
||||
{
|
||||
$request = new Cache($id);
|
||||
|
||||
|
@ -204,7 +204,8 @@ class Nextmatch extends Etemplate\Widget
|
||||
{
|
||||
$value['options-cat_id'][''] = lang('All categories');
|
||||
}
|
||||
$value['options-cat_id'] += Select::typeOptions('select-cat', ',,'.$cat_app,$no_lang=true,false,$value['cat_id']);
|
||||
$no_lang = true;
|
||||
$value['options-cat_id'] += Select::typeOptions('select-cat', ',,'.$cat_app,$no_lang,false,$value['cat_id']);
|
||||
Select::fix_encoded_options($value['options-cat_id']);
|
||||
}
|
||||
|
||||
|
@ -654,12 +654,12 @@ class Select extends Etemplate\Widget
|
||||
$options[$cat['id']] += $cat['data'];
|
||||
}
|
||||
}
|
||||
// preserv unavailible cats (eg. private user-cats)
|
||||
if ($value && ($unavailible = array_diff(is_array($value) ? $value : explode(',',$value),array_keys((array)$options))))
|
||||
// preserve unavailable cats (eg. private user-cats)
|
||||
if (isset(self::$request) && $value && ($unavailable = array_diff(is_array($value) ? $value : explode(',',$value),array_keys((array)$options))))
|
||||
{
|
||||
// unavailable cats need to be merged in again
|
||||
$unavailable_name = $form_name.self::UNAVAILABLE_CAT_POSTFIX;
|
||||
self::$request->preserv[$unavailable_name] = $unavailible;
|
||||
self::$request->preserv[$unavailable_name] = $unavailable;
|
||||
}
|
||||
$no_lang = True;
|
||||
break;
|
||||
|
@ -308,7 +308,7 @@ class Tree extends Etemplate\Widget
|
||||
{
|
||||
// += to keep further options set by app code
|
||||
self::$request->sel_options[$form_name] += self::typeOptions($this->attrs['type'], $this->attrs['options'],
|
||||
$no_lang=null, $this->attrs['readonly'], self::get_array(self::$request->content, $form_name), $form_name);
|
||||
$no_lang, $this->attrs['readonly'], self::get_array(self::$request->content, $form_name), $form_name);
|
||||
|
||||
// if no_lang was modified, forward modification to the client
|
||||
if ($no_lang != $this->attr['no_lang'])
|
||||
|
@ -1015,7 +1015,7 @@ class Link extends Link\Storage
|
||||
$view[$name] = $id[$n];
|
||||
}
|
||||
}
|
||||
else
|
||||
elseif(is_array($view))
|
||||
{
|
||||
$view[$reg['view_id']] = $id;
|
||||
}
|
||||
|
@ -24,10 +24,6 @@ use EGroupware\Api\Egw;
|
||||
// Declaration of <extended method> should be compatible with <parent method>, varios places where method parameters change
|
||||
// --> switching it off for now, as it makes error-log unusable
|
||||
error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED);
|
||||
if (function_exists('get_magic_quotes_runtime') && get_magic_quotes_runtime())
|
||||
{
|
||||
set_magic_quotes_runtime(false);
|
||||
}
|
||||
|
||||
$egw_min_php_version = '7.3';
|
||||
if (!function_exists('version_compare') || version_compare(PHP_VERSION,$egw_min_php_version) < 0)
|
||||
@ -35,7 +31,7 @@ if (!function_exists('version_compare') || version_compare(PHP_VERSION,$egw_min_
|
||||
die("EGroupware requires PHP $egw_min_php_version or greater.<br />Please contact your System Administrator to upgrade PHP!");
|
||||
}
|
||||
|
||||
if (!defined('EGW_API_INC')) define('EGW_API_INC',PHPGW_API_INC); // this is to support the header upgrade
|
||||
if (!defined('EGW_API_INC') && defined('PHPGW_API_INC')) define('EGW_API_INC',PHPGW_API_INC); // this is to support the header upgrade
|
||||
|
||||
/* Make sure the header.inc.php is current. */
|
||||
if (!isset($GLOBALS['egw_domain']) || $GLOBALS['egw_info']['server']['versions']['header'] < $GLOBALS['egw_info']['server']['versions']['current_header'])
|
||||
@ -80,7 +76,7 @@ if (Session::init_handler())
|
||||
|
||||
if (is_object($GLOBALS['egw']) && ($GLOBALS['egw'] instanceof Egw)) // only egw object has wakeup2, setups egw_minimal eg. has not!
|
||||
{
|
||||
$GLOBALS['egw']->wakeup2(); // adapt the restored egw-object/enviroment to this request (eg. changed current app)
|
||||
$GLOBALS['egw']->wakeup2(); // adapt the restored egw-object/environment to this request (eg. changed current app)
|
||||
|
||||
$GLOBALS['egw_info']['flags']['session_restore_time'] = microtime(true) - $GLOBALS['egw_info']['flags']['page_start_time'];
|
||||
if (is_object($GLOBALS['egw']->translation)) return; // exit this file, as the rest of the file creates a new egw-object and -enviroment
|
||||
|
@ -426,7 +426,11 @@ if (!function_exists('display_sidebox'))
|
||||
*/
|
||||
function display_sidebox($appname,$menu_title,$_file)
|
||||
{
|
||||
$file = str_replace('preferences.uisettings.index', 'preferences.preferences_settings.index', $_file);
|
||||
$file = array_map(function($item)
|
||||
{
|
||||
return is_array($item) ? $item :
|
||||
str_replace('preferences.uisettings.index', 'preferences.preferences_settings.index', $item);
|
||||
}, $_file);
|
||||
$GLOBALS['egw']->framework->sidebox($appname,$menu_title,$file);
|
||||
}
|
||||
}
|
||||
|
@ -1160,7 +1160,7 @@ class calendar_groupdav extends Api\CalDAV\Handler
|
||||
if (preg_match('/^METHOD:(PUBLISH|REQUEST)(\r\n|\r|\n)(.*)^BEGIN:VEVENT/ism', $options['content']))
|
||||
{
|
||||
$handler = $this->_get_handler();
|
||||
if (($foundEvents = $handler->search($vCalendar, null, false, $charset)))
|
||||
if (($foundEvents = $handler->iCalSearch($vCalendar, null, false, $charset)))
|
||||
{
|
||||
$id = array_shift($foundEvents);
|
||||
list($eventId) = explode(':', $id);
|
||||
@ -1548,11 +1548,12 @@ class calendar_groupdav extends Api\CalDAV\Handler
|
||||
* @param string $path
|
||||
* @param int|string $retval
|
||||
* @param boolean $path_attr_is_name =true true: path_attr is ca(l|rd)dav_name, false: id (GroupDAV needs Location header)
|
||||
* @param string $etag =null etag, to not calculate it again (if != null)
|
||||
*/
|
||||
function put_response_headers($entry, $path, $retval, $path_attr_is_name=true)
|
||||
function put_response_headers($entry, $path, $retval, $path_attr_is_name=true, $etag=null)
|
||||
{
|
||||
$schedule_tag = null;
|
||||
$etag = $this->get_etag($entry, $schedule_tag);
|
||||
if (!isset($etag)) $etag = $this->get_etag($entry, $schedule_tag);
|
||||
|
||||
if ($this->use_schedule_tag)
|
||||
{
|
||||
|
@ -3218,7 +3218,7 @@ class calendar_ical extends calendar_boupdate
|
||||
return $event;
|
||||
}
|
||||
|
||||
function search($_vcalData, $contentID=null, $relax=false, $charset=null)
|
||||
function iCalSearch($_vcalData, $contentID=null, $relax=false, $charset=null)
|
||||
{
|
||||
if (($events = $this->icaltoegw($_vcalData, $charset)))
|
||||
{
|
||||
|
@ -43,8 +43,10 @@ class calendar_import_csv extends importexport_basic_import_csv {
|
||||
|
||||
/**
|
||||
* Set up import
|
||||
* @param importexport_definition $definition
|
||||
* @param importexport_import_csv|null $import_csv
|
||||
*/
|
||||
protected function init(importexport_definition &$definition, importexport_import_csv &$import_csv=NULL)
|
||||
protected function init(importexport_definition $definition, importexport_import_csv $import_csv=NULL)
|
||||
{
|
||||
// fetch the addressbook bo
|
||||
$this->bo= new calendar_boupdate();
|
||||
@ -76,8 +78,9 @@ class calendar_import_csv extends importexport_basic_import_csv {
|
||||
*
|
||||
* @return boolean success
|
||||
*/
|
||||
public function import_record(\calendar_egw_record &$record, &$import_csv)
|
||||
public function import_record(importexport_iface_egw_record &$record, &$import_csv)
|
||||
{
|
||||
if (!is_a($record, calendar_egw_record::class)) throw new TypeError();
|
||||
// set eventOwner
|
||||
$options =& $this->definition->plugin_options;
|
||||
$options['owner'] = $options['owner'] ? $options['owner'] : $this->user;
|
||||
|
@ -119,11 +119,11 @@ class calendar_merge extends Api\Storage\Merge
|
||||
* @param string $charset=null charset to override default set by mimetype or export charset
|
||||
* @return string|boolean merged document or false on error
|
||||
*/
|
||||
function merge_string($content,$ids,$err,$mimetype,$fix)
|
||||
function &merge_string($content, $ids, &$err, $mimetype, array $fix=null, $charset=null)
|
||||
{
|
||||
$ids = $this->validate_ids((array)$ids, $content);
|
||||
|
||||
return parent::merge_string($content, $ids, $err, $mimetype,$fix);
|
||||
return parent::merge_string($content, $ids, $err, $mimetype, $fix, $charset);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -217,7 +217,7 @@ class calendar_owner_etemplate_widget extends Etemplate\Widget\Taglist
|
||||
);
|
||||
foreach($lists as $list_id => $list)
|
||||
{
|
||||
$_results[''+$list_id] = array(
|
||||
$_results[(string)$list_id] = array(
|
||||
'label' => $list,
|
||||
'resources' => $bo->enum_mailing_list($type.$list_id)
|
||||
);
|
||||
|
@ -220,8 +220,10 @@ abstract class importexport_basic_import_csv implements importexport_iface_impor
|
||||
|
||||
/**
|
||||
* Stub to hook into import initialization - set lookups, etc.
|
||||
* @param importexport_definition $definition
|
||||
* @param importexport_import_csv|null $import_csv
|
||||
*/
|
||||
protected function init(importexport_definition &$definition, importexport_import_csv &$import_csv = null)
|
||||
protected function init(importexport_definition $definition, importexport_import_csv $import_csv = null)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
<nextmatch-accountfilter empty_label="Owner" id="owner"/>
|
||||
</row>
|
||||
<row class="row $row_cont[class]">
|
||||
<image src="${row}[type]" no_lang="1" onclick="window.open(egw::link('/index.php','menuaction=importexport.importexport_${row_cont[type]}_ui.{$row_cont[type]}_dialog&appname=${row_cont[application]}&definition=${row_cont[definition_id]}'),'_blank','dependent=yes,width=850,height=440,scrollbars=yes,status=yes'); return false;" class="lr_padding button"/>
|
||||
<image src="${row}[type]" no_lang="1" onclick="window.open(egw::link('/index.php','menuaction=importexport.importexport_${row_cont[type]}_ui.${row_cont[type]}_dialog&appname=${row_cont[application]}&definition=${row_cont[definition_id]}'),'_blank','dependent=yes,width=850,height=440,scrollbars=yes,status=yes'); return false;" class="lr_padding button"/>
|
||||
<description id="${row}[name]" no_lang="1" class="lr_padding"/>
|
||||
<description id="${row}[application]" class="lr_padding"/>
|
||||
<listbox type="select-account" id="${row}[allowed_users]" no_lang="1" readonly="true" rows="5" empty_label='Private' class="lr_padding"/>
|
||||
|
@ -38,7 +38,7 @@
|
||||
<description/>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<grid width="100%" class="schedule" id="{$row}">
|
||||
<grid width="100%" class="schedule" id="$row">
|
||||
<columns>
|
||||
<column width="50"/>
|
||||
<column width="60"/>
|
||||
@ -74,8 +74,8 @@
|
||||
<description id="times" no_lang="1"/>
|
||||
</vbox>
|
||||
<hbox options="0,0">
|
||||
<button id="edit[{$_cont[id]}]" onclick="window.open(egw::link('/index.php','menuaction=importexport.importexport_schedule_ui.edit&id={$_cont[id]}'),'_blank','dependent=yes,width=600,height=450,scrollbars=yes,status=yes'); return false;" image="edit"/>
|
||||
<button id="delete[{$_cont[id]}]" onclick="1" image="delete"/>
|
||||
<button id="edit[$_cont[id]]" onclick="window.open(egw::link('/index.php','menuaction=importexport.importexport_schedule_ui.edit&id=$_cont[id]'),'_blank','dependent=yes,width=600,height=450,scrollbars=yes,status=yes'); return false;" image="edit"/>
|
||||
<button id="delete[$_cont[id]]" onclick="1" image="delete"/>
|
||||
</hbox>
|
||||
</row>
|
||||
<row class="th" disabled="!@result">
|
||||
|
@ -27,7 +27,7 @@
|
||||
</row>
|
||||
<row>
|
||||
<description id="${row}[name]" no_lang="1"/>
|
||||
<checkbox id="export[${row}]" no_lang="1" options="{$row_cont[field]}"/>
|
||||
<checkbox id="export[${row}]" no_lang="1" options="$row_cont[field]"/>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
|
@ -28,8 +28,8 @@
|
||||
<description value="Translation"/>
|
||||
</row>
|
||||
<row>
|
||||
<description id="{$row_cont[index]}" value="${row_cont[index]}" no_lang="1"/>
|
||||
<description value="{$row_cont[title]}" no_lang="1"/>
|
||||
<description id="$row_cont[index]" value="$row_cont[index]" no_lang="1"/>
|
||||
<description value="$row_cont[title]" no_lang="1"/>
|
||||
<listbox id="{$row}[field]" no_lang="1"/>
|
||||
<textbox id="{$row}[conversion]"/>
|
||||
</row>
|
||||
|
@ -1447,9 +1447,10 @@ class infolog_bo
|
||||
function link_titles(array $ids)
|
||||
{
|
||||
$titles = array();
|
||||
foreach ($this->search($params=array(
|
||||
$params = array(
|
||||
'col_filter' => array('info_id' => $ids),
|
||||
)) as $info)
|
||||
);
|
||||
foreach ($this->search($params) as $info)
|
||||
{
|
||||
$titles[$info['info_id']] = $this->link_title($info);
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ class infolog_tracking extends Api\Storage\Tracking
|
||||
* @param array $old
|
||||
* @return string
|
||||
*/
|
||||
function get_subject($data,$old)
|
||||
function get_subject($data, $old, $deleted = null, $receiver = null)
|
||||
{
|
||||
if ($data['prefix'])
|
||||
{
|
||||
@ -170,7 +170,7 @@ class infolog_tracking extends Api\Storage\Tracking
|
||||
* @param array $old
|
||||
* @return string
|
||||
*/
|
||||
function get_message($data,$old)
|
||||
function get_message($data, $old, $receiver = null)
|
||||
{
|
||||
if ($data['message']) return $data['message']; // async notification
|
||||
|
||||
|
@ -137,7 +137,7 @@ class resources_acl_ui
|
||||
$row['icon_url'] = $GLOBALS['egw_info']['server']['webserver_url']. resources_bo::ICON_PATH.'/'.$row['data']['icon'];
|
||||
}
|
||||
|
||||
$row['subs'] = count($row['children']);
|
||||
$row['subs'] = count($row['children'] ?? []);
|
||||
|
||||
$row['class'] = 'level'.$row['level'];
|
||||
|
||||
|
@ -28,12 +28,11 @@ class resources_import_csv extends importexport_basic_import_csv {
|
||||
|
||||
/**
|
||||
* imports entries according to given definition object.
|
||||
* @param resource $_stream
|
||||
* @param string $_charset
|
||||
* @param definition $_definition
|
||||
* @param importexport_definition $definition $definition
|
||||
* @param ?importexport_import_csv $import_csv
|
||||
*/
|
||||
public function init(importexport_definition $_definition ) {
|
||||
|
||||
protected function init(importexport_definition $definition, importexport_import_csv $import_csv = null)
|
||||
{
|
||||
// fetch the resource bo
|
||||
$this->bo = new resources_bo();
|
||||
|
||||
|
@ -47,21 +47,23 @@ class resources_so extends Api\Storage
|
||||
* Reimplemented to do some minimal caching (re-use already read data)
|
||||
*
|
||||
* @param int|array $res_id res_id
|
||||
* @param string|array $extra_cols string or array of strings to be added to the SELECT, eg. "count(*) as num"
|
||||
* @param string $join sql to do a join, added as is after the table-name, eg. ", table2 WHERE x=y" or
|
||||
* @return array|boolean data if row could be retrived else False
|
||||
*/
|
||||
function read($res_id)
|
||||
function read($keys, $extra_cols='', $join='')
|
||||
{
|
||||
if (is_array($res_id) && count($res_id) == 1 && isset($res_id['res_id'])) $res_id = $res_id['res_id'];
|
||||
if (is_array($keys) && count($keys) == 1 && isset($keys['keys'])) $keys = $keys['keys'];
|
||||
|
||||
/*if (!is_array($res_id) && $res_id == $this->data['res_id'])
|
||||
/*if (!is_array($keys) && $keys == $this->data['keys'])
|
||||
{
|
||||
error_log(__METHOD__.'('.array2string($res_id).') this->data[res_id]='.array2string($this->data['res_id']).' --> returning this->data');
|
||||
error_log(__METHOD__.'('.array2string($keys).') this->data[keys]='.array2string($this->data['keys']).' --> returning this->data');
|
||||
}
|
||||
else
|
||||
{
|
||||
error_log(__METHOD__.'('.array2string($res_id).') this->data[res_id]='.array2string($this->data['res_id']).' --> returning parent::read()');
|
||||
error_log(__METHOD__.'('.array2string($keys).') this->data[keys]='.array2string($this->data['keys']).' --> returning parent::read()');
|
||||
}*/
|
||||
return !is_array($res_id) && $res_id == $this->data['res_id'] ? $this->data : parent::read($res_id);
|
||||
return !is_array($keys) && $keys == $this->data['keys'] ? $this->data : parent::read($keys, $extra_cols, $join);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -70,11 +72,12 @@ class resources_so extends Api\Storage
|
||||
* Reimplemented to do some minimal caching (re-use already read data)
|
||||
*
|
||||
* @param int|array $res_id id of resource
|
||||
* @param boolean $only_return_ids =false return $ids of delete call to db object, but not run it (can be used by extending classes!)
|
||||
* @return int|array affected rows, should be 1 if ok, 0 if an error or array with id's if $only_return_ids
|
||||
*/
|
||||
function delete($res_id)
|
||||
function delete($keys=null,$only_return_ids=false)
|
||||
{
|
||||
if (($ok = parent::delete($res_id)) && !is_array($res_id) && $res_id == $this->data['res_id'])
|
||||
if (($ok = parent::delete($keys, $only_return_ids)) && !$only_return_ids && !is_array($keys) && $keys == $this->data['res_id'])
|
||||
{
|
||||
unset($this->data);
|
||||
}
|
||||
@ -85,12 +88,13 @@ class resources_so extends Api\Storage
|
||||
* saves a resource including extra fields
|
||||
*
|
||||
* @param array $resource key => value
|
||||
* @return mixed id of resource if all right, false if fale
|
||||
* @param string|array $extra_where =null extra where clause, eg. to check an etag, returns true if no affected rows!
|
||||
* @return int|boolean 0 on success, or errno != 0 on error, or true if $extra_where is given and no rows affected
|
||||
*/
|
||||
function save($resource)
|
||||
function save($keys=null,$extra_where=null)
|
||||
{
|
||||
$this->data = $resource;
|
||||
if(parent::save() != 0) return false;
|
||||
$this->data = $keys;
|
||||
if(parent::save(null, $extra_where) != 0) return false;
|
||||
$res_id = $this->data['res_id'];
|
||||
|
||||
return $res_id;
|
||||
|
@ -552,7 +552,7 @@ class timesheet_bo extends Api\Storage
|
||||
($this->quantity_sum ? "SUM(ts_quantity) AS ts_quantity" : '0'),
|
||||
'0','NULL','0','0','0','0','0','0',"SUM($total_sql) AS ts_total"
|
||||
),'GROUP BY '.$sum_sql[$type],$sum_extra_cols,$wildcard,$empty,$op,'UNION',$filter,$join,$need_full_no_count);
|
||||
$sum_extra_cols[$type]{0} = '0';
|
||||
$sum_extra_cols[$type][0] = '0';
|
||||
}
|
||||
$union_order[] = 'ts_start '.$sort;
|
||||
return parent::search('','',implode(',',$union_order),'','',false,'',$start);
|
||||
@ -565,10 +565,12 @@ class timesheet_bo extends Api\Storage
|
||||
*
|
||||
* @param int $ts_id
|
||||
* @param boolean $ignore_acl =false should the Acl be checked
|
||||
* @param string $join ='' *UNSUPPORTED*
|
||||
* @return array|boolean array with timesheet entry, null if timesheet not found or false if no rights
|
||||
*/
|
||||
function read($ts_id,$ignore_acl=false)
|
||||
function read($ts_id,$ignore_acl=false,$join='')
|
||||
{
|
||||
if (!is_bool($ignore_acl)) throw new TypeError();
|
||||
//error_log(__METHOD__."($ts_id,$ignore_acl) ".function_backtrace());
|
||||
if (!(int)$ts_id || (int)$ts_id != $this->data['ts_id'] && !parent::read($ts_id))
|
||||
{
|
||||
|
@ -46,9 +46,10 @@ class timesheet_import_csv extends importexport_basic_import_csv
|
||||
/**
|
||||
* Initialize for import
|
||||
*
|
||||
* @param definition $_definition
|
||||
* @param importexport_definition $definition
|
||||
* @param ?importexport_import_csv $import_csv
|
||||
*/
|
||||
protected function init( importexport_definition $_definition, importexport_import_csv &$import_csv )
|
||||
protected function init(importexport_definition $definition, importexport_import_csv $import_csv=null)
|
||||
{
|
||||
// fetch the bo
|
||||
$this->bo = new timesheet_bo();
|
||||
@ -60,10 +61,10 @@ class timesheet_import_csv extends importexport_basic_import_csv
|
||||
$import_csv->conversion_class = $this;
|
||||
|
||||
// set Owner
|
||||
$plugin_options = $_definition->plugin_options;
|
||||
$plugin_options['record_owner'] = isset( $_definition->plugin_options['record_owner'] ) ?
|
||||
$_definition->plugin_options['record_owner'] : $this->user;
|
||||
$_definition->plugin_options = $plugin_options;
|
||||
$plugin_options = $definition->plugin_options;
|
||||
$plugin_options['record_owner'] = isset( $definition->plugin_options['record_owner'] ) ?
|
||||
$definition->plugin_options['record_owner'] : $this->user;
|
||||
$definition->plugin_options = $plugin_options;
|
||||
|
||||
// For converting human-friendly lookups
|
||||
$this->lookups = array(
|
||||
@ -483,7 +484,7 @@ class timesheet_import_csv extends importexport_basic_import_csv
|
||||
// end of iface_export_plugin
|
||||
|
||||
// Extra conversion functions - must be static
|
||||
public static function addr_id( $n_family,$n_given=null,$org_name=null )
|
||||
public static function addr_id( $n_family,$n_given=null,$org_name=null, &$record=null)
|
||||
{
|
||||
|
||||
// find in Addressbook, at least n_family AND (n_given OR org_name) have to match
|
||||
@ -497,7 +498,7 @@ class timesheet_import_csv extends importexport_basic_import_csv
|
||||
if(!is_null($n_given)) $n_given = trim($n_given);
|
||||
if (!is_object($contacts))
|
||||
{
|
||||
$contacts =& CreateObject('phpgwapi.contacts');
|
||||
$contacts = new Api\Contacts();
|
||||
}
|
||||
if (!is_null($org_name)) // org_name given?
|
||||
{
|
||||
@ -523,4 +524,3 @@ class timesheet_import_csv extends importexport_basic_import_csv
|
||||
return False;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -500,7 +500,7 @@ class timesheet_ui extends timesheet_bo
|
||||
* @param boolean $id_only if true only return (via $rows) an array of contact-ids, dont save state to session
|
||||
* @return int total number of contacts matching the selection
|
||||
*/
|
||||
function get_rows(&$query_in,&$rows,&$readonlys,$id_only=false)
|
||||
function get_rrows(&$query_in,&$rows,&$readonlys,$id_only=false)
|
||||
{
|
||||
$this->show_sums = false;
|
||||
$end_date = false;
|
||||
@ -935,7 +935,7 @@ class timesheet_ui extends timesheet_bo
|
||||
$date_filters['custom'] = 'custom';
|
||||
|
||||
$content['nm'] = array(
|
||||
'get_rows' => TIMESHEET_APP.'.timesheet_ui.get_rows',
|
||||
'get_rows' => TIMESHEET_APP.'.timesheet_ui.get_rrows',
|
||||
'options-filter' => $date_filters,
|
||||
'options-filter2' => array('No details','Details'),
|
||||
'order' => 'ts_start',// IO name of the column to sort after (optional for the sortheaders)
|
||||
@ -1170,7 +1170,7 @@ class timesheet_ui extends timesheet_bo
|
||||
@set_time_limit(0); // switch off the execution time limit, as it's for big selections to small
|
||||
$query['num_rows'] = -1; // all
|
||||
$readonlys = null;
|
||||
$this->get_rows($query,$checked,$readonlys,true); // true = only return the id's
|
||||
$this->get_rrows($query,$checked,$readonlys,true); // true = only return the id's
|
||||
}
|
||||
}
|
||||
//error_log(__METHOD__."('$action', ".array2string($checked).', '.array2string($use_all).",,, '$session_name')");
|
||||
|
Loading…
Reference in New Issue
Block a user