@@ -85,19 +85,20 @@ class CitiesComponent | |||
public function callAddressApi($query) | |||
{ | |||
if(is_null($query)) { | |||
$query = ''; | |||
} | |||
$resultsToReturn = []; | |||
if(!is_null($query)) { | |||
$provider = $this->getGeocoderProvider() ; | |||
$query = GeocodeQuery::create($query)->withData('type', 'housenumber'); | |||
$results = $provider->geocodeQuery($query); | |||
$provider = $this->getGeocoderProvider() ; | |||
$query = GeocodeQuery::create($query)->withData('type', 'housenumber'); | |||
$results = $provider->geocodeQuery($query); | |||
$resultsToReturn = array(); | |||
foreach($results as $result) { | |||
if ($result->getStreetNumber() && strlen($result->getStreetNumber()) > 0) { | |||
$resultsToReturn[] = $result; | |||
foreach($results as $result) { | |||
if ($result->getStreetNumber() && strlen($result->getStreetNumber()) > 0) { | |||
$resultsToReturn[] = $result; | |||
} | |||
} | |||
} | |||
return $resultsToReturn; | |||
} | |||
@@ -146,7 +146,7 @@ abstract class AbstractFieldDefinition | |||
$fieldArray = []; | |||
foreach($configureFieldArray as $fieldName) { | |||
if(isset($allFieldArray[$fieldName])) { | |||
$fieldArray[] = $allFieldArray[$fieldName]; | |||
$fieldArray[$fieldName] = $allFieldArray[$fieldName]; | |||
} | |||
else { | |||
throw new \ErrorException('Le field "'.$fieldName.'" n\'est pas défini dans configureFields()'); |
@@ -65,6 +65,15 @@ export class SovTools { | |||
else return null; | |||
} | |||
static formatNumberWithoutRounding(number, toFixed) { | |||
if (number){ | |||
let factor = Math.pow(10, toFixed); | |||
return Math.floor(number * factor) / factor | |||
}else{ | |||
return null | |||
} | |||
} | |||
static formatNumberWithoutFixed(number) { | |||
if (typeof number == 'string') number = number.replace(',', '.'); | |||
if (number) return Number(number); |
@@ -100,16 +100,18 @@ export class SovWidgets { | |||
static setAutoCompleteField() { | |||
var autocompleteFields = $('[data-lc-autocomplete-url]'); | |||
autocompleteFields.each(function () { | |||
var $this = $(this), | |||
url = $this.data('lc-autocomplete-url'); | |||
$this.autoComplete({ | |||
//bootstrapVersion: 4, | |||
//noResultsText: 'Aucun résultat n\'a été trouvé.', | |||
resolverSettings: { | |||
url: url | |||
} | |||
}); | |||
if(!$(this).hasClass('autocomplete-disabled')) { | |||
var $this = $(this), | |||
url = $this.data('lc-autocomplete-url'); | |||
$this.autoComplete({ | |||
//bootstrapVersion: 4, | |||
//noResultsText: 'Aucun résultat n\'a été trouvé.', | |||
resolverSettings: { | |||
url: url | |||
} | |||
}); | |||
} | |||
}); | |||
} | |||