View | Details | Raw Unified | Return to bug 25655
Collapse All | Expand All

(-)a/C4/Acquisition.pm (+3 lines)
Lines 1383-1388 sub ModReceiveOrder { Link Here
1383
    $datereceived = $datereceived ? dt_from_string( $datereceived ) : dt_from_string;
1383
    $datereceived = $datereceived ? dt_from_string( $datereceived ) : dt_from_string;
1384
    $datereceived = $datereceived->ymd;
1384
    $datereceived = $datereceived->ymd;
1385
1385
1386
    $order->{invoice_unitprice} ||= $order->{unitprice};
1387
    $order->{invoice_currency}  ||= Koha::Acquisition::Currencies->get_active->currency;
1388
1386
    my $suggestionid = GetSuggestionFromBiblionumber( $biblionumber );
1389
    my $suggestionid = GetSuggestionFromBiblionumber( $biblionumber );
1387
    if ($suggestionid) {
1390
    if ($suggestionid) {
1388
        ModSuggestion( {suggestionid=>$suggestionid,
1391
        ModSuggestion( {suggestionid=>$suggestionid,
(-)a/t/db_dependent/Acquisition.t (-9 / +15 lines)
Lines 803-808 subtest 'ModReceiveOrder invoice_unitprice and invoice_currency' => sub { Link Here
803
                        quantityreceived       => 0,
803
                        quantityreceived       => 0,
804
                        ecost_tax_excluded     => 42,
804
                        ecost_tax_excluded     => 42,
805
                        unitprice_tax_excluded => 42,
805
                        unitprice_tax_excluded => 42,
806
                        unitprice              => 42,
806
                    }
807
                    }
807
                }
808
                }
808
            );
809
            );
Lines 819-834 subtest 'ModReceiveOrder invoice_unitprice and invoice_currency' => sub { Link Here
819
                    budget_id        => $order->budget_id,
820
                    budget_id        => $order->budget_id,
820
                }
821
                }
821
            );
822
            );
823
            my $active_currency = Koha::Acquisition::Currencies->get_active;
822
            my $received_order =
824
            my $received_order =
823
              Koha::Acquisition::Orders->find($received_ordernumber);
825
              Koha::Acquisition::Orders->find($received_ordernumber);
824
            is( $received_order->invoice_unitprice,
826
            is( $received_order->invoice_unitprice,
825
                undef, 'no price should be stored if none passed' );
827
                $order->unitprice, 'no price should be stored if none passed' );
826
            is( $received_order->invoice_currency,
828
            is( $received_order->invoice_currency,
827
                undef, 'no currency should be stored if none passed' );
829
                $active_currency->currency, 'no currency should be stored if none passed' );
828
            $order = $order->get_from_storage;
830
            $order = $order->get_from_storage;
829
            is( $order->invoice_unitprice, undef,
831
            is( $order->invoice_unitprice, $order->unitprice,
830
                'no price should be stored if none passed' );
832
                'no price should be stored if none passed' );
831
            is( $order->invoice_currency, undef,
833
            is( $order->invoice_currency, $active_currency->currency,
832
                'no currency should be stored if none passed' );
834
                'no currency should be stored if none passed' );
833
        };
835
        };
834
        subtest 'with invoice_unitprice' => sub {
836
        subtest 'with invoice_unitprice' => sub {
Lines 841-846 subtest 'ModReceiveOrder invoice_unitprice and invoice_currency' => sub { Link Here
841
                        quantityreceived       => 0,
843
                        quantityreceived       => 0,
842
                        ecost_tax_excluded     => 42,
844
                        ecost_tax_excluded     => 42,
843
                        unitprice_tax_excluded => 42,
845
                        unitprice_tax_excluded => 42,
846
                        unitprice              => 42,
844
                    }
847
                    }
845
                }
848
                }
846
            );
849
            );
Lines 886-891 subtest 'ModReceiveOrder invoice_unitprice and invoice_currency' => sub { Link Here
886
                        quantityreceived       => 0,
889
                        quantityreceived       => 0,
887
                        ecost_tax_excluded     => 42,
890
                        ecost_tax_excluded     => 42,
888
                        unitprice_tax_excluded => 42,
891
                        unitprice_tax_excluded => 42,
892
                        unitprice              => 42,
889
                    }
893
                    }
890
                }
894
                }
891
            );
895
            );
Lines 902-918 subtest 'ModReceiveOrder invoice_unitprice and invoice_currency' => sub { Link Here
902
                    budget_id        => $order->budget_id,
906
                    budget_id        => $order->budget_id,
903
                }
907
                }
904
            );
908
            );
909
            my $active_currency = Koha::Acquisition::Currencies->get_active;
905
            my $received_order =
910
            my $received_order =
906
              Koha::Acquisition::Orders->find($received_ordernumber);
911
              Koha::Acquisition::Orders->find($received_ordernumber);
907
            is( $received_order->invoice_unitprice,
912
            is( $received_order->invoice_unitprice,
908
                undef, 'no price should be stored if none passed' );
913
                $order->unitprice, 'no price should be stored if none passed' );
909
            is( $received_order->invoice_currency,
914
            is( $received_order->invoice_currency,
910
                undef, 'no currency should be stored if none passed' );
915
                $active_currency->currency, 'no currency should be stored if none passed' );
911
            $order = $order->get_from_storage;
916
            $order = $order->get_from_storage;
912
            is( $order->invoice_unitprice, undef,
917
            is( $order->invoice_unitprice, $order->unitprice,
913
                'no price should be stored if none passed' );
918
                'no price should be stored if none passed' );
914
            is( $order->invoice_currency, undef,
919
            is( $order->invoice_currency, $active_currency->currency,
915
                'no currency should be stored if none passed' );
920
                'no currency should be stored if none passed' );
921
916
        };
922
        };
917
923
918
        subtest 'with invoice_unitprice' => sub {
924
        subtest 'with invoice_unitprice' => sub {
Lines 925-930 subtest 'ModReceiveOrder invoice_unitprice and invoice_currency' => sub { Link Here
925
                        quantityreceived       => 0,
931
                        quantityreceived       => 0,
926
                        ecost_tax_excluded     => 42,
932
                        ecost_tax_excluded     => 42,
927
                        unitprice_tax_excluded => 42,
933
                        unitprice_tax_excluded => 42,
934
                        unitprice              => 42,
928
                    }
935
                    }
929
                }
936
                }
930
            );
937
            );
931
- 

Return to bug 25655