diff --git a/www/pages/content/fibu_buchungen_list.tpl b/www/pages/content/fibu_buchungen_list.tpl index 33610955..6effeaa1 100644 --- a/www/pages/content/fibu_buchungen_list.tpl +++ b/www/pages/content/fibu_buchungen_list.tpl @@ -33,7 +33,7 @@ [TAB1NEXT]
-
+ [MESSAGE]
diff --git a/www/pages/content/fibu_buchungen_zuordnen.tpl b/www/pages/content/fibu_buchungen_zuordnen.tpl index 0090e5c7..66b6778f 100644 --- a/www/pages/content/fibu_buchungen_zuordnen.tpl +++ b/www/pages/content/fibu_buchungen_zuordnen.tpl @@ -4,32 +4,34 @@
[MESSAGE] - - [FORMHANDLEREVENT] -
-
-
-
-
- {|Offene Einzelsalden|} + [FORMHANDLEREVENT] +
+
+
+
+
+ {|Offene Einzelsalden|} + [TAB1] -
-
-
-
-
-
- - {|Aktionen|} - - -
-
-
-
-
-
- + +
+
+
+
+
+
+ + {|Aktionen|} + + + + +
+
+
+
+
+
diff --git a/www/pages/fibu_buchungen.php b/www/pages/fibu_buchungen.php index 2b7affbd..2b586a02 100644 --- a/www/pages/fibu_buchungen.php +++ b/www/pages/fibu_buchungen.php @@ -214,6 +214,9 @@ class Fibu_buchungen { $submit = $this->app->Secure->GetPOST('submit'); if ($submit == 'neuberechnen') { $this->fibu_rebuild_tables(); + + $msg = "
Buchungen wurden neu berechnet.
"; + } // For transfer to tablesearch @@ -226,6 +229,10 @@ class Fibu_buchungen { $this->app->YUI->TableSearch('TAB1', 'fibu_buchungen_salden', "show", "", "", basename(__FILE__), __CLASS__); $this->app->YUI->TableSearch('TAB2', 'fibu_buchungen_list', "show", "", "", basename(__FILE__), __CLASS__); + if (!empty($msg)) { + $this->app->Tpl->Set('MESSAGE', $msg); + } + $this->app->Tpl->Parse('PAGE', "fibu_buchungen_list.tpl"); } @@ -233,7 +240,7 @@ class Fibu_buchungen { $id = (int) $this->app->Secure->GetGET('id'); // $this->app->DB->Delete("DELETE FROM `fibu_buchungen` WHERE `id` = '{$id}'"); - $this->app->Tpl->Set('MESSAGE', "
Der Eintrag wurde gelöscht.
"); +// $this->app->Tpl->Set('MESSAGE', "
Der Eintrag wurde gelöscht.
"); $this->fibu_buchungen_list(); } diff --git a/www/pages/kontoauszuege.php b/www/pages/kontoauszuege.php index 5897715d..420310c8 100644 --- a/www/pages/kontoauszuege.php +++ b/www/pages/kontoauszuege.php @@ -265,6 +265,20 @@ class Kontoauszuege { $this->app->Tpl->Parse('PAGE', "kontoauszuege_konto_list.tpl"); } + function kontoauszuege_mark_as_error(int $id) : ?string { + $sql = "SELECT id FROM fibu_buchungen_alle WHERE CONCAT(doc_typ,doc_id) <> CONCAT('kontoauszuege','".$id."') AND typ = 'kontoauszuege' AND id = ".$id; + $result = $this->app->DB->SelectArr($sql); + + if (!empty($result)) { + return("Es existieren Buchungen, Eintrag wurde nicht als Importfehler markiert!"); + } else { + $this->app->DB->Delete("UPDATE `kontoauszuege` SET importfehler = 1 WHERE `id` = '{$id}'"); + return("Der Eintrag wurde als Importfehler markiert."); + } + + return(null); + + } function kontoauszuege_list() { @@ -275,15 +289,28 @@ class Kontoauszuege { foreach($auswahl as $selectedId) { $selectedId = (int)$selectedId; if($selectedId > 0) { - $selectedIds[] = $selectedId; + $selectedIds[] = $selectedId; } } $submit = $this->app->Secure->GetPOST('ausfuehren'); if ($submit == 'Importfehler') { - $sql = "UPDATE kontoauszuege SET importfehler = 1 WHERE id IN (".implode(",",$selectedIds).")"; - $this->app->DB->Update($sql); + + $message = ""; + + foreach ($selectedIds as $selectedId) { + $result = $this->kontoauszuege_mark_as_error($selectedId); + if ($result) { + $message = $result; + } + } + + if ($message) { + $this->app->Tpl->Set('MESSAGE', "
".$message."
"); + } else { + $this->app->Tpl->Set('MESSAGE', "
Einträge wurden als Importfehler markiert.
"); + } } } @@ -309,15 +336,14 @@ class Kontoauszuege { public function kontoauszuege_delete() { $id = (int) $this->app->Secure->GetGET('id'); - $sql = "SELECT id FROM fibu_buchungen_alle WHERE CONCAT(doc_typ,doc_id) <> CONCAT('kontoauszuege','".$id."') AND typ = 'kontoauszuege' AND id = ".$id; - $result = $this->app->DB->SelectArr($sql); - - if (!empty($result)) { - $this->app->Tpl->Set('MESSAGE', "
Es existieren Buchungen, Eintrag wurde nicht als Importfehler markiert!
"); + $result = $this->kontoauszuege_mark_as_error($id); + + if ($result) { + $this->app->Tpl->Set('MESSAGE', "
".$result."
"); } else { - $this->app->DB->Delete("UPDATE `kontoauszuege` SET importfehler = 1 WHERE `id` = '{$id}'"); $this->app->Tpl->Set('MESSAGE', "
Der Eintrag wurde als Importfehler markiert.
"); } + $this->kontoauszuege_list(); }