Log removal of link in history

This commit is contained in:
Nathan Gray 2012-05-24 17:33:16 +00:00
parent 5647df9636
commit efbb743cc6
3 changed files with 31 additions and 3 deletions

View File

@ -187,6 +187,10 @@ class historylog_widget
$row[$status] = $row['status'];
}
}
// Add in links
self::$status_widgets['~link~'] = 'link-entry';
$tmpl->sel_options[$status]['~link~'] = lang('link');
// adding custom fields automatically to status-widgets, no need for each app to do that
foreach(config::get_customfields($app,true) as $cf_name => $cf_data)
{

View File

@ -590,6 +590,11 @@ class egw_link extends solink
}
$deleted =& solink::unlink($link_id,$app,$id,$owner,$app2 != '!'.self::VFS_APPNAME ? $app2 : '',$id2,$hold_for_purge);
// Log in history
historylog::static_add($app,$id,$GLOBALS['egw_info']['user']['account_id'],'~link~','',$app2.':'.$id2);
historylog::static_add($app2,$id2,$GLOBALS['egw_info']['user']['account_id'],'~link~','',$app.':'.$id);
// only notify on real links, not the one cached for writing or fileattachments
self::notify_unlink($deleted);

View File

@ -121,6 +121,25 @@ class historylog
}
}
/**
* Static function to add a history record
*/
public static function static_add($appname, $id, $user, $field_code, $new_value, $old_value = '')
{
if ($new_value != $old_value)
{
$GLOBALS['egw']->db->insert(self::TABLE,array(
'history_record_id' => $id,
'history_appname' => $appname,
'history_owner' => (int)$user,
'history_status' => $field_code,
'history_new_value' => $new_value,
'history_old_value' => $old_value,
'history_timestamp' => time(),
),false,__LINE__,__FILE__);
}
}
/**
* Search history-log
*
@ -163,7 +182,7 @@ class historylog
/**
* Get a slice of history records
*
*
* Similar to search(), except this one can take a start and a number of records
*/
public static function get_rows(&$query, &$rows) {
@ -188,9 +207,9 @@ class historylog
self::TABLE,
$mysql_calc_rows.'*',
$filter,
__LINE__, __FILE__,
__LINE__, __FILE__,
$query['start'],
'ORDER BY ' . ($query['order'] ? $query['order'] : 'history_id') . ' ' . ($query['sort'] ? $query['sort'] : 'DESC'),
'ORDER BY ' . ($query['order'] ? $query['order'] : 'history_id') . ' ' . ($query['sort'] ? $query['sort'] : 'DESC'),
'phpgwapi',
$query['num_rows']
) as $row) {