diff --git a/app/models/concerns/quickbooks_oauth.rb b/app/models/concerns/quickbooks_oauth.rb index d99344d..90d593c 100644 --- a/app/models/concerns/quickbooks_oauth.rb +++ b/app/models/concerns/quickbooks_oauth.rb @@ -72,6 +72,10 @@ module QuickbooksOauth oauth_consumer_key = Setting.plugin_redmine_qbo['settingsOAuthConsumerKey'] oauth_consumer_secret = Setting.plugin_redmine_qbo['settingsOAuthConsumerSecret'] + # Are we are playing in the sandbox? + Quickbooks.sandbox_mode = Setting.plugin_redmine_qbo['sandbox'] ? true : false + logger.info "Sandbox mode: #{Quickbooks.sandbox_mode}" + options = { site: "https://appcenter.intuit.com/connect/oauth2", authorize_url: "https://appcenter.intuit.com/connect/oauth2", diff --git a/app/views/qbo/_settings.html.erb b/app/views/qbo/_settings.html.erb index bc2b9d3..d75609a 100644 --- a/app/views/qbo/_settings.html.erb +++ b/app/views/qbo/_settings.html.erb @@ -57,6 +57,13 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI + + <%=t(:label_sandbox)%> + + <%= check_box_tag 'settings[sandbox]', @settings['sandbox'], @settings['sandbox'] %> + + + <%=t(:label_oauth_expires)%> <%= if Qbo.exists? then Qbo.first.oauth2_access_token_expires_at end %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 81a598e..0db3fc6 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -93,3 +93,4 @@ en: label_actions: "Actions" label_create_estimate: "Create Estimate" label_syncing: "Syncing Quickbooks" + label_sandbox: "Sandbox" diff --git a/init.rb b/init.rb index 8523b8e..fa577ca 100644 --- a/init.rb +++ b/init.rb @@ -39,9 +39,6 @@ Redmine::Plugin.register :redmine_qbo do Project.safe_attributes 'customer_id' Project.safe_attributes 'vehicle_id' - # We are playing in the sandbox - #Quickbooks.sandbox_mode = true - # set per_page globally WillPaginate.per_page = 20