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

(-)a/Koha/Acquisition/Order.pm (-2 / +2 lines)
Lines 146-153 sub cancel { Link Here
146
    }
146
    }
147
147
148
    # If ordered from a suggestion, revert the suggestion status to ACCEPTED
148
    # If ordered from a suggestion, revert the suggestion status to ACCEPTED
149
    my $suggestion = Koha::Suggestions->find({ biblionumber => $self->biblionumber, status => "ORDERED" });
149
    my $suggestion = $self->suggestion;
150
    if ( $suggestion and $suggestion->id ) {
150
    if ( $suggestion && $suggestion->STATUS eq "ORDERED" ) {
151
        ModSuggestion(
151
        ModSuggestion(
152
            {
152
            {
153
                suggestionid => $suggestion->id,
153
                suggestionid => $suggestion->id,
(-)a/Koha/EDI.pm (-8 / +5 lines)
Lines 45-50 use Koha::Plugins; # Adds plugin dirs to @INC Link Here
45
use Koha::Plugins::Handler;
45
use Koha::Plugins::Handler;
46
use Koha::Acquisition::Baskets;
46
use Koha::Acquisition::Baskets;
47
use Koha::Acquisition::Booksellers;
47
use Koha::Acquisition::Booksellers;
48
use Koha::Acquisition::Orders;
48
49
49
our $VERSION = 1.1;
50
our $VERSION = 1.1;
50
51
Lines 330-345 sub process_invoice { Link Here
330
                # ModReceiveOrder does not validate that $ordernumber exists validate here
331
                # ModReceiveOrder does not validate that $ordernumber exists validate here
331
                if ($order) {
332
                if ($order) {
332
333
333
                    # check suggestions
334
                    my $order_koha_object = Koha::Acquisition::Orders->find($ordernumber);
334
                    my $s = $schema->resultset('Suggestion')->search(
335
                    my $suggestion = $order_koha_object->suggestion;
335
                        {
336
                    if ($suggestion) {
336
                            biblionumber => $order->biblionumber->biblionumber,
337
                        }
338
                    )->single;
339
                    if ($s) {
340
                        ModSuggestion(
337
                        ModSuggestion(
341
                            {
338
                            {
342
                                suggestionid => $s->suggestionid,
339
                                suggestionid => $suggestion->suggestionid,
343
                                STATUS       => 'AVAILABLE',
340
                                STATUS       => 'AVAILABLE',
344
                            }
341
                            }
345
                        );
342
                        );
(-)a/acqui/addorder.pl (-12 / +14 lines)
Lines 330-346 if ( $basket->{is_standing} || $orderinfo->{quantity} ne '0' ) { Link Here
330
        $orderinfo->{biblionumber}=$biblionumber;
330
        $orderinfo->{biblionumber}=$biblionumber;
331
    }
331
    }
332
332
333
    # change suggestion status if applicable
334
    if ( my $suggestionid = $input->param('suggestionid') ) {
335
        ModSuggestion(
336
            {
337
                suggestionid => $suggestionid,
338
                biblionumber => $orderinfo->{biblionumber},
339
                STATUS       => 'ORDERED',
340
            }
341
        );
342
    }
343
344
    $orderinfo->{unitprice} = $orderinfo->{ecost} if not defined $orderinfo->{unitprice} or $orderinfo->{unitprice} eq '';
333
    $orderinfo->{unitprice} = $orderinfo->{ecost} if not defined $orderinfo->{unitprice} or $orderinfo->{unitprice} eq '';
345
334
346
    my $order;
335
    my $order;
Lines 357-362 if ( $basket->{is_standing} || $orderinfo->{quantity} ne '0' ) { Link Here
357
    $order->populate_with_prices_for_ordering();
346
    $order->populate_with_prices_for_ordering();
358
    $order->store;
347
    $order->store;
359
348
349
    # change suggestion status if applicable
350
    if ( my $suggestionid = $input->param('suggestionid') ) {
351
        # Double checking we are going to edit the correct suggestion
352
        if ( $suggestionid == $order->suggestion->suggestion ) {
353
            ModSuggestion(
354
                {
355
                    suggestionid => $suggestionid,
356
                    biblionumber => $orderinfo->{biblionumber},
357
                    STATUS       => 'ORDERED',
358
                }
359
            );
360
        }
361
    }
362
360
    # Log the order creation
363
    # Log the order creation
361
    if (C4::Context->preference("AcquisitionLog")) {
364
    if (C4::Context->preference("AcquisitionLog")) {
362
        my $infos = {};
365
        my $infos = {};
363
- 

Return to bug 28844