enable actions for multi (group) orders and ordergroup invoices
This commit is contained in:
parent
f676497e43
commit
e902aa0d5a
44 changed files with 550 additions and 324 deletions
|
|
@ -0,0 +1,5 @@
|
|||
class AddMultiGroupOrderIdToOrdergroupInvoices < ActiveRecord::Migration[7.0]
|
||||
def change
|
||||
add_reference :ordergroup_invoices, :multi_group_order, foreign_key: true, type: :integer
|
||||
end
|
||||
end
|
||||
12
db/migrate/20250516104953_make_group_order_key_nullable.rb
Normal file
12
db/migrate/20250516104953_make_group_order_key_nullable.rb
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
class MakeGroupOrderKeyNullable < ActiveRecord::Migration[7.0]
|
||||
def change
|
||||
# Make column nullable (safe even if already is)
|
||||
change_column_null :group_orders, :multi_group_order_id, true
|
||||
|
||||
# Remove old FK if it exists (avoid name conflict)
|
||||
remove_foreign_key :group_orders, column: :multi_group_order_id
|
||||
|
||||
# Re-add with ON DELETE SET NULL
|
||||
add_foreign_key :group_orders, :multi_group_orders, column: :multi_group_order_id, on_delete: :nullify
|
||||
end
|
||||
end
|
||||
10
db/routes.rb
10
db/routes.rb
|
|
@ -148,6 +148,7 @@ Rails.application.routes.draw do
|
|||
end
|
||||
|
||||
|
||||
post 'finance/ordergroup_invoice', to: 'ordergroup_invoices#create_multiple',
|
||||
post 'finance/group_order_invoice', to: 'group_order_invoices#create_multiple'
|
||||
|
||||
get 'orders/:order_id/group_order_invoices/download_all', to: 'group_order_invoices#download_all', as: 'download_all_group_order_invoices'
|
||||
|
|
@ -155,6 +156,15 @@ Rails.application.routes.draw do
|
|||
resources :ordergroup_invoices do
|
||||
member do
|
||||
get :download_collective
|
||||
patch :select_sepa_sequence_type
|
||||
patch :toggle_paid
|
||||
patch :toggle_sepa_downloaded
|
||||
end
|
||||
collection do
|
||||
get :download_within_date
|
||||
patch :select_all_sepa_sequence_type
|
||||
patch :toggle_all_sepa_downloaded
|
||||
patch :toggle_all_paid
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[7.0].define(version: 2025_04_30_091541) do
|
||||
ActiveRecord::Schema[7.0].define(version: 2025_05_16_104953) do
|
||||
create_table "action_text_rich_texts", charset: "utf8mb4", collation: "utf8mb4_general_ci", force: :cascade do |t|
|
||||
t.string "name", null: false
|
||||
t.text "body", size: :long
|
||||
|
|
@ -226,7 +226,6 @@ ActiveRecord::Schema[7.0].define(version: 2025_04_30_091541) do
|
|||
t.index ["order_id"], name: "index_group_orders_on_order_id"
|
||||
t.index ["ordergroup_id", "order_id"], name: "index_group_orders_on_ordergroup_id_and_order_id", unique: true
|
||||
t.index ["ordergroup_id"], name: "index_group_orders_on_ordergroup_id"
|
||||
t.index ["ordergroup_invoice_id"], name: "index_group_orders_on_ordergroup_invoice_id"
|
||||
end
|
||||
|
||||
create_table "groups", id: :integer, charset: "utf8mb4", collation: "utf8mb4_general_ci", force: :cascade do |t|
|
||||
|
|
@ -407,6 +406,8 @@ ActiveRecord::Schema[7.0].define(version: 2025_04_30_091541) do
|
|||
t.string "sepa_sequence_type", default: "RCUR"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.integer "multi_group_order_id"
|
||||
t.index ["multi_group_order_id"], name: "index_ordergroup_invoices_on_multi_group_order_id"
|
||||
end
|
||||
|
||||
create_table "orders", id: :integer, charset: "utf8mb4", collation: "utf8mb4_general_ci", force: :cascade do |t|
|
||||
|
|
@ -626,7 +627,8 @@ ActiveRecord::Schema[7.0].define(version: 2025_04_30_091541) do
|
|||
|
||||
add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id"
|
||||
add_foreign_key "group_order_invoice_group_orders", "group_orders"
|
||||
add_foreign_key "group_orders", "multi_group_orders"
|
||||
add_foreign_key "group_orders", "multi_group_orders", on_delete: :nullify
|
||||
add_foreign_key "multi_group_orders", "multi_orders"
|
||||
add_foreign_key "ordergroup_invoices", "multi_group_orders"
|
||||
add_foreign_key "orders", "multi_orders"
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue