]> wagnertech.de Git - mfinanz.git/blobdiff - t/controllers/financial_overview/sales_orders.t
Consolidation and extended test runs
[mfinanz.git] / t / controllers / financial_overview / sales_orders.t
index 9b278be269aeefa33384f224e9de8c267cde4642..34e1182b8573f4c33c9964af5cf2bae170270c48 100644 (file)
@@ -37,13 +37,26 @@ Support::TestSetup::login();
 
 our ($ar_chart, $buchungsgruppe, $ctrl, $currency_id, $customer, $employee, $order, $part, $tax_zone, $unit, @invoices);
 
 
 our ($ar_chart, $buchungsgruppe, $ctrl, $currency_id, $customer, $employee, $order, $part, $tax_zone, $unit, @invoices);
 
+sub clear_up {
+  "SL::DB::Manager::${_}"->delete_all(all => 1) for qw(InvoiceItem Invoice OrderItem Order Customer Part);
+};
+
 sub init_common_state {
 sub init_common_state {
-  $ar_chart       = SL::DB::Manager::Chart->find_by(accno => '1400')                        || croak "No AR chart";
-  $buchungsgruppe = SL::DB::Manager::Buchungsgruppe->find_by(description => 'Standard 19%') || croak "No accounting group";
-  $currency_id    = SL::DB::Default->get->currency_id;
-  $employee       = SL::DB::Manager::Employee->current                                      || croak "No employee";
-  $tax_zone       = SL::DB::Manager::TaxZone->find_by( description => 'Inland')             || croak "No taxzone";
-  $unit           = SL::DB::Manager::Unit->find_by(name => 'psch')                          || croak "No unit";
+  if ($::lx_office_conf{system}->{default_manager} eq "swiss") {
+    $ar_chart       = SL::DB::Manager::Chart->find_by(accno => '3200')                        || croak "No AR chart";
+    $buchungsgruppe = SL::DB::Manager::Buchungsgruppe->find_by(description => 'Standard 8%')  || croak "No accounting group";
+    $currency_id    = SL::DB::Default->get->currency_id;
+    $employee       = SL::DB::Manager::Employee->current                                      || croak "No employee";
+    $tax_zone       = SL::DB::Manager::TaxZone->find_by( description => 'Schweiz')            || croak "No taxzone";
+    $unit           = SL::DB::Manager::Unit->find_by(name => 'pauschal')                      || croak "No unit";
+  } else {
+    $ar_chart       = SL::DB::Manager::Chart->find_by(accno => '1400')                        || croak "No AR chart";
+    $buchungsgruppe = SL::DB::Manager::Buchungsgruppe->find_by(description => 'Standard 19%') || croak "No accounting group";
+    $currency_id    = SL::DB::Default->get->currency_id;
+    $employee       = SL::DB::Manager::Employee->current                                      || croak "No employee";
+    $tax_zone       = SL::DB::Manager::TaxZone->find_by( description => 'Inland')             || croak "No taxzone";
+    $unit           = SL::DB::Manager::Unit->find_by(name => 'psch')                          || croak "No unit";
+  }
 }
 
 sub create_sales_order {
 }
 
 sub create_sales_order {
@@ -52,7 +65,7 @@ sub create_sales_order {
   $params{$_} ||= {} for qw(customer part tax order orderitem);
 
   # Clean up: remove invoices, orders, parts and customers
   $params{$_} ||= {} for qw(customer part tax order orderitem);
 
   # Clean up: remove invoices, orders, parts and customers
-  "SL::DB::Manager::${_}"->delete_all(all => 1) for qw(InvoiceItem Invoice OrderItem Order Customer Part);
+  clear_up();
 
   $customer     = SL::DB::Customer->new(
     name        => 'Test Customer',
 
   $customer     = SL::DB::Customer->new(
     name        => 'Test Customer',
@@ -203,4 +216,6 @@ create_sales_order(
 is_deeply($ctrl->data->{$_}, { months => [ (0) x 12 ], quarters => [ 0, 0, 0, 0 ], year => 0 }, "periodic conf p=q ovp=y, no invoices, starting and ending before current year, data for $_")
   for qw(purchase_invoices purchase_orders requests_for_quotation sales_invoices sales_orders sales_orders_per_inv sales_quotations);
 
 is_deeply($ctrl->data->{$_}, { months => [ (0) x 12 ], quarters => [ 0, 0, 0, 0 ], year => 0 }, "periodic conf p=q ovp=y, no invoices, starting and ending before current year, data for $_")
   for qw(purchase_invoices purchase_orders requests_for_quotation sales_invoices sales_orders sales_orders_per_inv sales_quotations);
 
+clear_up();
+
 done_testing();
 done_testing();