X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=bin%2Fmozilla%2Fdatev.pl;h=9b9ac50e6df91b72cf8783a01b50625da7ec5c03;hb=ee56f1b20ab915671ded297f593c0e2e245bad70;hp=f3dbc2eb82bea431afafd5befe337076bd39e65c;hpb=6fdf290898b160dd60af5e00fab9f5820394947d;p=kivitendo-erp.git
diff --git a/bin/mozilla/datev.pl b/bin/mozilla/datev.pl
index f3dbc2eb8..9b9ac50e6 100644
--- a/bin/mozilla/datev.pl
+++ b/bin/mozilla/datev.pl
@@ -1,5 +1,5 @@
#=====================================================================
-# Lx-Office ERP
+# kivitendo ERP
# Copyright (c) 2004
#
# Author: Philip Reetz
@@ -18,7 +18,8 @@
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1335, USA.
#======================================================================
#
# Datev export module
@@ -29,7 +30,7 @@ use POSIX qw(strftime getcwd);
use Archive::Zip qw(:ERROR_CODES :CONSTANTS);
use SL::Common;
-use SL::DATEV;
+use SL::DATEV qw(:CONSTANTS);
use strict;
@@ -45,9 +46,10 @@ sub export {
$::lxdebug->enter_sub;
$::auth->assert('datev_export');
- DATEV->get_datev_stamm(\%::myconfig, $::form);
+ my $stamm = SL::DATEV->new->get_datev_stamm;
+
$::form->header;
- print $::form->parse_html_template('datev/export');
+ print $::form->parse_html_template('datev/export', $stamm);
$::lxdebug->leave_sub;
}
@@ -85,48 +87,41 @@ sub export_stammdaten {
}
sub export3 {
- $main::lxdebug->enter_sub();
-
- my $form = $main::form;
- my %myconfig = %main::myconfig;
- my $locale = $main::locale;
-
- $main::auth->assert('datev_export');
-
- DATEV::clean_temporary_directories();
-
- DATEV->save_datev_stamm(\%myconfig, \%$form);
+ $::lxdebug->enter_sub;
+ $::auth->assert('datev_export');
- my $link = "datev.pl?action=download&download_token=";
+ my %data = (
+ exporttype => $::form->{exporttype} ? DATEV_ET_STAMM : DATEV_ET_BUCHUNGEN,
+ format => $::form->{kne} ? DATEV_FORMAT_KNE : DATEV_FORMAT_OBE,
+ );
+
+ if ($::form->{exporttype} == DATEV_ET_STAMM) {
+ $data{accnofrom} = $::form->{accnofrom},
+ $data{accnoto} = $::form->{accnoto},
+ } elsif ($::form->{exporttype} == DATEV_ET_BUCHUNGEN) {
+ @data{qw(from to)} = _get_dates(
+ $::form->{zeitraum}, $::form->{monat}, $::form->{quartal},
+ $::form->{transdatefrom}, $::form->{transdateto},
+ );
+ } else {
+ die 'invalid exporttype';
+ }
- if ($form->{kne}) {
- my $result = DATEV->kne_export(\%myconfig, \%$form);
- if ($result && @{ $result->{filenames} }) {
- $link .= Q($result->{download_token});
+ my $datev = SL::DATEV->new(%data);
- print(qq|
| . $locale->text('KNE-Export erfolgreich!') . qq|
Download|);
+ $datev->clean_temporary_directories;
+ $datev->save_datev_stamm($::form);
- print $form->parse_html_template('datev/net_gross_difference') if @{ $form->{net_gross_differences} };
+ $datev->export;
- } else {
- $form->error("KNE-Export schlug fehl.");
- }
+ if (!$datev->errors) {
+ $::form->header;
+ print $::form->parse_html_template('datev/export3', { datev => $datev });
} else {
- # OBE-Export nicht implementiert.
-
- # my @filenames = DATEV->obe_export(\%myconfig, \%$form);
- # if (@filenames) {
- # print(qq|
| . $locale->text('OBE-Export erfolgreich!') . qq|
|);
- # $link .= "&filenames=" . $form->escape(join(":", @filenames));
- # print(qq|
Download|);
- # } else {
- # $form->error("OBE-Export schlug fehl.");
- # }
+ $::form->error("Export schlug fehl.\n" . join "\n", $datev->errors);
}
- print("