epic-s6g
authorSparky6 <sparky6@core>
Tue, 13 Dec 2022 17:38:50 +0000 (18:38 +0100)
committerSparky6 <sparky6@core>
Tue, 13 Dec 2022 17:38:50 +0000 (18:38 +0100)
19 files changed:
SL/Controller/Mebil.pm
SL/DB/Manager/MebilMapping.pm
SL/DB/MebilMapping.pm
SL/mebil/Mapping.pm [new file with mode: 0644]
Test/FitNesseRoot/RecentChanges/1-20210218164308.zip [deleted file]
Test/FitNesseRoot/RecentChanges/12-20210218191800.zip [deleted file]
Test/FitNesseRoot/RecentChanges/16-20210218192122.zip [deleted file]
Test/FitNesseRoot/RecentChanges/18-20210218193807.zip [deleted file]
Test/FitNesseRoot/RecentChanges/22-20210218193819.zip [deleted file]
Test/FitNesseRoot/RecentChanges/24-20210218193922.zip [deleted file]
Test/FitNesseRoot/RecentChanges/26-20210218194426.zip [deleted file]
Test/FitNesseRoot/RecentChanges/29-20210218194432.zip [deleted file]
Test/FitNesseRoot/RecentChanges/3-20210218191029.zip [deleted file]
Test/FitNesseRoot/RecentChanges/6-20210218191037.zip [deleted file]
Test/FitNesseRoot/RecentChanges/9-20210218191653.zip [deleted file]
Test/FitNesseRoot/RecentChanges/content.txt
Test/FitnessePages/MappingSuite/.dummy [new file with mode: 0644]
Test/perl/ErrorChannel.pm [new file with mode: 0644]
Test/perl/test_action.pl

index 570e070..dbb8c2d 100644 (file)
@@ -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;
index 6ccaa08..9f37457 100644 (file)
@@ -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');
+# }
index 785380f..2510d1f 100644 (file)
@@ -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 (file)
index 0000000..ca2d5ea
--- /dev/null
@@ -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 (file)
index c463dcd..0000000
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 (file)
index 6026a9e..0000000
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 (file)
index 9b48673..0000000
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 (file)
index 5e979db..0000000
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 (file)
index 216576e..0000000
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 (file)
index a5a181d..0000000
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 (file)
index 4960e1a..0000000
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 (file)
index 892df89..0000000
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 (file)
index a8e8dfe..0000000
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 (file)
index c31e20c..0000000
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 (file)
index 3e020af..0000000
Binary files a/Test/FitNesseRoot/RecentChanges/9-20210218191653.zip and /dev/null differ
index 9f8b01e..bc1d4b7 100644 (file)
@@ -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 (file)
index 0000000..e69de29
diff --git a/Test/perl/ErrorChannel.pm b/Test/perl/ErrorChannel.pm
new file mode 100644 (file)
index 0000000..0e89ce1
--- /dev/null
@@ -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
index 5611dac..069cc14 100755 (executable)
@@ -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";
 }