fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [9514] property: get locations for ajax


From: Sigurd Nes
Subject: [Fmsystem-commits] [9514] property: get locations for ajax
Date: Tue, 05 Jun 2012 17:47:23 +0000

Revision: 9514
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9514
Author:   sigurdne
Date:     2012-06-05 17:47:22 +0000 (Tue, 05 Jun 2012)
Log Message:
-----------
property: get locations for ajax

Modified Paths:
--------------
    trunk/property/inc/class.boentity.inc.php
    trunk/property/inc/class.soentity.inc.php
    trunk/property/inc/class.solocation.inc.php

Modified: trunk/property/inc/class.boentity.inc.php
===================================================================
--- trunk/property/inc/class.boentity.inc.php   2012-06-05 11:47:17 UTC (rev 
9513)
+++ trunk/property/inc/class.boentity.inc.php   2012-06-05 17:47:22 UTC (rev 
9514)
@@ -85,6 +85,7 @@
                        $order                                                  
= phpgw::get_var('order');
                        $filter                                                 
= phpgw::get_var('filter', 'int');
                        $district_id                                    = 
phpgw::get_var('district_id', 'int');
+                       $part_of_town_id                                = 
phpgw::get_var('part_of_town_id', 'int');
                        $status                                                 
= phpgw::get_var('status');
                        $start_date                                             
= phpgw::get_var('start_date');
                        $end_date                                               
= phpgw::get_var('end_date');
@@ -148,6 +149,10 @@
                        {
                                $this->district_id = $district_id;
                        }
+                       if(isset($_POST['part_of_town_id']) || 
isset($_GET['part_of_town_id']))
+                       {
+                               $this->part_of_town_id = $part_of_town_id;
+                       }
                        if(isset($_POST['criteria_id']) || 
isset($_GET['criteria_id']))
                        {
                                $this->criteria_id = $criteria_id;
@@ -346,7 +351,7 @@
                        }
 
                        $entity = $this->so->read(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
-                               'filter' => $this->filter,'cat_id' => 
$this->cat_id,'district_id' => $this->district_id,
+                               'filter' => $this->filter,'cat_id' => 
$this->cat_id,'district_id' => $this->district_id, 'part_of_town_id' => 
$this->part_of_town_id,
                                
'lookup'=>isset($data['lookup'])?$data['lookup']:'','allrows'=>isset($data['allrows'])?$data['allrows']:'',
                                
'entity_id'=>$this->entity_id,'cat_id'=>$this->cat_id,'status'=>$this->status,
                                
'start_date'=>$this->bocommon->date_to_timestamp($data['start_date']),

Modified: trunk/property/inc/class.soentity.inc.php
===================================================================
--- trunk/property/inc/class.soentity.inc.php   2012-06-05 11:47:17 UTC (rev 
9513)
+++ trunk/property/inc/class.soentity.inc.php   2012-06-05 17:47:22 UTC (rev 
9514)
@@ -225,6 +225,7 @@
                        $order                  = isset($data['order']) && 
$data['order'] ? $data['order'] : 'id';
                        $cat_id                 = isset($data['cat_id']) && 
$data['cat_id'] ? $data['cat_id'] : 0;
                        $district_id    = isset($data['district_id']) && 
$data['district_id'] ? $data['district_id'] : 0;
+                       $part_of_town_id= isset($data['part_of_town_id']) && 
$data['part_of_town_id'] ? $data['part_of_town_id'] : 0;
                        $lookup                 = isset($data['lookup']) ? 
$data['lookup'] : '';
                        $allrows                = isset($data['allrows']) ? 
$data['allrows'] : '';
                        $entity_id              = isset($data['entity_id']) ? 
$data['entity_id'] : '';
@@ -524,11 +525,16 @@
        //                      $where= 'AND';
                        }
 
-                       if ($district_id > 0 && $category['location_level'])
+                       if ($district_id > 0 && $category['location_level'] && 
!$part_of_town_id)
                        {
                                $filtermethod .= " $where  
fm_part_of_town.district_id='$district_id' ";
                                $where = 'AND';
                        }
+                       else if ($part_of_town_id > 0 && 
$category['location_level'])
+                       {
+                               $filtermethod .= " $where 
fm_part_of_town.part_of_town_id='$part_of_town_id' ";
+                               $where = 'AND';
+                       }
 
                        if ($start_date)
                        {
@@ -855,6 +861,7 @@
                        $order                  = isset($data['order']) ? 
$data['order'] : '';
                        $cat_id                 = isset($data['cat_id']) && 
$data['cat_id'] ? $data['cat_id'] : 0;
                        $district_id    = isset($data['district_id']) && 
$data['district_id'] ? $data['district_id'] : 0;
+                       $part_of_town_id= isset($data['part_of_town_id']) && 
$data['part_of_town_id'] ? $data['part_of_town_id'] : 0;
                        $lookup                 = isset($data['lookup']) ? 
$data['lookup'] : '';
                        $allrows                = isset($data['allrows']) ? 
$data['allrows'] : '';
                        $entity_id              = isset($data['entity_id']) ? 
$data['entity_id'] : '';
@@ -1178,11 +1185,16 @@
                                $where= 'AND';
                        }
 
-                       if ($district_id > 0 && $category['location_level'])
+                       if ($district_id > 0 && $category['location_level'] && 
!$part_of_town_id)
                        {
                                $filtermethod .= " $where  
fm_part_of_town.district_id='$district_id' ";
                                $where = 'AND';
                        }
+                       else if ($part_of_town_id > 0 && 
$category['location_level'])
+                       {
+                               $filtermethod .= " $where  
fm_part_of_town.part_of_town_id='$part_of_town_id' ";
+                               $where = 'AND';
+                       }
 
                        if ($start_date)
                        {

Modified: trunk/property/inc/class.solocation.inc.php
===================================================================
--- trunk/property/inc/class.solocation.inc.php 2012-06-05 11:47:17 UTC (rev 
9513)
+++ trunk/property/inc/class.solocation.inc.php 2012-06-05 17:47:22 UTC (rev 
9514)
@@ -1791,12 +1791,21 @@
 
                function get_children($criteria = '')
                {
+                       $join_method = '';
+                       $filtermethod = '';
                        if(is_array($criteria))
                        {
-                               $location_code  = $criteria['location_code'];
-                               $child_level    = $criteria['child_level'];
-                               $id_field               = 'location_code';
-                               $field_name             = 
$criteria['field_name'];
+                               $location_code          = 
$criteria['location_code'];
+                               $child_level            = 
$criteria['child_level'];
+                               $id_field                       = 
'location_code';
+                               $field_name                     = 
$criteria['field_name'];
+                               $part_of_town_id        = 
$criteria['part_of_town_id'];
+                               
+                               if($part_of_town_id)
+                               {
+                                       $join_method = "{$this->join} 
fm_part_of_town ON fm_part_of_town.part_of_town_id = 
fm_location1.part_of_town_id";
+                                       $filtermethod = 'AND 
fm_part_of_town.part_of_town_id =' . (int) $part_of_town_id;
+                               }
                        }
                        else
                        {
@@ -1824,7 +1833,7 @@
                                return $values;
                        }
                        
-                       $this->db->query("SELECT $id_field AS id, {$field_name} 
AS name FROM fm_location{$child_level} WHERE location_code {$this->like} 
'{$location_code}%' ORDER BY {$field_name} ASC",__LINE__,__FILE__);
+                       $this->db->query("SELECT $id_field AS id, {$field_name} 
AS name FROM fm_location{$child_level} {$join_method} WHERE location_code 
{$this->like} '{$location_code}%' {$filtermethod} ORDER BY {$field_name} 
ASC",__LINE__,__FILE__);
                        while ($this->db->next_record())
                        {
                                $id = $this->db->f('id');




reply via email to

[Prev in Thread] Current Thread [Next in Thread]