Compare commits

..

12 Commits

29 changed files with 63 additions and 133 deletions

View File

@@ -69,7 +69,7 @@ class CustomersController < ApplicationController
def create
@customer = Customer.new(allowed_params)
if @customer.save
flash[:notice] = "New Customer Created"
flash[:notice] = t :notice_customer_created
redirect_to @customer
else
flash[:error] = @customer.errors.full_messages.to_sentence
@@ -90,6 +90,7 @@ class CustomersController < ApplicationController
@issues.open.each { |i| @hours+= i.total_spent_hours }
@closed_issues.each { |i| @closed_hours+= i.total_spent_hours }
rescue
flash[:error] = t :notice_customer_not_found
render_404
end
end
@@ -99,6 +100,7 @@ class CustomersController < ApplicationController
begin
@customer = Customer.find_by_id(params[:id])
rescue
flash[:error] = t :notice_customer_not_found
render_404
end
end
@@ -108,13 +110,14 @@ class CustomersController < ApplicationController
begin
@customer = Customer.find_by_id(params[:id])
if @customer.update(allowed_params)
flash[:notice] = "Customer updated"
flash[:notice] = t :notice_customer_updated
redirect_to @customer
else
redirect_to edit_customer_path
flash[:error] = @customer.errors.full_messages.to_sentence if @customer.errors
end
rescue
flash[:error] = t :notice_customer_not_found
render_404
end
end
@@ -123,9 +126,10 @@ class CustomersController < ApplicationController
def destroy
begin
Customer.find_by_id(params[:id]).destroy
flash[:notice] = "Customer deleted successfully"
flash[:notice] = t :notice_customer_deleted
redirect_to action: :index
rescue
flash[:error] = t :notice_customer_not_deleted
render_404
end
end
@@ -143,6 +147,7 @@ class CustomersController < ApplicationController
issue = Issue.find_by_id(params[:id])
redirect_to view_path issue.share_token.token
rescue
flash[:error] = t :notice_issue_not_found
render_404
end
end
@@ -178,6 +183,7 @@ class CustomersController < ApplicationController
@time_entry = TimeEntry.new(issue: @issue, project: @issue.project)
@relation = IssueRelation.new
rescue
flash[:error] = t :notice_forbidden
render_403
end
end

View File

@@ -36,9 +36,9 @@ class EstimateController < ApplicationController
estimate = get_estimate
begin
send_data estimate.pdf, filename: "estimate #{estimate.doc_number}.pdf", disposition: 'inline', type: "application/pdf"
send_data estimate.pdf, filename: "estimate #{estimate.doc_number}.pdf", disposition: :inline, type: "application/pdf"
rescue
redirect_to :back, flash: { error: "Estimate not found" }
redirect_to :back, flash: { error: I18n.t(:notice_estimate_not_found) }
end
end
@@ -49,9 +49,9 @@ class EstimateController < ApplicationController
estimate = get_estimate
begin
send_data estimate.pdf, filename: "estimate #{estimate.doc_number}.pdf", disposition: 'inline', type: "application/pdf"
send_data estimate.pdf, filename: "estimate #{estimate.doc_number}.pdf", disposition: :inline, type: "application/pdf"
rescue
redirect_to :back, flash: { error: "Estimate not found" }
redirect_to :back, flash: { error: I18n.t(:notice_estimate_not_found) }
end
end

View File

@@ -45,10 +45,10 @@ class InvoiceController < ApplicationController
ref = invoice.doc_number
end
send_data @pdf, filename: "invoice #{ref}.pdf", disposition: 'inline', type: "application/pdf"
send_data @pdf, filename: "invoice #{ref}.pdf", disposition: :inline, type: "application/pdf"
end
rescue
redirect_to :back, flash: { error: "Invoice not found" }
redirect_to :back, flash: { error: I18n.t(:notice_invoice_not_found) }
end
end
end

View File

@@ -13,6 +13,7 @@ module AuthHelper
def require_user
return unless session[:token].nil?
if !User.current.logged?
flash[:error] = t :notice_forbidden
render_403
end
end
@@ -27,6 +28,7 @@ module AuthHelper
def check_permission(permission)
if !allowed_to?(permission)
flash[:error] = t :notice_forbidden
render_403
end
end
@@ -34,6 +36,7 @@ module AuthHelper
def global_check_permission(permission)
if !globaly_allowed_to?(permission)
flash[:error] = t :notice_forbidden
render_403
end
end

View File

@@ -73,7 +73,7 @@ module QuickbooksOauth
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
Quickbooks.sandbox_mode = Setting.plugin_redmine_qbo[:sandbox] ? true : false
logger.info "Sandbox mode: #{Quickbooks.sandbox_mode}"
options = {

View File

@@ -36,7 +36,7 @@
<%=t(:field_notes)%>:
<div class="input">
<p>
<%= content_tag 'span', id: "issue_description_and_toolbar" do %>
<%= content_tag :span, id: "issue_description_and_toolbar" do %>
<%= f.text_area :notes,
cols: 60,
rows: 10,
@@ -45,7 +45,7 @@
no_label: true %>
<% end %>
</p>
<%= wikitoolbar_for 'issue_description' %>
<%= wikitoolbar_for :issue_description %>
</div>
</div>

View File

@@ -1,4 +1,4 @@
<h2><%=t(:field_customer)%> #<%= @customer.id %> - <%= link_to @customer.to_s, "https://#{Setting.plugin_redmine_qbo['sandbox'] ? "sandbox" : "app"}.qbo.intuit.com/app/customerdetail?nameId=#{@customer.id}", target: :_blank %> </h2>
<h2><%=t(:field_customer)%> #<%= @customer.id %> - <%= link_to @customer.to_s, "https://#{Setting.plugin_redmine_qbo[:sandbox] ? "sandbox" : "app"}.qbo.intuit.com/app/customerdetail?nameId=#{@customer.id}", target: :_blank %> </h2>
<div class="issue">
<div class="splitcontent">

View File

@@ -19,27 +19,27 @@
<div class="attributes">
<%= issue_fields_rows do |rows|
rows.left l(:field_status), @issue.status.name, class: 'status'
rows.left l(:field_priority), @issue.priority.name, class: 'priority'
# unless @issue.disabled_core_fields.include?('assigned_to_id')
rows.left l(:field_status), @issue.status.name, class: :status
rows.left l(:field_priority), @issue.priority.name, class: :priority
# unless @issue.disabled_core_fields.include?(:assigned_to_id)
# rows.left l(:field_assigned_to), avatar(@issue.assigned_to, size: "14").to_s.html_safe + (@issue.assigned_to ? @issue.assigned_to : "-"), class: 'assigned-to'
# end
unless @issue.disabled_core_fields.include?('category_id') || (@issue.category.nil? && @issue.project.issue_categories.none?)
rows.left l(:field_category), (@issue.category ? @issue.category.name : "-"), class: 'category'
unless @issue.disabled_core_fields.include?(:category_id) || (@issue.category.nil? && @issue.project.issue_categories.none?)
rows.left l(:field_category), (@issue.category ? @issue.category.name : "-"), class: :category
end
unless @issue.disabled_core_fields.include?('fixed_version_id') || (@issue.fixed_version.nil? && @issue.assignable_versions.none?)
unless @issue.disabled_core_fields.include?(:fixed_version_id) || (@issue.fixed_version.nil? && @issue.assignable_versions.none?)
rows.left l(:field_fixed_version), (@issue.fixed_version ? @issue.fixed_version : "-"), class: 'fixed-version'
end
unless @issue.disabled_core_fields.include?('start_date')
unless @issue.disabled_core_fields.include?(:start_date)
rows.right l(:field_start_date), format_date(@issue.start_date), class: 'start-date'
end
unless @issue.disabled_core_fields.include?('due_date')
unless @issue.disabled_core_fields.include?(:due_date)
rows.right l(:field_due_date), format_date(@issue.due_date), class: 'due-date'
end
unless @issue.disabled_core_fields.include?('done_ratio')
rows.right l(:field_done_ratio), progress_bar(@issue.done_ratio, legend: "#{@issue.done_ratio}%"), class: 'progress'
unless @issue.disabled_core_fields.include?(:done_ratio)
rows.right l(:field_done_ratio), progress_bar(@issue.done_ratio, legend: "#{@issue.done_ratio}%"), class: :progress
end
unless @issue.disabled_core_fields.include?('estimated_hours')
unless @issue.disabled_core_fields.include?(:estimated_hours)
if @issue.estimated_hours.present? || @issue.total_estimated_hours.to_f > 0
rows.right l(:field_estimated_hours), issue_estimated_hours_details(@issue), class: 'estimated-hours'
end
@@ -59,7 +59,7 @@ end %>
<% if @issue.description? %>
<div class="description">
<div class="contextual">
<%= link_to l(:button_quote), quoted_issue_path(@issue), remote: true, method: 'post', class: 'icon icon-comment' if @issue.notes_addable? %>
<%= link_to l(:button_quote), quoted_issue_path(@issue), remote: true, method: :post, class: 'icon icon-comment' if @issue.notes_addable? %>
</div>
<p><strong><%=l(:field_description)%></strong></p>

View File

@@ -9,7 +9,7 @@
</tr></thead>
<tbody>
<% for issue in issues %>
<tr id="issue-<%= h(issue.id) %>" class="hascontextmenu <%= cycle('odd', 'even') %> <%= issue.css_classes %>">
<tr id="issue-<%= h(issue.id) %>" class="hascontextmenu <%= cycle(:odd, :even) %> <%= issue.css_classes %>">
<td class="id">
<%= check_box_tag("ids[]", issue.id, false, style: 'display:none;', id: nil) %>
<%= link_to(issue.id, issue_path(issue)) %>

View File

@@ -60,7 +60,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
<tr>
<th><%=t(:label_sandbox)%></th>
<td>
<%= check_box_tag 'settings[sandbox]', @settings['sandbox'], @settings['sandbox'] %>
<%= check_box_tag 'settings[sandbox]', @settings[:sandbox], @settings[:sandbox] %>
</td>
</tr>

View File

View File

@@ -85,4 +85,17 @@ en:
label_syncing: "Syncing Quickbooks"
label_sandbox: "Sandbox"
button_bulk_pdf: "Bulk PDF"
label_select_all: "Select All"
label_select_all: "Select All"
notice_customer_created: "Customer created in Quickbooks"
notice_customer_updated: "Customer updated in Quickbooks"
notice_customer_not_found: "Customer not found in Quickbooks"
notice_customer_not_deleted: "Customer could not be deleted in Quickbooks"
notice_customer_deleted: "Customer deleted in Quickbooks"
notice_estimate_created: "Estimate created in Quickbooks"
notice_estimate_updated: "Estimate updated in Quickbooks"
notice_estimate_not_found: "Estimate not found"
notice_invoice_created: "Invoice created in Quickbooks"
notice_invoice_updated: "Invoice updated in Quickbooks"
notice_invoice_not_found: "Invoice not found"
notice_forbidden: "You do not have permission to access this resource"
notice_issue_not_found: "Issue not found"

View File

@@ -14,10 +14,10 @@ Redmine::Plugin.register :redmine_qbo do
name 'Redmine QBO plugin'
author 'Rick Barrette'
description 'This is a plugin for Redmine to intergrate with Quickbooks Online to allow for seamless intergration CRM and invoicing of completed issues'
version '2026.1.6'
version '2026.1.8'
url 'https://github.com/rickbarrette/redmine_qbo'
author_url 'https://barrettefabrication.com'
settings default: {'empty' => true}, partial: 'qbo/settings'
settings default: {empty: true}, partial: 'qbo/settings'
requires_redmine version_or_higher: '6.1.0'
# Add safe attributes for core models

View File

@@ -28,7 +28,7 @@ module Hooks
context[:controller].send(:render_to_string, {
partial: 'issues/show_details',
locals: {
customer: issue.customer ? link_to(issue.customer): nill,
customer: issue.customer ? link_to(issue.customer) : nil,
estimate_link: issue.estimate ? link_to(issue.estimate, issue.estimate, target: :_blank) : nil,
invoice_link: invoice_link.html_safe,
issue: issue

View File

@@ -14,9 +14,9 @@ module Hooks
# Load the javascript to support the autocomplete forms
def view_layouts_base_html_head(context = {})
js = javascript_include_tag 'application.js', plugin: 'redmine_qbo'
js += javascript_include_tag 'autocomplete-rails.js', plugin: 'redmine_qbo'
js += javascript_include_tag 'checkbox_controller.js', plugin: 'redmine_qbo'
js = javascript_include_tag 'application.js', plugin: :redmine_qbo
js += javascript_include_tag 'autocomplete-rails.js', plugin: :redmine_qbo
js += javascript_include_tag 'checkbox_controller.js', plugin: :redmine_qbo
return js
end

View File

@@ -54,9 +54,9 @@ module Patches
left << [l(:field_status), issue.status]
left << [l(:field_priority), issue.priority]
left << [l(:field_customer), customer]
left << [l(:field_assigned_to), issue.assigned_to] unless issue.disabled_core_fields.include?('assigned_to_id')
#left << [l(:field_category), issue.category] unless issue.disabled_core_fields.include?('category_id')
#left << [l(:field_fixed_version), issue.fixed_version] unless issue.disabled_core_fields.include?('fixed_version_id')
left << [l(:field_assigned_to), issue.assigned_to] unless issue.disabled_core_fields.include?(:assigned_to_id)
#left << [l(:field_category), issue.category] unless issue.disabled_core_fields.include?(:category_id)
#left << [l(:field_fixed_version), issue.fixed_version] unless issue.disabled_core_fields.include?(:fixed_version_id)
logger.debug "Calling :pdf_left hook"
left_hook_output = Redmine::Hook.call_hook :pdf_left, { issue: issue }
@@ -67,10 +67,10 @@ module Patches
end
right = []
right << [l(:field_start_date), format_date(issue.start_date)] unless issue.disabled_core_fields.include?('start_date')
right << [l(:field_due_date), format_date(issue.due_date)] unless issue.disabled_core_fields.include?('due_date')
right << [l(:field_done_ratio), "#{issue.done_ratio}%"] unless issue.disabled_core_fields.include?('done_ratio')
right << [l(:field_estimated_hours), l_hours(issue.estimated_hours)] unless issue.disabled_core_fields.include?('estimated_hours')
right << [l(:field_start_date), format_date(issue.start_date)] unless issue.disabled_core_fields.include?(:start_date)
right << [l(:field_due_date), format_date(issue.due_date)] unless issue.disabled_core_fields.include?(:due_date)
right << [l(:field_done_ratio), "#{issue.done_ratio}%"] unless issue.disabled_core_fields.include?(:done_ratio)
right << [l(:field_estimated_hours), l_hours(issue.estimated_hours)] unless issue.disabled_core_fields.include?(:estimated_hours)
right << [l(:label_spent_time), l_hours(issue.total_spent_hours)] if User.current.allowed_to?(:view_time_entries, issue.project)
logger.debug "Calling :pdf_right hook"

View File

View File

@@ -1,8 +0,0 @@
require File.expand_path('../../test_helper', __FILE__)
class EstimateControllerTest < ActionController::TestCase
# Replace this with your real tests.
def test_truth
assert true
end
end

View File

@@ -1,8 +0,0 @@
require File.expand_path('../../test_helper', __FILE__)
class InvoiceControllerTest < ActionController::TestCase
# Replace this with your real tests.
def test_truth
assert true
end
end

View File

@@ -1,18 +0,0 @@
#The MIT License (MIT)
#
#Copyright (c) 2016 - 2026 rick barrette
#
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
#
#The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
#
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
require File.expand_path('../../test_helper', __FILE__)
class QboControllerTest < ActionController::TestCase
# Replace this with your real tests.
def test_truth
assert true
end
end

View File

@@ -1,2 +0,0 @@
# Load the Redmine helper
require File.expand_path(File.dirname(__FILE__) + '/../../../test/test_helper')

View File

@@ -1,9 +0,0 @@
require File.expand_path('../../test_helper', __FILE__)
class CustomerTokenTest < ActiveSupport::TestCase
# Replace this with your real tests.
def test_truth
assert true
end
end

View File

@@ -1,19 +0,0 @@
#The MIT License (MIT)
#
#Copyright (c) 2016 - 2026 rick barrette
#
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
#
#The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
#
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
require File.expand_path('../../test_helper', __FILE__)
class QboCustomersTest < ActiveSupport::TestCase
# Replace this with your real tests.
def test_truth
assert true
end
end

View File

@@ -1,9 +0,0 @@
require File.expand_path('../../test_helper', __FILE__)
class EmployeeTest < ActiveSupport::TestCase
# Replace this with your real tests.
def test_truth
assert true
end
end

View File

@@ -1,19 +0,0 @@
#The MIT License (MIT)
#
#Copyright (c) 2016 - 2026 rick barrette
#
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
#
#The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
#
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
require File.expand_path('../../test_helper', __FILE__)
class QboTest < ActiveSupport::TestCase
# Replace this with your real tests.
def test_truth
assert true
end
end