Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 65b054be

Von Sven Schöling vor mehr als 8 Jahren hinzugefügt

  • ID 65b054be8038e3eeb3dd2c87ba52a82a843cfd4f
  • Vorgänger e8784e42
  • Nachfolger 9d17d16c

SEPA: single-dbh

Unterschiede anzeigen:

SL/SEPA.pm
use SL::DBUtils;
use SL::DB::Invoice;
use SL::DB::PurchaseInvoice;
use SL::DB;
use SL::Locale::String qw(t8);
use DateTime;
......
}
sub create_export {
my ($self, %params) = @_;
$main::lxdebug->enter_sub();
my $rc = SL::DB->client->with_transaction(\&_create_export, $self, %params);
$::lxdebug->leave_sub;
return $rc;
}
sub _create_export {
my $self = shift;
my %params = @_;
......
my $vc = $params{vc} eq 'customer' ? 'customer' : 'vendor';
my $ARAP = uc $arap;
my $dbh = $params{dbh} || $form->get_standard_dbh($myconfig);
my $dbh = $params{dbh} || SL::DB->client->dbh;
my ($export_id) = selectfirst_array_query($form, $dbh, qq|SELECT nextval('sepa_export_id_seq')|);
my $query =
......
$h_insert->finish();
$h_item_id->finish();
$dbh->commit() unless ($params{dbh});
$main::lxdebug->leave_sub();
return $export_id;
}
......
my $myconfig = \%main::myconfig;
my $form = $main::form;
my $dbh = $params{dbh} || $form->get_standard_dbh($myconfig);
SL::DB->client->with_transaction(sub {
my $dbh = $params{dbh} || SL::DB->client->dbh;
my @ids = ref $params{id} eq 'ARRAY' ? @{ $params{id} } : ($params{id});
my $placeholders = join ', ', ('?') x scalar @ids;
my $query = qq|UPDATE sepa_export SET closed = TRUE WHERE id IN ($placeholders)|;
my @ids = ref $params{id} eq 'ARRAY' ? @{ $params{id} } : ($params{id});
my $placeholders = join ', ', ('?') x scalar @ids;
my $query = qq|UPDATE sepa_export SET closed = TRUE WHERE id IN ($placeholders)|;
do_query($form, $dbh, $query, map { conv_i($_) } @ids);
$dbh->commit() unless ($params{dbh});
do_query($form, $dbh, $query, map { conv_i($_) } @ids);
});
$main::lxdebug->leave_sub();
}
......
}
sub post_payment {
my ($self, %params) = @_;
$main::lxdebug->enter_sub();
my $rc = SL::DB->client->with_transaction(\&_post_payment, $self, %params);
$::lxdebug->leave_sub;
return $rc;
}
sub _post_payment {
my $self = shift;
my %params = @_;
......
my $mult = $params{vc} eq 'customer' ? -1 : 1;
my $ARAP = uc $arap;
my $dbh = $params{dbh} || $form->get_standard_dbh($myconfig);
my $dbh = $params{dbh} || SL::DB->client->dbh;
my @items = ref $params{items} eq 'ARRAY' ? @{ $params{items} } : ($params{items});
......
map { $_->[0]->finish() } values %handles;
$dbh->commit() unless ($params{dbh});
$main::lxdebug->leave_sub();
return 1;
}
1;

Auch abrufbar als: Unified diff