diff --git a/Gemfile b/Gemfile index 9a849c2..ff6b23a 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' gem 'rails-jquery-autocomplete' gem 'jquery-rails', '~> 3.1.4' gem 'jquery-ui-rails' 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 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)