Skip to content

Commit 5ec8a5e

Browse files
committed
Update job-media-sheets-completed calculation (Issue #1758)
1 parent fad1370 commit 5ec8a5e

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

‎CHANGES.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ v2.4.21 - YYYY-MM-DD
2121
- Fixed unintended usage of C99 language feature (Issue #1742)
2222
- Fixed regression in mailto notifier address validation (Issue #1744)
2323
- Fixed regression with setting up temporary queues (Issue #1751)
24+
- Fixed "job-media-sheets-completed" value (Issue #1758)
2425
- Fixed a potential integer overflow with `pwgMediaForPWG`.
2526

2627

‎scheduler/job.c‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5255,12 +5255,18 @@ update_job(cupsd_job_t *job) /* I - Job to check */
52555255

52565256
if (job->sheets)
52575257
{
5258+
int copies = ippGetInteger(ippFindAttribute(job->attrs, "copies", IPP_TAG_INTEGER), 0);
5259+
/* Number of copies */
52585260
const char *sides = ippGetString(ippFindAttribute(job->attrs, "sides", IPP_TAG_KEYWORD), 0, NULL);
5261+
/* Duplex mode, if any */
5262+
5263+
if (copies <= 0)
5264+
copies = 1;
52595265

52605266
if (sides && strcmp(sides, "one-sided"))
5261-
ippSetInteger(job->attrs, &job->sheets, 0, impressions / 2);
5267+
ippSetInteger(job->attrs, &job->sheets, 0, (impressions + 1) / 2 * copies);
52625268
else
5263-
ippSetInteger(job->attrs, &job->sheets, 0, impressions);
5269+
ippSetInteger(job->attrs, &job->sheets, 0, impressions * copies);
52645270

52655271
cupsdAddEvent(CUPSD_EVENT_JOB_PROGRESS, job->printer, job, "Printed %d page(s).", ippGetInteger(job->sheets, 0));
52665272
}

0 commit comments

Comments
 (0)