From 1e248098368da44b2b6c9a2eef30faef67a9356f Mon Sep 17 00:00:00 2001 From: Adam Bowling Date: Thu, 10 Jan 2019 02:05:50 -0500 Subject: [PATCH 1/1] LP#1787479: Adds customization for multipage print label printing and fixes the issue with saving templates after the change to DB saving from local storage. Signed-off-by: Adam Bowling Signed-off-by: Chris Sharp --- .../ui/default/staff/cat/printlabels/app.js | 34 +++++++++++-------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/Open-ILS/web/js/ui/default/staff/cat/printlabels/app.js b/Open-ILS/web/js/ui/default/staff/cat/printlabels/app.js index 1e83afa994..9907985aab 100644 --- a/Open-ILS/web/js/ui/default/staff/cat/printlabels/app.js +++ b/Open-ILS/web/js/ui/default/staff/cat/printlabels/app.js @@ -216,6 +216,7 @@ function ($scope, $q, $window, $routeParams, $location, $timeout, egCore, egNet, return !angular.isNumber(toolbox_settings.page.dimensions.rows) || !angular.isNumber(toolbox_settings.page.start_position.row) ? false : (toolbox_settings.page.start_position.row <= toolbox_settings.page.dimensions.rows); } }; + $scope.record_details = {}; $scope.org_unit_settings = {}; @@ -324,18 +325,22 @@ function ($scope, $q, $window, $routeParams, $location, $timeout, egCore, egNet, $scope.fetchTemplates(true); $scope.applyTemplate = function (n) { - $scope.print.cn_template_content = $scope.templates[n].cn_content; - $scope.print.template_content = $scope.templates[n].content; - $scope.print.template_context = $scope.templates[n].context; - for (var s in $scope.templates[n].settings) { - $scope.preview_scope.settings[s] = $scope.templates[n].settings[s]; - } - if ($scope.templates[n].toolbox_settings) { - $scope.preview_scope.toolbox_settings = $scope.templates[n].toolbox_settings; - $scope.create_print_label_table(); + if (n) { + if ($scope.templates[n]) { + $scope.print.cn_template_content = $scope.templates[n].cn_content; + $scope.print.template_content = $scope.templates[n].content; + $scope.print.template_context = $scope.templates[n].context; + for (var s in $scope.templates[n].settings) { + $scope.preview_scope.settings[s] = $scope.templates[n].settings[s]; + } + if ($scope.templates[n].toolbox_settings) { + $scope.preview_scope.toolbox_settings = $scope.templates[n].toolbox_settings; + $scope.create_print_label_table(); + } + egCore.hatch.setItem('cat.printlabels.default_template', n); + $scope.save_locally(); + } } - egCore.hatch.setItem('cat.printlabels.default_template', n); - $scope.save_locally(); } $scope.deleteTemplate = function (n) { @@ -356,13 +361,12 @@ function ($scope, $q, $window, $routeParams, $location, $timeout, egCore, egNet, $scope.saveTemplate = function (n) { if (n) { - $scope.templates[n] = { content: $scope.print.template_content , context: $scope.print.template_context , cn_content: $scope.print.cn_template_content - , settings: $scope.preview_scope.settings - , toolbox_settings: $scope.preview_scope.toolbox_settings + , settings: JSON.parse(JSON.stringify($scope.preview_scope.settings)) + , toolbox_settings: JSON.parse(JSON.stringify($scope.preview_scope.toolbox_settings)) }; $scope.template_name_list = Object.keys($scope.templates); @@ -513,7 +517,7 @@ function ($scope, $q, $window, $routeParams, $location, $timeout, egCore, egNet, $scope.preview_scope.label_output_copies = labelOutputRowsFilter($scope.preview_scope.copies, $scope.preview_scope.toolbox_settings); var html = $scope.print.template_content; var d = new Date(); //Added to table ID with 'eg_plt_' to cause $complie on $scope.print.template_content to fire due to template content change. - var table = " 0 && toolbox_settings.feed_option.selected === 'sheet' ? ' page-break' : ''}}\" ng-init=\"parentIndex = $index\" ng-repeat=\"row in label_output_copies\">\n"; + var table = "
0 && toolbox_settings.feed_option.selected === 'sheet' ? ' page-break' : ''}}\" ng-init=\"parentIndex = $index\" ng-repeat=\"row in label_output_copies\">\n"; table += "\n"; table += "
0 ? toolbox_settings.page.space_between_labels.vertical.size : parentIndex > 0 ? toolbox_settings.page.space_between_labels.vertical.size : 0}} 0 0 {{$index === 0 ? toolbox_settings.page.margins.left.size : col.styl ? col.styl : toolbox_settings.page.space_between_labels.horizontal.size}};\" ng-repeat=\"col in row.columns\">\n"; table += "
\n";
-- 
2.43.2