Merge branch 'master' of git://github.com/sempervictus/redmine_qbo into sempervictus-master

This commit is contained in:
2017-02-22 11:10:46 -05:00
3 changed files with 8 additions and 4 deletions

View File

@@ -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'

View File

@@ -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

View File

@@ -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)