From 178ddd32c74f73de8ac97796820be8ae834e2b18 Mon Sep 17 00:00:00 2001 From: RageLtMan Date: Mon, 2 Jan 2017 05:01:41 -0500 Subject: [PATCH 1/3] Remove will_paginate version constraint --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 1ce29d7..4bcfc74 100644 --- a/Gemfile +++ b/Gemfile @@ -6,7 +6,7 @@ gem 'oauth-plugin' gem 'oauth' gem 'roxml' gem 'edmunds_vin' -gem 'will_paginate', '~> 3.1.0' +gem 'will_paginate' group :assets do gem 'coffee-rails' From 772483817e76b47909b61383e2b874889222e53e Mon Sep 17 00:00:00 2001 From: RageLtMan Date: Tue, 3 Jan 2017 04:32:04 -0500 Subject: [PATCH 2/3] Prevent billing if issue has no customer assigned --- app/controllers/qbo_controller.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/controllers/qbo_controller.rb b/app/controllers/qbo_controller.rb index 2c91e92..22abf7a 100644 --- a/app/controllers/qbo_controller.rb +++ b/app/controllers/qbo_controller.rb @@ -66,8 +66,12 @@ class QboController < ApplicationController # Manual Billing def bill i = Issue.find_by_id params[:id] - i.bill_time - redirect_to i, :flash => { :notice => "Successfully Billed #{i.customer.name}" } + if i.customer + i.bill_time + redirect_to i, :flash => { :notice => "Successfully Billed #{i.customer.name}" } + else + redirect_to i, :flash => { :error => "Cannot bill without a customer assigned" } + end end # Quickbooks Webhook Callback From fcf55bb5045784219033b2fc4aaa987b9d3f762b Mon Sep 17 00:00:00 2001 From: RageLtMan Date: Thu, 19 Jan 2017 04:02:59 -0500 Subject: [PATCH 3/3] Do not permit OAUTH_CONSUMER_SECRET to be nil When QBO plugin is not configured, OAUTH_CONSUMER_SECRET can be nil, and any codepath hitting the model raises a stack trace. Set a "safe-ish" value here to allow execution in conditions where QBO plugin is installed, but not yet configured. --- app/models/customer_token.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/customer_token.rb b/app/models/customer_token.rb index 05c5998..0976410 100644 --- a/app/models/customer_token.rb +++ b/app/models/customer_token.rb @@ -15,7 +15,7 @@ class CustomerToken < ActiveRecord::Base validates_presence_of :expires_at, :issue_id before_create :generate_token - OAUTH_CONSUMER_SECRET = Setting.plugin_redmine_qbo['settingsOAuthConsumerSecret'] + OAUTH_CONSUMER_SECRET = Setting.plugin_redmine_qbo['settingsOAuthConsumerSecret'] || 'CONFIGURE_QBO__' + SecureRandom.uuid def generate_token self.token = SecureRandom.base64(15).tr('+/=lIO0', OAUTH_CONSUMER_SECRET)