X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=Test%2Fperl%2Ftest_action.pl;h=abf7379886ffd721368d65d39bacaa70f4707718;hb=47db6ae13df64092d401896ec476b9335e9ec807;hp=904bb23bc3316e8a98045e0ddabdddf605e2fd25;hpb=9c454191438763ec271c715cb2d2b81cc9e647ea;p=kivitendo-erp.git diff --git a/Test/perl/test_action.pl b/Test/perl/test_action.pl index 904bb23bc..abf737988 100755 --- a/Test/perl/test_action.pl +++ b/Test/perl/test_action.pl @@ -1,28 +1,40 @@ #!/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::mebil::Mapping; +use ErrorChannel; $::lxdebug = new LXDebug; -#$::form = new Form; - -#my $dbh = $::form->get_standard_dbh; SL::DB->register_db( + domain => 'KIVITENDO', + type => 'KIVITENDO', driver => 'Pg', - database => 'dev_db', + database => 'firma', host => 'localhost', username => 'kivitendo', - password => 'kivitemdo', + password => 'kivitendo', ); -#my $db = SL::DB::client; +my $db = SL::DB->new(domain => 'KIVITENDO', + type => 'KIVITENDO',); +my $dbh = $db->dbh; -#my $dbh = SL::DB::dbi_connect("dbi:driver=Pg;dbname=firma;host=localhost;port=5432", "kivitendo", "kivitendo"); -my $db = SL::DB->new; +my $errch = new ErrorChannel; +my $mapper = new SL::mebil::Mapping($errch, $dbh); -my $m = new SL::Controller::Mebil; -$m->action_calcmap; +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"; +}