- my ($self, $myconfig, $form) = @_;
-
-
- my $chart_obj = SL::DB::Manager::Chart->find_by(id => $form->{id}) || die "Can't open chart";
-
- # connect to database
- my $dbh = $form->dbconnect($myconfig);
- my $query = qq{
- SELECT c.accno, c.description, c.charttype, c.category,
- c.link, c.pos_bilanz, c.pos_eur, c.pos_er, c.new_chart_id, c.valid_from,
- c.pos_bwa, datevautomatik,
- tk.taxkey_id, tk.pos_ustva, tk.tax_id,
- tk.tax_id || '--' || tk.taxkey_id AS tax, tk.startdate
- FROM chart c
- LEFT JOIN taxkeys tk
- ON (c.id=tk.chart_id AND tk.id =
- (SELECT id FROM taxkeys
- WHERE taxkeys.chart_id = c.id AND startdate <= current_date
- ORDER BY startdate DESC LIMIT 1))
- WHERE c.id = ?
- };
-
-
- $main::lxdebug->message(LXDebug->QUERY(), "\$query=\n $query");
- my $sth = $dbh->prepare($query);
- $sth->execute($form->{id}) || $form->dberror($query . " ($form->{id})");
-
- my $ref = $sth->fetchrow_hashref("NAME_lc");
+ # fetch chart-related data and set form fields
+ # get_account is called by add_account in am.pl
+ # always sets $form->{TAXKEY} and default_accounts
+ # loads chart data when $form->{id} is passed