Index: /pykota/trunk/pykota/storages/sql.py
===================================================================
--- /pykota/trunk/pykota/storages/sql.py (revision 1792)
+++ /pykota/trunk/pykota/storages/sql.py (revision 1806)
@@ -22,4 +22,8 @@
 #
 # $Log$
+# Revision 1.58  2004/10/12 08:58:53  jalet
+# Now warnpykota only warns users who have already printed, to not confuse
+# users who have just opened their account.
+#
 # Revision 1.57  2004/10/10 10:12:21  jalet
 # Improved SQL queries for groups. Same work has to be done for groups print quotas.
@@ -184,4 +188,11 @@
             groupnames = [record["groupname"] for record in result]
         return groupnames
+        
+    def getUserNbJobsFromHistory(self, user) :
+        """Returns the number of jobs the user has in history."""
+        result = self.doSearch("SELECT COUNT(*) FROM jobhistory WHERE userid=%s" % self.doQuote(user.ident))
+        if result :
+            return result[0]["count"]
+        return 0
         
     def getUserFromBackend(self, username) :    
Index: /pykota/trunk/pykota/storages/ldapstorage.py
===================================================================
--- /pykota/trunk/pykota/storages/ldapstorage.py (revision 1790)
+++ /pykota/trunk/pykota/storages/ldapstorage.py (revision 1806)
@@ -22,4 +22,8 @@
 #
 # $Log$
+# Revision 1.84  2004/10/12 08:58:53  jalet
+# Now warnpykota only warns users who have already printed, to not confuse
+# users who have just opened their account.
+#
 # Revision 1.83  2004/10/07 21:14:28  jalet
 # Hopefully final fix for data encoding to and from the database
@@ -522,4 +526,9 @@
             groupnames = [record[1]["pykotaGroupName"][0] for record in result]
         return groupnames
+        
+    def getUserNbJobsFromHistory(self, user) :
+        """Returns the number of jobs the user has in history."""
+        result = self.doSearch("(&(pykotaUserName=%s)(objectClass=pykotaJob))" % user.Name, None, base=self.info["jobbase"])
+        return len(result)
         
     def getUserFromBackend(self, username) :    
Index: /pykota/trunk/pykota/version.py
===================================================================
--- /pykota/trunk/pykota/version.py (revision 1791)
+++ /pykota/trunk/pykota/version.py (revision 1806)
@@ -22,5 +22,5 @@
 #
 
-__version__ = "1.20alpha23_unofficial"
+__version__ = "1.20alpha24_unofficial"
 
 __doc__ = """PyKota : a complete Printing Quota Solution for CUPS and LPRng."""
Index: /pykota/trunk/bin/warnpykota
===================================================================
--- /pykota/trunk/bin/warnpykota (revision 1803)
+++ /pykota/trunk/bin/warnpykota (revision 1806)
@@ -24,4 +24,8 @@
 #
 # $Log$
+# Revision 1.33  2004/10/12 08:58:53  jalet
+# Now warnpykota only warns users who have already printed, to not confuse
+# users who have just opened their account.
+#
 # Revision 1.32  2004/10/11 22:53:05  jalet
 # Postponed string interpolation to help message's output method
@@ -234,5 +238,10 @@
             else :
                 for (user, userpquota) in self.storage.getPrinterUsersAndQuotas(printer, ugnames) :
-                    self.warnUserPQuota(userpquota)
+                    # we only want to warn users who have ever printed something
+                    # and don't want to warn users who have never printed
+                    if (user.AccountBalance and (user.AccountBalance != user.LifeTimePaid)) or \
+                       userpquota.PageCounter or userpquota.LifePageCounter or \
+                       self.storage.getUserNbJobsFromHistory(user) :
+                        self.warnUserPQuota(userpquota)
                      
 if __name__ == "__main__" : 
Index: /pykota/trunk/NEWS
===================================================================
--- /pykota/trunk/NEWS (revision 1791)
+++ /pykota/trunk/NEWS (revision 1806)
@@ -22,4 +22,12 @@
 PyKota NEWS :
 
+    - 1.20alpha24 :
+    
+        - Now warnpykota only warns users who have ever printed,
+          to not cause confusion to users who have just opened
+          their account.
+        
+        - Prepared help messages for translations.
+        
     - 1.20alpha23 :
     
