mirror of
https://github.com/rickbarrette/redmine_qbo.git
synced 2026-11-19 10:40:36 -05:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
778111825b | ||
|
|
4ba96e2dfd |
No files matched your search
@@ -116,13 +116,19 @@ class QboEstimatesController < ApplicationController
|
|||||||
customer = Customer.find_by(id: params[:customer_id])
|
customer = Customer.find_by(id: params[:customer_id])
|
||||||
return render(json: {}, status: :not_found) unless customer
|
return render(json: {}, status: :not_found) unless customer
|
||||||
|
|
||||||
render json: {
|
info = {
|
||||||
id: customer.id,
|
id: customer.id,
|
||||||
name: customer.name,
|
name: customer.name,
|
||||||
email: RedmineQboBilling::EstimateWriter.customer_email(customer),
|
email: RedmineQboBilling::EstimateWriter.customer_email(customer),
|
||||||
billing_address: RedmineQboBilling::EstimateWriter.customer_address(customer),
|
billing_address: RedmineQboBilling::EstimateWriter.customer_address(customer),
|
||||||
field_options: RedmineQboBilling.field_options(customer)
|
field_options: RedmineQboBilling.field_options(customer)
|
||||||
}
|
}
|
||||||
|
# A new invoice warns about the customer's open issues
|
||||||
|
if params[:document] == 'invoice'
|
||||||
|
info[:open_issues_html] = render_to_string(partial: 'qbo_invoices/open_issues', formats: [:html],
|
||||||
|
locals: { customer: customer })
|
||||||
|
end
|
||||||
|
render json: info
|
||||||
end
|
end
|
||||||
|
|
||||||
# Product/service search for the line table (the QuickBooks item list)
|
# Product/service search for the line table (the QuickBooks item list)
|
||||||
|
|||||||
@@ -446,7 +446,9 @@ $(function () {
|
|||||||
var id = $(this).val();
|
var id = $(this).val();
|
||||||
if (!id) return;
|
if (!id) return;
|
||||||
dirty = true;
|
dirty = true;
|
||||||
$.getJSON($form.data('customerInfoUrl'), { customer_id: id }).done(function (info) {
|
$.getJSON($form.data('customerInfoUrl'), { customer_id: id, document: $form.data('document') }).done(function (info) {
|
||||||
|
// A new invoice's open issues notice follows the customer
|
||||||
|
if (info.open_issues_html !== undefined) $('#qbo-open-issues').replaceWith(info.open_issues_html);
|
||||||
// Replace the email only if it was the previous customer's (or empty)
|
// Replace the email only if it was the previous customer's (or empty)
|
||||||
if (!$email.val().trim() || $email.val() === loadedEmail) $email.val(info.email || '');
|
if (!$email.val().trim() || $email.val() === loadedEmail) $email.val(info.email || '');
|
||||||
loadedEmail = info.email || '';
|
loadedEmail = info.email || '';
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<%# A new invoice's customer still has open issues (work orders), so they're not left behind once billed.
|
||||||
|
Replaced when the customer is changed (customer_info's open_issues_html). %>
|
||||||
|
<%
|
||||||
|
issues = customer ? customer.issues.open.visible.order(id: :desc).to_a : []
|
||||||
|
%>
|
||||||
|
<div id="qbo-open-issues">
|
||||||
|
<% if issues.any? %>
|
||||||
|
<div class="warning qbo-estimate-notice">
|
||||||
|
<%= l(:text_invoice_customer_open_issues, count: issues.size) %>
|
||||||
|
<ul>
|
||||||
|
<% issues.each do |issue| %>
|
||||||
|
<li><%= link_to_issue(issue, truncate: 60) %> (<%= issue.status %>)</li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
<% html_title l(:label_new_invoice) %>
|
<% html_title l(:label_new_invoice) %>
|
||||||
|
|
||||||
<%= render partial: 'qbo_estimates/header', locals: { form: @form } %>
|
<%= render partial: 'qbo_estimates/header', locals: { form: @form } %>
|
||||||
|
<%= render partial: 'qbo_invoices/open_issues', locals: { customer: (Customer.find_by(id: @form.customer_id) if @form.customer_id.present?) } %>
|
||||||
<%= render partial: 'qbo_estimates/form', locals: { form: @form } %>
|
<%= render partial: 'qbo_estimates/form', locals: { form: @form } %>
|
||||||
@@ -256,6 +256,9 @@ en:
|
|||||||
notice_invoice_sent: "Invoice #%{number} emailed to %{email}"
|
notice_invoice_sent: "Invoice #%{number} emailed to %{email}"
|
||||||
text_email_invoice_confirmation: "Email invoice #%{number} to %{email}?"
|
text_email_invoice_confirmation: "Email invoice #%{number} to %{email}?"
|
||||||
text_invoice_from_estimate: "Made from estimate #%{number}. The estimate is closed when the invoice is saved."
|
text_invoice_from_estimate: "Made from estimate #%{number}. The estimate is closed when the invoice is saved."
|
||||||
|
text_invoice_customer_open_issues:
|
||||||
|
one: "This customer has an open issue. Make sure its work is finished and billed so it isn't left open:"
|
||||||
|
other: "This customer has %{count} open issues. Make sure their work is finished and billed so none are left open:"
|
||||||
text_line_bills_time: "Bills a QuickBooks time activity; saving marks the time as billed"
|
text_line_bills_time: "Bills a QuickBooks time activity; saving marks the time as billed"
|
||||||
text_replace_lines: "Tick the lines the time replaces (e.g. the estimate's labor lines). Each time entry takes the place of the line with its issue's description (e.g. Install Lift Kit), then any others in order."
|
text_replace_lines: "Tick the lines the time replaces (e.g. the estimate's labor lines). Each time entry takes the place of the line with its issue's description (e.g. Install Lift Kit), then any others in order."
|
||||||
|
|
||||||
|
|||||||
@@ -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: customers, time activities for billable hours when an issue is closed, and estimates, invoices and payments written in Redmine'
|
description 'A pluging for Redmine to connect with QuickBooks Online: customers, time activities for billable hours when an issue is closed, and estimates, invoices and payments written in Redmine'
|
||||||
version '2026.11.6'
|
version '2026.11.7'
|
||||||
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'
|
||||||
|
|||||||
Reference in new issue
Block a user