Indention
authorJoey Schulze <joey@infodrom.org>
Sat, 17 Mar 2007 17:59:57 +0000 (17:59 +0000)
committerJoey Schulze <joey@infodrom.org>
Sat, 17 Mar 2007 17:59:57 +0000 (17:59 +0000)
src/InfoCon/account/update.wml

index 1b85f02..593db38 100644 (file)
     phpinfo();
     exit (0);
   } else {
+    $table = "account";
+    $field = "value_eur";
+    if ((strlen ($_POST[currency]) > 0) && ($_POST[currency] == "dm")) {
+      $table = "account_dm";
+      $field = "value_dm";
+    }
 
-  $table = "account";
-  $field = "value_eur";
-  if ((strlen ($_POST[currency]) > 0) && ($_POST[currency] == "dm")) {
-    $table = "account_dm";
-    $field = "value_dm";
-  }
-
-  if (strlen ($_POST[category]) == 0 && strlen ($_POST[newcategory]) > 0) {
-    $category = $_POST[newcategory];
-  } else {
-    $category = $_POST[category];
-  }
-  if (strlen ($_POST[from_to]) == 0 && strlen ($_POST[newfrom_to]) > 0) {
-    $from_to = $_POST[newfrom_to];
-  } else {
-    $from_to = $_POST[from_to];
-  }
-  $statement = sql_prepare ($_POST[statement]);
-  $category = sql_prepare ($category);
-  $descr = sql_prepare ($_POST[descr]);
-  $from_to = sql_prepare ($from_to);
-
-  $date = form_to_yyyymmdd ($_POST[datum]);
-
-  $value = ereg_replace (",",".", $_POST[value]);
-
-  if (isset($_GET[oid]) && $_GET[oid] > 0 && strlen ($_GET[delete])) {
-    $query = "DELETE FROM $table WHERE oid = $_GET[oid]";
-    $output = "Posten gelöscht.";
-  } elseif (isset($_POST[oid]) && $_POST[oid] > 0) {
-      $query = "UPDATE $table SET "
-       . "datum='$date',"
-       . "statement='$statement',"
-       . "from_to='$from_to',"
-       . "descr='$descr',"
-       . "$field=$value,"
-       . "category='$category'"
-       . " WHERE oid = $_POST[oid]";
-      $output = "Posten aktualisiert.";
-  } else {
-    $query = "INSERT INTO $table "
-      . "(blz_kto,statement,datum,from_to,descr,$field,category) VALUES ("
-      . "'$_POST[blzkto]','$statement','$date','$from_to','$descr',$value,'$category')";
+    if (strlen ($_POST[category]) == 0 && strlen ($_POST[newcategory]) > 0) {
+      $category = $_POST[newcategory];
+    } else {
+      $category = $_POST[category];
+    }
+    if (strlen ($_POST[from_to]) == 0 && strlen ($_POST[newfrom_to]) > 0) {
+      $from_to = $_POST[newfrom_to];
+    } else {
+      $from_to = $_POST[from_to];
+    }
+    $statement = sql_prepare ($_POST[statement]);
+    $category = sql_prepare ($category);
+    $descr = sql_prepare ($_POST[descr]);
+    $from_to = sql_prepare ($from_to);
+
+    $date = form_to_yyyymmdd ($_POST[datum]);
+
+    $value = ereg_replace (",",".", $_POST[value]);
+
+    if (isset($_GET[oid]) && $_GET[oid] > 0 && strlen ($_GET[delete])) {
+      $query = "DELETE FROM $table WHERE oid = $_GET[oid]";
+      $output = "Posten gelöscht.";
+    } elseif (isset($_POST[oid]) && $_POST[oid] > 0) {
+       $query = "UPDATE $table SET "
+         . "datum='$date',"
+         . "statement='$statement',"
+         . "from_to='$from_to',"
+         . "descr='$descr',"
+         . "$field=$value,"
+         . "category='$category'"
+         . " WHERE oid = $_POST[oid]";
+       $output = "Posten aktualisiert.";
+    } else {
+      $query = "INSERT INTO $table "
+       . "(blz_kto,statement,datum,from_to,descr,$field,category) VALUES ("
+       . "'$_POST[blzkto]','$statement','$date','$from_to','$descr',$value,'$category')";
 
-    $output = "Neuen Posten aufgenommen.";
-  }
-  $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+      $output = "Neuen Posten aufgenommen.";
+    }
+    $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
   }
 
   echo ("<p>".$output."</p>");