Index: pykota/trunk/pykota/storages/pgstorage.py
===================================================================
--- pykota/trunk/pykota/storages/pgstorage.py (revision 1200)
+++ pykota/trunk/pykota/storages/pgstorage.py (revision 1203)
@@ -22,4 +22,7 @@
 #
 # $Log$
+# Revision 1.23  2003/11/23 19:01:37  jalet
+# Job price added to history
+#
 # Revision 1.22  2003/11/21 14:28:46  jalet
 # More complete job history.
@@ -282,5 +285,5 @@
         """Extracts a printer's last job information."""
         lastjob = StorageLastJob(self, printer)
-        result = self.doSearch("SELECT jobhistory.id, jobid, userid, username, pagecounter, jobsize, jobdate FROM jobhistory, users WHERE printerid=%s AND userid=users.id ORDER BY jobdate DESC LIMIT 1" % self.doQuote(printer.ident))
+        result = self.doSearch("SELECT jobhistory.id, jobid, userid, username, pagecounter, jobsize, jobprice, filename, title, copies, options, jobdate FROM jobhistory, users WHERE printerid=%s AND userid=users.id ORDER BY jobdate DESC LIMIT 1" % self.doQuote(printer.ident))
         if result :
             fields = result[0]
@@ -290,5 +293,10 @@
             lastjob.PrinterPageCounter = fields.get("pagecounter")
             lastjob.JobSize = fields.get("jobsize")
+            lastjob.JobPrice = fields.get("jobprice")
             lastjob.JobAction = fields.get("action")
+            lastjob.JobFileName = fields.get("filename")
+            lastjob.JobTitle = fields.get("title")
+            lastjob.JobCopies = fields.get("copies")
+            lastjob.JobOptions = fields.get("options")
             lastjob.JobDate = fields.get("jobdate")
             lastjob.Exists = 1
@@ -446,18 +454,18 @@
            self.doModify("UPDATE users SET balance=%s WHERE id=%s" % (self.doQuote(newbalance), self.doQuote(user.ident)))
             
-    def writeLastJobSize(self, lastjob, jobsize) :        
+    def writeLastJobSize(self, lastjob, jobsize, jobprice) :        
         """Sets the last job's size permanently."""
-        self.doModify("UPDATE jobhistory SET jobsize=%s WHERE id=%s" % (self.doQuote(jobsize), self.doQuote(lastjob.ident)))
-        
-    def writeJobNew(self, printer, user, jobid, pagecounter, action, jobsize=None, filename=None, title=None, copies=None, options=None) :    
+        self.doModify("UPDATE jobhistory SET jobsize=%s, jobprice=%s WHERE id=%s" % (self.doQuote(jobsize), self.doQuote(jobprice), self.doQuote(lastjob.ident)))
+        
+    def writeJobNew(self, printer, user, jobid, pagecounter, action, jobsize=None, jobprice=None, filename=None, title=None, copies=None, options=None) :    
         """Adds a job in a printer's history."""
         if (not self.disablehistory) or (not printer.LastJob.Exists) :
             if jobsize is not None :
-                self.doModify("INSERT INTO jobhistory (userid, printerid, jobid, pagecounter, action, jobsize, filename, title, copies, options) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)" % (self.doQuote(user.ident), self.doQuote(printer.ident), self.doQuote(jobid), self.doQuote(pagecounter), self.doQuote(action), self.doQuote(jobsize), self.doQuote(filename), self.doQuote(title), self.doQuote(copies), self.doQuote(options)))
+                self.doModify("INSERT INTO jobhistory (userid, printerid, jobid, pagecounter, action, jobsize, jobprice, filename, title, copies, options) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)" % (self.doQuote(user.ident), self.doQuote(printer.ident), self.doQuote(jobid), self.doQuote(pagecounter), self.doQuote(action), self.doQuote(jobsize), self.doQuote(jobprice), self.doQuote(filename), self.doQuote(title), self.doQuote(copies), self.doQuote(options)))
             else :    
                 self.doModify("INSERT INTO jobhistory (userid, printerid, jobid, pagecounter, action, filename, title, copies, options) VALUES (%s, %s, %s, %s, %s)" % (self.doQuote(user.ident), self.doQuote(printer.ident), self.doQuote(jobid), self.doQuote(pagecounter), self.doQuote(action), self.doQuote(filename), self.doQuote(title), self.doQuote(copies), self.doQuote(options)))
         else :        
             # here we explicitly want to reset jobsize to NULL if needed
-            self.doModify("UPDATE jobhistory SET userid=%s, jobid=%s, pagecounter=%s, action=%s, jobsize=%s, jobdate=now() WHERE id=%s;" % (self.doQuote(user.ident), self.doQuote(jobid), self.doQuote(pagecounter), self.doQuote(action), self.doQuote(jobsize), self.doQuote(printer.LastJob.ident)))
+            self.doModify("UPDATE jobhistory SET userid=%s, jobid=%s, pagecounter=%s, action=%s, jobsize=%s, jobprice=%s, filename=%s, title=%s, copies=%s, options=%s, jobdate=now() WHERE id=%s;" % (self.doQuote(user.ident), self.doQuote(jobid), self.doQuote(pagecounter), self.doQuote(action), self.doQuote(jobsize), self.doQuote(jobprice), self.doQuote(filename), self.doQuote(title), self.doQuote(copies), self.doQuote(options), self.doQuote(printer.LastJob.ident)))
             
     def writeUserPQuotaLimits(self, userpquota, softlimit, hardlimit) :
Index: pykota/trunk/pykota/storages/ldapstorage.py
===================================================================
--- pykota/trunk/pykota/storages/ldapstorage.py (revision 1200)
+++ pykota/trunk/pykota/storages/ldapstorage.py (revision 1203)
@@ -22,4 +22,7 @@
 #
 # $Log$
+# Revision 1.37  2003/11/23 19:01:37  jalet
+# Job price added to history
+#
 # Revision 1.36  2003/11/21 14:28:46  jalet
 # More complete job history.
@@ -407,5 +410,5 @@
             lastjob.lastjobident = result[0][0]
             lastjobident = result[0][1]["pykotaLastJobIdent"][0]
-            result = self.doSearch("objectClass=pykotaJob", ["pykotaUserName", "pykotaJobId", "pykotaPrinterPageCounter", "pykotaJobSize", "pykotaAction", "createTimestamp"], base="cn=%s,%s" % (lastjobident, self.info["jobbase"]), scope=ldap.SCOPE_BASE)
+            result = self.doSearch("objectClass=pykotaJob", ["pykotaUserName", "pykotaJobId", "pykotaPrinterPageCounter", "pykotaJobSize", "pykotaAction", "pykotaJobPrice", "pykotaFileName", "pykotaTitle", "pykotaCopies", "pykotaOptions", "createTimestamp"], base="cn=%s,%s" % (lastjobident, self.info["jobbase"]), scope=ldap.SCOPE_BASE)
             if result :
                 fields = result[0][1]
@@ -415,5 +418,10 @@
                 lastjob.PrinterPageCounter = int(fields.get("pykotaPrinterPageCounter")[0] or 0)
                 lastjob.JobSize = int(fields.get("pykotaJobSize", [0])[0])
+                lastjob.JobPrice = float(fields.get("pykotaJobPrice", [0.0])[0])
                 lastjob.JobAction = fields.get("pykotaAction")[0]
+                lastjob.JobFileName = fields.get("pykotaFileName")[0]
+                lastjob.JobTitle = fields.get("pykotaTitle")[0]
+                lastjob.JobCopies = int(fields.get("pykotaCopies", [0])[0])
+                lastjob.JobOptions = fields.get("pykotaOptions")[0]
                 date = fields.get("createTimestamp")[0]
                 year = int(date[:4])
@@ -686,12 +694,13 @@
         return self.doModify(user.idbalance, fields)         
             
-    def writeLastJobSize(self, lastjob, jobsize) :        
+    def writeLastJobSize(self, lastjob, jobsize, jobprice) :        
         """Sets the last job's size permanently."""
         fields = {
                    "pykotaJobSize" : str(jobsize),
+                   "pykotaJobPrice" : str(jobprice),
                  }
         self.doModify(lastjob.ident, fields)         
         
-    def writeJobNew(self, printer, user, jobid, pagecounter, action, jobsize=None, filename=None, title=None, copies=None, options=None) :    
+    def writeJobNew(self, printer, user, jobid, pagecounter, action, jobsize=None, jobprice=None, filename=None, title=None, copies=None, options=None) :
         """Adds a job in a printer's history."""
         if (not self.disablehistory) or (not printer.LastJob.Exists) :
@@ -716,9 +725,9 @@
         if (not self.disablehistory) or (not printer.LastJob.Exists) :
             if jobsize is not None :         
-                fields.update({ "pykotaJobSize" : str(jobsize) })
+                fields.update({ "pykotaJobSize" : str(jobsize), "pykotaJobPrice" : str(jobprice) })
             self.doAdd(dn, fields)
         else :    
             # here we explicitly want to reset jobsize to 'None' if needed
-            fields.update({ "pykotaJobSize" : str(jobsize) })
+            fields.update({ "pykotaJobSize" : str(jobsize), "pykotaJobPrice" : str(jobprice) })
             self.doModify(dn, fields)
             
