diff --git a/infolog/inc/class.infolog_ui.inc.php b/infolog/inc/class.infolog_ui.inc.php index d2c2c20803..264eb9c349 100644 --- a/infolog/inc/class.infolog_ui.inc.php +++ b/infolog/inc/class.infolog_ui.inc.php @@ -5,7 +5,7 @@ * @link http://www.egroupware.org * @author Ralf Becker * @package infolog - * @copyright (c) 2003-13 by Ralf Becker + * @copyright (c) 2003-14 by Ralf Becker * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License * @version $Id$ */ @@ -206,14 +206,22 @@ class infolog_ui if ($info['info_id_parent']) $info['class'] .= 'infolog_rowHasParent '; if ($info['info_anz_subs'] > 0) $info['class'] .= 'infolog_rowHasSubs '; + $info['row_mod'] = $info['info_modified']; + if (!$show_links) $show_links = $this->prefs['show_links']; if (($show_links != 'none' && $show_links != 'no_describtion' || $this->prefs['show_times'] || isset($GLOBALS['egw_info']['user']['apps']['timesheet'])) && - (isset($info['links']) || ($info['links'] = egw_link::get_links('infolog',$info['info_id'],'','link_lastmod DESC',true)))) + (isset($info['links']) || ($info['links'] = egw_link::get_links('infolog',$info['info_id'],'','link_lastmod DESC',true,true)))) { $timesheets = array(); foreach ($info['links'] as $link) { + // incl. link modification time into row_mod (link's lastmod is always in server-time!) + $link_mod = egw_time::server2user($link['lastmod']); + if ($info['row_mod'] < $link_mod) $info['row_mod'] = $link_mod; + + if ($link['deleted']) continue; // skip deleted links, but incl. them in row_mod! + if ($show_links != 'none' && $show_links != 'no_describtion' && $link['link_id'] != $info['info_link_id'] && ($link['app'] != $action || $link['id'] != $action_id) && @@ -231,6 +239,8 @@ class infolog_ui { $sum = ExecMethod('timesheet.timesheet_bo.sum',$timesheets); $info['info_sum_timesheets'] = $sum['duration']; + // incl. max timesheet modification in row_mod + if ($info['row_mod'] < $sum['max_modified']) $info['row_mod'] = $sum['max_modified']; } } $info['info_type_label'] = $this->bo->enums['type'][$info['info_type']]; @@ -279,7 +289,7 @@ class infolog_ui } $query['actions'] = $this->get_actions($query); $query['row_id'] = 'info_id'; - $query['row_modified'] = 'info_datemodified'; + $query['row_modified'] = 'row_mod'; $query['parent_id'] = 'info_id_parent'; $query['is_parent'] = 'info_anz_subs'; $query['action_var'] = 'multi_action'; // as 'action' is already used in infolog @@ -398,7 +408,7 @@ class infolog_ui // query all links and sub counts in one go if ($infos && (!$query['csv_export'] || !is_array($query['csv_export']))) { - $links = egw_link::get_links_multiple('infolog',array_keys($infos),true); + $links = egw_link::get_links_multiple('infolog',array_keys($infos),true,'','link_lastmod DESC',true); // true=incl. deleted $anzSubs = $this->bo->anzSubs(array_keys($infos)); } $rows = array(); diff --git a/phpgwapi/inc/class.egw_link.inc.php b/phpgwapi/inc/class.egw_link.inc.php index e923d3a8ff..6eb765fa18 100644 --- a/phpgwapi/inc/class.egw_link.inc.php +++ b/phpgwapi/inc/class.egw_link.inc.php @@ -8,7 +8,7 @@ * * @link http://www.egroupware.org * @author Ralf Becker - * @copyright 2001-2013 by RalfBecker@outdoor-training.de + * @copyright 2001-2014 by RalfBecker@outdoor-training.de * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License * @package api * @subpackage link @@ -16,7 +16,7 @@ */ /** - * Generalized linking between entries of eGroupware apps + * Generalized linking between entries of EGroupware apps * * Please note: this class can NOT and does not need to be initialised, all methods are static * @@ -99,6 +99,9 @@ * Attached files are stored under $vfs_basedir='/infolog' in the vfs! * 3) It manages the link-registry, in which apps can register themselfs by implementing some hooks * 4) It notifies apps, who registered for that service, about changes in the links their entries + * + * Modification times in links (and deleted timestamp) are always in server-time! + * (We dont convert them here, as most apps ignore them anyway) */ class egw_link extends solink { diff --git a/phpgwapi/inc/class.solink.inc.php b/phpgwapi/inc/class.solink.inc.php index e466cd3d32..19a4b4b469 100644 --- a/phpgwapi/inc/class.solink.inc.php +++ b/phpgwapi/inc/class.solink.inc.php @@ -8,7 +8,7 @@ * * @link http://www.egroupware.org * @author Ralf Becker - * @copyright 2001-2013 by RalfBecker@outdoor-training.de + * @copyright 2001-2014 by RalfBecker@outdoor-training.de * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License * @package api * @subpackage link @@ -53,10 +53,9 @@ class solink * @param string $remark='' Remark to be saved with the link (defaults to '') * @param int $owner=0 Owner of the link (defaults to user) * @param int $lastmod=0 timestamp of last modification (defaults to now=time()) - * @param int $no_notify=0 &1 dont notify $app1, &2 dont notify $app2 * @return int/boolean False (for db or param-error) or on success link_id (Please not the return-value of $id1) */ - static function link( $app1,&$id1,$app2,$id2='',$remark='',$owner=0,$lastmod=0,$no_notify=0 ) + static function link( $app1,&$id1,$app2,$id2='',$remark='',$owner=0,$lastmod=0 ) { if (self::DEBUG) { @@ -67,7 +66,7 @@ class solink { return False; // dont link to self or other nosense } - if ($link = self::get_link($app1,$id1,$app2,$id2)) + if (($link = self::get_link($app1,$id1,$app2,$id2))) { if ($link['link_remark'] != $remark) { @@ -186,6 +185,7 @@ class solink 'owner' => $row['link_owner'], 'lastmod' => $row['link_lastmod'], 'link_id' => $row['link_id'], + 'deleted' => $row['deleted'], ); } @@ -303,7 +303,10 @@ class solink } if($hold_for_purge) { - self::$db->update(self::TABLE,array('deleted'=> time()), $where, __LINE__,__FILE__); + self::$db->update(self::TABLE,array( + 'deleted' => time(), + 'link_lastmod' => time(), + ), $where, __LINE__,__FILE__); } else { diff --git a/timesheet/inc/class.timesheet_bo.inc.php b/timesheet/inc/class.timesheet_bo.inc.php index 43ba0a25c4..c1ad1095c4 100644 --- a/timesheet/inc/class.timesheet_bo.inc.php +++ b/timesheet/inc/class.timesheet_bo.inc.php @@ -5,7 +5,7 @@ * @link http://www.egroupware.org * @author Ralf Becker * @package timesheet - * @copyright (c) 2005-13 by Ralf Becker + * @copyright (c) 2005-14 by Ralf Becker * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License * @version $Id$ */ @@ -518,16 +518,21 @@ class timesheet_bo extends so_sql_cf return array(); } unset($criteria); - foreach ($ids as $r =>$v) $id_filter[] = $v['id']; + foreach ($ids as $v) + { + $id_filter[] = $v['id']; + } $filter = array('ts_id'=>$id_filter); } // if we only want to return the summary (sum of duration and sum of price) we have to take care that the customfield table // is not joined, as the join causes a multiplication of the sum per customfield found // joining of the cutomfield table is triggered by criteria being set with either a string or an array - $this->summary = parent::search(($only_summary?false:$criteria),"SUM(ts_duration) AS duration,SUM($total_sql) AS price". + $this->summary = parent::search(($only_summary?false:$criteria), + "SUM(ts_duration) AS duration,SUM($total_sql) AS price,MAX(ts_modified) AS max_modified". ($this->quantity_sum ? ",SUM(ts_quantity) AS quantity" : ''), '','',$wildcard,$empty,$op,false,($only_summary&&is_array($criteria)&&is_array($filter)?array_merge($criteria,$filter):$filter),($only_summary?'':$join)); $this->summary = $this->summary[0]; + $this->summary['max_modified'] = egw_time::server2user($this->summary['max_modified']); if ($only_summary) return $this->summary; @@ -676,7 +681,7 @@ class timesheet_bo extends so_sql_cf } $ts_id = is_null($keys) ? $this->data['ts_id'] : $keys['ts_id']; - if (!$this->check_acl(EGW_ACL_DELETE,$ts_id) || !($old = $this->read($ts_id))) + if (!$ignore_acl && !$this->check_acl(EGW_ACL_DELETE,$ts_id) || !($old = $this->read($ts_id))) { return false; } @@ -727,11 +732,11 @@ class timesheet_bo extends so_sql_cf /** * set a status for timesheet entry identified by $keys * - * @param array $keys if given array with col => value pairs to characterise the rows to delete - * @param boolean $status + * @param array $keys=null if given array with col => value pairs to characterise single timesheet or null for $this->data + * @param int $status=0 * @return int affected rows, should be 1 if ok, 0 if an error */ - function set_status($keys=null,$status) + function set_status($keys=null, $status=0) { $ret = true; if (!is_array($keys) && (int) $keys) @@ -752,10 +757,10 @@ class timesheet_bo extends so_sql_cf } /** - * Get the time- and pricesum for the given timesheet entries + * Get the time-, price-, quantity-sum and max. modification date for the given timesheet entries * * @param array $ids array of timesheet id's - * @return array with keys time and price + * @return array with values for keys "duration", "price", "max_modified" and "quantity" */ function sum($ids) { @@ -854,6 +859,8 @@ class timesheet_bo extends so_sql_cf */ function file_access($id,$check,$rel_path=null,$user=null) { + unset($rel_path); // not used, but required by function signature + return $this->check_acl($check,$id,$user); }