diff --git a/.github/workflows/development.yml b/.github/workflows/test.yml
similarity index 95%
rename from .github/workflows/development.yml
rename to .github/workflows/test.yml
index 2b16cbd..e3a94f6 100644
--- a/.github/workflows/development.yml
+++ b/.github/workflows/test.yml
@@ -36,4 +36,4 @@ jobs:
run: |
git config --global user.email "samuel@oriontransfer.net"
git config --global user.name "Samuel Williams"
- ${{matrix.env}} bundle exec rspec
+ bundle exec bake test
diff --git a/.rspec b/.rspec
deleted file mode 100644
index 0c705cb..0000000
--- a/.rspec
+++ /dev/null
@@ -1,4 +0,0 @@
---format documentation
---backtrace
---warnings
---require spec_helper
diff --git a/config.ru b/config.ru
new file mode 100644
index 0000000..106b450
--- /dev/null
+++ b/config.ru
@@ -0,0 +1,8 @@
+#!/usr/bin/env rackup
+# frozen_string_literal: true
+
+require_relative 'config/environment'
+
+require 'financier/middleware'
+
+Financier::Middleware.call(self, utopia: UTOPIA)
diff --git a/config/environment.rb b/config/environment.rb
new file mode 100644
index 0000000..3f25094
--- /dev/null
+++ b/config/environment.rb
@@ -0,0 +1,14 @@
+# frozen_string_literal: true
+
+require 'bundler/setup'
+Bundler.setup
+
+require 'utopia/setup'
+UTOPIA ||= Utopia.setup
+
+require_relative '../db/environment'
+
+require 'financier'
+require 'json'
+
+require 'time/zone'
diff --git a/config/sus.rb b/config/sus.rb
new file mode 100644
index 0000000..931b1c8
--- /dev/null
+++ b/config/sus.rb
@@ -0,0 +1,4 @@
+require 'covered/sus'
+include Covered::Sus
+
+require_relative 'environment'
diff --git a/financier.gemspec b/financier.gemspec
index 76f93b7..addaee3 100644
--- a/financier.gemspec
+++ b/financier.gemspec
@@ -22,16 +22,17 @@ Gem::Specification.new do |spec|
spec.add_dependency "utopia", "~> 2.18"
- spec.add_dependency "relaxo", "~> 1.3"
+ spec.add_dependency "relaxo", "~> 1.7"
spec.add_dependency "relaxo-model", "~> 0.19"
- spec.add_dependency "periodical", "~> 1.0"
- spec.add_dependency "latinum", "~> 1.3"
+ spec.add_dependency "periodical", "~> 1.2"
+ spec.add_dependency "latinum", "~> 1.8"
spec.add_dependency "time-zone", "~> 1.1"
spec.add_dependency "ofx", "~> 0.3"
spec.add_dependency "qif", "~> 1.1"
+ spec.add_dependency "csv", "~> 3.0"
spec.add_dependency "bcrypt", "~> 3.0"
@@ -40,9 +41,4 @@ Gem::Specification.new do |spec|
spec.add_dependency "markly"
spec.add_dependency "tty-prompt"
-
- spec.add_development_dependency 'covered'
- spec.add_development_dependency 'bundler'
- spec.add_development_dependency 'rspec'
- spec.add_development_dependency 'bake-bundler'
end
diff --git a/fixtures/website.rb b/fixtures/website.rb
new file mode 100644
index 0000000..d2da6bc
--- /dev/null
+++ b/fixtures/website.rb
@@ -0,0 +1,39 @@
+# frozen_string_literal: true
+
+# Released under the MIT License.
+# Copyright, 2016-2023, by Samuel Williams.
+
+require 'rack/test'
+require 'sus/fixtures/async/http'
+require 'protocol/rack'
+
+AWebsite = Sus::Shared("a website") do
+ include Rack::Test::Methods
+
+ let(:rackup_path) {File.expand_path('../config.ru', __dir__)}
+ let(:rackup_directory) {File.dirname(rackup_path)}
+
+ let(:app) {Rack::Builder.parse_file(rackup_path)}
+end
+
+AValidPage = Sus::Shared("a valid page") do |path|
+ it "can access #{path}" do
+ get path
+
+ while last_response.redirect?
+ follow_redirect!
+ end
+
+ expect(last_response.status).to be == 200
+ end
+end
+
+AServer = Sus::Shared("a server") do
+ include Sus::Fixtures::Async::HTTP::ServerContext
+
+ let(:rackup_path) {File.expand_path('../config.ru', __dir__)}
+ let(:rackup_directory) {File.dirname(rackup_path)}
+
+ let(:rack_app) {Rack::Builder.parse_file(rackup_path)}
+ let(:app) {Protocol::Rack::Adapter.new(rack_app)}
+end
diff --git a/gems.locked b/gems.locked
index adafd12..44f42e4 100644
--- a/gems.locked
+++ b/gems.locked
@@ -3,12 +3,13 @@ PATH
specs:
financier (0.1.0)
bcrypt (~> 3.0)
- latinum (~> 1.3)
+ csv (~> 3.0)
+ latinum (~> 1.8)
markly
ofx (~> 0.3)
- periodical (~> 1.0)
+ periodical (~> 1.2)
qif (~> 1.1)
- relaxo (~> 1.3)
+ relaxo (~> 1.7)
relaxo-model (~> 0.19)
time-zone (~> 1.1)
tty-prompt
@@ -19,44 +20,39 @@ PATH
GEM
remote: https://rubygems.org/
specs:
- async (2.11.0)
- console (~> 1.25, >= 1.25.2)
+ async (2.17.0)
+ console (~> 1.26)
fiber-annotation
- io-event (~> 1.5, >= 1.5.1)
- timers (~> 4.1)
- async-await (0.6.0)
+ io-event (~> 1.6, >= 1.6.5)
+ async-await (0.7.0)
async
- ruby2_keywords
- async-container (0.18.2)
+ async-container (0.18.3)
async (~> 2.10)
- async-http (0.66.2)
+ async-http (0.79.0)
async (>= 2.10.2)
- async-pool (>= 0.6.1)
- io-endpoint (~> 0.10)
+ async-pool (~> 0.7)
+ io-endpoint (~> 0.11)
io-stream (~> 0.4)
- protocol-http (~> 0.26.0)
- protocol-http1 (~> 0.19.0)
- protocol-http2 (~> 0.17.0)
- traces (>= 0.10.0)
- async-http-cache (0.4.3)
+ protocol-http (~> 0.37)
+ protocol-http1 (~> 0.27)
+ protocol-http2 (~> 0.19)
+ traces (>= 0.10)
+ async-http-cache (0.4.4)
async-http (~> 0.56)
async-io (1.43.2)
async
- async-pool (0.6.1)
+ async-pool (0.8.1)
async (>= 1.25)
- async-rspec (1.17.0)
- rspec (~> 3.0)
- rspec-files (~> 1.0)
- rspec-memory (~> 1.0)
+ metrics
+ traces
async-service (0.12.0)
async
async-container (~> 0.16)
- bake (0.20.0)
+ bake (0.21.0)
bigdecimal
samovar (~> 2.1)
- bake-bundler (0.3.5)
- bake (~> 0.9)
- rspec
+ bake-test (0.3.0)
+ bake
bcrypt (3.1.20)
benchmark-http (0.17.0)
async-await
@@ -66,82 +62,56 @@ GEM
samovar (~> 2.0)
xrb-sanitize
bigdecimal (3.1.8)
- coderay (1.1.3)
- concurrent-ruby (1.2.3)
- console (1.25.2)
+ concurrent-ruby (1.3.4)
+ console (1.27.0)
fiber-annotation
fiber-local (~> 1.1)
json
- covered (0.25.1)
+ covered (0.26.0)
console (~> 1.0)
msgpack (~> 1.0)
+ csv (3.3.0)
date (3.3.4)
- diff-lcs (1.5.1)
- falcon (0.47.3)
+ falcon (0.48.2)
async
async-container (~> 0.18)
- async-http (~> 0.66, >= 0.66.2)
- async-http-cache (~> 0.4.0)
+ async-http (~> 0.75)
+ async-http-cache (~> 0.4)
async-service (~> 0.10)
bundler
localhost (~> 1.1)
openssl (~> 3.0)
- process-metrics (~> 0.2.0)
- protocol-rack (~> 0.5)
+ process-metrics (~> 0.2)
+ protocol-http (~> 0.31)
+ protocol-rack (~> 0.7)
samovar (~> 2.3)
- ffi (1.16.3)
fiber-annotation (0.2.0)
fiber-local (1.1.0)
fiber-storage
- fiber-storage (0.1.0)
- formatador (1.1.0)
- guard (2.18.1)
- formatador (>= 0.2.4)
- listen (>= 2.7, < 4.0)
- lumberjack (>= 1.0.12, < 2.0)
- nenv (~> 0.1)
- notiffany (~> 0.0)
- pry (>= 0.13.0)
- shellany (~> 0.0)
- thor (>= 0.18.1)
- guard-compat (1.2.1)
- guard-falcon (0.13.1)
- async-container (~> 0.16)
- console (~> 1.0)
- falcon (~> 0.35)
- guard
- guard-compat (~> 1.2)
- guard-rspec (4.7.3)
- guard (~> 2.1)
- guard-compat (~> 1.1)
- rspec (>= 2.99.0, < 4.0)
+ fiber-storage (1.0.0)
http-accept (2.2.1)
- io-endpoint (0.10.2)
- io-event (1.5.1)
- io-stream (0.4.0)
+ io-endpoint (0.13.1)
+ io-event (1.6.5)
+ io-stream (0.4.1)
+ io-watch (0.6.3)
json (2.7.2)
latinum (1.8.0)
- listen (3.9.0)
- rb-fsevent (~> 0.10, >= 0.10.3)
- rb-inotify (~> 0.9, >= 0.9.10)
localhost (1.3.1)
- lumberjack (1.2.10)
mail (2.8.1)
mini_mime (>= 0.1.1)
net-imap
net-pop
net-smtp
mapping (1.1.1)
- markly (0.10.0)
- method_source (1.1.0)
+ markly (0.12.1)
+ metrics (0.10.2)
mime-types (3.5.2)
mime-types-data (~> 3.2015)
- mime-types-data (3.2024.0507)
+ mime-types-data (3.2024.0903)
mini_mime (1.1.5)
- mini_portile2 (2.8.6)
+ mini_portile2 (2.8.7)
msgpack (1.7.2)
- nenv (0.3.0)
- net-imap (0.4.10)
+ net-imap (0.4.16)
date
net-protocol
net-pop (0.1.2)
@@ -153,74 +123,53 @@ GEM
nokogiri (1.13.10)
mini_portile2 (~> 2.8.0)
racc (~> 1.4)
- notiffany (0.1.3)
- nenv (~> 0.1)
- shellany (~> 0.0)
ofx (0.3.5)
nokogiri (~> 1.13.1)
openssl (3.2.0)
pastel (0.8.0)
tty-color (~> 0.5)
periodical (1.2.0)
- process-metrics (0.2.1)
+ process-metrics (0.3.0)
console (~> 1.8)
+ json (~> 2)
samovar (~> 2.1)
- protocol-hpack (1.4.3)
- protocol-http (0.26.5)
- protocol-http1 (0.19.1)
+ protocol-hpack (1.5.1)
+ protocol-http (0.37.0)
+ protocol-http1 (0.27.0)
protocol-http (~> 0.22)
- protocol-http2 (0.17.0)
+ protocol-http2 (0.19.2)
protocol-hpack (~> 1.4)
protocol-http (~> 0.18)
- protocol-rack (0.5.1)
- protocol-http (~> 0.23)
+ protocol-rack (0.10.0)
+ protocol-http (~> 0.37)
rack (>= 1.0)
- pry (0.14.2)
- coderay (~> 1.1)
- method_source (~> 1.0)
qif (1.2.0)
- racc (1.7.3)
- rack (3.0.10)
+ racc (1.8.1)
+ rack (3.1.7)
rack-test (2.1.0)
rack (>= 1.3)
- rb-fsevent (0.11.2)
- rb-inotify (0.10.1)
- ffi (~> 1.0)
relaxo (1.7.0)
console
rugged
relaxo-model (0.19.0)
msgpack (~> 1.0)
relaxo (~> 1.5)
- rspec (3.13.0)
- rspec-core (~> 3.13.0)
- rspec-expectations (~> 3.13.0)
- rspec-mocks (~> 3.13.0)
- rspec-core (3.13.0)
- rspec-support (~> 3.13.0)
- rspec-expectations (3.13.0)
- diff-lcs (>= 1.2.0, < 2.0)
- rspec-support (~> 3.13.0)
- rspec-files (1.1.3)
- rspec (~> 3.0)
- rspec-memory (1.0.4)
- rspec (~> 3.0)
- rspec-mocks (3.13.0)
- diff-lcs (>= 1.2.0, < 2.0)
- rspec-support (~> 3.13.0)
- rspec-support (3.13.1)
- ruby2_keywords (0.0.5)
rugged (1.7.2)
samovar (2.3.0)
console (~> 1.0)
mapping (~> 1.0)
- shellany (0.0.1)
- thor (1.3.1)
+ sus (0.31.0)
+ sus-fixtures-async (0.2.0)
+ async
+ sus (~> 0.10)
+ sus-fixtures-async-http (0.9.0)
+ async-http (~> 0.54)
+ sus (~> 0.31)
+ sus-fixtures-async (~> 0.1)
thread-local (1.1.0)
time-zone (1.2.0)
timeout (0.4.1)
- timers (4.3.5)
- traces (0.11.1)
+ traces (0.13.1)
tty-color (0.6.0)
tty-cursor (0.7.1)
tty-prompt (0.23.1)
@@ -231,7 +180,7 @@ GEM
tty-screen (~> 0.8)
wisper (~> 2.0)
tty-screen (0.8.2)
- utopia (2.24.2)
+ utopia (2.25.0)
bake (~> 0.20)
concurrent-ruby (~> 1.2)
console (~> 1.24)
@@ -259,16 +208,15 @@ PLATFORMS
ruby
DEPENDENCIES
- async-rspec
- bake-bundler
+ bake-test
benchmark-http
- bundler
covered
+ falcon
financier!
- guard-falcon
- guard-rspec
+ io-watch
rack-test
- rspec
+ sus
+ sus-fixtures-async-http
BUNDLED WITH
- 2.5.5
+ 2.5.16
diff --git a/gems.rb b/gems.rb
index 382bbcf..039895e 100644
--- a/gems.rb
+++ b/gems.rb
@@ -4,12 +4,16 @@
gemspec
-group :development do
- gem 'rack-test'
+group :test do
+ gem 'sus'
+ gem 'covered'
- gem 'guard-falcon', require: false
- gem 'guard-rspec', require: false
+ gem "falcon"
+ gem 'rack-test'
+ gem 'sus-fixtures-async-http'
- gem 'async-rspec'
gem 'benchmark-http'
+ gem 'io-watch'
+
+ gem 'bake-test'
end
diff --git a/lib/financier/service.rb b/lib/financier/service.rb
index de9eb72..4bd1947 100644
--- a/lib/financier/service.rb
+++ b/lib/financier/service.rb
@@ -93,7 +93,7 @@ def billing_description(to_date = nil)
def self.generate_invoice(dataset, services, date, **arguments)
today = Date.today
- invoice = Invoice.insert(dataset, **arguments)
+ invoice = Invoice.insert(dataset, arguments)
services.each do |service|
# Round down the number of periods:
diff --git a/lib/financier/timesheet.rb b/lib/financier/timesheet.rb
index b215171..b6d1867 100644
--- a/lib/financier/timesheet.rb
+++ b/lib/financier/timesheet.rb
@@ -114,7 +114,7 @@ def entries
end
def self.generate_invoice(dataset, entries, **arguments)
- invoice = Invoice.insert(dataset, **arguments)
+ invoice = Invoice.insert(dataset, arguments)
entries.each do |entry|
transaction = Invoice::Transaction.create(dataset,
diff --git a/pages/accounts/controller.rb b/pages/accounts/controller.rb
index c1b09c1..b9c1ade 100644
--- a/pages/accounts/controller.rb
+++ b/pages/accounts/controller.rb
@@ -25,7 +25,7 @@
on 'delete' do |request, path|
fail!(:forbidden) unless request.post?
- documents = request[:rows].values
+ documents = request.params[:rows].values
Financier::DB.commit(message: "Delete Companies") do |dataset|
documents.each do |document|
@@ -52,7 +52,7 @@
end
on 'edit' do |request, path|
- @account = Financier::Account.fetch_all(Financier::DB.current, id: request[:id])
+ @account = Financier::Account.fetch_all(Financier::DB.current, id: request.params[:id])
if request.post?
@account.assign(request.params, PARAMETERS)
@@ -66,11 +66,11 @@
end
on 'show' do |request, path|
- @account = Financier::Account.fetch_all(Financier::DB.current, id: request[:id])
+ @account = Financier::Account.fetch_all(Financier::DB.current, id: request.params[:id])
end
on 'download' do |request, path|
- @account = Financier::Account.fetch_all(Financier::DB.current, id: request[:id])
+ @account = Financier::Account.fetch_all(Financier::DB.current, id: request.params[:id])
currencies = Set.new
balance = Latinum::Collection.new(currencies)
@@ -151,16 +151,16 @@ def import_csv(path)
end
on 'import' do |request, path|
- if request[:account]
- @account = Financier::Account.fetch(Financier::DB.current, request[:account])
+ if request.params[:account]
+ @account = Financier::Account.fetch(Financier::DB.current, request.params[:account])
else
@account = nil
end
- @default_currency = request[:default_currency] || "NZD"
+ @default_currency = request.params[:default_currency] || "NZD"
if request.post? and @account
- upload = request[:data]
+ upload = request.params[:data]
case upload[:filename]
when /\.ofx/i
diff --git a/pages/accounts/transactions/controller.rb b/pages/accounts/transactions/controller.rb
index 01f248c..35c6c31 100644
--- a/pages/accounts/transactions/controller.rb
+++ b/pages/accounts/transactions/controller.rb
@@ -12,7 +12,7 @@
on 'delete' do |request, path|
fail!(:forbidden) unless request.post?
- documents = request[:rows].values
+ documents = request.params[:rows].values
Financier::DB.commit(message: "Delete Account Transactions") do |dataset|
documents.each do |document|
@@ -27,7 +27,7 @@
on 'new' do |request, path|
@transaction = Financier::Account::Transaction.create(Financier::DB.current, timestamp: Time.now)
- @transaction.account = Financier::Account.fetch_all(@transaction.dataset, id: request[:account_id])
+ @transaction.account = Financier::Account.fetch_all(@transaction.dataset, id: request.params[:account_id])
if request.post?
@transaction.assign(request.params, PARAMETERS)
@@ -36,16 +36,16 @@
@transaction.save(dataset)
end
- redirect! request[:_return] || "../show?id=#{@transaction.account.id}"
+ redirect! request.params[:_return] || "../show?id=#{@transaction.account.id}"
end
end
on 'show' do |request, path|
- @transaction = Financier::Account::Transaction.fetch_all(Financier::DB.current, id: request[:id])
+ @transaction = Financier::Account::Transaction.fetch_all(Financier::DB.current, id: request.params[:id])
end
on 'edit' do |request, path|
- @transaction = Financier::Account::Transaction.fetch_all(Financier::DB.current, id: request[:id])
+ @transaction = Financier::Account::Transaction.fetch_all(Financier::DB.current, id: request.params[:id])
if request.post?
@transaction.assign(request.params, PARAMETERS)
@@ -54,6 +54,6 @@
@transaction.save(dataset)
end
- redirect! request[:_return] || "../show?id=#{@transaction.account.id}"
+ redirect! request.params[:_return] || "../show?id=#{@transaction.account.id}"
end
end
diff --git a/pages/addresses/controller.rb b/pages/addresses/controller.rb
index 694c982..8e81d57 100644
--- a/pages/addresses/controller.rb
+++ b/pages/addresses/controller.rb
@@ -19,7 +19,7 @@
on 'delete' do |request, path|
fail!(:forbidden) unless request.post?
- documents = request[:rows].values
+ documents = request.params[:rows].values
Financier::DB.commit(message: "Delete Companies") do |dataset|
documents.each do |document|
@@ -46,7 +46,7 @@
end
on 'edit' do |request, path|
- @address = Financier::Address.fetch_all(Financier::DB.current, id: request[:id])
+ @address = Financier::Address.fetch_all(Financier::DB.current, id: request.params[:id])
if request.post?
@address.assign(request.params, PARAMETERS)
@@ -60,5 +60,5 @@
end
on 'print' do |request, path|
- @address = Financier::Address.fetch_all(Financier::DB.current, id: request[:id])
+ @address = Financier::Address.fetch_all(Financier::DB.current, id: request.params[:id])
end
diff --git a/pages/companies/controller.rb b/pages/companies/controller.rb
index 7c63ca4..c922650 100644
--- a/pages/companies/controller.rb
+++ b/pages/companies/controller.rb
@@ -9,7 +9,7 @@
on 'delete' do |request, path|
fail!(:forbidden) unless request.post?
- documents = request[:rows].values
+ documents = request.params[:rows].values
Financier::DB.commit(message: "Delete Companies") do |dataset|
documents.each do |document|
@@ -36,7 +36,7 @@
end
on 'edit' do |request, path|
- @company = Financier::Company.fetch_all(Financier::DB.current, id: request[:id])
+ @company = Financier::Company.fetch_all(Financier::DB.current, id: request.params[:id])
if request.post?
@company.assign(request.params, PARAMETERS)
diff --git a/pages/controller.rb b/pages/controller.rb
index 29b4a18..7a78c3b 100644
--- a/pages/controller.rb
+++ b/pages/controller.rb
@@ -3,9 +3,9 @@
on 'login' do |request, path|
if request.post?
- user = Financier::User.fetch_by_name(Financier::DB.current, name: request[:name])
+ user = Financier::User.fetch_by_name(Financier::DB.current, name: request.params[:name])
- if user && user.password == request[:password]
+ if user && user.password == request.params[:password]
request.session[:user_id] = user.id
Financier::DB.commit(message: "User Login") do |dataset|
diff --git a/pages/customers/controller.rb b/pages/customers/controller.rb
index 893db82..63f1bc9 100644
--- a/pages/customers/controller.rb
+++ b/pages/customers/controller.rb
@@ -8,7 +8,7 @@
on 'delete' do |request, path|
fail!(:forbidden) unless request.post?
- documents = request[:rows].values
+ documents = request.params[:rows].values
Financier::DB.commit(message: "Delete Customers") do |dataset|
documents.each do |document|
@@ -35,7 +35,7 @@
end
on 'edit' do |request, path|
- @customer = Financier::Customer.fetch_all(Financier::DB.current, id: request[:id])
+ @customer = Financier::Customer.fetch_all(Financier::DB.current, id: request.params[:id])
if request.post?
@customer.assign(request.params, PARAMETERS)
@@ -49,7 +49,7 @@
end
on 'show' do |request, path|
- @customer = Financier::Customer.fetch_all(Financier::DB.current, id: request[:id])
+ @customer = Financier::Customer.fetch_all(Financier::DB.current, id: request.params[:id])
@transactions = []
@transactions += @customer.invoices.to_a
diff --git a/pages/invoices/controller.rb b/pages/invoices/controller.rb
index 14e68cb..097ec74 100644
--- a/pages/invoices/controller.rb
+++ b/pages/invoices/controller.rb
@@ -20,7 +20,7 @@
on 'delete' do |request, path|
fail!(:forbidden) unless request.post?
- documents = request[:rows].values
+ documents = request.params[:rows].values
Financier::DB.commit(message: "Delete Companies") do |dataset|
documents.each do |document|
@@ -47,7 +47,7 @@
end
on 'edit' do |request, path|
- @invoice = Financier::Invoice.fetch_all(Financier::DB.current, id: request[:id])
+ @invoice = Financier::Invoice.fetch_all(Financier::DB.current, id: request.params[:id])
if request.post?
@invoice.assign(request.params, PARAMETERS)
@@ -57,10 +57,10 @@
@invoice.save(dataset)
end
- redirect! request[:_return] || "index"
+ redirect! request.params[:_return] || "index"
end
end
on 'show' do |request, path|
- @invoice = Financier::Invoice.fetch_all(Financier::DB.current, id: request[:id])
+ @invoice = Financier::Invoice.fetch_all(Financier::DB.current, id: request.params[:id])
end
diff --git a/pages/invoices/print/controller.rb b/pages/invoices/print/controller.rb
index e1fca5a..1d43ed7 100644
--- a/pages/invoices/print/controller.rb
+++ b/pages/invoices/print/controller.rb
@@ -2,10 +2,10 @@
prepend Actions
on 'full' do |request, path|
- @invoice = Financier::Invoice.fetch_all(Financier::DB.current, id: request[:id])
+ @invoice = Financier::Invoice.fetch_all(Financier::DB.current, id: request.params[:id])
end
on 'plain' do |request, path|
- @invoice = Financier::Invoice.fetch_all(Financier::DB.current, id: request[:id])
+ @invoice = Financier::Invoice.fetch_all(Financier::DB.current, id: request.params[:id])
end
diff --git a/pages/invoices/transactions/controller.rb b/pages/invoices/transactions/controller.rb
index 8b79351..a894a95 100644
--- a/pages/invoices/transactions/controller.rb
+++ b/pages/invoices/transactions/controller.rb
@@ -20,7 +20,7 @@
on 'delete' do |request, path|
fail!(:forbidden) unless request.post?
- documents = request[:rows].values
+ documents = request.params[:rows].values
Financier::DB.commit(message: "Delete Invoice Transactions") do |dataset|
documents.each do |document|
@@ -35,7 +35,7 @@
on 'new' do |request, path|
@transaction = Financier::Invoice::Transaction.create(Financier::DB.current, :date => Date.today, :quantity => 1)
- @transaction.invoice = Financier::Invoice.fetch_all(@transaction.dataset, id: request[:invoice_id])
+ @transaction.invoice = Financier::Invoice.fetch_all(@transaction.dataset, id: request.params[:invoice_id])
if request.post?
@transaction.assign(request.params, PARAMETERS)
@@ -49,7 +49,7 @@
end
on 'edit' do |request, path|
- @transaction = Financier::Invoice::Transaction.fetch_all(Financier::DB.current, id: request[:id])
+ @transaction = Financier::Invoice::Transaction.fetch_all(Financier::DB.current, id: request.params[:id])
if request.post?
@transaction.assign(request.params, PARAMETERS)
@@ -63,7 +63,7 @@
end
on 'move' do |request, path|
- @transaction = Financier::Invoice::Transaction.fetch_all(Financier::DB.current, id: request[:id])
+ @transaction = Financier::Invoice::Transaction.fetch_all(Financier::DB.current, id: request.params[:id])
if request.post?
@transaction.assign(request.params)
diff --git a/pages/services/controller.rb b/pages/services/controller.rb
index f93d5da..1109195 100644
--- a/pages/services/controller.rb
+++ b/pages/services/controller.rb
@@ -16,7 +16,7 @@
on 'delete' do |request, path|
fail!(:forbidden) unless request.post?
- documents = request[:rows].values
+ documents = request.params[:rows].values
Financier::DB.commit(message: "Delete Services") do |dataset|
documents.each do |document|
@@ -43,7 +43,7 @@
end
on 'edit' do |request, path|
- @service = Financier::Service.fetch_all(Financier::DB.current, id: request[:id])
+ @service = Financier::Service.fetch_all(Financier::DB.current, id: request.params[:id])
if request.post?
@service.assign(request.params, PARAMETERS)
@@ -57,17 +57,17 @@
end
on 'invoice' do |request, path|
- @services = request[:services].map{|id| Financier::Service.fetch(Financier::DB.current, id)}
+ @services = request.params[:services].map{|id| Financier::Service.fetch(Financier::DB.current, id)}
- @billing_end_date = Date.parse(request[:billing_end_date]) rescue Date.today
+ @billing_end_date = Date.parse(request.params[:billing_end_date]) rescue Date.today
- if billing_customer = request[:billing_customer]
+ if billing_customer = request.params[:billing_customer]
@billing_customer = Financier::Customer.fetch(Financier::DB.current, billing_customer)
else
@billing_customer = @services.first.customer
end
- if request.post? && request[:create]
+ if request.post? && request.params[:create]
invoice = nil
Financier::DB.commit(message: "Create Invoice for Services") do |dataset|
diff --git a/pages/services/invoice.xnode b/pages/services/invoice.xnode
index 6964923..b089f22 100644
--- a/pages/services/invoice.xnode
+++ b/pages/services/invoice.xnode
@@ -11,7 +11,7 @@