my ($self, $myconfig, $form, $order_by, $order_dir) = @_;
- my $dbh = $form->dbconnect($myconfig);
+ my $dbh = SL::DB->client->dbh;
my (@filter_values, $filter);
}
if ($form->{no_assemblies}) {
- $filter .= qq| AND (NOT COALESCE(assembly, FALSE))|;
+ $filter .= qq| AND (NOT part_type = 'assembly')|;
}
if ($form->{assemblies}) {
- $filter .= qq| AND assembly=TRUE|;
+ $filter .= qq| AND part_type = 'assembly'|;
}
if ($form->{no_services}) {
- $filter .= qq| AND (inventory_accno_id is not NULL or assembly=TRUE)|;
+ $filter .= qq| AND NOT (part_type = 'service' OR part_type = 'assembly')|;
}
substr($filter, 1, 3) = "WHERE" if ($filter);
push(@{$parts}, $ref);
}
$sth->finish();
- $dbh->disconnect();
$main::lxdebug->leave_sub();
my ($self, $myconfig, $form, $order_by, $order_dir, $is_vendor, $allow_both) = @_;
- my $dbh = $form->dbconnect($myconfig);
+ my $dbh = SL::DB->client->dbh;
my (@filter_values, $filter);
if ($form->{"name"}) {
push(@{$customers}, $ref);
}
$sth->finish();
- $dbh->disconnect();
$main::lxdebug->leave_sub();
my ($self, $myconfig, $form, $order_by, $order_dir) = @_;
- my $dbh = $form->dbconnect($myconfig);
+ my $dbh = SL::DB->client->dbh;
my (@filter_values, $filter);
if ($form->{"name"}) {
push(@{$delivery_customers}, $ref);
}
$sth->finish();
- $dbh->disconnect();
$main::lxdebug->leave_sub();
my ($self, $myconfig, $form, $order_by, $order_dir) = @_;
- my $dbh = $form->dbconnect($myconfig);
+ my $dbh = SL::DB->client->dbh;
my (@filter_values, $filter);
if ($form->{"name"}) {
push(@{$vendors}, $ref);
}
$sth->finish();
- $dbh->disconnect();
$main::lxdebug->leave_sub();
$vc = $vc eq "customer" ? "customer" : "vendor";
- my $dbh = $form->dbconnect($myconfig);
+ my $dbh = SL::DB->client->dbh;
my $query;
my $ref = selectfirst_hashref_query($form, $dbh, $query, $vc_id);
if (!$ref) {
- $dbh->disconnect();
$main::lxdebug->leave_sub();
return 0;
}
# Only show default pricegroup for customer, not vendor, which is why this is outside the main query
($form->{pricegroup}) = selectrow_query($form, $dbh, qq|SELECT pricegroup FROM pricegroup WHERE id = ?|, $form->{pricegroup_id});
- $dbh->disconnect();
-
$main::lxdebug->leave_sub();
return 1;
$prefix ||= "";
- my $dbh = $form->dbconnect($myconfig);
+ my $dbh = SL::DB->client->dbh;
my $query = qq|SELECT * FROM shipto WHERE shipto_id = ?|;
my $ref = selectfirst_hashref_query($form, $dbh, $query, $shipto_id);
);
$form->{"${prefix}shiptocvar_$_->{name}"} = $_->{value} for @{ $cvars };
- $dbh->disconnect();
-
$main::lxdebug->leave_sub();
}
do_query($form, $dbh, qq|UPDATE $table SET intnotes = ? WHERE id = ?|, $intnotes, $form->{id});
$form->save_status($dbh);
- });
+ 1;
+ }) or do { die SL::DB->client->error };
$main::lxdebug->leave_sub();
}