From aeeebc3b4fc503809590dc55263f560835cc4bae Mon Sep 17 00:00:00 2001 From: AbleKSaju <126228406+AbleKSaju@users.noreply.github.com> Date: Fri, 3 Jan 2025 10:10:54 +0530 Subject: [PATCH] fix: use POS print template width from print settings --- main/getPrintTemplates.ts | 6 +++++- schemas/app/PrintSettings.json | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/main/getPrintTemplates.ts b/main/getPrintTemplates.ts index d56ca2cc..98c3ef43 100644 --- a/main/getPrintTemplates.ts +++ b/main/getPrintTemplates.ts @@ -1,5 +1,6 @@ import fs from 'fs/promises'; import path from 'path'; +import { fyo } from 'src/initFyo'; import { TemplateFile } from 'utils/types'; export async function getTemplates() { @@ -13,7 +14,10 @@ export async function getTemplates() { const filePath = path.join(paths.root, file); const template = await fs.readFile(filePath, 'utf-8'); const { mtime } = await fs.stat(filePath); - const width = file?.split('-')[1]?.split('.')[0] === 'POS' ? 8 : 0; + const width = + file?.split('-')[1]?.split('.')[0] === 'POS' + ? (fyo.singles.PrintSettings?.posPrintWidth as number) + : 0; const height = file?.split('-')[1]?.split('.')[0] === 'POS' ? 22 : 0; templates.push({ diff --git a/schemas/app/PrintSettings.json b/schemas/app/PrintSettings.json index 54a91d9c..af429f9d 100644 --- a/schemas/app/PrintSettings.json +++ b/schemas/app/PrintSettings.json @@ -131,7 +131,7 @@ "fieldname": "posPrintWidth", "label": "Pos Print Width", "fieldtype": "Float", - "default": 10, + "default": 8, "section": "Customizations" } ]