|
Lines 8-14
use POSIX qw(strftime);
Link Here
|
| 8 |
|
8 |
|
| 9 |
use C4::Bookseller qw( GetBookSellerFromId ); |
9 |
use C4::Bookseller qw( GetBookSellerFromId ); |
| 10 |
|
10 |
|
| 11 |
use Test::More tests => 68; |
11 |
use Test::More tests => 71; |
| 12 |
|
12 |
|
| 13 |
BEGIN { |
13 |
BEGIN { |
| 14 |
use_ok('C4::Acquisition'); |
14 |
use_ok('C4::Acquisition'); |
|
Lines 793-805
is(
Link Here
|
| 793 |
|
793 |
|
| 794 |
( $datereceived, $new_ordernumber ) = |
794 |
( $datereceived, $new_ordernumber ) = |
| 795 |
ModReceiveOrder( $biblionumber2, $ordernumbers[1], 2, undef, 12, 12, |
795 |
ModReceiveOrder( $biblionumber2, $ordernumbers[1], 2, undef, 12, 12, |
| 796 |
$invoiceid, 42, ); |
796 |
$invoiceid, 42, undef, undef, undef, "my notes"); |
| 797 |
my $order2 = GetOrder( $ordernumbers[1] ); |
797 |
my $order2 = GetOrder( $ordernumbers[1] ); |
| 798 |
is( $order2->{'quantityreceived'}, |
798 |
is( $order2->{'quantityreceived'}, |
| 799 |
0, 'Splitting up order did not receive any on original order' ); |
799 |
0, 'Splitting up order did not receive any on original order' ); |
| 800 |
is( $order2->{'quantity'}, 40, '40 items on original order' ); |
800 |
is( $order2->{'quantity'}, 40, '40 items on original order' ); |
| 801 |
is( $order2->{'budget_id'}, $budgetid, |
801 |
is( $order2->{'budget_id'}, $budgetid, |
| 802 |
'Budget on original order is unchanged' ); |
802 |
'Budget on original order is unchanged' ); |
|
|
803 |
is( $order2->{notes}, "my notes", |
| 804 |
'ModReceiveOrder and GetOrder deal with notes' ); |
| 803 |
|
805 |
|
| 804 |
$neworder = GetOrder($new_ordernumber); |
806 |
$neworder = GetOrder($new_ordernumber); |
| 805 |
is( $neworder->{'quantity'}, 2, '2 items on new order' ); |
807 |
is( $neworder->{'quantity'}, 2, '2 items on new order' ); |
|
Lines 816-822
my $budgetid2 = C4::Budgets::AddBudget(
Link Here
|
| 816 |
|
818 |
|
| 817 |
( $datereceived, $new_ordernumber ) = |
819 |
( $datereceived, $new_ordernumber ) = |
| 818 |
ModReceiveOrder( $biblionumber2, $ordernumbers[2], 2, undef, 12, 12, |
820 |
ModReceiveOrder( $biblionumber2, $ordernumbers[2], 2, undef, 12, 12, |
| 819 |
$invoiceid, 42, $budgetid2 ); |
821 |
$invoiceid, 42, $budgetid2, undef, undef, "my other notes" ); |
| 820 |
|
822 |
|
| 821 |
my $order3 = GetOrder( $ordernumbers[2] ); |
823 |
my $order3 = GetOrder( $ordernumbers[2] ); |
| 822 |
is( $order3->{'quantityreceived'}, |
824 |
is( $order3->{'quantityreceived'}, |
|
Lines 824-829
is( $order3->{'quantityreceived'},
Link Here
|
| 824 |
is( $order3->{'quantity'}, 2, '2 items on original order' ); |
826 |
is( $order3->{'quantity'}, 2, '2 items on original order' ); |
| 825 |
is( $order3->{'budget_id'}, $budgetid, |
827 |
is( $order3->{'budget_id'}, $budgetid, |
| 826 |
'Budget on original order is unchanged' ); |
828 |
'Budget on original order is unchanged' ); |
|
|
829 |
is( $order3->{notes}, "my other notes", |
| 830 |
'ModReceiveOrder and GetOrder deal with notes' ); |
| 827 |
|
831 |
|
| 828 |
$neworder = GetOrder($new_ordernumber); |
832 |
$neworder = GetOrder($new_ordernumber); |
| 829 |
is( $neworder->{'quantity'}, 2, '2 items on new order' ); |
833 |
is( $neworder->{'quantity'}, 2, '2 items on new order' ); |
|
Lines 833-844
is( $neworder->{'budget_id'}, $budgetid2, 'Budget on new order is changed' );
Link Here
|
| 833 |
|
837 |
|
| 834 |
( $datereceived, $new_ordernumber ) = |
838 |
( $datereceived, $new_ordernumber ) = |
| 835 |
ModReceiveOrder( $biblionumber2, $ordernumbers[2], 2, undef, 12, 12, |
839 |
ModReceiveOrder( $biblionumber2, $ordernumbers[2], 2, undef, 12, 12, |
| 836 |
$invoiceid, 42, $budgetid2 ); |
840 |
$invoiceid, 42, $budgetid2, undef, undef, "my third notes" ); |
| 837 |
|
841 |
|
| 838 |
$order3 = GetOrder( $ordernumbers[2] ); |
842 |
$order3 = GetOrder( $ordernumbers[2] ); |
| 839 |
is( $order3->{'quantityreceived'}, 2, 'Order not split up' ); |
843 |
is( $order3->{'quantityreceived'}, 2, 'Order not split up' ); |
| 840 |
is( $order3->{'quantity'}, 2, '2 items on order' ); |
844 |
is( $order3->{'quantity'}, 2, '2 items on order' ); |
| 841 |
is( $order3->{'budget_id'}, $budgetid2, 'Budget has changed' ); |
845 |
is( $order3->{'budget_id'}, $budgetid2, 'Budget has changed' ); |
|
|
846 |
is( $order3->{notes}, "my third notes", 'ModReceiveOrder and GetOrder deal with notes' ); |
| 842 |
|
847 |
|
| 843 |
my $nonexistent_order = GetOrder(); |
848 |
my $nonexistent_order = GetOrder(); |
| 844 |
is( $nonexistent_order, undef, 'GetOrder returns undef if no ordernumber is given' ); |
849 |
is( $nonexistent_order, undef, 'GetOrder returns undef if no ordernumber is given' ); |
| 845 |
- |
|
|