is(GetInvoice($invoiceid3), undef, 'DelInvoice deleted correct invoice');
my @invoices_linked_to_subscriptions = map{
- $_->{linked_to_subscriptions}
+ $_->{is_linked_to_subscriptions}
? $_
: ()
} @invoices;
use Modern::Perl;
-use Test::More tests => 12;
+use Test::More tests => 13;
use Data::Dumper;
use_ok('C4::Acquisition');
is ( $order->{subscriptionid}, $subscription->{subscriptionid}, "test subscriptionid for the last order not received");
ok( $order->{ecost} == $cost, "test cost for the last order not received");
+$dbh->do(q{DELETE FROM aqinvoices});
+my $invoiceid = AddInvoice(invoicenumber => 'invoice1', booksellerid => $booksellerid, unknown => "unknown");
+
my ( $datereceived, $new_ordernumber ) = ModReceiveOrder(
{
biblionumber => $biblionumber,
ecost => $cost,
rrp => $cost,
budget_id => $budget_id,
- datereceived => '02-01-2013'
+ datereceived => '02-01-2013',
+ invoiceid => $invoiceid,
}
);
$order = GetLastOrderNotReceivedFromSubscriptionid( $subscription->{subscriptionid} );
is ( $order, undef, "test no not received order for a received order");
+my @invoices = GetInvoices();
+my @invoices_linked_to_subscriptions = grep { $_->{is_linked_to_subscriptions} } @invoices;
+is(scalar(@invoices_linked_to_subscriptions), 1, 'GetInvoices() can identify invoices that are linked to a subscription');
+
# Cleanup
$dbh->rollback;