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

(-)a/C4/Acquisition.pm (-2 / +5 lines)
Lines 1460-1475 sub ModReceiveOrder { Link Here
1460
            UPDATE aqorders
1460
            UPDATE aqorders
1461
            SET quantity = ?,
1461
            SET quantity = ?,
1462
                orderstatus = 'partial'|;
1462
                orderstatus = 'partial'|;
1463
        $query .= q|, order_internalnote = ?| if defined $order->{order_internalnote};
1464
        $query .= q| WHERE ordernumber = ?|;
1463
        $query .= q| WHERE ordernumber = ?|;
1465
        my $sth = $dbh->prepare($query);
1464
        my $sth = $dbh->prepare($query);
1466
1465
1467
        $sth->execute(
1466
        $sth->execute(
1468
            ( $is_standing ? 1 : ($order->{quantity} - $quantrec) ),
1467
            ( $is_standing ? 1 : ($order->{quantity} - $quantrec) ),
1469
            ( defined $order->{order_internalnote} ? $order->{order_internalnote} : () ),
1470
            $order->{ordernumber}
1468
            $order->{ordernumber}
1471
        );
1469
        );
1472
1470
1471
        if ( not $order->{subscriptionid} && defined $order->{order_internalnote} ) {
1472
            $dbh->do(q|UPDATE aqorders
1473
                SET order_internalnote = ?|, {}, $order->{order_internalnote});
1474
        }
1475
1473
        # Recalculate tax_value
1476
        # Recalculate tax_value
1474
        $dbh->do(q|
1477
        $dbh->do(q|
1475
            UPDATE aqorders
1478
            UPDATE aqorders
(-)a/acqui/orderreceive.pl (-3 / +12 lines)
Lines 194-199 my @gst_values = map { Link Here
194
    option => $_ + 0.0
194
    option => $_ + 0.0
195
}, split( '\|', C4::Context->preference("gist") );
195
}, split( '\|', C4::Context->preference("gist") );
196
196
197
my $order_internalnote = $order->{order_internalnote};
198
my $order_vendornote   = $order->{order_vendornote};
197
if ( $order->{subscriptionid} ) {
199
if ( $order->{subscriptionid} ) {
198
    # Order from a subscription, we will display an history of what has been received
200
    # Order from a subscription, we will display an history of what has been received
199
    my $orders = Koha::Acquisition::Orders->search(
201
    my $orders = Koha::Acquisition::Orders->search(
Lines 203-209 if ( $order->{subscriptionid} ) { Link Here
203
            ordernumber        => { '!=' => $order->{ordernumber} }
205
            ordernumber        => { '!=' => $order->{ordernumber} }
204
        }
206
        }
205
    );
207
    );
206
    $template->param( orders => $orders );
208
    if ( $order->{parent_ordernumber} != $order->{ordernumber} ) {
209
        my $parent_order = Koha::Acquisition::Orders->find($order->{parent_ordernumber});
210
        $order_internalnote = $parent_order->{order_internalnote};
211
        $order_vendornote   = $parent_order->{order_vendornote};
212
    }
213
    $template->param(
214
        orders => $orders,
215
    );
207
}
216
}
208
217
209
$template->param(
218
$template->param(
Lines 233-240 $template->param( Link Here
233
    invoiceid             => $invoice->{invoiceid},
242
    invoiceid             => $invoice->{invoiceid},
234
    invoice               => $invoice->{invoicenumber},
243
    invoice               => $invoice->{invoicenumber},
235
    datereceived          => $datereceived,
244
    datereceived          => $datereceived,
236
    order_internalnote    => $order->{order_internalnote},
245
    order_internalnote    => $order_internalnote,
237
    order_vendornote      => $order->{order_vendornote},
246
    order_vendornote      => $order_vendornote,
238
    suggestionid          => $suggestion->{suggestionid},
247
    suggestionid          => $suggestion->{suggestionid},
239
    surnamesuggestedby    => $suggestion->{surnamesuggestedby},
248
    surnamesuggestedby    => $suggestion->{surnamesuggestedby},
240
    firstnamesuggestedby  => $suggestion->{firstnamesuggestedby},
249
    firstnamesuggestedby  => $suggestion->{firstnamesuggestedby},
(-)a/t/db_dependent/Acquisition.t (-2 / +40 lines)
Lines 19-25 use Modern::Perl; Link Here
19
19
20
use POSIX qw(strftime);
20
use POSIX qw(strftime);
21
21
22
use Test::More tests => 70;
22
use Test::More tests => 71;
23
use t::lib::Mocks;
23
use t::lib::Mocks;
24
use Koha::Database;
24
use Koha::Database;
25
25
Lines 708-711 subtest 'ModReceiveOrder replacementprice tests' => sub { Link Here
708
    is ($received_order->{replacementprice},'16.120000',"Replacement price set if none passed in");
708
    is ($received_order->{replacementprice},'16.120000',"Replacement price set if none passed in");
709
};
709
};
710
710
711
subtest 'ModReceiveOrder and subscription' => sub {
712
    plan tests => 2;
713
714
    my $builder     = t::lib::TestBuilder->new;
715
    my $first_note  = 'first note';
716
    my $second_note = 'second note';
717
    my $subscription = $builder->build_object( { class => 'Koha::Subscriptions' } );
718
    my $order = $builder->build_object(
719
        {
720
            class => 'Koha::Acquisition::Orders',
721
            value => {
722
                subscriptionid     => $subscription->subscriptionid,
723
                order_internalnote => $first_note,
724
                quantity           => 5,
725
                quantityreceived   => 0,
726
            }
727
        }
728
    );
729
    my $order_info = $order->unblessed;
730
    # We do not want the note from the original note to be modified
731
    # Keeping it will permit to display it for future receptions
732
    $order_info->{order_internalnote} = $second_note;
733
    my ( undef, my $received_ordernumber ) = ModReceiveOrder(
734
        {
735
            biblionumber     => $order->biblionumber,
736
            order            => $order_info,
737
            invoice          => $order->{invoiceid},
738
            quantityreceived => 1,
739
            budget_id        => $order->budget_id,
740
        }
741
    );
742
    my $received_order = Koha::Acquisition::Orders->find($received_ordernumber);
743
    is( $received_order->order_internalnote,
744
        $second_note, "No price set if none passed in" );
745
746
    $order->get_from_storage;
747
    is( $order->get_from_storage->order_internalnote, $first_note );
748
};
749
711
$schema->storage->txn_rollback();
750
$schema->storage->txn_rollback();
712
- 

Return to bug 21467