Revision 040aa711
Von Sven Schöling vor mehr als 8 Jahren hinzugefügt
SL/DATEV.pm | ||
---|---|---|
|
||
use SL::DBUtils;
|
||
use SL::DATEV::KNEFile;
|
||
use SL::DB;
|
||
|
||
use Data::Dumper;
|
||
use DateTime;
|
||
... | ... | |
$self->{provided_dbh} = 1;
|
||
}
|
||
|
||
$self->{dbh} ||= $::form->get_standard_dbh;
|
||
$self->{dbh} ||= SL::DB->client->dbh;
|
||
}
|
||
|
||
sub provided_dbh {
|
||
... | ... | |
sub save_datev_stamm {
|
||
my ($self, $data) = @_;
|
||
|
||
do_query($::form, $self->dbh, 'DELETE FROM datev');
|
||
SL::DB->client->with_transaction(sub {
|
||
do_query($::form, $self->dbh, 'DELETE FROM datev');
|
||
|
||
my @columns = qw(beraternr beratername dfvkz mandantennr datentraegernr abrechnungsnr);
|
||
my @columns = qw(beraternr beratername dfvkz mandantennr datentraegernr abrechnungsnr);
|
||
|
||
my $query = "INSERT INTO datev (" . join(', ', @columns) . ") VALUES (" . join(', ', ('?') x @columns) . ")";
|
||
do_query($::form, $self->dbh, $query, map { $data->{$_} } @columns);
|
||
|
||
$self->dbh->commit unless $self->provided_dbh;
|
||
my $query = "INSERT INTO datev (" . join(', ', @columns) . ") VALUES (" . join(', ', ('?') x @columns) . ")";
|
||
do_query($::form, $self->dbh, $query, map { $data->{$_} } @columns);
|
||
});
|
||
}
|
||
|
||
sub export {
|
||
... | ... | |
Set a database handle to use in the process. This allows for an export to be
|
||
done on a transaction in progress without committing first.
|
||
|
||
Note: If you don't want this code to commit, simply providing a dbh is not
|
||
enough enymore. You'll have to wrap the call into a transaction yourself, so
|
||
that the internal transaction does not commit.
|
||
|
||
=item exporttype
|
||
|
||
See L<CONSTANTS> for possible values. This MUST be set before export is called.
|
Auch abrufbar als: Unified diff
DATEV: single-dbh