Compare commits

...
3 Commits
Author SHA1 Message Date
ricky e61217b719 2026.10.1 2026-10-29 21:35:51 -04:00
Claude b8ddf1c38b Issue PDF: allow plugin rows with an HTML value
Rows from the :pdf_left / :pdf_right hooks can now be
[label, text, { html: "..." }]; the value is drawn with writeHTMLCell so
part of it can be bold (used by redmine_qbo_vehicles to bold the last 8
of a VIN). The text still sizes the row, plain rows are unchanged, and
PdfPatch::PDF_HTML_VALUES lets plugins check for support.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM
2026-10-29 20:21:07 -04:00
Claude f1d81890de Restore AuthHelper#require_user for plugins that still use it
redmine_qbo_vehicles calls before_action :require_user; removing it in
the security fixes would break every vehicles page. It now simply
requires a logged-in user.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM
2026-10-28 22:57:45 -04:00
3 changed files with 25 additions and 5 deletions

No files matched your search

+8
View File
@@ -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])
+2 -2
View File
@@ -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
+15 -3
View File
@@ -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)