From: Sparky6 Date: Tue, 13 Dec 2022 17:38:50 +0000 (+0100) Subject: epic-s6g X-Git-Tag: kivitendo-mebil_0.1-0~2 X-Git-Url: http://wagnertech.de/git?p=kivitendo-erp.git;a=commitdiff_plain;h=5349a1ed016ae603b39d73747eccc6792707db1c epic-s6g --- diff --git a/SL/Controller/Mebil.pm b/SL/Controller/Mebil.pm index 570e07011..dbb8c2dea 100644 --- a/SL/Controller/Mebil.pm +++ b/SL/Controller/Mebil.pm @@ -13,6 +13,8 @@ use SL::Locale::String; # t8 #use Data::Dumper; #use SL::ClientJS; +use SL::mebil::Mapping; + use Rose::Object::MakeMethods::Generic ( scalar => [ qw(report number_columns year current_year objects subtotals_per_quarter salesman_id) ], 'scalar --get_set_init' => [ qw(employees types data) ], @@ -56,8 +58,8 @@ sub action_showmap { $::form->{title} = $::locale->text('Mebil Map'); - my $sql = "SELECT fromacc,typ,toacc from mebil_mapping order by ordering"; - $self->{data} = SL::DBUtils::selectall_hashref_query($::form, $::form->get_standard_dbh, $sql); + my $mapping = new SL::mebil::Mapping($::form, $::form->get_standard_dbh); + $self->{data} = $mapping->get_mapping(); $self->prepare_report; $self->list_data; diff --git a/SL/DB/Manager/MebilMapping.pm b/SL/DB/Manager/MebilMapping.pm index 6ccaa0821..9f37457a7 100644 --- a/SL/DB/Manager/MebilMapping.pm +++ b/SL/DB/Manager/MebilMapping.pm @@ -12,3 +12,31 @@ sub object_class { 'SL::DB::MebilMapping' } __PACKAGE__->make_manager_methods; 1; + +# The call above creates the methods shown below. (The actual +# method bodies vary slightly, but this is the gist of it...) +# +# sub get_products +# { +# shift->get_objects(@_, object_class => 'Product'); +# } +# +# sub get_products_iterator +# { +# shift->get_objects_iterator(@_, object_class => 'Product'); +# } +# +# sub get_products_count +# { +# shift->get_objects_count(@_, object_class => 'Product'); +# } +# +# sub update_products +# { +# shift->update_objects(@_, object_class => 'Product'); +# } +# +# sub delete_products +# { +# shift->delete_objects(@_, object_class => 'Product'); +# } diff --git a/SL/DB/MebilMapping.pm b/SL/DB/MebilMapping.pm index 785380ff7..2510d1fbb 100644 --- a/SL/DB/MebilMapping.pm +++ b/SL/DB/MebilMapping.pm @@ -7,10 +7,4 @@ use SL::DB::Manager::MebilMapping; __PACKAGE__->meta->initialize; -sub getMappings { - my $dbh = shift; - - return SL::DB::Manager::MebilMapping::get_mebilmappings(); -} - 1; diff --git a/SL/mebil/Mapping.pm b/SL/mebil/Mapping.pm new file mode 100644 index 000000000..ca2d5ea63 --- /dev/null +++ b/SL/mebil/Mapping.pm @@ -0,0 +1,22 @@ +package SL::mebil::Mapping; + +use strict; + +# Manager methods for mebil + +sub new { + # parameter: 1) ... + my $name = shift; + my $my_data = { + error_channel => shift, + dbh => shift}; + bless $my_data; + return $my_data; +} +sub get_mapping { + my $self = shift; + my $sql = "SELECT fromacc,typ,toacc from mebil_mapping order by ordering"; + return SL::DBUtils::selectall_hashref_query($self->{error_channel}, $self->{dbh}, $sql); +} + +1; diff --git a/Test/FitNesseRoot/RecentChanges/1-20210218164308.zip b/Test/FitNesseRoot/RecentChanges/1-20210218164308.zip deleted file mode 100644 index c463dcdf1..000000000 Binary files a/Test/FitNesseRoot/RecentChanges/1-20210218164308.zip and /dev/null differ diff --git a/Test/FitNesseRoot/RecentChanges/12-20210218191800.zip b/Test/FitNesseRoot/RecentChanges/12-20210218191800.zip deleted file mode 100644 index 6026a9e75..000000000 Binary files a/Test/FitNesseRoot/RecentChanges/12-20210218191800.zip and /dev/null differ diff --git a/Test/FitNesseRoot/RecentChanges/16-20210218192122.zip b/Test/FitNesseRoot/RecentChanges/16-20210218192122.zip deleted file mode 100644 index 9b486732d..000000000 Binary files a/Test/FitNesseRoot/RecentChanges/16-20210218192122.zip and /dev/null differ diff --git a/Test/FitNesseRoot/RecentChanges/18-20210218193807.zip b/Test/FitNesseRoot/RecentChanges/18-20210218193807.zip deleted file mode 100644 index 5e979dbd5..000000000 Binary files a/Test/FitNesseRoot/RecentChanges/18-20210218193807.zip and /dev/null differ diff --git a/Test/FitNesseRoot/RecentChanges/22-20210218193819.zip b/Test/FitNesseRoot/RecentChanges/22-20210218193819.zip deleted file mode 100644 index 216576ebf..000000000 Binary files a/Test/FitNesseRoot/RecentChanges/22-20210218193819.zip and /dev/null differ diff --git a/Test/FitNesseRoot/RecentChanges/24-20210218193922.zip b/Test/FitNesseRoot/RecentChanges/24-20210218193922.zip deleted file mode 100644 index a5a181ddd..000000000 Binary files a/Test/FitNesseRoot/RecentChanges/24-20210218193922.zip and /dev/null differ diff --git a/Test/FitNesseRoot/RecentChanges/26-20210218194426.zip b/Test/FitNesseRoot/RecentChanges/26-20210218194426.zip deleted file mode 100644 index 4960e1a51..000000000 Binary files a/Test/FitNesseRoot/RecentChanges/26-20210218194426.zip and /dev/null differ diff --git a/Test/FitNesseRoot/RecentChanges/29-20210218194432.zip b/Test/FitNesseRoot/RecentChanges/29-20210218194432.zip deleted file mode 100644 index 892df892b..000000000 Binary files a/Test/FitNesseRoot/RecentChanges/29-20210218194432.zip and /dev/null differ diff --git a/Test/FitNesseRoot/RecentChanges/3-20210218191029.zip b/Test/FitNesseRoot/RecentChanges/3-20210218191029.zip deleted file mode 100644 index a8e8dfedb..000000000 Binary files a/Test/FitNesseRoot/RecentChanges/3-20210218191029.zip and /dev/null differ diff --git a/Test/FitNesseRoot/RecentChanges/6-20210218191037.zip b/Test/FitNesseRoot/RecentChanges/6-20210218191037.zip deleted file mode 100644 index c31e20c75..000000000 Binary files a/Test/FitNesseRoot/RecentChanges/6-20210218191037.zip and /dev/null differ diff --git a/Test/FitNesseRoot/RecentChanges/9-20210218191653.zip b/Test/FitNesseRoot/RecentChanges/9-20210218191653.zip deleted file mode 100644 index 3e020af8a..000000000 Binary files a/Test/FitNesseRoot/RecentChanges/9-20210218191653.zip and /dev/null differ diff --git a/Test/FitNesseRoot/RecentChanges/content.txt b/Test/FitNesseRoot/RecentChanges/content.txt index 9f8b01e61..bc1d4b74c 100644 --- a/Test/FitNesseRoot/RecentChanges/content.txt +++ b/Test/FitNesseRoot/RecentChanges/content.txt @@ -1,3 +1,5 @@ +|FrontPage.MappingSuite.ShowMapping||18:30:23 Di., Dez. 13, 2022| +|FrontPage.MappingSuite||12:36:18 Di., Dez. 13, 2022| |FrontPage.AlAktualisierung||19:45:06 Do, Feb 18, 2021| |FrontPage.AdNeuInstallation||19:39:22 Do, Feb 18, 2021| |FrontPage.AbDeinstallieren||19:21:22 Do, Feb 18, 2021| diff --git a/Test/FitnessePages/MappingSuite/.dummy b/Test/FitnessePages/MappingSuite/.dummy new file mode 100644 index 000000000..e69de29bb diff --git a/Test/perl/ErrorChannel.pm b/Test/perl/ErrorChannel.pm new file mode 100644 index 000000000..0e89ce1f0 --- /dev/null +++ b/Test/perl/ErrorChannel.pm @@ -0,0 +1,16 @@ +use strict; + +package ErrorChannel; + +sub new { + my $self = {}; + bless $self, shift; + return $self; +} + +sub dberror { + my $self = shift; + print shift; print "\n"; +} + +1; \ No newline at end of file diff --git a/Test/perl/test_action.pl b/Test/perl/test_action.pl index 5611dace2..069cc1491 100755 --- a/Test/perl/test_action.pl +++ b/Test/perl/test_action.pl @@ -1,16 +1,12 @@ #!/usr/bin/perl use strict; -#use SL::Controller::Mebil; -use SL::DB; -use SL::Form; +use lib "/opt/kivitendo-erp"; use SL::LXDebug; -use SL::DB::Manager::MebilMapping; +use SL::mebil::Mapping; +use Test::perl::ErrorChannel; $::lxdebug = new LXDebug; -#$::form = new Form; - -#my $dbh = $::form->get_standard_dbh; SL::DB->register_db( domain => 'KIVITENDO', @@ -26,13 +22,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 "GetMapping") { + my $mapping = $mapper->get_mapping(); + foreach (@$mapping) { + print $_->{fromacc}."\n"; + } + die ("Kein Mapping vorhanden.") unless (scalar(@$mapping) > 0); +} elsif ($command eq "CalcMapping") { + die ("NIY."); +} else { + die "Invalid command: $command"; }