Changeset 2136 for trunk/workflow


Ignore:
Timestamp:
03/02/10 16:20:01 (14 years ago)
Author:
asaikawa
Message:

Ticket #942 - Alteracoes nos metodos para considerar a nova coluna is_district

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/workflow/inc/local/classes/class.wf_location.php

    r795 r2136  
    7272                        c.id_city AS id_city, 
    7373                        c.city_name AS city_name, 
     74                        c.is_district, 
    7475                        s.id_state AS id_state, 
    7576                        s.state_name AS state_name, 
     
    125126         * Busca as cidades de um estado 
    126127         * @param int $state_id Numero ID do estado 
     128         * @param bool $include_districts True, busca cidades e distritos. False, busca apenas cidades. 
    127129         * @return mixed (array ou boolean) 
    128130         * @access public 
    129131         */ 
    130         function getCitiesFromState($state_id) 
     132        function getCitiesFromState($state_id, $include_districts = true) 
    131133        { 
    132                 if (!is_numeric($state_id)) 
     134                if (!is_numeric($state_id) || !is_bool($include_districts)) 
    133135                        return false; 
    134136 
     
    137139                        return $this->citiesFromState[$state_id]; 
    138140 
     141                $where = ""; 
     142                if(!$include_districts){ 
     143                        $where = " AND c.is_district = 'F' "; 
     144                } 
     145 
    139146                $sql = 
    140147                "SELECT 
    141148                        c.id_city AS id_city, 
    142                         c.city_name AS city_name 
     149                        c.city_name AS city_name, 
     150                        c.is_district 
    143151                FROM 
    144152                        phpgw_cc_state s, 
     
    147155                        c.id_state = s.id_state AND 
    148156                        s.id_country = 'BR' AND 
    149                         c.id_state = ? 
     157                        c.id_state = ? " . $where . " 
    150158                ORDER BY 
    151159                        city_name"; 
     
    159167                return $output; 
    160168        } 
    161     /** 
     169        /** 
    162170         * Busca os estados brasileiros 
    163171         * @return mixed (array ou boolean) 
Note: See TracChangeset for help on using the changeset viewer.