069cc1491943b143f04d248f21713bcfc73c19b6
[kivitendo-erp.git] / Test / perl / test_action.pl
1 #!/usr/bin/perl
2 use strict;
3
4 use lib "/opt/kivitendo-erp";
5 use SL::LXDebug;
6 use SL::mebil::Mapping;
7 use Test::perl::ErrorChannel;
8
9 $::lxdebug = new LXDebug;
10
11 SL::DB->register_db(
12   domain   => 'KIVITENDO',
13   type     => 'KIVITENDO',
14   driver   => 'Pg',
15   database => 'firma',
16   host     => 'localhost',
17   username => 'kivitendo',
18   password => 'kivitendo',
19 );
20
21 my $db = SL::DB->new(domain   => 'KIVITENDO',
22   type     => 'KIVITENDO',);
23 my $dbh = $db->dbh;
24
25 my $errch = new ErrorChannel;
26 my $mapper = new SL::mebil::Mapping($errch, $dbh);
27
28 my $command = $ARGV[0];
29 if ($command eq "GetMapping") {
30         my $mapping = $mapper->get_mapping();
31         foreach (@$mapping) {
32                 print $_->{fromacc}."\n";
33         }
34         die ("Kein Mapping vorhanden.") unless (scalar(@$mapping) > 0);
35 } elsif ($command eq "CalcMapping") {
36         die ("NIY.");
37 } else {
38         die "Invalid command: $command";
39 }