mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Fix #2001
This commit is contained in:
parent
74ff17da7e
commit
e6ff895eff
@ -58,20 +58,19 @@ class TagFactory
|
||||
{
|
||||
$zoomLevel = 0 === (int)$data['zoom_level'] ? null : (int)$data['zoom_level'];
|
||||
$latitude = 0.0 === (float)$data['latitude'] ? null : (float)$data['latitude'];
|
||||
$longitude = 0.0 === (float)$data['longitude'] ? null : (int)$data['longitude'];
|
||||
$longitude = 0.0 === (float)$data['longitude'] ? null : (float)$data['longitude'];
|
||||
$array = [
|
||||
'user_id' => $this->user->id,
|
||||
'tag' => trim($data['tag']),
|
||||
'tagMode' => 'nothing',
|
||||
'date' => $data['date'],
|
||||
'description' => $data['description'],
|
||||
'latitude' => $latitude,
|
||||
'longitude' => $longitude,
|
||||
'zoomLevel' => $zoomLevel,
|
||||
];
|
||||
|
||||
return Tag::create(
|
||||
[
|
||||
'user_id' => $this->user->id,
|
||||
'tag' => trim($data['tag']),
|
||||
'tagMode' => 'nothing',
|
||||
'date' => $data['date'],
|
||||
'description' => $data['description'],
|
||||
'latitude' => $latitude,
|
||||
'longitude ' => $longitude,
|
||||
'zoomLevel' => $zoomLevel,
|
||||
]
|
||||
);
|
||||
return Tag::create($array);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -33,6 +33,7 @@ use FireflyIII\Support\Http\Controllers\PeriodOverview;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
* Class TagController.
|
||||
@ -250,7 +251,10 @@ class TagController extends Controller
|
||||
public function store(TagFormRequest $request): RedirectResponse
|
||||
{
|
||||
$data = $request->collectTagData();
|
||||
$this->repository->store($data);
|
||||
Log::debug('Data from request', $data);
|
||||
|
||||
$result = $this->repository->store($data);
|
||||
Log::debug('Data after storage', $result->toArray());
|
||||
|
||||
session()->flash('success', (string)trans('firefly.created_tag', ['tag' => $data['tag']]));
|
||||
app('preferences')->mark();
|
||||
|
@ -40,8 +40,8 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
* @property int $id
|
||||
* @property \Carbon\Carbon $date
|
||||
* @property int zoomLevel
|
||||
* @property float longitude
|
||||
* @property float latitude
|
||||
* @property float longitude
|
||||
* @property string description
|
||||
* @property string amount_sum
|
||||
* @property string tagMode
|
||||
@ -64,9 +64,11 @@ class Tag extends Model
|
||||
'deleted_at' => 'datetime',
|
||||
'date' => 'date',
|
||||
'zoomLevel' => 'int',
|
||||
'latitude' => 'float',
|
||||
'longitude' => 'float',
|
||||
];
|
||||
/** @var array Fields that can be filled */
|
||||
protected $fillable = ['user_id', 'tag', 'date', 'description', 'longitude', 'latitude', 'zoomLevel', 'tagMode'];
|
||||
protected $fillable = ['user_id', 'tag', 'date', 'description', 'latitude', 'longitude', 'zoomLevel', 'tagMode'];
|
||||
|
||||
/**
|
||||
* Route binder. Converts the key in the URL to the specified object (or throw 404).
|
||||
|
@ -253,10 +253,9 @@ class TagRepository implements TagRepositoryInterface
|
||||
public function store(array $data): Tag
|
||||
{
|
||||
/** @var TagFactory $factory */
|
||||
$factory = new TagFactory;
|
||||
$factory = app(TagFactory::class);
|
||||
$factory->setUser($this->user);
|
||||
return $factory->create($data);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,7 +1,7 @@
|
||||
<div class="{{ classes }}" id="{{ name }}_holder">
|
||||
<label for="{{ options.id }}" class="col-sm-4 control-label">{{ label }}</label>
|
||||
<div class="col-sm-8">
|
||||
{% if env('MAPBOX_API_KEY','') == '' %}
|
||||
{% if config('firefly.mapbox_api_key') == '' %}
|
||||
<p class="text-danger">
|
||||
{{ trans('firefly.mapbox_api_key')|raw }}
|
||||
</p>
|
||||
@ -42,7 +42,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if env('MAPBOX_API_KEY','') != '' %}
|
||||
{% if config('firefly.mapbox_api_key') != '' %}
|
||||
{% set latitudevar = name~'_latitude' %}
|
||||
{% set longitudevar = name~'_longitude' %}
|
||||
{% set zoomlevelvar = name~'_zoomlevel' %}
|
||||
|
@ -85,13 +85,13 @@
|
||||
var mapboxToken = "{{ config('firefly.mapbox_api_key') }}";
|
||||
|
||||
</script>
|
||||
<script src="lib/leaflet/leaflet.js?v={{ FF_VERSION }}"></script>
|
||||
<script src="v1/lib/leaflet/leaflet.js?v={{ FF_VERSION }}"></script>
|
||||
<script type="text/javascript" src="v1/js/lib/modernizr-custom.js?v={{ FF_VERSION }}"></script>
|
||||
<script type="text/javascript" src="v1/js/lib/jquery-ui.min.js?v={{ FF_VERSION }}"></script>
|
||||
<script src="v1/js/ff/tags/create-edit.js?v={{ FF_VERSION }}"></script>
|
||||
{% endblock %}
|
||||
{% block styles %}
|
||||
<link rel="stylesheet" href="lib/leaflet/leaflet.css?v={{ FF_VERSION }}"/>
|
||||
<link rel="stylesheet" href="v1/lib/leaflet/leaflet.css?v={{ FF_VERSION }}"/>
|
||||
<link href="v1/css/jquery-ui/jquery-ui.structure.min.css?v={{ FF_VERSION }}" type="text/css" rel="stylesheet" media="all">
|
||||
<link href="v1/css/jquery-ui/jquery-ui.theme.min.css?v={{ FF_VERSION }}" type="text/css" rel="stylesheet" media="all">
|
||||
{% endblock %}
|
||||
|
@ -89,13 +89,13 @@
|
||||
var mapboxToken = "{{ config('firefly.mapbox_api_key') }}";
|
||||
|
||||
</script>
|
||||
<script src="lib/leaflet/leaflet.js?v={{ FF_VERSION }}"></script>
|
||||
<script src="v1/lib/leaflet/leaflet.js?v={{ FF_VERSION }}"></script>
|
||||
<script type="text/javascript" src="v1/js/lib/modernizr-custom.js?v={{ FF_VERSION }}"></script>
|
||||
<script type="text/javascript" src="v1/js/lib/jquery-ui.min.js?v={{ FF_VERSION }}"></script>
|
||||
<script src="v1/js/ff/tags/create-edit.js?v={{ FF_VERSION }}"></script>
|
||||
{% endblock %}
|
||||
{% block styles %}
|
||||
<link rel="stylesheet" href="lib/leaflet/leaflet.css?v={{ FF_VERSION }}"/>
|
||||
<link rel="stylesheet" href="v1/lib/leaflet/leaflet.css?v={{ FF_VERSION }}"/>
|
||||
<link href="v1/css/jquery-ui/jquery-ui.structure.min.css?v={{ FF_VERSION }}" type="text/css" rel="stylesheet" media="all">
|
||||
<link href="v1/css/jquery-ui/jquery-ui.theme.min.css?v={{ FF_VERSION }}" type="text/css" rel="stylesheet" media="all">
|
||||
{% endblock %}
|
||||
|
@ -168,7 +168,7 @@
|
||||
|
||||
{% endblock %}
|
||||
{% block styles %}
|
||||
<link rel="stylesheet" href="lib/leaflet/leaflet.css?v={{ FF_VERSION }}"/>
|
||||
<link rel="stylesheet" href="v1/lib/leaflet/leaflet.css?v={{ FF_VERSION }}"/>
|
||||
{% endblock %}
|
||||
{% block scripts %}
|
||||
<script type="text/javascript">
|
||||
@ -186,7 +186,7 @@
|
||||
var mapboxToken = "{{ config('firefly.mapbox_api_key') }}";
|
||||
|
||||
</script>
|
||||
<script src="lib/leaflet/leaflet.js?v={{ FF_VERSION }}"></script>
|
||||
<script src="v1/lib/leaflet/leaflet.js?v={{ FF_VERSION }}"></script>
|
||||
<script src="v1/js/ff/tags/show.js?v={{ FF_VERSION }}"></script>
|
||||
<script type="text/javascript" src="v1/js/ff/transactions/list.js?v={{ FF_VERSION }}"></script>
|
||||
{% endblock %}
|
||||
|
Loading…
Reference in New Issue
Block a user