fixed writeing of temp. alphanumerical info_link_id to the db, as pgSql complains about the wrong type

This commit is contained in:
Ralf Becker 2003-03-20 17:22:53 +00:00
parent 686537ac7a
commit 74fc92f617
2 changed files with 18 additions and 7 deletions

View File

@ -37,7 +37,7 @@
'attached_local' => True,
'link_title' => True,
'link_query' => True,
'link_id2title' => True
'link_id2from' => True
);
var $enums;
var $so;
@ -129,8 +129,9 @@
$this->so->init();
}
function link_id2title(&$info,$not_app='',$not_id='')
function link_id2from(&$info,$not_app='',$not_id='')
{
//echo "<p>boinfolog::link_id2title(subject='$info[info_subject]', link_id='$info[info_link_id], from='$info[info_from]')";
if ($info['info_link_id'] > 0 &&
($link = $this->link->get_link($info['info_link_id'])) !== False)
{
@ -149,6 +150,7 @@
$info['info_link_view'] = $this->link->view($link['link_app'.$nr],$link['link_id'.$nr]);
$info['info_from'] = $info['info_link_title'] = $title;
}
//echo " title='$title'</p>\n";
return $title;
}
return False;

View File

@ -96,7 +96,7 @@
}
$info['info_des'] = nl2br($info['info_des']);
$info['info_anz_subs'] = $this->bo->anzSubs($id);
$this->bo->link_id2title(&$info,$action,$action_id);
$this->bo->link_id2from($info,$action,$action_id);
$readonlys["edit[$id]"] = !$this->bo->check_access($id,PHPGW_ACL_EDIT);
$readonlys["delete[$id]"] = !$this->bo->check_access($id,PHPGW_ACL_DELETE);
@ -281,21 +281,30 @@
{
if ($content['save'] && (!$info_id || $this->bo->check_access($info_id,PHPGW_ACL_EDIT)))
{
if (strstr($content['info_link_id'],':') !== False)
{
$info_link_id = $content['info_link_id'];
$content['info_link_id'] = 0; // as field has to be int
}
if ($content['info_link_id'] && empty($content['info_from']))
{
$this->bo->link_id2from($content);
}
$this->bo->write($content);
if (!$info_id && is_array($content['link_to']['to_id'])) // writing link for new entry
{
$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)
if ($info_link_id)
{
list($app,$id) = explode(':',$content['info_link_id']);
list($app,$id) = explode(':',$info_link_id);
$link = $this->link->get_link('infolog',$content['info_id'],$app,$id);
$content['info_link_id'] = $link['link_id'];
if ($content['info_from'] == '')
if (empty($content['info_from']))
{
$content['info_from'] = $this->bo->link_id2title($content);
$this->bo->link_id2from($content);
}
$this->bo->write(array(
'info_id' => $content['info_id'],