Allow editing of booking texts
authorJoey Schulze <joey@infodrom.org>
Mon, 4 Jun 2018 18:18:41 +0000 (20:18 +0200)
committerJoey Schulze <joey@infodrom.org>
Sat, 6 Oct 2018 17:30:26 +0000 (19:30 +0200)
class/sales.class.php
src/InfoCon/buch/list.wml

index b5a535d..8dde7d8 100644 (file)
@@ -63,5 +63,10 @@ class Sales extends DatabaseTable {
     return $this->modify('paid', 0);
   }
 
     return $this->modify('paid', 0);
   }
 
+  public function ajaxEditDescription(Array $data)
+  {
+      return $this->modify('description', utf8_decode($data['content']));
+  }
+
 }
 
 }
 
index 422c179..100dc5d 100644 (file)
@@ -1,6 +1,8 @@
 #include <infocon.style>
 
 #include <infocon.style>
 
+<future>
 <page func=InfoCon title="Buchhaltung">
 <page func=InfoCon title="Buchhaltung">
+<script type="text/javascript" src="<root_prefix>jquery.editable.js"></script>
 
 <?
   $dbh = pg_pconnect ("<dbhost>", "<dbport>", "<dbname>")
 
 <?
   $dbh = pg_pconnect ("<dbhost>", "<dbport>", "<dbname>")
@@ -36,7 +38,7 @@ if ($_POST["submit"] == "List") {
     $where[] = "price < 0.0";
   }
 
     $where[] = "price < 0.0";
   }
 
-  $query = "SELECT date,billing_date,oid,category,description,price FROM $table ";
+  $query = "SELECT nr,date,billing_date,category,description,price FROM $table ";
   if (count($where) > 0) {
     $query .= " WHERE " . implode ($where, " AND ");
   }
   if (count($where) > 0) {
     $query .= " WHERE " . implode ($where, " AND ");
   }
@@ -61,8 +63,8 @@ if ($_POST["submit"] == "List") {
     printf ("<td width=\"10%%\" align=\"right\">%s</td>", $date);
     printf ("<td width=\"10%%\" align=\"right\">%s</td>", $billing_date);
     printf ("<td width=\"10%%\" align=\"center\">%s</td>", $row['category']);
     printf ("<td width=\"10%%\" align=\"right\">%s</td>", $date);
     printf ("<td width=\"10%%\" align=\"right\">%s</td>", $billing_date);
     printf ("<td width=\"10%%\" align=\"center\">%s</td>", $row['category']);
-    printf ("<td width=\"0%%\"><a href=\"edit.php?oid=%d\">%s</a></td>",
-      $row['oid'], $row['description']);
+    printf ("<td width=\"0%%\"><span class=\"edit\" route=\"Sales/EditDescription\" item_id=\"%d\">%s</span></td>",
+      $row['nr'], $row['description']);
     printf ("<td width=\"10%%\" align=\"right\">%5.2f</td>", $row['price']);
     $sum += $row['price'];
     echo ("</tr>");
     printf ("<td width=\"10%%\" align=\"right\">%5.2f</td>", $row['price']);
     $sum += $row['price'];
     echo ("</tr>");
@@ -239,6 +241,13 @@ function tally ($dbh, $head, $where, $class)
 ?>
 <div style="padding-top: 5px;"></div>
 
 ?>
 <div style="padding-top: 5px;"></div>
 
+<script type="text/javascript">
+<protect>
+$(function(){
+    make_editable('table.smallfont tr span.edit');
+});
+</protect>
+</script>
 </page>
 
 # Local variables:
 </page>
 
 # Local variables: