Fix contact not saved properly for new entries

This commit is contained in:
nathangray 2016-12-09 12:02:02 -07:00
parent ba61821d4d
commit 5ce0060f71
2 changed files with 15 additions and 6 deletions

View File

@ -423,7 +423,7 @@ class infolog_bo
*/
function link_id2from(&$info,$not_app='',$not_id='')
{
//echo "<p>boinfolog::link_id2from(subject='$info[info_subject]', link_id='$info[info_link_id]', from='$info[info_from]', not_app='$not_app', not_id='$not_id')";
//error_log(__METHOD__ . "(subject='{$info['info_subject']}', link_id='{$info['info_link_id']}', from='{$info['info_from']}', not_app='$not_app', not_id='$not_id')");
if ($info['info_link_id'] > 0 &&
(isset($info['links']) && ($link = $info['links'][$info['info_link_id']]) || // use supplied links info
@ -955,6 +955,8 @@ class infolog_bo
$this->write_check_links($to_write);
if(!$values['info_link_id'] && $to_write['info_link_id'])
{
// Just got a link ID, need to save it
$this->so->write($to_write);
$values['info_link_id'] = $to_write['info_link_id'];
}

View File

@ -233,7 +233,8 @@ class infolog_tracking extends Api\Storage\Tracking
) as $name => $value)
{
//error_log(__METHOD__.__LINE__.' Key:'.$name.' val:'.array2string($value));
if ($name=='info_from' && empty($value) && !empty($data['info_contact']) && is_array($data['link_to']['to_id']))
if ($name=='info_from' && empty($value))
if(!empty($data['info_contact']) && is_array($data['link_to']['to_id']))
{
$lkeys = array_keys($data['link_to']['to_id']);
if (in_array($data['info_contact'],$lkeys))
@ -242,6 +243,12 @@ class infolog_tracking extends Api\Storage\Tracking
if (!empty($app)&&!empty($id)) $value = Link::title($app,$id);
}
}
else if ($data['info_link_id'])
{
$this->infolog->link_id2from($data);
list($app,$id) = explode(':',$data['info_contact']);
if (!empty($app)&&!empty($id)) $value = Link::title($app,$id);
}
$details[$name] = array(
'label' => lang($this->field2label[$name]),
'value' => $value,