X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/2d0387d1624b5b7ed6b13b79b9d5a87ce9b6d12b..47db6ae13df64092d401896ec476b9335e9ec807:/Test/perl/test_action.pl diff --git a/Test/perl/test_action.pl b/Test/perl/test_action.pl index 5611dace2..abf737988 100755 --- a/Test/perl/test_action.pl +++ b/Test/perl/test_action.pl @@ -1,16 +1,13 @@ #!/usr/bin/perl use strict; -#use SL::Controller::Mebil; -use SL::DB; -use SL::Form; +use lib "/opt/kivitendo-erp"; +use lib "perl"; use SL::LXDebug; -use SL::DB::Manager::MebilMapping; +use SL::mebil::Mapping; +use ErrorChannel; $::lxdebug = new LXDebug; -#$::form = new Form; - -#my $dbh = $::form->get_standard_dbh; SL::DB->register_db( domain => 'KIVITENDO', @@ -26,13 +23,18 @@ my $db = SL::DB->new(domain => 'KIVITENDO', type => 'KIVITENDO',); my $dbh = $db->dbh; -#$dbh->do("SELECT * FROM mebil_mapping"); - -#$db->begin_work or die $db->error; -#my $m = new SL::Controller::Mebil; -#$m->action_calcmap; -my $mappings = SL::DB::Manager::MebilMapping->get_objects(dbh => $dbh); - -foreach my $map (@$mappings) { - print ("$map\n"); +my $errch = new ErrorChannel; +my $mapper = new SL::mebil::Mapping($errch, $dbh); + +my $command = $ARGV[0]; +if ($command eq "ShowMapping") { + my $mapping = $mapper->get_mapping(); + foreach (@$mapping) { + print $_->{fromacc}."\n"; + } + die ("Kein Mapping vorhanden.") unless (scalar(@$mapping) > 0); +} elsif ($command eq "CalcMapping") { + (my $fromacc, my $toacc) = $mapper->calc_mapping(2022); +} else { + die "Invalid command: $command"; }