From ffd78fe7013b1c45dc68503ccdce6eadb3ee51c6 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Wed, 23 Nov 2022 17:54:46 +0100 Subject: [PATCH] refs #4550 Fixes --- Dockerfile | 1 + entrypoint.sh | 2 -- print-server.js | 5 ++--- sql/selectQueued.sql | 5 ++--- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 55a5ba1..e4f94c6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,6 +23,7 @@ COPY \ RUN npm install COPY cupsd.conf /etc/cups/ +RUN useradd admin && usermod -g lpadmin admin COPY \ main.js \ diff --git a/entrypoint.sh b/entrypoint.sh index 77ae108..8d35760 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,8 +1,6 @@ #!/bin/bash -useradd admin echo "admin:$CUPS_PASSWORD" | chpasswd -usermod -g lpadmin admin cupsd exec $@ diff --git a/print-server.js b/print-server.js index 0bfff6b..c3e7353 100644 --- a/print-server.js +++ b/print-server.js @@ -85,7 +85,7 @@ class PrintServer { try { await conn.beginTransaction(); - [[printJob]] = await conn.query(selectQuery, ['LabelCollection', this.conf.printers]); + [[printJob]] = await conn.query(selectQuery); if (!printJob) return; jobId = printJob.id; @@ -105,9 +105,8 @@ class PrintServer { args[row.name] = row.value; try { let methodPath = this.method.replace(/{\w+}/g, function(match) { - const params = {id: args.collectionFk}; const key = match.substr(1, match.length - 2); - const value = params[key]; + const value = args[key]; return value !== undefined ? value : match; }); diff --git a/sql/selectQueued.sql b/sql/selectQueued.sql index e5ac781..a59e486 100644 --- a/sql/selectQueued.sql +++ b/sql/selectQueued.sql @@ -8,8 +8,7 @@ SELECT pq.id, JOIN report r ON r.id = pq.reportFk JOIN printQueueArgs pqa ON pqa.printQueueFk = pq.id LEFT JOIN printer p ON p.id = pq.printerFk - WHERE r.name = ? - AND pq.statusCode = 'queued' + WHERE pq.statusCode = 'queued' AND NOT r.method IS NULL ORDER BY pq.priorityFk ASC - LIMIT 1 \ No newline at end of file + LIMIT 1