mirror of
https://github.com/rickbarrette/redmine_qbo.git
synced 2026-11-19 18:40:36 -05:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e61217b719 | ||
|
|
b8ddf1c38b | ||
|
|
f1d81890de |
No files matched your search
@@ -31,6 +31,14 @@ module AuthHelper
|
|||||||
require_login
|
require_login
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Kept for plugins that still call it (e.g. redmine_qbo_vehicles): requires a logged-in user.
|
||||||
|
# The old version effectively never ran; share-link customers use require_login_or_customer_token.
|
||||||
|
def require_user
|
||||||
|
return true if User.current.logged?
|
||||||
|
|
||||||
|
require_login
|
||||||
|
end
|
||||||
|
|
||||||
def allowed_to?(action)
|
def allowed_to?(action)
|
||||||
return false if User.current.nil?
|
return false if User.current.nil?
|
||||||
project = Project.find_by(id: params[:project_id])
|
project = Project.find_by(id: params[:project_id])
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ Redmine::Plugin.register :redmine_qbo do
|
|||||||
name 'Redmine QBO plugin'
|
name 'Redmine QBO plugin'
|
||||||
author 'Rick Barrette'
|
author 'Rick Barrette'
|
||||||
description 'A pluging for Redmine to connect with QuickBooks Online to create Time Activity Entries for billable hours logged when an Issue is closed'
|
description 'A pluging for Redmine to connect with QuickBooks Online to create Time Activity Entries for billable hours logged when an Issue is closed'
|
||||||
version '2026.10.0'
|
version '2026.10.1'
|
||||||
url 'https://github.com/rickbarrette/redmine_qbo'
|
url 'https://github.com/rickbarrette/redmine_qbo'
|
||||||
author_url 'https://barrettefabrication.com'
|
author_url 'https://barrettefabrication.com'
|
||||||
settings default: {empty: true}, partial: 'qbo/settings'
|
settings default: {empty: true}, partial: 'qbo/settings'
|
||||||
@@ -50,4 +50,4 @@ Redmine::Plugin.register :redmine_qbo do
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
RedmineQbo.setup
|
RedmineQbo.setup
|
||||||
@@ -13,6 +13,12 @@ module RedmineQbo
|
|||||||
module PdfPatch
|
module PdfPatch
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
|
# Rows returned by the :pdf_left / :pdf_right hooks are [label, text], or
|
||||||
|
# [label, text, { html: "..." }] to draw the value as simple HTML (e.g. part of it in <b>).
|
||||||
|
# text is still required: it sizes the row. Other plugins can check this constant before
|
||||||
|
# sending HTML values, so they keep working with older versions of this plugin.
|
||||||
|
PDF_HTML_VALUES = true
|
||||||
|
|
||||||
def issue_to_pdf(issue, assoc={})
|
def issue_to_pdf(issue, assoc={})
|
||||||
pdf = setup_pdf(issue)
|
pdf = setup_pdf(issue)
|
||||||
|
|
||||||
@@ -136,8 +142,8 @@ module RedmineQbo
|
|||||||
hr1 = pdf.get_string_height(35, item_right ? "#{item_right.first}:" : "")
|
hr1 = pdf.get_string_height(35, item_right ? "#{item_right.first}:" : "")
|
||||||
|
|
||||||
pdf.SetFontStyle('', 9)
|
pdf.SetFontStyle('', 9)
|
||||||
hl2 = pdf.get_string_height(60, item_left ? item_left.last.to_s : "")
|
hl2 = pdf.get_string_height(60, item_left ? item_left[1].to_s : "")
|
||||||
hr2 = pdf.get_string_height(60, item_right ? item_right.last.to_s : "")
|
hr2 = pdf.get_string_height(60, item_right ? item_right[1].to_s : "")
|
||||||
|
|
||||||
height = [hl1, hr1, hl2, hr2].max
|
height = [hl1, hr1, hl2, hr2].max
|
||||||
|
|
||||||
@@ -162,7 +168,13 @@ module RedmineQbo
|
|||||||
pdf.RDMMultiCell(35, height, item ? "#{item.first}:" : "", border_label, '', 0, 0)
|
pdf.RDMMultiCell(35, height, item ? "#{item.first}:" : "", border_label, '', 0, 0)
|
||||||
|
|
||||||
pdf.SetFontStyle('', 9)
|
pdf.SetFontStyle('', 9)
|
||||||
pdf.RDMMultiCell(60, height, item ? item.last.to_s : "", border_val, '', 0, ln_type)
|
html = item && item[2].is_a?(Hash) ? item[2][:html].presence : nil
|
||||||
|
if html
|
||||||
|
# Plugin-supplied HTML value, drawn directly (RDMwriteHTMLCell would run wiki formatting on it)
|
||||||
|
pdf.writeHTMLCell(60, height, '', '', html, border_val, ln_type, 0)
|
||||||
|
else
|
||||||
|
pdf.RDMMultiCell(60, height, item ? item[1].to_s : "", border_val, '', 0, ln_type)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def render_description(pdf, issue)
|
def render_description(pdf, issue)
|
||||||
|
|||||||
Reference in new issue
Block a user