mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-21 10:52:21 +01:00
save payment schedules PDF to a persistant volume storage
This commit is contained in:
parent
bbf88846dd
commit
32b0222da5
3
.gitignore
vendored
3
.gitignore
vendored
@ -34,6 +34,9 @@
|
|||||||
# PDF invoices
|
# PDF invoices
|
||||||
/invoices/*
|
/invoices/*
|
||||||
|
|
||||||
|
# PDF Payment Schedules
|
||||||
|
/payment_schedules/*
|
||||||
|
|
||||||
# XLSX exports
|
# XLSX exports
|
||||||
/exports/*
|
/exports/*
|
||||||
|
|
||||||
|
@ -10,8 +10,10 @@
|
|||||||
- [TODO DEPLOY] `rails fablab:maintenance:rebuild_stylesheet`
|
- [TODO DEPLOY] `rails fablab:maintenance:rebuild_stylesheet`
|
||||||
- [TODO DEPLOY] `rails fablab:stripe:set_product_id`
|
- [TODO DEPLOY] `rails fablab:stripe:set_product_id`
|
||||||
- [TODO DEPLOY] `rails fablab:setup:add_schedule_reference`
|
- [TODO DEPLOY] `rails fablab:setup:add_schedule_reference`
|
||||||
|
- [TODO DEPLOY] `rails db:seed`
|
||||||
- [TODO DEPLOY] add the `INTL_LOCALE` environment variable (see [doc/environment.md](doc/environment.md#INTL_LOCALE) for configuration details)
|
- [TODO DEPLOY] add the `INTL_LOCALE` environment variable (see [doc/environment.md](doc/environment.md#INTL_LOCALE) for configuration details)
|
||||||
- [TODO DEPLOY] add the `INTL_CURRENCY` environment variable (see [doc/environment.md](doc/environment.md#INTL_CURRENCY) for configuration details)
|
- [TODO DEPLOY] add the `INTL_CURRENCY` environment variable (see [doc/environment.md](doc/environment.md#INTL_CURRENCY) for configuration details)
|
||||||
|
- [TODO DEPLOY] `\curl -sSL https://raw.githubusercontent.com/sleede/fab-manager/master/scripts/mount-payment-schedules.sh | bash`
|
||||||
|
|
||||||
## v4.6.5 2020 December 07
|
## v4.6.5 2020 December 07
|
||||||
- Fix a bug: unable to run the upgrade script with docker-compose >= v1.19
|
- Fix a bug: unable to run the upgrade script with docker-compose >= v1.19
|
||||||
|
@ -58,6 +58,7 @@ RUN apk del .build-deps && \
|
|||||||
RUN mkdir -p /usr/src/app && \
|
RUN mkdir -p /usr/src/app && \
|
||||||
mkdir -p /usr/src/app/config && \
|
mkdir -p /usr/src/app/config && \
|
||||||
mkdir -p /usr/src/app/invoices && \
|
mkdir -p /usr/src/app/invoices && \
|
||||||
|
mkdir -p /usr/src/app/payment_schedules && \
|
||||||
mkdir -p /usr/src/app/exports && \
|
mkdir -p /usr/src/app/exports && \
|
||||||
mkdir -p /usr/src/app/imports && \
|
mkdir -p /usr/src/app/imports && \
|
||||||
mkdir -p /usr/src/app/log && \
|
mkdir -p /usr/src/app/log && \
|
||||||
@ -72,6 +73,7 @@ COPY . /usr/src/app
|
|||||||
|
|
||||||
# Volumes
|
# Volumes
|
||||||
VOLUME /usr/src/app/invoices
|
VOLUME /usr/src/app/invoices
|
||||||
|
VOLUME /usr/src/app/payment_schedules
|
||||||
VOLUME /usr/src/app/exports
|
VOLUME /usr/src/app/exports
|
||||||
VOLUME /usr/src/app/imports
|
VOLUME /usr/src/app/imports
|
||||||
VOLUME /usr/src/app/public
|
VOLUME /usr/src/app/public
|
||||||
|
@ -28,13 +28,13 @@ class PaymentSchedule < PaymentDocument
|
|||||||
end
|
end
|
||||||
|
|
||||||
def filename
|
def filename
|
||||||
prefix = Setting.find_by(name: 'invoice_prefix').value_at(created_at)
|
prefix = Setting.find_by(name: 'payment_schedule_prefix').value_at(created_at)
|
||||||
prefix ||= if created_at < Setting.find_by(name: 'invoice_prefix').history_values.order(created_at: :asc).limit(1).first.created_at
|
prefix ||= if created_at < Setting.find_by(name: 'payment_schedule_prefix').first_update
|
||||||
Setting.find_by(name: 'invoice_prefix').history_values.order(created_at: :asc).limit(1).first
|
Setting.find_by(name: 'payment_schedule_prefix').first_value
|
||||||
else
|
else
|
||||||
Setting.find_by(name: 'invoice_prefix')..history_values.order(created_at: :desc).limit(1).first
|
Setting.get('payment_schedule_prefix')
|
||||||
end
|
end
|
||||||
"#{prefix.value}-#{id}_#{created_at.strftime('%d%m%Y')}.pdf"
|
"#{prefix}-#{id}_#{created_at.strftime('%d%m%Y')}.pdf"
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
|
@ -106,7 +106,8 @@ class Setting < ApplicationRecord
|
|||||||
confirmation_required
|
confirmation_required
|
||||||
wallet_module
|
wallet_module
|
||||||
statistics_module
|
statistics_module
|
||||||
upcoming_events_shown] }
|
upcoming_events_shown
|
||||||
|
payment_schedule_prefix] }
|
||||||
# WARNING: when adding a new key, you may also want to add it in app/policies/setting_policy.rb#public_whitelist
|
# WARNING: when adding a new key, you may also want to add it in app/policies/setting_policy.rb#public_whitelist
|
||||||
|
|
||||||
def value
|
def value
|
||||||
|
@ -883,6 +883,8 @@ Setting.set('stripe_currency', 'EUR') unless Setting.find_by(name: 'stripe_curre
|
|||||||
|
|
||||||
Setting.set('invoice_prefix', 'FabManager_invoice') unless Setting.find_by(name: 'invoice_prefix').try(:value)
|
Setting.set('invoice_prefix', 'FabManager_invoice') unless Setting.find_by(name: 'invoice_prefix').try(:value)
|
||||||
|
|
||||||
|
Setting.set('payment_schedule_prefix', 'FabManager_paymentSchedule') unless Setting.find_by(name: 'payment_schedule_prefix').try(:value)
|
||||||
|
|
||||||
Setting.set('confirmation_required', false) unless Setting.find_by(name: 'confirmation_required').try(:value)
|
Setting.set('confirmation_required', false) unless Setting.find_by(name: 'confirmation_required').try(:value)
|
||||||
|
|
||||||
Setting.set('wallet_module', true) unless Setting.find_by(name: 'wallet_module').try(:value)
|
Setting.set('wallet_module', true) unless Setting.find_by(name: 'wallet_module').try(:value)
|
||||||
|
38
scripts/mount-payment-schedules.sh
Normal file
38
scripts/mount-payment-schedules.sh
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
yq() {
|
||||||
|
docker run --rm -i -v "${PWD}:/workdir" mikefarah/yq yq "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
config()
|
||||||
|
{
|
||||||
|
echo -ne "Checking user... "
|
||||||
|
if [[ "$(whoami)" != "root" ]] && ! groups | grep docker
|
||||||
|
then
|
||||||
|
echo "Please add your current user to the docker group OR run this script as root."
|
||||||
|
echo "current user is not allowed to use docker, exiting..."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if ! command -v awk || ! [[ $(awk -W version) =~ ^GNU ]]
|
||||||
|
then
|
||||||
|
echo "Please install GNU Awk before running this script."
|
||||||
|
echo "gawk was not found, exiting..."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
SERVICE="$(yq r docker-compose.yml --printMode p 'services.*(.==sleede/fab-manager*)' | awk 'BEGIN { FS = "." } ; {print $2}')"
|
||||||
|
}
|
||||||
|
|
||||||
|
add_mount()
|
||||||
|
{
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
# we don't want to expand ${PWD}
|
||||||
|
yq w docker-compose.yml "services.$SERVICE.volumes[+]" '- ${PWD}/payment_schedules:/usr/src/app/payment_schedules'
|
||||||
|
}
|
||||||
|
|
||||||
|
proceed()
|
||||||
|
{
|
||||||
|
config
|
||||||
|
add_mount
|
||||||
|
}
|
||||||
|
|
||||||
|
proceed "$@"
|
@ -11,6 +11,7 @@ services:
|
|||||||
- ${PWD}/public/packs:/usr/src/app/public/packs
|
- ${PWD}/public/packs:/usr/src/app/public/packs
|
||||||
- ${PWD}/public/uploads:/usr/src/app/public/uploads
|
- ${PWD}/public/uploads:/usr/src/app/public/uploads
|
||||||
- ${PWD}/invoices:/usr/src/app/invoices
|
- ${PWD}/invoices:/usr/src/app/invoices
|
||||||
|
- ${PWD}/payment_schedules:/usr/src/app/payment_schedules
|
||||||
- ${PWD}/exports:/usr/src/app/exports
|
- ${PWD}/exports:/usr/src/app/exports
|
||||||
- ${PWD}/imports:/usr/src/app/imports
|
- ${PWD}/imports:/usr/src/app/imports
|
||||||
- ${PWD}/log:/var/log/supervisor
|
- ${PWD}/log:/var/log/supervisor
|
||||||
|
Loading…
x
Reference in New Issue
Block a user