Index: /pykota/trunk/conf/pykota.conf.sample
===================================================================
--- /pykota/trunk/conf/pykota.conf.sample (revision 3148)
+++ /pykota/trunk/conf/pykota.conf.sample (revision 3158)
@@ -1059,4 +1059,19 @@
 
 
+# If a job is printed by the same person as the last job on the same printer, 
+# should banners be avoided to save some paper
+#
+# This option can be set either globally or on a per printer basis.
+# If set to yes, any duplicate banners will be avoided forever
+# If set to no or 0, no banners will be avoided (they will all be printed)
+# If set to any positive integer, banners will be avoided if printed within
+#     'integer' seconds of the last job 
+#
+# This value defaults to no
+# avoidduplicatebanners: yes
+# avoidduplicatebanners: no
+# avoidduplicatebanners: 600   
+
+
 # StartingBanner : if defined will print a banner before the rest of the job 
 # is printed. The argument can be a printable file, or an executable file.
Index: /pykota/trunk/pykota/config.py
===================================================================
--- /pykota/trunk/pykota/config.py (revision 3133)
+++ /pykota/trunk/pykota/config.py (revision 3158)
@@ -603,4 +603,22 @@
             return value  
 
+    def getAvoidDuplicateBanners(self, printername) :
+        """Returns normalized value for avoiding extra banners. """
+        try :
+            avoidduplicatebanners = self.getPrinterOption(printername, "avoidduplicatebanners").upper()
+        except PyKotaConfigError :
+            return "NO"
+        else :
+            try :
+                value = int(avoidduplicatebanners)
+                if value < 0 :
+                    raise ValueError
+            except ValueError :
+                if avoidduplicatebanners not in ["YES", "NO"] :
+                    raise PyKotaConfigError, _("Option avoidduplicatebanners only accepts 'yes', 'no', or a positive integer.")
+                else :
+                    value = avoidduplicatebanners
+            return value
+
     def getStartingBanner(self, printername) :
         """Returns the startingbanner value if set, else None."""
Index: /pykota/trunk/bin/cupspykota
===================================================================
--- /pykota/trunk/bin/cupspykota (revision 3153)
+++ /pykota/trunk/bin/cupspykota (revision 3158)
@@ -833,5 +833,33 @@
                 self.logdebug("Print job cancelled, not printing a banner.", "warn")
             else :
-                getattr(self, "%sBanner" % bannertype)(withaccounting)
+                self.logdebug("Checking if job owner printed the last job and if another banner is needed...")
+                # Print the banner by default
+                printbanner = True
+                avoidduplicatebanners = self.config.getAvoidDuplicateBanners(self.PrinterName)
+                if ((avoidduplicatebanners == "NO") or (avoidduplicatebanners == 0)):
+                    self.logdebug("We want all banners to be printed.")
+                else :
+                    # Check if we should deny the banner or not
+                    if self.Printer.LastJob.Exists \
+                            and (self.Printer.LastJob.UserName == self.UserName) :
+                        if (avoidduplicatebanners == "YES") :
+                            printbanner = False
+                        else :    
+                            # avoidduplicatebanners is an integer, since NO, 
+                            # YES and 0 are already handled
+                            now = DateTime.now()
+                            try :
+                                previous = DateTime.ISO.ParseDateTime(str(self.Printer.LastJob.JobDate)[:19]).localtime()
+                            except :
+                                previous = now
+                            difference = (now - previous).seconds
+                            self.logdebug("Difference with previous job : %.2f seconds. Try to avoid banners for : %.2f seconds." % (difference, avoidduplicatebanners))
+                            if difference < avoidduplicatebanners :
+                                self.logdebug("Duplicate banner avoided because previous banner is less than %.2f seconds old." % avoidduplicatebanners) 
+                                printbanner = False
+                            else :
+                                printbanner = True
+                if printbanner :
+                    getattr(self, "%sBanner" % bannertype)(withaccounting)
         self.logdebug("%s banner done." % bannertype.title())
         
