X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FAM.pm;h=11b32ca4bd5fb4ae7ebfbf5498b24f7015ee54d8;hb=8f64093b4d58bd4bd72cd7465b7e402ad949eaf1;hp=fa7826095a094730186a5312ceed31404e236c09;hpb=aaf1cc99f5da2a694b5cbbf2eeb13e8e29dbc334;p=kivitendo-erp.git diff --git a/SL/AM.pm b/SL/AM.pm index fa7826095..11b32ca4b 100644 --- a/SL/AM.pm +++ b/SL/AM.pm @@ -41,6 +41,8 @@ use Carp; use Data::Dumper; use SL::DBUtils; +use strict; + sub get_account { $main::lxdebug->enter_sub(); @@ -64,11 +66,11 @@ sub get_account { }; - $main::lxdebug->message(LXDebug::QUERY, "\$query=\n $query"); + $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); + my $ref = $sth->fetchrow_hashref("NAME_lc"); foreach my $key (keys %$ref) { $form->{"$key"} = $ref->{"$key"}; @@ -79,13 +81,13 @@ sub get_account { # get default accounts $query = qq|SELECT inventory_accno_id, income_accno_id, expense_accno_id FROM defaults|; - $main::lxdebug->message(LXDebug::QUERY, "\$query=\n $query"); + $main::lxdebug->message(LXDebug->QUERY(), "\$query=\n $query"); $sth = $dbh->prepare($query); $sth->execute || $form->dberror($query); - $ref = $sth->fetchrow_hashref(NAME_lc); + $ref = $sth->fetchrow_hashref("NAME_lc"); - map { $form->{$_} = $ref->{$_} } keys %ref; + map { $form->{$_} = $ref->{$_} } keys %{ $ref }; $sth->finish; @@ -102,13 +104,13 @@ sub get_account { rate FROM tax ORDER BY taxkey }; - $main::lxdebug->message(LXDebug::QUERY, "\$query=\n $query"); + $main::lxdebug->message(LXDebug->QUERY(), "\$query=\n $query"); $sth = $dbh->prepare($query); $sth->execute || $form->dberror($query); $form->{TAXKEY} = []; - while (my $ref = $sth->fetchrow_hashref(NAME_lc)) { + while (my $ref = $sth->fetchrow_hashref("NAME_lc")) { push @{ $form->{TAXKEY} }, $ref; } @@ -119,12 +121,12 @@ sub get_account { FROM chart WHERE link = ? ORDER BY accno|; - $main::lxdebug->message(LXDebug::QUERY, "\$query=\n $query"); + $main::lxdebug->message(LXDebug->QUERY(), "\$query=\n $query"); $sth = $dbh->prepare($query); $sth->execute($form->{link}) || $form->dberror($query . " ($form->{link})"); $form->{NEWACCOUNT} = []; - while (my $ref = $sth->fetchrow_hashref(NAME_lc)) { + while (my $ref = $sth->fetchrow_hashref("NAME_lc")) { push @{ $form->{NEWACCOUNT} }, $ref; } @@ -150,14 +152,14 @@ sub get_account { WHERE tk.chart_id = ? ORDER BY startdate DESC }; - $main::lxdebug->message(LXDebug::QUERY, "\$query=\n $query"); + $main::lxdebug->message(LXDebug->QUERY(), "\$query=\n $query"); $sth = $dbh->prepare($query); $sth->execute($form->{id}) || $form->dberror($query . " ($form->{id})"); $form->{ACCOUNT_TAXKEYS} = []; - while (my $ref = $sth->fetchrow_hashref(NAME_lc)) { + while (my $ref = $sth->fetchrow_hashref("NAME_lc")) { push @{ $form->{ACCOUNT_TAXKEYS} }, $ref; } @@ -167,7 +169,7 @@ sub get_account { # check if we have any transactions $query = qq|SELECT a.trans_id FROM acc_trans a WHERE a.chart_id = ?|; - $main::lxdebug->message(LXDebug::QUERY, "\$query=\n $query"); + $main::lxdebug->message(LXDebug->QUERY(), "\$query=\n $query"); $sth = $dbh->prepare($query); $sth->execute($form->{id}) || $form->dberror($query . " ($form->{id})"); @@ -180,7 +182,7 @@ sub get_account { if ($form->{new_chart_id}) { $query = qq|SELECT current_date-valid_from FROM chart WHERE id = ?|; - $main::lxdebug->message(LXDebug::QUERY, "\$query=\n $query"); + $main::lxdebug->message(LXDebug->QUERY(), "\$query=\n $query"); my ($count) = selectrow_query($form, $dbh, $query, $form->{id}); if ($count >=0) { $form->{new_chart_valid} = 1; @@ -230,6 +232,13 @@ sub save_account { $form->{id} = ""; } + if (!$form->{id} || $form->{id} eq "") { + $query = qq|SELECT nextval('id')|; + ($form->{"id"}) = selectrow_query($form, $dbh, $query); + $query = qq|INSERT INTO chart (id, accno) VALUES (?, ?)|; + do_query($form, $dbh, $query, $form->{"id"}, $form->{"accno"}); + } + my @values; if ($form->{id}) { @@ -262,52 +271,6 @@ sub save_account { $form->{id}, ); - } - elsif ($form->{id} && !$form->{new_chart_valid}) { - - $query = qq| - UPDATE chart - SET new_chart_id = ?, - valid_from = ? - WHERE id = ? - |; - - @values = ( - conv_i($form->{new_chart_id}), - conv_date($form->{valid_from}), - $form->{id} - ); - } - else { - - $query = qq| - INSERT INTO chart ( - accno, - description, - charttype, - category, - link, - pos_bwa, - pos_bilanz, - pos_eur, - new_chart_id, - valid_from, - datevautomatik ) - VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) - |; - - @values = ( - $form->{accno}, - $form->{description}, - $form->{charttype}, - $form->{category}, $form->{link}, - conv_i($form->{pos_bwa}), - conv_i($form->{pos_bilanz}), conv_i($form->{pos_eur}), - conv_i($form->{new_chart_id}), - conv_date($form->{valid_from}), - ($form->{datevautomatik} eq 'T') ? 'true':'false', - ); - } do_query($form, $dbh, $query, @values); @@ -325,6 +288,9 @@ sub save_account { # Loop control # Check if the account already exists, else cancel + + print(STDERR "Keine Taxkeys weil ID =: $form->{id}\n"); + last READTAXKEYS if ( $form->{'id'} == 0); # check if there is a startdate @@ -484,11 +450,11 @@ sub departments { FROM department d ORDER BY 2|; - $sth = $dbh->prepare($query); + my $sth = $dbh->prepare($query); $sth->execute || $form->dberror($query); $form->{ALL} = []; - while (my $ref = $sth->fetchrow_hashref(NAME_lc)) { + while (my $ref = $sth->fetchrow_hashref("NAME_lc")) { push @{ $form->{ALL} }, $ref; } @@ -512,7 +478,7 @@ sub get_department { my $sth = $dbh->prepare($query); $sth->execute($form->{id}) || $form->dberror($query . " ($form->{id})"); - my $ref = $sth->fetchrow_hashref(NAME_lc); + my $ref = $sth->fetchrow_hashref("NAME_lc"); map { $form->{$_} = $ref->{$_} } keys %$ref; @@ -535,6 +501,7 @@ sub save_department { $main::lxdebug->enter_sub(); my ($self, $myconfig, $form) = @_; + my ($query); # connect to database my $dbh = $form->dbconnect($myconfig); @@ -561,6 +528,7 @@ sub delete_department { $main::lxdebug->enter_sub(); my ($self, $myconfig, $form) = @_; + my ($query); # connect to database my $dbh = $form->dbconnect($myconfig); @@ -586,10 +554,10 @@ sub lead { FROM leads ORDER BY 2|; - $sth = $dbh->prepare($query); + my $sth = $dbh->prepare($query); $sth->execute || $form->dberror($query); - while (my $ref = $sth->fetchrow_hashref(NAME_lc)) { + while (my $ref = $sth->fetchrow_hashref("NAME_lc")) { push @{ $form->{ALL} }, $ref; } @@ -614,7 +582,7 @@ sub get_lead { my $sth = $dbh->prepare($query); $sth->execute($form->{id}) || $form->dberror($query . " ($form->{id})"); - my $ref = $sth->fetchrow_hashref(NAME_lc); + my $ref = $sth->fetchrow_hashref("NAME_lc"); map { $form->{$_} = $ref->{$_} } keys %$ref; @@ -629,6 +597,7 @@ sub save_lead { $main::lxdebug->enter_sub(); my ($self, $myconfig, $form) = @_; + my ($query); # connect to database my $dbh = $form->dbconnect($myconfig); @@ -656,6 +625,7 @@ sub delete_lead { $main::lxdebug->enter_sub(); my ($self, $myconfig, $form) = @_; + my ($query); # connect to database my $dbh = $form->dbconnect($myconfig); @@ -681,10 +651,10 @@ sub business { FROM business ORDER BY 2|; - $sth = $dbh->prepare($query); + my $sth = $dbh->prepare($query); $sth->execute || $form->dberror($query); - while (my $ref = $sth->fetchrow_hashref(NAME_lc)) { + while (my $ref = $sth->fetchrow_hashref("NAME_lc")) { push @{ $form->{ALL} }, $ref; } @@ -709,7 +679,7 @@ sub get_business { my $sth = $dbh->prepare($query); $sth->execute($form->{id}) || $form->dberror($query . " ($form->{id})"); - my $ref = $sth->fetchrow_hashref(NAME_lc); + my $ref = $sth->fetchrow_hashref("NAME_lc"); map { $form->{$_} = $ref->{$_} } keys %$ref; @@ -724,6 +694,7 @@ sub save_business { $main::lxdebug->enter_sub(); my ($self, $myconfig, $form) = @_; + my ($query); # connect to database my $dbh = $form->dbconnect($myconfig); @@ -758,7 +729,7 @@ sub delete_business { # connect to database my $dbh = $form->dbconnect($myconfig); - $query = qq|DELETE FROM business + my $query = qq|DELETE FROM business WHERE id = ?|; do_query($form, $dbh, $query, $form->{id}); @@ -781,12 +752,12 @@ sub language { " output_numberformat, output_dateformat, output_longdates " . "FROM language ORDER BY description"; - $sth = $dbh->prepare($query); + my $sth = $dbh->prepare($query); $sth->execute || $form->dberror($query); my $ary = []; - while (my $ref = $sth->fetchrow_hashref(NAME_lc)) { + while (my $ref = $sth->fetchrow_hashref("NAME_lc")) { push(@{ $ary }, $ref); } @@ -817,7 +788,7 @@ sub get_language { my $sth = $dbh->prepare($query); $sth->execute($form->{"id"}) || $form->dberror($query . " ($form->{id})"); - my $ref = $sth->fetchrow_hashref(NAME_lc); + my $ref = $sth->fetchrow_hashref("NAME_lc"); map { $form->{$_} = $ref->{$_} } keys %$ref; @@ -888,12 +859,13 @@ sub delete_language { $main::lxdebug->enter_sub(); my ($self, $myconfig, $form) = @_; + my $query; # connect to database my $dbh = $form->dbconnect_noauto($myconfig); foreach my $table (qw(translation_payment_terms units_language)) { - my $query = qq|DELETE FROM $table WHERE language_id = ?|; + $query = qq|DELETE FROM $table WHERE language_id = ?|; do_query($form, $dbh, $query, $form->{"id"}); } @@ -937,11 +909,11 @@ sub buchungsgruppe { FROM buchungsgruppen ORDER BY sortkey|; - $sth = $dbh->prepare($query); + my $sth = $dbh->prepare($query); $sth->execute || $form->dberror($query); $form->{ALL} = []; - while (my $ref = $sth->fetchrow_hashref(NAME_lc)) { + while (my $ref = $sth->fetchrow_hashref("NAME_lc")) { push @{ $form->{ALL} }, $ref; } @@ -985,7 +957,7 @@ sub get_buchungsgruppe { my $sth = $dbh->prepare($query); $sth->execute($form->{id}) || $form->dberror($query . " ($form->{id})"); - my $ref = $sth->fetchrow_hashref(NAME_lc); + my $ref = $sth->fetchrow_hashref("NAME_lc"); map { $form->{$_} = $ref->{$_} } keys %$ref; @@ -1013,7 +985,7 @@ sub get_buchungsgruppe { my $sth = $dbh->prepare($query); $sth->execute || $form->dberror($query); - while (my $ref = $sth->fetchrow_hashref(NAME_lc)) { + while (my $ref = $sth->fetchrow_hashref("NAME_lc")) { foreach my $key (split(/:/, $ref->{link})) { if (!$form->{"std_inventory_accno_id"} && ($key eq "IC")) { $form->{"std_inventory_accno_id"} = $ref->{"id"}; @@ -1100,7 +1072,7 @@ sub delete_buchungsgruppe { # connect to database my $dbh = $form->dbconnect($myconfig); - $query = qq|DELETE FROM buchungsgruppen WHERE id = ?|; + my $query = qq|DELETE FROM buchungsgruppen WHERE id = ?|; do_query($form, $dbh, $query, $form->{id}); $dbh->disconnect; @@ -1148,11 +1120,11 @@ sub printer { FROM printers ORDER BY 2|; - $sth = $dbh->prepare($query); + my $sth = $dbh->prepare($query); $sth->execute || $form->dberror($query); $form->{"ALL"} = []; - while (my $ref = $sth->fetchrow_hashref(NAME_lc)) { + while (my $ref = $sth->fetchrow_hashref("NAME_lc")) { push @{ $form->{ALL} }, $ref; } @@ -1177,7 +1149,7 @@ sub get_printer { my $sth = $dbh->prepare($query); $sth->execute($form->{id}) || $form->dberror($query . " ($form->{id})"); - my $ref = $sth->fetchrow_hashref(NAME_lc); + my $ref = $sth->fetchrow_hashref("NAME_lc"); map { $form->{$_} = $ref->{$_} } keys %$ref; @@ -1192,6 +1164,7 @@ sub save_printer { $main::lxdebug->enter_sub(); my ($self, $myconfig, $form) = @_; + my $query; # connect to database my $dbh = $form->dbconnect($myconfig); @@ -1226,7 +1199,7 @@ sub delete_printer { # connect to database my $dbh = $form->dbconnect($myconfig); - $query = qq|DELETE FROM printers + my $query = qq|DELETE FROM printers WHERE id = ?|; do_query($form, $dbh, $query, $form->{id}); @@ -1245,11 +1218,11 @@ sub payment { my $query = qq|SELECT * FROM payment_terms ORDER BY sortkey|; - $sth = $dbh->prepare($query); + my $sth = $dbh->prepare($query); $sth->execute || $form->dberror($query); $form->{ALL} = []; - while (my $ref = $sth->fetchrow_hashref(NAME_lc)) { + while (my $ref = $sth->fetchrow_hashref("NAME_lc")) { push @{ $form->{ALL} }, $ref; } @@ -1271,7 +1244,7 @@ sub get_payment { my $sth = $dbh->prepare($query); $sth->execute($form->{"id"}) || $form->dberror($query . " ($form->{id})"); - my $ref = $sth->fetchrow_hashref(NAME_lc); + my $ref = $sth->fetchrow_hashref("NAME_lc"); map { $form->{$_} = $ref->{$_} } keys %$ref; $sth->finish(); @@ -1288,7 +1261,7 @@ sub get_payment { $sth->execute($form->{"id"}) || $form->dberror($query . " ($form->{id})"); my %mapping; - while (my $ref = $sth->fetchrow_hashref(NAME_lc)) { + while (my $ref = $sth->fetchrow_hashref("NAME_lc")) { $mapping{ $ref->{"language_id"} } = $ref unless (defined($mapping{ $ref->{"language_id"} })); } @@ -1510,7 +1483,8 @@ sub save_defaults { pdonumber = ?, yearend = ?, curr = ?, - businessnumber = ?|; + businessnumber = ?, + weightunit = ?|; my @values = ($accnos{inventory_accno}, $accnos{income_accno}, $accnos{expense_accno}, $accnos{fxgain_accno}, $accnos{fxloss_accno}, $form->{invnumber}, $form->{cnnumber}, @@ -1520,7 +1494,7 @@ sub save_defaults { $form->{articlenumber}, $form->{servicenumber}, $form->{sdonumber}, $form->{pdonumber}, $form->{yearend}, $currency, - $form->{businessnumber}); + $form->{businessnumber}, $form->{weightunit}); do_query($form, $dbh, $query, @values); $dbh->commit(); @@ -1550,13 +1524,13 @@ sub save_preferences { $form->{businessnumber} = $businessnumber; - my $myconfig = new User($form->{login}); + $myconfig = new User($form->{login}); foreach my $item (keys %$form) { $myconfig->{$item} = $form->{$item}; } - $myconfig->save_member($memberfile); + $myconfig->save_member($main::memberfile); my $auth = $main::auth; @@ -1571,14 +1545,15 @@ sub save_preferences { } if ($webdav) { - @webdavdirs = + my @webdavdirs = qw(angebote bestellungen rechnungen anfragen lieferantenbestellungen einkaufsrechnungen); - foreach $directory (@webdavdirs) { - $file = "webdav/" . $directory . "/webdav-user"; + foreach my $directory (@webdavdirs) { + my $file = "webdav/" . $directory . "/webdav-user"; + my $newfile; if ($myconfig->{$directory}) { open(HTACCESS, "$file") or die "cannot open webdav-user $!\n"; while () { - ($login, $password) = split(/:/, $_); + my ($login, $password) = split(/:/, $_); if ($login ne $form->{login}) { $newfile .= $_; } @@ -1592,7 +1567,7 @@ sub save_preferences { $form->{$directory} = 0; open(HTACCESS, "$file") or die "cannot open webdav-user $!\n"; while () { - ($login, $password) = split(/:/, $_); + my ($login, $password) = split(/:/, $_); if ($login ne $form->{login}) { $newfile .= $_; } @@ -1610,6 +1585,26 @@ sub save_preferences { return $rc; } +sub get_defaults { + $main::lxdebug->enter_sub(); + + my $self = shift; + my %params = @_; + + my $myconfig = \%main::myconfig; + my $form = $main::form; + + my $dbh = $params{dbh} || $form->get_standard_dbh($myconfig); + + my $defaults = selectfirst_hashref_query($form, $dbh, qq|SELECT * FROM defaults|) || {}; + + $defaults->{weightunit} ||= 'kg'; + + $main::lxdebug->leave_sub(); + + return $defaults; +} + sub defaultaccounts { $main::lxdebug->enter_sub(); @@ -1623,12 +1618,14 @@ sub defaultaccounts { my $sth = $dbh->prepare($query); $sth->execute || $form->dberror($query); - $form->{defaults} = $sth->fetchrow_hashref(NAME_lc); - $form->{defaults}{IC} = $form->{defaults}{inventory_accno_id}; - $form->{defaults}{IC_income} = $form->{defaults}{income_accno_id}; - $form->{defaults}{IC_expense} = $form->{defaults}{expense_accno_id}; - $form->{defaults}{FX_gain} = $form->{defaults}{fxgain_accno_id}; - $form->{defaults}{FX_loss} = $form->{defaults}{fxloss_accno_id}; + $form->{defaults} = $sth->fetchrow_hashref("NAME_lc"); + $form->{defaults}{IC} = $form->{defaults}{inventory_accno_id}; + $form->{defaults}{IC_income} = $form->{defaults}{income_accno_id}; + $form->{defaults}{IC_expense} = $form->{defaults}{expense_accno_id}; + $form->{defaults}{FX_gain} = $form->{defaults}{fxgain_accno_id}; + $form->{defaults}{FX_loss} = $form->{defaults}{fxloss_accno_id}; + + $form->{defaults}{weightunit} ||= 'kg'; $sth->finish; @@ -1639,10 +1636,10 @@ sub defaultaccounts { $sth = $dbh->prepare($query); $sth->execute || $self->dberror($query); - while (my $ref = $sth->fetchrow_hashref(NAME_lc)) { + while (my $ref = $sth->fetchrow_hashref("NAME_lc")) { foreach my $key (split(/:/, $ref->{link})) { if ($key =~ /IC/) { - $nkey = $key; + my $nkey = $key; if ($key =~ /cogs/) { $nkey = "IC_expense"; } @@ -1666,7 +1663,7 @@ sub defaultaccounts { $sth = $dbh->prepare($query); $sth->execute || $self->dberror($query); - while (my $ref = $sth->fetchrow_hashref(NAME_lc)) { + while (my $ref = $sth->fetchrow_hashref("NAME_lc")) { %{ $form->{IC}{FX_gain}{ $ref->{accno} } } = ( id => $ref->{id}, description => $ref->{description} @@ -1682,7 +1679,7 @@ sub defaultaccounts { $sth = $dbh->prepare($query); $sth->execute || $self->dberror($query); - while (my $ref = $sth->fetchrow_hashref(NAME_lc)) { + while (my $ref = $sth->fetchrow_hashref("NAME_lc")) { %{ $form->{IC}{FX_loss}{ $ref->{accno} } } = ( id => $ref->{id}, description => $ref->{description} @@ -1699,7 +1696,7 @@ sub defaultaccounts { $sth = $dbh->prepare($query); $sth->execute || $form->dberror($query); - while (my $ref = $sth->fetchrow_hashref(NAME_lc)) { + while (my $ref = $sth->fetchrow_hashref("NAME_lc")) { $form->{taxrates}{ $ref->{accno} }{id} = $ref->{id}; $form->{taxrates}{ $ref->{accno} }{description} = $ref->{description}; $form->{taxrates}{ $ref->{accno} }{taxnumber} = $ref->{taxnumber} @@ -1797,7 +1794,7 @@ sub retrieve_units { $sth = $dbh->prepare($query_lang); $sth->execute() || $form->dberror($query_lang); my @languages; - while ($ref = $sth->fetchrow_hashref()) { + while (my $ref = $sth->fetchrow_hashref()) { push(@languages, $ref); } $sth->finish(); @@ -1817,7 +1814,7 @@ sub retrieve_units { } $sth->execute($unit->{"name"}) || $form->dberror($query_lang . " (" . $unit->{"name"} . ")"); - while ($ref = $sth->fetchrow_hashref()) { + while (my $ref = $sth->fetchrow_hashref()) { map({ $unit->{"LANGUAGES"}->{$ref->{"template_code"}}->{$_} = $ref->{$_} } keys(%{$ref})); } } @@ -1946,11 +1943,12 @@ sub convertible_units { # else return 1 sub convert_unit { $main::lxdebug->enter_sub(2); - ($this, $a, $b, $all_units) = @_; + my ($this, $a, $b, $all_units) = @_; + $main::lxdebug->leave_sub(2) and return 0 unless $a && $b; $main::lxdebug->leave_sub(2) and return 0 unless $all_units->{$a} && $all_units->{$b}; $main::lxdebug->leave_sub(2) and return 0 unless $all_units->{$a}{base_unit} eq $all_units->{$b}{base_unit}; - $main::lxdebug->leave_sub(2) and return $all_units->{$a}{factor} / $all_units->{$b}{factor}; + $main::lxdebug->leave_sub(2) and return $all_units->{$a}{factor} / $all_units->{$b}{factor}; } sub unit_select_data { @@ -2028,7 +2026,7 @@ sub sum_with_unit { $main::lxdebug->leave_sub(); - return wantarray ? ($sum, $baseunit) : $sum; + return wantarray ? ($sum, $base_unit) : $sum; } sub add_unit { @@ -2174,11 +2172,11 @@ sub taxes { FROM tax t ORDER BY taxkey|; - $sth = $dbh->prepare($query); + my $sth = $dbh->prepare($query); $sth->execute || $form->dberror($query); $form->{TAX} = []; - while (my $ref = $sth->fetchrow_hashref(NAME_lc)) { + while (my $ref = $sth->fetchrow_hashref("NAME_lc")) { push @{ $form->{TAX} }, $ref; } @@ -2204,11 +2202,11 @@ sub get_tax_accounts { ORDER BY accno }; - $sth = $dbh->prepare($query); + my $sth = $dbh->prepare($query); $sth->execute || $form->dberror($query); $form->{ACCOUNTS} = []; - while (my $ref = $sth->fetchrow_hashref(NAME_lc)) { + while (my $ref = $sth->fetchrow_hashref("NAME_lc")) { push @{ $form->{ACCOUNTS} }, $ref; } @@ -2238,7 +2236,7 @@ sub get_tax { my $sth = $dbh->prepare($query); $sth->execute($form->{id}) || $form->dberror($query . " ($form->{id})"); - my $ref = $sth->fetchrow_hashref(NAME_lc); + my $ref = $sth->fetchrow_hashref("NAME_lc"); map { $form->{$_} = $ref->{$_} } keys %$ref; @@ -2264,7 +2262,7 @@ sub get_tax { $sth->execute($form->{id}) || $form->dberror($query . " ($form->{id})"); $form->{TAXINUSE} = []; - while (my $ref = $sth->fetchrow_hashref(NAME_lc)) { + while (my $ref = $sth->fetchrow_hashref("NAME_lc")) { push @{ $form->{TAXINUSE} }, $ref; } @@ -2280,6 +2278,7 @@ sub save_tax { $main::lxdebug->enter_sub(); my ($self, $myconfig, $form) = @_; + my $query; # connect to database my $dbh = $form->get_standard_dbh($myconfig); @@ -2319,6 +2318,7 @@ sub delete_tax { $main::lxdebug->enter_sub(); my ($self, $myconfig, $form) = @_; + my $query; # connect to database my $dbh = $form->get_standard_dbh($myconfig);