projects
/
kivitendo-erp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
js-Validator: Kommentar-Update
[kivitendo-erp.git]
/
t
/
shop
/
shop_order.t
diff --git
a/t/shop/shop_order.t
b/t/shop/shop_order.t
index
5504231
..
e40ec2f
100644
(file)
--- a/
t/shop/shop_order.t
+++ b/
t/shop/shop_order.t
@@
-5,6
+5,7
@@
use lib 't';
use Support::TestSetup;
use Carp;
use Test::Exception;
use Support::TestSetup;
use Carp;
use Test::Exception;
+use SL::DBUtils qw(check_trgm);
use SL::Dev::ALL;
use SL::Dev::Part qw(new_part);
use SL::Dev::Shop qw(new_shop new_shop_part new_shop_order);
use SL::Dev::ALL;
use SL::Dev::Part qw(new_part);
use SL::Dev::Shop qw(new_shop new_shop_part new_shop_order);
@@
-16,12
+17,16
@@
use SL::Controller::ShopOrder;
use Data::Dumper;
my ($shop, $shop_order, $shop_part, $part, $customer, $employee);
use Data::Dumper;
my ($shop, $shop_order, $shop_part, $part, $customer, $employee);
+my ($transdate);
sub reset_state {
my %params = @_;
clear_up();
sub reset_state {
my %params = @_;
clear_up();
+ $transdate = DateTime->today_local;
+ $transdate->set_year(2019) if $transdate->year == 2020; # use year 2019 in 2020, because of tax rate change in Germany
+
$shop = new_shop->save;
$part = new_part->save;
$shop_part = new_shop_part(part => $part, shop => $shop)->save;
$shop = new_shop->save;
$part = new_part->save;
$shop_part = new_shop_part(part => $part, shop => $shop)->save;
@@
-35,13
+40,13
@@
sub reset_state {
)->save;
}
)->save;
}
-sub save_sho
r
controller_to_string {
+sub save_sho
p
controller_to_string {
my $output;
my $output;
- open(my $outputFH, '
<
', \$output) or die "OUTPUT";
+ open(my $outputFH, '
>
', \$output) or die "OUTPUT";
my $oldFH = select $outputFH;
my $oldFH = select $outputFH;
- my $sho
r
_controller = SL::Controller::ShopOrder->new;
- $sho
r
_controller->action_transfer;
+ my $sho
p
_controller = SL::Controller::ShopOrder->new;
+ $sho
p
_controller->action_transfer;
select $oldFH;
close $outputFH;
select $oldFH;
close $outputFH;
@@
-53,7
+58,7
@@
sub test_transfer {
$::form->{import_id} = $params{import_id};
$::form->{customer} = $params{customer};
my $test_name = 'Test Controller Action Transfer';
$::form->{import_id} = $params{import_id};
$::form->{customer} = $params{customer};
my $test_name = 'Test Controller Action Transfer';
- save_sho
r
controller_to_string();
+ save_sho
p
controller_to_string();
my @links_record = RecordLinks->get_links( 'from_table' => 'shop_orders',
'from_id' => $params{import_id},
'to_table' => 'oe',
my @links_record = RecordLinks->get_links( 'from_table' => 'shop_orders',
'from_id' => $params{import_id},
'to_table' => 'oe',
@@
-67,13
+72,15
@@
Support::TestSetup::login();
reset_state();
reset_state();
-my $trgm =
SL::DB::ShopOrder->check_trgm
;
+my $trgm =
check_trgm($::form->get_standard_dbh())
;
my $shop_trans_id = 1;
$shop_order = new_shop_order(
shop => $shop,
my $shop_trans_id = 1;
$shop_order = new_shop_order(
shop => $shop,
+ transfer_date => $transdate,
shop_trans_id => $shop_trans_id,
shop_trans_id => $shop_trans_id,
+ order_date => $transdate->datetime,
amount => 59.5,
billing_lastname => 'Schmidt',
billing_firstname => 'Sven',
amount => 59.5,
billing_lastname => 'Schmidt',
billing_firstname => 'Sven',
@@
-141,7
+148,7
@@
is($shop->description , 'testshop' , 'shop description ok');
is($shop_order->shop_id , $shop->id , "shop_id ok");
note('testing convert_to_sales_order');
is($shop_order->shop_id , $shop->id , "shop_id ok");
note('testing convert_to_sales_order');
-my $order = $shop_order->convert_to_sales_order(employee => $employee, customer => $customer);
+my $order = $shop_order->convert_to_sales_order(employee => $employee, customer => $customer
, transdate => $shop_order->order_date
);
$order->calculate_prices_and_taxes;
$order->save;
$order->calculate_prices_and_taxes;
$order->save;