]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Mirror fix from master.
authorMichael Sweet <michael.r.sweet@gmail.com>
Wed, 11 May 2016 14:39:23 +0000 (10:39 -0400)
committerMichael Sweet <michael.r.sweet@gmail.com>
Wed, 11 May 2016 14:39:23 +0000 (10:39 -0400)
CHANGES.txt
scheduler/ipp.c
scheduler/job.c

index d5c883df8d25b9a668e06535f931b45a0e7bc2e9..5c21e4fd66e7c4740eac07cdce67feb460b87d6e 100644 (file)
@@ -1,8 +1,10 @@
-CHANGES.txt - 2.1.4 - 2016-03-24
+CHANGES.txt - 2.1.4 - 2016-05-11
 --------------------------------
 
 CHANGES IN CUPS V2.1.4
 
+       - The scheduler did not implement the Hold-New-Jobs opertion correctly
+         (Issue #4767)
        - The ipptool program truncated values at 8k (Issue #4786)
        - The ipptool program did not correctly report uriScheme values in plist
          output (Issue #4785)
index b7c65fda3367ab026e8d13c63bd8647bb0a56817..06a236b94b8fa7e238331fbe35c51be6340d867d 100644 (file)
@@ -1692,7 +1692,24 @@ add_job(cupsd_client_t  *con,            /* I - Client connection */
     attr = ippAddString(job->attrs, IPP_TAG_JOB, IPP_TAG_KEYWORD,
                         "job-hold-until", NULL, val);
   }
-  if (attr && strcmp(attr->values[0].string.text, "no-hold"))
+
+  if (printer->holding_new_jobs)
+  {
+   /*
+    * Hold all new jobs on this printer...
+    */
+
+    if (attr && strcmp(attr->values[0].string.text, "no-hold"))
+      cupsdSetJobHoldUntil(job, ippGetString(attr, 0, NULL), 0);
+    else
+      cupsdSetJobHoldUntil(job, "indefinite", 0);
+
+    job->state->values[0].integer = IPP_JOB_HELD;
+    job->state_value              = IPP_JOB_HELD;
+
+    ippSetString(job->attrs, &job->reasons, 0, "job-held-on-create");
+  }
+  else if (attr && strcmp(attr->values[0].string.text, "no-hold"))
   {
    /*
     * Hold job until specified time...
@@ -8668,6 +8685,8 @@ release_held_new_jobs(
                     "Printer \"%s\" now printing pending/new jobs (\"%s\").",
                     printer->name, get_username(con));
 
+  cupsdCheckJobs();
+
  /*
   * Everything was ok, so return OK status...
   */
index 0fb0362a06e9c3a65d6f0d6e57e51333c847c492..4738258d392e2cc4781e143f0390f2d9dd9eccea 100644 (file)
@@ -229,6 +229,7 @@ cupsdCheckJobs(void)
                        *pclass;        /* Printer class destination */
   ipp_attribute_t      *attr;          /* Job attribute */
   time_t               curtime;        /* Current time */
+  const char           *reasons;       /* job-state-reasons value */
 
 
   curtime = time(NULL);
@@ -322,6 +323,25 @@ cupsdCheckJobs(void)
        ((FilterLevel + job->pending_cost) < FilterLimit || FilterLevel == 0))
       cupsdContinueJob(job);
 
+   /*
+    * Skip jobs that where held-on-create
+    */
+
+    reasons = ippGetString(job->reasons, 0, NULL);
+    if (reasons && !strcmp(reasons, "job-held-on-create"))
+    {
+     /*
+      * Check whether the printer is still holding new jobs...
+      */
+
+      printer = cupsdFindDest(job->dest);
+
+      if (printer->holding_new_jobs)
+        continue;
+
+      ippSetString(job->attrs, &job->reasons, 0, "none");
+    }
+
    /*
     * Start pending jobs if the destination is available...
     */
@@ -359,7 +379,7 @@ cupsdCheckJobs(void)
                         "Job aborted because the destination printer/class "
                         "has gone away.");
       }
-      else if (printer && !printer->holding_new_jobs)
+      else if (printer)
       {
        /*
         * See if the printer is available or remote and not printing a job;