mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-27 00:09:13 +01:00
fix for 'cf_link_fields do not create link on inital save' in calendar: reason no id passed when called tracking for new events
This commit is contained in:
parent
9f3a3f0424
commit
11411abef5
@ -1005,6 +1005,7 @@ class calendar_boupdate extends calendar_bo
|
||||
$tracking = new calendar_tracking($this);
|
||||
$event['category'] = implode(',', $this->get_categories($event['category']));
|
||||
$old_event['category'] = implode(',', $this->get_categories($old_event['category']));
|
||||
if (empty($event['id']) && !empty($cal_id)) $event['id']=$cal_id;
|
||||
$tracking->track($event, $old_event);
|
||||
|
||||
return $cal_id;
|
||||
|
@ -266,9 +266,12 @@ abstract class bo_tracking
|
||||
*/
|
||||
protected function update_links(array $data, array $old)
|
||||
{
|
||||
//error_log(__METHOD__.__LINE__.array2string($data).function_backtrace());
|
||||
//error_log(__METHOD__.__LINE__.array2string($this->cf_link_fields));
|
||||
$current_ids = array_unique(array_diff(array_intersect_key($data,$this->cf_link_fields),array('',0,NULL)));
|
||||
$old_ids = $old ? array_unique(array_diff(array_intersect_key($old,$this->cf_link_fields),array('',0,NULL))) : array();
|
||||
|
||||
//error_log(__METHOD__.__LINE__.array2string($current_ids));
|
||||
//error_log(__METHOD__.__LINE__.array2string($old_ids));
|
||||
// create links for added application entry
|
||||
foreach(array_diff($current_ids,$old_ids) as $name => $id)
|
||||
{
|
||||
@ -277,7 +280,10 @@ abstract class bo_tracking
|
||||
list($app,$id) = explode(':',$id);
|
||||
if (!$id) continue; // can be eg. 'addressbook:', if no contact selected
|
||||
}
|
||||
egw_link::link($this->app,$data[$this->id_field],$app,$id);
|
||||
$source_id = $data[$this->id_field];
|
||||
//error_log(__METHOD__.__LINE__.array2string($source_id));
|
||||
if ($source_id) egw_link::link($this->app,$source_id,$app,$id);
|
||||
//error_log(__METHOD__.__LINE__."egw_link::link('$this->app',".array2string($source_id).",'$app',$id);");
|
||||
//echo "<p>egw_link::link('$this->app',{$data[$this->id_field]},'$app',$id);</p>\n";
|
||||
}
|
||||
|
||||
@ -289,7 +295,8 @@ abstract class bo_tracking
|
||||
list($app,$id) = explode(':',$id);
|
||||
if (!$id) continue;
|
||||
}
|
||||
egw_link::unlink(null,$this->app,$data[$this->id_field],0,$app,$id);
|
||||
$source_id = $data[$this->id_field];
|
||||
if ($source_id) egw_link::unlink(null,$this->app,$source_id,0,$app,$id);
|
||||
//echo "<p>egw_link::unlink(NULL,'$this->app',{$data[$this->id_field]},0,'$app',$id);</p>\n";
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user