Change switching permission for label templates and zebra print to stock management [SCI-7305] (#4574)

This commit is contained in:
ajugo 2022-10-25 13:07:45 +02:00 committed by GitHub
parent eec5fd9ab3
commit ea75eefd88
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 9 additions and 7 deletions

View file

@ -19,6 +19,10 @@ class LabelPrinter < ApplicationRecord
validates :type_of, presence: true
validates :language_type, presence: true
def self.zebra_print_enabled?
RepositoryBase.stock_management_enabled?
end
def done?
current_print_job_ids.blank? && ready?
end

View file

@ -16,7 +16,7 @@ class LabelTemplate < ApplicationRecord
validate :ensure_single_default_template!
def self.enabled?
ApplicationSettings.instance.values['label_templates_enabled']
RepositoryBase.stock_management_enabled?
end
def icon

View file

@ -7,7 +7,7 @@
data-print-validation-url="<%= validate_label_template_columns_repository_row_path %>"
data-label-preview-url="<%= zpl_preview_label_templates_path %>"
data-fluics-info-url="<%= Constants::SCINOTE_FLUICS_URL %>"
data-zebra-enabled="<%= Rails.configuration.x.zebra_print_enabled %>"
data-zebra-enabled="<%= LabelPrinter.zebra_print_enabled? %>"
>
<print-modal-container
:show-modal = "showModal"

View file

@ -16,7 +16,7 @@
<h1 class="printer-title">
<% if @printer_type == 'fluics' %>
<%= t("users.settings.account.label_printer.fluics_printer") %>
<% elsif @printer_type == 'zebra' && Rails.configuration.x.zebra_print_enabled %>
<% elsif @printer_type == 'zebra' && LabelPrinter.zebra_print_enabled? %>
<%= t("users.settings.account.label_printer.zebra_printer") %>
<% end %>
</h1>
@ -25,7 +25,7 @@
<% if @printer_type == 'fluics' %>
<%= render "fluics_settings" %>
<% elsif @printer_type == 'zebra' && Rails.configuration.x.zebra_print_enabled %>
<% elsif @printer_type == 'zebra' && LabelPrinter.zebra_print_enabled? %>
<%= render "zebra_settings" %>
<% end %>
</div>

View file

@ -20,7 +20,7 @@
<div class="row printer-settings">
<div class="col-xs-12 col-sm-12">
<h2 class="addons-subtitle"><%= t('users.settings.account.addons.label_printers') %></h2>
<% if Rails.configuration.x.zebra_print_enabled %>
<% if LabelPrinter.zebra_print_enabled? %>
<div class="printers-container">
<div class="printer">
<div class="header">

View file

@ -57,8 +57,6 @@ module Scinote
config.x.webhooks_enabled = ENV['ENABLE_WEBHOOKS'] == 'true'
config.x.zebra_print_enabled = ENV['SCINOTE_ZEBRA_PRINT_ENABLED'] == 'true'
# Logging
config.log_formatter = proc do |severity, datetime, progname, msg|
"[#{datetime}] #{severity}: #{msg}\n"