[feat:] enable/disable label export (to only export running sheets
This commit is contained in:
@@ -13,7 +13,7 @@ namespace Logof_Client;
|
|||||||
public static class SchemaMigration
|
public static class SchemaMigration
|
||||||
{
|
{
|
||||||
// Current schema version - increment when you make breaking changes
|
// Current schema version - increment when you make breaking changes
|
||||||
public const int CURRENT_SCHEMA_VERSION = 4;
|
public const int CURRENT_SCHEMA_VERSION = 5;
|
||||||
|
|
||||||
// Dictionary of migration functions, keyed by the version they migrate TO
|
// Dictionary of migration functions, keyed by the version they migrate TO
|
||||||
private static readonly Dictionary<int, Func<JObject, JObject>> Migrations = new()
|
private static readonly Dictionary<int, Func<JObject, JObject>> Migrations = new()
|
||||||
@@ -24,6 +24,7 @@ public static class SchemaMigration
|
|||||||
|
|
||||||
// Example: Migration from v2 to v3
|
// Example: Migration from v2 to v3
|
||||||
{ 4, MigrateV3ToV4 },
|
{ 4, MigrateV3ToV4 },
|
||||||
|
{ 5, MigrateV4ToV5 },
|
||||||
};
|
};
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -104,6 +105,16 @@ public static class SchemaMigration
|
|||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
private static JObject MigrateV4ToV5(JObject obj)
|
||||||
|
{
|
||||||
|
// Example: Add a new field that didn't exist before
|
||||||
|
if (!obj.ContainsKey("expLabEnable"))
|
||||||
|
{
|
||||||
|
obj["expLabEnable"] = JToken.FromObject(new PdfExportSettings().expLabEnable);
|
||||||
|
}
|
||||||
|
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Registers a new migration function that will be called when upgrading to a specific version.
|
/// Registers a new migration function that will be called when upgrading to a specific version.
|
||||||
|
|||||||
@@ -98,6 +98,7 @@ public enum LCModule
|
|||||||
|
|
||||||
public class PdfExportSettings
|
public class PdfExportSettings
|
||||||
{
|
{
|
||||||
|
public bool expLabEnable {get; set;} = true;
|
||||||
public double cellPaddingTopMm { get; set; } = 4;
|
public double cellPaddingTopMm { get; set; } = 4;
|
||||||
public double cellPaddingBottomMm { get; set; } = 4;
|
public double cellPaddingBottomMm { get; set; } = 4;
|
||||||
public double cellPaddingLeftMm { get; set; } = 4;
|
public double cellPaddingLeftMm { get; set; } = 4;
|
||||||
|
|||||||
@@ -315,6 +315,7 @@
|
|||||||
<Grid Grid.Row="2" Margin="20" ColumnDefinitions="*,5*,*" IsVisible="False" x:Name="GrdExportMarginOptions">
|
<Grid Grid.Row="2" Margin="20" ColumnDefinitions="*,5*,*" IsVisible="False" x:Name="GrdExportMarginOptions">
|
||||||
<ScrollViewer Grid.Column="1">
|
<ScrollViewer Grid.Column="1">
|
||||||
<StackPanel Margin="5,5,5,5" Orientation="Vertical" Spacing="20" Background="AliceBlue" >
|
<StackPanel Margin="5,5,5,5" Orientation="Vertical" Spacing="20" Background="AliceBlue" >
|
||||||
|
<CheckBox Content="Versandetiketten erstellen" x:Name="CbExpLabEnable"></CheckBox>
|
||||||
<Grid ColumnDefinitions="*,*,*" ColumnSpacing="20" Margin="10,10,10,0">
|
<Grid ColumnDefinitions="*,*,*" ColumnSpacing="20" Margin="10,10,10,0">
|
||||||
<StackPanel Orientation="Vertical" Spacing="10">
|
<StackPanel Orientation="Vertical" Spacing="10">
|
||||||
<Grid ColumnDefinitions="*,*">
|
<Grid ColumnDefinitions="*,*">
|
||||||
|
|||||||
@@ -978,6 +978,8 @@ public partial class MainWindow : Window
|
|||||||
{
|
{
|
||||||
var options = Settings._instance.pdfExport ?? new PdfExportSettings();
|
var options = Settings._instance.pdfExport ?? new PdfExportSettings();
|
||||||
|
|
||||||
|
CbExpLabEnable.IsChecked = (bool)options.expLabEnable;
|
||||||
|
|
||||||
NudExpMargCellPaddingTop.Value = (decimal)options.cellPaddingTopMm;
|
NudExpMargCellPaddingTop.Value = (decimal)options.cellPaddingTopMm;
|
||||||
NudExpMargCellPaddingBot.Value = (decimal)options.cellPaddingBottomMm;
|
NudExpMargCellPaddingBot.Value = (decimal)options.cellPaddingBottomMm;
|
||||||
NudExpMargCellPaddingLeft.Value = (decimal)options.cellPaddingLeftMm;
|
NudExpMargCellPaddingLeft.Value = (decimal)options.cellPaddingLeftMm;
|
||||||
@@ -1031,6 +1033,8 @@ public partial class MainWindow : Window
|
|||||||
fontSize = ReadDouble(NudExpMargFontSize),
|
fontSize = ReadDouble(NudExpMargFontSize),
|
||||||
smallFontSize = ReadDouble(NudExpMargSmallFontSize),
|
smallFontSize = ReadDouble(NudExpMargSmallFontSize),
|
||||||
|
|
||||||
|
expLabEnable = CbExpLabEnable.IsChecked.Value,
|
||||||
|
|
||||||
rsKNrAbs = TbExpRnsKNrAbs.Text,
|
rsKNrAbs = TbExpRnsKNrAbs.Text,
|
||||||
rsKNrEmp = TbExpRnsKNrEmp.Text,
|
rsKNrEmp = TbExpRnsKNrEmp.Text,
|
||||||
rsZKZ = TbExpRnsZKZ.Text,
|
rsZKZ = TbExpRnsZKZ.Text,
|
||||||
|
|||||||
+11
-2
@@ -92,6 +92,8 @@ public class PdfBuilder
|
|||||||
public void CreateAddressLabelPdfFromAddressSetWithPlaceholder(int addressSetId, string placeholderText, bool pvst,
|
public void CreateAddressLabelPdfFromAddressSetWithPlaceholder(int addressSetId, string placeholderText, bool pvst,
|
||||||
string outputPath)
|
string outputPath)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Find the AddressSet by ID
|
// Find the AddressSet by ID
|
||||||
@@ -174,9 +176,16 @@ public class PdfBuilder
|
|||||||
|
|
||||||
string output_inter = outputPath.Replace(".pdf", "-international.pdf");
|
string output_inter = outputPath.Replace(".pdf", "-international.pdf");
|
||||||
|
|
||||||
if(addresses_german.Count > 0) CreateAddressLabelPdfWithPlaceholder(addresses_german, placeholderText, outputPath, pvst);
|
if(Settings._instance.pdfExport.expLabEnable == false)
|
||||||
if(addresses_inter.Count > 0) CreateAddressLabelPdfWithPlaceholder(addresses_inter, placeholderText, output_inter, pvst);
|
{
|
||||||
|
Logger.Log("Skipping label pdf generation cause it was disabled by user");
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
if(addresses_german.Count > 0) CreateAddressLabelPdfWithPlaceholder(addresses_german, placeholderText, outputPath, pvst);
|
||||||
|
if(addresses_inter.Count > 0) CreateAddressLabelPdfWithPlaceholder(addresses_inter, placeholderText, output_inter, pvst);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (_settings.exportRunningSheets)
|
if (_settings.exportRunningSheets)
|
||||||
{
|
{
|
||||||
ExportRunningSheets(addressSetId, outputPath);
|
ExportRunningSheets(addressSetId, outputPath);
|
||||||
|
|||||||
Reference in New Issue
Block a user