);
map { do_query($form, $dbh, $_, @values) } @queries;
- });
+ 1;
+ }) or do { die SL::DB->client->error };
return 1;
}
my ($self, $myconfig, $form) = @_;
# connect to database
- my $dbh = $form->dbconnect($myconfig);
+ my $dbh = SL::DB->client->dbh;
my ($query, $sth, $ref, $q_invdate);
map { $form->{$_} = $ref->{$_} } keys %$ref;
if (!$form->{id}) {
- $dbh->disconnect();
$main::lxdebug->leave_sub();
return;
Common::webdav_folder($form);
- $dbh->disconnect();
-
$main::lxdebug->leave_sub();
}
$params = $form unless defined $params && ref $params eq "HASH";
# connect to database
- my $dbh = $form->dbconnect($myconfig);
+ my $dbh = SL::DB->client->dbh;
my $dateformat = $myconfig->{dateformat};
$dateformat .= "yy" if $myconfig->{dateformat} !~ /^y/;
$params->{rowcount} = $i if ($i && !$params->{type});
}
- $dbh->disconnect();
-
$main::lxdebug->leave_sub();
}
my ($self, $myconfig, $form) = @_;
- # connect to database
- my $dbh = $form->dbconnect($myconfig);
+ my $dbh = SL::DB->client->dbh;
my $i = $form->{rowcount};
# don't include assemblies or obsolete parts
- my $where = "NOT p.assembly = '1' AND NOT p.obsolete = '1'";
+ my $where = "NOT p.part_type = 'assembly' AND NOT p.obsolete = '1'";
my @values;
foreach my $table_column (qw(p.partnumber p.description pg.partsgroup)) {
my $query =
qq|SELECT
p.id, p.partnumber, p.description, p.lastcost AS sellprice, p.listprice,
- p.unit, p.assembly, p.onhand, p.formel,
+ p.unit, p.part_type, p.onhand, p.formel,
p.notes AS partnotes, p.notes AS longdescription, p.not_discountable,
p.inventory_accno_id, p.price_factor_id,
p.ean,
map { $item->{"ic_cvar_" . $_->{name} } = $_->{value} } @{ $custom_variables };
}
- $dbh->disconnect();
-
$main::lxdebug->leave_sub();
}
my ($self, $myconfig, $form, @wanted_vars) = @_;
- # connect to database
- my $dbh = $form->dbconnect($myconfig);
+ my $dbh = SL::DB->client->dbh;
my @values;
'translation_type' => 'greetings::' . ($form->{cp_gender} eq 'f' ? 'female' : 'male'),
'allow_fallback' => 1);
- $dbh->disconnect();
-
$main::lxdebug->leave_sub();
}
my ($self, $myconfig, $form) = @_;
- # connect to database
- my $dbh = $form->dbconnect($myconfig);
+ my $dbh = SL::DB->client->dbh;
my $query =
qq|SELECT accno, description, link
}
$sth->finish();
- $dbh->disconnect();
-
$main::lxdebug->leave_sub();
}