Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
4e34457
feat: add initial structure for invoices plugin
robwa Jul 3, 2025
8be31d4
feat(invoices): add basic data model
robwa Jul 8, 2025
cdedd1f
feat(invoices): add basic group order invoice view
robwa Jul 17, 2025
cb494d2
feat(assets): introduce dynamic asset registry
robwa Jul 17, 2025
ecc1865
feat(invoices): add dynamic asset registration
robwa Jul 17, 2025
ceaaee0
feat(config): add tax number and invoice settings
robwa Jul 17, 2025
9293635
feat(invoices): allow to create group order invoices
robwa Jul 17, 2025
4d7c6b3
feat(invoices): add group order invoice PDF generation
robwa Jul 17, 2025
45feab9
feat(invoices): activate delete link for group order invoices
robwa Jul 24, 2025
e0593d8
feat(invoices): activate toggle for paid status in group order invoices
robwa Jul 24, 2025
0a5335a
feat(invoices): remove SEPA-related functionality
robwa Jul 24, 2025
44a5d96
feat(invoices): add bulk creation for group order invoices
robwa Jul 24, 2025
b49a131
feat(invoices): enable bulk toggle and download for group order invoices
robwa Jul 24, 2025
db40ba6
feat(locales): add file date format to time formats
robwa Jul 24, 2025
9af21f2
feat(locales): add Dutch translations for group order invoices
robwa Jul 24, 2025
8c77993
refactor(invoices): fix rubocop offenses
robwa Jul 24, 2025
d9e85ac
feat(invoices): add gem and spec for group order invoices
robwa Jul 26, 2025
eaed6b6
fix(migrations): enforce NOT NULL constraint on boolean fields
robwa Jul 29, 2025
805ff19
feat(workflows): add plugin migrations step to Ruby CI
robwa Jul 29, 2025
abeef09
feat(invoices): enhance GroupOrderInvoicePdf generation
robwa Jul 29, 2025
a1292be
refactor(invoices): improve GroupOrderInvoicePdf structure
robwa Jul 29, 2025
5494d16
docs(invoices): update README with configuration and migration steps
robwa Jul 29, 2025
13905c3
feat(invoices): update UI for toggling invoice paid status
robwa Jul 30, 2025
82c2517
feat(invoices): implement multi-order creation and grouping
robwa Jul 31, 2025
0d04670
feat(invoices): introduce OrdergroupInvoice model and migration
robwa Jul 31, 2025
78ea8d9
feat(invoices): improve multi-order row with detailed modal and links
robwa Aug 4, 2025
24ac5b4
feat(invoices): add OrdergroupInvoicesController with full CRUD and b…
robwa Aug 4, 2025
08c6eca
feat(invoices): add UI and logic for toggling paid status
robwa Aug 4, 2025
3d634cc
feat(invoices): add UI and logic to toggle all invoices as paid
robwa Aug 4, 2025
dacf8af
feat(invoices): add create and download-all actions for OrdergroupInv…
robwa Aug 4, 2025
66fc8f3
feat(invoices): automate group order invoice email notifications
robwa Aug 5, 2025
f62ffcd
feat(invoices): add email notification support for ordergroup invoices
robwa Aug 5, 2025
2b4974c
feat(invoices): add UI and logic for toggling SEPA downloaded status
robwa Aug 6, 2025
bc0fc6b
feat(invoices): add SEPA sequence type selection support
robwa Aug 6, 2025
51de361
feat(invoices): add SEPA collective direct debit generation
robwa Aug 7, 2025
0e43e15
refactor(invoices): optimize SEPA export and error handling
robwa Aug 7, 2025
1862ce2
feat(invoices): add SEPA functionality for multi orders
robwa Aug 7, 2025
9cba1e8
feat(invoices): add group order invoices settings
robwa Aug 7, 2025
eddca70
fix(invoices): remove redundant type in migrations
robwa Aug 7, 2025
c2b0e1e
feat(configs): add tax number field to admin settings
robwa Aug 7, 2025
3882ecb
fix(invoices): update group order handling in SEPA export
robwa Aug 7, 2025
5574e4b
feat(invoices): enhance localization and SEPA UI
robwa Aug 8, 2025
3ac0d3b
feat(invoices): add SEPA localization and direct debit updates
robwa Aug 8, 2025
b48e1bb
test(invoices): add model specs and factories
robwa Aug 9, 2025
2add878
refactor(invoices): modularize extension enabling logic
robwa Aug 11, 2025
f2cb9d1
feat(docs): update invoice plugin README
robwa Aug 11, 2025
22ff001
test(invoices): add additional specs for models
robwa Aug 11, 2025
b88d18d
test(invoices): add controller specs for orders and finance
robwa Aug 11, 2025
2782aff
feat(invoices): replace hardcoded strings with I18n keys
robwa Aug 12, 2025
e851d49
test(invoices): add specs and factories for SEPA and multi-orders
robwa Aug 12, 2025
a02ba7c
test(invoices): add feature spec for finance balancing
robwa Aug 12, 2025
f235708
fix(invoices): call `enable_extensions!` on module
robwa Aug 13, 2025
235d43c
feat(invoices): update dependencies for SEPA support
robwa Oct 8, 2025
01fb9b3
feat(configs): add tax number field to foodcoop settings
robwa Oct 8, 2025
41b9bfa
feat(assets): introduce asset registry for precompilation
robwa Oct 8, 2025
f5bdc32
fix(finance): update button classes for consistency
robwa Oct 8, 2025
ebd4480
fix: fix tests after Ruby and Rails upgrade
robwa Oct 17, 2025
f767ef1
fix(finance): improve row selection for invoice column
robwa Oct 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ jobs:
env:
DATABASE_URL: mysql2://user:[email protected]/test
RAILS_ENV: test
- name: Apply plugin migrations
run: bundle exec rake foodsoft_invoices_engine:install:migrations db:migrate
env:
DATABASE_URL: mysql2://user:[email protected]/test
RAILS_ENV: test
- name: Run tests
run: bundle exec rake rspec-rerun:spec
env:
Expand Down
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ gem 'foodsoft_wiki', path: 'plugins/wiki'
# gem 'foodsoft_printer', path: 'plugins/printer'
# gem 'foodsoft_uservoice', path: 'plugins/uservoice'
# gem 'foodsoft_mollie', path: 'plugins/mollie'
# gem 'foodsoft_invoices', path: 'plugins/invoices'

group :development do
gem 'listen'
Expand Down Expand Up @@ -135,4 +136,5 @@ group :test do
gem 'rswag-specs'
# plugins with tests deactivated by default
gem 'foodsoft_b85', path: 'plugins/b85'
gem 'foodsoft_invoices', path: 'plugins/invoices'
end
16 changes: 16 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ PATH
rails
ruby-filemagic

PATH
remote: plugins/invoices
specs:
foodsoft_invoices (0.1.0)
deface (~> 1.0)
prawn
prawn-table
rails
sepa_king

PATH
remote: plugins/links
specs:
Expand Down Expand Up @@ -277,6 +287,7 @@ GEM
i18n (>= 0.6.6, < 2)
i18n-spec (0.6.0)
iso
iban-tools (1.2.1)
ice_cube (0.17.0)
image_processing (1.13.0)
mini_magick (>= 4.9.5, < 5)
Expand Down Expand Up @@ -600,6 +611,10 @@ GEM
tilt
securerandom (0.4.1)
select2-rails (4.0.13)
sepa_king (0.14.0)
activemodel (>= 4.2)
iban-tools
nokogiri
simple-navigation (4.4.0)
activesupport (>= 2.3.2)
simple_form (5.3.1)
Expand Down Expand Up @@ -739,6 +754,7 @@ DEPENDENCIES
foodsoft_b85!
foodsoft_discourse!
foodsoft_documents!
foodsoft_invoices!
foodsoft_links!
foodsoft_messages!
foodsoft_polls!
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/finance/balancing_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ def close
@type = FinancialTransactionType.find_by_id(params.permit(:type)[:type])
@link = FinancialLink.new if params[:create_financial_link]
@order.close!(@current_user, @type, @link, create_foodcoop_transaction: params[:create_foodcoop_transaction])
# Allow plugins to react on order close
ActiveSupport::Notifications.instrument('foodsoft.order.closed', order: @order)
redirect_to finance_order_index_url, notice: t('.notice')
rescue StandardError => e
redirect_to new_finance_order_url(order_id: @order.id), alert: t('.alert', message: e.message)
Expand Down
1 change: 1 addition & 0 deletions app/views/admin/configs/_tab_foodcoop.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
= config_input c, :country, as: :string, input_html: {class: 'form-control'}
= config_input c, :email, required: true, input_html: {class: 'form-control'}
= config_input c, :phone, input_html: {class: 'form-control'}
= config_input c, :tax_number, input_html: {class: 'form-control'}
= config_input form, :homepage, required: true, as: :url, input_html: {class: 'form-control'}
14 changes: 14 additions & 0 deletions app/views/finance/balancing/_order_row.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
- row_class = cycle("even","odd", :name => "order")
%tr{:class => row_class, 'data-order_id' => order.id}
%td= link_to truncate(order.name), new_finance_order_path(order_id: order.id)
%td=h format_time(order.ends) unless order.ends.nil?
%td= order.closed? ? t('finance.balancing.orders.cleared', amount: number_to_currency(order.foodcoop_result)) : t('finance.balancing.orders.ended')
%td= show_user(order.updated_by)
%td
- unless order.closed?
- if current_user.role_orders?
- unless order.stockit?
= link_to t('orders.index.action_receive'), receive_order_path(order), class: 'btn btn-default btn-sm'
- else
= link_to t('orders.index.action_receive'), '#', class: 'btn btn-sm disabled'
= link_to t('finance.balancing.orders.clear'), new_finance_order_path(order_id: order.id), class: 'btn btn-sm btn-primary'
16 changes: 2 additions & 14 deletions app/views/finance/balancing/_orders.html.haml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
- unless @orders.empty?
- if Order.finished.count > 20
- if @orders.total_count > 20
= items_per_page
= pagination_links_remote @orders
%table.table.table-striped
Expand All @@ -12,18 +12,6 @@
%th
%tbody
- @orders.each do |order|
%tr{:class => cycle("even","odd", :name => "order")}
%td= link_to truncate(order.name), new_finance_order_path(order_id: order.id)
%td=h format_time(order.ends) unless order.ends.nil?
%td= order.closed? ? t('.cleared', amount: number_to_currency(order.foodcoop_result)) : t('.ended')
%td= show_user(order.updated_by)
%td
- unless order.closed?
- if current_user.role_orders?
- unless order.stockit?
= link_to t('orders.index.action_receive'), receive_order_path(order), class: 'btn btn-default btn-sm'
- else
= link_to t('orders.index.action_receive'), '#', class: 'btn btn-sm disabled'
= link_to t('.clear'), new_finance_order_path(order_id: order.id), class: 'btn btn-sm btn-primary'
= render partial: 'order_row', locals: { order: order }
- else
%i= t('.no_closed_orders')
4 changes: 2 additions & 2 deletions app/views/layouts/_header.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
%meta(name="viewport" content="width=device-width, initial-scale=1.0")
%title= [t('layouts.foodsoft'), yield(:title)].join(" - ")
= csrf_meta_tags
= stylesheet_link_tag "application", :media => "all"
= stylesheet_link_tag *Foodsoft::AssetRegistry.stylesheets, media: "all"
//%link(href="images/favicon.ico" rel="shortcut icon")
= yield(:head)
= foodcoop_css_tag
Expand All @@ -20,7 +20,7 @@
\==================================================
/ Placed at the end of the document so the pages load faster
= javascript_importmap_tags
= javascript_include_tag "application_legacy"
= javascript_include_tag *Foodsoft::AssetRegistry.javascripts

:javascript
I18n.defaultLocale = "#{I18n.default_locale}";
Expand Down
11 changes: 11 additions & 0 deletions config/app_config.yml.SAMPLE
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ default: &defaults
country: Deutschland
email: [email protected]
phone: "030 323 23249"
tax_number: "12345"

# Homepage
homepage: http://www.foodcoop.test
Expand Down Expand Up @@ -105,6 +106,16 @@ default: &defaults
# Members of a user's groups and administrators can still see full names.
use_nick: false

# When use_invoices is enabled, it is possible to generate group order invoices
# in balancing view.
use_invoices: false
group_order_invoices:
iban: DE12345
bic: GENODE123
creditor_identifier: DE98ZZZ09999999999
use_automatic_invoices: false
vat_exempt: false

# Most plugins can be enabled/disabled here as well. Messages and wiki are enabled
# by default and need to be set to false to disable. Most other plugins needs to
# be enabled before they do anything.
Expand Down
3 changes: 3 additions & 0 deletions config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,7 @@

# Raise error when a before_action's only/except options reference missing actions
config.action_controller.raise_on_missing_callback_actions = true

# Add factories from plugins
config.factory_bot.definition_file_paths += Dir['plugins/**/spec/factories']
end
5 changes: 5 additions & 0 deletions config/initializers/assets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,8 @@
# application.js, application.css, and all non-JS/CSS in the app/assets
# folder are already added.
Rails.application.config.assets.precompile += %w[application_legacy.js jquery.min.js trix-editor-overrides.js]

# Add registered assets after all plugins have been initialized
Rails.application.config.after_initialize do
Rails.application.config.assets.precompile += Foodsoft::AssetRegistry.precompile_assets
end
4 changes: 4 additions & 0 deletions config/locales/de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,7 @@ de:
phone: Telefon
street: Straße
zip_code: Postleitzahl
tax_number: Steuernummer
currency_space: Leerzeichen hinzufügen
currency_unit: Währung
custom_css: Angepasstes CSS
Expand Down Expand Up @@ -1566,6 +1567,7 @@ de:
confirm_end: Willst Du wirklich die Bestellung %{order} beenden? Es gibt kein zurück.
new_order: Neue Bestellung anlegen
no_open_or_finished_orders: Derzeit gibt es keine laufende oder beendete Bestellungen.
not_closed: Nicht abgerechnet
orders_finished: Beendet
orders_open: Laufend
orders_settled: Abgerechnet
Expand Down Expand Up @@ -1976,6 +1978,7 @@ de:
cancel: Abbrechen
close: Schließen
confirm_delete: Willst du %{name} wirklich löschen?
confirm_mark_all: Willst du wirklich '%{name}' für alle setzen?
confirm_restore: Willst du %{name} wirklich wiederherstellen?
copy: Kopieren
delete: Löschen
Expand Down Expand Up @@ -2010,3 +2013,4 @@ de:
time:
formats:
foodsoft_datetime: "%d.%m.%Y %H:%M"
file: "%Y-%d-%B"
4 changes: 4 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,7 @@ en:
phone: Phone
street: Street
zip_code: Postcode
tax_number: Tax number
currency_space: add space
currency_unit: Currency
custom_css: Custom CSS
Expand Down Expand Up @@ -1571,6 +1572,7 @@ en:
confirm_end: Do you really want to close the order %{order}? There is no going back.
new_order: Create new order
no_open_or_finished_orders: There are currently no open or closed orders.
not_closed: Not accounted
orders_finished: Closed
orders_open: Open
orders_settled: Settled
Expand Down Expand Up @@ -1981,6 +1983,7 @@ en:
cancel: Cancel
close: Close
confirm_delete: Do you really want to delete %{name}?
confirm_mark_all: Do you really want to set '%{name}' for all?
confirm_restore: Do you really want to restore %{name}?
copy: Copy
delete: Delete
Expand Down Expand Up @@ -2015,3 +2018,4 @@ en:
time:
formats:
foodsoft_datetime: "%Y-%m-%d %H:%M"
file: "%Y-%d-%B"
1 change: 1 addition & 0 deletions config/locales/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1894,3 +1894,4 @@ es:
time:
formats:
foodsoft_datetime: "%d/%b/%Y %H:%M"
file: "%Y-%d-%B"
1 change: 1 addition & 0 deletions config/locales/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1366,3 +1366,4 @@ fr:
time:
formats:
foodsoft_datetime: "%d/%m/%Y %H:%M"
file: "%Y-%d-%B"
3 changes: 3 additions & 0 deletions config/locales/nl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1487,6 +1487,7 @@ nl:
confirm_end: Wil je de bestelling %{order} werkelijk sluiten? Dit kun je niet ongedaan maken.
new_order: Nieuwe bestelling openen
no_open_or_finished_orders: Er zijn momenteel geen open of gesloten bestellingen.
not_closed: Niet afgerekend
orders_finished: Gesloten
orders_open: Open
orders_settled: Afgerekend
Expand Down Expand Up @@ -1861,6 +1862,7 @@ nl:
cancel: Annuleren
close: Sluiten
confirm_delete: Wil je %{name} echt verwijderen?
confirm_mark_all: Wil je '%{name}' echt voor iedereen instellen?
confirm_restore: Wil je %{name} echt opnieuw actief maken?
copy: Kopiëren
delete: Verwijder
Expand Down Expand Up @@ -1895,3 +1897,4 @@ nl:
time:
formats:
foodsoft_datetime: "%d-%m-%Y %H:%M"
file: "%Y-%d-%B"
1 change: 1 addition & 0 deletions config/locales/tr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1892,3 +1892,4 @@ tr:
time:
formats:
foodsoft_datetime: "%d.%b.%Y %H:%M"
file: "%Y-%d-%B"
27 changes: 27 additions & 0 deletions lib/foodsoft/asset_registry.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# frozen_string_literal: true

module Foodsoft
class AssetRegistry
class << self
def stylesheets
@stylesheets ||= Set.new(['application'])
end

def javascripts
@javascripts ||= Set.new(['application_legacy'])
end

def register_stylesheet(name)
stylesheets.add(name)
end

def register_javascript(name)
javascripts.add(name)
end

def precompile_assets
(stylesheets.map { |s| "#{s}.css" } + javascripts.map { |j| "#{j}.js" }).to_a
end
end
end
end
Loading
Loading