fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [7342] property: generic export as webservice


From: Sigurd Nes
Subject: [Fmsystem-commits] [7342] property: generic export as webservice
Date: Sun, 05 Jun 2011 21:44:45 +0000

Revision: 7342
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7342
Author:   sigurdne
Date:     2011-06-05 21:44:45 +0000 (Sun, 05 Jun 2011)
Log Message:
-----------
property: generic export as webservice

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

Modified: trunk/property/inc/class.soentity.inc.php
===================================================================
--- trunk/property/inc/class.soentity.inc.php   2011-06-05 21:43:48 UTC (rev 
7341)
+++ trunk/property/inc/class.soentity.inc.php   2011-06-05 21:44:45 UTC (rev 
7342)
@@ -120,6 +120,7 @@
                        $criteria_id    = isset($data['criteria_id']) ? 
$data['criteria_id'] : '';
                        $attrib_filter  = $data['attrib_filter'] ? 
$data['attrib_filter'] : array();
                        $p_num                  = isset($data['p_num']) ? 
$data['p_num'] : '';
+                       $custom_condition= isset($data['custom_condition']) ? 
$data['custom_condition'] : '';
 
                        if(!$entity_id || !$cat_id)
                        {
@@ -401,6 +402,12 @@
                                $where= 'AND';                  
                        }
 
+                       if ($custom_condition)
+                       {
+                               $filtermethod .= " {$where} 
{$custom_condition}";
+                               $where= 'AND';                  
+                       }
+
                        if ($p_num)
                        {
                                $filtermethod .= " $where 
$entity_table.p_num='$p_num'";

Modified: trunk/property/inc/class.soexportentity.inc.php
===================================================================
--- trunk/property/inc/class.soexportentity.inc.php     2011-06-05 21:43:48 UTC 
(rev 7341)
+++ trunk/property/inc/class.soexportentity.inc.php     2011-06-05 21:44:45 UTC 
(rev 7342)
@@ -163,36 +163,55 @@
 
                        $criteria = array
                        (
-                               'start'                 => 
isset($data['start']) && $data['start'] ? (int)$data['start'] : 0,
-                               'query'                 => 
isset($data['query']) ? $data['query'] : '',
-                               'sort'                  => isset($data['sort']) 
? $data['sort'] : '',
-                               'order'                 => 
isset($data['order']) ? $data['order'] : '',
-                               'filter'                => 
isset($data['filter']) ? $data['filter'] : '',
-                               'cat_id'                => $this->cat_id,
-                               'district_id'   => isset($data['district_id']) 
&& $data['district_id'] ? (int)$data['district_id'] : 0,
-                               'lookup'                => 
isset($data['lookup'])?$data['lookup']:'',
-                               'allrows'               => 
isset($data['allrows'])?$data['allrows']:'',
-                               'entity_id'             => 
(int)$this->entity_id,
-                               'cat_id'                => (int)$this->cat_id,
-                               'status'                => 
isset($data['status']) ? $data['status'] : '',
-                               'start_date'    => 
phpgwapi_datetime::date_to_timestamp($data['start_date']),
-                               'end_date'              => 
phpgwapi_datetime::date_to_timestamp($data['end_date']),
-                               'dry_run'               => $data['dry_run'],
-                               'type'                  => $data['type'],
-                               'location_code' => 
isset($data['location_code']) ? $data['location_code'] : '',
-                               'criteria_id'   => $data['criteria_id'],
-                               'attrib_filter' => $attrib_filter,
-                               'p_num'                 => $this->p_num
+                               'start'                         => 
isset($data['start']) && $data['start'] ? (int)$data['start'] : 0,
+                               'query'                         => 
isset($data['query']) ? $data['query'] : '',
+                               'sort'                          => 
isset($data['sort']) ? $data['sort'] : '',
+                               'order'                         => 
isset($data['order']) ? $data['order'] : '',
+                               'filter'                        => 
isset($data['filter']) ? $data['filter'] : '',
+                               'cat_id'                        => 
$this->cat_id,
+                               'district_id'           => 
isset($data['district_id']) && $data['district_id'] ? (int)$data['district_id'] 
: 0,
+                               'lookup'                        => 
isset($data['lookup'])?$data['lookup']:'',
+                               'allrows'                       => 
isset($data['allrows'])?$data['allrows']:'',
+                               'entity_id'                     => 
(int)$this->entity_id,
+                               'cat_id'                        => 
(int)$this->cat_id,
+                               'status'                        => 
isset($data['status']) ? $data['status'] : '',
+                               'start_date'            => 
phpgwapi_datetime::date_to_timestamp($data['start_date']),
+                               'end_date'                      => 
phpgwapi_datetime::date_to_timestamp($data['end_date']),
+                               'dry_run'                       => 
$data['dry_run'],
+                               'type'                          => 
$data['type'],
+                               'location_code'         => 
isset($data['location_code']) ? $data['location_code'] : '',
+                               'criteria_id'           => $data['criteria_id'],
+                               'attrib_filter'         => $attrib_filter,
+                               'p_num'                         => $this->p_num,
+                               'custom_condition'      => 
$data['custom_condition']
                        );
 
                        $values = $soentity->read($criteria);
-//_debug_array($values);                               
-                       foreach($values as &$entry)
+
+                       $solocation     = CreateObject('property.solocation');
+                       $custom                 = 
createObject('property.custom_fields');
+
+                       $_values['attributes'] = 
$custom->find('property','.location.1', 0, '', 'ASC', 'attrib_sort', true, 
true);
+
+                       if( isset($data['get_location_info']) && 
$data['get_location_info'])
                        {
-                               $entry['address'] = 
utf8_decode($entry['address']);
-                               $entry['user_id'] = 
utf8_decode($entry['user_id']);
+                               foreach($values as &$entry)
+                               {
+       //                              $entry['address'] = 
utf8_decode($entry['address']);
+       //                              $entry['user'] = 
utf8_decode($entry['user_id']);
+                                       $__values = 
$solocation->read_single($entry['loc1'],$_values);
+       //                              $entry['location_data'] = 
$solocation->read_single($entry['loc1'],$_values);
+                                       $entry['location_data'] = 
$custom->prepare($__values, 'property',".location.1", true);
+                               }
                        }
 
-                       return $values;
+                       $resultset = array
+                       (
+                               'total_records' => $soentity->total_records,
+                               'values'                => $values
+                       );
+
+//_debug_array($resultset);
+                       return $resultset;
                }
        }




reply via email to

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