Author: ralfbecker
New Revision: 55862
URL: http://svn.stylite.de/viewvc/egroupware?rev=55862&view=rev
Log:
update to only use new Api, incl. dependency to only api (no more phpgwapi and etemplate)
Removed:
trunk/timesheet/setup/etemplates.inc.php
Modified:
trunk/timesheet/inc/class.timesheet_bo.inc.php
trunk/timesheet/inc/class.timesheet_datasource.inc.php
trunk/timesheet/inc/class.timesheet_egw_record.inc.php
trunk/timesheet/inc/class.timesheet_favorite_portlet.inc.php
trunk/timesheet/inc/class.timesheet_hooks.inc.php
trunk/timesheet/inc/class.timesheet_import_csv.inc.php
trunk/timesheet/inc/class.timesheet_merge.inc.php
trunk/timesheet/inc/class.timesheet_tracking.inc.php
trunk/timesheet/inc/class.timesheet_ui.inc.php
trunk/timesheet/inc/class.timesheet_wizard_export_csv.inc.php
trunk/timesheet/inc/class.timesheet_wizard_import_csv.inc.php
trunk/timesheet/index.php
trunk/timesheet/setup/setup.inc.php
trunk/timesheet/setup/tables_update.inc.php
— trunk/timesheet/inc/class.timesheet_bo.inc.php (original)
+++ trunk/timesheet/inc/class.timesheet_bo.inc.php Tue Apr 26 20:27:29 2016
@@ -5,10 +5,14 @@
+use EGroupware\Api;
+use EGroupware\Api\Link;
+use EGroupware\Api\Acl;
if (!defined(‘TIMESHEET_APP’))
{
@@ -19,9 +23,9 @@
/**
- Business object of the TimeSheet
-
-
- Uses eTemplate’s so_sql as storage object (Table: egw_timesheet).
-
-
Timesheets Api\Config data
-
-
@var array
*/
@@ -164,7 +168,7 @@
parent::__construct(TIMESHEET_APP,‘egw_timesheet’,self::EXTRA_TABLE,’’,‘ts_extra_name’,‘ts_extra_value’,‘ts_id’);
if ($this->customfields) $this->columns_to_search[] = self::EXTRA_TABLE.’.ts_extra_value’;
@@ -220,7 +224,7 @@
$this->status_labels = array();
$this->make_status_labels($tree, $this->status_labels);
@@ -286,7 +290,7 @@
{
if ($grant & $required)
{
@@ -297,7 +301,7 @@
/**
* checks if the user has enough rights for a certain operation
*
-
- Rights are given via status config admin/noadmin
-
- Rights are given via status Api\Config admin/noadmin
-
-
@param array|int $data =null use $this->data or $this->data[‘ts_id’] (to fetch the data)
-
@param int $user =null for which user to check, default current user
@@ -331,9 +335,9 @@
/**
- checks if the user has enough rights for a certain operation
-
-
- Rights are given via owner grants or role based acl
-
-
-
@param int $required EGW_ACL_READ, EGW_ACL_WRITE, EGW_ACL_ADD, EGW_ACL_DELETE, EGW_ACL_BUDGET, EGW_ACL_EDIT_BUDGET
-
- Rights are given via owner grants or role based Acl
-
-
-
@param int $required Acl::READ, EGW_ACL_WRITE, Acl::ADD, Acl::DELETE, EGW_ACL_BUDGET, EGW_ACL_EDIT_BUDGET
-
@param array|int $data =null project or project-id to use, default the project in $this->data
-
@param int $user =null for which user to check, default current user
-
@return boolean true if the rights are ok, null if not found, false if no rights
@@ -363,7 +367,7 @@
}
$ret = $data && !!($grants[$data[‘ts_owner’]] & $required);
@@ -382,7 +386,7 @@
*/
function date_filter($name,&$start,&$end)
{
-
return egw_time::sql_filter($name, $start, $end, 'ts_start', $this->date_filters);
-
return Api\DateTime::sql_filter($name, $start, $end, 'ts_start', $this->date_filters);
}
/**
@@ -479,7 +483,7 @@
$only_summary && is_array($criteria) ? ($filter ? array_merge($criteria, (array)$filter) : $criteria) : $filter,
$only_summary ? ‘’ : $join);
$this->summary = $this->summary[0];
@@ -528,7 +532,7 @@
* read a timesheet entry
*
* @param int $ts_id
-
-
@param boolean $ignore_acl =false should the acl be checked
-
-
@param boolean $ignore_acl =false should the Acl be checked
-
@return array|boolean array with timesheet entry, null if timesheet not found or false if no rights
*/
function read($ts_id,$ignore_acl=false)
@@ -538,7 +542,7 @@
{
return null; // entry not found
}
@@ -552,14 +556,14 @@
*
* @param array $keys if given $keys are copied to data before saveing => allows a save as
* @param boolean $touch_modified =true should modification date+user be set, default yes
-
-
@param boolean $ignore_acl =false should the acl be checked, returns true if no edit-rigts
-
-
@param boolean $ignore_acl =false should the Acl be checked, returns true if no edit-rigts
-
@return int 0 on success and errno != 0 else
*/
function save($keys=null,$touch_modified=true,$ignore_acl=false)
{
if ($keys) $this->data_merge($keys);
@@ -592,7 +596,7 @@
// Check for restore of deleted contact, restore held links
if($old && $old[‘ts_status’] == self::DELETED_STATUS && $new[‘ts_status’] != self::DELETED_STATUS)
{
@@ -608,7 +612,7 @@
if (!($err = parent::save()))
{
// notify the link-class about the update, as other apps may be subscribt to it
@@ -618,7 +622,7 @@
* deletes a timesheet entry identified by $keys or the loaded one, reimplemented to notify the link class (unlink)
*
* @param array $keys if given array with col => value pairs to characterise the rows to delete
-
-
@param boolean $ignore_acl =false should the acl be checked, returns false if no delete-rigts
-
-
@param boolean $ignore_acl =false should the Acl be checked, returns false if no delete-rigts
-
@return int affected rows, should be 1 if ok, 0 if an error
*/
function delete($keys=null,$ignore_acl=false)
@@ -629,7 +633,7 @@
}
$ts_id = is_null($keys) ? $this->data[‘ts_id’] : $keys[‘ts_id’];
@@ -640,12 +644,12 @@
$delete = $old;
$delete[‘ts_status’] = self::DELETED_STATUS;
$ret = !($this->save($delete));
-
egw_link::unlink(0,TIMESHEET_APP,$ts_id,'','','',true);
-
Link::unlink(0,TIMESHEET_APP,$ts_id,'','','',true);
}
elseif (($ret = parent::delete($keys)) && $ts_id)
{
// delete all links to timesheet entry $ts_id
-
Link::unlink(0, TIMESHEET_APP, '', $account_id);
parent::delete(array('ts_owner' => $account_id));
}
else
@@ -693,7 +697,7 @@
}
$ts_id = is_null($keys) ? $this->data[‘ts_id’] : $keys[‘ts_id’];
@@ -768,7 +772,7 @@
$titles[$entry[‘ts_id’]] = $this->link_title($entry);
}
}
@@ -809,7 +813,7 @@
* Check access to the file store
*
* @param int|array $id id of entry or entry array
-
-
@param int $check EGW_ACL_READ for read and EGW_ACL_EDIT for write or delete access
-
-
@param int $check Acl::READ for read and Acl::EDIT for write or delete access
-
@param string $rel_path =null currently not used in InfoLog
-
@param int $user =null for which user to check, default current user
-
@return boolean true if access is granted or false otherwise
@@ -858,7 +862,7 @@
{
$pm_ids = ExecMethod(‘projectmanager.projectmanager_bo.children’,$pm_id);
$pm_ids[] = $pm_id;
-
$links = Link\Storage::get_links('projectmanager',$pm_ids,'timesheet'); // Link\Storage::get_links not egw_links::get_links!
if ($links)
{
$links = array_unique(call_user_func_array('array_merge',$links));
@@ -884,7 +888,7 @@
if ($data['target_app'] == 'projectmanager' && $this->read($data['id']))
{
@@ -893,7 +897,7 @@
isset($old_title) && $this->data[‘ts_project’] === $old_title)
{
$pm_id = $data[‘target_id’];
@@ -914,7 +918,7 @@
{
$this->update($update);
// do NOT notify about title-change, as this will lead to an infinit loop!
@@ -941,10 +945,10 @@
if (!isset($data[‘pm_id’]) && $data[‘ts_id’])
{
$first_pm_id = null;
@@ -954,7 +958,7 @@
}
if (!isset($data[‘pm_id’]) && isset($first_pm_id)) $data[‘pm_id’] = $first_pm_id;
}
@@ -980,7 +984,7 @@
// allways store ts_project to be able to search for it, even if no custom project is set
if (empty($data[‘ts_project’]) && !is_null($data[‘ts_project’]))
{
— trunk/timesheet/inc/class.timesheet_datasource.inc.php (original)
+++ trunk/timesheet/inc/class.timesheet_datasource.inc.php Tue Apr 26 20:27:29 2016
@@ -5,7 +5,7 @@
-
-
@param array $target_data=null data of target-project, atm not used by the infolog datasource
-
-
@return array/boolean array(info_id,link_id) on success, false otherwise
— trunk/timesheet/inc/class.timesheet_egw_record.inc.php (original)
+++ trunk/timesheet/inc/class.timesheet_egw_record.inc.php Tue Apr 26 20:27:29 2016
@@ -10,6 +10,8 @@
+use EGroupware\Api\Link;
/**
- class egw_addressbook_record
@@ -84,7 +86,8 @@
*@return string title
*/
- public function get_title() {
- public function get_title()
- {
// TODO get_record gibts nicht ?
// if (empty($this->timesheetentry)) {
// $this->get_record();
@@ -102,8 +105,8 @@
$this->timesheetentry = $_record;
// Check for linked project ID
if($this->timesheetentry[‘ts_project’]) {
-
$links = egw_link::get_links('timesheet', $_record['ts_id'], 'projectmanager');
-
foreach($links as $link_id => $app_id) {
-
$links = Link::get_links('timesheet', $_record['ts_id'], 'projectmanager');
-
foreach($links as $app_id) {
$this->timesheetentry['pm_id'] = $app_id;
break;
}
@@ -135,7 +138,7 @@
* @return string identifier
*/
public function save ( $_dst_identifier ) {
-
unset($_dst_identifier);
}
/**
@@ -145,7 +148,7 @@
-
@return string dst_identifier
*/
public function copy ( $_dst_identifier ) {
-
unset($_dst_identifier);
}
/**
@@ -156,7 +159,7 @@
-
@return string dst_identifier
*/
public function move ( $_dst_identifier ) {
-
unset($_dst_identifier);
}
/**
— trunk/timesheet/inc/class.timesheet_favorite_portlet.inc.php (original)
+++ trunk/timesheet/inc/class.timesheet_favorite_portlet.inc.php Tue Apr 26 20:27:29 2016
@@ -9,13 +9,16 @@
+use EGroupware\Api;
+use EGroupware\Api\Acl;
+use EGroupware\Api\Etemplate;
+
/**
- The timesheet_list_portlet uses a nextmatch / favorite
- to display a list of entries.
*/
class timesheet_favorite_portlet extends home_favorite_portlet
{
@@ -39,7 +42,7 @@
);
}
- public function exec($id = null, etemplate_new &$etemplate = null)
- public function exec($id = null, Etemplate &$etemplate = null)
{
$ui = new timesheet_ui();
@@ -51,7 +54,7 @@
$date_filters[‘custom’] = ‘custom’;
$this->context[‘sel_options’][‘filter’] = $date_filters;
$this->context[‘sel_options’][‘filter2’] = array(‘No details’,‘Details’);
@@ -84,7 +87,7 @@
* output is handled by parent.
*
* @param type $id
-
-
@param etemplate_new $etemplate
-
-
@param Etemplate $etemplate
*/
public static function process($content = array())
{
@@ -109,7 +112,7 @@
if (!count($content[‘nm’][‘selected’]) && !$content[‘nm’][‘select_all’])
{
$msg = lang(‘You need to select some entries first!’);
@@ -119,21 +122,20 @@
{
$msg .= lang(’%1 timesheets(s) %2’,$success,$action_msg);
-
Api\Json\Response::get()->apply('egw.message',array($msg,'success'));
foreach($content['nm']['selected'] as &$id)
{
$id = 'timesheet::'.$id;
}
// Directly request an update - this will get timesheet tab too
-
Api\Json\Response::get()->apply('egw.dataRefreshUIDs',array($content['nm']['selected']));
}
elseif(empty($msg))
{
$msg .= lang('%1 timesheets(s) %2, %3 failed because of insufficent rights !!!',$success,$action_msg,$failed);
}
— trunk/timesheet/inc/class.timesheet_hooks.inc.php (original)
+++ trunk/timesheet/inc/class.timesheet_hooks.inc.php Tue Apr 26 20:27:29 2016
@@ -9,6 +9,12 @@
+use EGroupware\Api;
+use EGroupware\Api\Link;
+use EGroupware\Api\Framework;
+use EGroupware\Api\Egw;
+use EGroupware\Api\Acl;
if (!defined(‘TIMESHEET_APP’))
{
@@ -74,7 +80,7 @@
*/
static function cumulate($param)
{
@@ -93,7 +99,7 @@
}
/**
-
- hooks to build projectmanager’s sidebox-menu plus the admin and preferences sections
-
- hooks to build projectmanager’s sidebox-menu plus the admin and Api\Preferences sections
-
-
@param string/array $args hook args
*/
@@ -106,32 +112,32 @@
if ($location == ‘sidebox_menu’)
{
// Magic etemplate2 favorites menu (from nextmatch widget)
-
'Timesheet list' => Egw::link('/index.php',array(
'menuaction' => 'timesheet.timesheet_ui.index',
'ajax' => 'true')),
array(
-
'text' => lang('Add %1',lang(Link::get_registry($appname, 'entry'))),
'no_lang' => true,
'link' => "javascript:egw.open('','$appname','add')"
),
);
-
$file['Placeholders'] = Egw::link('/index.php','menuaction=timesheet.timesheet_merge.show_replacements');
display_sidebox($appname,$GLOBALS['egw_info']['apps'][$appname]['title'].' '.lang('Menu'),$file);
}
if ($GLOBALS['egw_info']['user']['apps']['admin'])
{
$file = Array(
-
'Site Configuration' => egw::link('/index.php','menuaction=admin.admin_config.index&appname=' . $appname,'&ajax=true'),
-
'Custom fields' => egw::link('/index.php','menuaction=admin.customfields.index&appname='.$appname.'&use_private=1'),
-
'Global Categories' => egw::link('/index.php',array(
-
'Site Configuration' => Egw::link('/index.php','menuaction=admin.admin_config.index&appname=' . $appname,'&ajax=true'),
-
'Custom fields' => Egw::link('/index.php','menuaction=admin.customfields.index&appname='.$appname.'&use_private=1'),
-
'Global Categories' => Egw::link('/index.php',array(
'menuaction' => 'admin.admin_categories.index',
'appname' => $appname,
'global_cats'=> True)),
@@ -145,7 +151,7 @@
}
/**
-
- populates $GLOBALS[‘settings’] for the preferences
-
- populates $GLOBALS[‘settings’] for the Api\Preferences
*/
static function settings()
{
@@ -174,7 +180,7 @@
‘name’ => ‘default_document’,
‘help’ => lang(‘If you specify a document (full vfs path) here, %1 displays an extra document icon for each entry. That icon allows to download the specified document with the data inserted.’,lang(‘timesheet’)).’ ‘.
lang(‘The document can contain placeholder like {{%1}}, to be replaced with the data.’, ‘ts_title’).’ '.
-
lang('The following document-types are supported:'). implode(',',Api\Storage\Merge::get_file_extensions()),
'run_lang' => false,
'xmlrpc' => True,
'admin' => False,
@@ -186,7 +192,7 @@
‘name’ => ‘document_dir’,
‘help’ => lang(‘If you specify a directory (full vfs path) here, %1 displays an action for each document. That action allows to download the specified document with the %1 data inserted.’, lang(‘timesheet’)).’ ‘.
lang(‘The document can contain placeholder like {{%1}}, to be replaced with the data.’,‘ts_title’).’ '.
-
lang('The following document-types are supported:'). implode(',',Api\Storage\Merge::get_file_extensions()),
'run_lang' => false,
'xmlrpc' => True,
'admin' => False,
@@ -248,9 +254,9 @@
unset($params); // not used, but required by function signature
return array(
-
acl::READ => 'read',
-
acl::EDIT => 'edit',
-
acl::DELETE => 'delete',
— trunk/timesheet/inc/class.timesheet_import_csv.inc.php (original)
+++ trunk/timesheet/inc/class.timesheet_import_csv.inc.php Tue Apr 26 20:27:29 2016
@@ -11,12 +11,14 @@
+use EGroupware\Api;
+use EGroupware\Api\Link;
/**
- class import_csv for timesheet
*/
-class timesheet_import_csv implements importexport_iface_import_plugin {
+class timesheet_import_csv implements importexport_iface_import_plugin
+{
private static $plugin_options = array(
‘fieldsep’, // char
’charset’, // string
@@ -146,10 +148,10 @@
$_definition->plugin_options[‘record_owner’] : $this->user;
// Used to try to automatically match names to account IDs
// ‘cat_id’ => $categories->return_sorted_array(0,False,’’,’’,’’,true)
@@ -177,11 +179,11 @@
$result = importexport_import_csv::convert($record, timesheet_egw_record::$types, ‘timesheet’, $lookups, $_definition->plugin_options[‘convert’]);
if($result) $this->warnings[$import_csv->get_current_position()] = $result;
-
// Automatically handle text Api\Categories without explicit Api\Translation
foreach(array('ts_status','cat_id') as $field) {
if(!is_numeric($record[$field])) {
$translate_key = 'translate'.(substr($field,0,2) == 'ts' ? substr($field,2) : '_cat_id');
-
if(($key = array_search($record[$field], $lookups[$field]))) {
$record[$field] = $key;
} elseif(array_key_exists($translate_key, $_definition->plugin_options)) {
$t_field = $_definition->plugin_options[$translate_key];
@@ -212,11 +214,11 @@
‘parent’ => $parent,
‘admin’ => false
);
@@ -230,13 +232,13 @@
// Set creator, unless it’s supposed to come from CSV file
if($_definition->plugin_options[‘owner_from_csv’] && $record[‘ts_owner’]) {
if(!is_numeric($record[‘ts_owner’])) {
-
// Automatically handle text owner without explicit Api\Translation
$new_owner = importexport_helper_functions::account_name2id($record['ts_owner']);
if($new_owner == '') {
$this->errors[$import_csv->get_current_position()] = lang(
'Unable to convert "%1" to account ID. Using plugin setting (%2) for %3.',
$record['ts_owner'],
@@ -253,13 +255,13 @@
if($record[$field] && !is_numeric($record[$field])) {
// Try an automatic conversion
$account_id = importexport_helper_functions::account_name2id($record[$field]);
-
if($account_id && strtoupper(Api\Accounts::username($account_id)) == strtoupper($record[$field])) {
$record[$field] = $account_id;
} else {
$this->errors[$import_csv->get_current_position()] = lang(
'Unable to convert "%1" to account ID. Using plugin setting (%2) for %3.',
$record[$field],
@@ -348,9 +350,9 @@
// Clear old link, if different
if ($_data['ts_id'] && array_key_exists('pm_id', $_data) && $_data['pm_id'] != $old['pm_id']) {
-
egw_link::unlink2(0,TIMESHEET_APP,$_data['ts_id'],0,'projectmanager',$old['pm_id']);
-
}
-
-
Link::unlink2(0,TIMESHEET_APP,$_data['ts_id'],0,'projectmanager',$old['pm_id']);
-
}
-
// Fall through
case 'insert' :
if ( $this->dry_run ) {
@@ -363,7 +365,7 @@
// Set projectmanager link
if ($_data['pm_id']) {
@@ -378,7 +380,7 @@
break;
}
default:
@@ -397,7 +399,7 @@
$id = $_data[$field];
}
if ($app && $app_id) {
— trunk/timesheet/inc/class.timesheet_merge.inc.php (original)
+++ trunk/timesheet/inc/class.timesheet_merge.inc.php Tue Apr 26 20:27:29 2016
@@ -6,16 +6,19 @@
+use EGroupware\Api;
+use EGroupware\Api\Link;
+
/**
- Timesheet - document merge object
/
-class timesheet_merge extends bo_merge
+class timesheet_merge extends Api\Storage\Merge
{
/*
- Functions that can be called via menuaction
@@ -50,8 +53,8 @@
{
parent::__construct();
-
// switch of handling of html formated content, if html is not used
-
$this->parse_html_styles = egw_customfields::use_html('timesheet');
-
// switch of handling of Api\Html formated content, if Api\Html is not used
-
$this->parse_html_styles = Api\Storage\Customfields::use_html('timesheet');
$this->bo = new timesheet_bo();
$this->date_fields += array(
@@ -102,7 +105,7 @@
$info = array();
// Get project manager ID
@@ -152,14 +155,14 @@
}
/**
-
- Generate table with replacements for the preferences
-
- Generate table with replacements for the Api\Preferences
-
*/
public function show_replacements()
{
$GLOBALS[‘egw_info’][‘flags’][‘app_header’] = lang(‘timesheet’).’ - '.lang(‘Replacements for inserting entries into documents’);
$GLOBALS[‘egw_info’][‘flags’][‘nonavbar’] = false;
@@ -223,6 +226,6 @@
echo "</table>\n";
— trunk/timesheet/inc/class.timesheet_tracking.inc.php (original)
+++ trunk/timesheet/inc/class.timesheet_tracking.inc.php Tue Apr 26 20:27:29 2016
@@ -5,15 +5,17 @@
+use EGroupware\Api;
+
/**
- Timesheet - tracking object for the tracker
/
-class timesheet_tracking extends bo_tracking
+class timesheet_tracking extends Api\Storage\Tracking
{
/*
- Application we are tracking (required!)
@@ -62,7 +64,7 @@
/**
- Constructor
-
-
-
@param timesheet_bo $botimesheet
-
-
@param timesheet_bo $bo
-
@return timesheet_tracking
/
function __construct(timesheet_bo $bo)
@@ -81,12 +83,12 @@
/*
- Get a notification-config value
-
-
-
@param string $name
-
- ‘copy’ array of email addresses notifications should be copied too, can depend on $data
-
- ‘lang’ string lang code for copy mail
-
- ‘sender’ string send email address
-
@param array $data current entry
-
-
@param array $old=null old/last state of the entry or null for a new entry
-
-
@param array $old =null old/last state of the entry or null for a new entry
-
@return mixed
*/
function get_config($name,$data,$old=null)
@@ -99,7 +101,7 @@
}
/**
-
- Get the subject for a given entry, reimplementation for get_subject in bo_tracking
-
- Get the subject for a given entry, reimplementation for get_subject in Api\Storage\Tracking
-
- Default implementation uses the link-title
-
@@ -124,11 +126,11 @@
if (!$data[‘ts_modified’] || !$old)
{
return lang(‘New timesheet submitted by %1 at %2’,
— trunk/timesheet/inc/class.timesheet_ui.inc.php (original)
+++ trunk/timesheet/inc/class.timesheet_ui.inc.php Tue Apr 26 20:27:29 2016
@@ -9,6 +9,12 @@
+use EGroupware\Api;
+use EGroupware\Api\Link;
+use EGroupware\Api\Framework;
+use EGroupware\Api\Acl;
+use EGroupware\Api\Etemplate;
/**
-
User interface object of the TimeSheet
@@ -54,7 +60,7 @@
function edit($content = null,$view = false)
{
@@ -63,9 +69,9 @@
{
if (!$this->read((int)$_GET[‘ts_id’]))
{
@@ -75,7 +81,7 @@
$this->data = array(
‘ts_start’ => $this->today,
‘start_time’ => ‘’, // force empty start-time
-
'end_time' => Api\DateTime::to($this->now,'H:i'),
'ts_owner' => $GLOBALS['egw_info']['user']['account_id'],
'cat_id' => (int) $_REQUEST['cat_id'],
'ts_status'=> $GLOBALS['egw_info']['user']['preferences']['timesheet']['predefined_status'],
@@ -91,7 +97,7 @@
$only_admin_edit = true;
$msg = lang(‘only Admin can edit this status’);
}
@@ -113,14 +119,14 @@
if (isset($content[‘start_time’])) // start-time specified
{
//$content[‘ts_start’] += $content[‘start_time’];
-
$start = new Api\DateTime($content['ts_start']);
$start_time = explode(':',$content['start_time']);
$start->setTime($start_time[0],$start_time[1]);
$content['ts_start'] = $start->format('ts');
}
if (isset($content['end_time'])) // end-time specified
{
@@ -137,14 +143,14 @@
elseif ($content[‘ts_duration’] && $end) // no start, calculate from end and duration
{
$content[‘ts_start’] = $end->format(‘ts’) - 60*$content[‘ts_duration’];
-
//echo "<p>end_time=$content[end_time], duration=$content[ts_duration] --> ts_start=$content[ts_start]=".Api\DateTime::to($content['ts_start'])."</p>\n";
}
if ($content['ts_duration'] > 0) unset($content['end_time']);
// now we only deal with start (date+time) and duration
list($button) = @each($content['button']);
$view = $content['view'];
$referer = $content['referer'];
-
$content['ts_project_blur'] = $content['pm_id'] ? Link::title('projectmanager', $content['pm_id']) : '';
$this->data = $content;
foreach(array('button','view','referer','tabs','start_time') as $key)
{
@@ -153,7 +159,7 @@
switch($button)
{
case ‘edit’:
@@ -212,11 +218,11 @@
// update links accordingly
if ($this->data[‘pm_id’])
{
-
Link::link(TIMESHEET_APP,$content['link_to']['to_id'],'projectmanager',$this->data['pm_id']);
}
if ($this->data['old_pm_id'])
{
-
egw_link::unlink2(0,TIMESHEET_APP,$content['link_to']['to_id'],0,'projectmanager',$this->data['old_pm_id']);
-
Link::unlink2(0,TIMESHEET_APP,$content['link_to']['to_id'],0,'projectmanager',$this->data['old_pm_id']);
unset($this->data['old_pm_id']);
}
}
@@ -228,7 +234,7 @@
if ($data[‘app’] == ‘projectmanager’)
{
$this->data[‘pm_id’] = $data[‘id’];
@@ -244,10 +250,10 @@
$msg = lang(‘Entry saved’);
if (is_array($content[‘link_to’][‘to_id’]) && count($content[‘link_to’][‘to_id’]))
{
-
egw_framework::refresh_opener($msg, 'timesheet', $this->data['ts_id'], $content['ts_id'] ? 'edit' : 'add');
-
Framework::refresh_opener($msg, 'timesheet', $this->data['ts_id'], $content['ts_id'] ? 'edit' : 'add');
if ($button == 'apply') break;
if ($button == 'save_new')
{
@@ -256,9 +262,9 @@
if (!is_array($content[‘link_to’][‘to_id’])) // set links again, so new entry gets the same links as the existing one
{
$content[‘link_to’][‘to_id’] = 0;
-
egw_link::link(TIMESHEET_APP,$content['link_to']['to_id'],$link['app'],$link['id'],$link['remark']);
-
Link::link(TIMESHEET_APP,$content['link_to']['to_id'],$link['app'],$link['id'],$link['remark']);
}
}
// create a new entry
@@ -278,7 +284,7 @@
if ($this->delete())
{
$msg = lang(‘Entry deleted’);
@@ -288,7 +294,7 @@
}
// fall-through for save
case ‘cancel’:
@@ -329,13 +335,13 @@
if(!$n)
{
// get title from first linked app
-
$preserv['ts_title_blur'] = Link::title($link_app,$link_id);
// ask first linked app via "timesheet_set" hook, for further data to set, incl. links
-
if (($l_id=$set['link_id'][$i])) egw_link::link(TIMESHEET_APP,$content['link_to']['to_id'],$l_app,$l_id);
-
if (($l_id=$set['link_id'][$i])) Link::link(TIMESHEET_APP,$content['link_to']['to_id'],$l_app,$l_id);
if ($l_app == 'projectmanager') $links[] = $l_id;
}
unset($set['link_app']);
@@ -346,13 +352,13 @@
}
break;
}
-
Link::link(TIMESHEET_APP,$content['link_to']['to_id'],$link_app,$link_id);
}
}
}
elseif ($this->data['ts_id'])
{
-
$links = Link::get_links(TIMESHEET_APP,$this->data['ts_id'],'projectmanager');
}
// make all linked projects availible for the pm-pricelist widget, to be able to choose prices from all
$content['all_pm_ids'] = array_values($links);
@@ -385,9 +391,9 @@
// or the preserved project-blur comming from the current selected project
$content[‘ts_title_blur’] = $preserv[‘ts_title_blur’] ? $preserv[‘ts_title_blur’] : $content[‘ts_project_blur’];
$readonlys = array(
-
'button[delete]' => !$this->data['ts_id'] || !$this->check_acl(Acl::DELETE) || $this->data['ts_status'] == self::DELETED_STATUS,
'button[undelete]' => $this->data['ts_status'] != self::DELETED_STATUS,
-
'button[edit]' => !$view || !$this->check_acl(Acl::EDIT),
'button[save]' => $view,
'button[save_new]' => $view,
'button[apply]' => $view,
@@ -401,7 +407,7 @@
}
$readonlys[‘start_time’] = $readonlys[‘end_time’] = true;
}
@@ -409,7 +415,7 @@
// in view mode, we need to add the owner, if it does not exist, otherwise it’s displayed empty
if ($view && $content[‘ts_owner’] && !isset($edit_grants[$content[‘ts_owner’]]))
{
@@ -454,11 +460,11 @@
/**
* query projects for nextma