fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [9389] property:get_locations_by_name


From: Sigurd Nes
Subject: [Fmsystem-commits] [9389] property:get_locations_by_name
Date: Mon, 14 May 2012 09:09:16 +0000

Revision: 9389
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9389
Author:   sigurdne
Date:     2012-05-14 09:09:15 +0000 (Mon, 14 May 2012)
Log Message:
-----------
property:get_locations_by_name

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

Modified: trunk/property/inc/class.solocation.inc.php
===================================================================
--- trunk/property/inc/class.solocation.inc.php 2012-05-14 06:15:23 UTC (rev 
9388)
+++ trunk/property/inc/class.solocation.inc.php 2012-05-14 09:09:15 UTC (rev 
9389)
@@ -1823,4 +1823,32 @@
                        }
                        return $values;
                }
+
+               /**
+                * Get location by name
+                *
+                * @param array   $data array with level and name to search for
+                *
+                * @return array array of hits
+                */
+               public function get_locations_by_name($data)
+               {
+                       $level = isset($data['level']) && $data['level'] ? 
$data['level'] : 1;
+
+                       $location_name = isset($data['location_name']) && 
$data['location_name'] ? $data['location_name'] : '';
+                       $values = array();
+                       if($location_name)
+                       {
+                               $this->db->query("SELECT loc{$level}_name as 
name, location_code FROM fm_location{$level} WHERE loc{$level}_name 
{$this->like} '{$location_name}%'",__LINE__,__FILE__);
+                               while ($this->db->next_record())
+                               {
+                                       $values[] = array
+                                       (
+                                               'name'                  => 
$this->db->f('name',true),
+                                               'location_code' => 
$this->db->f('location_code'),
+                                       );
+                               }
+                       }
+                       return $values;
+               }
        }




reply via email to

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