my $dbconnect = 'dbi:Pg:dbname=' . $client->dbname . ';host=' . $client->dbhost . ';port=' . $client->dbport;
my $dbh = DBI->connect($dbconnect, $client->dbuser, $client->dbpasswd);
my $query = q{ SELECT coa FROM defaults };
- (my $sth = $dbh->prepare($query))->execute;
($coa) = selectrow_query($::form, $dbh, $query);
- $sth->finish;
$dbh->disconnect;
};
return $coa;
payments_changeable => { type => 'integer', default => '0', not_null => 1 },
pdonumber => { type => 'text' },
ponumber => { type => 'text' },
+ precision => { type => 'numeric', precision => 15, scale => 5, default => '0.01', not_null => 1 },
profit_determination => { type => 'text' },
purchase_delivery_order_show_delete => { type => 'boolean', default => 'true' },
purchase_order_show_delete => { type => 'boolean', default => 'true' },
my $dbconnect = 'dbi:Pg:dbname=' . $client->{dbname} . ';host=' . $client->{dbhost} . ';port=' . $client->{dbport};
my $dbh = DBI->connect($dbconnect, $client->{dbuser}, $client->{dbpasswd});
my $query = q{ SELECT precision FROM defaults };
- (my $sth = $dbh->prepare($query))->execute;
($precision) = selectrow_query($::form, $dbh, $query);
- $sth->finish;
$dbh->disconnect;
};
return $precision;
sub init_menu {
my @menu_files;
- if(scalar(grep(/^Switzerland/, (selectrow_query($::form, $::form->get_standard_dbh, 'SELECT coa FROM defaults'))[0]))) {
+ my $dbh = $::form->get_standard_dbh;
+ if(scalar(grep(/^Switzerland/, (selectrow_query($::form, $dbh, 'SELECT coa FROM defaults'))[0]))) {
@menu_files = qw(menus/erp_ch.ini);
} else {
@menu_files = qw(menus/erp.ini);
}
+ $dbh->commit;
unshift @menu_files, 'menus/crm.ini' if $::instance_conf->crm_installed;
Menu->new(@menu_files);
}