Merge pull request #3504 from artoscinote/ma_SCI_6025

Amended label template, truncate item name before print [SCI_6025]
This commit is contained in:
artoscinote 2021-08-24 10:59:46 +02:00 committed by GitHub
commit a847f68de4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 5 deletions

View file

@ -4,6 +4,8 @@ class RepositoryRowsController < ApplicationController
include ApplicationHelper
include MyModulesHelper
MAX_PRINTABLE_ITEM_NAME_LENGTH = 64
before_action :load_repository, except: :show
before_action :load_repository_row, only: %i(update assigned_task_list)
before_action :check_read_permissions, except: %i(show create update delete_records copy_records)
@ -99,7 +101,7 @@ class RepositoryRowsController < ApplicationController
label_printer,
LabelTemplate.first.render( # Currently we will only use the default template
item_id: repository_row.code,
item_name: repository_row.name
item_name: repository_row.name.truncate(MAX_PRINTABLE_ITEM_NAME_LENGTH)
),
params[:copies].to_i
).job_id

View file

@ -24,10 +24,11 @@ class CreateLabelTemplates < ActiveRecord::Migration[6.1]
content:
<<~HEREDOC
^XA
^CF0,21
^FO10,0^FD{{item_id}}^FS
^FO5,3^BY3,3.0,25^BQN,2,4^FDMA\\{{item_id}}^FS
^FO100,39^FB190,20,5,L^FD{{item_name}}^FS^FS
^LH20,20
^CF0,23
^FO0,0^FDIT68329^FS
^FO0,20^BQN,2,4^FDMA\{{item_id}}^FS
^FO95,30^FB180,4,0,L^FD{{item_name}}^FS^FS
^XZ
HEREDOC
)