# connect to database
my $dbh = $form->dbconnect($myconfig);
my $query =
- qq!SELECT c.accno, c.description, c.charttype, c.gifi_accno, c.category,! .
+ qq!SELECT c.accno, c.description, c.charttype, c.category,! .
qq! c.link, c.pos_bilanz, c.pos_eur, c.new_chart_id, c.valid_from, ! .
qq! c.pos_bwa, ! .
qq! tk.taxkey_id, tk.pos_ustva, tk.tax_id, ! .
my ($tax_id, $taxkey) = split(/--/, $form->{tax});
my $startdate = $form->{startdate} ? $form->{startdate} : "1970-01-01";
- if ($form->{id} && $form->{orphaned}) {
+ if ($form->{id}) {
$query = qq|UPDATE chart SET
accno = ?, description = ?, charttype = ?,
- gifi_accno = ?, category = ?, link = ?,
+ category = ?, link = ?,
taxkey_id = ?,
pos_ustva = ?, pos_bwa = ?, pos_bilanz = ?,
pos_eur = ?, new_chart_id = ?, valid_from = ?
WHERE id = ?|;
@values = ($form->{accno}, $form->{description}, $form->{charttype},
- $form->{gifi_accno}, $form->{category}, $form->{link},
+ $form->{category}, $form->{link},
conv_i($taxkey),
conv_i($form->{pos_ustva}), conv_i($form->{pos_bwa}),
conv_i($form->{pos_bilanz}), conv_i($form->{pos_eur}),
} else {
$query = qq|INSERT INTO chart
(accno, description, charttype,
- gifi_accno, category, link,
- taxkey_id,
+ category, link, taxkey_id,
pos_ustva, pos_bwa, pos_bilanz, pos_eur,
new_chart_id, valid_from)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)|;
@values = ($form->{accno}, $form->{description}, $form->{charttype},
- $form->{gifi_accno}, $form->{category}, $form->{link},
- conv_i($taxkey),
+ $form->{category}, $form->{link}, conv_i($taxkey),
conv_i($form->{pos_ustva}), conv_i($form->{pos_bwa}),
conv_i($form->{pos_bilanz}), conv_i($form->{pos_eur}),
conv_i($form->{new_chart_id}),
# connect to database
my $dbh = $form->dbconnect($myconfig);
- my $query = qq|SELECT id, description, discount, customernumberinit, salesman
+ my $query = qq|SELECT id, description, discount, customernumberinit
FROM business
ORDER BY 2|;
my $dbh = $form->dbconnect($myconfig);
my $query =
- qq|SELECT b.description, b.discount, b.customernumberinit, b.salesman
+ qq|SELECT b.description, b.discount, b.customernumberinit
FROM business b
WHERE b.id = ?|;
my $sth = $dbh->prepare($query);
my $dbh = $form->dbconnect($myconfig);
my @values = ($form->{description}, $form->{discount},
- $form->{customernumberinit}, $form->{salesman} ? 't' : 'f');
+ $form->{customernumberinit});
# id is the old record
if ($form->{id}) {
$query = qq|UPDATE business SET
description = ?,
discount = ?,
- customernumberinit = ?,
- salesman = ?
+ customernumberinit = ?
WHERE id = ?|;
push(@values, $form->{id});
} else {
$query = qq|INSERT INTO business
- (description, discount, customernumberinit, salesman)
- VALUES (?, ?, ?, ?)|;
+ (description, discount, customernumberinit)
+ VALUES (?, ?, ?)|;
}
do_query($form, $dbh, $query, @values);
qq|SELECT count(id) = 0 AS orphaned
FROM parts
WHERE buchungsgruppen_id = ?|;
- ($form->{orphaned}) = selectrow_arra($query, undef, $form->{id});
- $form->dberror($query . " ($form->{id})") if ($dbh->err);
+ ($form->{orphaned}) = selectrow_query($form, $dbh, $query, $form->{id});
}
$query = "SELECT inventory_accno_id, income_accno_id, expense_accno_id ".
"FROM defaults";
($form->{"std_inventory_accno_id"}, $form->{"std_income_accno_id"},
- $form->{"std_expense_accno_id"}) = $dbh->selectrow_array($query);
+ $form->{"std_expense_accno_id"}) = selectrow_query($form, $dbh, $query);
my $module = "IC";
$query = qq|SELECT c.accno, c.description, c.link, c.id,
push(@{$select}, { "name" => "", "base_unit" => "", "factor" => "", "selected" => "" });
}
- foreach my $unit (sort({ $a->{"sortkey"} <=> $b->{"sortkey"} } keys(%{$units}))) {
+ foreach my $unit (sort({ $units->{$a}->{"sortkey"} <=> $units->{$b}->{"sortkey"} } keys(%{$units}))) {
push(@{$select}, { "name" => $unit,
"base_unit" => $units->{$unit}->{"base_unit"},
"factor" => $units->{$unit}->{"factor"},
my $select = "<select name=${name}>";
- foreach my $unit (sort({ $a->{"sortkey"} <=> $b->{"sortkey"} } keys(%{$units}))) {
+ foreach my $unit (sort({ $units->{$a}->{"sortkey"} <=> $units->{$b}->{"sortkey"} } keys(%{$units}))) {
if (!$convertible_into ||
($units->{$convertible_into} &&
($units->{$convertible_into}->{"base_unit"} eq $units->{$unit}->{"base_unit"}))) {