$from=$ctx->db->quote(bank_name($from));
$to=$ctx->db->quote(bank_name($to));
$amount=$ctx->db->quote($amount);
-
- $comment=trim($comment);
- if(strlen($comment)<4) die("Komentář musí mít alespoň 4 znaky!");
- $comment=$ctx->db->quote($comment);
+ $comment=$ctx->db->quote(trim($comment));
$sql="INSERT INTO `bank` (`bank_time`, `bank_from`, `bank_to`, `bank_amount`, `bank_author`, `bank_comment`) VALUES (now(), $from, $to, $amount, $author, $comment);";
$ctx->db->safe_query($sql);
$this->post_redirect_get("$URL_INTERNAL","Účet byl vytvořen");
}
if(isset($_POST['transaction'])) {
- if(!is_numeric($_POST['amount']) || $_POST['amount'] < 0) $this->post_redirect_get("$URL_INTERNAL","Lze převádět jen kladné částky", true);
+ if(!is_numeric($_POST['amount']) || $_POST['amount'] < 0) $this->post_redirect_get("$URL_INTERNAL?account=".$_POST['account_from'],"Lze převádět jen kladné částky", true);
+ $comment=trim($_POST['comment']);
+ if(strlen($comment)<4) $this->post_redirect_get("$URL_INTERNAL?account=".$_POST['account_from'],"Komentář musí mít alespoň 4 znaky!",true);
bank_transaction($this, $_POST['account_from'], $_POST['account_to'], $_POST['comment'], $_POST['amount']);
- $this->post_redirect_get("$URL_INTERNAL","Transakce byla provedena"); //TODO redirect na account_from
+ $this->post_redirect_get("$URL_INTERNAL?account=".$_POST['account_from'],"Transakce byla provedena");
}
//bank_add_account($this, 'material');
$result = $this->db->safe_query_fetch("SELECT SUM(bank_amount) as troughput FROM bank;");
echo("Obrat: ".$result[0]['troughput'].' '.$bank_currency);
$result = $this->db->safe_query_fetch("SELECT * FROM `bank` ORDER BY bank_time DESC;");
- echo $this->html->render_item_table(bank_get_overview($this));
+ echo $this->html->render_item_table(bank_get_overview($this),'bank');
echo ("<h2>Přehled transakcí</h2>");
} else {
$account=bank_name($_GET['account']);
echo(bank_get_total($this,$account,true)." $bank_currency");
$result = $this->db->safe_query_fetch("SELECT * FROM `bank` WHERE `bank_to`=$account_sql OR `bank_from`=$account_sql ORDER BY bank_time DESC;");
}
- $this->html->table_hide_columns($result, 'bank');
- echo $this->html->render_item_table($result);
+ echo $this->html->render_item_table($result,'bank');
break;
case 'admin':