Show estimate, invoice and payment activity on the activity page

Each type appears only on the overall activity page, and only for users who may see it:
estimates need View customers or Write estimates, invoices View customers or Write invoices,
and payments View or Receive payments.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rickyandClaude Opus 5.5 committed 2026-11-03 21:53:13 -05:00
1 parent dbee228cdf
commit 159420fac1
10 files changed
+185

No files matched your search

+3
View File
@@ -18,6 +18,9 @@ module RedmineQbo
IssueQuery.prepend RedmineQbo::Patches::QueryPatch
TimeEntryQuery.prepend RedmineQbo::Patches::TimeEntryQueryPatch
# === Activity: estimates, invoices and payments, for users who may see them ===
Redmine::Activity::Fetcher.prepend RedmineQbo::Patches::ActivityFetcherPatch
# === Controllers ===
RedmineQbo::Patches::IssuesControllerPatch.apply
RedmineQbo::Patches::AttachmentsControllerPatch.apply
@@ -0,0 +1,29 @@
#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.
module RedmineQbo
module Patches
# The activity page lists every activity type for the whole site, and a project's page those its members may
# see. QuickBooks estimates, invoices and payments (QboActivity) belong to no project: they're kept to the
# overall page, and to users with one of their permissions, so nobody gets a checkbox for activity they can't see.
module ActivityFetcherPatch
def event_types
return @event_types if @qbo_activity_checked
@qbo_activity_checked = true
@event_types = super.select do |event_type|
providers = Redmine::Activity.providers[event_type].map(&:constantize)
qbo = providers.select { |provider| provider.respond_to?(:qbo_activity_visible_to?) }
qbo.empty? || (project.nil? && qbo.any? { |provider| provider.qbo_activity_visible_to?(user) })
end
end
end
end
end