[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [11359] property: related at location
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [11359] property: related at location |
Date: |
Wed, 09 Oct 2013 13:56:39 +0000 |
Revision: 11359
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11359
Author: sigurdne
Date: 2013-10-09 13:56:36 +0000 (Wed, 09 Oct 2013)
Log Message:
-----------
property: related at location
Modified Paths:
--------------
trunk/property/inc/class.boentity.inc.php
trunk/property/inc/class.bolocation.inc.php
trunk/property/inc/class.bos_agreement.inc.php
trunk/property/inc/class.solocation.inc.php
trunk/property/inc/class.sos_agreement.inc.php
trunk/property/inc/class.uilocation.inc.php
trunk/property/inc/class.uis_agreement.inc.php
trunk/property/setup/phpgw_no.lang
trunk/property/templates/base/location.xsl
Modified: trunk/property/inc/class.boentity.inc.php
===================================================================
--- trunk/property/inc/class.boentity.inc.php 2013-10-08 13:59:52 UTC (rev
11358)
+++ trunk/property/inc/class.boentity.inc.php 2013-10-09 13:56:36 UTC (rev
11359)
@@ -64,7 +64,7 @@
var $type_app = array();
var $type;
- function property_boentity($session=false, $type = '',
$entity_id = 0, $cat_id = 0)
+ function __construct($session=false, $type = '', $entity_id =
0, $cat_id = 0)
{
$this->solocation =
CreateObject('property.solocation');
$this->bocommon =
CreateObject('property.bocommon');
Modified: trunk/property/inc/class.bolocation.inc.php
===================================================================
--- trunk/property/inc/class.bolocation.inc.php 2013-10-08 13:59:52 UTC (rev
11358)
+++ trunk/property/inc/class.bolocation.inc.php 2013-10-09 13:56:36 UTC (rev
11359)
@@ -201,9 +201,9 @@
return $this->bocommon->select_list($selected,$list);
}
- function read_entity_to_link($location_code)
+ function read_entity_to_link($location_code, $exact = false)
{
- return $this->so->read_entity_to_link($location_code);
+ return $this->so->read_entity_to_link($location_code,
$exact);
}
function get_owner_list($format='',$selected='')
Modified: trunk/property/inc/class.bos_agreement.inc.php
===================================================================
--- trunk/property/inc/class.bos_agreement.inc.php 2013-10-08 13:59:52 UTC
(rev 11358)
+++ trunk/property/inc/class.bos_agreement.inc.php 2013-10-09 13:56:36 UTC
(rev 11359)
@@ -43,6 +43,7 @@
var $role;
var $member_id;
var $uicols = array();
+ var $location_code;
/**
* @var object $custom reference to custom fields object
@@ -82,7 +83,8 @@
$allrows =
phpgw::get_var('allrows', 'bool');
$role =
phpgw::get_var('role');
$member_id =
phpgw::get_var('member_id', 'int');
- $status_id = phpgw::get_var('status_id', 'int');
+ $status_id =
phpgw::get_var('status_id', 'int');
+ $this->location_code= phpgw::get_var('location_code');
$this->p_num = phpgw::get_var('p_num');
@@ -176,7 +178,7 @@
{
$s_agreements = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
'filter' => $this->filter,'cat_id' =>
$this->cat_id,'allrows'=>$this->allrows,'member_id'=>$this->member_id,
- 'vendor_id'=>$this->vendor_id, 'p_num' =>
$this->p_num, 'status_id'=>$this->status_id));
+ 'vendor_id'=>$this->vendor_id, 'p_num' =>
$this->p_num, 'status_id'=>$this->status_id, 'location_code' =>
$this->location_code));
$this->total_records = $this->so->total_records;
$this->uicols = $this->so->uicols;
Modified: trunk/property/inc/class.solocation.inc.php
===================================================================
--- trunk/property/inc/class.solocation.inc.php 2013-10-08 13:59:52 UTC (rev
11358)
+++ trunk/property/inc/class.solocation.inc.php 2013-10-09 13:56:36 UTC (rev
11359)
@@ -61,8 +61,10 @@
$this->like = & $this->db->like;
}
- function read_entity_to_link($location_code)
+ function read_entity_to_link($location_code, $exact = false)
{
+ $condition = $exact ? "= '{$location_code}'" :
"{$this->like} '{$location_code}%'";
+
$entity = array();
$type_app =
execMethod('property.soentity.get_type_app');
@@ -99,11 +101,11 @@
$this->db->query("SELECT id as
bim_type FROM fm_bim_type WHERE location_id =
{$location_id}",__LINE__,__FILE__);
$this->db->next_record();
$bim_type =
(int)$this->db->f('bim_type');
- $sql = "SELECT count(*) as hits
FROM fm_bim_item WHERE location_code {$this->like} '$location_code%' AND type =
{$bim_type}";
+ $sql = "SELECT count(*) as hits
FROM fm_bim_item WHERE location_code {$condition} AND type = {$bim_type}";
}
else
{
- $sql = "SELECT count(*) as hits
FROM fm_{$type}_{$entry['entity_id']}_{$entry['cat_id']} WHERE location_code
{$this->like} '$location_code%'";
+ $sql = "SELECT count(*) as hits
FROM fm_{$type}_{$entry['entity_id']}_{$entry['cat_id']} WHERE location_code
{$condition}";
}
$this->db->query($sql,__LINE__,__FILE__);
@@ -128,7 +130,7 @@
}
}
- $sql = "SELECT count(*) as hits FROM fm_tts_tickets
WHERE location_code $this->like '$location_code%'";
+ $sql = "SELECT count(*) as hits FROM fm_tts_tickets
WHERE location_code {$condition}";
$this->db->query($sql,__LINE__,__FILE__);
$this->db->next_record();
if($this->db->f('hits'))
@@ -142,7 +144,7 @@
);
}
- $sql = "SELECT count(*) as hits FROM fm_request WHERE
location_code $this->like '$location_code%'";
+ $sql = "SELECT count(*) as hits FROM fm_request WHERE
location_code {$condition}";
$this->db->query($sql,__LINE__,__FILE__);
$this->db->next_record();
if($this->db->f('hits'))
@@ -156,7 +158,7 @@
);
}
- $sql = "SELECT count(*) as hits FROM fm_project WHERE
location_code $this->like '$location_code%'";
+ $sql = "SELECT count(*) as hits FROM fm_project WHERE
location_code {$condition}";
$this->db->query($sql,__LINE__,__FILE__);
$this->db->next_record();
if($this->db->f('hits'))
@@ -170,7 +172,7 @@
);
}
- $sql = "SELECT count(*) as hits FROM fm_gab_location
WHERE location_code $this->like '$location_code%'";
+ $sql = "SELECT count(*) as hits FROM fm_gab_location
WHERE location_code {$condition}";
$this->db->query($sql,__LINE__,__FILE__);
$this->db->next_record();
if($this->db->f('hits'))
@@ -185,16 +187,19 @@
}
- $sql = "SELECT count(*) as hits FROM fm_s_agreement
{$this->join} fm_s_agreement_detail ON fm_s_agreement.id =
fm_s_agreement_detail.agreement_id WHERE location_code {$this->like}
'$location_code%'";
+ $sql = "SELECT DISTINCT fm_s_agreement.id FROM
fm_s_agreement"
+ . " {$this->join} fm_s_agreement_detail ON
fm_s_agreement.id = fm_s_agreement_detail.agreement_id"
+ . " WHERE location_code {$condition}"
+ . " GROUP BY fm_s_agreement.id";
$this->db->query($sql,__LINE__,__FILE__);
- $this->db->next_record();
- if($this->db->f('hits'))
+ $hits = $this->db->num_rows();
+
+ if( $hits )
{
- $hits = $this->db->f('hits');
$entity['related'][] = array
(
'entity_link' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction' =>
'property.uis_agreement.index',
-
'query'=> $location_code)),
+
'location_code'=>
$location_code)),
'name' =>
lang('service agreement') . " [{$hits}]",
'descr' =>
lang('service agreement')
);
Modified: trunk/property/inc/class.sos_agreement.inc.php
===================================================================
--- trunk/property/inc/class.sos_agreement.inc.php 2013-10-08 13:59:52 UTC
(rev 11358)
+++ trunk/property/inc/class.sos_agreement.inc.php 2013-10-09 13:56:36 UTC
(rev 11359)
@@ -83,6 +83,7 @@
$detail =
isset($data['detail'])?$data['detail']:'';
$p_num = isset($data['p_num'])
? $data['p_num'] : '';
$status_id =
isset($data['status_id']) && $data['status_id'] ? (int)$data['status_id']:0;
+ $location_code =
isset($data['location_code'])?$data['location_code']:'';
}
$choice_table = 'phpgw_cust_choice';
@@ -157,7 +158,7 @@
$attribute_filter = " location_id =
{$location_id}";
$paranthesis .='(';
- $joinmethod .= " $this->join
fm_s_agreement_pricing ON ( $entity_table.agreement_id
=fm_s_agreement_pricing.agreement_id AND $entity_table.id
=fm_s_agreement_pricing.item_id))";
+ $joinmethod .= " {$this->join}
fm_s_agreement_pricing ON ( $entity_table.agreement_id
=fm_s_agreement_pricing.agreement_id AND {$entity_table}.id
=fm_s_agreement_pricing.item_id))";
$cols = "$entity_table.*,
fm_s_agreement_pricing.cost,fm_s_agreement_pricing.id as
index_count,fm_s_agreement_pricing.index_date,fm_s_agreement_pricing.item_id,fm_s_agreement_pricing.this_index";
@@ -347,6 +348,12 @@
$where= 'AND';
}
+ if ($location_code)
+ {
+ $filtermethod .= " $where location_code
{$this->like} '{$location_code}%'";
+ $where= 'AND';
+ }
+
if ($cat_id && !$detail)
{
$filtermethod .= " $where
$entity_table.category='$cat_id' ";
Modified: trunk/property/inc/class.uilocation.inc.php
===================================================================
--- trunk/property/inc/class.uilocation.inc.php 2013-10-08 13:59:52 UTC (rev
11358)
+++ trunk/property/inc/class.uilocation.inc.php 2013-10-09 13:56:36 UTC (rev
11359)
@@ -2227,10 +2227,19 @@
}
//_debug_array($roles);die();
+ $location_arr = explode('-', $location_code);
+//_debug_array($location_arr);die();
- $related =
$this->bo->read_entity_to_link($location_code);
+ $related = array();
+ $_location_level_arr = array();
+ foreach($location_arr as $_location_level)
+ {
+ $_exact = $location_code ==
$_location_level ? false : true;
+ $_location_level_arr[] =
$_location_level;
+ $location_level = implode('-',
$_location_level_arr);
+ $related[$location_level] =
$this->bo->read_entity_to_link($location_level, $_exact);
+ }
//_debug_array($related);die();
- $related_link = array();
$location_type_info =
$this->soadmin_location->read_single($type_id);
$documents = array();
@@ -2273,56 +2282,45 @@
$file_tree = json_encode($file_tree);
}
- if(isset($related['related']))
+ $_related = array();
+ foreach($related as $_location_level =>
$related_info)
{
- $tabs['related'] = array('label'
=> lang('related'), 'link' => '#related');
- }
-
-
-// old
- foreach($related as $related_key =>
$related_data)
- {
- if( $related_key == 'gab')
+ if(isset($related_info['related']))
{
- foreach($related_data as $entry)
+ foreach($related_info as
$related_key => $related_data)
{
- $entities_link[] = array
- (
-
'entity_link' => $entry['entity_link'],
-
'lang_entity_statustext' => $entry['descr'],
-
'text_entity' => $entry['name'],
- );
+ if( $related_key ==
'gab')
+ {
+
foreach($related_data as $entry)
+ {
+
$entities_link[] = array
+
(
+
'entity_link' => $entry['entity_link'],
+
'lang_entity_statustext' => $entry['descr'],
+
'text_entity' => $entry['name'],
+
);
+ }
+ }
+ else
+ {
+
foreach($related_data as $entry)
+ {
+
$_related[] = array
+ (
+
'where' => $_location_level,
+
'url' => "<a href=\"{$entry['entity_link']}\" > {$entry['name']}</a>",
+ );
+ }
+ }
}
}
-
- if( $related_key == 'related')
- {
- foreach($related_data as $entry)
- {
- $related_link[] = array
- (
-
'entity_link' => $entry['entity_link'],
-
'lang_entity_statustext' => $entry['descr'],
-
'text_entity' => $entry['name'],
- );
-
- }
- }
}
-//end old
- $_related = array();
- if(isset($related['related']))
+
+ $related_link = $_related ? true : false;
+
+ if($_related)
{
- foreach($related as $related_key =>
$related_data)
- {
- foreach($related_data as $entry)
- {
- $_related[] = array
- (
- 'url'
=> "<a href=\"{$entry['entity_link']}\" > {$entry['name']}</a>",
- );
- }
- }
+ $tabs['related'] = array('label'
=> lang('related'), 'link' => '#related');
}
@@ -2342,7 +2340,8 @@
(
'name' => "0",
'values' =>
json_encode(array(
- array('key' =>
'url','label'=>lang('where'),'sortable'=>false,'resizeable'=>true),
+ array('key' =>
'where','label'=>lang('where'),'sortable'=>false,'resizeable'=>true),
+ array('key' =>
'url','label'=>lang('what'),'sortable'=>false,'resizeable'=>true),
)
)
);
Modified: trunk/property/inc/class.uis_agreement.inc.php
===================================================================
--- trunk/property/inc/class.uis_agreement.inc.php 2013-10-08 13:59:52 UTC
(rev 11358)
+++ trunk/property/inc/class.uis_agreement.inc.php 2013-10-09 13:56:36 UTC
(rev 11359)
@@ -93,6 +93,7 @@
$this->member_id =
$this->bo->member_id;
$this->p_num =
$this->bo->p_num;
$this->status_id =
$this->bo->status_id;
+ $this->location_code =
$this->bo->location_code;
}
function save_sessiondata()
@@ -189,15 +190,16 @@
$datatable['config']['base_url'] =
$GLOBALS['phpgw']->link('/index.php', array
(
'menuaction' =>
'property.uis_agreement.index',
- 'sort' =>$this->sort,
- 'order' =>$this->order,
- 'cat_id' =>$this->cat_id,
- 'filter' =>$this->filter,
- 'query' =>$this->query,
- 'role' => $this->role,
- 'member_id' =>
$this->member_id,
- 'p_num' => $this->p_num,
- 'status_id' =>
$this->status_id
+ 'sort'
=>$this->sort,
+ 'order'
=>$this->order,
+ 'cat_id'
=>$this->cat_id,
+ 'filter'
=>$this->filter,
+ 'query'
=>$this->query,
+ 'role' =>
$this->role,
+ 'member_id' =>
$this->member_id,
+ 'p_num' =>
$this->p_num,
+ 'status_id' =>
$this->status_id,
+ 'location_code' =>
$this->location_code
));
$datatable['config']['base_java_url'] =
"menuaction:'property.uis_agreement.index',"
@@ -210,6 +212,7 @@
."query:'{$this->query}',"
."p_num: '{$this->p_num}',"
."role:'{$this->role}',"
+
."location_code:'{$this->location_code}',"
."member_id:'{$this->member_id}'";
$datatable['config']['allow_allrows'] = true;
@@ -252,14 +255,15 @@
array
(
'menuaction'
=> 'property.uis_agreement.index',
- 'sort'
=>$this->sort,
- 'order'
=>$this->order,
- 'cat_id'
=>$this->cat_id,
- 'filter'
=>$this->filter,
- 'query'
=>$this->query,
- 'role'
=> $this->role,
- 'member_id'
=> $this->member_id,
- 'status_id'
=> $this->status_id
+ 'sort'
=> $this->sort,
+ 'order'
=> $this->order,
+ 'cat_id'
=> $this->cat_id,
+ 'filter'
=> $this->filter,
+ 'query'
=> $this->query,
+ 'role'
=> $this->role,
+ 'member_id'
=> $this->member_id,
+ 'status_id'
=> $this->status_id,
+ 'location_code'
=> $this->location_code
)
),
'fields' => array
Modified: trunk/property/setup/phpgw_no.lang
===================================================================
--- trunk/property/setup/phpgw_no.lang 2013-10-08 13:59:52 UTC (rev 11358)
+++ trunk/property/setup/phpgw_no.lang 2013-10-09 13:56:36 UTC (rev 11359)
@@ -2012,3 +2012,4 @@
cost operation property no Andel driftskonstnad i kr.
cost investment property no Andel investering i kr.
grant category property no Tilskuddskategori
+what property no Hva
Modified: trunk/property/templates/base/location.xsl
===================================================================
--- trunk/property/templates/base/location.xsl 2013-10-08 13:59:52 UTC (rev
11358)
+++ trunk/property/templates/base/location.xsl 2013-10-09 13:56:36 UTC (rev
11359)
@@ -589,13 +589,6 @@
<table
cellpadding="2" cellspacing="2" width="80%" align="center">
<tr>
<td>
-
<table width="100%" cellpadding="2" cellspacing="2" align="center">
-
<xsl:apply-templates select="related_link"/>
-
</table>
-
</td>
- </tr>
- <tr>
-
<td>
<div id="datatable-container_0"/>
</td>
</tr>
@@ -798,22 +791,6 @@
</tr>
</xsl:template>
- <!-- New template-->
- <xsl:template match="related_link">
- <xsl:variable name="lang_entity_statustext">
- <xsl:value-of select="lang_entity_statustext"/>
- </xsl:variable>
- <xsl:variable name="entity_link">
- <xsl:value-of select="entity_link"/>
- </xsl:variable>
- <tr>
- <td class="small_text" align="left">
- <a href="{$entity_link}"
onMouseover="window.status='{$lang_entity_statustext}';return true;"
onMouseout="window.status='';return true;">
- <xsl:value-of select="text_entity"/>
- </a>
- </td>
- </tr>
- </xsl:template>
<!-- New template-->
<xsl:template match="summary">
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [11359] property: related at location,
Sigurd Nes <=