mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-19 02:45:58 +00:00
Compare commits
162 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
c9f4cf4f34 | ||
|
1b3d3de969 | ||
|
e80d616ef4 | ||
|
2ddf48f15c | ||
|
692b256f3f | ||
|
3ad4e04e2a | ||
|
427de0594d | ||
|
7d482aa24c | ||
|
a9f34e9dd1 | ||
|
f795cb07e1 | ||
|
17a66b3056 | ||
|
531161db09 | ||
|
a70b7cc7b9 | ||
|
def307010c | ||
|
45b8c36272 | ||
|
45ddb64186 | ||
|
76aa8acf0f | ||
|
220add3eda | ||
|
541280ee91 | ||
|
01219c951c | ||
|
69fa60cd21 | ||
|
a11d2df6bb | ||
|
07d39a23a8 | ||
|
ca67d98676 | ||
|
7b60d210ee | ||
|
78d955ebf6 | ||
|
f6f21e02ac | ||
|
e2ebd01719 | ||
|
b8ac7c9d89 | ||
|
037d9b7017 | ||
|
6462d2b87a | ||
|
cb4ff35adb | ||
|
d063f32c1c | ||
|
244d8eecab | ||
|
b66f6d7e2e | ||
|
aa3a88f537 | ||
|
e5476e6e7a | ||
|
4d976312e8 | ||
|
2ef5d3d4c6 | ||
|
eb3a89555d | ||
|
0a80b7fca7 | ||
|
f682981c1e | ||
|
4aac969ae4 | ||
|
00651adf5e | ||
|
ed94e71168 | ||
|
6e12f434ad | ||
|
b8c4ec1449 | ||
|
4ca60ca92a | ||
|
48219c9af3 | ||
|
9887b9809d | ||
|
a13ad5b417 | ||
|
3f28fd689f | ||
|
959025545e | ||
|
1978463e59 | ||
|
e85ac07c49 | ||
|
b7f0a6fff4 | ||
|
3a57e09447 | ||
|
87d5cabe52 | ||
|
af07522f16 | ||
|
1b8d4e4c63 | ||
|
9f3c114d57 | ||
|
c51c1b8098 | ||
|
143fe2a71f | ||
|
3379b723cf | ||
|
39321b320e | ||
|
fe738fd321 | ||
|
95720673d2 | ||
|
963be4a4fa | ||
|
61db419485 | ||
|
cb17b09b24 | ||
|
0f1236a597 | ||
|
ac26427a63 | ||
|
491903778a | ||
|
405c3e110a | ||
|
5464bfac19 | ||
|
ad31cc1c1f | ||
|
3aa79fb1e4 | ||
|
e3de03e50d | ||
|
d8b4af34e0 | ||
|
222d8e071a | ||
|
36c2f27d59 | ||
|
5d43faab96 | ||
|
07048cb5fb | ||
|
38c79c3dc4 | ||
|
7610d9e0db | ||
|
e4f3d0a0ea | ||
|
fdf147d9c6 | ||
|
f7e418f517 | ||
|
738f6ed232 | ||
|
12217d9850 | ||
|
87c8b3d7c6 | ||
|
fd571abbb0 | ||
|
64ae56757e | ||
|
7d75f00696 | ||
|
451c86e431 | ||
|
c8c71da903 | ||
|
423f3a9296 | ||
|
7658b7d9a6 | ||
|
0d0906c5e2 | ||
|
e0aa7f3ff5 | ||
|
59fdf5b77a | ||
|
e28cfade8d | ||
|
19710c3eab | ||
|
0782354160 | ||
|
22bc6d507e | ||
|
bf3c74e65f | ||
|
71fb9d8fa5 | ||
|
9a461fc7b7 | ||
|
e0d87aa11e | ||
|
b273af341c | ||
|
2117fc2a5a | ||
|
58e55dc789 | ||
|
ac9b8b8c30 | ||
|
4dcc66238e | ||
|
90c0aa6360 | ||
|
1594335487 | ||
|
2517674849 | ||
|
c00bc2a1f3 | ||
|
f999be81c2 | ||
|
e2530c5486 | ||
|
7526f13ca9 | ||
|
ed08d299de | ||
|
b6ea2f1c64 | ||
|
9ee14374bb | ||
|
925401682b | ||
|
53c71bb7a2 | ||
|
3c036ae021 | ||
|
bf89d9956d | ||
|
71104f375c | ||
|
4c94820cf4 | ||
|
8998c9a672 | ||
|
ccf60f4cdc | ||
|
c5af1d363c | ||
|
c6e3b54705 | ||
|
4f274a290e | ||
|
1774bcbabe | ||
|
492c11784b | ||
|
21ddbd220a | ||
|
e4a95e55ed | ||
|
3a0eb5a428 | ||
|
e55fd968cf | ||
|
d41be08b48 | ||
|
a18272513d | ||
|
e88061199c | ||
|
d0d7c437f2 | ||
|
a1ac1a4a29 | ||
|
41d22876c4 | ||
|
e1bb0298cb | ||
|
1ec2772255 | ||
|
40d77d82cd | ||
|
311d51464d | ||
|
d63c9c9aea | ||
|
f1e83f240e | ||
|
b0f847959f | ||
|
d3d4439b03 | ||
|
0e1da3f797 | ||
|
def95df49e | ||
|
73c8c6de37 | ||
|
25b2b43a38 | ||
|
1fc2c998de | ||
|
b7a577cc4c | ||
|
2cdedd9c29 |
@@ -45,6 +45,14 @@ DB_DATABASE=${FF_DB_NAME}
|
|||||||
DB_USERNAME=${FF_DB_USER}
|
DB_USERNAME=${FF_DB_USER}
|
||||||
DB_PASSWORD="${FF_DB_PASSWORD}"
|
DB_PASSWORD="${FF_DB_PASSWORD}"
|
||||||
|
|
||||||
|
# PostgreSQL supports SSL. You can configure it here.
|
||||||
|
PGSQL_SSL=${PGSQL_SSL}
|
||||||
|
PGSQL_SSL_MODE=${PGSQL_SSL_MODE}
|
||||||
|
PGSQL_SSL_ROOT_CERT=${PGSQL_SSL_ROOT_CERT}
|
||||||
|
PGSQL_SSL_CERT=${PGSQL_SSL_CERT}
|
||||||
|
PGSQL_SSL_KEY=${PGSQL_SSL_KEY}
|
||||||
|
PGSQL_SSL_CRL_FILE=${PGSQL_SSL_CRL_FILE}
|
||||||
|
|
||||||
# If you're looking for performance improvements, you could install memcached.
|
# If you're looking for performance improvements, you could install memcached.
|
||||||
CACHE_DRIVER=file
|
CACHE_DRIVER=file
|
||||||
SESSION_DRIVER=file
|
SESSION_DRIVER=file
|
||||||
@@ -112,7 +120,7 @@ ANALYTICS_ID=${ANALYTICS_ID}
|
|||||||
USE_ENCRYPTION=true
|
USE_ENCRYPTION=true
|
||||||
|
|
||||||
# Firefly III has two options for user authentication. "eloquent" is the default,
|
# Firefly III has two options for user authentication. "eloquent" is the default,
|
||||||
# and "adldap" for LDAP servers.
|
# and "ldap" for LDAP servers.
|
||||||
# For full instructions on these settings please visit:
|
# For full instructions on these settings please visit:
|
||||||
# https://firefly-iii.readthedocs.io/en/latest/installation/authentication.html
|
# https://firefly-iii.readthedocs.io/en/latest/installation/authentication.html
|
||||||
LOGIN_PROVIDER=${LOGIN_PROVIDER}
|
LOGIN_PROVIDER=${LOGIN_PROVIDER}
|
||||||
@@ -135,8 +143,6 @@ ADLDAP_ADMIN_PASSWORD="${ADLDAP_ADMIN_PASSWORD}"
|
|||||||
|
|
||||||
ADLDAP_ACCOUNT_PREFIX="${ADLDAP_ACCOUNT_PREFIX}"
|
ADLDAP_ACCOUNT_PREFIX="${ADLDAP_ACCOUNT_PREFIX}"
|
||||||
ADLDAP_ACCOUNT_SUFFIX="${ADLDAP_ACCOUNT_SUFFIX}"
|
ADLDAP_ACCOUNT_SUFFIX="${ADLDAP_ACCOUNT_SUFFIX}"
|
||||||
ADLDAP_ADMIN_ACCOUNT_PREFIX="${ADLDAP_ADMIN_ACCOUNT_PREFIX}"
|
|
||||||
ADLDAP_ADMIN_ACCOUNT_SUFFIX="${ADLDAP_ADMIN_ACCOUNT_SUFFIX}"
|
|
||||||
|
|
||||||
# LDAP authentication settings.
|
# LDAP authentication settings.
|
||||||
ADLDAP_PASSWORD_SYNC=${ADLDAP_PASSWORD_SYNC}
|
ADLDAP_PASSWORD_SYNC=${ADLDAP_PASSWORD_SYNC}
|
@@ -3,16 +3,20 @@
|
|||||||
# build image
|
# build image
|
||||||
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
|
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if [ "$TRAVIS_BRANCH" == "develop" ]; then
|
if [ "$TRAVIS_BRANCH" == "develop" ]; then
|
||||||
echo "Build develop amd64"
|
echo "Build develop amd64"
|
||||||
docker build -t jc5x/firefly-iii:develop-amd -f Dockerfile .
|
docker build -t jc5x/firefly-iii:develop-amd64 -f Dockerfile.amd64 .
|
||||||
docker push jc5x/firefly-iii:develop-amd
|
docker tag jc5x/firefly-iii:develop-amd64 jc5x/firefly-iii:develop-$VERSION-amd64
|
||||||
|
docker push jc5x/firefly-iii:develop-amd64
|
||||||
|
docker push jc5x/firefly-iii:develop-$VERSION-amd64
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$TRAVIS_BRANCH" == "master" ]; then
|
if [ "$TRAVIS_BRANCH" == "master" ]; then
|
||||||
echo "Build master amd64"
|
echo "Build master amd64"
|
||||||
docker build -t jc5x/firefly-iii:latest-amd -f Dockerfile .
|
docker build -t jc5x/firefly-iii:latest-amd64 -f Dockerfile.amd64 .
|
||||||
docker tag jc5x/firefly-iii:latest-amd jc5x/firefly-iii:release-$VERSION-amd
|
docker tag jc5x/firefly-iii:latest-amd64 jc5x/firefly-iii:release-$VERSION-amd64
|
||||||
docker push jc5x/firefly-iii:latest-amd
|
docker push jc5x/firefly-iii:latest-amd64
|
||||||
docker push jc5x/firefly-iii:release-$VERSION-amd
|
docker push jc5x/firefly-iii:release-$VERSION-amd64
|
||||||
fi
|
fi
|
@@ -15,13 +15,15 @@ echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
|
|||||||
|
|
||||||
if [ "$TRAVIS_BRANCH" == "develop" ]; then
|
if [ "$TRAVIS_BRANCH" == "develop" ]; then
|
||||||
echo "Build develop arm"
|
echo "Build develop arm"
|
||||||
docker build --tag jc5x/firefly-iii:develop-arm --file Dockerfile-ARM .
|
docker build --tag jc5x/firefly-iii:develop-arm --file Dockerfile.arm .
|
||||||
|
docker tag jc5x/firefly-iii:develop-arm jc5x/firefly-iii:develop-$VERSION-arm
|
||||||
docker push jc5x/firefly-iii:develop-arm
|
docker push jc5x/firefly-iii:develop-arm
|
||||||
|
docker push jc5x/firefly-iii:develop-$VERSION-arm
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$TRAVIS_BRANCH" == "master" ]; then
|
if [ "$TRAVIS_BRANCH" == "master" ]; then
|
||||||
echo "Build master arm"
|
echo "Build master arm"
|
||||||
docker build --tag jc5x/firefly-iii:latest-arm --file Dockerfile-ARM .
|
docker build --tag jc5x/firefly-iii:latest-arm --file Dockerfile.arm .
|
||||||
docker tag jc5x/firefly-iii:latest-arm jc5x/firefly-iii:release-$VERSION-arm
|
docker tag jc5x/firefly-iii:latest-arm jc5x/firefly-iii:release-$VERSION-arm
|
||||||
docker push jc5x/firefly-iii:latest-arm
|
docker push jc5x/firefly-iii:latest-arm
|
||||||
docker push jc5x/firefly-iii:release-$VERSION-arm
|
docker push jc5x/firefly-iii:release-$VERSION-arm
|
||||||
|
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
echo "Now in entrypoint.sh for Firefly III"
|
echo "Now in entrypoint.sh for Firefly III"
|
||||||
|
|
||||||
|
lscpu
|
||||||
|
|
||||||
# make sure the correct directories exists (suggested by @chrif):
|
# make sure the correct directories exists (suggested by @chrif):
|
||||||
echo "Making directories..."
|
echo "Making directories..."
|
||||||
mkdir -p $FIREFLY_PATH/storage/app/public
|
mkdir -p $FIREFLY_PATH/storage/app/public
|
||||||
@@ -42,7 +44,7 @@ echo "Remove log file..."
|
|||||||
rm -f $FIREFLY_PATH/storage/logs/laravel.log
|
rm -f $FIREFLY_PATH/storage/logs/laravel.log
|
||||||
|
|
||||||
echo "Map environment variables on .env file..."
|
echo "Map environment variables on .env file..."
|
||||||
cat .env.docker | envsubst > .env
|
cat $FIREFLY_PATH/.deploy/docker/.env.docker | envsubst > $FIREFLY_PATH/.env
|
||||||
echo "Dump auto load..."
|
echo "Dump auto load..."
|
||||||
composer dump-autoload
|
composer dump-autoload
|
||||||
echo "Discover packages..."
|
echo "Discover packages..."
|
||||||
|
@@ -1,8 +1,9 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
if [ "$TRAVIS_BRANCH" == "develop" ]; then
|
if [ "$TRAVIS_BRANCH" == "develop" ]; then
|
||||||
TARGET=jc5x/firefly-iii:develop
|
TARGET=jc5x/firefly-iii:develop
|
||||||
ARM=jc5x/firefly-iii:develop-arm
|
ARM=jc5x/firefly-iii:develop-arm
|
||||||
AMD=jc5x/firefly-iii:develop-amd
|
AMD=jc5x/firefly-iii:develop-amd64
|
||||||
|
|
||||||
docker manifest create $TARGET $AMD $ARM
|
docker manifest create $TARGET $AMD $ARM
|
||||||
docker manifest annotate $TARGET $ARM --arch arm --os linux
|
docker manifest annotate $TARGET $ARM --arch arm --os linux
|
||||||
@@ -15,7 +16,7 @@ echo "The version is $VERSION"
|
|||||||
if [ "$TRAVIS_BRANCH" == "master" ]; then
|
if [ "$TRAVIS_BRANCH" == "master" ]; then
|
||||||
TARGET=jc5x/firefly-iii:latest
|
TARGET=jc5x/firefly-iii:latest
|
||||||
ARM=jc5x/firefly-iii:latest-arm
|
ARM=jc5x/firefly-iii:latest-arm
|
||||||
AMD=jc5x/firefly-iii:latest-amd
|
AMD=jc5x/firefly-iii:latest-amd64
|
||||||
|
|
||||||
docker manifest create $TARGET $AMD $ARM
|
docker manifest create $TARGET $AMD $ARM
|
||||||
docker manifest annotate $TARGET $ARM --arch arm --os linux
|
docker manifest annotate $TARGET $ARM --arch arm --os linux
|
||||||
@@ -25,7 +26,7 @@ if [ "$TRAVIS_BRANCH" == "master" ]; then
|
|||||||
# and another one for version specific:
|
# and another one for version specific:
|
||||||
TARGET=jc5x/firefly-iii:release-$VERSION
|
TARGET=jc5x/firefly-iii:release-$VERSION
|
||||||
ARM=jc5x/firefly-iii:release-$VERSION-arm
|
ARM=jc5x/firefly-iii:release-$VERSION-arm
|
||||||
AMD=jc5x/firefly-iii:release-$VERSION-amd
|
AMD=jc5x/firefly-iii:release-$VERSION-amd64
|
||||||
|
|
||||||
docker manifest create $TARGET $AMD $ARM
|
docker manifest create $TARGET $AMD $ARM
|
||||||
docker manifest annotate $TARGET $ARM --arch arm --os linux
|
docker manifest annotate $TARGET $ARM --arch arm --os linux
|
||||||
|
@@ -42,7 +42,12 @@ DB_CONNECTION=pgsql
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# PostgreSQL supports SSL. You can configure it here.
|
||||||
|
PGSQL_SSL_MODE=prefer
|
||||||
|
PGSQL_SSL_ROOT_CERT=null
|
||||||
|
PGSQL_SSL_CERT=null
|
||||||
|
PGSQL_SSL_KEY=null
|
||||||
|
PGSQL_SSL_CRL_FILE=null
|
||||||
|
|
||||||
|
|
||||||
# If you're looking for performance improvements, you could install memcached.
|
# If you're looking for performance improvements, you could install memcached.
|
||||||
@@ -112,7 +117,7 @@ ANALYTICS_ID=
|
|||||||
USE_ENCRYPTION=true
|
USE_ENCRYPTION=true
|
||||||
|
|
||||||
# Firefly III has two options for user authentication. "eloquent" is the default,
|
# Firefly III has two options for user authentication. "eloquent" is the default,
|
||||||
# and "adldap" for LDAP servers.
|
# and "ldap" for LDAP servers.
|
||||||
# For full instructions on these settings please visit:
|
# For full instructions on these settings please visit:
|
||||||
# https://firefly-iii.readthedocs.io/en/latest/installation/authentication.html
|
# https://firefly-iii.readthedocs.io/en/latest/installation/authentication.html
|
||||||
LOGIN_PROVIDER=eloquent
|
LOGIN_PROVIDER=eloquent
|
||||||
@@ -136,8 +141,6 @@ ADLDAP_ADMIN_PASSWORD=
|
|||||||
|
|
||||||
ADLDAP_ACCOUNT_PREFIX=
|
ADLDAP_ACCOUNT_PREFIX=
|
||||||
ADLDAP_ACCOUNT_SUFFIX=
|
ADLDAP_ACCOUNT_SUFFIX=
|
||||||
ADLDAP_ADMIN_ACCOUNT_PREFIX=
|
|
||||||
ADLDAP_ADMIN_ACCOUNT_SUFFIX=
|
|
||||||
|
|
||||||
# LDAP authentication settings.
|
# LDAP authentication settings.
|
||||||
ADLDAP_PASSWORD_SYNC=false
|
ADLDAP_PASSWORD_SYNC=false
|
@@ -1,4 +1,5 @@
|
|||||||
en_US
|
en_US
|
||||||
|
es_ES
|
||||||
de_DE
|
de_DE
|
||||||
fr_FR
|
fr_FR
|
||||||
it_IT
|
it_IT
|
||||||
@@ -6,4 +7,4 @@ nl_NL
|
|||||||
pl_PL
|
pl_PL
|
||||||
pt_BR
|
pt_BR
|
||||||
ru_RU
|
ru_RU
|
||||||
tr_TR
|
nb_NO
|
@@ -112,7 +112,7 @@ ANALYTICS_ID=
|
|||||||
USE_ENCRYPTION=true
|
USE_ENCRYPTION=true
|
||||||
|
|
||||||
# Firefly III has two options for user authentication. "eloquent" is the default,
|
# Firefly III has two options for user authentication. "eloquent" is the default,
|
||||||
# and "adldap" for LDAP servers.
|
# and "ldap" for LDAP servers.
|
||||||
# For full instructions on these settings please visit:
|
# For full instructions on these settings please visit:
|
||||||
# https://firefly-iii.readthedocs.io/en/latest/installation/authentication.html
|
# https://firefly-iii.readthedocs.io/en/latest/installation/authentication.html
|
||||||
LOGIN_PROVIDER=eloquent
|
LOGIN_PROVIDER=eloquent
|
||||||
@@ -136,8 +136,6 @@ ADLDAP_ADMIN_PASSWORD=
|
|||||||
|
|
||||||
ADLDAP_ACCOUNT_PREFIX=
|
ADLDAP_ACCOUNT_PREFIX=
|
||||||
ADLDAP_ACCOUNT_SUFFIX=
|
ADLDAP_ACCOUNT_SUFFIX=
|
||||||
ADLDAP_ADMIN_ACCOUNT_PREFIX=
|
|
||||||
ADLDAP_ADMIN_ACCOUNT_SUFFIX=
|
|
||||||
|
|
||||||
# LDAP authentication settings.
|
# LDAP authentication settings.
|
||||||
ADLDAP_PASSWORD_SYNC=false
|
ADLDAP_PASSWORD_SYNC=false
|
11
.env.example
11
.env.example
@@ -45,6 +45,13 @@ DB_DATABASE=homestead
|
|||||||
DB_USERNAME=homestead
|
DB_USERNAME=homestead
|
||||||
DB_PASSWORD=secret
|
DB_PASSWORD=secret
|
||||||
|
|
||||||
|
# PostgreSQL supports SSL. You can configure it here.
|
||||||
|
PGSQL_SSL_MODE=prefer
|
||||||
|
PGSQL_SSL_ROOT_CERT=null
|
||||||
|
PGSQL_SSL_CERT=null
|
||||||
|
PGSQL_SSL_KEY=null
|
||||||
|
PGSQL_SSL_CRL_FILE=null
|
||||||
|
|
||||||
# If you're looking for performance improvements, you could install memcached.
|
# If you're looking for performance improvements, you could install memcached.
|
||||||
CACHE_DRIVER=file
|
CACHE_DRIVER=file
|
||||||
SESSION_DRIVER=file
|
SESSION_DRIVER=file
|
||||||
@@ -112,7 +119,7 @@ ANALYTICS_ID=
|
|||||||
USE_ENCRYPTION=true
|
USE_ENCRYPTION=true
|
||||||
|
|
||||||
# Firefly III has two options for user authentication. "eloquent" is the default,
|
# Firefly III has two options for user authentication. "eloquent" is the default,
|
||||||
# and "adldap" for LDAP servers.
|
# and "ldap" for LDAP servers.
|
||||||
# For full instructions on these settings please visit:
|
# For full instructions on these settings please visit:
|
||||||
# https://firefly-iii.readthedocs.io/en/latest/installation/authentication.html
|
# https://firefly-iii.readthedocs.io/en/latest/installation/authentication.html
|
||||||
LOGIN_PROVIDER=eloquent
|
LOGIN_PROVIDER=eloquent
|
||||||
@@ -136,8 +143,6 @@ ADLDAP_ADMIN_PASSWORD=
|
|||||||
|
|
||||||
ADLDAP_ACCOUNT_PREFIX=
|
ADLDAP_ACCOUNT_PREFIX=
|
||||||
ADLDAP_ACCOUNT_SUFFIX=
|
ADLDAP_ACCOUNT_SUFFIX=
|
||||||
ADLDAP_ADMIN_ACCOUNT_PREFIX=
|
|
||||||
ADLDAP_ADMIN_ACCOUNT_SUFFIX=
|
|
||||||
|
|
||||||
# LDAP authentication settings.
|
# LDAP authentication settings.
|
||||||
ADLDAP_PASSWORD_SYNC=false
|
ADLDAP_PASSWORD_SYNC=false
|
||||||
|
180
.env.testing
180
.env.testing
@@ -1,180 +0,0 @@
|
|||||||
# You can leave this on "local". If you change it to production most console commands will ask for extra confirmation.
|
|
||||||
# Never set it to "testing".
|
|
||||||
APP_ENV=testing
|
|
||||||
|
|
||||||
# Set to true if you want to see debug information in error screens.
|
|
||||||
APP_DEBUG=true
|
|
||||||
|
|
||||||
# This should be your email address
|
|
||||||
SITE_OWNER=thegrumpydictator+testing@gmail.com
|
|
||||||
|
|
||||||
# The encryption key for your database and sessions. Keep this very secure.
|
|
||||||
# If you generate a new one all existing data must be considered LOST.
|
|
||||||
# Change it to a string of exactly 32 chars or use command `php artisan key:generate` to generate it
|
|
||||||
APP_KEY=TestTestTestTestTestTestTestTest
|
|
||||||
|
|
||||||
# Change this value to your preferred time zone.
|
|
||||||
# Example: Europe/Amsterdam
|
|
||||||
TZ=Europe/Amsterdam
|
|
||||||
|
|
||||||
# This variable must match your installation's external address but keep in mind that
|
|
||||||
# it's only used on the command line as a fallback value.
|
|
||||||
APP_URL=http://localhost
|
|
||||||
|
|
||||||
# TRUSTED_PROXIES is a useful variable when using Docker and/or a reverse proxy.
|
|
||||||
TRUSTED_PROXIES=
|
|
||||||
|
|
||||||
# The log channel defines where your log entries go to.
|
|
||||||
# 'daily' is the default logging mode giving you 5 daily rotated log files in /storage/logs/.
|
|
||||||
# Several other options exist. You can use 'single' for one big fat error log (not recommended).
|
|
||||||
# Also available are 'syslog', 'errorlog' and 'stdout' which will log to the system itself.
|
|
||||||
LOG_CHANNEL=dailytest
|
|
||||||
|
|
||||||
# Log level. You can set this from least severe to most severe:
|
|
||||||
# debug, info, notice, warning, error, critical, alert, emergency
|
|
||||||
# If you set it to debug your logs will grow large, and fast. If you set it to emergency probably
|
|
||||||
# nothing will get logged, ever.
|
|
||||||
APP_LOG_LEVEL=info
|
|
||||||
|
|
||||||
# Database credentials. Make sure the database exists. I recommend a dedicated user for Firefly III
|
|
||||||
# For other database types, please see the FAQ: http://firefly-iii.readthedocs.io/en/latest/support/faq.html
|
|
||||||
DB_CONNECTION=sqlite
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# If you're looking for performance improvements, you could install memcached.
|
|
||||||
CACHE_DRIVER=file
|
|
||||||
SESSION_DRIVER=file
|
|
||||||
|
|
||||||
# You can configure another file storage backend if you cannot use the local storage option.
|
|
||||||
# To set this up, fill in the following variables. The upload path is used to store uploaded
|
|
||||||
# files and the export path is to store exported data (before download).
|
|
||||||
SFTP_HOST=
|
|
||||||
SFTP_PORT=
|
|
||||||
SFTP_UPLOAD_PATH=
|
|
||||||
SFTP_EXPORT_PATH=
|
|
||||||
|
|
||||||
# SFTP uses either the username/password combination or the private key to authenticate.
|
|
||||||
SFTP_USERNAME=
|
|
||||||
SFTP_PASSWORD=
|
|
||||||
SFTP_PRIV_KEY=
|
|
||||||
|
|
||||||
# Cookie settings. Should not be necessary to change these.
|
|
||||||
COOKIE_PATH="/"
|
|
||||||
COOKIE_DOMAIN=
|
|
||||||
COOKIE_SECURE=false
|
|
||||||
|
|
||||||
# If you want Firefly III to mail you, update these settings
|
|
||||||
# For instructions, see: https://firefly-iii.readthedocs.io/en/latest/installation/mail.html
|
|
||||||
MAIL_DRIVER=log
|
|
||||||
MAIL_HOST=smtp.mailtrap.io
|
|
||||||
MAIL_PORT=2525
|
|
||||||
MAIL_FROM=changeme@example.com
|
|
||||||
MAIL_USERNAME=null
|
|
||||||
MAIL_PASSWORD=null
|
|
||||||
MAIL_ENCRYPTION=null
|
|
||||||
|
|
||||||
# Other mail drivers:
|
|
||||||
MAILGUN_DOMAIN=
|
|
||||||
MAILGUN_SECRET=
|
|
||||||
MANDRILL_SECRET=
|
|
||||||
SPARKPOST_SECRET=
|
|
||||||
|
|
||||||
# Firefly III can send you the following messages
|
|
||||||
SEND_REGISTRATION_MAIL=true
|
|
||||||
SEND_ERROR_MESSAGE=false
|
|
||||||
|
|
||||||
# These messages contain (sensitive) transaction information:
|
|
||||||
SEND_REPORT_JOURNALS=true
|
|
||||||
|
|
||||||
# Set a Mapbox API key here (see mapbox.com) so there might be a map available at various places.
|
|
||||||
MAPBOX_API_KEY=
|
|
||||||
|
|
||||||
# Firefly III currently supports two provider for live Currency Exchange Rates:
|
|
||||||
# "fixer" is the default (for backward compatibility), and "ratesapi" is the new one.
|
|
||||||
# RatesApi.IO (see https://ratesapi.io) is a FREE and OPEN SOURCE live currency exchange rates,
|
|
||||||
# built compatible with Fixer.IO, based on data published by European Central Bank, and don't require API key.
|
|
||||||
CER_PROVIDER=fixer
|
|
||||||
# If you have select "fixer" as default currency exchange rates,
|
|
||||||
# set a Fixer IO API key here (see https://fixer.io) to enable live currency exchange rates.
|
|
||||||
# Please note that this WILL ONLY WORK FOR PAID fixer.io accounts because they severely limited
|
|
||||||
# the free API up to the point where you might as well offer nothing.
|
|
||||||
FIXER_API_KEY=
|
|
||||||
|
|
||||||
# If you wish to track your own behavior over Firefly III, set a valid analytics tracker ID here.
|
|
||||||
ANALYTICS_ID=
|
|
||||||
|
|
||||||
# Most parts of the database are encrypted by default, but you can turn this off if you want to.
|
|
||||||
# This makes it easier to migrate your database. Not that some fields will never be decrypted.
|
|
||||||
USE_ENCRYPTION=false
|
|
||||||
|
|
||||||
# Firefly III has two options for user authentication. "eloquent" is the default,
|
|
||||||
# and "adldap" for LDAP servers.
|
|
||||||
# For full instructions on these settings please visit:
|
|
||||||
# https://firefly-iii.readthedocs.io/en/latest/installation/authentication.html
|
|
||||||
LOGIN_PROVIDER=eloquent
|
|
||||||
|
|
||||||
# LDAP connection configuration
|
|
||||||
# or FreeIPA or ActiveDirectory
|
|
||||||
ADLDAP_CONNECTION_SCHEME=OpenLDAP
|
|
||||||
ADLDAP_AUTO_CONNECT=true
|
|
||||||
|
|
||||||
# LDAP connection settings
|
|
||||||
ADLDAP_CONTROLLERS=
|
|
||||||
ADLDAP_PORT=389
|
|
||||||
ADLDAP_TIMEOUT=5
|
|
||||||
ADLDAP_BASEDN=""
|
|
||||||
ADLDAP_FOLLOW_REFFERALS=false
|
|
||||||
ADLDAP_USE_SSL=false
|
|
||||||
ADLDAP_USE_TLS=false
|
|
||||||
|
|
||||||
ADLDAP_ADMIN_USERNAME=
|
|
||||||
ADLDAP_ADMIN_PASSWORD=
|
|
||||||
|
|
||||||
ADLDAP_ACCOUNT_PREFIX=
|
|
||||||
ADLDAP_ACCOUNT_SUFFIX=
|
|
||||||
ADLDAP_ADMIN_ACCOUNT_PREFIX=
|
|
||||||
ADLDAP_ADMIN_ACCOUNT_SUFFIX=
|
|
||||||
|
|
||||||
# LDAP authentication settings.
|
|
||||||
ADLDAP_PASSWORD_SYNC=false
|
|
||||||
ADLDAP_LOGIN_FALLBACK=false
|
|
||||||
|
|
||||||
ADLDAP_DISCOVER_FIELD=distinguishedname
|
|
||||||
ADLDAP_AUTH_FIELD=distinguishedname
|
|
||||||
|
|
||||||
# Will allow SSO if your server provides an AUTH_USER field.
|
|
||||||
WINDOWS_SSO_DISCOVER=samaccountname
|
|
||||||
WINDOWS_SSO_KEY=AUTH_USER
|
|
||||||
|
|
||||||
# field to sync as local username.
|
|
||||||
ADLDAP_SYNC_FIELD=userprincipalname
|
|
||||||
|
|
||||||
# You can disable the X-Frame-Options header if it interfears with tools like
|
|
||||||
# Organizr. This is at your own risk.
|
|
||||||
DISABLE_FRAME_HEADER=false
|
|
||||||
|
|
||||||
# Leave the following configuration vars as is.
|
|
||||||
# Unless you like to tinker and know what you're doing.
|
|
||||||
APP_NAME=FireflyIII
|
|
||||||
ADLDAP_CONNECTION=default
|
|
||||||
BROADCAST_DRIVER=log
|
|
||||||
QUEUE_DRIVER=sync
|
|
||||||
REDIS_HOST=127.0.0.1
|
|
||||||
REDIS_PASSWORD=null
|
|
||||||
REDIS_PORT=6379
|
|
||||||
CACHE_PREFIX=firefly_tst
|
|
||||||
SEARCH_RESULT_LIMIT=50
|
|
||||||
PUSHER_KEY=
|
|
||||||
PUSHER_SECRET=
|
|
||||||
PUSHER_ID=
|
|
||||||
DEMO_USERNAME=
|
|
||||||
DEMO_PASSWORD=
|
|
||||||
IS_DOCKER=false
|
|
||||||
IS_SANDSTORM=false
|
|
||||||
IS_HEROKU=false
|
|
||||||
BUNQ_USE_SANDBOX=true
|
|
||||||
FFIII_LAYOUT=v1
|
|
8
.github/pull_request_template.md
vendored
8
.github/pull_request_template.md
vendored
@@ -1,8 +1,10 @@
|
|||||||
<!--
|
<!--
|
||||||
Please read me:
|
Before you create a new PR, please consider the following two considerations.
|
||||||
|
|
||||||
1) DO NOT create a pull request for the MASTER branch.
|
1) Pull request for the MASTER branch will be closed.
|
||||||
2) DO NOT create pull requests to add new CURRENCIES.
|
2) We cannot accept pull requests to add new currencies.
|
||||||
|
|
||||||
|
Thanks.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
Fixes issue # (if relevant)
|
Fixes issue # (if relevant)
|
||||||
|
@@ -6,7 +6,7 @@ set -euo pipefail
|
|||||||
echo "In build.sh"
|
echo "In build.sh"
|
||||||
|
|
||||||
cd /opt/app
|
cd /opt/app
|
||||||
cp .env.sandstorm .env
|
cp .deploy/sandstorm/.env.sandstorm .env
|
||||||
|
|
||||||
if [ -f /opt/app/composer.json ] ; then
|
if [ -f /opt/app/composer.json ] ; then
|
||||||
if [ ! -f composer.phar ] ; then
|
if [ ! -f composer.phar ] ; then
|
||||||
|
@@ -1,3 +1,70 @@
|
|||||||
|
# 4.7.17.4 (API 0.9.2)
|
||||||
|
|
||||||
|
- Several XSS issues, found by [@dayn1ne](https://github.com/dayn1ne).
|
||||||
|
|
||||||
|
# 4.7.17.3 (API 0.9.2)
|
||||||
|
|
||||||
|
- XSS bug in file uploads (x2), found by [@dayn1ne](https://github.com/dayn1ne).
|
||||||
|
- XSS bug in search, found by [@dayn1ne](https://github.com/dayn1ne).
|
||||||
|
|
||||||
|
# 4.7.17.2 (API 0.9.2)
|
||||||
|
- XSS bug in budget title, found by [@dayn1ne](https://github.com/dayn1ne).
|
||||||
|
|
||||||
|
# 4.7.17 (API 0.9.2)
|
||||||
|
- Support for Norwegian!
|
||||||
|
- Clear cache during install routine.
|
||||||
|
- Add Firefly III version number to install routine.
|
||||||
|
- Initial release.
|
||||||
|
- [Issue 2159](https://github.com/firefly-iii/firefly-iii/issues/2159) Bad redirect due to Laravel upgrade.
|
||||||
|
- [Issue 2166](https://github.com/firefly-iii/firefly-iii/issues/2166) Importer had some issues with distinguishing double transfers.
|
||||||
|
- [Issue 2167](https://github.com/firefly-iii/firefly-iii/issues/2167) New LDAP package gave some configuration changes.
|
||||||
|
- [Issue 2173](https://github.com/firefly-iii/firefly-iii/issues/2173) Missing class when generating 2FA codes.
|
||||||
|
|
||||||
|
# 4.7.16 (API 0.9.2)
|
||||||
|
- 4.7.16 was released to fix a persistent issue with broken user preferences.
|
||||||
|
- Firefly III now uses Laravel 5.8
|
||||||
|
|
||||||
|
# 4.7.15 (API 0.9.2)
|
||||||
|
- 4.7.15 was released to fix some issues upgrading from older versions.
|
||||||
|
- [Issue 2128](https://github.com/firefly-iii/firefly-iii/issues/2128) Support for Postgres SSL
|
||||||
|
- [Issue 2120](https://github.com/firefly-iii/firefly-iii/issues/2120) Add a missing meta tag, thanks to @lastlink
|
||||||
|
- Search is a lot faster now.
|
||||||
|
- [Issue 2125](https://github.com/firefly-iii/firefly-iii/issues/2125) Decryption issues during upgrade
|
||||||
|
- [Issue 2130](https://github.com/firefly-iii/firefly-iii/issues/2130) Fixed database migrations and rollbacks.
|
||||||
|
- [Issue 2135](https://github.com/firefly-iii/firefly-iii/issues/2135) Date fixes in transaction overview
|
||||||
|
|
||||||
|
# 4.7.14 (API 0.9.2)
|
||||||
|
- 4.7.14 was released to fix an issue with the Composer installation script.
|
||||||
|
|
||||||
|
# 4.7.13 (API 0.9.2)
|
||||||
|
- 4.7.13 was released to fix an issue that affected the Softaculous build.
|
||||||
|
- A routine has been added that warns about transactions with a 0.00 amount.
|
||||||
|
- PHP maximum execution time is now 600 seconds in the Docker image.
|
||||||
|
- Moved several files outside of the root of Firefly III
|
||||||
|
- Fix issue where missing preference breaks the database upgrade.
|
||||||
|
- [Issue 2100](https://github.com/firefly-iii/firefly-iii/issues/2100) Mass edit transactions results in a reset of the date.
|
||||||
|
|
||||||
|
# 4.7.12
|
||||||
|
- 4.7.12 was released to fix several shortcomings in v4.7.11's Docker image. Those in turn were caused by me. My apologies.
|
||||||
|
- [Issue 2085](https://github.com/firefly-iii/firefly-iii/issues/2085) Upgraded the LDAP code. To keep using LDAP, set the `LOGIN_PROVIDER` to `ldap`.
|
||||||
|
- [Issue 2061](https://github.com/firefly-iii/firefly-iii/issues/2061) Some users reported empty update popups.
|
||||||
|
- [Issue 2070](https://github.com/firefly-iii/firefly-iii/issues/2070) A cache issue prevented rules from being applied correctly.
|
||||||
|
- [Issue 2071](https://github.com/firefly-iii/firefly-iii/issues/2071) Several issues with Postgres and date values with time zone information in them.
|
||||||
|
- [Issue 2081](https://github.com/firefly-iii/firefly-iii/issues/2081) Rules were not being applied when importing using FinTS.
|
||||||
|
- [Issue 2082](https://github.com/firefly-iii/firefly-iii/issues/2082) The mass-editor changed all dates to today.
|
||||||
|
|
||||||
|
# 4.7.11
|
||||||
|
- Experimental audit logging channel to track important events (separate from debug logging).
|
||||||
|
- [Issue 2003](https://github.com/firefly-iii/firefly-iii/issues/2003), [issue 2006](https://github.com/firefly-iii/firefly-iii/issues/2006) Transactions can be stored with a timestamp. The user-interface does not support this yet. But the API does.
|
||||||
|
- Docker image tags a new manifest for arm and amd64.
|
||||||
|
- [skuzzle](https://github.com/skuzzle) removed an annoying console.log statement.
|
||||||
|
- [Issue 2048](https://github.com/firefly-iii/firefly-iii/issues/2048) Fix "Are you sure?" popup, thanks to @nescafe2002!
|
||||||
|
- [Issue 2049](https://github.com/firefly-iii/firefly-iii/issues/2049) Empty preferences would crash Firefly III.
|
||||||
|
- [Issue 2052](https://github.com/firefly-iii/firefly-iii/issues/2052) Rules could not auto-covert to liabilities.
|
||||||
|
- Webbased upgrade routine will also decrypt the database.
|
||||||
|
- Last use date for categories was off.
|
||||||
|
- The `date`-field in any transaction object now returns a ISO 8601 timestamp instead of a date.
|
||||||
|
|
||||||
# 4.7.10
|
# 4.7.10
|
||||||
- [Issue 2037](https://github.com/firefly-iii/firefly-iii/issues/2037) Added some new magic keywords to reports.
|
- [Issue 2037](https://github.com/firefly-iii/firefly-iii/issues/2037) Added some new magic keywords to reports.
|
||||||
- Added a new currency exchange rate service, [ratesapi.io](https://ratesapi.io/), that does not require expensive API keys. Built by [@BoGnY](https://github.com/BoGnY).
|
- Added a new currency exchange rate service, [ratesapi.io](https://ratesapi.io/), that does not require expensive API keys. Built by [@BoGnY](https://github.com/BoGnY).
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -15,8 +15,8 @@ const pkgdef :Spk.PackageDefinition = (
|
|||||||
|
|
||||||
manifest = (
|
manifest = (
|
||||||
appTitle = (defaultText = "Firefly III"),
|
appTitle = (defaultText = "Firefly III"),
|
||||||
appVersion = 20,
|
appVersion = 30,
|
||||||
appMarketingVersion = (defaultText = "4.7.10"),
|
appMarketingVersion = (defaultText = "4.7.17.4"),
|
||||||
|
|
||||||
actions = [
|
actions = [
|
||||||
# Define your "new document" handlers here.
|
# Define your "new document" handlers here.
|
||||||
|
@@ -13,6 +13,7 @@ apt-get update
|
|||||||
apt-get install -y python-software-properties software-properties-common
|
apt-get install -y python-software-properties software-properties-common
|
||||||
|
|
||||||
# install all languages
|
# install all languages
|
||||||
|
#en_US
|
||||||
sed -i 's/# es_ES.UTF-8 UTF-8/es_ES.UTF-8 UTF-8/g' /etc/locale.gen
|
sed -i 's/# es_ES.UTF-8 UTF-8/es_ES.UTF-8 UTF-8/g' /etc/locale.gen
|
||||||
sed -i 's/# de_DE.UTF-8 UTF-8/de_DE.UTF-8 UTF-8/g' /etc/locale.gen
|
sed -i 's/# de_DE.UTF-8 UTF-8/de_DE.UTF-8 UTF-8/g' /etc/locale.gen
|
||||||
sed -i 's/# fr_FR.UTF-8 UTF-8/fr_FR.UTF-8 UTF-8/g' /etc/locale.gen
|
sed -i 's/# fr_FR.UTF-8 UTF-8/fr_FR.UTF-8 UTF-8/g' /etc/locale.gen
|
||||||
@@ -22,6 +23,9 @@ sed -i 's/# pl_PL.UTF-8 UTF-8/pl_PL.UTF-8 UTF-8/g' /etc/locale.gen
|
|||||||
sed -i 's/# pt_BR.UTF-8 UTF-8/pt_BR.UTF-8 UTF-8/g' /etc/locale.gen
|
sed -i 's/# pt_BR.UTF-8 UTF-8/pt_BR.UTF-8 UTF-8/g' /etc/locale.gen
|
||||||
sed -i 's/# ru_RU.UTF-8 UTF-8/ru_RU.UTF-8 UTF-8/g' /etc/locale.gen
|
sed -i 's/# ru_RU.UTF-8 UTF-8/ru_RU.UTF-8 UTF-8/g' /etc/locale.gen
|
||||||
sed -i 's/# zh_TW.UTF-8 UTF-8/zh_TW.UTF-8 UTF-8/g' /etc/locale.gen
|
sed -i 's/# zh_TW.UTF-8 UTF-8/zh_TW.UTF-8 UTF-8/g' /etc/locale.gen
|
||||||
|
sed -i 's/# zh_CN.UTF-8 UTF-8/zh_CN.UTF-8 UTF-8/g' /etc/locale.gen
|
||||||
|
sed -i 's/# nb_NO.UTF-8 UTF-8/nb_NO.UTF-8 UTF-8/g' /etc/locale.gen
|
||||||
|
|
||||||
|
|
||||||
dpkg-reconfigure --frontend=noninteractive locales
|
dpkg-reconfigure --frontend=noninteractive locales
|
||||||
|
|
||||||
|
12
.travis.yml
12
.travis.yml
@@ -1,23 +1,29 @@
|
|||||||
sudo: required
|
sudo: required
|
||||||
language: bash
|
language: bash
|
||||||
|
env:
|
||||||
|
- VERSION=4.7.17.4
|
||||||
|
|
||||||
|
dist: xenial
|
||||||
|
|
||||||
# safelist
|
# safelist
|
||||||
branches:
|
branches:
|
||||||
only:
|
only:
|
||||||
- develop
|
- develop
|
||||||
- master
|
- master
|
||||||
|
|
||||||
env:
|
|
||||||
- VERSION=4.7.10
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
- docker
|
- docker
|
||||||
|
|
||||||
script:
|
script:
|
||||||
# enable experimental features.
|
# enable experimental features.
|
||||||
- echo '{"experimental":true}' | sudo tee /etc/docker/daemon.json
|
- echo '{"experimental":true}' | sudo tee /etc/docker/daemon.json
|
||||||
|
- mkdir $HOME/.docker
|
||||||
|
- touch $HOME/.docker/config.json
|
||||||
|
- echo '{"experimental":"enabled"}' | sudo tee $HOME/.docker/config.json
|
||||||
- sudo service docker restart
|
- sudo service docker restart
|
||||||
- docker version -f '{{.Server.Experimental}}'
|
- docker version -f '{{.Server.Experimental}}'
|
||||||
- docker version
|
- docker version
|
||||||
|
# build everything
|
||||||
- .deploy/docker/build-amd64.sh
|
- .deploy/docker/build-amd64.sh
|
||||||
- .deploy/docker/build-arm.sh
|
- .deploy/docker/build-arm.sh
|
||||||
- .deploy/docker/manifest.sh
|
- .deploy/docker/manifest.sh
|
@@ -1,7 +1,7 @@
|
|||||||
FROM php:7.2-apache
|
FROM php:7.2-apache
|
||||||
|
|
||||||
ENV FIREFLY_PATH=/var/www/firefly-iii COMPOSER_ALLOW_SUPERUSER=1
|
ENV FIREFLY_PATH=/var/www/firefly-iii COMPOSER_ALLOW_SUPERUSER=1
|
||||||
LABEL version="1.3" maintainer="thegrumpydictator@gmail.com"
|
LABEL version="1.4" maintainer="thegrumpydictator@gmail.com"
|
||||||
|
|
||||||
# Create volumes
|
# Create volumes
|
||||||
VOLUME $FIREFLY_PATH/storage/export $FIREFLY_PATH/storage/upload
|
VOLUME $FIREFLY_PATH/storage/export $FIREFLY_PATH/storage/upload
|
||||||
@@ -44,6 +44,11 @@ RUN chown -R www-data:www-data /var/www && \
|
|||||||
locale-gen && \
|
locale-gen && \
|
||||||
composer install --prefer-dist --no-dev --no-scripts --no-suggest
|
composer install --prefer-dist --no-dev --no-scripts --no-suggest
|
||||||
|
|
||||||
|
# configure PHP
|
||||||
|
RUN cp /usr/local/etc/php/php.ini-production /usr/local/etc/php/php.ini && \
|
||||||
|
sed -i 's/max_execution_time = 30/max_execution_time = 600/' /usr/local/etc/php/php.ini && \
|
||||||
|
sed -i 's/memory_limit = 128M/memory_limit = 512M/' /usr/local/etc/php/php.ini
|
||||||
|
|
||||||
# Expose port 80
|
# Expose port 80
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|
||||||
|
57
Dockerfile.amd64
Normal file
57
Dockerfile.amd64
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
FROM php:7.2-apache
|
||||||
|
ARG ARCH
|
||||||
|
ENV FIREFLY_PATH=/var/www/firefly-iii COMPOSER_ALLOW_SUPERUSER=1
|
||||||
|
LABEL version="1.4" maintainer="thegrumpydictator@gmail.com"
|
||||||
|
|
||||||
|
# Create volumes
|
||||||
|
VOLUME $FIREFLY_PATH/storage/export $FIREFLY_PATH/storage/upload
|
||||||
|
|
||||||
|
# Install some stuff
|
||||||
|
RUN apt-get update && apt-get install -y libpng-dev \
|
||||||
|
libicu-dev \
|
||||||
|
unzip \
|
||||||
|
gettext-base \
|
||||||
|
libldap2-dev \
|
||||||
|
libpq-dev \
|
||||||
|
locales \
|
||||||
|
libmemcached-dev && \
|
||||||
|
apt-get clean && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Copy in Firefly III source
|
||||||
|
WORKDIR $FIREFLY_PATH
|
||||||
|
ADD . $FIREFLY_PATH
|
||||||
|
|
||||||
|
# copy ca certs to correct location
|
||||||
|
COPY ./.deploy/docker/cacert.pem /usr/local/ssl/cert.pem
|
||||||
|
|
||||||
|
# copy Apache config to correct spot.
|
||||||
|
COPY ./.deploy/docker/apache2.conf /etc/apache2/apache2.conf
|
||||||
|
|
||||||
|
# Enable default site (Firefly III)
|
||||||
|
COPY ./.deploy/docker/apache-firefly.conf /etc/apache2/sites-available/000-default.conf
|
||||||
|
|
||||||
|
# Run a lot of installation commands:
|
||||||
|
RUN chown -R www-data:www-data /var/www && \
|
||||||
|
chmod -R 775 $FIREFLY_PATH/storage && \
|
||||||
|
a2enmod rewrite && a2enmod ssl && \
|
||||||
|
docker-php-ext-configure ldap --with-libdir=lib/$(gcc -dumpmachine)/ && \
|
||||||
|
docker-php-ext-install -j$(nproc) zip bcmath ldap gd pdo_pgsql pdo_mysql intl opcache && \
|
||||||
|
pecl install memcached-3.1.3 && \
|
||||||
|
docker-php-ext-enable memcached && \
|
||||||
|
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer && \
|
||||||
|
echo "de_DE.UTF-8 UTF-8\nen_US.UTF-8 UTF-8\nes_ES.UTF-8 UTF-8\nfr_FR.UTF-8 UTF-8\nid_ID.UTF-8 UTF-8\nit_IT.UTF-8 UTF-8\nnl_NL.UTF-8 UTF-8\npl_PL.UTF-8 UTF-8\npt_BR.UTF-8 UTF-8\nru_RU.UTF-8 UTF-8\ntr_TR.UTF-8 UTF-8\nzh_TW.UTF-8 UTF-8\nzh_CN.UTF-8 UTF-8\n\n" > /etc/locale.gen && \
|
||||||
|
locale-gen && \
|
||||||
|
composer install --prefer-dist --no-dev --no-scripts --no-suggest
|
||||||
|
|
||||||
|
# configure PHP
|
||||||
|
RUN cp /usr/local/etc/php/php.ini-production /usr/local/etc/php/php.ini && \
|
||||||
|
sed -i 's/max_execution_time = 30/max_execution_time = 600/' /usr/local/etc/php/php.ini && \
|
||||||
|
sed -i 's/memory_limit = 128M/memory_limit = 512M/' /usr/local/etc/php/php.ini
|
||||||
|
|
||||||
|
|
||||||
|
# Expose port 80
|
||||||
|
EXPOSE 80
|
||||||
|
|
||||||
|
# Run entrypoint thing
|
||||||
|
ENTRYPOINT [".deploy/docker/entrypoint.sh"]
|
@@ -1,8 +1,8 @@
|
|||||||
FROM arm32v7/php:7.2.8-apache-stretch
|
FROM arm32v7/php:7.2.8-apache-stretch
|
||||||
ARG TARGETPLATFORM
|
ARG ARCH
|
||||||
COPY tmp/qemu-arm-static /usr/bin/qemu-arm-static
|
COPY tmp/qemu-arm-static /usr/bin/qemu-arm-static
|
||||||
ENV FIREFLY_PATH=/var/www/firefly-iii COMPOSER_ALLOW_SUPERUSER=1
|
ENV FIREFLY_PATH=/var/www/firefly-iii COMPOSER_ALLOW_SUPERUSER=1
|
||||||
LABEL version="1.3" maintainer="thegrumpydictator@gmail.com"
|
LABEL version="1.4" maintainer="thegrumpydictator@gmail.com"
|
||||||
|
|
||||||
# Create volumes
|
# Create volumes
|
||||||
VOLUME $FIREFLY_PATH/storage/export $FIREFLY_PATH/storage/upload
|
VOLUME $FIREFLY_PATH/storage/export $FIREFLY_PATH/storage/upload
|
50
Dockerfile.arm64
Normal file
50
Dockerfile.arm64
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
FROM arm32v7/php:7.2.8-apache-stretch
|
||||||
|
ARG ARCH
|
||||||
|
COPY tmp/qemu-arm-static /usr/bin/qemu-arm-static
|
||||||
|
ENV FIREFLY_PATH=/var/www/firefly-iii COMPOSER_ALLOW_SUPERUSER=1
|
||||||
|
LABEL version="1.4" maintainer="thegrumpydictator@gmail.com"
|
||||||
|
|
||||||
|
# Create volumes
|
||||||
|
VOLUME $FIREFLY_PATH/storage/export $FIREFLY_PATH/storage/upload
|
||||||
|
|
||||||
|
# Install some stuff
|
||||||
|
RUN apt-get update && apt-get install -y libpng-dev \
|
||||||
|
libicu-dev \
|
||||||
|
unzip \
|
||||||
|
gettext-base \
|
||||||
|
libldap2-dev \
|
||||||
|
libpq-dev \
|
||||||
|
locales \
|
||||||
|
libmemcached-dev
|
||||||
|
|
||||||
|
# Copy in Firefly III source
|
||||||
|
WORKDIR $FIREFLY_PATH
|
||||||
|
ADD . $FIREFLY_PATH
|
||||||
|
|
||||||
|
# copy ca certs to correct location
|
||||||
|
COPY ./.deploy/docker/cacert.pem /usr/local/ssl/cert.pem
|
||||||
|
|
||||||
|
# copy Apache config to correct spot.
|
||||||
|
COPY ./.deploy/docker/apache2.conf /etc/apache2/apache2.conf
|
||||||
|
|
||||||
|
# Enable default site (Firefly III)
|
||||||
|
COPY ./.deploy/docker/apache-firefly.conf /etc/apache2/sites-available/000-default.conf
|
||||||
|
|
||||||
|
# Run a lot of installation commands:
|
||||||
|
RUN chown -R www-data:www-data /var/www && \
|
||||||
|
chmod -R 775 $FIREFLY_PATH/storage && \
|
||||||
|
a2enmod rewrite && a2enmod ssl && \
|
||||||
|
docker-php-ext-configure ldap --with-libdir=lib/$(gcc -dumpmachine)/ && \
|
||||||
|
docker-php-ext-install -j$(nproc) zip bcmath ldap gd pdo_pgsql pdo_mysql intl opcache && \
|
||||||
|
pecl install memcached-3.1.3 && \
|
||||||
|
docker-php-ext-enable memcached && \
|
||||||
|
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer && \
|
||||||
|
echo "de_DE.UTF-8 UTF-8\nen_US.UTF-8 UTF-8\nes_ES.UTF-8 UTF-8\nfr_FR.UTF-8 UTF-8\nid_ID.UTF-8 UTF-8\nit_IT.UTF-8 UTF-8\nnl_NL.UTF-8 UTF-8\npl_PL.UTF-8 UTF-8\npt_BR.UTF-8 UTF-8\nru_RU.UTF-8 UTF-8\ntr_TR.UTF-8 UTF-8\nzh_TW.UTF-8 UTF-8\nzh_CN.UTF-8 UTF-8\n\n" > /etc/locale.gen && \
|
||||||
|
locale-gen && \
|
||||||
|
composer install --prefer-dist --no-dev --no-scripts --no-suggest
|
||||||
|
|
||||||
|
# Expose port 80
|
||||||
|
EXPOSE 80
|
||||||
|
|
||||||
|
# Run entrypoint thing
|
||||||
|
ENTRYPOINT [".deploy/docker/entrypoint.sh"]
|
@@ -60,7 +60,7 @@ class AboutController extends Controller
|
|||||||
'driver' => $currentDriver,
|
'driver' => $currentDriver,
|
||||||
];
|
];
|
||||||
|
|
||||||
return response()->json(['data' => $data], 200)->header('Content-Type', 'application/vnd.api+json');
|
return response()->json(['data' => $data])->header('Content-Type', 'application/vnd.api+json');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -100,7 +100,7 @@ class AttachmentController extends Controller
|
|||||||
$quoted = sprintf('"%s"', addcslashes(basename($attachment->filename), '"\\'));
|
$quoted = sprintf('"%s"', addcslashes(basename($attachment->filename), '"\\'));
|
||||||
|
|
||||||
/** @var LaravelResponse $response */
|
/** @var LaravelResponse $response */
|
||||||
$response = response($content, 200);
|
$response = response($content);
|
||||||
$response
|
$response
|
||||||
->header('Content-Description', 'File Transfer')
|
->header('Content-Description', 'File Transfer')
|
||||||
->header('Content-Type', 'application/octet-stream')
|
->header('Content-Type', 'application/octet-stream')
|
||||||
|
@@ -24,12 +24,10 @@ declare(strict_types=1);
|
|||||||
namespace FireflyIII\Api\V1\Controllers;
|
namespace FireflyIII\Api\V1\Controllers;
|
||||||
|
|
||||||
use FireflyIII\Api\V1\Requests\AvailableBudgetRequest;
|
use FireflyIII\Api\V1\Requests\AvailableBudgetRequest;
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
|
||||||
use FireflyIII\Factory\TransactionCurrencyFactory;
|
use FireflyIII\Factory\TransactionCurrencyFactory;
|
||||||
use FireflyIII\Models\AvailableBudget;
|
use FireflyIII\Models\AvailableBudget;
|
||||||
use FireflyIII\Models\TransactionCurrency;
|
use FireflyIII\Models\TransactionCurrency;
|
||||||
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
||||||
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
|
|
||||||
use FireflyIII\Transformers\AvailableBudgetTransformer;
|
use FireflyIII\Transformers\AvailableBudgetTransformer;
|
||||||
use FireflyIII\User;
|
use FireflyIII\User;
|
||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
@@ -48,8 +46,6 @@ use League\Fractal\Serializer\JsonApiSerializer;
|
|||||||
*/
|
*/
|
||||||
class AvailableBudgetController extends Controller
|
class AvailableBudgetController extends Controller
|
||||||
{
|
{
|
||||||
/** @var CurrencyRepositoryInterface The currency repository */
|
|
||||||
private $currencyRepository;
|
|
||||||
/** @var BudgetRepositoryInterface The budget repository */
|
/** @var BudgetRepositoryInterface The budget repository */
|
||||||
private $repository;
|
private $repository;
|
||||||
|
|
||||||
@@ -62,9 +58,8 @@ class AvailableBudgetController extends Controller
|
|||||||
$this->middleware(
|
$this->middleware(
|
||||||
function ($request, $next) {
|
function ($request, $next) {
|
||||||
/** @var User $user */
|
/** @var User $user */
|
||||||
$user = auth()->user();
|
$user = auth()->user();
|
||||||
$this->repository = app(BudgetRepositoryInterface::class);
|
$this->repository = app(BudgetRepositoryInterface::class);
|
||||||
$this->currencyRepository = app(CurrencyRepositoryInterface::class);
|
|
||||||
$this->repository->setUser($user);
|
$this->repository->setUser($user);
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
@@ -103,16 +98,18 @@ class AvailableBudgetController extends Controller
|
|||||||
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||||
|
|
||||||
// get list of available budgets. Count it and split it.
|
// get list of available budgets. Count it and split it.
|
||||||
$collection = $this->repository->getAvailableBudgets();
|
$collection = $this->repository->getAvailableBudgets();
|
||||||
|
|
||||||
// filter list on start and end date, if present.
|
// filter list on start and end date, if present.
|
||||||
// TODO: put this in the query.
|
// TODO: put this in the query.
|
||||||
$start = $this->parameters->get('start');
|
$start = $this->parameters->get('start');
|
||||||
$end = $this->parameters->get('end');
|
$end = $this->parameters->get('end');
|
||||||
if(null !== $start && null !== $end) {
|
if (null !== $start && null !== $end) {
|
||||||
$collection = $collection->filter(function(AvailableBudget $availableBudget) use ($start, $end) {
|
$collection = $collection->filter(
|
||||||
return $availableBudget->start_date->gte($start) && $availableBudget->end_date->lte($end);
|
function (AvailableBudget $availableBudget) use ($start, $end) {
|
||||||
});
|
return $availableBudget->start_date->gte($start) && $availableBudget->end_date->lte($end);
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$count = $collection->count();
|
$count = $collection->count();
|
||||||
@@ -164,7 +161,6 @@ class AvailableBudgetController extends Controller
|
|||||||
* @param AvailableBudgetRequest $request
|
* @param AvailableBudgetRequest $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
* @throws FireflyException
|
|
||||||
*/
|
*/
|
||||||
public function store(AvailableBudgetRequest $request): JsonResponse
|
public function store(AvailableBudgetRequest $request): JsonResponse
|
||||||
{
|
{
|
||||||
|
@@ -1,4 +1,25 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AccountController.php
|
||||||
|
* Copyright (c) 2019 thegrumpydictator@gmail.com
|
||||||
|
*
|
||||||
|
* This file is part of Firefly III.
|
||||||
|
*
|
||||||
|
* Firefly III is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Firefly III is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace FireflyIII\Api\V1\Controllers\Chart;
|
namespace FireflyIII\Api\V1\Controllers\Chart;
|
||||||
@@ -135,94 +156,6 @@ class AccountController extends Controller
|
|||||||
return response()->json($chartData);
|
return response()->json($chartData);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Request $request
|
|
||||||
*
|
|
||||||
* @return JsonResponse
|
|
||||||
* @throws FireflyException
|
|
||||||
*/
|
|
||||||
public function revenueOverview(Request $request): JsonResponse
|
|
||||||
{
|
|
||||||
// parameters for chart:
|
|
||||||
$start = (string)$request->get('start');
|
|
||||||
$end = (string)$request->get('end');
|
|
||||||
if ('' === $start || '' === $end) {
|
|
||||||
throw new FireflyException('Start and end are mandatory parameters.');
|
|
||||||
}
|
|
||||||
|
|
||||||
$start = Carbon::createFromFormat('Y-m-d', $start);
|
|
||||||
$end = Carbon::createFromFormat('Y-m-d', $end);
|
|
||||||
$start->subDay();
|
|
||||||
|
|
||||||
// prep some vars:
|
|
||||||
$currencies = [];
|
|
||||||
$chartData = [];
|
|
||||||
$tempData = [];
|
|
||||||
|
|
||||||
// grab all accounts and names
|
|
||||||
$accounts = $this->repository->getAccountsByType([AccountType::REVENUE]);
|
|
||||||
$accountNames = $this->extractNames($accounts);
|
|
||||||
$startBalances = app('steam')->balancesPerCurrencyByAccounts($accounts, $start);
|
|
||||||
$endBalances = app('steam')->balancesPerCurrencyByAccounts($accounts, $end);
|
|
||||||
|
|
||||||
// loop the end balances. This is an array for each account ($expenses)
|
|
||||||
foreach ($endBalances as $accountId => $expenses) {
|
|
||||||
$accountId = (int)$accountId;
|
|
||||||
// loop each expense entry (each entry can be a different currency).
|
|
||||||
foreach ($expenses as $currencyId => $endAmount) {
|
|
||||||
$currencyId = (int)$currencyId;
|
|
||||||
|
|
||||||
// see if there is an accompanying start amount.
|
|
||||||
// grab the difference and find the currency.
|
|
||||||
$startAmount = $startBalances[$accountId][$currencyId] ?? '0';
|
|
||||||
$diff = bcsub($endAmount, $startAmount);
|
|
||||||
$currencies[$currencyId] = $currencies[$currencyId] ?? $this->currencyRepository->findNull($currencyId);
|
|
||||||
if (0 !== bccomp($diff, '0')) {
|
|
||||||
// store the values in a temporary array.
|
|
||||||
$tempData[] = [
|
|
||||||
'name' => $accountNames[$accountId],
|
|
||||||
'difference' => bcmul($diff,'-1'),
|
|
||||||
'diff_float' => (float)$diff * -1,
|
|
||||||
'currency_id' => $currencyId,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// sort temp array by amount.
|
|
||||||
$amounts = array_column($tempData, 'diff_float');
|
|
||||||
array_multisort($amounts, SORT_DESC, $tempData);
|
|
||||||
|
|
||||||
// loop all found currencies and build the data array for the chart.
|
|
||||||
/**
|
|
||||||
* @var int $currencyId
|
|
||||||
* @var TransactionCurrency $currency
|
|
||||||
*/
|
|
||||||
foreach ($currencies as $currencyId => $currency) {
|
|
||||||
$currentSet = [
|
|
||||||
'label' => trans('firefly.box_earned_in_currency', ['currency' => $currency->symbol]),
|
|
||||||
'currency_id' => $currency->id,
|
|
||||||
'currency_code' => $currency->code,
|
|
||||||
'currency_symbol' => $currency->symbol,
|
|
||||||
'currency_decimal_places' => $currency->decimal_places,
|
|
||||||
'type' => 'bar', // line, area or bar
|
|
||||||
'yAxisID' => 0, // 0, 1, 2
|
|
||||||
'entries' => $this->expandNames($tempData),
|
|
||||||
];
|
|
||||||
$chartData[$currencyId] = $currentSet;
|
|
||||||
}
|
|
||||||
|
|
||||||
// loop temp data and place data in correct array:
|
|
||||||
foreach ($tempData as $entry) {
|
|
||||||
$currencyId = $entry['currency_id'];
|
|
||||||
$name = $entry['name'];
|
|
||||||
$chartData[$currencyId]['entries'][$name] = round($entry['difference'], $chartData[$currencyId]['currency_decimal_places']);
|
|
||||||
}
|
|
||||||
$chartData = array_values($chartData);
|
|
||||||
|
|
||||||
return response()->json($chartData);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
*
|
*
|
||||||
@@ -287,6 +220,94 @@ class AccountController extends Controller
|
|||||||
return response()->json($chartData);
|
return response()->json($chartData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Request $request
|
||||||
|
*
|
||||||
|
* @return JsonResponse
|
||||||
|
* @throws FireflyException
|
||||||
|
*/
|
||||||
|
public function revenueOverview(Request $request): JsonResponse
|
||||||
|
{
|
||||||
|
// parameters for chart:
|
||||||
|
$start = (string)$request->get('start');
|
||||||
|
$end = (string)$request->get('end');
|
||||||
|
if ('' === $start || '' === $end) {
|
||||||
|
throw new FireflyException('Start and end are mandatory parameters.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$start = Carbon::createFromFormat('Y-m-d', $start);
|
||||||
|
$end = Carbon::createFromFormat('Y-m-d', $end);
|
||||||
|
$start->subDay();
|
||||||
|
|
||||||
|
// prep some vars:
|
||||||
|
$currencies = [];
|
||||||
|
$chartData = [];
|
||||||
|
$tempData = [];
|
||||||
|
|
||||||
|
// grab all accounts and names
|
||||||
|
$accounts = $this->repository->getAccountsByType([AccountType::REVENUE]);
|
||||||
|
$accountNames = $this->extractNames($accounts);
|
||||||
|
$startBalances = app('steam')->balancesPerCurrencyByAccounts($accounts, $start);
|
||||||
|
$endBalances = app('steam')->balancesPerCurrencyByAccounts($accounts, $end);
|
||||||
|
|
||||||
|
// loop the end balances. This is an array for each account ($expenses)
|
||||||
|
foreach ($endBalances as $accountId => $expenses) {
|
||||||
|
$accountId = (int)$accountId;
|
||||||
|
// loop each expense entry (each entry can be a different currency).
|
||||||
|
foreach ($expenses as $currencyId => $endAmount) {
|
||||||
|
$currencyId = (int)$currencyId;
|
||||||
|
|
||||||
|
// see if there is an accompanying start amount.
|
||||||
|
// grab the difference and find the currency.
|
||||||
|
$startAmount = $startBalances[$accountId][$currencyId] ?? '0';
|
||||||
|
$diff = bcsub($endAmount, $startAmount);
|
||||||
|
$currencies[$currencyId] = $currencies[$currencyId] ?? $this->currencyRepository->findNull($currencyId);
|
||||||
|
if (0 !== bccomp($diff, '0')) {
|
||||||
|
// store the values in a temporary array.
|
||||||
|
$tempData[] = [
|
||||||
|
'name' => $accountNames[$accountId],
|
||||||
|
'difference' => bcmul($diff, '-1'),
|
||||||
|
'diff_float' => (float)$diff * -1,
|
||||||
|
'currency_id' => $currencyId,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// sort temp array by amount.
|
||||||
|
$amounts = array_column($tempData, 'diff_float');
|
||||||
|
array_multisort($amounts, SORT_DESC, $tempData);
|
||||||
|
|
||||||
|
// loop all found currencies and build the data array for the chart.
|
||||||
|
/**
|
||||||
|
* @var int $currencyId
|
||||||
|
* @var TransactionCurrency $currency
|
||||||
|
*/
|
||||||
|
foreach ($currencies as $currencyId => $currency) {
|
||||||
|
$currentSet = [
|
||||||
|
'label' => trans('firefly.box_earned_in_currency', ['currency' => $currency->symbol]),
|
||||||
|
'currency_id' => $currency->id,
|
||||||
|
'currency_code' => $currency->code,
|
||||||
|
'currency_symbol' => $currency->symbol,
|
||||||
|
'currency_decimal_places' => $currency->decimal_places,
|
||||||
|
'type' => 'bar', // line, area or bar
|
||||||
|
'yAxisID' => 0, // 0, 1, 2
|
||||||
|
'entries' => $this->expandNames($tempData),
|
||||||
|
];
|
||||||
|
$chartData[$currencyId] = $currentSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
// loop temp data and place data in correct array:
|
||||||
|
foreach ($tempData as $entry) {
|
||||||
|
$currencyId = $entry['currency_id'];
|
||||||
|
$name = $entry['name'];
|
||||||
|
$chartData[$currencyId]['entries'][$name] = round($entry['difference'], $chartData[$currencyId]['currency_decimal_places']);
|
||||||
|
}
|
||||||
|
$chartData = array_values($chartData);
|
||||||
|
|
||||||
|
return response()->json($chartData);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Small helper function for the revenue and expense account charts.
|
* Small helper function for the revenue and expense account charts.
|
||||||
* TODO should include Trait instead of doing this.
|
* TODO should include Trait instead of doing this.
|
||||||
@@ -324,4 +345,4 @@ class AccountController extends Controller
|
|||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,25 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AvailableBudgetController.php
|
||||||
|
* Copyright (c) 2019 thegrumpydictator@gmail.com
|
||||||
|
*
|
||||||
|
* This file is part of Firefly III.
|
||||||
|
*
|
||||||
|
* Firefly III is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Firefly III is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace FireflyIII\Api\V1\Controllers\Chart;
|
namespace FireflyIII\Api\V1\Controllers\Chart;
|
||||||
@@ -9,7 +30,6 @@ use FireflyIII\Models\AvailableBudget;
|
|||||||
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
||||||
use FireflyIII\User;
|
use FireflyIII\User;
|
||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -39,13 +59,11 @@ class AvailableBudgetController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Request $request
|
|
||||||
*
|
|
||||||
* @param AvailableBudget $availableBudget
|
* @param AvailableBudget $availableBudget
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
public function overview(Request $request, AvailableBudget $availableBudget): JsonResponse
|
public function overview(AvailableBudget $availableBudget): JsonResponse
|
||||||
{
|
{
|
||||||
$currency = $availableBudget->transactionCurrency;
|
$currency = $availableBudget->transactionCurrency;
|
||||||
$budgets = $this->repository->getActiveBudgets();
|
$budgets = $this->repository->getActiveBudgets();
|
||||||
@@ -90,4 +108,4 @@ class AvailableBudgetController extends Controller
|
|||||||
return response()->json($chartData);
|
return response()->json($chartData);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,25 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CategoryController.php
|
||||||
|
* Copyright (c) 2019 thegrumpydictator@gmail.com
|
||||||
|
*
|
||||||
|
* This file is part of Firefly III.
|
||||||
|
*
|
||||||
|
* Firefly III is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Firefly III is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace FireflyIII\Api\V1\Controllers\Chart;
|
namespace FireflyIII\Api\V1\Controllers\Chart;
|
||||||
@@ -185,4 +206,4 @@ class CategoryController extends Controller
|
|||||||
|
|
||||||
return response()->json($chartData);
|
return response()->json($chartData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -54,7 +54,6 @@ class ConfigurationController extends Controller
|
|||||||
$admin = auth()->user();
|
$admin = auth()->user();
|
||||||
|
|
||||||
if (!$this->repository->hasRole($admin, 'owner')) {
|
if (!$this->repository->hasRole($admin, 'owner')) {
|
||||||
/** @noinspection ExceptionsAnnotatingAndHandlingInspection */
|
|
||||||
throw new FireflyException('No access to method.'); // @codeCoverageIgnore
|
throw new FireflyException('No access to method.'); // @codeCoverageIgnore
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,7 +71,7 @@ class ConfigurationController extends Controller
|
|||||||
{
|
{
|
||||||
$configData = $this->getConfigData();
|
$configData = $this->getConfigData();
|
||||||
|
|
||||||
return response()->json(['data' => $configData], 200)->header('Content-Type', 'application/vnd.api+json');
|
return response()->json(['data' => $configData])->header('Content-Type', 'application/vnd.api+json');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -82,7 +81,6 @@ class ConfigurationController extends Controller
|
|||||||
* @param string $name
|
* @param string $name
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
* @throws FireflyException
|
|
||||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
||||||
*/
|
*/
|
||||||
public function update(ConfigurationRequest $request, string $name): JsonResponse
|
public function update(ConfigurationRequest $request, string $name): JsonResponse
|
||||||
@@ -91,7 +89,7 @@ class ConfigurationController extends Controller
|
|||||||
app('fireflyconfig')->set($name, $data['value']);
|
app('fireflyconfig')->set($name, $data['value']);
|
||||||
$configData = $this->getConfigData();
|
$configData = $this->getConfigData();
|
||||||
|
|
||||||
return response()->json(['data' => $configData], 200)->header('Content-Type', 'application/vnd.api+json');
|
return response()->json(['data' => $configData])->header('Content-Type', 'application/vnd.api+json');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -104,7 +104,7 @@ class Controller extends BaseController
|
|||||||
$obj = null;
|
$obj = null;
|
||||||
if (null !== $date) {
|
if (null !== $date) {
|
||||||
try {
|
try {
|
||||||
$obj = new Carbon($date);
|
$obj = Carbon::parse($date);
|
||||||
} catch (InvalidDateException $e) {
|
} catch (InvalidDateException $e) {
|
||||||
// don't care
|
// don't care
|
||||||
Log::error(sprintf('Invalid date exception in API controller: %s', $e->getMessage()));
|
Log::error(sprintf('Invalid date exception in API controller: %s', $e->getMessage()));
|
||||||
|
@@ -263,7 +263,9 @@ class CurrencyController extends Controller
|
|||||||
/**
|
/**
|
||||||
* List all budget limits
|
* List all budget limits
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
|
*
|
||||||
|
* @param TransactionCurrency $currency
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
@@ -489,7 +491,9 @@ class CurrencyController extends Controller
|
|||||||
/**
|
/**
|
||||||
* List all recurring transactions.
|
* List all recurring transactions.
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
|
*
|
||||||
|
* @param TransactionCurrency $currency
|
||||||
*
|
*
|
||||||
* @return JsonResponse]
|
* @return JsonResponse]
|
||||||
*/
|
*/
|
||||||
|
@@ -127,6 +127,7 @@ class ImportController extends Controller
|
|||||||
/**
|
/**
|
||||||
* Show all transactions
|
* Show all transactions
|
||||||
*
|
*
|
||||||
|
* @param Request $request
|
||||||
* @param ImportJob $importJob
|
* @param ImportJob $importJob
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
|
@@ -90,7 +90,7 @@ class LinkTypeController extends Controller
|
|||||||
if (false === $linkType->editable) {
|
if (false === $linkType->editable) {
|
||||||
throw new FireflyException(sprintf('You cannot delete this link type (#%d, "%s")', $linkType->id, $linkType->name));
|
throw new FireflyException(sprintf('You cannot delete this link type (#%d, "%s")', $linkType->id, $linkType->name));
|
||||||
}
|
}
|
||||||
$this->repository->destroy($linkType, null);
|
$this->repository->destroy($linkType);
|
||||||
|
|
||||||
return response()->json([], 204);
|
return response()->json([], 204);
|
||||||
}
|
}
|
||||||
@@ -190,6 +190,7 @@ class LinkTypeController extends Controller
|
|||||||
/**
|
/**
|
||||||
* Delete the resource.
|
* Delete the resource.
|
||||||
*
|
*
|
||||||
|
* @param Request $request
|
||||||
* @param LinkType $linkType
|
* @param LinkType $linkType
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
|
@@ -59,7 +59,7 @@ class PreferenceController extends Controller
|
|||||||
// an important fallback is that the frontPageAccount array gets refilled automatically
|
// an important fallback is that the frontPageAccount array gets refilled automatically
|
||||||
// when it turns up empty.
|
// when it turns up empty.
|
||||||
$frontPageAccounts = app('preferences')->getForUser($user, 'frontPageAccounts', [])->data;
|
$frontPageAccounts = app('preferences')->getForUser($user, 'frontPageAccounts', [])->data;
|
||||||
if (\count($frontPageAccounts) === 0) {
|
if (0 === \count($frontPageAccounts)) {
|
||||||
/** @var Collection $accounts */
|
/** @var Collection $accounts */
|
||||||
$accounts = $repository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET]);
|
$accounts = $repository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET]);
|
||||||
$accountIds = $accounts->pluck('id')->toArray();
|
$accountIds = $accounts->pluck('id')->toArray();
|
||||||
|
@@ -247,7 +247,7 @@ class RecurrenceController extends Controller
|
|||||||
return response()->json([], 204);
|
return response()->json([], 204);
|
||||||
}
|
}
|
||||||
if (true === $result) {
|
if (true === $result) {
|
||||||
return response()->json([], 200);
|
return response()->json();
|
||||||
}
|
}
|
||||||
|
|
||||||
return response()->json([], 418); // @codeCoverageIgnore
|
return response()->json([], 418); // @codeCoverageIgnore
|
||||||
|
@@ -1,4 +1,25 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SummaryController.php
|
||||||
|
* Copyright (c) 2019 thegrumpydictator@gmail.com
|
||||||
|
*
|
||||||
|
* This file is part of Firefly III.
|
||||||
|
*
|
||||||
|
* Firefly III is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Firefly III is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace FireflyIII\Api\V1\Controllers;
|
namespace FireflyIII\Api\V1\Controllers;
|
||||||
@@ -84,6 +105,7 @@ class SummaryController extends Controller
|
|||||||
$spentData = $this->getLeftToSpendInfo($start, $end);
|
$spentData = $this->getLeftToSpendInfo($start, $end);
|
||||||
$networthData = $this->getNetWorthInfo($start, $end);
|
$networthData = $this->getNetWorthInfo($start, $end);
|
||||||
$total = array_merge($balanceData, $billData, $spentData, $networthData);
|
$total = array_merge($balanceData, $billData, $spentData, $networthData);
|
||||||
|
|
||||||
// TODO: liabilities with icon line-chart
|
// TODO: liabilities with icon line-chart
|
||||||
|
|
||||||
return response()->json($total);
|
return response()->json($total);
|
||||||
@@ -340,7 +362,10 @@ class SummaryController extends Controller
|
|||||||
*/
|
*/
|
||||||
private function getNetWorthInfo(Carbon $start, Carbon $end): array
|
private function getNetWorthInfo(Carbon $start, Carbon $end): array
|
||||||
{
|
{
|
||||||
$date = Carbon::create()->startOfDay();
|
/** @var User $user */
|
||||||
|
$user = auth()->user();
|
||||||
|
$date = Carbon::now()->startOfDay();
|
||||||
|
|
||||||
|
|
||||||
// start and end in the future? use $end
|
// start and end in the future? use $end
|
||||||
if ($this->notInDateRange($date, $start, $end)) {
|
if ($this->notInDateRange($date, $start, $end)) {
|
||||||
@@ -350,7 +375,7 @@ class SummaryController extends Controller
|
|||||||
|
|
||||||
/** @var NetWorthInterface $netWorthHelper */
|
/** @var NetWorthInterface $netWorthHelper */
|
||||||
$netWorthHelper = app(NetWorthInterface::class);
|
$netWorthHelper = app(NetWorthInterface::class);
|
||||||
$netWorthHelper->setUser(auth()->user());
|
$netWorthHelper->setUser($user);
|
||||||
$allAccounts = $this->accountRepository->getActiveAccountsByType([AccountType::ASSET, AccountType::DEBT, AccountType::LOAN, AccountType::MORTGAGE]);
|
$allAccounts = $this->accountRepository->getActiveAccountsByType([AccountType::ASSET, AccountType::DEBT, AccountType::LOAN, AccountType::MORTGAGE]);
|
||||||
|
|
||||||
// filter list on preference of being included.
|
// filter list on preference of being included.
|
||||||
@@ -368,7 +393,7 @@ class SummaryController extends Controller
|
|||||||
/** @var TransactionCurrency $currency */
|
/** @var TransactionCurrency $currency */
|
||||||
$currency = $data['currency'];
|
$currency = $data['currency'];
|
||||||
$amount = round($data['balance'], $currency->decimal_places);
|
$amount = round($data['balance'], $currency->decimal_places);
|
||||||
if ($amount === 0.0) {
|
if (0.0 === $amount) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// return stuff
|
// return stuff
|
||||||
@@ -389,4 +414,4 @@ class SummaryController extends Controller
|
|||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -179,7 +179,7 @@ class TransactionController extends Controller
|
|||||||
$baseUrl = $request->getSchemeAndHttpHost() . '/api/v1';
|
$baseUrl = $request->getSchemeAndHttpHost() . '/api/v1';
|
||||||
$manager->setSerializer(new JsonApiSerializer($baseUrl));
|
$manager->setSerializer(new JsonApiSerializer($baseUrl));
|
||||||
|
|
||||||
$events = $this->repository->getPiggyBankEventsByTr($transaction);
|
$events = $this->repository->getPiggyBankEventsbyTr($transaction);
|
||||||
|
|
||||||
/** @var PiggyBankEventTransformer $transformer */
|
/** @var PiggyBankEventTransformer $transformer */
|
||||||
$transformer = app(PiggyBankEventTransformer::class);
|
$transformer = app(PiggyBankEventTransformer::class);
|
||||||
|
@@ -29,7 +29,6 @@ use FireflyIII\Models\TransactionJournalLink;
|
|||||||
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||||
use FireflyIII\Repositories\LinkType\LinkTypeRepositoryInterface;
|
use FireflyIII\Repositories\LinkType\LinkTypeRepositoryInterface;
|
||||||
use FireflyIII\Support\Http\Api\TransactionFilter;
|
use FireflyIII\Support\Http\Api\TransactionFilter;
|
||||||
use FireflyIII\Transformers\JournalLinkTransformer;
|
|
||||||
use FireflyIII\Transformers\TransactionLinkTransformer;
|
use FireflyIII\Transformers\TransactionLinkTransformer;
|
||||||
use FireflyIII\User;
|
use FireflyIII\User;
|
||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
|
@@ -52,7 +52,7 @@ class BillRequest extends Request
|
|||||||
public function getAll(): array
|
public function getAll(): array
|
||||||
{
|
{
|
||||||
$active = true;
|
$active = true;
|
||||||
if(null !== $this->get('active')) {
|
if (null !== $this->get('active')) {
|
||||||
$active = $this->boolean('active');
|
$active = $this->boolean('active');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -24,7 +24,6 @@ declare(strict_types=1);
|
|||||||
namespace FireflyIII\Api\V1\Requests;
|
namespace FireflyIII\Api\V1\Requests;
|
||||||
|
|
||||||
use FireflyIII\Models\Category;
|
use FireflyIII\Models\Category;
|
||||||
use FireflyIII\Rules\IsBoolean;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class CategoryRequest
|
* Class CategoryRequest
|
||||||
@@ -50,7 +49,7 @@ class CategoryRequest extends Request
|
|||||||
public function getAll(): array
|
public function getAll(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'name' => $this->string('name')
|
'name' => $this->string('name'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,7 +61,7 @@ class CategoryRequest extends Request
|
|||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
$rules = [
|
$rules = [
|
||||||
'name' => 'required|between:1,100|uniqueObjectForUser:categories,name'
|
'name' => 'required|between:1,100|uniqueObjectForUser:categories,name',
|
||||||
];
|
];
|
||||||
switch ($this->method()) {
|
switch ($this->method()) {
|
||||||
default:
|
default:
|
||||||
|
@@ -25,6 +25,7 @@ namespace FireflyIII\Api\V1\Requests;
|
|||||||
|
|
||||||
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||||
use FireflyIII\Repositories\LinkType\LinkTypeRepositoryInterface;
|
use FireflyIII\Repositories\LinkType\LinkTypeRepositoryInterface;
|
||||||
|
use FireflyIII\User;
|
||||||
use Illuminate\Validation\Validator;
|
use Illuminate\Validation\Validator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -98,13 +99,15 @@ class TransactionLinkRequest extends Request
|
|||||||
*/
|
*/
|
||||||
private function validateExistingLink(Validator $validator): void
|
private function validateExistingLink(Validator $validator): void
|
||||||
{
|
{
|
||||||
|
/** @var User $user */
|
||||||
|
$user = auth()->user();
|
||||||
/** @var LinkTypeRepositoryInterface $repository */
|
/** @var LinkTypeRepositoryInterface $repository */
|
||||||
$repository = app(LinkTypeRepositoryInterface::class);
|
$repository = app(LinkTypeRepositoryInterface::class);
|
||||||
$repository->setUser(auth()->user());
|
$repository->setUser($user);
|
||||||
|
|
||||||
/** @var JournalRepositoryInterface $journalRepos */
|
/** @var JournalRepositoryInterface $journalRepos */
|
||||||
$journalRepos = app(JournalRepositoryInterface::class);
|
$journalRepos = app(JournalRepositoryInterface::class);
|
||||||
$journalRepos->setUser(auth()->user());
|
$journalRepos->setUser($user);
|
||||||
|
|
||||||
$data = $validator->getData();
|
$data = $validator->getData();
|
||||||
$inwardId = (int)($data['inward_id'] ?? 0);
|
$inwardId = (int)($data['inward_id'] ?? 0);
|
||||||
|
@@ -26,6 +26,7 @@ namespace FireflyIII\Api\V1\Requests;
|
|||||||
|
|
||||||
use FireflyIII\Rules\BelongsUser;
|
use FireflyIII\Rules\BelongsUser;
|
||||||
use FireflyIII\Rules\IsBoolean;
|
use FireflyIII\Rules\IsBoolean;
|
||||||
|
use FireflyIII\Rules\IsDateOrTime;
|
||||||
use FireflyIII\Validation\TransactionValidation;
|
use FireflyIII\Validation\TransactionValidation;
|
||||||
use Illuminate\Validation\Validator;
|
use Illuminate\Validation\Validator;
|
||||||
|
|
||||||
@@ -59,7 +60,7 @@ class TransactionRequest extends Request
|
|||||||
{
|
{
|
||||||
$data = [
|
$data = [
|
||||||
'type' => $this->string('type'),
|
'type' => $this->string('type'),
|
||||||
'date' => $this->date('date'),
|
'date' => $this->dateTime('date'),
|
||||||
'description' => $this->string('description'),
|
'description' => $this->string('description'),
|
||||||
'piggy_bank_id' => $this->integer('piggy_bank_id'),
|
'piggy_bank_id' => $this->integer('piggy_bank_id'),
|
||||||
'piggy_bank_name' => $this->string('piggy_bank_name'),
|
'piggy_bank_name' => $this->string('piggy_bank_name'),
|
||||||
@@ -103,7 +104,7 @@ class TransactionRequest extends Request
|
|||||||
// basic fields for journal:
|
// basic fields for journal:
|
||||||
'type' => 'required|in:withdrawal,deposit,transfer,opening-balance,reconciliation',
|
'type' => 'required|in:withdrawal,deposit,transfer,opening-balance,reconciliation',
|
||||||
'description' => 'between:1,255',
|
'description' => 'between:1,255',
|
||||||
'date' => 'required|date',
|
'date' => ['required', new IsDateOrTime],
|
||||||
'piggy_bank_id' => ['numeric', 'nullable', 'mustExist:piggy_banks,id', new BelongsUser],
|
'piggy_bank_id' => ['numeric', 'nullable', 'mustExist:piggy_banks,id', new BelongsUser],
|
||||||
'piggy_bank_name' => ['between:1,255', 'nullable', new BelongsUser],
|
'piggy_bank_name' => ['between:1,255', 'nullable', new BelongsUser],
|
||||||
'bill_id' => ['numeric', 'nullable', 'mustExist:bills,id', new BelongsUser],
|
'bill_id' => ['numeric', 'nullable', 'mustExist:bills,id', new BelongsUser],
|
||||||
|
@@ -41,6 +41,7 @@ use Illuminate\Support\Collection;
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Class ApplyRules
|
* Class ApplyRules
|
||||||
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
class ApplyRules extends Command
|
class ApplyRules extends Command
|
||||||
@@ -184,6 +185,8 @@ class ApplyRules extends Command
|
|||||||
private function applyRuleSelection(Collection $rules, Collection $transactions, bool $breakProcessing): void
|
private function applyRuleSelection(Collection $rules, Collection $transactions, bool $breakProcessing): void
|
||||||
{
|
{
|
||||||
$bar = $this->output->createProgressBar($rules->count() * $transactions->count());
|
$bar = $this->output->createProgressBar($rules->count() * $transactions->count());
|
||||||
|
|
||||||
|
/** @var Rule $rule */
|
||||||
foreach ($rules as $rule) {
|
foreach ($rules as $rule) {
|
||||||
/** @var Processor $processor */
|
/** @var Processor $processor */
|
||||||
$processor = app(Processor::class);
|
$processor = app(Processor::class);
|
||||||
@@ -191,7 +194,7 @@ class ApplyRules extends Command
|
|||||||
|
|
||||||
/** @var Transaction $transaction */
|
/** @var Transaction $transaction */
|
||||||
foreach ($transactions as $transaction) {
|
foreach ($transactions as $transaction) {
|
||||||
/** @var Rule $rule */
|
/** @noinspection DisconnectedForeachInstructionInspection */
|
||||||
$bar->advance();
|
$bar->advance();
|
||||||
$result = $processor->handleTransaction($transaction);
|
$result = $processor->handleTransaction($transaction);
|
||||||
if (true === $result) {
|
if (true === $result) {
|
||||||
@@ -210,6 +213,7 @@ class ApplyRules extends Command
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
* @throws \FireflyIII\Exceptions\FireflyException
|
||||||
*/
|
*/
|
||||||
private function grabAllRules(): void
|
private function grabAllRules(): void
|
||||||
{
|
{
|
||||||
@@ -226,11 +230,12 @@ class ApplyRules extends Command
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
* @throws \FireflyIII\Exceptions\FireflyException
|
||||||
*/
|
*/
|
||||||
private function parseDates(): void
|
private function parseDates(): void
|
||||||
{
|
{
|
||||||
// parse start date.
|
// parse start date.
|
||||||
$startDate = Carbon::create()->startOfMonth();
|
$startDate = Carbon::now()->startOfMonth();
|
||||||
$startString = $this->option('start_date');
|
$startString = $this->option('start_date');
|
||||||
if (null === $startString) {
|
if (null === $startString) {
|
||||||
/** @var JournalRepositoryInterface $repository */
|
/** @var JournalRepositoryInterface $repository */
|
||||||
|
@@ -134,8 +134,8 @@ class CreateExport extends Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
$processor->createZipFile();
|
$processor->createZipFile();
|
||||||
$disk = Storage::disk('export');
|
$disk = Storage::disk('export');
|
||||||
$fileName = sprintf('export-%s.zip', date('Y-m-d_H-i-s'));
|
$fileName = sprintf('export-%s.zip', date('Y-m-d_H-i-s'));
|
||||||
$localPath = storage_path('export') . '/' . $job->key . '.zip';
|
$localPath = storage_path('export') . '/' . $job->key . '.zip';
|
||||||
|
|
||||||
// "move" from local to export disk
|
// "move" from local to export disk
|
||||||
|
@@ -97,7 +97,7 @@ class CreateImport extends Command
|
|||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (\strlen($configuration) > 0) {
|
if ('' !== $configuration) {
|
||||||
$configurationData = json_decode(file_get_contents($configuration), true);
|
$configurationData = json_decode(file_get_contents($configuration), true);
|
||||||
if (null === $configurationData) {
|
if (null === $configurationData) {
|
||||||
$this->errorLine(sprintf('Firefly III cannot read the contents of configuration file "%s" (working directory: "%s").', $configuration, $cwd));
|
$this->errorLine(sprintf('Firefly III cannot read the contents of configuration file "%s" (working directory: "%s").', $configuration, $cwd));
|
||||||
@@ -136,7 +136,7 @@ class CreateImport extends Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
// store file as attachment.
|
// store file as attachment.
|
||||||
if (\strlen($file) > 0) {
|
if ('' !== $file) {
|
||||||
$messages = $jobRepository->storeCLIUpload($importJob, 'import_file', $file);
|
$messages = $jobRepository->storeCLIUpload($importJob, 'import_file', $file);
|
||||||
if ($messages->count() > 0) {
|
if ($messages->count() > 0) {
|
||||||
$this->errorLine($messages->first());
|
$this->errorLine($messages->first());
|
||||||
|
@@ -48,16 +48,6 @@ class Cron extends Command
|
|||||||
*/
|
*/
|
||||||
protected $signature = 'firefly:cron';
|
protected $signature = 'firefly:cron';
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new command instance.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
parent::__construct();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute the console command.
|
* Execute the console command.
|
||||||
*
|
*
|
||||||
|
@@ -1,9 +1,33 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DecryptDatabase.php
|
||||||
|
* Copyright (c) 2019 thegrumpydictator@gmail.com
|
||||||
|
*
|
||||||
|
* This file is part of Firefly III.
|
||||||
|
*
|
||||||
|
* Firefly III is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Firefly III is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace FireflyIII\Console\Commands;
|
namespace FireflyIII\Console\Commands;
|
||||||
|
|
||||||
use Crypt;
|
use Crypt;
|
||||||
use DB;
|
use DB;
|
||||||
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
|
use FireflyIII\Models\Preference;
|
||||||
use FireflyIII\Support\Facades\FireflyConfig;
|
use FireflyIII\Support\Facades\FireflyConfig;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
use Illuminate\Contracts\Encryption\DecryptException;
|
use Illuminate\Contracts\Encryption\DecryptException;
|
||||||
@@ -64,6 +88,22 @@ class DecryptDatabase extends Command
|
|||||||
}
|
}
|
||||||
$id = $row->id;
|
$id = $row->id;
|
||||||
$value = $this->tryDecrypt($original);
|
$value = $this->tryDecrypt($original);
|
||||||
|
|
||||||
|
// A separate routine for preferences:
|
||||||
|
if ('preferences' === $table) {
|
||||||
|
// try to json_decrypt the value.
|
||||||
|
$value = json_decode($value, true) ?? $value;
|
||||||
|
Log::debug(sprintf('Decrypted field "%s" "%s" to "%s" in table "%s" (row #%d)', $field, $original, print_r($value, true), $table, $id));
|
||||||
|
|
||||||
|
/** @var Preference $object */
|
||||||
|
$object = Preference::find((int)$id);
|
||||||
|
if (null !== $object) {
|
||||||
|
$object->data = $value;
|
||||||
|
$object->save();
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if ($value !== $original) {
|
if ($value !== $original) {
|
||||||
Log::debug(sprintf('Decrypted field "%s" "%s" to "%s" in table "%s" (row #%d)', $field, $original, $value, $table, $id));
|
Log::debug(sprintf('Decrypted field "%s" "%s" to "%s" in table "%s" (row #%d)', $field, $original, $value, $table, $id));
|
||||||
DB::table($table)->where('id', $id)->update([$field => $value]);
|
DB::table($table)->where('id', $id)->update([$field => $value]);
|
||||||
@@ -91,7 +131,7 @@ class DecryptDatabase extends Command
|
|||||||
$configName = sprintf('is_decrypted_%s', $table);
|
$configName = sprintf('is_decrypted_%s', $table);
|
||||||
$configVar = FireflyConfig::get($configName, false);
|
$configVar = FireflyConfig::get($configName, false);
|
||||||
if (null !== $configVar) {
|
if (null !== $configVar) {
|
||||||
return $configVar->data;
|
return (bool)$configVar->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@@ -108,7 +148,10 @@ class DecryptDatabase extends Command
|
|||||||
try {
|
try {
|
||||||
$value = Crypt::decrypt($value);
|
$value = Crypt::decrypt($value);
|
||||||
} catch (DecryptException $e) {
|
} catch (DecryptException $e) {
|
||||||
//Log::debug(sprintf('Could not decrypt. %s', $e->getMessage()));
|
if ('The MAC is invalid.' === $e->getMessage()) {
|
||||||
|
throw new FireflyException($e->getMessage());
|
||||||
|
}
|
||||||
|
Log::debug(sprintf('Could not decrypt. %s', $e->getMessage()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $value;
|
return $value;
|
||||||
|
@@ -28,6 +28,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Console\Commands;
|
namespace FireflyIII\Console\Commands;
|
||||||
|
|
||||||
|
use Crypt;
|
||||||
use DB;
|
use DB;
|
||||||
use Exception;
|
use Exception;
|
||||||
use FireflyIII\Models\Account;
|
use FireflyIII\Models\Account;
|
||||||
@@ -35,6 +36,7 @@ use FireflyIII\Models\AccountMeta;
|
|||||||
use FireflyIII\Models\AccountType;
|
use FireflyIII\Models\AccountType;
|
||||||
use FireflyIII\Models\Attachment;
|
use FireflyIII\Models\Attachment;
|
||||||
use FireflyIII\Models\Bill;
|
use FireflyIII\Models\Bill;
|
||||||
|
use FireflyIII\Models\Budget;
|
||||||
use FireflyIII\Models\BudgetLimit;
|
use FireflyIII\Models\BudgetLimit;
|
||||||
use FireflyIII\Models\Note;
|
use FireflyIII\Models\Note;
|
||||||
use FireflyIII\Models\Preference;
|
use FireflyIII\Models\Preference;
|
||||||
@@ -52,6 +54,7 @@ use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
|
|||||||
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||||
use FireflyIII\User;
|
use FireflyIII\User;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Contracts\Encryption\DecryptException;
|
||||||
use Illuminate\Database\QueryException;
|
use Illuminate\Database\QueryException;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Log;
|
use Log;
|
||||||
@@ -105,6 +108,22 @@ class UpgradeDatabase extends Command
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $value
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
private function tryDecrypt(string $value): string
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$value = Crypt::decrypt($value);
|
||||||
|
} catch (DecryptException $e) {
|
||||||
|
Log::debug(sprintf('Could not decrypt. %s', $e->getMessage()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Since it is one routine these warnings make sense and should be supressed.
|
* Since it is one routine these warnings make sense and should be supressed.
|
||||||
*
|
*
|
||||||
@@ -126,11 +145,17 @@ class UpgradeDatabase extends Command
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
$currencyCode = $this->tryDecrypt($currencyPreference->data);
|
||||||
|
|
||||||
$currency = TransactionCurrency::where('code', $currencyPreference->data)->first();
|
// try json decrypt just in case.
|
||||||
|
if (\strlen($currencyCode) > 3) {
|
||||||
|
$currencyCode = json_decode($currencyCode) ?? 'EUR';
|
||||||
|
}
|
||||||
|
|
||||||
|
$currency = TransactionCurrency::where('code', $currencyCode)->first();
|
||||||
if (null === $currency) {
|
if (null === $currency) {
|
||||||
$this->line('Fall back to default currency in migrateBillsToRules().');
|
$this->line('Fall back to default currency in migrateBillsToRules().');
|
||||||
$currency = app('amount')->getDefaultCurrency();
|
$currency = app('amount')->getDefaultCurrencyByUser($user);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null === $ruleGroup) {
|
if (null === $ruleGroup) {
|
||||||
@@ -267,11 +292,12 @@ class UpgradeDatabase extends Command
|
|||||||
if (!Schema::hasTable('transaction_journals')) {
|
if (!Schema::hasTable('transaction_journals')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$subQuery = TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
|
$subQuery = TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
|
||||||
->whereNull('transaction_journals.deleted_at')
|
->whereNull('transaction_journals.deleted_at')
|
||||||
->whereNull('transactions.deleted_at')
|
->whereNull('transactions.deleted_at')
|
||||||
->groupBy(['transaction_journals.id'])
|
->groupBy(['transaction_journals.id'])
|
||||||
->select(['transaction_journals.id', DB::raw('COUNT(transactions.id) AS t_count')]);
|
->select(['transaction_journals.id', DB::raw('COUNT(transactions.id) AS t_count')]);
|
||||||
|
/** @noinspection PhpStrictTypeCheckingInspection */
|
||||||
$result = DB::table(DB::raw('(' . $subQuery->toSql() . ') AS derived'))
|
$result = DB::table(DB::raw('(' . $subQuery->toSql() . ') AS derived'))
|
||||||
->mergeBindings($subQuery->getQuery())
|
->mergeBindings($subQuery->getQuery())
|
||||||
->where('t_count', '>', 2)
|
->where('t_count', '>', 2)
|
||||||
@@ -292,23 +318,38 @@ class UpgradeDatabase extends Command
|
|||||||
*/
|
*/
|
||||||
public function updateAccountCurrencies(): void
|
public function updateAccountCurrencies(): void
|
||||||
{
|
{
|
||||||
|
Log::debug('Now in updateAccountCurrencies()');
|
||||||
|
|
||||||
|
$defaultConfig = (string)config('firefly.default_currency', 'EUR');
|
||||||
|
Log::debug(sprintf('System default currency is "%s"', $defaultConfig));
|
||||||
|
|
||||||
$accounts = Account::leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id')
|
$accounts = Account::leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id')
|
||||||
->whereIn('account_types.type', [AccountType::DEFAULT, AccountType::ASSET])->get(['accounts.*']);
|
->whereIn('account_types.type', [AccountType::DEFAULT, AccountType::ASSET])->get(['accounts.*']);
|
||||||
/** @var AccountRepositoryInterface $repository */
|
/** @var AccountRepositoryInterface $repository */
|
||||||
$repository = app(AccountRepositoryInterface::class);
|
$repository = app(AccountRepositoryInterface::class);
|
||||||
$accounts->each(
|
$accounts->each(
|
||||||
function (Account $account) use ($repository) {
|
function (Account $account) use ($repository, $defaultConfig) {
|
||||||
$repository->setUser($account->user);
|
$repository->setUser($account->user);
|
||||||
// get users preference, fall back to system pref.
|
// get users preference, fall back to system pref.
|
||||||
$defaultCurrencyCode = app('preferences')->getForUser($account->user, 'currencyPreference', config('firefly.default_currency', 'EUR'))->data;
|
|
||||||
$defaultCurrency = TransactionCurrency::where('code', $defaultCurrencyCode)->first();
|
// expand and debug routine.
|
||||||
$accountCurrency = (int)$repository->getMetaValue($account, 'currency_id');
|
$defaultCurrencyCode = app('preferences')->getForUser($account->user, 'currencyPreference', $defaultConfig)->data;
|
||||||
$openingBalance = $account->getOpeningBalance();
|
Log::debug(sprintf('Default currency code is "%s"', var_export($defaultCurrencyCode, true)));
|
||||||
$obCurrency = (int)$openingBalance->transaction_currency_id;
|
if (!is_string($defaultCurrencyCode)) {
|
||||||
|
$defaultCurrencyCode = $defaultConfig;
|
||||||
|
Log::debug(sprintf('Default currency code is not a string, now set to "%s"', $defaultCurrencyCode));
|
||||||
|
}
|
||||||
|
$defaultCurrency = TransactionCurrency::where('code', $defaultCurrencyCode)->first();
|
||||||
|
$accountCurrency = (int)$repository->getMetaValue($account, 'currency_id');
|
||||||
|
$openingBalance = $account->getOpeningBalance();
|
||||||
|
$obCurrency = (int)$openingBalance->transaction_currency_id;
|
||||||
|
|
||||||
if (null === $defaultCurrency) {
|
if (null === $defaultCurrency) {
|
||||||
throw new UnexpectedValueException('The default currency is NULL, and this is more or less impossible.');
|
throw new UnexpectedValueException(sprintf('User has a preference for "%s", but this currency does not exist.', $defaultCurrencyCode));
|
||||||
}
|
}
|
||||||
|
Log::debug(
|
||||||
|
sprintf('Found default currency #%d (%s) while searching for "%s"', $defaultCurrency->id, $defaultCurrency->code, $defaultCurrencyCode)
|
||||||
|
);
|
||||||
|
|
||||||
// both 0? set to default currency:
|
// both 0? set to default currency:
|
||||||
if (0 === $accountCurrency && 0 === $obCurrency) {
|
if (0 === $accountCurrency && 0 === $obCurrency) {
|
||||||
@@ -448,11 +489,12 @@ class UpgradeDatabase extends Command
|
|||||||
/** @var BudgetLimit $budgetLimit */
|
/** @var BudgetLimit $budgetLimit */
|
||||||
foreach ($budgetLimits as $budgetLimit) {
|
foreach ($budgetLimits as $budgetLimit) {
|
||||||
if (null === $budgetLimit->transaction_currency_id) {
|
if (null === $budgetLimit->transaction_currency_id) {
|
||||||
|
/** @var Budget $budget */
|
||||||
$budget = $budgetLimit->budget;
|
$budget = $budgetLimit->budget;
|
||||||
if (null !== $budget) {
|
if (null !== $budget) {
|
||||||
$user = $budget->user;
|
$user = $budget->user;
|
||||||
if (null !== $user) {
|
if (null !== $user) {
|
||||||
$currency = \Amount::getDefaultCurrencyByUser($user);
|
$currency = app('amount')->getDefaultCurrencyByUser($user);
|
||||||
$budgetLimit->transaction_currency_id = $currency->id;
|
$budgetLimit->transaction_currency_id = $currency->id;
|
||||||
$budgetLimit->save();
|
$budgetLimit->save();
|
||||||
$this->line(
|
$this->line(
|
||||||
@@ -464,6 +506,9 @@ class UpgradeDatabase extends Command
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
private function createNewTypes(): void
|
private function createNewTypes(): void
|
||||||
{
|
{
|
||||||
// create transaction type "Reconciliation".
|
// create transaction type "Reconciliation".
|
||||||
@@ -490,7 +535,7 @@ class UpgradeDatabase extends Command
|
|||||||
|
|
||||||
// move description:
|
// move description:
|
||||||
$description = (string)$att->description;
|
$description = (string)$att->description;
|
||||||
if (\strlen($description) > 0) {
|
if ('' !== $description) {
|
||||||
// find or create note:
|
// find or create note:
|
||||||
$note = $att->notes()->first();
|
$note = $att->notes()->first();
|
||||||
if (null === $note) {
|
if (null === $note) {
|
||||||
@@ -541,19 +586,19 @@ class UpgradeDatabase extends Command
|
|||||||
*/
|
*/
|
||||||
private function removeCCLiabilities(): void
|
private function removeCCLiabilities(): void
|
||||||
{
|
{
|
||||||
$ccType = AccountType::where('type', AccountType::CREDITCARD)->first();
|
$ccType = AccountType::where('type', AccountType::CREDITCARD)->first();
|
||||||
$debtType =AccountType::where('type', AccountType::DEBT)->first();
|
$debtType = AccountType::where('type', AccountType::DEBT)->first();
|
||||||
if(null === $ccType || null === $debtType) {
|
if (null === $ccType || null === $debtType) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/** @var Collection $accounts */
|
/** @var Collection $accounts */
|
||||||
$accounts = Account::where('account_type_id', $ccType->id)->get();
|
$accounts = Account::where('account_type_id', $ccType->id)->get();
|
||||||
foreach($accounts as $account) {
|
foreach ($accounts as $account) {
|
||||||
$account->account_type_id = $debtType->id;
|
$account->account_type_id = $debtType->id;
|
||||||
$account->save();
|
$account->save();
|
||||||
$this->line(sprintf('Converted credit card liability account "%s" (#%d) to generic debt liability.', $account->name, $account->id));
|
$this->line(sprintf('Converted credit card liability account "%s" (#%d) to generic debt liability.', $account->name, $account->id));
|
||||||
}
|
}
|
||||||
if($accounts->count() > 0) {
|
if ($accounts->count() > 0) {
|
||||||
$this->info('Credit card liability types are no longer supported and have been converted to generic debts. See: http://bit.ly/FF3-credit-cards');
|
$this->info('Credit card liability types are no longer supported and have been converted to generic debts. See: http://bit.ly/FF3-credit-cards');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -25,8 +25,8 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Console\Commands;
|
namespace FireflyIII\Console\Commands;
|
||||||
|
|
||||||
use Crypt;
|
|
||||||
use DB;
|
use DB;
|
||||||
|
use Exception;
|
||||||
use FireflyIII\Models\Account;
|
use FireflyIII\Models\Account;
|
||||||
use FireflyIII\Models\AccountMeta;
|
use FireflyIII\Models\AccountMeta;
|
||||||
use FireflyIII\Models\AccountType;
|
use FireflyIII\Models\AccountType;
|
||||||
@@ -42,7 +42,6 @@ use FireflyIII\Models\TransactionType;
|
|||||||
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
||||||
use FireflyIII\User;
|
use FireflyIII\User;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
use Illuminate\Contracts\Encryption\DecryptException;
|
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Log;
|
use Log;
|
||||||
@@ -100,6 +99,7 @@ class VerifyDatabase extends Command
|
|||||||
$this->fixBadMeta();
|
$this->fixBadMeta();
|
||||||
$this->removeBills();
|
$this->removeBills();
|
||||||
$this->enableCurrencies();
|
$this->enableCurrencies();
|
||||||
|
$this->reportZeroAmount();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -691,4 +691,24 @@ class VerifyDatabase extends Command
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Collect all journals with empty amount.
|
||||||
|
*/
|
||||||
|
private function reportZeroAmount(): void
|
||||||
|
{
|
||||||
|
$set = Transaction::where('amount', 0)->get(['transaction_journal_id'])->pluck('transaction_journal_id')->toArray();
|
||||||
|
$set = array_unique($set);
|
||||||
|
/** @var Collection $journals */
|
||||||
|
$journals = TransactionJournal::whereIn('id', $set)->get();
|
||||||
|
/** @var TransactionJournal $journal */
|
||||||
|
foreach ($journals as $journal) {
|
||||||
|
$message = sprintf(
|
||||||
|
'Transaction "%s" (#%d), owned by user %s, has amount zero (0.00). It should be deleted.', $journal->description,
|
||||||
|
$journal->id, $journal->user->email
|
||||||
|
);
|
||||||
|
$this->error($message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -30,6 +30,7 @@ use Log;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* File to make sure commands work.
|
* File to make sure commands work.
|
||||||
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
class Kernel extends ConsoleKernel
|
class Kernel extends ConsoleKernel
|
||||||
@@ -54,7 +55,9 @@ class Kernel extends ConsoleKernel
|
|||||||
{
|
{
|
||||||
$schedule->call(
|
$schedule->call(
|
||||||
function () {
|
function () {
|
||||||
Log::error('Firefly III no longer users the Laravel scheduler to do cron jobs! Please read the instructions at https://firefly-iii.readthedocs.io/en/latest/');
|
Log::error(
|
||||||
|
'Firefly III no longer users the Laravel scheduler to do cron jobs! Please read the instructions at https://firefly-iii.readthedocs.io/en/latest/'
|
||||||
|
);
|
||||||
echo "\n";
|
echo "\n";
|
||||||
echo '------------';
|
echo '------------';
|
||||||
echo "\n";
|
echo "\n";
|
||||||
|
@@ -30,6 +30,7 @@ use Log;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Class AdminRequestedTestMessage.
|
* Class AdminRequestedTestMessage.
|
||||||
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
class AdminRequestedTestMessage extends Event
|
class AdminRequestedTestMessage extends Event
|
||||||
|
@@ -26,6 +26,7 @@ namespace FireflyIII\Events;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Event.
|
* Class Event.
|
||||||
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
abstract class Event
|
abstract class Event
|
||||||
|
@@ -29,6 +29,7 @@ use Illuminate\Queue\SerializesModels;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Class RegisteredUser.
|
* Class RegisteredUser.
|
||||||
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
class RegisteredUser extends Event
|
class RegisteredUser extends Event
|
||||||
|
@@ -29,6 +29,7 @@ use Illuminate\Queue\SerializesModels;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Class RequestedNewPassword.
|
* Class RequestedNewPassword.
|
||||||
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
class RequestedNewPassword extends Event
|
class RequestedNewPassword extends Event
|
||||||
|
@@ -46,6 +46,6 @@ class StoredTransactionJournal extends Event
|
|||||||
*/
|
*/
|
||||||
public function __construct(TransactionJournal $journal)
|
public function __construct(TransactionJournal $journal)
|
||||||
{
|
{
|
||||||
$this->journal = $journal;
|
$this->journal = $journal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -28,6 +28,7 @@ use Crypt;
|
|||||||
use FireflyIII\Models\Attachment;
|
use FireflyIII\Models\Attachment;
|
||||||
use FireflyIII\Repositories\Attachment\AttachmentRepositoryInterface;
|
use FireflyIII\Repositories\Attachment\AttachmentRepositoryInterface;
|
||||||
use Illuminate\Contracts\Encryption\DecryptException;
|
use Illuminate\Contracts\Encryption\DecryptException;
|
||||||
|
use Illuminate\Contracts\Filesystem\FileNotFoundException;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Log;
|
use Log;
|
||||||
use Storage;
|
use Storage;
|
||||||
@@ -102,6 +103,7 @@ class AttachmentCollector extends BasicCollector implements CollectorInterface
|
|||||||
* @param Attachment $attachment
|
* @param Attachment $attachment
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
|
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
|
||||||
*/
|
*/
|
||||||
private function exportAttachment(Attachment $attachment): bool
|
private function exportAttachment(Attachment $attachment): bool
|
||||||
{
|
{
|
||||||
@@ -110,7 +112,7 @@ class AttachmentCollector extends BasicCollector implements CollectorInterface
|
|||||||
if ($this->uploadDisk->exists($file)) {
|
if ($this->uploadDisk->exists($file)) {
|
||||||
try {
|
try {
|
||||||
$decrypted = Crypt::decrypt($this->uploadDisk->get($file));
|
$decrypted = Crypt::decrypt($this->uploadDisk->get($file));
|
||||||
} catch (DecryptException $e) {
|
} catch (DecryptException|FileNotFoundException $e) {
|
||||||
Log::error('Catchable error: could not decrypt attachment #' . $attachment->id . ' because: ' . $e->getMessage());
|
Log::error('Catchable error: could not decrypt attachment #' . $attachment->id . ' because: ' . $e->getMessage());
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@@ -110,7 +110,7 @@ class UploadCollector extends BasicCollector implements CollectorInterface
|
|||||||
Log::error(sprintf('Could not decrypt old import file "%s". Skipped because: %s', $key, $e->getMessage()));
|
Log::error(sprintf('Could not decrypt old import file "%s". Skipped because: %s', $key, $e->getMessage()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (\strlen($content) > 0) {
|
if ('' !== $content) {
|
||||||
// add to export disk.
|
// add to export disk.
|
||||||
$date = $job->created_at->format('Y-m-d');
|
$date = $job->created_at->format('Y-m-d');
|
||||||
$file = sprintf('%s-Old %s import dated %s.%s', $this->job->key, strtoupper($job->file_type), $date, $job->file_type);
|
$file = sprintf('%s-Old %s import dated %s.%s', $this->job->key, strtoupper($job->file_type), $date, $job->file_type);
|
||||||
|
@@ -49,48 +49,24 @@ use FireflyIII\Models\Transaction;
|
|||||||
*/
|
*/
|
||||||
final class Entry
|
final class Entry
|
||||||
{
|
{
|
||||||
/** @var int ID of the journal */
|
|
||||||
public $journal_id;
|
|
||||||
/** @var int ID of the transaction */
|
|
||||||
public $transaction_id = 0;
|
|
||||||
/** @var string The date. */
|
|
||||||
public $date;
|
|
||||||
/** @var string The description */
|
|
||||||
public $description;
|
|
||||||
/** @var string The currency code. */
|
|
||||||
public $currency_code;
|
|
||||||
/** @var string The amount. */
|
/** @var string The amount. */
|
||||||
public $amount;
|
public $amount;
|
||||||
/** @var string The foreign currency code */
|
/** @var string Asset account BIC */
|
||||||
public $foreign_currency_code = '';
|
public $asset_account_bic;
|
||||||
/** @var string Foreign amount */
|
/** @var string Asset account IBAN */
|
||||||
public $foreign_amount = '0';
|
public $asset_account_iban;
|
||||||
/** @var string Transaction type */
|
|
||||||
public $transaction_type;
|
|
||||||
/** @var string Asset account ID */
|
/** @var string Asset account ID */
|
||||||
public $asset_account_id;
|
public $asset_account_id;
|
||||||
/** @var string Asset account name */
|
/** @var string Asset account name */
|
||||||
public $asset_account_name;
|
public $asset_account_name;
|
||||||
/** @var string Asset account IBAN */
|
|
||||||
public $asset_account_iban;
|
|
||||||
/** @var string Asset account BIC */
|
|
||||||
public $asset_account_bic;
|
|
||||||
/** @var string Asset account number */
|
/** @var string Asset account number */
|
||||||
public $asset_account_number;
|
public $asset_account_number;
|
||||||
/** @var string Asset account currency code */
|
/** @var string Asset account currency code */
|
||||||
public $asset_currency_code;
|
public $asset_currency_code;
|
||||||
/** @var string Opposing account ID */
|
/** @var string Bill ID */
|
||||||
public $opposing_account_id;
|
public $bill_id;
|
||||||
/** @var string Opposing account name */
|
/** @var string Bill name */
|
||||||
public $opposing_account_name;
|
public $bill_name;
|
||||||
/** @var string Opposing account IBAN */
|
|
||||||
public $opposing_account_iban;
|
|
||||||
/** @var string Opposing account BIC */
|
|
||||||
public $opposing_account_bic;
|
|
||||||
/** @var string Opposing account number */
|
|
||||||
public $opposing_account_number;
|
|
||||||
/** @var string Opposing account code */
|
|
||||||
public $opposing_currency_code;
|
|
||||||
/** @var string Budget ID */
|
/** @var string Budget ID */
|
||||||
public $budget_id;
|
public $budget_id;
|
||||||
/** @var string Budget name */
|
/** @var string Budget name */
|
||||||
@@ -99,14 +75,38 @@ final class Entry
|
|||||||
public $category_id;
|
public $category_id;
|
||||||
/** @var string Category name */
|
/** @var string Category name */
|
||||||
public $category_name;
|
public $category_name;
|
||||||
/** @var string Bill ID */
|
/** @var string The currency code. */
|
||||||
public $bill_id;
|
public $currency_code;
|
||||||
/** @var string Bill name */
|
/** @var string The date. */
|
||||||
public $bill_name;
|
public $date;
|
||||||
|
/** @var string The description */
|
||||||
|
public $description;
|
||||||
|
/** @var string Foreign amount */
|
||||||
|
public $foreign_amount = '0';
|
||||||
|
/** @var string The foreign currency code */
|
||||||
|
public $foreign_currency_code = '';
|
||||||
|
/** @var int ID of the journal */
|
||||||
|
public $journal_id;
|
||||||
/** @var string Notes */
|
/** @var string Notes */
|
||||||
public $notes;
|
public $notes;
|
||||||
|
/** @var string Opposing account BIC */
|
||||||
|
public $opposing_account_bic;
|
||||||
|
/** @var string Opposing account IBAN */
|
||||||
|
public $opposing_account_iban;
|
||||||
|
/** @var string Opposing account ID */
|
||||||
|
public $opposing_account_id;
|
||||||
|
/** @var string Opposing account name */
|
||||||
|
public $opposing_account_name;
|
||||||
|
/** @var string Opposing account number */
|
||||||
|
public $opposing_account_number;
|
||||||
|
/** @var string Opposing account code */
|
||||||
|
public $opposing_currency_code;
|
||||||
/** @var string Tags */
|
/** @var string Tags */
|
||||||
public $tags;
|
public $tags;
|
||||||
|
/** @var int ID of the transaction */
|
||||||
|
public $transaction_id = 0;
|
||||||
|
/** @var string Transaction type */
|
||||||
|
public $transaction_type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Entry constructor.
|
* Entry constructor.
|
||||||
@@ -132,7 +132,7 @@ final class Entry
|
|||||||
$entry->transaction_id = $transaction->id;
|
$entry->transaction_id = $transaction->id;
|
||||||
$entry->date = $transaction->date->format('Ymd');
|
$entry->date = $transaction->date->format('Ymd');
|
||||||
$entry->description = $transaction->description;
|
$entry->description = $transaction->description;
|
||||||
if (\strlen((string)$transaction->transaction_description) > 0) {
|
if ('' !== (string)$transaction->transaction_description) {
|
||||||
$entry->description = $transaction->transaction_description . '(' . $transaction->description . ')';
|
$entry->description = $transaction->transaction_description . '(' . $transaction->description . ')';
|
||||||
}
|
}
|
||||||
$entry->currency_code = $transaction->transactionCurrency->code;
|
$entry->currency_code = $transaction->transactionCurrency->code;
|
||||||
|
@@ -25,7 +25,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Export;
|
namespace FireflyIII\Export;
|
||||||
|
|
||||||
use Crypt;
|
|
||||||
use DB;
|
use DB;
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
use FireflyIII\Export\Collector\AttachmentCollector;
|
use FireflyIII\Export\Collector\AttachmentCollector;
|
||||||
@@ -41,8 +40,8 @@ use FireflyIII\Models\Transaction;
|
|||||||
use FireflyIII\Models\TransactionJournal;
|
use FireflyIII\Models\TransactionJournal;
|
||||||
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
|
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Log;
|
|
||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
use Log;
|
||||||
use ZipArchive;
|
use ZipArchive;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -193,8 +192,8 @@ class ExpandedProcessor implements ProcessorInterface
|
|||||||
*/
|
*/
|
||||||
public function createZipFile(): bool
|
public function createZipFile(): bool
|
||||||
{
|
{
|
||||||
$zip = new ZipArchive;
|
$zip = new ZipArchive;
|
||||||
$file = $this->job->key . '.zip';
|
$file = $this->job->key . '.zip';
|
||||||
$localPath = storage_path('export') . '/' . $file;
|
$localPath = storage_path('export') . '/' . $file;
|
||||||
|
|
||||||
if (true !== $zip->open($localPath, ZipArchive::CREATE)) {
|
if (true !== $zip->open($localPath, ZipArchive::CREATE)) {
|
||||||
@@ -339,7 +338,7 @@ class ExpandedProcessor implements ProcessorInterface
|
|||||||
$return = [];
|
$return = [];
|
||||||
/** @var Note $note */
|
/** @var Note $note */
|
||||||
foreach ($notes as $note) {
|
foreach ($notes as $note) {
|
||||||
if (\strlen(trim((string)$note->text)) > 0) {
|
if ('' !== trim((string)$note->text)) {
|
||||||
$id = (int)$note->noteable_id;
|
$id = (int)$note->noteable_id;
|
||||||
$return[$id] = $note->text;
|
$return[$id] = $note->text;
|
||||||
}
|
}
|
||||||
|
@@ -25,8 +25,8 @@ declare(strict_types=1);
|
|||||||
namespace FireflyIII\Export\Exporter;
|
namespace FireflyIII\Export\Exporter;
|
||||||
|
|
||||||
use FireflyIII\Export\Entry\Entry;
|
use FireflyIII\Export\Entry\Entry;
|
||||||
use League\Csv\Writer;
|
|
||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
use League\Csv\Writer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class CsvExporter.
|
* Class CsvExporter.
|
||||||
|
@@ -49,6 +49,7 @@ class AccountFactory
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* AccountFactory constructor.
|
* AccountFactory constructor.
|
||||||
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
@@ -103,7 +104,7 @@ class AccountFactory
|
|||||||
// use default currency:
|
// use default currency:
|
||||||
$currency = app('amount')->getDefaultCurrencyByUser($this->user);
|
$currency = app('amount')->getDefaultCurrencyByUser($this->user);
|
||||||
}
|
}
|
||||||
$currency->enabled =true;
|
$currency->enabled = true;
|
||||||
$currency->save();
|
$currency->save();
|
||||||
|
|
||||||
unset($data['currency_code']);
|
unset($data['currency_code']);
|
||||||
|
@@ -43,6 +43,7 @@ class AccountMetaFactory
|
|||||||
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
|
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $data
|
* @param array $data
|
||||||
*
|
*
|
||||||
@@ -73,6 +74,7 @@ class AccountMetaFactory
|
|||||||
// if $data has field and $entry is null, create new one:
|
// if $data has field and $entry is null, create new one:
|
||||||
if (null === $entry) {
|
if (null === $entry) {
|
||||||
Log::debug(sprintf('Created meta-field "%s":"%s" for account #%d ("%s") ', $field, $value, $account->id, $account->name));
|
Log::debug(sprintf('Created meta-field "%s":"%s" for account #%d ("%s") ', $field, $value, $account->id, $account->name));
|
||||||
|
|
||||||
return $this->create(['account_id' => $account->id, 'name' => $field, 'data' => $value]);
|
return $this->create(['account_id' => $account->id, 'name' => $field, 'data' => $value]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,6 +91,7 @@ class AccountMetaFactory
|
|||||||
} catch (Exception $e) { // @codeCoverageIgnore
|
} catch (Exception $e) { // @codeCoverageIgnore
|
||||||
Log::debug(sprintf('Could not delete entry: %s', $e->getMessage())); // @codeCoverageIgnore
|
Log::debug(sprintf('Could not delete entry: %s', $e->getMessage())); // @codeCoverageIgnore
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -38,6 +38,9 @@ class BillFactory
|
|||||||
{
|
{
|
||||||
use BillServiceTrait;
|
use BillServiceTrait;
|
||||||
|
|
||||||
|
/** @var User */
|
||||||
|
private $user;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*/
|
*/
|
||||||
@@ -48,9 +51,6 @@ class BillFactory
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @var User */
|
|
||||||
private $user;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $data
|
* @param array $data
|
||||||
*
|
*
|
||||||
@@ -63,7 +63,7 @@ class BillFactory
|
|||||||
/** @var TransactionCurrency $currency */
|
/** @var TransactionCurrency $currency */
|
||||||
$currency = $factory->find((int)($data['currency_id'] ?? null), (string)($data['currency_code'] ?? null));
|
$currency = $factory->find((int)($data['currency_id'] ?? null), (string)($data['currency_code'] ?? null));
|
||||||
|
|
||||||
if(null === $currency) {
|
if (null === $currency) {
|
||||||
// use default currency:
|
// use default currency:
|
||||||
$currency = app('amount')->getDefaultCurrencyByUser($this->user);
|
$currency = app('amount')->getDefaultCurrencyByUser($this->user);
|
||||||
}
|
}
|
||||||
@@ -111,7 +111,7 @@ class BillFactory
|
|||||||
}
|
}
|
||||||
|
|
||||||
// then find by name:
|
// then find by name:
|
||||||
if (null === $bill && \strlen($billName) > 0) {
|
if (null === $bill && '' !== $billName) {
|
||||||
$bill = $this->findByName($billName);
|
$bill = $this->findByName($billName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -34,6 +34,9 @@ use Log;
|
|||||||
*/
|
*/
|
||||||
class BudgetFactory
|
class BudgetFactory
|
||||||
{
|
{
|
||||||
|
/** @var User */
|
||||||
|
private $user;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*/
|
*/
|
||||||
@@ -44,10 +47,6 @@ class BudgetFactory
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @var User */
|
|
||||||
private $user;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int|null $budgetId
|
* @param int|null $budgetId
|
||||||
* @param null|string $budgetName
|
* @param null|string $budgetName
|
||||||
|
@@ -34,6 +34,9 @@ use Log;
|
|||||||
*/
|
*/
|
||||||
class CategoryFactory
|
class CategoryFactory
|
||||||
{
|
{
|
||||||
|
/** @var User */
|
||||||
|
private $user;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*/
|
*/
|
||||||
@@ -44,9 +47,6 @@ class CategoryFactory
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @var User */
|
|
||||||
private $user;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $name
|
* @param string $name
|
||||||
*
|
*
|
||||||
@@ -94,7 +94,7 @@ class CategoryFactory
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (\strlen($categoryName) > 0) {
|
if ('' !== $categoryName) {
|
||||||
$category = $this->findByName($categoryName);
|
$category = $this->findByName($categoryName);
|
||||||
if (null !== $category) {
|
if (null !== $category) {
|
||||||
return $category;
|
return $category;
|
||||||
|
@@ -33,6 +33,9 @@ use Log;
|
|||||||
*/
|
*/
|
||||||
class PiggyBankFactory
|
class PiggyBankFactory
|
||||||
{
|
{
|
||||||
|
/** @var User */
|
||||||
|
private $user;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*/
|
*/
|
||||||
@@ -43,9 +46,6 @@ class PiggyBankFactory
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @var User */
|
|
||||||
private $user;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int|null $piggyBankId
|
* @param int|null $piggyBankId
|
||||||
* @param null|string $piggyBankName
|
* @param null|string $piggyBankName
|
||||||
@@ -70,7 +70,7 @@ class PiggyBankFactory
|
|||||||
}
|
}
|
||||||
|
|
||||||
// then find by name:
|
// then find by name:
|
||||||
if (\strlen($piggyBankName) > 0) {
|
if ('' !== $piggyBankName) {
|
||||||
/** @var PiggyBank $piggyBank */
|
/** @var PiggyBank $piggyBank */
|
||||||
$piggyBank = $this->findByName($piggyBankName);
|
$piggyBank = $this->findByName($piggyBankName);
|
||||||
if (null !== $piggyBank) {
|
if (null !== $piggyBank) {
|
||||||
|
@@ -39,6 +39,11 @@ use Log;
|
|||||||
*/
|
*/
|
||||||
class RecurrenceFactory
|
class RecurrenceFactory
|
||||||
{
|
{
|
||||||
|
/** @var User */
|
||||||
|
private $user;
|
||||||
|
|
||||||
|
use TransactionTypeTrait, TransactionServiceTrait, RecurringTransactionTrait;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*/
|
*/
|
||||||
@@ -49,11 +54,6 @@ class RecurrenceFactory
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
use TransactionTypeTrait, TransactionServiceTrait, RecurringTransactionTrait;
|
|
||||||
|
|
||||||
/** @var User */
|
|
||||||
private $user;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $data
|
* @param array $data
|
||||||
*
|
*
|
||||||
|
@@ -38,6 +38,7 @@ class TransactionCurrencyFactory
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* TransactionCurrencyFactory constructor.
|
* TransactionCurrencyFactory constructor.
|
||||||
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
@@ -100,7 +101,7 @@ class TransactionCurrencyFactory
|
|||||||
Log::warning(sprintf('Currency ID is %d but found nothing!', $currencyId));
|
Log::warning(sprintf('Currency ID is %d but found nothing!', $currencyId));
|
||||||
}
|
}
|
||||||
// then by code:
|
// then by code:
|
||||||
if (\strlen($currencyCode) > 0) {
|
if ('' !== $currencyCode) {
|
||||||
$currency = TransactionCurrency::whereCode($currencyCode)->first();
|
$currency = TransactionCurrency::whereCode($currencyCode)->first();
|
||||||
if (null !== $currency) {
|
if (null !== $currency) {
|
||||||
return $currency;
|
return $currency;
|
||||||
|
@@ -115,7 +115,7 @@ class TransactionFactory
|
|||||||
$currency = $currency ?? $defaultCurrency;
|
$currency = $currency ?? $defaultCurrency;
|
||||||
|
|
||||||
// enable currency:
|
// enable currency:
|
||||||
if(false === $currency->enabled) {
|
if (false === $currency->enabled) {
|
||||||
$currency->enabled = true;
|
$currency->enabled = true;
|
||||||
$currency->save();
|
$currency->save();
|
||||||
}
|
}
|
||||||
|
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Factory;
|
namespace FireflyIII\Factory;
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
use FireflyIII\Models\TransactionJournal;
|
use FireflyIII\Models\TransactionJournal;
|
||||||
use FireflyIII\Services\Internal\Support\JournalServiceTrait;
|
use FireflyIII\Services\Internal\Support\JournalServiceTrait;
|
||||||
@@ -70,14 +71,18 @@ class TransactionJournalFactory
|
|||||||
Log::debug(sprintf('Going to store a %s', $type->type));
|
Log::debug(sprintf('Going to store a %s', $type->type));
|
||||||
$description = app('steam')->cleanString($data['description']);
|
$description = app('steam')->cleanString($data['description']);
|
||||||
$description = str_replace(["\n", "\t", "\r"], "\x20", $description);
|
$description = str_replace(["\n", "\t", "\r"], "\x20", $description);
|
||||||
$journal = TransactionJournal::create(
|
/** @var Carbon $carbon */
|
||||||
|
$carbon = $data['date'];
|
||||||
|
$carbon->setTimezone(config('app.timezone'));
|
||||||
|
|
||||||
|
$journal = TransactionJournal::create(
|
||||||
[
|
[
|
||||||
'user_id' => $data['user'],
|
'user_id' => $data['user'],
|
||||||
'transaction_type_id' => $type->id,
|
'transaction_type_id' => $type->id,
|
||||||
'bill_id' => null,
|
'bill_id' => null,
|
||||||
'transaction_currency_id' => $defaultCurrency->id,
|
'transaction_currency_id' => $defaultCurrency->id,
|
||||||
'description' => $description,
|
'description' => $description,
|
||||||
'date' => $data['date']->format('Y-m-d'),
|
'date' => $carbon->format('Y-m-d H:i:s'),
|
||||||
'order' => 0,
|
'order' => 0,
|
||||||
'tag_count' => 0,
|
'tag_count' => 0,
|
||||||
'completed' => 0,
|
'completed' => 0,
|
||||||
@@ -92,7 +97,7 @@ class TransactionJournalFactory
|
|||||||
/** @var TransactionFactory $factory */
|
/** @var TransactionFactory $factory */
|
||||||
$factory = app(TransactionFactory::class);
|
$factory = app(TransactionFactory::class);
|
||||||
$factory->setUser($this->user);
|
$factory->setUser($this->user);
|
||||||
$totalAmount= '0';
|
$totalAmount = '0';
|
||||||
Log::debug(sprintf('Found %d transactions in array.', \count($data['transactions'])));
|
Log::debug(sprintf('Found %d transactions in array.', \count($data['transactions'])));
|
||||||
/** @var array $trData */
|
/** @var array $trData */
|
||||||
foreach ($data['transactions'] as $index => $trData) {
|
foreach ($data['transactions'] as $index => $trData) {
|
||||||
|
@@ -27,6 +27,7 @@ namespace FireflyIII\Factory;
|
|||||||
|
|
||||||
use FireflyIII\Models\TransactionType;
|
use FireflyIII\Models\TransactionType;
|
||||||
use Log;
|
use Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class TransactionTypeFactory
|
* Class TransactionTypeFactory
|
||||||
*/
|
*/
|
||||||
|
@@ -24,6 +24,7 @@ namespace FireflyIII\Generator\Chart\Basic;
|
|||||||
|
|
||||||
use FireflyIII\Support\ChartColour;
|
use FireflyIII\Support\ChartColour;
|
||||||
use Log;
|
use Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ChartJsGenerator.
|
* Class ChartJsGenerator.
|
||||||
*/
|
*/
|
||||||
@@ -39,6 +40,46 @@ class ChartJsGenerator implements GeneratorInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Expects data as:.
|
||||||
|
*
|
||||||
|
* key => [value => x, 'currency_symbol' => 'x']
|
||||||
|
*
|
||||||
|
* @param array $data
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function multiCurrencyPieChart(array $data): array
|
||||||
|
{
|
||||||
|
$chartData = [
|
||||||
|
'datasets' => [
|
||||||
|
0 => [],
|
||||||
|
],
|
||||||
|
'labels' => [],
|
||||||
|
];
|
||||||
|
|
||||||
|
$amounts = array_column($data, 'amount');
|
||||||
|
$next = next($amounts);
|
||||||
|
$sortFlag = SORT_ASC;
|
||||||
|
if (!\is_bool($next) && 1 === bccomp((string)$next, '0')) {
|
||||||
|
$sortFlag = SORT_DESC;
|
||||||
|
}
|
||||||
|
array_multisort($amounts, $sortFlag, $data);
|
||||||
|
unset($next, $sortFlag, $amounts);
|
||||||
|
|
||||||
|
$index = 0;
|
||||||
|
foreach ($data as $key => $valueArray) {
|
||||||
|
// make larger than 0
|
||||||
|
$chartData['datasets'][0]['data'][] = (float)app('steam')->positive((string)$valueArray['amount']);
|
||||||
|
$chartData['datasets'][0]['backgroundColor'][] = ChartColour::getColour($index);
|
||||||
|
$chartData['datasets'][0]['currency_symbol'][] = $valueArray['currency_symbol'];
|
||||||
|
$chartData['labels'][] = $key;
|
||||||
|
++$index;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $chartData;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Will generate a Chart JS compatible array from the given input. Expects this format.
|
* Will generate a Chart JS compatible array from the given input. Expects this format.
|
||||||
*
|
*
|
||||||
@@ -150,46 +191,6 @@ class ChartJsGenerator implements GeneratorInterface
|
|||||||
return $chartData;
|
return $chartData;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Expects data as:.
|
|
||||||
*
|
|
||||||
* key => [value => x, 'currency_symbol' => 'x']
|
|
||||||
*
|
|
||||||
* @param array $data
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function multiCurrencyPieChart(array $data): array
|
|
||||||
{
|
|
||||||
$chartData = [
|
|
||||||
'datasets' => [
|
|
||||||
0 => [],
|
|
||||||
],
|
|
||||||
'labels' => [],
|
|
||||||
];
|
|
||||||
|
|
||||||
$amounts = array_column($data, 'amount');
|
|
||||||
$next = next($amounts);
|
|
||||||
$sortFlag = SORT_ASC;
|
|
||||||
if (!\is_bool($next) && 1 === bccomp((string)$next, '0')) {
|
|
||||||
$sortFlag = SORT_DESC;
|
|
||||||
}
|
|
||||||
array_multisort($amounts, $sortFlag, $data);
|
|
||||||
unset($next, $sortFlag, $amounts);
|
|
||||||
|
|
||||||
$index = 0;
|
|
||||||
foreach ($data as $key => $valueArray) {
|
|
||||||
// make larger than 0
|
|
||||||
$chartData['datasets'][0]['data'][] = (float)app('steam')->positive((string)$valueArray['amount']);
|
|
||||||
$chartData['datasets'][0]['backgroundColor'][] = ChartColour::getColour($index);
|
|
||||||
$chartData['datasets'][0]['currency_symbol'][] = $valueArray['currency_symbol'];
|
|
||||||
$chartData['labels'][] = $key;
|
|
||||||
++$index;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $chartData;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Will generate a (ChartJS) compatible array from the given input. Expects this format:.
|
* Will generate a (ChartJS) compatible array from the given input. Expects this format:.
|
||||||
*
|
*
|
||||||
|
@@ -24,6 +24,7 @@ namespace FireflyIII\Generator\Report\Audit;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Class MultiYearReportGenerator.
|
* Class MultiYearReportGenerator.
|
||||||
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
class MultiYearReportGenerator extends MonthReportGenerator
|
class MultiYearReportGenerator extends MonthReportGenerator
|
||||||
|
@@ -24,6 +24,7 @@ namespace FireflyIII\Generator\Report\Audit;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Class YearReportGenerator.
|
* Class YearReportGenerator.
|
||||||
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
class YearReportGenerator extends MonthReportGenerator
|
class YearReportGenerator extends MonthReportGenerator
|
||||||
|
@@ -24,6 +24,7 @@ namespace FireflyIII\Generator\Report\Budget;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Class MultiYearReportGenerator.
|
* Class MultiYearReportGenerator.
|
||||||
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
class MultiYearReportGenerator extends MonthReportGenerator
|
class MultiYearReportGenerator extends MonthReportGenerator
|
||||||
|
@@ -24,6 +24,7 @@ namespace FireflyIII\Generator\Report\Budget;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Class YearReportGenerator.
|
* Class YearReportGenerator.
|
||||||
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
class YearReportGenerator extends MonthReportGenerator
|
class YearReportGenerator extends MonthReportGenerator
|
||||||
|
@@ -40,6 +40,7 @@ use Throwable;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Class MonthReportGenerator.
|
* Class MonthReportGenerator.
|
||||||
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
class MonthReportGenerator extends Support implements ReportGeneratorInterface
|
class MonthReportGenerator extends Support implements ReportGeneratorInterface
|
||||||
|
@@ -24,6 +24,7 @@ namespace FireflyIII\Generator\Report\Category;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Class MultiYearReportGenerator.
|
* Class MultiYearReportGenerator.
|
||||||
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
class MultiYearReportGenerator extends MonthReportGenerator
|
class MultiYearReportGenerator extends MonthReportGenerator
|
||||||
|
@@ -24,6 +24,7 @@ namespace FireflyIII\Generator\Report\Category;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Class YearReportGenerator.
|
* Class YearReportGenerator.
|
||||||
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
class YearReportGenerator extends MonthReportGenerator
|
class YearReportGenerator extends MonthReportGenerator
|
||||||
|
@@ -27,6 +27,7 @@ use FireflyIII\Exceptions\FireflyException;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ReportGeneratorFactory.
|
* Class ReportGeneratorFactory.
|
||||||
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
class ReportGeneratorFactory
|
class ReportGeneratorFactory
|
||||||
|
@@ -31,6 +31,7 @@ use Throwable;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Class MonthReportGenerator.
|
* Class MonthReportGenerator.
|
||||||
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
class MonthReportGenerator implements ReportGeneratorInterface
|
class MonthReportGenerator implements ReportGeneratorInterface
|
||||||
|
@@ -30,6 +30,7 @@ use Throwable;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Class MonthReportGenerator.
|
* Class MonthReportGenerator.
|
||||||
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
class MultiYearReportGenerator implements ReportGeneratorInterface
|
class MultiYearReportGenerator implements ReportGeneratorInterface
|
||||||
|
@@ -30,6 +30,7 @@ use Throwable;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Class MonthReportGenerator.
|
* Class MonthReportGenerator.
|
||||||
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
class YearReportGenerator implements ReportGeneratorInterface
|
class YearReportGenerator implements ReportGeneratorInterface
|
||||||
|
@@ -31,6 +31,7 @@ use Illuminate\Support\Collection;
|
|||||||
* Class Support.
|
* Class Support.
|
||||||
* @method Collection getExpenses()
|
* @method Collection getExpenses()
|
||||||
* @method Collection getIncome()
|
* @method Collection getIncome()
|
||||||
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
class Support
|
class Support
|
||||||
|
@@ -24,6 +24,7 @@ namespace FireflyIII\Generator\Report\Tag;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Class MultiYearReportGenerator.
|
* Class MultiYearReportGenerator.
|
||||||
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
class MultiYearReportGenerator extends MonthReportGenerator
|
class MultiYearReportGenerator extends MonthReportGenerator
|
||||||
|
@@ -24,6 +24,7 @@ namespace FireflyIII\Generator\Report\Tag;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Class YearReportGenerator.
|
* Class YearReportGenerator.
|
||||||
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
class YearReportGenerator extends MonthReportGenerator
|
class YearReportGenerator extends MonthReportGenerator
|
||||||
|
@@ -49,7 +49,7 @@ class StoredJournalEventHandler
|
|||||||
/** @var RuleGroupRepositoryInterface $ruleGroupRepos */
|
/** @var RuleGroupRepositoryInterface $ruleGroupRepos */
|
||||||
$ruleGroupRepos = app(RuleGroupRepositoryInterface::class);
|
$ruleGroupRepos = app(RuleGroupRepositoryInterface::class);
|
||||||
$ruleGroupRepos->setUser($journal->user);
|
$ruleGroupRepos->setUser($journal->user);
|
||||||
$groups = $ruleGroupRepos->getActiveGroups($journal->user);
|
$groups = $ruleGroupRepos->getActiveGroups($journal->user);
|
||||||
|
|
||||||
/** @var RuleGroup $group */
|
/** @var RuleGroup $group */
|
||||||
foreach ($groups as $group) {
|
foreach ($groups as $group) {
|
||||||
|
@@ -50,7 +50,7 @@ class UpdatedJournalEventHandler
|
|||||||
$ruleGroupRepos = app(RuleGroupRepositoryInterface::class);
|
$ruleGroupRepos = app(RuleGroupRepositoryInterface::class);
|
||||||
$ruleGroupRepos->setUser($journal->user);
|
$ruleGroupRepos->setUser($journal->user);
|
||||||
|
|
||||||
$groups = $ruleGroupRepos->getActiveGroups($journal->user);
|
$groups = $ruleGroupRepos->getActiveGroups($journal->user);
|
||||||
|
|
||||||
/** @var RuleGroup $group */
|
/** @var RuleGroup $group */
|
||||||
foreach ($groups as $group) {
|
foreach ($groups as $group) {
|
||||||
|
@@ -146,6 +146,7 @@ class UserEventHandler
|
|||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
Log::error($e->getMessage());
|
Log::error($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
// @codeCoverageIgnoreEnd
|
// @codeCoverageIgnoreEnd
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -172,6 +173,7 @@ class UserEventHandler
|
|||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
Log::error($e->getMessage());
|
Log::error($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
// @codeCoverageIgnoreEnd
|
// @codeCoverageIgnoreEnd
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -199,6 +201,7 @@ class UserEventHandler
|
|||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
Log::error($e->getMessage());
|
Log::error($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
// @codeCoverageIgnoreEnd
|
// @codeCoverageIgnoreEnd
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@@ -26,11 +26,12 @@ use Crypt;
|
|||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
use FireflyIII\Models\Attachment;
|
use FireflyIII\Models\Attachment;
|
||||||
use Illuminate\Contracts\Encryption\DecryptException;
|
use Illuminate\Contracts\Encryption\DecryptException;
|
||||||
|
use Illuminate\Contracts\Filesystem\FileNotFoundException;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
use Illuminate\Support\MessageBag;
|
use Illuminate\Support\MessageBag;
|
||||||
use Log;
|
use Log;
|
||||||
use Illuminate\Support\Facades\Storage;
|
|
||||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -85,7 +86,7 @@ class AttachmentHelper implements AttachmentHelperInterface
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$content = Crypt::decrypt($this->uploadDisk->get(sprintf('at-%d.data', $attachment->id)));
|
$content = Crypt::decrypt($this->uploadDisk->get(sprintf('at-%d.data', $attachment->id)));
|
||||||
} catch (DecryptException $e) {
|
} catch (DecryptException|FileNotFoundException $e) {
|
||||||
Log::error(sprintf('Could not decrypt data of attachment #%d: %s', $attachment->id, $e->getMessage()));
|
Log::error(sprintf('Could not decrypt data of attachment #%d: %s', $attachment->id, $e->getMessage()));
|
||||||
$content = '';
|
$content = '';
|
||||||
}
|
}
|
||||||
@@ -102,8 +103,7 @@ class AttachmentHelper implements AttachmentHelperInterface
|
|||||||
*/
|
*/
|
||||||
public function getAttachmentLocation(Attachment $attachment): string
|
public function getAttachmentLocation(Attachment $attachment): string
|
||||||
{
|
{
|
||||||
$path = sprintf('%sat-%d.data', DIRECTORY_SEPARATOR, (int)$attachment->id);
|
return sprintf('%sat-%d.data', DIRECTORY_SEPARATOR, (int)$attachment->id);
|
||||||
return $path;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -186,11 +186,11 @@ class AttachmentHelper implements AttachmentHelperInterface
|
|||||||
* @param array|null $files
|
* @param array|null $files
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
* @throws \Illuminate\Contracts\Encryption\EncryptException
|
* @throws FireflyException
|
||||||
*/
|
*/
|
||||||
public function saveAttachmentsForModel(object $model, ?array $files): bool
|
public function saveAttachmentsForModel(object $model, ?array $files): bool
|
||||||
{
|
{
|
||||||
if(!($model instanceof Model)) {
|
if (!($model instanceof Model)) {
|
||||||
return false; // @codeCoverageIgnore
|
return false; // @codeCoverageIgnore
|
||||||
}
|
}
|
||||||
Log::debug(sprintf('Now in saveAttachmentsForModel for model %s', \get_class($model)));
|
Log::debug(sprintf('Now in saveAttachmentsForModel for model %s', \get_class($model)));
|
||||||
@@ -265,10 +265,10 @@ class AttachmentHelper implements AttachmentHelperInterface
|
|||||||
$attachment->save();
|
$attachment->save();
|
||||||
Log::debug('Created attachment:', $attachment->toArray());
|
Log::debug('Created attachment:', $attachment->toArray());
|
||||||
|
|
||||||
$fileObject = $file->openFile('r');
|
$fileObject = $file->openFile();
|
||||||
$fileObject->rewind();
|
$fileObject->rewind();
|
||||||
|
|
||||||
if(0 === $file->getSize()) {
|
if (0 === $file->getSize()) {
|
||||||
throw new FireflyException('Cannot upload empty or non-existent file.'); // @codeCoverageIgnore
|
throw new FireflyException('Cannot upload empty or non-existent file.'); // @codeCoverageIgnore
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -651,6 +651,40 @@ class TransactionCollector implements TransactionCollectorInterface
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Search for words in descriptions.
|
||||||
|
*
|
||||||
|
* @param array $array
|
||||||
|
*
|
||||||
|
* @return TransactionCollectorInterface
|
||||||
|
*/
|
||||||
|
public function setSearchWords(array $array): TransactionCollectorInterface
|
||||||
|
{
|
||||||
|
// 'transaction_journals.description',
|
||||||
|
$this->query->where(
|
||||||
|
function (EloquentBuilder $q) use ($array) {
|
||||||
|
$q->where(
|
||||||
|
function (EloquentBuilder $q1) use ($array) {
|
||||||
|
foreach ($array as $word) {
|
||||||
|
$keyword = sprintf('%%%s%%', $word);
|
||||||
|
$q1->where('transaction_journals.description', 'LIKE', $keyword);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
$q->orWhere(
|
||||||
|
function (EloquentBuilder $q2) use ($array) {
|
||||||
|
foreach ($array as $word) {
|
||||||
|
$keyword = sprintf('%%%s%%', $word);
|
||||||
|
$q2->where('transactions.description', 'LIKE', $keyword);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Tag $tag
|
* @param Tag $tag
|
||||||
*
|
*
|
||||||
|
@@ -145,15 +145,6 @@ interface TransactionCollectorInterface
|
|||||||
*/
|
*/
|
||||||
public function setAllAssetAccounts(): TransactionCollectorInterface;
|
public function setAllAssetAccounts(): TransactionCollectorInterface;
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the required currency (local or foreign)
|
|
||||||
*
|
|
||||||
* @param TransactionCurrency $currency
|
|
||||||
*
|
|
||||||
* @return TransactionCollectorInterface
|
|
||||||
*/
|
|
||||||
public function setCurrency(TransactionCurrency $currency): TransactionCollectorInterface;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Collect transactions before a specific date.
|
* Collect transactions before a specific date.
|
||||||
*
|
*
|
||||||
@@ -208,6 +199,15 @@ interface TransactionCollectorInterface
|
|||||||
*/
|
*/
|
||||||
public function setCategory(Category $category): TransactionCollectorInterface;
|
public function setCategory(Category $category): TransactionCollectorInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the required currency (local or foreign)
|
||||||
|
*
|
||||||
|
* @param TransactionCurrency $currency
|
||||||
|
*
|
||||||
|
* @return TransactionCollectorInterface
|
||||||
|
*/
|
||||||
|
public function setCurrency(TransactionCurrency $currency): TransactionCollectorInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the journal IDs to filter on.
|
* Set the journal IDs to filter on.
|
||||||
*
|
*
|
||||||
@@ -272,6 +272,15 @@ interface TransactionCollectorInterface
|
|||||||
*/
|
*/
|
||||||
public function setRange(Carbon $start, Carbon $end): TransactionCollectorInterface;
|
public function setRange(Carbon $start, Carbon $end): TransactionCollectorInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Search for words in descriptions.
|
||||||
|
*
|
||||||
|
* @param array $array
|
||||||
|
*
|
||||||
|
* @return TransactionCollectorInterface
|
||||||
|
*/
|
||||||
|
public function setSearchWords(array $array): TransactionCollectorInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the tag to collect from.
|
* Set the tag to collect from.
|
||||||
*
|
*
|
||||||
|
@@ -31,6 +31,7 @@ use Illuminate\Support\Collection;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Class CountAttachmentsFilter
|
* Class CountAttachmentsFilter
|
||||||
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
class CountAttachmentsFilter implements FilterInterface
|
class CountAttachmentsFilter implements FilterInterface
|
||||||
|
@@ -26,6 +26,7 @@ use FireflyIII\Models\Transaction;
|
|||||||
use FireflyIII\Models\TransactionType;
|
use FireflyIII\Models\TransactionType;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Log;
|
use Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class TransferFilter.
|
* Class TransferFilter.
|
||||||
*
|
*
|
||||||
|
@@ -25,7 +25,6 @@ namespace FireflyIII\Helpers\Help;
|
|||||||
use Cache;
|
use Cache;
|
||||||
use Exception;
|
use Exception;
|
||||||
use GuzzleHttp\Client;
|
use GuzzleHttp\Client;
|
||||||
use GuzzleHttp\Exception\GuzzleException;
|
|
||||||
use League\CommonMark\CommonMarkConverter;
|
use League\CommonMark\CommonMarkConverter;
|
||||||
use Log;
|
use Log;
|
||||||
use Route;
|
use Route;
|
||||||
@@ -87,14 +86,14 @@ class Help implements HelpInterface
|
|||||||
$res = $client->request('GET', $uri, $opt);
|
$res = $client->request('GET', $uri, $opt);
|
||||||
$statusCode = $res->getStatusCode();
|
$statusCode = $res->getStatusCode();
|
||||||
$content = trim($res->getBody()->getContents());
|
$content = trim($res->getBody()->getContents());
|
||||||
} catch (GuzzleException|Exception $e) {
|
} catch (Exception $e) {
|
||||||
Log::info($e->getMessage());
|
Log::info($e->getMessage());
|
||||||
Log::info($e->getTraceAsString());
|
Log::info($e->getTraceAsString());
|
||||||
}
|
}
|
||||||
|
|
||||||
Log::debug(sprintf('Status code is %d', $statusCode));
|
Log::debug(sprintf('Status code is %d', $statusCode));
|
||||||
|
|
||||||
if (\strlen($content) > 0) {
|
if ('' !== $content) {
|
||||||
Log::debug('Content is longer than zero. Expect something.');
|
Log::debug('Content is longer than zero. Expect something.');
|
||||||
$converter = new CommonMarkConverter();
|
$converter = new CommonMarkConverter();
|
||||||
$content = $converter->convertToHtml($content);
|
$content = $converter->convertToHtml($content);
|
||||||
@@ -153,7 +152,7 @@ class Help implements HelpInterface
|
|||||||
public function putInCache(string $route, string $language, string $content): void
|
public function putInCache(string $route, string $language, string $content): void
|
||||||
{
|
{
|
||||||
$key = sprintf(self::CACHEKEY, $route, $language);
|
$key = sprintf(self::CACHEKEY, $route, $language);
|
||||||
if (\strlen($content) > 0) {
|
if ('' !== $content) {
|
||||||
Log::debug(sprintf('Will store entry in cache: %s', $key));
|
Log::debug(sprintf('Will store entry in cache: %s', $key));
|
||||||
Cache::put($key, $content, 10080); // a week.
|
Cache::put($key, $content, 10080); // a week.
|
||||||
|
|
||||||
|
@@ -25,7 +25,6 @@ namespace FireflyIII\Helpers\Report;
|
|||||||
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use FireflyIII\Models\Account;
|
use FireflyIII\Models\Account;
|
||||||
use FireflyIII\Models\AccountType;
|
|
||||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||||
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
|
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
|
||||||
use FireflyIII\Support\CacheProperties;
|
use FireflyIII\Support\CacheProperties;
|
||||||
|
@@ -31,6 +31,7 @@ use FireflyIII\Models\TransactionType;
|
|||||||
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Log;
|
use Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class PopupReport.
|
* Class PopupReport.
|
||||||
*
|
*
|
||||||
@@ -186,7 +187,7 @@ class PopupReport implements PopupReportInterface
|
|||||||
$collector->setAccounts(new Collection([$account]))->setRange($attributes['startDate'], $attributes['endDate'])
|
$collector->setAccounts(new Collection([$account]))->setRange($attributes['startDate'], $attributes['endDate'])
|
||||||
->setTypes([TransactionType::DEPOSIT, TransactionType::TRANSFER]);
|
->setTypes([TransactionType::DEPOSIT, TransactionType::TRANSFER]);
|
||||||
$transactions = $collector->getTransactions();
|
$transactions = $collector->getTransactions();
|
||||||
$report = $attributes['accounts']->pluck('id')->toArray(); // accounts used in this report
|
$report = $attributes['accounts']->pluck('id')->toArray(); // accounts used in this report
|
||||||
|
|
||||||
// filter the set so the destinations outside of $attributes['accounts'] are not included.
|
// filter the set so the destinations outside of $attributes['accounts'] are not included.
|
||||||
$transactions = $transactions->filter(
|
$transactions = $transactions->filter(
|
||||||
|
@@ -33,6 +33,7 @@ use FireflyIII\Repositories\Bill\BillRepositoryInterface;
|
|||||||
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Log;
|
use Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ReportHelper.
|
* Class ReportHelper.
|
||||||
*
|
*
|
||||||
|
@@ -50,6 +50,8 @@ trait UpdateTrait
|
|||||||
$request->call();
|
$request->call();
|
||||||
} catch (FireflyException $e) {
|
} catch (FireflyException $e) {
|
||||||
Log::error(sprintf('Could not check for updates: %s', $e->getMessage()));
|
Log::error(sprintf('Could not check for updates: %s', $e->getMessage()));
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get releases from array.
|
// get releases from array.
|
||||||
@@ -79,19 +81,22 @@ trait UpdateTrait
|
|||||||
public function parseResult(int $versionCheck, Release $release = null): string
|
public function parseResult(int $versionCheck, Release $release = null): string
|
||||||
{
|
{
|
||||||
Log::debug(sprintf('Now in parseResult(%d)', $versionCheck));
|
Log::debug(sprintf('Now in parseResult(%d)', $versionCheck));
|
||||||
$current = (string)config('firefly.version');
|
$current = (string)config('firefly.version');
|
||||||
$return = '';
|
$return = '';
|
||||||
|
$triggered = false;
|
||||||
if ($versionCheck === -2) {
|
if ($versionCheck === -2) {
|
||||||
Log::debug('-2, so give error.');
|
Log::debug('-2, so give error.');
|
||||||
$return = (string)trans('firefly.update_check_error');
|
$return = (string)trans('firefly.update_check_error');
|
||||||
|
$triggered = true;
|
||||||
}
|
}
|
||||||
if ($versionCheck === -1 && null !== $release) {
|
if ($versionCheck === -1 && null !== $release) {
|
||||||
|
$triggered = true;
|
||||||
Log::debug('New version!');
|
Log::debug('New version!');
|
||||||
// there is a new FF version!
|
// there is a new FF version!
|
||||||
// has it been released for at least three days?
|
// has it been released for at least three days?
|
||||||
$today = new Carbon;
|
$today = new Carbon;
|
||||||
$releaseDate = $release->getUpdated();
|
$releaseDate = $release->getUpdated();
|
||||||
if ($today->diffInDays($releaseDate, true) > 3) {
|
if ($today->diffInDays($releaseDate) > 3) {
|
||||||
Log::debug('New version is older than 3 days!');
|
Log::debug('New version is older than 3 days!');
|
||||||
$monthAndDayFormat = (string)trans('config.month_and_day');
|
$monthAndDayFormat = (string)trans('config.month_and_day');
|
||||||
$return = (string)trans(
|
$return = (string)trans(
|
||||||
@@ -106,16 +111,23 @@ trait UpdateTrait
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (0 === $versionCheck) {
|
if (0 === $versionCheck) {
|
||||||
|
$triggered = true;
|
||||||
Log::debug('User is running current version.');
|
Log::debug('User is running current version.');
|
||||||
// you are running the current version!
|
// you are running the current version!
|
||||||
$return = (string)trans('firefly.update_current_version_alert', ['version' => $current]);
|
$return = (string)trans('firefly.update_current_version_alert', ['version' => $current]);
|
||||||
}
|
}
|
||||||
if (1 === $versionCheck && null !== $release) {
|
if (1 === $versionCheck && null !== $release) {
|
||||||
|
$triggered = true;
|
||||||
Log::debug('User is running NEWER version.');
|
Log::debug('User is running NEWER version.');
|
||||||
// you are running a newer version!
|
// you are running a newer version!
|
||||||
$return = (string)trans('firefly.update_newer_version_alert', ['your_version' => $current, 'new_version' => $release->getTitle()]);
|
$return = (string)trans('firefly.update_newer_version_alert', ['your_version' => $current, 'new_version' => $release->getTitle()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (false === $triggered) {
|
||||||
|
Log::debug('No option was triggered.');
|
||||||
|
$return = (string)trans('firefly.update_check_error');
|
||||||
|
}
|
||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,6 +143,7 @@ trait UpdateTrait
|
|||||||
Log::debug('Now in versionCheck()');
|
Log::debug('Now in versionCheck()');
|
||||||
if (null === $release) {
|
if (null === $release) {
|
||||||
Log::debug('Release is null, return -2.');
|
Log::debug('Release is null, return -2.');
|
||||||
|
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
$current = (string)config('firefly.version');
|
$current = (string)config('firefly.version');
|
||||||
|
@@ -84,9 +84,9 @@ class CreateController extends Controller
|
|||||||
$loan = $this->repository->getAccountTypeByType(AccountType::LOAN);
|
$loan = $this->repository->getAccountTypeByType(AccountType::LOAN);
|
||||||
$mortgage = $this->repository->getAccountTypeByType(AccountType::MORTGAGE);
|
$mortgage = $this->repository->getAccountTypeByType(AccountType::MORTGAGE);
|
||||||
$liabilityTypes = [
|
$liabilityTypes = [
|
||||||
$debt->id => (string)trans('firefly.account_type_' . AccountType::DEBT),
|
$debt->id => (string)trans('firefly.account_type_' . AccountType::DEBT),
|
||||||
$loan->id => (string)trans('firefly.account_type_' . AccountType::LOAN),
|
$loan->id => (string)trans('firefly.account_type_' . AccountType::LOAN),
|
||||||
$mortgage->id => (string)trans('firefly.account_type_' . AccountType::MORTGAGE),
|
$mortgage->id => (string)trans('firefly.account_type_' . AccountType::MORTGAGE),
|
||||||
];
|
];
|
||||||
asort($liabilityTypes);
|
asort($liabilityTypes);
|
||||||
|
|
||||||
@@ -111,6 +111,7 @@ class CreateController extends Controller
|
|||||||
$this->rememberPreviousUri('accounts.create.uri');
|
$this->rememberPreviousUri('accounts.create.uri');
|
||||||
}
|
}
|
||||||
$request->session()->forget('accounts.create.fromStore');
|
$request->session()->forget('accounts.create.fromStore');
|
||||||
|
Log::channel('audit')->info('Create new account.');
|
||||||
|
|
||||||
return view('accounts.create', compact('subTitleIcon', 'what', 'interestPeriods', 'subTitle', 'roles', 'liabilityTypes'));
|
return view('accounts.create', compact('subTitleIcon', 'what', 'interestPeriods', 'subTitle', 'roles', 'liabilityTypes'));
|
||||||
}
|
}
|
||||||
@@ -131,7 +132,7 @@ class CreateController extends Controller
|
|||||||
$request->session()->flash('success', (string)trans('firefly.stored_new_account', ['name' => $account->name]));
|
$request->session()->flash('success', (string)trans('firefly.stored_new_account', ['name' => $account->name]));
|
||||||
app('preferences')->mark();
|
app('preferences')->mark();
|
||||||
|
|
||||||
|
Log::channel('audit')->info('Store new account.', $data);
|
||||||
|
|
||||||
// update preferences if necessary:
|
// update preferences if necessary:
|
||||||
$frontPage = app('preferences')->get('frontPageAccounts', [])->data;
|
$frontPage = app('preferences')->get('frontPageAccounts', [])->data;
|
||||||
|
@@ -91,9 +91,9 @@ class EditController extends Controller
|
|||||||
$loan = $this->repository->getAccountTypeByType(AccountType::LOAN);
|
$loan = $this->repository->getAccountTypeByType(AccountType::LOAN);
|
||||||
$mortgage = $this->repository->getAccountTypeByType(AccountType::MORTGAGE);
|
$mortgage = $this->repository->getAccountTypeByType(AccountType::MORTGAGE);
|
||||||
$liabilityTypes = [
|
$liabilityTypes = [
|
||||||
$debt->id => (string)trans('firefly.account_type_' . AccountType::DEBT),
|
$debt->id => (string)trans('firefly.account_type_' . AccountType::DEBT),
|
||||||
$loan->id => (string)trans('firefly.account_type_' . AccountType::LOAN),
|
$loan->id => (string)trans('firefly.account_type_' . AccountType::LOAN),
|
||||||
$mortgage->id => (string)trans('firefly.account_type_' . AccountType::MORTGAGE),
|
$mortgage->id => (string)trans('firefly.account_type_' . AccountType::MORTGAGE),
|
||||||
];
|
];
|
||||||
asort($liabilityTypes);
|
asort($liabilityTypes);
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user