Rozdeleni uctu do radek
[mirrors/SokoMan.git] / assistants / bank.inc.php
index 0c0e27d3ba7caaf91199dbdcc88421d9d28d4753..067e98943b2859fc9adb18b90057859585d5a2f2 100644 (file)
@@ -72,19 +72,22 @@ function bank_get_overview($ctx,$prefix='') {
        return $overview;
 }
 
-if(isset($bank_json_only) && $bank_json_only) die(json_encode(array(
-       'overview'=>bank_get_overview($this)['array']
-)));
+if(isset($bank_json_only) && $bank_json_only) {
+       $overview=bank_get_overview($this);
+       die(json_encode(array(
+               'overview'=>$overview['array']
+       )));
+}
 
 if(isset($_POST['create_account'])) {
        bank_add_account($this, $_POST['account_name']);
-       $this->post_redirect_get("$URL_INTERNAL","Účet byl vytvořen");
+       $this->post_redirect_get("$URL_INTERNAL/admin","Účet byl vytvořen");
 }
 if(isset($_POST['rename_account'])) {
        if(bank_rename_account($this, $_POST['account_old'], $_POST['account_new'])) {
-               $this->post_redirect_get("$URL_INTERNAL","Účet byl upraven");
+               $this->post_redirect_get("$URL_INTERNAL/admin","Účet byl upraven");
        } else {
-               $this->post_redirect_get("$URL_INTERNAL","Takový účet již existuje!", false);
+               $this->post_redirect_get("$URL_INTERNAL/admin","Takový účet již existuje!", false);
        }
 }
 if(isset($_POST['transaction'])) {
@@ -97,10 +100,15 @@ if(isset($_POST['transaction'])) {
 
 //bank_add_account($this, 'material');
 echo("<a href='$URL/'>Banka</a> - ");
-echo("<a href='$URL/admin'>Správa účtů</a> - ");
-echo("Účty: ");
+echo("<a href='$URL/admin'>Správa účtů - </a>");
+echo("Účty: <br />");
 $accounts = bank_get_accounts($this, $SUBPATH[0]=='admin');
-foreach($accounts as $account) echo("<a href='$URL?account=$account'>$account</a>, ");
+$lastaccount=false;
+foreach($accounts as $account) {
+       if($lastaccount && $lastaccount[0]!=$account[0] && !preg_match('/[a-zA-Z0-9]/', $lastaccount[0])) echo('<br />');
+       echo("<a href='$URL?account=$account'>$account</a>, ");
+       $lastaccount=$account;
+}
 
 switch($SUBPATH[0]) {
        default:
@@ -113,7 +121,8 @@ switch($SUBPATH[0]) {
            $result = $this->db->safe_query_fetch("SELECT SUM(${bank_table}_amount) as troughput FROM ${bank_table};");
                        echo("Obrat: ".$result[0]['troughput'].' '.$bank_currency);
            $result = $this->db->safe_query_fetch("SELECT * FROM `${bank_table}` ORDER BY ${bank_table}_time DESC;");
-                       echo $this->html->render_item_table(bank_get_overview($this, $bank_table.'_')['table'],'bank');
+                       $overview=bank_get_overview($this,$bank_table.'_');
+                       echo $this->html->render_item_table($overview['table'],'bank');
                        echo ("<h2>Přehled transakcí</h2>");
                } else {
                        $account=bank_name($_GET['account']);
This page took 0.132692 seconds and 4 git commands to generate.