Estimate hooks: replaceable Create Estimate link and per-estimate actions

view_customers_show_estimate_link lets a plugin replace the customer page's
Create Estimate link (which opens QuickBooks). view_estimate_actions adds
links after an estimate on the customer page's list and the issue page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM
This commit is contained in:
Claude committed 2026-10-29 23:56:07 -04:00
1 parent 6ec8853508
commit afca8eb6ea
4 files changed
+13 -1

No files matched your search

+2
View File
@@ -109,6 +109,8 @@ Available hooks:
|Type|Hook|Note
|--|--|--|
View Hook|:view_customers_show_contextual, { customer: @customer } | Used to add action links to the customer page's top-right action area (return links styled like Redmine's, e.g. `link_to sprite_icon('add', 'Label'), path, class: 'icon icon-add'`). Replaces `customer_actions_top` / `customer_actions_bottom`
View Hook|:view_customers_show_estimate_link, { customer: @customer } | Replaces the customer page's Create Estimate link (which opens QuickBooks) with the link a plugin returns
View Hook|:view_estimate_actions, { estimate: estimate } | Used to add small action links after an estimate on the customer page's estimate list and the issue page (e.g. an Edit link)
View Hook|:pdf_left, { issue: issue } | Used to add text to left side of PDF
View Hook|:pdf_right, { issue: issue } | Used to add text to right side of PDF
View Hook|:show_customer_view_right, { customer: customer } | Used to show partials on right side of customer view
+6
View File
@@ -4,8 +4,14 @@
id: 'dynamic-new-issue-link', class: 'icon icon-add', target: :_blank %>
<%# Plugins add their customer actions here (e.g. redmine_qbo_calendar's Add appointment) %>
<%= call_hook :view_customers_show_contextual, { customer: @customer } %>
<%# A plugin can replace the Create Estimate link (e.g. redmine_qbo_estimates writes estimates in Redmine) %>
<% estimate_link = call_hook(:view_customers_show_estimate_link, { customer: @customer }) %>
<% if estimate_link.present? %>
<%= estimate_link %>
<% else %>
<%= link_to sprite_icon('document', l(:label_create_estimate)), "https://qbo.intuit.com/app/estimate?nameId=#{@customer.id}",
class: 'icon icon-document', target: :_blank %>
<% end %>
<%= link_to sprite_icon('add', l(:label_create_payment)), "https://qbo.intuit.com/app/recvpayment?nameId=#{@customer.id}",
class: 'icon icon-add', target: :_blank %>
<% if User.current.allowed_to?(:edit_customers, nil, global: true) %>
+1
View File
@@ -4,6 +4,7 @@
<div class="row">
<%= check_box_tag "estimate_ids[]", estimate.id, false, onchange: "updateLink()", data: { text: "Estimate ##{estimate.doc_number}" }, class: "estimate-checkbox appointment" %>
<b><%= link_to "##{estimate.doc_number}", estimate_path(estimate), target: :_blank %></b> <%= estimate.txn_date %>
<%= call_hook :view_estimate_actions, { estimate: estimate } %>
</div>
<% end %>
+4 -1
View File
@@ -7,7 +7,10 @@
<div class="estimate_id attribute">
<div class="label"><span><%=t(:field_estimate)%></span>:</div>
<div class="value"><%= estimate_link %></div>
<div class="value">
<%= estimate_link %>
<%= call_hook :view_estimate_actions, { estimate: issue.estimate } if issue.estimate %>
</div>
</div>
<div class="invoice_id attribute">