some fixes to get the links working in case the entry is not yet created

This commit is contained in:
Ralf Becker 2002-10-18 20:20:35 +00:00
parent 65c0123279
commit 6e17b96dd9
5 changed files with 52 additions and 30 deletions

View File

@ -140,11 +140,11 @@
case 'create':
if ($value['to_app']) // make the link
{
$this->link->link($value['to_app'],$value['to_id'],$value['app'],$value['id'],$value['remark']);
$link_id = $this->link->link($value['to_app'],$value['to_id'],$value['app'],$value['id'],$value['remark']);
//echo "<p>link($value[to_app],$value[to_id],$value[app],$value[id],'$value[remark]')</p>\n";
if (isset($value['primary']) && !$value['anz_links'] )
{
$value['primary'] = $value['app'].'/'.$value['id'];
$value['primary'] = $link_id;
}
}
// fall-trough

View File

@ -208,7 +208,7 @@
}
else
{
ExecMethod($session_data['method'],$this->complete_array_merge($content,$session_data['preserv']));
ExecMethod($session_data['method'],$this->complete_array_merge($session_data['preserv'],$content));
}
}
@ -358,10 +358,14 @@
each($cols); // skip next cell(s)
}
}
elseif ($opts[$col]) // width only once for a non colspan cell
else
{
$row_data[".$col"] .= ' WIDTH='.$opts[$col];
$opts[$col] = 0;
list($width,$disable) = explode(',',$opts[$col]);
if ($width) // width only once for a non colspan cell
{
$row_data[".$col"] .= " WIDTH=\"$width\"";
$opts[$col] = "0,$disable";
}
}
$row_data[".$col"] .= $this->html->formatOptions($cell['align'],'ALIGN');
list(,$cl) = explode(',',$cell['span']);

View File

@ -179,7 +179,7 @@
$this->so->delete($info_id);
}
function write($values)
function write($values,$check_defaults=True)
{
while (list($key,$val) = each($values))
{
@ -189,21 +189,24 @@
unset($values[$key]);
}
}
if ($values['info_responsible'] && $values['info_status'] == 'offer')
if ($check_defaults)
{
$values['info_status'] = 'ongoing'; // have to match if not finished
}
if (!$values['info_id'] && !$values['info_owner'])
{
$values['info_owner'] = $this->so->user;
}
if (!$values['info_subject'])
{
$values['info_subject'] = substr($values['info_des'],0,60).' ...';
}
if ($values['info_link_id'] && $values['info_from'] == '')
{
$values['info_from'] = $this->link_id2title($values);
if ($values['info_responsible'] && $values['info_status'] == 'offer')
{
$values['info_status'] = 'ongoing'; // have to match if not finished
}
if (!$values['info_id'] && !$values['info_owner'])
{
$values['info_owner'] = $this->so->user;
}
if (!$values['info_subject'])
{
$values['info_subject'] = substr($values['info_des'],0,60).' ...';
}
if ($values['info_link_id'] && $values['info_from'] == '')
{
$values['info_from'] = $this->link_id2title($values);
}
}
$values['info_datemodified'] = time();
$values['info_modifier'] = $this->so->user;

View File

@ -61,7 +61,7 @@
*/
function link( $app1,$id1,$app2,$id2,$remark='',$owner=0,$lastmod=0 )
{
if ($this->debug)
//if ($this->debug)
{
echo "<p>solink.link('$app1',$id1,'$app2',$id2,'$remark',$owner)</p>\n";
}
@ -167,6 +167,10 @@
*/
function get_link($app_link_id,$id='',$app2='',$id2='')
{
if ($this->debug)
{
echo "<p>solink.get_link('$app_link_id',$id,'$app2','$id2')</p>\n";
}
$sql = "SELECT * FROM $this->db_name WHERE ";
if (intval($app_link_id) > 0)
{
@ -185,6 +189,10 @@
if ($this->db->next_record())
{
if ($this->debug)
{
_debug_array($this->db->Record);
}
return $this->db->Record;
}
return False;

View File

@ -143,7 +143,6 @@
{
$referer = is_array($values) ? $values['referer'] : $referer;
//echo "<p>uiinfolog::index(action='$action/$action_id',referer='$referer/$values[referer]')</p>\n";
if (!is_array($values))
{
$values = array('nm' => $GLOBALS['phpgw']->session->appsession('session_data','infolog'));
@ -262,6 +261,7 @@
{
if (is_array($content))
{
//echo "uiinfolog::edit: content="; _debug_array($content);
$info_id = $content['info_id'];
$action = $content['action'];
$action_id = $content['action_id'];
@ -271,7 +271,7 @@
{
$content['info_link_id'] = $content['link_to']['primary'];
}
if (!$this->link->get_link($content['info_link_id']))
if (intval($content['info_link_id']) > 0 && !$this->link->get_link($content['info_link_id']))
{
$content['info_link_id'] = 0; // link has been deleted
}
@ -288,16 +288,23 @@
if (!$info_id && is_array($content['link_to']['to_id'])) // writing link for new entry
{
$info_id = $this->bo->so->data['info_id'];
$this->link->link('infolog',$info_id,$content['link_to']['to_id']);
$content['info_id'] = $this->bo->so->data['info_id'];
$this->link->link('infolog',$content['info_id'],$content['link_to']['to_id']);
if (strstr($content['info_link_id'],':') !== False)
{
list($app,$id) = explode(':',$content['info_link_id']);
$content['info_link_id'] = $this->link->get_link('info_log',$info_id,$app,$id);
$link = $this->link->get_link('infolog',$content['info_id'],$app,$id);
$content['info_link_id'] = $link['link_id'];
if ($content['info_from'] == '')
{
$content['info_from'] = $this->bo->link_id2title($content);
}
$this->bo->write(array(
'info_id' => $info_id,
'info_link_id' => $content['info_link_id']
));
'info_id' => $content['info_id'],
'info_link_id' => $content['info_link_id'],
'info_from' => $content['info_from']
),False);
}
}
}