Skip to content

Commit

Permalink
Avoid city name validation. Open311 addons
Browse files Browse the repository at this point in the history
  • Loading branch information
jjnf committed Nov 15, 2016
1 parent 76c8f9b commit c72e9d8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,14 @@ function markaspot_logic_validate($form, &$form_state) {
// Iterate through all strings.
$valid = array();

foreach ($validate_cities as $validate_city) {
/* foreach ($validate_cities as $validate_city) {
$valid[] = strstr($form_state['values']['field_geo'][LANGUAGE_NONE][0]['address']['field'], $validate_city) ? TRUE : FALSE;
}

if (!in_array(TRUE, $valid)) {
form_set_error('field_geo', t('Sorry, we only operate in the following areas: @area', array('@area' => $area)));
}
*/

/* Bounding Box */
$lat = $form_state['values']['field_geo'][LANGUAGE_NONE][0]['lat'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,8 +358,8 @@ function markaspot_open311_requests_index($page, $parameters) {
$query->propertyOrderBy('created', $direction = 'DESC');

if (isset($parameters['north'],$parameters['south'],$parameters['east'],$parameters['west'])) {
$query->fieldCondition('field_geo', 'lat', $parameters['north'], '>=');
$query->fieldCondition('field_geo', 'lat', $parameters['south'], '<=');
$query->fieldCondition('field_geo', 'lat', $parameters['north'], '<=');
$query->fieldCondition('field_geo', 'lat', $parameters['south'], '>=');
$query->fieldCondition('field_geo', 'lng', $parameters['west'], '>=');
$query->fieldCondition('field_geo', 'lng', $parameters['east'], '<=');
}
Expand Down Expand Up @@ -572,6 +572,8 @@ function markaspot_open311_request_map_node($request) {
if($results) $node->field_neighbourhood[$node->language][0]['value'] = $results[0]['neighbourhood'][0];
}

if (!isset($node->field_neighbourhood[$node->language][0]['value']) && isset($request->neighbourhood)) $node->field_neighbourhood[$node->language][0]['value'] = $request->neighbourhood;

if (isset($request->email)) $node->field_e_mail[$node->language][0]['value'] = $request->email;
if (isset($request->phone)) $node->field_phone[$node->language][0]['value'] = $request->phone;

Expand Down

0 comments on commit c72e9d8

Please sign in to comment.