Skip to content

Commit

Permalink
params[] expects a string key.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Sep 30, 2024
1 parent 804c6ff commit 13e679d
Show file tree
Hide file tree
Showing 14 changed files with 60 additions and 60 deletions.
16 changes: 8 additions & 8 deletions pages/accounts/controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
on "delete" do |request, path|
fail!(:forbidden) unless request.post?

documents = request.params[:rows].values
documents = request.params["rows"].values

Financier::DB.commit(message: "Delete Companies") do |dataset|
documents.each do |document|
Expand All @@ -56,7 +56,7 @@
end

on "edit" do |request, path|
@account = Financier::Account.fetch_all(Financier::DB.current, id: request.params[:id])
@account = Financier::Account.fetch_all(Financier::DB.current, id: request.params["id"])

if request.post?
@account.assign(request.params, PARAMETERS)
Expand All @@ -70,11 +70,11 @@
end

on "show" do |request, path|
@account = Financier::Account.fetch_all(Financier::DB.current, id: request.params[: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.params[:id])
@account = Financier::Account.fetch_all(Financier::DB.current, id: request.params["id"])

currencies = Set.new
balance = Latinum::Collection.new(currencies)
Expand Down Expand Up @@ -155,16 +155,16 @@ def import_csv(path)
end

on "import" do |request, path|
if request.params[:account]
@account = Financier::Account.fetch(Financier::DB.current, request.params[:account])
if request.params["account"]
@account = Financier::Account.fetch(Financier::DB.current, request.params["account"])
else
@account = nil
end

@default_currency = request.params[:default_currency] || "NZD"
@default_currency = request.params["default_currency"] || "NZD"

if request.post? and @account
upload = request.params[:data]
upload = request.params["data"]

case upload[:filename]
when /\.ofx/i
Expand Down
12 changes: 6 additions & 6 deletions pages/accounts/transactions/controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
on "delete" do |request, path|
fail!(:forbidden) unless request.post?

documents = request.params[:rows].values
documents = request.params["rows"].values

Financier::DB.commit(message: "Delete Account Transactions") do |dataset|
documents.each do |document|
Expand All @@ -31,7 +31,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.params[:account_id])
@transaction.account = Financier::Account.fetch_all(@transaction.dataset, id: request.params["account_id"])

if request.post?
@transaction.assign(request.params, PARAMETERS)
Expand All @@ -40,16 +40,16 @@
@transaction.save(dataset)
end

redirect! request.params[:_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.params[: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.params[:id])
@transaction = Financier::Account::Transaction.fetch_all(Financier::DB.current, id: request.params["id"])

if request.post?
@transaction.assign(request.params, PARAMETERS)
Expand All @@ -58,6 +58,6 @@
@transaction.save(dataset)
end

redirect! request.params[:_return] || "../show?id=#{@transaction.account.id}"
redirect! request.params["_return"] || "../show?id=#{@transaction.account.id}"
end
end
6 changes: 3 additions & 3 deletions pages/addresses/controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
on "delete" do |request, path|
fail!(:forbidden) unless request.post?

documents = request.params[:rows].values
documents = request.params["rows"].values

Financier::DB.commit(message: "Delete Companies") do |dataset|
documents.each do |document|
Expand All @@ -50,7 +50,7 @@
end

on "edit" do |request, path|
@address = Financier::Address.fetch_all(Financier::DB.current, id: request.params[:id])
@address = Financier::Address.fetch_all(Financier::DB.current, id: request.params["id"])

if request.post?
@address.assign(request.params, PARAMETERS)
Expand All @@ -64,5 +64,5 @@
end

on "print" do |request, path|
@address = Financier::Address.fetch_all(Financier::DB.current, id: request.params[:id])
@address = Financier::Address.fetch_all(Financier::DB.current, id: request.params["id"])
end
4 changes: 2 additions & 2 deletions pages/companies/controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
on "delete" do |request, path|
fail!(:forbidden) unless request.post?

documents = request.params[:rows].values
documents = request.params["rows"].values

Financier::DB.commit(message: "Delete Companies") do |dataset|
documents.each do |document|
Expand All @@ -40,7 +40,7 @@
end

on "edit" do |request, path|
@company = Financier::Company.fetch_all(Financier::DB.current, id: request.params[:id])
@company = Financier::Company.fetch_all(Financier::DB.current, id: request.params["id"])

if request.post?
@company.assign(request.params, PARAMETERS)
Expand Down
8 changes: 4 additions & 4 deletions pages/controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

on "login" do |request, path|
if request.post?
user = Financier::User.fetch_by_name(Financier::DB.current, name: request.params[:name])
user = Financier::User.fetch_by_name(Financier::DB.current, name: request.params["name"])

if user && user.password == request.params[:password]
if user && user.password == request.params["password"]
request.session[:user_id] = user.id

Financier::DB.commit(message: "User Login") do |dataset|
Expand All @@ -18,8 +18,8 @@
user.save(dataset)
end

if request.params[:to]
redirect request.params[:to]
if request.params["to"]
redirect request.params["to"]
else
redirect! "/customers/index"
end
Expand Down
6 changes: 3 additions & 3 deletions pages/customers/controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
on "delete" do |request, path|
fail!(:forbidden) unless request.post?

documents = request.params[:rows].values
documents = request.params["rows"].values

Financier::DB.commit(message: "Delete Customers") do |dataset|
documents.each do |document|
Expand All @@ -39,7 +39,7 @@
end

on "edit" do |request, path|
@customer = Financier::Customer.fetch_all(Financier::DB.current, id: request.params[:id])
@customer = Financier::Customer.fetch_all(Financier::DB.current, id: request.params["id"])

if request.post?
@customer.assign(request.params, PARAMETERS)
Expand All @@ -53,7 +53,7 @@
end

on "show" do |request, path|
@customer = Financier::Customer.fetch_all(Financier::DB.current, id: request.params[:id])
@customer = Financier::Customer.fetch_all(Financier::DB.current, id: request.params["id"])

@transactions = []
@transactions += @customer.invoices.to_a
Expand Down
8 changes: 4 additions & 4 deletions pages/invoices/controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
on "delete" do |request, path|
fail!(:forbidden) unless request.post?

documents = request.params[:rows].values
documents = request.params["rows"].values

Financier::DB.commit(message: "Delete Companies") do |dataset|
documents.each do |document|
Expand All @@ -51,7 +51,7 @@
end

on "edit" do |request, path|
@invoice = Financier::Invoice.fetch_all(Financier::DB.current, id: request.params[:id])
@invoice = Financier::Invoice.fetch_all(Financier::DB.current, id: request.params["id"])

if request.post?
@invoice.assign(request.params, PARAMETERS)
Expand All @@ -61,10 +61,10 @@
@invoice.save(dataset)
end

redirect! request.params[:_return] || "index"
redirect! request.params["_return"] || "index"
end
end

on "show" do |request, path|
@invoice = Financier::Invoice.fetch_all(Financier::DB.current, id: request.params[:id])
@invoice = Financier::Invoice.fetch_all(Financier::DB.current, id: request.params["id"])
end
4 changes: 2 additions & 2 deletions pages/invoices/print/controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
prepend Actions

on "full" do |request, path|
@invoice = Financier::Invoice.fetch_all(Financier::DB.current, id: request.params[: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.params[:id])
@invoice = Financier::Invoice.fetch_all(Financier::DB.current, id: request.params["id"])
end

8 changes: 4 additions & 4 deletions pages/invoices/transactions/controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
on "delete" do |request, path|
fail!(:forbidden) unless request.post?

documents = request.params[:rows].values
documents = request.params["rows"].values

Financier::DB.commit(message: "Delete Invoice Transactions") do |dataset|
documents.each do |document|
Expand All @@ -39,7 +39,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.params[:invoice_id])
@transaction.invoice = Financier::Invoice.fetch_all(@transaction.dataset, id: request.params["invoice_id"])

if request.post?
@transaction.assign(request.params, PARAMETERS)
Expand All @@ -53,7 +53,7 @@
end

on "edit" do |request, path|
@transaction = Financier::Invoice::Transaction.fetch_all(Financier::DB.current, id: request.params[:id])
@transaction = Financier::Invoice::Transaction.fetch_all(Financier::DB.current, id: request.params["id"])

if request.post?
@transaction.assign(request.params, PARAMETERS)
Expand All @@ -67,7 +67,7 @@
end

on "move" do |request, path|
@transaction = Financier::Invoice::Transaction.fetch_all(Financier::DB.current, id: request.params[:id])
@transaction = Financier::Invoice::Transaction.fetch_all(Financier::DB.current, id: request.params["id"])

if request.post?
@transaction.assign(request.params)
Expand Down
12 changes: 6 additions & 6 deletions pages/services/controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
on "delete" do |request, path|
fail!(:forbidden) unless request.post?

documents = request.params[:rows].values
documents = request.params["rows"].values

Financier::DB.commit(message: "Delete Services") do |dataset|
documents.each do |document|
Expand All @@ -47,7 +47,7 @@
end

on "edit" do |request, path|
@service = Financier::Service.fetch_all(Financier::DB.current, id: request.params[:id])
@service = Financier::Service.fetch_all(Financier::DB.current, id: request.params["id"])

if request.post?
@service.assign(request.params, PARAMETERS)
Expand All @@ -61,17 +61,17 @@
end

on "invoice" do |request, path|
@services = request.params[: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.params[:billing_end_date]) rescue Date.today
@billing_end_date = Date.parse(request.params["billing_end_date"]) rescue Date.today

if billing_customer = request.params[: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.params[:create]
if request.post? && request.params["create"]
invoice = nil

Financier::DB.commit(message: "Create Invoice for Services") do |dataset|
Expand Down
2 changes: 1 addition & 1 deletion pages/services/invoice.xnode
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<content:heading>Create Invoice from Services</content:heading>

<form class="basic editor" method="post" action="#">
<?r request.params[:services].each do |id| ?>
<?r request.params["services"].each do |id| ?>
#{f.hidden :field => :'services[]', :value => id}
<?r end ?>

Expand Down
20 changes: 10 additions & 10 deletions pages/timesheets/controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
on "delete" do |request, path|
fail!(:forbidden) unless request.post?

documents = request.params[:rows].values
documents = request.params["rows"].values

Financier::DB.commit(message: "Delete Timesheets") do |dataset|
documents.each do |document|
Expand All @@ -46,7 +46,7 @@
end

on "edit" do |request, path|
@timesheet = Financier::Timesheet.fetch_all(Financier::DB.current, id: request.params[:id])
@timesheet = Financier::Timesheet.fetch_all(Financier::DB.current, id: request.params["id"])

if request.post?
@timesheet.assign(request.params, PARAMETERS)
Expand All @@ -60,22 +60,22 @@
end

on "show" do |request, path|
@timesheet = Financier::Timesheet.fetch_all(Financier::DB.current, id: request.params[:id])
@timesheet = Financier::Timesheet.fetch_all(Financier::DB.current, id: request.params["id"])
end

on "calendar" do |request|
@today = Time::Zone.now(@user.timezone).to_date

if start_date = request.params[:start_date]
if start_date = request.params["start_date"]
@start_date = Date.parse(start_date)
else
today = Date.today
@start_date = today - today.day + 1
end

if end_date = request.params[:end_date]
if end_date = request.params["end_date"]
@end_date = Date.parse(end_date)
elsif days = request.params[:days]
elsif days = request.params["days"]
@end_date = @start_date + Integer(days)
else
@end_date = @start_date.next_month
Expand All @@ -88,16 +88,16 @@
end

on "invoice" do |request, path|
@start_date = Date.parse(request.params[:start_date])
@end_date = Date.parse(request.params[:end_date])
@start_date = Date.parse(request.params["start_date"])
@end_date = Date.parse(request.params["end_date"])

@calendar = Financier::Calendar.new(@start_date, @end_date)

if billing_customer = request.params[:billing_customer]
if billing_customer = request.params["billing_customer"]
@billing_customer = Financier::Customer.fetch(Financier::DB.current, billing_customer)
end

if request.post? and entries = request.params[:entries]
if request.post? and entries = request.params["entries"]
invoice = nil
@entries = entries.map{|id| Financier::Timesheet::Entry.fetch(Financier::DB.current, id)}

Expand Down
Loading

0 comments on commit 13e679d

Please sign in to comment.