mirror of
https://github.com/rickbarrette/redmine_qbo.git
synced 2026-11-18 02:20:37 -05:00
Link the Customer column in issue lists to the customer
Only for users with View customers, who can open the customer page; others see the name as plain text. CSV and PDF exports are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3b51625df4
commit
084df36061
2 files changed
+32
No files matched your search
@@ -27,6 +27,7 @@ module RedmineQbo
|
|||||||
|
|
||||||
# === Helpers / Exports ===
|
# === Helpers / Exports ===
|
||||||
IssuesHelper.prepend RedmineQbo::Patches::IssuesHelperPatch
|
IssuesHelper.prepend RedmineQbo::Patches::IssuesHelperPatch
|
||||||
|
QueriesHelper.prepend RedmineQbo::Patches::QueriesHelperPatch
|
||||||
Redmine::Export::PDF::IssuesPdfHelper.prepend RedmineQbo::Patches::PdfPatch
|
Redmine::Export::PDF::IssuesPdfHelper.prepend RedmineQbo::Patches::PdfPatch
|
||||||
|
|
||||||
# === Hooks ===
|
# === Hooks ===
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
#The MIT License (MIT)
|
||||||
|
#
|
||||||
|
#Copyright (c) 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.
|
||||||
|
|
||||||
|
module RedmineQbo
|
||||||
|
module Patches
|
||||||
|
# Links the Customer column in issue lists to the customer's page, for users who may open it
|
||||||
|
# (View customers). Others see the name as plain text. CSV and PDF exports are unchanged.
|
||||||
|
module QueriesHelperPatch
|
||||||
|
def column_value(column, item, value)
|
||||||
|
return super unless column.name == :customer && value.is_a?(Customer) && qbo_can_view_customers?
|
||||||
|
|
||||||
|
link_to(value.to_s, customer_path(value))
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def qbo_can_view_customers?
|
||||||
|
return @qbo_can_view_customers if defined?(@qbo_can_view_customers)
|
||||||
|
|
||||||
|
@qbo_can_view_customers = User.current.allowed_to?(:view_customers, nil, global: true)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
Reference in new issue
Block a user