mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-03 04:29:28 +01:00
Fix for a problem with cumulating timesheets when the linking application is other than initiated by $app1, means for whom link_app1=$app1 and app1
being the application passed on in the get_3links function parameter list.
This commit is contained in:
parent
1055642df3
commit
a10101d640
@ -353,16 +353,42 @@ class solink
|
|||||||
function get_3links($app,$target_app,$target_id=null)
|
function get_3links($app,$target_app,$target_id=null)
|
||||||
{
|
{
|
||||||
$links = array();
|
$links = array();
|
||||||
$this->db->select($this->link_table,'c.*,b.link_app1 AS app3,b.link_id1 AS id3,b.link_id AS link3',
|
$table_def = $this->db->get_table_definitions('phpgwapi',$this->link_table);
|
||||||
'a.link_app1='.$this->db->quote($app).' AND c.link_app2='.$this->db->quote($target_app).
|
$arrayofselects=array(
|
||||||
(!$target_id ? '' : $this->db->expression($this->link_table,' AND c.',array('link_id2' => $target_id))),
|
// retrieve the type of links, where the relation is realized as timesheet->infolog/tracker via infolog->projectmanager to timesheet->projectmanager
|
||||||
__LINE__,__FILE__,false,'',false,0," a
|
array('table'=>$this->link_table,
|
||||||
JOIN $this->link_table b ON a.link_id2=b.link_id1 AND a.link_app2=b.link_app1
|
'cols'=>'c.*,b.link_app1 AS app3,b.link_id1 AS id3,b.link_id AS link3',
|
||||||
JOIN $this->link_table c ON a.link_id1=c.link_id1 AND a.link_app1=c.link_app1 AND a.link_id!=c.link_id AND c.link_app2=b.link_app2 AND c.link_id2=b.link_id2");
|
'where'=>'a.link_app1='.$this->db->quote($app).' AND c.link_app2='.$this->db->quote($target_app).
|
||||||
while (($row = $this->db->row(true,'link_')))
|
(!$target_id ? '' : $this->db->expression($this->link_table,' AND c.',array('link_id2' => $target_id))),
|
||||||
{
|
'join'=>" a
|
||||||
$links[] = $row;
|
JOIN $this->link_table b ON a.link_id2=b.link_id1 AND a.link_app2=b.link_app1
|
||||||
}
|
JOIN $this->link_table c ON a.link_id1=c.link_id1 AND a.link_app1=c.link_app1 AND a.link_id!=c.link_id AND c.link_app2=b.link_app2 AND c.link_id2=b.link_id2",
|
||||||
return $links;
|
'table_def'=>$table_def
|
||||||
|
),
|
||||||
|
// retrieve the type of links, where the relation is realized as timesheet->infolog/tracker and projectmanager->timesheet
|
||||||
|
array('table'=>$this->link_table,
|
||||||
|
'cols'=>'b.link_id, b.link_app2 as app1, b.link_id2 as id1, b.link_app1 as app2, b.link_id1 as id2, b.link_remark,b.link_lastmod,b.link_owner,c.link_app1 AS app3,c.link_id1 AS id3,c.link_id AS link3',
|
||||||
|
'where'=>'a.link_app1='.$this->db->quote($app).' AND b.link_app1='.$this->db->quote($target_app).
|
||||||
|
(!$target_id ? '' : $this->db->expression($this->link_table,' AND b.',array('link_id1' => $target_id))),
|
||||||
|
'join'=>" a
|
||||||
|
JOIN $this->link_table b ON a.link_id1=b.link_id2 AND a.link_app1=b.link_app2
|
||||||
|
JOIN egw_links c ON a.link_id2=c.link_id1 AND a.link_app2=c.link_app1 AND a.link_id!=c.link_id AND c.link_app2=b.link_app1 AND c.link_id2=b.link_id1",
|
||||||
|
'table_def'=>$table_def),
|
||||||
|
// retrieve the type of links, where the relation is realized as timesheet->projectmanager and infolog->timesheet
|
||||||
|
array('table'=>$this->link_table,
|
||||||
|
'cols'=>'a.*,c.link_app1 AS app3,c.link_id1 AS id3,c.link_id AS link3',
|
||||||
|
'where'=>'a.link_app1='.$this->db->quote($app).' AND a.link_app2='.$this->db->quote($target_app).
|
||||||
|
(!$target_id ? '' : $this->db->expression($this->link_table,' AND a.',array('link_id2' => $target_id))),
|
||||||
|
'join'=>" a
|
||||||
|
JOIN $this->link_table b ON a.link_id1=b.link_id2 AND a.link_app1=b.link_app2
|
||||||
|
JOIN egw_links c ON a.link_id2=c.link_id2 AND a.link_app2=c.link_app2 AND a.link_id!=c.link_id AND c.link_app1=b.link_app1 AND c.link_id1=b.link_id1",
|
||||||
|
'table_def'=>$table_def),
|
||||||
|
);
|
||||||
|
$this->db->union($arrayofselects,__LINE__,__FILE__);
|
||||||
|
while (($row = $this->db->row(true,'link_')))
|
||||||
|
{
|
||||||
|
$links[] = $row;
|
||||||
|
}
|
||||||
|
return $links;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user