mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-06 14:12:15 +00:00
Make sure that accounts and tags both can handle locations.
This commit is contained in:
@@ -67,9 +67,10 @@ class AccountFormRequest extends Request
|
||||
'interest' => $this->string('interest'),
|
||||
'interest_period' => $this->string('interest_period'),
|
||||
'include_net_worth' => '1',
|
||||
|
||||
// new: location
|
||||
'longitude' => $this->float('location_longitude'),
|
||||
'latitude' => $this->float('location_latitude'),
|
||||
'longitude' => $this->string('location_longitude'),
|
||||
'latitude' => $this->string('location_latitude'),
|
||||
'zoom_level' => $this->integer('location_zoom_level'),
|
||||
'has_location' => $this->boolean('location_has_location'),
|
||||
];
|
||||
@@ -113,6 +114,9 @@ class AccountFormRequest extends Request
|
||||
'amount_currency_id_virtual_balance' => 'exists:transaction_currencies,id',
|
||||
'what' => 'in:' . $types,
|
||||
'interest_period' => 'in:daily,monthly,yearly',
|
||||
'latitude' => 'numeric|min:-90|max:90|nullable|required_with:longitude',
|
||||
'longitude' => 'numeric|min:-180|max:180|nullable|required_with:latitude',
|
||||
'zoom_level' => 'numeric|min:0|max:80|nullable',
|
||||
];
|
||||
|
||||
if ('liabilities' === $this->get('objectType')) {
|
||||
|
||||
@@ -47,26 +47,26 @@ class TagFormRequest extends Request
|
||||
*/
|
||||
public function collectTagData(): array
|
||||
{
|
||||
$latitude = null;
|
||||
$longitude = null;
|
||||
$zoomLevel = null;
|
||||
|
||||
if ('true' === $this->get('tag_position_has_tag')) {
|
||||
$latitude = $this->string('tag_position_latitude');
|
||||
$longitude = $this->string('tag_position_longitude');
|
||||
$zoomLevel = $this->integer('tag_position_zoomlevel');
|
||||
$latitude = null;
|
||||
$longitude = null;
|
||||
$zoomLevel = null;
|
||||
$hasLocation = false;
|
||||
if (true === $this->boolean('location_has_location')) {
|
||||
$latitude = $this->string('location_latitude');
|
||||
$longitude = $this->string('location_longitude');
|
||||
$zoomLevel = $this->integer('location_zoom_level');
|
||||
$hasLocation = true;
|
||||
}
|
||||
|
||||
$data = [
|
||||
'tag' => $this->string('tag'),
|
||||
'date' => $this->date('date'),
|
||||
'description' => $this->string('description'),
|
||||
'latitude' => $latitude,
|
||||
'longitude' => $longitude,
|
||||
'zoom_level' => $zoomLevel,
|
||||
return [
|
||||
'tag' => $this->string('tag'),
|
||||
'date' => $this->date('date'),
|
||||
'description' => $this->string('description'),
|
||||
'latitude' => $latitude,
|
||||
'longitude' => $longitude,
|
||||
'zoom_level' => $zoomLevel,
|
||||
'has_location' => $hasLocation,
|
||||
];
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user