function _get_price_tankinspection($postalcode, $ligging_tank) { $region = _get_region($postalcode); $price = db_select('a30_prices_tankinspection', 'p')->fields('p')->condition('region', $region, '=')->execute()->fetch(); if (empty($price)) { throw new \Exception('a30_prices_tankinspection not found'); } if ($ligging_tank == 'ondergronds' || $ligging_tank == 'souterrain') { return $price->price_under; } else { return $price->price_above; } }
function geoip_region_by_addr($gi, $addr) { if ($addr == NULL) { return 0; } $ipnum = ip2long($addr); return _get_region($gi, $ipnum); }