Print label in the sidebar, filled in from the page

A Labels section in the sidebar of every page: Print label fills the
label in from the page's customer (their name), estimate, invoice,
appointment (its customer and estimate) or work order, or opens a blank
label anywhere else. When there's a customer, the PO number field offers
their latest estimates, invoices and open work orders.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rickyandClaude Opus 5.5 committed 2026-11-16 11:51:53 -05:00
1 parent 3e29f14f76
commit 98a9bcc1bf
11 files changed
+239 -18

No files matched your search

+3 -2
View File
@@ -8,7 +8,8 @@
#
#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.
# The Print label dialog: opened from an issue, estimate or invoice (new), sends the label to a printer's
# The Print label dialog: opened from an issue, estimate, invoice, customer or appointment, or blank from the
# sidebar (new), sends the label to a printer's
# queue (create), and follows it until it's printed (show, polled by the dialog). The dialog asks for show's
# JSON with an Accept header, not a .json URL: Redmine treats .json as the REST API, without the session.
class LabelJobsController < ApplicationController
@@ -27,7 +28,7 @@ class LabelJobsController < ApplicationController
@copies = params[:copies].to_i.clamp(1, LabelJob::MAX_COPIES)
printer = @printers.find { |p| p.id == params[:printer_id].to_i } || @printers.first
@job = LabelJob.new(label_printer: printer, user: User.current, lines: @lines, copies: @copies,
source_type: @source.type, source_id: @source.id.to_s)
source_type: @source.type, source_id: @source.id&.to_s)
@job.save if printer
respond_to { |format| format.js }
end