mirror of
https://github.com/rickbarrette/redmine_qbo.git
synced 2026-11-20 18:40:37 -05:00
Allow unlocking estimates linked to issues
An estimate attached to an issue was read-only, so changing it after a customer asked for tweaks meant taking it off the work order first. A new global permission, "Edit estimates linked to issues" (on top of Write estimates), shows an "Unlock to edit" button on a linked estimate. After a confirmation the estimate opens for editing, and the issues stay linked when it's saved. EstimateWriter.save still refuses a linked estimate unless it was unlocked by a user with the permission. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
22af08cee7
commit
48f92f241f
9 files changed
+118
-4
No files matched your search
@@ -50,6 +50,8 @@
|
||||
<%= hidden_field_tag 'estimate[txn_status]', form.txn_status, id: nil %>
|
||||
<%# Shown again if the page is redisplayed; the saved value is worked out when saving %>
|
||||
<%= hidden_field_tag 'estimate[sales_person]', form.sales_person, id: nil if form.persisted? || form.invoice? %>
|
||||
<%# An estimate linked to an issue opened for editing (Unlock) stays unlocked if the page is shown again %>
|
||||
<%= hidden_field_tag 'unlock', '1', id: nil if !invoice && form.unlocked %>
|
||||
<% if invoice %>
|
||||
<%= hidden_field_tag 'estimate[balance]', form.balance, id: nil %>
|
||||
<%# A paid invoice opened for editing (Unlock) stays unlocked if the page is shown again %>
|
||||
|
||||
@@ -67,6 +67,21 @@
|
||||
<li><%= link_to_issue(issue, truncate: 60) %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<%# Opened for editing anyway after a confirmation (e.g. the customer asks for changes after the diagnosis) %>
|
||||
<% if RedmineQboBilling.linked_estimate_editor? %>
|
||||
<%= link_to sprite_icon('unlock', l(:button_unlock_estimate)), edit_qbo_estimate_path(form.id, unlock: 1),
|
||||
class: 'icon icon-unlock', id: 'qbo-unlock-estimate',
|
||||
data: { confirm: l(:text_unlock_estimate_confirmation) } %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% elsif form.unlocked && !invoice %>
|
||||
<div class="warning qbo-estimate-notice">
|
||||
<%= l(:text_estimate_unlocked) %>
|
||||
<ul>
|
||||
<% Array(@linked_issues).each do |issue| %>
|
||||
<li><%= link_to_issue(issue, truncate: 60) %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% elsif form.locked == :paid %>
|
||||
<p class="warning">
|
||||
|
||||
Reference in new issue
Block a user