mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-11 05:41:24 +00:00
Compare commits
157 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f090a9534f | ||
|
|
ad289bc8cd | ||
|
|
6f5b6e536d | ||
|
|
c810bad97c | ||
|
|
a172c51495 | ||
|
|
633c776ebf | ||
|
|
19bd295c71 | ||
|
|
3b39fb93e7 | ||
|
|
e3a338db0e | ||
|
|
02df24bbc9 | ||
|
|
4f6ba1e706 | ||
|
|
a1f57a0949 | ||
|
|
3d444eb833 | ||
|
|
57b2a8d459 | ||
|
|
8a06507003 | ||
|
|
04d7137dff | ||
|
|
a2be71499f | ||
|
|
effba42ac2 | ||
|
|
aea8603ca1 | ||
|
|
fdb2abdf92 | ||
|
|
4b1d66bcf6 | ||
|
|
248e393405 | ||
|
|
967ea6a181 | ||
|
|
a11f876c49 | ||
|
|
2a4051fe92 | ||
|
|
10737d10a5 | ||
|
|
6f75e0df3c | ||
|
|
24a2238134 | ||
|
|
c7931f2b72 | ||
|
|
852584b6a8 | ||
|
|
21a9e981a2 | ||
|
|
ecc37b2ed3 | ||
|
|
c0935e192d | ||
|
|
92a2404b61 | ||
|
|
d9a2bd3e5f | ||
|
|
22f110df8d | ||
|
|
c76337926b | ||
|
|
bf57dec07c | ||
|
|
10d760a614 | ||
|
|
7b813065da | ||
|
|
c218a12af7 | ||
|
|
98ae0efb16 | ||
|
|
98cff18efa | ||
|
|
a7b2fbbf10 | ||
|
|
ccc12171d6 | ||
|
|
525f69cf63 | ||
|
|
4d2c5c1b58 | ||
|
|
450d07580e | ||
|
|
246100f2b7 | ||
|
|
9974e0229d | ||
|
|
ad44f99dbf | ||
|
|
12a64fefc8 | ||
|
|
2ee8cbbae4 | ||
|
|
34c19b145c | ||
|
|
c5e047ea02 | ||
|
|
fc78c32fca | ||
|
|
b53cbbe469 | ||
|
|
1d4434698e | ||
|
|
6d1bfd3956 | ||
|
|
1974d5f1e3 | ||
|
|
c235e42d6c | ||
|
|
342985d52a | ||
|
|
c2296c3ad5 | ||
|
|
23479790fe | ||
|
|
44823c6fec | ||
|
|
acfdf7dc90 | ||
|
|
6038a68ba9 | ||
|
|
79cf61b653 | ||
|
|
b97d3d3627 | ||
|
|
7f887e294a | ||
|
|
6f78735bc5 | ||
|
|
3e242aaca6 | ||
|
|
0796e422d4 | ||
|
|
fbd7c9ae07 | ||
|
|
5cfb1b63dc | ||
|
|
f09d0e87e4 | ||
|
|
820358af73 | ||
|
|
5a2998c80e | ||
|
|
a32df0066e | ||
|
|
02db333d46 | ||
|
|
070f46c755 | ||
|
|
b4a732bf77 | ||
|
|
d8eb59736e | ||
|
|
41c15b0cf8 | ||
|
|
fdf99400bc | ||
|
|
1ba45afeab | ||
|
|
1819ece55d | ||
|
|
78335210db | ||
|
|
ca23bb6272 | ||
|
|
eed84e18bb | ||
|
|
12641f96b1 | ||
|
|
1b97c4d58f | ||
|
|
ee3a2ef41c | ||
|
|
084ceb0c4e | ||
|
|
2497c4ee5c | ||
|
|
757a118f87 | ||
|
|
97908932e6 | ||
|
|
4c73ad8306 | ||
|
|
10a2078661 | ||
|
|
3fb09136cf | ||
|
|
843cced454 | ||
|
|
71a501868f | ||
|
|
0a0ad8200a | ||
|
|
a9baf54b12 | ||
|
|
ed565136fc | ||
|
|
4719b87314 | ||
|
|
24b30af018 | ||
|
|
e9f4695355 | ||
|
|
5b969fa014 | ||
|
|
499e713683 | ||
|
|
5eadb51b78 | ||
|
|
713a962005 | ||
|
|
d96e77a3ec | ||
|
|
bc68c367c8 | ||
|
|
33e241d39a | ||
|
|
e67812bf64 | ||
|
|
1090ce6597 | ||
|
|
e358f19548 | ||
|
|
eac406d62d | ||
|
|
142a488ab3 | ||
|
|
893c83e086 | ||
|
|
76dad84ba6 | ||
|
|
6e78d4efa7 | ||
|
|
66ffbf9e47 | ||
|
|
c499899988 | ||
|
|
77ea246fc3 | ||
|
|
80f9896f2a | ||
|
|
90c60e55f7 | ||
|
|
b085ee3437 | ||
|
|
3b3f24fe56 | ||
|
|
1d2c834b2c | ||
|
|
cc243f9fb7 | ||
|
|
788bde5562 | ||
|
|
f67a9547cc | ||
|
|
8545d73119 | ||
|
|
c4964cf603 | ||
|
|
903b4e520c | ||
|
|
c0033ae56b | ||
|
|
3daddd690f | ||
|
|
0d9bae6ec2 | ||
|
|
6e2978231b | ||
|
|
0097c66522 | ||
|
|
93f1854be0 | ||
|
|
b7f3c53688 | ||
|
|
94b8bb8f66 | ||
|
|
edb038c822 | ||
|
|
b6a9204c4f | ||
|
|
1d1b335cac | ||
|
|
0516065f5a | ||
|
|
606f33ceeb | ||
|
|
cb1db06a7c | ||
|
|
7b0ccdbdb4 | ||
|
|
55cf9fa9d0 | ||
|
|
b3156e9798 | ||
|
|
8e51b3edef | ||
|
|
6f8b1f3b9d | ||
|
|
3b81b7a904 |
@@ -70,7 +70,7 @@ php artisan firefly-iii:cc-liabilities
|
||||
php artisan firefly-iii:back-to-journals
|
||||
php artisan firefly-iii:rename-account-meta
|
||||
|
||||
# there are 13 verify commands
|
||||
# there are 14 verify commands
|
||||
php artisan firefly-iii:fix-piggies
|
||||
php artisan firefly-iii:create-link-types
|
||||
php artisan firefly-iii:create-access-tokens
|
||||
@@ -80,10 +80,11 @@ php artisan firefly-iii:fix-transfer-budgets
|
||||
php artisan firefly-iii:fix-uneven-amount
|
||||
php artisan firefly-iii:delete-zero-amount
|
||||
php artisan firefly-iii:delete-orphaned-transactions
|
||||
php artisan firefly-iii:delete-empty-journals
|
||||
php artisan firefly-iii:delete-empty-journals
|
||||
php artisan firefly-iii:delete-empty-groups
|
||||
php artisan firefly-iii:fix-account-types
|
||||
php artisan firefly-iii:rename-meta-fields
|
||||
php artisan firefly-iii:fix-ob-currencies
|
||||
|
||||
# report commands
|
||||
php artisan firefly-iii:report-empty-objects
|
||||
|
||||
@@ -40,6 +40,7 @@ APP_LOG_LEVEL=notice
|
||||
# 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=mysql
|
||||
# If you use DOCKER COMPOSE, change this variable to "firefly_iii_db"
|
||||
DB_HOST=127.0.0.1
|
||||
DB_PORT=3306
|
||||
DB_DATABASE=homestead
|
||||
|
||||
12
.github/ranger.yml
vendored
12
.github/ranger.yml
vendored
@@ -1,6 +1,8 @@
|
||||
# in .github/ranger.yml
|
||||
comments:
|
||||
- action: delete_comment
|
||||
pattern: +1
|
||||
- action: delete_comment
|
||||
pattern: ":+1:"
|
||||
comments:
|
||||
-
|
||||
action: delete_comment
|
||||
pattern: 1
|
||||
-
|
||||
action: delete_comment
|
||||
pattern: ":+1:"
|
||||
|
||||
@@ -1,3 +1,62 @@
|
||||
# 4.8.0.3 (API 0.10.1)
|
||||
|
||||
- #2438 Some balance issues when working with multiple currencies (a known issue)
|
||||
- #2425 Transaction edit/create form is weird with the enter button
|
||||
- #2424 auto complete tab doesn't work.
|
||||
- #2441 Inconsistent character limit for currencies.
|
||||
- #2443 500 error when submitting budgets
|
||||
- #2446 Can't update current amount for piggy bank
|
||||
- #2440 Errors when interacting with recurring transactions
|
||||
- #2439 SQL error in API post new user
|
||||
- Transaction report (after import, over email) is mostly empty
|
||||
- Mass edit checkboxes doesn't work in a tag overview
|
||||
- #2437 CPU issues when viewing accounts, probably run-away queries.
|
||||
- #2432 Can't disable all currencies except one / can't disable EUR and switch to something else.
|
||||
- Option to edit the budget is gone from edit transaction form.
|
||||
- #2453 Search view things
|
||||
- #2449 Can't add invoice date.
|
||||
- #2448 Bad link in transaction overview
|
||||
- #2447 Bad link in bill overview
|
||||
- Improvements to various API end-points. Docs are updated.
|
||||
|
||||
# 4.8.0.2 (API 0.10.0)
|
||||
|
||||
- [Issue 2203](https://github.com/firefly-iii/firefly-iii/issues/2203) Reconciliation inconsistencies.
|
||||
- [Issue 2392](https://github.com/firefly-iii/firefly-iii/issues/2392) Bad namespace leads to installation errors.
|
||||
- [Issue 2393](https://github.com/firefly-iii/firefly-iii/issues/2393) Missing budget selector.
|
||||
- [Issue 2402](https://github.com/firefly-iii/firefly-iii/issues/2402) bad amounts in default report
|
||||
- [Issue 2405](https://github.com/firefly-iii/firefly-iii/issues/2405) Due date can't be edited.
|
||||
- [Issue 2404](https://github.com/firefly-iii/firefly-iii/issues/2404) bad page indicator in the "no category" transaction overview.
|
||||
- [Issue 2407](https://github.com/firefly-iii/firefly-iii/issues/2407) Fix recurring transaction dates
|
||||
- [Issue 2410](https://github.com/firefly-iii/firefly-iii/issues/2410) Transaction links inconsistent
|
||||
- [Issue 2414](https://github.com/firefly-iii/firefly-iii/issues/2414) Can't edit recurring transactions
|
||||
- [Issue 2415](https://github.com/firefly-iii/firefly-iii/issues/2415) Return here + reset form results in empty transaction form
|
||||
- [Issue 2416](https://github.com/firefly-iii/firefly-iii/issues/2416) Some form inconsistencies.
|
||||
- [Issue 2418](https://github.com/firefly-iii/firefly-iii/issues/2418) Reports are inaccurate or broken.
|
||||
- [Issue 2422](https://github.com/firefly-iii/firefly-iii/issues/2422) PHP error when matching transactions.
|
||||
- [Issue 2423](https://github.com/firefly-iii/firefly-iii/issues/2423) Reports are inaccurate or broken.
|
||||
- [Issue 2426](https://github.com/firefly-iii/firefly-iii/issues/2426) Inconsistent documentation and instructions.
|
||||
- [Issue 2427](https://github.com/firefly-iii/firefly-iii/issues/2427) Deleted account and "initial balance" accounts may appear in dropdowns.
|
||||
- [Issue 2428](https://github.com/firefly-iii/firefly-iii/issues/2428) Reports are inaccurate or broken.
|
||||
- [Issue 2429](https://github.com/firefly-iii/firefly-iii/issues/2429) Typo leads to SQL errors in available budgets API
|
||||
- [Issue 2431](https://github.com/firefly-iii/firefly-iii/issues/2431) Issues creating new recurring transactions.
|
||||
- [Issue 2434](https://github.com/firefly-iii/firefly-iii/issues/2434) You can edit the initial balance transaction but it fails to save.
|
||||
- ARM build should work now.
|
||||
|
||||
# 4.8.0.1 (API 0.10.0)
|
||||
|
||||
- The balance box on the dashboard shows only negative numbers, skewing the results.
|
||||
- Selecting or using tags in new transactions results in an error.
|
||||
- Editing a transaction with tags will drop the tags from the transaction.
|
||||
- [Issue 2382](https://github.com/firefly-iii/firefly-iii/issues/2382) Ranger config
|
||||
- [Issue 2384](https://github.com/firefly-iii/firefly-iii/issues/2384) When upgrading manually, you may see: `The command "generate-keys" does not exist.`
|
||||
- [Issue 2385](https://github.com/firefly-iii/firefly-iii/issues/2385) When upgrading manually, the firefly:verify command may fail to run.
|
||||
- [Issue 2388](https://github.com/firefly-iii/firefly-iii/issues/2388) When registering as a new user, leaving the opening balance at 0 will give you an error.
|
||||
- [Issue 2395](https://github.com/firefly-iii/firefly-iii/issues/2395) Editing split transactions is broken.
|
||||
- [Issue 2397](https://github.com/firefly-iii/firefly-iii/issues/2397) Transfers are stored the wrong way around.
|
||||
- [Issue 2399](https://github.com/firefly-iii/firefly-iii/issues/2399) Not all account balances are updated after you create a new transaction.
|
||||
- [Issue 2401](https://github.com/firefly-iii/firefly-iii/issues/2401) Could not delete a split from a split transaction.
|
||||
|
||||
# 4.8.0 (API 0.10.0)
|
||||
|
||||
- Hungarian translation!
|
||||
|
||||
@@ -15,8 +15,8 @@ const pkgdef :Spk.PackageDefinition = (
|
||||
|
||||
manifest = (
|
||||
appTitle = (defaultText = "Firefly III"),
|
||||
appVersion = 32,
|
||||
appMarketingVersion = (defaultText = "4.7.17.6"),
|
||||
appVersion = 35,
|
||||
appMarketingVersion = (defaultText = "4.8.0.3"),
|
||||
|
||||
actions = [
|
||||
# Define your "new document" handlers here.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
sudo: required
|
||||
language: bash
|
||||
env:
|
||||
- VERSION=4.8.0
|
||||
- VERSION=4.8.0.3
|
||||
|
||||
dist: xenial
|
||||
|
||||
@@ -26,4 +26,4 @@ script:
|
||||
# build everything
|
||||
- .deploy/docker/build-amd64.sh
|
||||
- .deploy/docker/build-arm.sh
|
||||
- .deploy/docker/manifest.sh
|
||||
- .deploy/docker/manifest.sh
|
||||
|
||||
39
Dockerfile
39
Dockerfile
@@ -1,36 +1,10 @@
|
||||
FROM php:7.2-apache
|
||||
FROM jc5x/firefly-iii-base-image:latest
|
||||
ENV FIREFLY_PATH=/var/www/firefly-iii COMPOSER_ALLOW_SUPERUSER=1
|
||||
LABEL version="1.4" maintainer="thegrumpydictator@gmail.com"
|
||||
LABEL version="1.5" maintainer="thegrumpydictator@gmail.com"
|
||||
|
||||
# Create volumes
|
||||
VOLUME $FIREFLY_PATH/storage/export $FIREFLY_PATH/storage/upload
|
||||
|
||||
# Install stuff Firefly III runs with & depends on: php extensions, locales, dev headers and composer
|
||||
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/*
|
||||
|
||||
RUN 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 && \
|
||||
a2enmod rewrite && a2enmod ssl && \
|
||||
echo "hu_HU.UTF-8 UTF-8\nro_RO.UTF-8 UTF-8\nnb_NO.UTF-8 UTF-8\nde_DE.UTF-8 UTF-8\ncs_CZ.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 && \
|
||||
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
||||
|
||||
# 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
|
||||
|
||||
# Copy in Firefly III source
|
||||
WORKDIR $FIREFLY_PATH
|
||||
ADD . $FIREFLY_PATH
|
||||
@@ -40,15 +14,6 @@ RUN chown -R www-data:www-data /var/www && \
|
||||
chmod -R 775 $FIREFLY_PATH/storage && \
|
||||
composer install --prefer-dist --no-dev --no-scripts --no-suggest
|
||||
|
||||
# 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
|
||||
|
||||
# Expose port 80
|
||||
EXPOSE 80
|
||||
|
||||
|
||||
@@ -1,37 +1,10 @@
|
||||
FROM php:7.2-apache
|
||||
ARG ARCH
|
||||
FROM jc5x/firefly-iii-base-image:latest
|
||||
ENV FIREFLY_PATH=/var/www/firefly-iii COMPOSER_ALLOW_SUPERUSER=1
|
||||
LABEL version="1.4" maintainer="thegrumpydictator@gmail.com"
|
||||
LABEL version="1.5" maintainer="thegrumpydictator@gmail.com"
|
||||
|
||||
# Create volumes
|
||||
VOLUME $FIREFLY_PATH/storage/export $FIREFLY_PATH/storage/upload
|
||||
|
||||
# Install stuff Firefly III runs with & depends on: php extensions, locales, dev headers and composer
|
||||
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/*
|
||||
|
||||
RUN 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 && \
|
||||
a2enmod rewrite && a2enmod ssl && \
|
||||
echo "hu_HU.UTF-8 UTF-8\nro_RO.UTF-8 UTF-8\nnb_NO.UTF-8 UTF-8\nde_DE.UTF-8 UTF-8\ncs_CZ.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 && \
|
||||
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
||||
|
||||
# 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
|
||||
|
||||
# Copy in Firefly III source
|
||||
WORKDIR $FIREFLY_PATH
|
||||
ADD . $FIREFLY_PATH
|
||||
@@ -41,15 +14,6 @@ RUN chown -R www-data:www-data /var/www && \
|
||||
chmod -R 775 $FIREFLY_PATH/storage && \
|
||||
composer install --prefer-dist --no-dev --no-scripts --no-suggest
|
||||
|
||||
# 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
|
||||
|
||||
# Expose port 80
|
||||
EXPOSE 80
|
||||
|
||||
|
||||
@@ -1,38 +1,10 @@
|
||||
FROM arm32v7/php:7.2.8-apache-stretch
|
||||
ARG ARCH
|
||||
COPY tmp/qemu-arm-static /usr/bin/qemu-arm-static
|
||||
FROM jc5x/firefly-iii-base-image:latest
|
||||
ENV FIREFLY_PATH=/var/www/firefly-iii COMPOSER_ALLOW_SUPERUSER=1
|
||||
LABEL version="1.4" maintainer="thegrumpydictator@gmail.com"
|
||||
LABEL version="1.5" maintainer="thegrumpydictator@gmail.com"
|
||||
|
||||
# Create volumes
|
||||
VOLUME $FIREFLY_PATH/storage/export $FIREFLY_PATH/storage/upload
|
||||
|
||||
# Install stuff Firefly III runs with & depends on: php extensions, locales, dev headers and composer
|
||||
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/*
|
||||
|
||||
RUN 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 && \
|
||||
a2enmod rewrite && a2enmod ssl && \
|
||||
echo "hu_HU.UTF-8 UTF-8\nro_RO.UTF-8 UTF-8\nnb_NO.UTF-8 UTF-8\nde_DE.UTF-8 UTF-8\ncs_CZ.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 && \
|
||||
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
||||
|
||||
# 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
|
||||
|
||||
# Copy in Firefly III source
|
||||
WORKDIR $FIREFLY_PATH
|
||||
ADD . $FIREFLY_PATH
|
||||
@@ -42,15 +14,6 @@ RUN chown -R www-data:www-data /var/www && \
|
||||
chmod -R 775 $FIREFLY_PATH/storage && \
|
||||
composer install --prefer-dist --no-dev --no-scripts --no-suggest
|
||||
|
||||
# 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
|
||||
|
||||
# Expose port 80
|
||||
EXPOSE 80
|
||||
|
||||
|
||||
@@ -1,37 +1,24 @@
|
||||
FROM arm32v7/php:7.2.8-apache-stretch
|
||||
FROM arm32v7/php:7.2-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"
|
||||
LABEL version="1.5" maintainer="thegrumpydictator@gmail.com"
|
||||
|
||||
# Create volumes
|
||||
VOLUME $FIREFLY_PATH/storage/export $FIREFLY_PATH/storage/upload
|
||||
|
||||
# Install stuff Firefly III runs with & depends on: php extensions, locales, dev headers and composer
|
||||
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/*
|
||||
RUN apt-get update && apt-get install -y locales unzip && apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN 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 && \
|
||||
a2enmod rewrite && a2enmod ssl && \
|
||||
echo "hu_HU.UTF-8 UTF-8\nro_RO.UTF-8 UTF-8\nnb_NO.UTF-8 UTF-8\nde_DE.UTF-8 UTF-8\ncs_CZ.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 && \
|
||||
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
||||
ADD https://raw.githubusercontent.com/mlocati/docker-php-extension-installer/master/install-php-extensions /usr/local/bin/
|
||||
|
||||
# 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
|
||||
RUN chmod uga+x /usr/local/bin/install-php-extensions && sync && \
|
||||
install-php-extensions --cleanup bcmath ldap gd pdo_pgsql pdo_sqlite pdo_mysql intl opcache memcached
|
||||
|
||||
RUN a2enmod rewrite && a2enmod ssl
|
||||
RUN echo "hu_HU.UTF-8 UTF-8\nro_RO.UTF-8 UTF-8\nnb_NO.UTF-8 UTF-8\nde_DE.UTF-8 UTF-8\ncs_CZ.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
|
||||
RUN locale-gen
|
||||
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
||||
|
||||
# Copy in Firefly III source
|
||||
WORKDIR $FIREFLY_PATH
|
||||
|
||||
@@ -47,7 +47,7 @@ use League\Fractal\Serializer\JsonApiSerializer;
|
||||
/**
|
||||
* Class AccountController.
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||
*
|
||||
*/
|
||||
class AccountController extends Controller
|
||||
{
|
||||
@@ -234,8 +234,6 @@ class AccountController extends Controller
|
||||
*
|
||||
* @return JsonResponse
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
||||
*/
|
||||
public function transactions(Request $request, Account $account): JsonResponse
|
||||
{
|
||||
|
||||
@@ -23,7 +23,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Controllers;
|
||||
|
||||
use FireflyIII\Api\V1\Requests\AttachmentRequest;
|
||||
use FireflyIII\Api\V1\Requests\AttachmentStoreRequest;
|
||||
use FireflyIII\Api\V1\Requests\AttachmentUpdateRequest;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Helpers\Attachments\AttachmentHelperInterface;
|
||||
use FireflyIII\Models\Attachment;
|
||||
@@ -44,7 +45,7 @@ use function strlen;
|
||||
/**
|
||||
* Class AttachmentController.
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||
*
|
||||
*/
|
||||
class AttachmentController extends Controller
|
||||
{
|
||||
@@ -182,12 +183,12 @@ class AttachmentController extends Controller
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param AttachmentRequest $request
|
||||
* @param AttachmentStoreRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function store(AttachmentRequest $request): JsonResponse
|
||||
public function store(AttachmentStoreRequest $request): JsonResponse
|
||||
{
|
||||
$data = $request->getAll();
|
||||
$attachment = $this->repository->store($data);
|
||||
@@ -207,12 +208,12 @@ class AttachmentController extends Controller
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param AttachmentRequest $request
|
||||
* @param AttachmentUpdateRequest $request
|
||||
* @param Attachment $attachment
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function update(AttachmentRequest $request, Attachment $attachment): JsonResponse
|
||||
public function update(AttachmentUpdateRequest $request, Attachment $attachment): JsonResponse
|
||||
{
|
||||
$data = $request->getAll();
|
||||
$this->repository->update($attachment, $data);
|
||||
|
||||
@@ -42,7 +42,7 @@ use League\Fractal\Serializer\JsonApiSerializer;
|
||||
/**
|
||||
* Class AvailableBudgetController.
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||
*
|
||||
*/
|
||||
class AvailableBudgetController extends Controller
|
||||
{
|
||||
|
||||
@@ -48,7 +48,7 @@ use League\Fractal\Serializer\JsonApiSerializer;
|
||||
/**
|
||||
* Class BillController.
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||
*
|
||||
*/
|
||||
class BillController extends Controller
|
||||
{
|
||||
|
||||
@@ -47,7 +47,7 @@ use League\Fractal\Serializer\JsonApiSerializer;
|
||||
/**
|
||||
* Class BudgetController.
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||
*
|
||||
*/
|
||||
class BudgetController extends Controller
|
||||
{
|
||||
@@ -79,8 +79,6 @@ class BudgetController extends Controller
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Budget $budget
|
||||
*
|
||||
|
||||
@@ -46,7 +46,7 @@ use League\Fractal\Serializer\JsonApiSerializer;
|
||||
/**
|
||||
* Class BudgetLimitController.
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||
*
|
||||
*/
|
||||
class BudgetLimitController extends Controller
|
||||
{
|
||||
|
||||
@@ -44,7 +44,7 @@ use League\Fractal\Serializer\JsonApiSerializer;
|
||||
/**
|
||||
* Class CategoryController.
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||
*
|
||||
*/
|
||||
class CategoryController extends Controller
|
||||
{
|
||||
|
||||
@@ -65,7 +65,7 @@ class CategoryController extends Controller
|
||||
*
|
||||
* @return JsonResponse
|
||||
*
|
||||
* TODO after 4.8.0, simplify
|
||||
* TODO after 4.8,0, simplify
|
||||
*/
|
||||
public function overview(DateRequest $request): JsonResponse
|
||||
{
|
||||
|
||||
@@ -37,7 +37,7 @@ use Symfony\Component\HttpFoundation\ParameterBag;
|
||||
* Class Controller.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* @SuppressWarnings(PHPMD.NumberOfChildren)
|
||||
*
|
||||
*/
|
||||
class Controller extends BaseController
|
||||
{
|
||||
|
||||
@@ -66,7 +66,7 @@ use League\Fractal\Serializer\JsonApiSerializer;
|
||||
/**
|
||||
* Class CurrencyController.
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||
*
|
||||
*/
|
||||
class CurrencyController extends Controller
|
||||
{
|
||||
|
||||
@@ -45,7 +45,7 @@ use League\Fractal\Serializer\JsonApiSerializer;
|
||||
/**
|
||||
* Class LinkTypeController.
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||
*
|
||||
*/
|
||||
class LinkTypeController extends Controller
|
||||
{
|
||||
|
||||
@@ -42,7 +42,7 @@ use League\Fractal\Serializer\JsonApiSerializer;
|
||||
/**
|
||||
* Class PiggyBankController.
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||
*
|
||||
*/
|
||||
class PiggyBankController extends Controller
|
||||
{
|
||||
@@ -226,7 +226,14 @@ class PiggyBankController extends Controller
|
||||
*/
|
||||
public function update(PiggyBankRequest $request, PiggyBank $piggyBank): JsonResponse
|
||||
{
|
||||
$piggyBank = $this->repository->update($piggyBank, $request->getAll());
|
||||
$data = $request->getAll();
|
||||
$piggyBank = $this->repository->update($piggyBank, $data);
|
||||
|
||||
if ('' !== $data['current_amount']) {
|
||||
$this->repository->setCurrentAmount($piggyBank, $data['current_amount']);
|
||||
}
|
||||
|
||||
|
||||
$manager = new Manager();
|
||||
$baseUrl = $request->getSchemeAndHttpHost() . '/api/v1';
|
||||
$manager->setSerializer(new JsonApiSerializer($baseUrl));
|
||||
|
||||
@@ -48,7 +48,7 @@ use Log;
|
||||
|
||||
/**
|
||||
* Class RuleController
|
||||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||
*
|
||||
*/
|
||||
class RuleController extends Controller
|
||||
{
|
||||
|
||||
@@ -231,7 +231,7 @@ class RuleGroupController extends Controller
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||
*
|
||||
*/
|
||||
public function testGroup(RuleGroupTestRequest $request, RuleGroup $group): JsonResponse
|
||||
{
|
||||
|
||||
@@ -32,6 +32,7 @@ use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Helpers\Collector\GroupCollectorInterface;
|
||||
use FireflyIII\Models\TransactionGroup;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Repositories\Journal\JournalAPIRepositoryInterface;
|
||||
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||
use FireflyIII\Repositories\TransactionGroup\TransactionGroupRepositoryInterface;
|
||||
use FireflyIII\Support\Http\Api\TransactionFilter;
|
||||
@@ -61,6 +62,9 @@ class TransactionController extends Controller
|
||||
/** @var JournalRepositoryInterface The journal repository */
|
||||
private $repository;
|
||||
|
||||
/** @var JournalAPIRepositoryInterface Journal API repos */
|
||||
private $journalAPIRepository;
|
||||
|
||||
/**
|
||||
* TransactionController constructor.
|
||||
*
|
||||
@@ -74,10 +78,12 @@ class TransactionController extends Controller
|
||||
/** @var User $admin */
|
||||
$admin = auth()->user();
|
||||
|
||||
$this->repository = app(JournalRepositoryInterface::class);
|
||||
$this->groupRepository = app(TransactionGroupRepositoryInterface::class);
|
||||
$this->repository = app(JournalRepositoryInterface::class);
|
||||
$this->groupRepository = app(TransactionGroupRepositoryInterface::class);
|
||||
$this->journalAPIRepository = app(JournalAPIRepositoryInterface::class);
|
||||
$this->repository->setUser($admin);
|
||||
$this->groupRepository->setUser($admin);
|
||||
$this->journalAPIRepository->setUser($admin);
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
@@ -97,7 +103,7 @@ class TransactionController extends Controller
|
||||
$baseUrl = $request->getSchemeAndHttpHost() . '/api/v1';
|
||||
$manager->setSerializer(new JsonApiSerializer($baseUrl));
|
||||
|
||||
$attachments = $this->repository->getAttachments($transactionJournal);
|
||||
$attachments = $this->journalAPIRepository->getAttachments($transactionJournal);
|
||||
|
||||
/** @var AttachmentTransformer $transformer */
|
||||
$transformer = app(AttachmentTransformer::class);
|
||||
@@ -206,7 +212,7 @@ class TransactionController extends Controller
|
||||
$baseUrl = $request->getSchemeAndHttpHost() . '/api/v1';
|
||||
$manager->setSerializer(new JsonApiSerializer($baseUrl));
|
||||
|
||||
$events = $this->repository->getPiggyBankEvents($transactionJournal);
|
||||
$events = $this->journalAPIRepository->getPiggyBankEvents($transactionJournal);
|
||||
|
||||
/** @var PiggyBankEventTransformer $transformer */
|
||||
$transformer = app(PiggyBankEventTransformer::class);
|
||||
|
||||
@@ -24,7 +24,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Controllers;
|
||||
|
||||
use FireflyIII\Api\V1\Requests\UserRequest;
|
||||
use FireflyIII\Api\V1\Requests\UserStoreRequest;
|
||||
use FireflyIII\Api\V1\Requests\UserUpdateRequest;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
||||
use FireflyIII\Transformers\UserTransformer;
|
||||
@@ -42,7 +43,7 @@ use League\Fractal\Serializer\JsonApiSerializer;
|
||||
/**
|
||||
* Class UserController.
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||
*
|
||||
*/
|
||||
class UserController extends Controller
|
||||
{
|
||||
@@ -155,11 +156,11 @@ class UserController extends Controller
|
||||
/**
|
||||
* Store a new user.
|
||||
*
|
||||
* @param UserRequest $request
|
||||
* @param UserStoreRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function store(UserRequest $request): JsonResponse
|
||||
public function store(UserStoreRequest $request): JsonResponse
|
||||
{
|
||||
$data = $request->getAll();
|
||||
$user = $this->repository->store($data);
|
||||
@@ -183,12 +184,12 @@ class UserController extends Controller
|
||||
/**
|
||||
* Update a user.
|
||||
*
|
||||
* @param UserRequest $request
|
||||
* @param UserUpdateRequest $request
|
||||
* @param User $user
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function update(UserRequest $request, User $user): JsonResponse
|
||||
public function update(UserUpdateRequest $request, User $user): JsonResponse
|
||||
{
|
||||
$data = $request->getAll();
|
||||
$user = $this->repository->update($user, $data);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* AttachmentRequest.php
|
||||
* Copyright (c) 2018 thegrumpydictator@gmail.com
|
||||
* AttachmentStoreRequest.php
|
||||
* Copyright (c) 2019 thegrumpydictator@gmail.com
|
||||
*
|
||||
* This file is part of Firefly III.
|
||||
*
|
||||
@@ -29,11 +29,10 @@ use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Rules\IsValidAttachmentModel;
|
||||
|
||||
/**
|
||||
* Class AttachmentRequest
|
||||
* Class AttachmentStoreRequest
|
||||
* @codeCoverageIgnore
|
||||
* TODO AFTER 4.8.0: split this into two request classes.
|
||||
*/
|
||||
class AttachmentRequest extends Request
|
||||
class AttachmentStoreRequest extends Request
|
||||
{
|
||||
/**
|
||||
* Authorize logged in users.
|
||||
@@ -78,23 +77,12 @@ class AttachmentRequest extends Request
|
||||
]
|
||||
);
|
||||
$model = $this->string('model');
|
||||
$rules = [
|
||||
return [
|
||||
'filename' => 'required|between:1,255',
|
||||
'title' => 'between:1,255',
|
||||
'notes' => 'between:1,65000',
|
||||
'model' => sprintf('required|in:%s', $models),
|
||||
'model_id' => ['required', 'numeric', new IsValidAttachmentModel($model)],
|
||||
];
|
||||
switch ($this->method()) {
|
||||
default:
|
||||
break;
|
||||
case 'PUT':
|
||||
case 'PATCH':
|
||||
unset($rules['model'], $rules['model_id']);
|
||||
$rules['filename'] = 'between:1,255';
|
||||
break;
|
||||
}
|
||||
|
||||
return $rules;
|
||||
}
|
||||
}
|
||||
73
app/Api/V1/Requests/AttachmentUpdateRequest.php
Normal file
73
app/Api/V1/Requests/AttachmentUpdateRequest.php
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
/**
|
||||
* AttachmentUpdateRequest.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\Api\V1\Requests;
|
||||
|
||||
/**
|
||||
* ClassAttachmentUpdateRequest
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class AttachmentUpdateRequest extends Request
|
||||
{
|
||||
/**
|
||||
* Authorize logged in users.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
// Only allow authenticated users
|
||||
return auth()->check();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all data from the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getAll(): array
|
||||
{
|
||||
return [
|
||||
'filename' => $this->string('filename'),
|
||||
'title' => $this->string('title'),
|
||||
'notes' => $this->string('notes'),
|
||||
'model' => $this->string('model'),
|
||||
'model_id' => $this->integer('model_id'),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* The rules that the incoming request must be matched against.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'filename' => 'between:1,255',
|
||||
'title' => 'between:1,255',
|
||||
'notes' => 'between:1,65000',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -30,7 +30,7 @@ use Illuminate\Validation\Validator;
|
||||
/**
|
||||
* Class BillRequest
|
||||
*
|
||||
* TODO AFTER 4.8.0: split this into two request classes.
|
||||
* TODO AFTER 4.8,0: split this into two request classes.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace FireflyIII\Api\V1\Requests;
|
||||
* Class BudgetLimitRequest
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* TODO AFTER 4.8.0: split this into two request classes.
|
||||
* TODO AFTER 4.8,0: split this into two request classes.
|
||||
*/
|
||||
class BudgetLimitRequest extends Request
|
||||
{
|
||||
|
||||
@@ -29,7 +29,7 @@ use FireflyIII\Rules\IsBoolean;
|
||||
/**
|
||||
* Class BudgetRequest
|
||||
* @codeCoverageIgnore
|
||||
* TODO AFTER 4.8.0: split this into two request classes.
|
||||
* TODO AFTER 4.8,0: split this into two request classes.
|
||||
*/
|
||||
class BudgetRequest extends Request
|
||||
{
|
||||
|
||||
@@ -28,7 +28,7 @@ use FireflyIII\Models\Category;
|
||||
/**
|
||||
* Class CategoryRequest
|
||||
* @codeCoverageIgnore
|
||||
* TODO AFTER 4.8.0: split this into two request classes.
|
||||
* TODO AFTER 4.8,0: split this into two request classes.
|
||||
*/
|
||||
class CategoryRequest extends Request
|
||||
{
|
||||
|
||||
@@ -29,7 +29,7 @@ use FireflyIII\Rules\IsBoolean;
|
||||
/**
|
||||
* Class CurrencyRequest
|
||||
* @codeCoverageIgnore
|
||||
* TODO AFTER 4.8.0: split this into two request classes.
|
||||
* TODO AFTER 4.8,0: split this into two request classes.
|
||||
*/
|
||||
class CurrencyRequest extends Request
|
||||
{
|
||||
@@ -80,7 +80,7 @@ class CurrencyRequest extends Request
|
||||
$rules = [
|
||||
'name' => 'required|between:1,255|unique:transaction_currencies,name',
|
||||
'code' => 'required|between:3,3|unique:transaction_currencies,code',
|
||||
'symbol' => 'required|between:1,5|unique:transaction_currencies,symbol',
|
||||
'symbol' => 'required|between:1,8|unique:transaction_currencies,symbol',
|
||||
'decimal_places' => 'between:0,20|numeric|min:0|max:20',
|
||||
'enabled' => [new IsBoolean()],
|
||||
'default' => [new IsBoolean()],
|
||||
@@ -94,8 +94,8 @@ class CurrencyRequest extends Request
|
||||
case 'PATCH':
|
||||
$currency = $this->route()->parameter('currency_code');
|
||||
$rules['name'] = 'required|between:1,255|unique:transaction_currencies,name,' . $currency->id;
|
||||
$rules['code'] = 'required|between:1,255|unique:transaction_currencies,code,' . $currency->id;
|
||||
$rules['symbol'] = 'required|between:1,255|unique:transaction_currencies,symbol,' . $currency->id;
|
||||
$rules['code'] = 'required|between:3,3|unique:transaction_currencies,code,' . $currency->id;
|
||||
$rules['symbol'] = 'required|between:1,8|unique:transaction_currencies,symbol,' . $currency->id;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* DateRequest.php
|
||||
* Copyright (c) 2019 thegrumpydictator@gmail.com
|
||||
@@ -19,6 +20,8 @@
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Requests;
|
||||
|
||||
|
||||
@@ -65,4 +68,4 @@ class DateRequest extends Request
|
||||
'end' => 'required|date|after:start',
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ use Illuminate\Validation\Rule;
|
||||
*
|
||||
* Class LinkTypeRequest
|
||||
* @codeCoverageIgnore
|
||||
* TODO AFTER 4.8.0: split this into two request classes.
|
||||
* TODO AFTER 4.8,0: split this into two request classes.
|
||||
*/
|
||||
class LinkTypeRequest extends Request
|
||||
{
|
||||
|
||||
@@ -25,13 +25,14 @@ namespace FireflyIII\Api\V1\Requests;
|
||||
|
||||
use FireflyIII\Models\PiggyBank;
|
||||
use FireflyIII\Rules\IsAssetAccountId;
|
||||
use FireflyIII\Rules\LessThanPiggyTarget;
|
||||
use FireflyIII\Rules\ZeroOrMore;
|
||||
|
||||
/**
|
||||
*
|
||||
* Class PiggyBankRequest
|
||||
* @codeCoverageIgnore
|
||||
* TODO AFTER 4.8.0: split this into two request classes.
|
||||
* TODO AFTER 4.8,0: split this into two request classes.
|
||||
*/
|
||||
class PiggyBankRequest extends Request
|
||||
{
|
||||
@@ -53,14 +54,11 @@ class PiggyBankRequest extends Request
|
||||
*/
|
||||
public function getAll(): array
|
||||
{
|
||||
$current = $this->string('current_amount');
|
||||
$current = '' === $current ? '0' : $current;
|
||||
|
||||
return [
|
||||
'name' => $this->string('name'),
|
||||
'account_id' => $this->integer('account_id'),
|
||||
'targetamount' => $this->string('target_amount'),
|
||||
'current_amount' => $current,
|
||||
'current_amount' => $this->string('current_amount'),
|
||||
'startdate' => $this->date('start_date'),
|
||||
'targetdate' => $this->date('target_date'),
|
||||
'notes' => $this->string('notes'),
|
||||
@@ -76,8 +74,6 @@ class PiggyBankRequest extends Request
|
||||
{
|
||||
$rules = [
|
||||
'name' => 'required|between:1,255|uniquePiggyBankForUser',
|
||||
'account_id' => ['required', 'belongsToUser:accounts', new IsAssetAccountId],
|
||||
'target_amount' => 'required|numeric|more:0',
|
||||
'current_amount' => ['numeric', new ZeroOrMore, 'lte:target_amount'],
|
||||
'start_date' => 'date|nullable',
|
||||
'target_date' => 'date|nullable|after:start_date',
|
||||
@@ -90,8 +86,11 @@ class PiggyBankRequest extends Request
|
||||
case 'PUT':
|
||||
case 'PATCH':
|
||||
/** @var PiggyBank $piggyBank */
|
||||
$piggyBank = $this->route()->parameter('piggyBank');
|
||||
$rules['name'] = 'required|between:1,255|uniquePiggyBankForUser:' . $piggyBank->id;
|
||||
$piggyBank = $this->route()->parameter('piggyBank');
|
||||
$rules['name'] = 'between:1,255|uniquePiggyBankForUser:' . $piggyBank->id;
|
||||
$rules['account_id'] = ['belongsToUser:accounts', new IsAssetAccountId];
|
||||
$rules['target_amount'] = 'numeric|more:0';
|
||||
$rules['current_amount'] = ['numeric', new ZeroOrMore, new LessThanPiggyTarget];
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,9 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Requests;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Rules\BelongsUser;
|
||||
use FireflyIII\Rules\IsBoolean;
|
||||
use FireflyIII\Validation\RecurrenceValidation;
|
||||
use FireflyIII\Validation\TransactionValidation;
|
||||
use Illuminate\Validation\Validator;
|
||||
@@ -52,7 +55,37 @@ class RecurrenceStoreRequest extends Request
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return $this->rulesRecurrence();
|
||||
$today = Carbon::now()->addDay();
|
||||
|
||||
return [
|
||||
'type' => 'required|in:withdrawal,transfer,deposit',
|
||||
'title' => 'required|between:1,255|uniqueObjectForUser:recurrences,title',
|
||||
'description' => 'between:1,65000',
|
||||
'first_date' => sprintf('required|date|after:%s', $today->format('Y-m-d')),
|
||||
'apply_rules' => [new IsBoolean],
|
||||
'active' => [new IsBoolean],
|
||||
'repeat_until' => sprintf('date|after:%s', $today->format('Y-m-d')),
|
||||
'nr_of_repetitions' => 'numeric|between:1,31',
|
||||
'tags' => 'between:1,64000',
|
||||
'piggy_bank_id' => 'numeric',
|
||||
'repetitions.*.type' => 'required|in:daily,weekly,ndom,monthly,yearly',
|
||||
'repetitions.*.moment' => 'between:0,10',
|
||||
'repetitions.*.skip' => 'required|numeric|between:0,31',
|
||||
'repetitions.*.weekend' => 'required|numeric|min:1|max:4',
|
||||
'transactions.*.description' => 'required|between:1,255',
|
||||
'transactions.*.amount' => 'required|numeric|more:0',
|
||||
'transactions.*.foreign_amount' => 'numeric|more:0',
|
||||
'transactions.*.currency_id' => 'numeric|exists:transaction_currencies,id',
|
||||
'transactions.*.currency_code' => 'min:3|max:3|exists:transaction_currencies,code',
|
||||
'transactions.*.foreign_currency_id' => 'numeric|exists:transaction_currencies,id',
|
||||
'transactions.*.foreign_currency_code' => 'min:3|max:3|exists:transaction_currencies,code',
|
||||
'transactions.*.budget_id' => ['mustExist:budgets,id', new BelongsUser],
|
||||
'transactions.*.category_name' => 'between:1,255|nullable',
|
||||
'transactions.*.source_id' => ['numeric', 'nullable', new BelongsUser],
|
||||
'transactions.*.source_name' => 'between:1,255|nullable',
|
||||
'transactions.*.destination_id' => ['numeric', 'nullable', new BelongsUser],
|
||||
'transactions.*.destination_name' => 'between:1,255|nullable',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,6 +23,10 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Requests;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Models\Recurrence;
|
||||
use FireflyIII\Rules\BelongsUser;
|
||||
use FireflyIII\Rules\IsBoolean;
|
||||
use FireflyIII\Validation\RecurrenceValidation;
|
||||
use FireflyIII\Validation\TransactionValidation;
|
||||
use Illuminate\Validation\Validator;
|
||||
@@ -52,7 +56,40 @@ class RecurrenceUpdateRequest extends Request
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return $this->rulesRecurrence();
|
||||
/** @var Recurrence $recurrence */
|
||||
$recurrence = $this->route()->parameter('recurrence');
|
||||
$first = clone $recurrence->first_date;
|
||||
$first->subDay();
|
||||
|
||||
return [
|
||||
'type' => 'required|in:withdrawal,transfer,deposit',
|
||||
'title' => sprintf('required|between:1,255|uniqueObjectForUser:recurrences,title,%d', $recurrence->id),
|
||||
'description' => 'between:1,65000',
|
||||
'first_date' => sprintf('required|date|after:%s', $first->format('Y-m-d')),
|
||||
'apply_rules' => [new IsBoolean],
|
||||
'active' => [new IsBoolean],
|
||||
'repeat_until' => sprintf('date|after:%s', $first->format('Y-m-d')),
|
||||
'nr_of_repetitions' => 'numeric|between:1,31',
|
||||
'tags' => 'between:1,64000',
|
||||
'piggy_bank_id' => 'numeric',
|
||||
'repetitions.*.type' => 'required|in:daily,weekly,ndom,monthly,yearly',
|
||||
'repetitions.*.moment' => 'between:0,10',
|
||||
'repetitions.*.skip' => 'required|numeric|between:0,31',
|
||||
'repetitions.*.weekend' => 'required|numeric|min:1|max:4',
|
||||
'transactions.*.description' => 'required|between:1,255',
|
||||
'transactions.*.amount' => 'required|numeric|more:0',
|
||||
'transactions.*.foreign_amount' => 'numeric|more:0',
|
||||
'transactions.*.currency_id' => 'numeric|exists:transaction_currencies,id',
|
||||
'transactions.*.currency_code' => 'min:3|max:3|exists:transaction_currencies,code',
|
||||
'transactions.*.foreign_currency_id' => 'numeric|exists:transaction_currencies,id',
|
||||
'transactions.*.foreign_currency_code' => 'min:3|max:3|exists:transaction_currencies,code',
|
||||
'transactions.*.budget_id' => ['mustExist:budgets,id', new BelongsUser],
|
||||
'transactions.*.category_name' => 'between:1,255|nullable',
|
||||
'transactions.*.source_id' => ['numeric', 'nullable', new BelongsUser],
|
||||
'transactions.*.source_name' => 'between:1,255|nullable',
|
||||
'transactions.*.destination_id' => ['numeric', 'nullable', new BelongsUser],
|
||||
'transactions.*.destination_name' => 'between:1,255|nullable',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -121,48 +121,6 @@ class Request extends FireflyIIIRequest
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* The rules that the incoming request must be matched against.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function rulesRecurrence(): array
|
||||
{
|
||||
$today = Carbon::now()->addDay();
|
||||
|
||||
return [
|
||||
'type' => 'required|in:withdrawal,transfer,deposit',
|
||||
'title' => 'required|between:1,255|uniqueObjectForUser:recurrences,title',
|
||||
'description' => 'between:1,65000',
|
||||
'first_date' => sprintf('required|date|after:%s', $today->format('Y-m-d')),
|
||||
'apply_rules' => [new IsBoolean],
|
||||
'active' => [new IsBoolean],
|
||||
'repeat_until' => sprintf('date|after:%s', $today->format('Y-m-d')),
|
||||
'nr_of_repetitions' => 'numeric|between:1,31',
|
||||
'tags' => 'between:1,64000',
|
||||
'piggy_bank_id' => 'numeric',
|
||||
'repetitions.*.type' => 'required|in:daily,weekly,ndom,monthly,yearly',
|
||||
'repetitions.*.moment' => 'between:0,10',
|
||||
'repetitions.*.skip' => 'required|numeric|between:0,31',
|
||||
'repetitions.*.weekend' => 'required|numeric|min:1|max:4',
|
||||
'transactions.*.description' => 'required|between:1,255',
|
||||
'transactions.*.amount' => 'required|numeric|more:0',
|
||||
'transactions.*.foreign_amount' => 'numeric|more:0',
|
||||
'transactions.*.currency_id' => 'numeric|exists:transaction_currencies,id',
|
||||
'transactions.*.currency_code' => 'min:3|max:3|exists:transaction_currencies,code',
|
||||
'transactions.*.foreign_currency_id' => 'numeric|exists:transaction_currencies,id',
|
||||
'transactions.*.foreign_currency_code' => 'min:3|max:3|exists:transaction_currencies,code',
|
||||
'transactions.*.budget_id' => ['mustExist:budgets,id', new BelongsUser],
|
||||
'transactions.*.category_name' => 'between:1,255|nullable',
|
||||
'transactions.*.source_id' => ['numeric', 'nullable', new BelongsUser],
|
||||
'transactions.*.source_name' => 'between:1,255|nullable',
|
||||
'transactions.*.destination_id' => ['numeric', 'nullable', new BelongsUser],
|
||||
'transactions.*.destination_name' => 'between:1,255|nullable',
|
||||
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the repetition data as it is found in the submitted data.
|
||||
*
|
||||
|
||||
@@ -30,7 +30,7 @@ use FireflyIII\Rules\IsBoolean;
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* Class RuleGroupRequest
|
||||
* TODO AFTER 4.8.0: split this into two request classes.
|
||||
* TODO AFTER 4.8,0: split this into two request classes.
|
||||
*/
|
||||
class RuleGroupRequest extends Request
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* RuleGroupTestRequest.php
|
||||
* Copyright (c) 2019 thegrumpydictator@gmail.com
|
||||
@@ -19,6 +20,9 @@
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
|
||||
namespace FireflyIII\Api\V1\Requests;
|
||||
|
||||
|
||||
@@ -141,4 +145,4 @@ class RuleGroupTestRequest extends Request
|
||||
return null !== $account && AccountType::ASSET === $account->accountType->type;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* RuleGroupTriggerRequest.php
|
||||
* Copyright (c) 2019 thegrumpydictator@gmail.com
|
||||
@@ -19,6 +20,9 @@
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
|
||||
namespace FireflyIII\Api\V1\Requests;
|
||||
|
||||
|
||||
@@ -116,4 +120,4 @@ class RuleGroupTriggerRequest extends Request
|
||||
return null !== $account && AccountType::ASSET === $account->accountType->type;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* RuleTestRequest.php
|
||||
* Copyright (c) 2019 thegrumpydictator@gmail.com
|
||||
@@ -19,6 +20,9 @@
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
|
||||
namespace FireflyIII\Api\V1\Requests;
|
||||
|
||||
|
||||
@@ -141,4 +145,4 @@ class RuleTestRequest extends Request
|
||||
return null !== $account && AccountType::ASSET === $account->accountType->type;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* RuleTriggerRequest.php
|
||||
* Copyright (c) 2019 thegrumpydictator@gmail.com
|
||||
@@ -19,6 +20,8 @@
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Requests;
|
||||
|
||||
|
||||
@@ -116,4 +119,4 @@ class RuleTriggerRequest extends Request
|
||||
return null !== $account && AccountType::ASSET === $account->accountType->type;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ use FireflyIII\Models\Tag;
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* TODO AFTER 4.8.0: split this into two request classes.
|
||||
* TODO AFTER 4.8,0: split this into two request classes.
|
||||
*/
|
||||
class TagRequest extends Request
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* UserRequest.php
|
||||
* UserStoreRequest.php
|
||||
* Copyright (c) 2018 thegrumpydictator@gmail.com
|
||||
*
|
||||
* This file is part of Firefly III.
|
||||
@@ -30,11 +30,9 @@ use FireflyIII\User;
|
||||
|
||||
|
||||
/**
|
||||
* Class UserRequest
|
||||
* @codeCoverageIgnore
|
||||
* TODO AFTER 4.8.0: split this into two request classes.
|
||||
* Class UserStoreRequest
|
||||
*/
|
||||
class UserRequest extends Request
|
||||
class UserStoreRequest extends Request
|
||||
{
|
||||
/**
|
||||
* Authorize logged in users.
|
||||
@@ -68,7 +66,7 @@ class UserRequest extends Request
|
||||
public function getAll(): array
|
||||
{
|
||||
$blocked = false;
|
||||
if (null === $this->get('blocked')) {
|
||||
if (null !== $this->get('blocked')) {
|
||||
$blocked = $this->boolean('blocked');
|
||||
}
|
||||
$data = [
|
||||
@@ -88,23 +86,12 @@ class UserRequest extends Request
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
$rules = [
|
||||
return [
|
||||
'email' => 'required|email|unique:users,email,',
|
||||
'blocked' => [new IsBoolean],
|
||||
'blocked_code' => 'in:email_changed',
|
||||
'role' => 'in:owner,demo',
|
||||
];
|
||||
switch ($this->method()) {
|
||||
default:
|
||||
break;
|
||||
case 'PUT':
|
||||
case 'PATCH':
|
||||
$user = $this->route()->parameter('user');
|
||||
$rules['email'] = 'required|email|unique:users,email,' . $user->id;
|
||||
break;
|
||||
}
|
||||
|
||||
return $rules;
|
||||
}
|
||||
|
||||
}
|
||||
100
app/Api/V1/Requests/UserUpdateRequest.php
Normal file
100
app/Api/V1/Requests/UserUpdateRequest.php
Normal file
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* UserUpdateRequest.php
|
||||
* Copyright (c) 2018 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\Api\V1\Requests;
|
||||
|
||||
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
||||
use FireflyIII\Rules\IsBoolean;
|
||||
use FireflyIII\User;
|
||||
|
||||
|
||||
/**
|
||||
* Class UserUpdateRequest
|
||||
*/
|
||||
class UserUpdateRequest extends Request
|
||||
{
|
||||
/**
|
||||
* Authorize logged in users.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
$result = false;
|
||||
// Only allow authenticated users
|
||||
if (auth()->check()) {
|
||||
/** @var User $user */
|
||||
$user = auth()->user();
|
||||
|
||||
/** @var UserRepositoryInterface $repository */
|
||||
$repository = app(UserRepositoryInterface::class);
|
||||
|
||||
if ($repository->hasRole($user, 'owner')) {
|
||||
$result = true; // @codeCoverageIgnore
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all data from the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getAll(): array
|
||||
{
|
||||
$blocked = false;
|
||||
if (null !== $this->get('blocked')) {
|
||||
$blocked = $this->boolean('blocked');
|
||||
}
|
||||
$data = [
|
||||
'email' => $this->string('email'),
|
||||
'blocked' => $blocked,
|
||||
'blocked_code' => $this->string('blocked_code'),
|
||||
'role' => $this->string('role'),
|
||||
];
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* The rules that the incoming request must be matched against.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
$user = $this->route()->parameter('user');
|
||||
$rules = [
|
||||
'email' => sprintf('email|unique:users,email,%d', $user->id),
|
||||
'blocked' => [new IsBoolean],
|
||||
'blocked_code' => 'in:email_changed',
|
||||
'role' => 'in:owner,demo,',
|
||||
];
|
||||
|
||||
return $rules;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -70,6 +70,7 @@ class CorrectDatabase extends Command
|
||||
'firefly-iii:delete-empty-groups',
|
||||
'firefly-iii:fix-account-types',
|
||||
'firefly-iii:rename-meta-fields',
|
||||
'firefly-iii:fix-ob-currencies'
|
||||
];
|
||||
foreach ($commands as $command) {
|
||||
$this->line(sprintf('Now executing %s', $command));
|
||||
@@ -80,4 +81,4 @@ class CorrectDatabase extends Command
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,158 @@
|
||||
<?php
|
||||
/**
|
||||
* CorrectOpeningBalanceCurrencies.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/>.
|
||||
*/
|
||||
|
||||
namespace FireflyIII\Console\Commands\Correction;
|
||||
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\AccountType;
|
||||
use FireflyIII\Models\Transaction;
|
||||
use FireflyIII\Models\TransactionCurrency;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Models\TransactionType;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use Illuminate\Console\Command;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
* Class CorrectOpeningBalanceCurrencies
|
||||
*/
|
||||
class CorrectOpeningBalanceCurrencies extends Command
|
||||
{
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Will make sure that opening balance transaction currencies match the account they\'re for.';
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'firefly-iii:fix-ob-currencies';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function handle(): int
|
||||
{
|
||||
// get all OB journals:
|
||||
$set = TransactionJournal
|
||||
::leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id')
|
||||
->whereNull('transaction_journals.deleted_at')
|
||||
->where('transaction_types.type', TransactionType::OPENING_BALANCE)->get(['transaction_journals.*']);
|
||||
|
||||
$this->line(sprintf('Going to verify %d opening balance transactions.', $set->count()));
|
||||
$count = 0;
|
||||
/** @var TransactionJournal $journal */
|
||||
foreach ($set as $journal) {
|
||||
$count += $this->correctJournal($journal);
|
||||
}
|
||||
|
||||
if ($count > 0) {
|
||||
$this->line(sprintf('Corrected %d opening balance transactions.', $count));
|
||||
}
|
||||
if (0 === $count) {
|
||||
$this->info('There was nothing to fix in the opening balance transactions.');
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param TransactionJournal $journal
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
private function correctJournal(TransactionJournal $journal): int
|
||||
{
|
||||
Log::debug(sprintf('Going to correct journal #%d', $journal->id));
|
||||
// get the asset account for this opening balance:
|
||||
$account = $this->getAccount($journal);
|
||||
if (null === $account) {
|
||||
$this->warn(sprintf('Transaction journal #%d has no valid account. Cant fix this line.', $journal->id));
|
||||
|
||||
return 0;
|
||||
}
|
||||
Log::debug(sprintf('Found %s #%d "%s".', $account->accountType->type, $account->id, $account->name));
|
||||
$currency = $this->getCurrency($account);
|
||||
Log::debug(sprintf('Found currency #%d (%s)', $currency->id, $currency->code));
|
||||
|
||||
// update journal and all transactions:
|
||||
$this->setCurrency($journal, $currency);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param TransactionJournal $journal
|
||||
*
|
||||
* @return Account|null
|
||||
*/
|
||||
private function getAccount(TransactionJournal $journal): ?Account
|
||||
{
|
||||
$excluded = [];
|
||||
$transactions = $journal->transactions()->with(['account', 'account.accountType'])->get();
|
||||
/** @var Transaction $transaction */
|
||||
foreach ($transactions as $transaction) {
|
||||
$account = $transaction->account;
|
||||
if (null !== $account) {
|
||||
if (AccountType::INITIAL_BALANCE !== $account->accountType->type) {
|
||||
return $account;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Account $account
|
||||
*
|
||||
* @return TransactionCurrency
|
||||
*/
|
||||
private function getCurrency(Account $account): TransactionCurrency
|
||||
{
|
||||
/** @var AccountRepositoryInterface $repos */
|
||||
$repos = app(AccountRepositoryInterface::class);
|
||||
$repos->setUser($account->user);
|
||||
|
||||
return $repos->getAccountCurrency($account) ?? app('amount')->getDefaultCurrencyByUser($account->user);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param TransactionJournal $journal
|
||||
* @param TransactionCurrency $currency
|
||||
*/
|
||||
private function setCurrency(TransactionJournal $journal, TransactionCurrency $currency): void
|
||||
{
|
||||
$journal->transaction_currency_id = $currency->id;
|
||||
$journal->save();
|
||||
|
||||
/** @var Transaction $transaction */
|
||||
foreach ($journal->transactions as $transaction) {
|
||||
$transaction->transaction_currency_id = $currency->id;
|
||||
$transaction->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* CreateAccessTokens.php
|
||||
* Copyright (c) 2019 thegrumpydictator@gmail.com
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* CreateLinkTypes.php
|
||||
* Copyright (c) 2019 thegrumpydictator@gmail.com
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* DeleteEmptyGroups.php
|
||||
* Copyright (c) 2019 thegrumpydictator@gmail.com
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* DeleteEmptyJournals.php
|
||||
* Copyright (c) 2019 thegrumpydictator@gmail.com
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* DeleteOrphanedTransactions.php
|
||||
* Copyright (c) 2019 thegrumpydictator@gmail.com
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* DeleteZeroAmount.php
|
||||
* Copyright (c) 2019 thegrumpydictator@gmail.com
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* EnableCurrencies.php
|
||||
* Copyright (c) 2019 thegrumpydictator@gmail.com
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* FixAccountTypes.php
|
||||
* Copyright (c) 2019 thegrumpydictator@gmail.com
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* FixPiggies.php
|
||||
* Copyright (c) 2019 thegrumpydictator@gmail.com
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* FixUnevenAmount.php
|
||||
* Copyright (c) 2019 thegrumpydictator@gmail.com
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* RemoveBills.php
|
||||
* Copyright (c) 2019 thegrumpydictator@gmail.com
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* RenameMetaFields.php
|
||||
* Copyright (c) 2019 thegrumpydictator@gmail.com
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* TransferBudgets.php
|
||||
* Copyright (c) 2019 thegrumpydictator@gmail.com
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* ReportEmptyObjects.php
|
||||
* Copyright (c) 2019 thegrumpydictator@gmail.com
|
||||
|
||||
@@ -70,4 +70,4 @@ class ReportIntegrity extends Command
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* ReportSum.php
|
||||
* Copyright (c) 2019 thegrumpydictator@gmail.com
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* AccountCurrencies.php
|
||||
* Copyright (c) 2019 thegrumpydictator@gmail.com
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* BackToJournals.php
|
||||
* Copyright (c) 2019 thegrumpydictator@gmail.com
|
||||
|
||||
@@ -116,4 +116,4 @@ class BudgetLimitCurrency extends Command
|
||||
{
|
||||
app('fireflyconfig')->set(self::CONFIG_NAME, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,4 +115,4 @@ class CCLiabilities extends Command
|
||||
{
|
||||
app('fireflyconfig')->set(self::CONFIG_NAME, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,4 +125,4 @@ class MigrateAttachments extends Command
|
||||
{
|
||||
app('fireflyconfig')->set(self::CONFIG_NAME, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,4 +124,4 @@ class MigrateJournalNotes extends Command
|
||||
{
|
||||
app('fireflyconfig')->set(self::CONFIG_NAME, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* MigrateToGroups.php
|
||||
* Copyright (c) 2019 thegrumpydictator@gmail.com
|
||||
@@ -26,6 +27,7 @@ use Exception;
|
||||
use FireflyIII\Factory\TransactionGroupFactory;
|
||||
use FireflyIII\Models\Transaction;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Repositories\Journal\JournalCLIRepositoryInterface;
|
||||
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||
use FireflyIII\Services\Internal\Destroy\JournalDestroyService;
|
||||
use Illuminate\Console\Command;
|
||||
@@ -58,6 +60,8 @@ class MigrateToGroups extends Command
|
||||
private $groupFactory;
|
||||
/** @var JournalRepositoryInterface */
|
||||
private $journalRepository;
|
||||
/** @var JournalCLIRepositoryInterface */
|
||||
private $cliRepository;
|
||||
/** @var JournalDestroyService */
|
||||
private $service;
|
||||
private $count;
|
||||
@@ -122,6 +126,7 @@ class MigrateToGroups extends Command
|
||||
$this->journalRepository = app(JournalRepositoryInterface::class);
|
||||
$this->service = app(JournalDestroyService::class);
|
||||
$this->groupFactory = app(TransactionGroupFactory::class);
|
||||
$this->cliRepository = app(JournalCLIRepositoryInterface::class);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -195,7 +200,7 @@ class MigrateToGroups extends Command
|
||||
*/
|
||||
private function makeGroupsFromAll(): void
|
||||
{
|
||||
$orphanedJournals = $this->journalRepository->getJournalsWithoutGroup();
|
||||
$orphanedJournals = $this->cliRepository->getJournalsWithoutGroup();
|
||||
$count = count($orphanedJournals);
|
||||
if ($count > 0) {
|
||||
Log::debug(sprintf('Going to convert %d transaction journals. Please hold..', $count));
|
||||
@@ -215,7 +220,7 @@ class MigrateToGroups extends Command
|
||||
*/
|
||||
private function makeGroupsFromSplitJournals(): void
|
||||
{
|
||||
$splitJournals = $this->journalRepository->getSplitJournals();
|
||||
$splitJournals = $this->cliRepository->getSplitJournals();
|
||||
if ($splitJournals->count() > 0) {
|
||||
$this->info(sprintf('Going to convert %d split transaction(s). Please hold..', $splitJournals->count()));
|
||||
/** @var TransactionJournal $journal */
|
||||
@@ -232,7 +237,7 @@ class MigrateToGroups extends Command
|
||||
* @param TransactionJournal $journal
|
||||
*
|
||||
* @throws Exception
|
||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||
*
|
||||
*/
|
||||
private function makeMultiGroup(TransactionJournal $journal): void
|
||||
{
|
||||
@@ -248,6 +253,7 @@ class MigrateToGroups extends Command
|
||||
|
||||
$this->journalRepository->setUser($journal->user);
|
||||
$this->groupFactory->setUser($journal->user);
|
||||
$this->cliRepository->setUser($journal->user);
|
||||
|
||||
$data = [
|
||||
// mandatory fields.
|
||||
@@ -255,32 +261,31 @@ class MigrateToGroups extends Command
|
||||
'transactions' => [],
|
||||
];
|
||||
$destTransactions = $this->getDestinationTransactions($journal);
|
||||
$budgetId = $this->journalRepository->getJournalBudgetId($journal);
|
||||
$categoryId = $this->journalRepository->getJournalCategoryId($journal);
|
||||
$notes = $this->journalRepository->getNoteText($journal);
|
||||
$tags = $this->journalRepository->getTags($journal);
|
||||
$internalRef = $this->journalRepository->getMetaField($journal, 'internal-reference');
|
||||
$sepaCC = $this->journalRepository->getMetaField($journal, 'sepa_cc');
|
||||
$sepaCtOp = $this->journalRepository->getMetaField($journal, 'sepa_ct_op');
|
||||
$sepaCtId = $this->journalRepository->getMetaField($journal, 'sepa_ct_id');
|
||||
$sepaDb = $this->journalRepository->getMetaField($journal, 'sepa_db');
|
||||
$sepaCountry = $this->journalRepository->getMetaField($journal, 'sepa_country');
|
||||
$sepaEp = $this->journalRepository->getMetaField($journal, 'sepa_ep');
|
||||
$sepaCi = $this->journalRepository->getMetaField($journal, 'sepa_ci');
|
||||
$sepaBatchId = $this->journalRepository->getMetaField($journal, 'sepa_batch_id');
|
||||
$externalId = $this->journalRepository->getMetaField($journal, 'external-id');
|
||||
$originalSource = $this->journalRepository->getMetaField($journal, 'original-source');
|
||||
$recurrenceId = $this->journalRepository->getMetaField($journal, 'recurrence_id');
|
||||
$bunq = $this->journalRepository->getMetaField($journal, 'bunq_payment_id');
|
||||
$hash = $this->journalRepository->getMetaField($journal, 'import_hash');
|
||||
$hashTwo = $this->journalRepository->getMetaField($journal, 'import_hash_v2');
|
||||
$interestDate = $this->journalRepository->getMetaDate($journal, 'interest_date');
|
||||
$bookDate = $this->journalRepository->getMetaDate($journal, 'book_date');
|
||||
$processDate = $this->journalRepository->getMetaDate($journal, 'process_date');
|
||||
$dueDate = $this->journalRepository->getMetaDate($journal, 'due_date');
|
||||
$paymentDate = $this->journalRepository->getMetaDate($journal, 'payment_date');
|
||||
$invoiceDate = $this->journalRepository->getMetaDate($journal, 'invoice_date');
|
||||
|
||||
$budgetId = $this->cliRepository->getJournalBudgetId($journal);
|
||||
$categoryId = $this->cliRepository->getJournalCategoryId($journal);
|
||||
$notes = $this->cliRepository->getNoteText($journal);
|
||||
$tags = $this->cliRepository->getTags($journal);
|
||||
$internalRef = $this->cliRepository->getMetaField($journal, 'internal-reference');
|
||||
$sepaCC = $this->cliRepository->getMetaField($journal, 'sepa_cc');
|
||||
$sepaCtOp = $this->cliRepository->getMetaField($journal, 'sepa_ct_op');
|
||||
$sepaCtId = $this->cliRepository->getMetaField($journal, 'sepa_ct_id');
|
||||
$sepaDb = $this->cliRepository->getMetaField($journal, 'sepa_db');
|
||||
$sepaCountry = $this->cliRepository->getMetaField($journal, 'sepa_country');
|
||||
$sepaEp = $this->cliRepository->getMetaField($journal, 'sepa_ep');
|
||||
$sepaCi = $this->cliRepository->getMetaField($journal, 'sepa_ci');
|
||||
$sepaBatchId = $this->cliRepository->getMetaField($journal, 'sepa_batch_id');
|
||||
$externalId = $this->cliRepository->getMetaField($journal, 'external-id');
|
||||
$originalSource = $this->cliRepository->getMetaField($journal, 'original-source');
|
||||
$recurrenceId = $this->cliRepository->getMetaField($journal, 'recurrence_id');
|
||||
$bunq = $this->cliRepository->getMetaField($journal, 'bunq_payment_id');
|
||||
$hash = $this->cliRepository->getMetaField($journal, 'import_hash');
|
||||
$hashTwo = $this->cliRepository->getMetaField($journal, 'import_hash_v2');
|
||||
$interestDate = $this->cliRepository->getMetaDate($journal, 'interest_date');
|
||||
$bookDate = $this->cliRepository->getMetaDate($journal, 'book_date');
|
||||
$processDate = $this->cliRepository->getMetaDate($journal, 'process_date');
|
||||
$dueDate = $this->cliRepository->getMetaDate($journal, 'due_date');
|
||||
$paymentDate = $this->cliRepository->getMetaDate($journal, 'payment_date');
|
||||
$invoiceDate = $this->cliRepository->getMetaDate($journal, 'invoice_date');
|
||||
|
||||
Log::debug(sprintf('Will use %d positive transactions to create a new group.', $destTransactions->count()));
|
||||
|
||||
|
||||
@@ -246,4 +246,4 @@ class MigrateToRules extends Command
|
||||
$this->billRepository->update($bill, $newBillData);
|
||||
$this->count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Models\TransactionType;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
|
||||
use FireflyIII\Repositories\Journal\JournalCLIRepositoryInterface;
|
||||
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
@@ -61,6 +62,8 @@ class OtherCurrenciesCorrections extends Command
|
||||
private $currencyRepos;
|
||||
/** @var JournalRepositoryInterface */
|
||||
private $journalRepos;
|
||||
/** @var JournalCLIRepositoryInterface */
|
||||
private $cliRepos;
|
||||
/** @var int */
|
||||
private $count;
|
||||
|
||||
@@ -105,6 +108,7 @@ class OtherCurrenciesCorrections extends Command
|
||||
$this->accountRepos = app(AccountRepositoryInterface::class);
|
||||
$this->currencyRepos = app(CurrencyRepositoryInterface::class);
|
||||
$this->journalRepos = app(JournalRepositoryInterface::class);
|
||||
$this->cliRepos = app(JournalCLIRepositoryInterface::class);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -121,6 +125,7 @@ class OtherCurrenciesCorrections extends Command
|
||||
if (isset($this->accountCurrencies[$accountId]) && $this->accountCurrencies[$accountId] instanceof TransactionCurrency) {
|
||||
return $this->accountCurrencies[$accountId]; // @codeCoverageIgnore
|
||||
}
|
||||
// TODO we can use getAccountCurrency() instead
|
||||
$currencyId = (int)$this->accountRepos->getMetaValue($account, 'currency_id');
|
||||
$result = $this->currencyRepos->findNull($currencyId);
|
||||
if (null === $result) {
|
||||
@@ -166,6 +171,7 @@ class OtherCurrenciesCorrections extends Command
|
||||
$this->accountRepos->setUser($journal->user);
|
||||
$this->journalRepos->setUser($journal->user);
|
||||
$this->currencyRepos->setUser($journal->user);
|
||||
$this->cliRepos->setUser($journal->user);
|
||||
|
||||
$leadTransaction = $this->getLeadTransaction($journal);
|
||||
|
||||
@@ -223,7 +229,7 @@ class OtherCurrenciesCorrections extends Command
|
||||
private function updateOtherJournalsCurrencies(): void
|
||||
{
|
||||
$set =
|
||||
$this->journalRepos->getAllJournals(
|
||||
$this->cliRepos->getAllJournals(
|
||||
[
|
||||
TransactionType::WITHDRAWAL,
|
||||
TransactionType::DEPOSIT,
|
||||
@@ -242,8 +248,8 @@ class OtherCurrenciesCorrections extends Command
|
||||
* Gets the transaction that determines the transaction that "leads" and will determine
|
||||
* the currency to be used by all transactions, and the journal itself.
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
||||
* @param TransactionJournal $journal
|
||||
*
|
||||
* @return Transaction|null
|
||||
*/
|
||||
private function getLeadTransaction(TransactionJournal $journal): ?Transaction
|
||||
@@ -277,4 +283,4 @@ class OtherCurrenciesCorrections extends Command
|
||||
|
||||
return $lead;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* RenameAccountMeta.php
|
||||
* Copyright (c) 2019 thegrumpydictator@gmail.com
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* TransactionIdentifier.php
|
||||
* Copyright (c) 2019 thegrumpydictator@gmail.com
|
||||
@@ -23,6 +24,7 @@ namespace FireflyIII\Console\Commands\Upgrade;
|
||||
|
||||
use FireflyIII\Models\Transaction;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Repositories\Journal\JournalCLIRepositoryInterface;
|
||||
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Database\QueryException;
|
||||
@@ -51,6 +53,9 @@ class TransactionIdentifier extends Command
|
||||
/** @var JournalRepositoryInterface */
|
||||
private $journalRepository;
|
||||
|
||||
/** @var JournalCLIRepositoryInterface */
|
||||
private $cliRepository;
|
||||
|
||||
/** @var int */
|
||||
private $count;
|
||||
|
||||
@@ -81,7 +86,7 @@ class TransactionIdentifier extends Command
|
||||
return 0;
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
$journals = $this->journalRepository->getSplitJournals();
|
||||
$journals = $this->cliRepository->getSplitJournals();
|
||||
/** @var TransactionJournal $journal */
|
||||
foreach ($journals as $journal) {
|
||||
$this->updateJournalIdentifiers($journal);
|
||||
@@ -111,6 +116,7 @@ class TransactionIdentifier extends Command
|
||||
private function stupidLaravel(): void
|
||||
{
|
||||
$this->journalRepository = app(JournalRepositoryInterface::class);
|
||||
$this->cliRepository = app(JournalCLIRepositoryInterface::class);
|
||||
$this->count = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* TransferCurrenciesCorrections.php
|
||||
* Copyright (c) 2019 thegrumpydictator@gmail.com
|
||||
@@ -29,6 +30,7 @@ use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Models\TransactionType;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
|
||||
use FireflyIII\Repositories\Journal\JournalCLIRepositoryInterface;
|
||||
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||
use Illuminate\Console\Command;
|
||||
use Log;
|
||||
@@ -60,6 +62,8 @@ class TransferCurrenciesCorrections extends Command
|
||||
private $currencyRepos;
|
||||
/** @var JournalRepositoryInterface */
|
||||
private $journalRepos;
|
||||
/** @var JournalCLIRepositoryInterface */
|
||||
private $cliRepos;
|
||||
/** @var int */
|
||||
private $count;
|
||||
|
||||
@@ -125,6 +129,7 @@ class TransferCurrenciesCorrections extends Command
|
||||
$this->accountRepos = app(AccountRepositoryInterface::class);
|
||||
$this->currencyRepos = app(CurrencyRepositoryInterface::class);
|
||||
$this->journalRepos = app(JournalRepositoryInterface::class);
|
||||
$this->cliRepos = app(JournalCLIRepositoryInterface::class);
|
||||
$this->accountCurrencies = [];
|
||||
$this->resetInformation();
|
||||
}
|
||||
@@ -143,6 +148,7 @@ class TransferCurrenciesCorrections extends Command
|
||||
if (isset($this->accountCurrencies[$accountId]) && $this->accountCurrencies[$accountId] instanceof TransactionCurrency) {
|
||||
return $this->accountCurrencies[$accountId]; // @codeCoverageIgnore
|
||||
}
|
||||
// TODO we can use getAccountCurrency() instead
|
||||
$currencyId = (int)$this->accountRepos->getMetaValue($account, 'currency_id');
|
||||
$result = $this->currencyRepos->findNull($currencyId);
|
||||
if (null === $result) {
|
||||
@@ -238,7 +244,7 @@ class TransferCurrenciesCorrections extends Command
|
||||
*/
|
||||
private function startUpdateRoutine(): void
|
||||
{
|
||||
$set = $this->journalRepos->getAllJournals([TransactionType::TRANSFER]);
|
||||
$set = $this->cliRepos->getAllJournals([TransactionType::TRANSFER]);
|
||||
/** @var TransactionJournal $journal */
|
||||
foreach ($set as $journal) {
|
||||
$this->updateTransferCurrency($journal);
|
||||
@@ -286,8 +292,6 @@ class TransferCurrenciesCorrections extends Command
|
||||
}
|
||||
|
||||
/**
|
||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||
*
|
||||
* @param TransactionJournal $transfer
|
||||
*/
|
||||
private function updateTransferCurrency(TransactionJournal $transfer): void
|
||||
@@ -571,4 +575,4 @@ class TransferCurrenciesCorrections extends Command
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* UpgradeDatabase.php
|
||||
* Copyright (c) 2019 thegrumpydictator@gmail.com
|
||||
@@ -52,6 +53,7 @@ class UpgradeDatabase extends Command
|
||||
*/
|
||||
public function handle(): int
|
||||
{
|
||||
|
||||
$this->callInitialCommands();
|
||||
|
||||
|
||||
@@ -70,7 +72,7 @@ class UpgradeDatabase extends Command
|
||||
'firefly-iii:back-to-journals',
|
||||
'firefly-iii:rename-account-meta',
|
||||
|
||||
// there are 13 verify commands.
|
||||
// there are 14 verify commands.
|
||||
'firefly-iii:fix-piggies',
|
||||
'firefly-iii:create-link-types',
|
||||
'firefly-iii:create-access-tokens',
|
||||
@@ -84,6 +86,7 @@ class UpgradeDatabase extends Command
|
||||
'firefly-iii:delete-empty-groups',
|
||||
'firefly-iii:fix-account-types',
|
||||
'firefly-iii:rename-meta-fields',
|
||||
'firefly-iii:fix-ob-currencies',
|
||||
|
||||
// two report commands
|
||||
'firefly-iii:report-empty-objects',
|
||||
@@ -102,8 +105,8 @@ class UpgradeDatabase extends Command
|
||||
$result = Artisan::output();
|
||||
echo $result;
|
||||
}
|
||||
|
||||
// set new DB version.
|
||||
app('fireflyconfig')->set('db_version', (int)config('firefly.db_version'));
|
||||
// index will set FF3 version.
|
||||
app('fireflyconfig')->set('ff3_version', (string)config('firefly.version'));
|
||||
|
||||
@@ -112,8 +115,21 @@ class UpgradeDatabase extends Command
|
||||
|
||||
private function callInitialCommands(): void
|
||||
{
|
||||
Artisan::call('migrate', ['--seed' => true]);
|
||||
$this->line('Now seeding the database...');
|
||||
Artisan::call('migrate', ['--seed' => true, '--force' => true]);
|
||||
$result = Artisan::output();
|
||||
echo $result;
|
||||
|
||||
$this->line('Now decrypting the database (if necessary)...');
|
||||
Artisan::call('firefly-iii:decrypt-all');
|
||||
Artisan::call('generate-keys');
|
||||
$result = Artisan::output();
|
||||
echo $result;
|
||||
|
||||
$this->line('Now installing OAuth2 keys...');
|
||||
Artisan::call('passport:install');
|
||||
$result = Artisan::output();
|
||||
echo $result;
|
||||
|
||||
$this->line('Done!');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,8 +60,8 @@ class RequestedReportOnJournals
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
|
||||
/** @var Collection The journals to report on. */
|
||||
public $journals;
|
||||
/** @var Collection The transaction groups to report on. */
|
||||
public $groups;
|
||||
/** @var int The ID of the user. */
|
||||
public $userId;
|
||||
|
||||
@@ -69,13 +69,13 @@ class RequestedReportOnJournals
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param int $userId
|
||||
* @param Collection $journals
|
||||
* @param Collection $groups
|
||||
*/
|
||||
public function __construct(int $userId, Collection $journals)
|
||||
public function __construct(int $userId, Collection $groups)
|
||||
{
|
||||
Log::debug('In event RequestedReportOnJournals.');
|
||||
$this->userId = $userId;
|
||||
$this->journals = $journals;
|
||||
$this->groups = $groups;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -36,16 +36,15 @@ class StoredTransactionGroup extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
public $applyRules;
|
||||
/** @var TransactionGroup The group that was stored. */
|
||||
public $transactionGroup;
|
||||
|
||||
public $applyRules;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param TransactionGroup $transactionGroup
|
||||
* @param bool $applyRules
|
||||
* @param bool $applyRules
|
||||
*/
|
||||
public function __construct(TransactionGroup $transactionGroup, bool $applyRules = true)
|
||||
{
|
||||
|
||||
@@ -29,6 +29,7 @@ use Illuminate\Queue\SerializesModels;
|
||||
|
||||
/**
|
||||
* Class UpdatedTransactionGroup.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* GracefulNotFoundHandler.php
|
||||
* Copyright (c) 2019 thegrumpydictator@gmail.com
|
||||
@@ -43,9 +44,7 @@ class GracefulNotFoundHandler extends ExceptionHandler
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Exception $exception
|
||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
||||
* @SuppressWarnings(PHPMD.NPathComplexity)
|
||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||
*
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
@@ -225,4 +224,4 @@ class GracefulNotFoundHandler extends ExceptionHandler
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,9 +48,7 @@ class Handler extends ExceptionHandler
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Exception $exception
|
||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
||||
* @SuppressWarnings(PHPMD.NPathComplexity)
|
||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||
*
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
@@ -112,7 +110,7 @@ class Handler extends ExceptionHandler
|
||||
*
|
||||
* This is a great spot to send exceptions to Sentry etc.
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity) // it's five its fine.
|
||||
* // it's five its fine.
|
||||
*
|
||||
* @param Exception $exception
|
||||
*
|
||||
|
||||
@@ -189,7 +189,7 @@ class AccountFactory
|
||||
* @param null|string $accountType
|
||||
*
|
||||
* @return AccountType|null
|
||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
||||
*
|
||||
*/
|
||||
protected function getAccountType(?int $accountTypeId, ?string $accountType): ?AccountType
|
||||
{
|
||||
|
||||
@@ -26,7 +26,6 @@ namespace FireflyIII\Factory;
|
||||
|
||||
use FireflyIII\Models\Budget;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
@@ -53,7 +52,7 @@ class BudgetFactory
|
||||
* @param null|string $budgetName
|
||||
*
|
||||
* @return Budget|null
|
||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
||||
*
|
||||
*/
|
||||
public function find(?int $budgetId, ?string $budgetName): ?Budget
|
||||
{
|
||||
@@ -90,17 +89,7 @@ class BudgetFactory
|
||||
*/
|
||||
public function findByName(string $name): ?Budget
|
||||
{
|
||||
/** @var Collection $collection */
|
||||
$collection = $this->user->budgets()->get();
|
||||
// TODO no longer need to loop like this
|
||||
/** @var Budget $budget */
|
||||
foreach ($collection as $budget) {
|
||||
if ($budget->name === $name) {
|
||||
return $budget;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
return $this->user->budgets()->where('name', $name)->first();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -26,7 +26,6 @@ namespace FireflyIII\Factory;
|
||||
|
||||
use FireflyIII\Models\Category;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
@@ -55,21 +54,7 @@ class CategoryFactory
|
||||
*/
|
||||
public function findByName(string $name): ?Category
|
||||
{
|
||||
$result = null;
|
||||
/** @var Collection $collection */
|
||||
$collection = $this->user->categories()->get();
|
||||
|
||||
// TODO no longer need to loop like this
|
||||
|
||||
/** @var Category $category */
|
||||
foreach ($collection as $category) {
|
||||
if ($category->name === $name) {
|
||||
$result = $category;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
return $this->user->categories()->where('name', $name)->first();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -77,7 +62,7 @@ class CategoryFactory
|
||||
* @param null|string $categoryName
|
||||
*
|
||||
* @return Category|null
|
||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
||||
*
|
||||
*/
|
||||
public function findOrCreate(?int $categoryId, ?string $categoryName): ?Category
|
||||
{
|
||||
|
||||
@@ -53,7 +53,7 @@ class PiggyBankEventFactory
|
||||
* @param PiggyBank|null $piggyBank
|
||||
*
|
||||
* @return PiggyBankEvent|null
|
||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
||||
*
|
||||
*/
|
||||
public function create(TransactionJournal $journal, ?PiggyBank $piggyBank): ?PiggyBankEvent
|
||||
{
|
||||
|
||||
@@ -52,7 +52,7 @@ class PiggyBankFactory
|
||||
* @param null|string $piggyBankName
|
||||
*
|
||||
* @return PiggyBank|null
|
||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
||||
*
|
||||
*/
|
||||
public function find(?int $piggyBankId, ?string $piggyBankName): ?PiggyBank
|
||||
{
|
||||
@@ -90,18 +90,7 @@ class PiggyBankFactory
|
||||
*/
|
||||
public function findByName(string $name): ?PiggyBank
|
||||
{
|
||||
$set = $this->user->piggyBanks()->get();
|
||||
|
||||
// TODO no longer need to loop like this
|
||||
|
||||
/** @var PiggyBank $piggy */
|
||||
foreach ($set as $piggy) {
|
||||
if ($piggy->name === $name) {
|
||||
return $piggy;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
return $this->user->piggyBanks()->where('piggy_banks.name', $name)->first();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -79,7 +79,7 @@ class TransactionCurrencyFactory
|
||||
* @param null|string $currencyCode
|
||||
*
|
||||
* @return TransactionCurrency|null
|
||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
||||
*
|
||||
*/
|
||||
public function find(?int $currencyId, ?string $currencyCode): ?TransactionCurrency
|
||||
{
|
||||
|
||||
@@ -23,9 +23,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Factory;
|
||||
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Models\TransactionGroup;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\User;
|
||||
|
||||
/**
|
||||
@@ -60,10 +58,8 @@ class TransactionGroupFactory
|
||||
$collection = $this->journalFactory->create($data);
|
||||
$title = $data['group_title'] ?? null;
|
||||
$title = '' === $title ? null : $title;
|
||||
/** @var TransactionJournal $first */
|
||||
$first = $collection->first();
|
||||
$group = new TransactionGroup;
|
||||
$group->user()->associate($first->user);
|
||||
$group = new TransactionGroup;
|
||||
$group->user()->associate($this->user);
|
||||
$group->title = $title;
|
||||
$group->save();
|
||||
|
||||
@@ -81,4 +77,4 @@ class TransactionGroupFactory
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,6 +143,9 @@ class TransactionJournalFactory
|
||||
if (null !== $journal) {
|
||||
$collection->push($journal);
|
||||
}
|
||||
if(null === $journal) {
|
||||
Log::error('The createJournal() method returned NULL. This may indicate an error.');
|
||||
}
|
||||
}
|
||||
|
||||
return $collection;
|
||||
@@ -247,13 +250,14 @@ class TransactionJournalFactory
|
||||
$destinationAccount = $this->getAccount($type->type, 'destination', (int)$row['destination_id'], $row['destination_name']);
|
||||
// @codeCoverageIgnoreStart
|
||||
} catch (FireflyException $e) {
|
||||
Log::error('Could not validate source or destination.');
|
||||
Log::error($e->getMessage());
|
||||
|
||||
return null;
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
// TODO After 4.8.0 better handling below:
|
||||
// TODO AFTER 4.8,0 better handling below:
|
||||
|
||||
/** double check currencies. */
|
||||
$sourceCurrency = $currency;
|
||||
@@ -261,7 +265,7 @@ class TransactionJournalFactory
|
||||
$sourceForeignCurrency = $foreignCurrency;
|
||||
$destForeignCurrency = $foreignCurrency;
|
||||
|
||||
if ('Withdrawal' === $type->type) {
|
||||
if (TransactionType::WITHDRAWAL === $type->type) {
|
||||
// make sure currency is correct.
|
||||
$currency = $this->getCurrency($currency, $sourceAccount);
|
||||
// make sure foreign currency != currency.
|
||||
@@ -273,7 +277,7 @@ class TransactionJournalFactory
|
||||
$sourceForeignCurrency = $foreignCurrency;
|
||||
$destForeignCurrency = $foreignCurrency;
|
||||
}
|
||||
if ('Deposit' === $type->type) {
|
||||
if (TransactionType::DEPOSIT === $type->type) {
|
||||
// make sure currency is correct.
|
||||
$currency = $this->getCurrency($currency, $destinationAccount);
|
||||
// make sure foreign currency != currency.
|
||||
@@ -293,14 +297,9 @@ class TransactionJournalFactory
|
||||
$foreignCurrency = $this->getCurrency($foreignCurrency, $destinationAccount);
|
||||
|
||||
$sourceCurrency = $currency;
|
||||
$destCurrency = $foreignCurrency;
|
||||
$destCurrency = $currency;
|
||||
$sourceForeignCurrency = $foreignCurrency;
|
||||
$destForeignCurrency = $currency;
|
||||
}
|
||||
|
||||
// if transfer, switch accounts:
|
||||
if (TransactionType::TRANSFER === $type->type) {
|
||||
[$sourceAccount, $destinationAccount] = [$destinationAccount, $sourceAccount];
|
||||
$destForeignCurrency = $foreignCurrency;
|
||||
}
|
||||
|
||||
/** Create a basic journal. */
|
||||
|
||||
@@ -49,8 +49,6 @@ class TransactionJournalMetaFactory
|
||||
* @param array $data
|
||||
*
|
||||
* @return TransactionJournalMeta|null
|
||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||
*/
|
||||
public function updateOrCreate(array $data): ?TransactionJournalMeta
|
||||
{
|
||||
|
||||
@@ -109,7 +109,7 @@ class ChartJsGenerator implements GeneratorInterface
|
||||
* ]
|
||||
* ]
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity) // it's five.
|
||||
* // it's five.
|
||||
*
|
||||
* @param array $data
|
||||
*
|
||||
|
||||
@@ -60,7 +60,7 @@ interface GeneratorInterface
|
||||
* ]
|
||||
* ]
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity) // it's five.
|
||||
* // it's five.
|
||||
*
|
||||
* @param array $data
|
||||
*
|
||||
|
||||
@@ -24,7 +24,6 @@ namespace FireflyIII\Generator\Report\Standard;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Generator\Report\ReportGeneratorInterface;
|
||||
use FireflyIII\Helpers\Report\ReportHelperInterface;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
use Throwable;
|
||||
@@ -50,17 +49,11 @@ class MonthReportGenerator implements ReportGeneratorInterface
|
||||
*/
|
||||
public function generate(): string
|
||||
{
|
||||
/** @var ReportHelperInterface $helper */
|
||||
$helper = app(ReportHelperInterface::class);
|
||||
$bills = $helper->getBillReport($this->start, $this->end, $this->accounts);
|
||||
$accountIds = implode(',', $this->accounts->pluck('id')->toArray());
|
||||
$reportType = 'default';
|
||||
|
||||
try {
|
||||
return view(
|
||||
'reports.default.month',
|
||||
compact('bills', 'accountIds', 'reportType')
|
||||
)->with('start', $this->start)->with('end', $this->end)->render();
|
||||
return view('reports.default.month', compact('accountIds', 'reportType'))->with('start', $this->start)->with('end', $this->end)->render();
|
||||
} catch (Throwable $e) {
|
||||
Log::error(sprintf('Cannot render reports.default.month: %s', $e->getMessage()));
|
||||
$result = 'Could not render report view.';
|
||||
|
||||
@@ -112,7 +112,7 @@ class Support
|
||||
/**
|
||||
* Summarize collection by earned and spent data.
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity) // it's exactly five.
|
||||
* // it's exactly five.
|
||||
*
|
||||
* @param array $spent
|
||||
* @param array $earned
|
||||
|
||||
@@ -55,10 +55,10 @@ class AutomationHandler
|
||||
/** @var UserRepositoryInterface $repository */
|
||||
$repository = app(UserRepositoryInterface::class);
|
||||
$user = $repository->findNull($event->userId);
|
||||
if (null !== $user && 0 !== $event->journals->count()) {
|
||||
if (null !== $user && 0 !== $event->groups->count()) {
|
||||
try {
|
||||
Log::debug('Trying to mail...');
|
||||
Mail::to($user->email)->send(new ReportNewJournalsMail($user->email, '127.0.0.1', $event->journals));
|
||||
Mail::to($user->email)->send(new ReportNewJournalsMail($user->email, '127.0.0.1', $event->groups));
|
||||
// @codeCoverageIgnoreStart
|
||||
} catch (Exception $e) {
|
||||
Log::debug('Send message failed! :(');
|
||||
|
||||
@@ -43,9 +43,7 @@ class VersionCheckEventHandler
|
||||
/**
|
||||
* Checks with GitHub to see if there is a new version.
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
||||
* @SuppressWarnings(PHPMD.NPathComplexity)
|
||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||
*
|
||||
* @param RequestedVersionCheckStatus $event
|
||||
*/
|
||||
public function checkForUpdates(RequestedVersionCheckStatus $event): void
|
||||
|
||||
@@ -98,7 +98,7 @@ class MetaPieChart implements MetaPieChartInterface
|
||||
* @param string $group
|
||||
*
|
||||
* @return array
|
||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
||||
*
|
||||
*/
|
||||
public function generate(string $direction, string $group): array
|
||||
{
|
||||
@@ -181,8 +181,6 @@ class MetaPieChart implements MetaPieChartInterface
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
||||
*
|
||||
*/
|
||||
protected function groupByFields(array $array, array $fields): array
|
||||
{
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user