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

(-)a/Koha/Acquisition/Orders.pm (+1 lines)
Lines 287-292 sub cancel { Link Here
287
    my $count         = 0;
287
    my $count         = 0;
288
    my @messages;
288
    my @messages;
289
    while ( my $order = $self->next ) {
289
    while ( my $order = $self->next ) {
290
        next if $order->orderstatus =~ /complete|cancelled/;
290
        _correct_quantity($order);                        # historical ballast
291
        _correct_quantity($order);                        # historical ballast
291
        $order->cancel( { delete_biblio => $delete_biblio } );
292
        $order->cancel( { delete_biblio => $delete_biblio } );
292
        if ( @{ $order->object_messages } ) {
293
        if ( @{ $order->object_messages } ) {
(-)a/cataloguing/addbiblio.pl (-2 / +2 lines)
Lines 789-796 elsif ( $op eq "cud-delete" ) { Link Here
789
    try {
789
    try {
790
        my @result = Koha::Acquisition::Orders->search( { biblionumber => $biblionumber } )->cancel;
790
        my @result = Koha::Acquisition::Orders->search( { biblionumber => $biblionumber } )->cancel;
791
        my $warns  = @{ $result[1] };
791
        my $warns  = @{ $result[1] };
792
        if ( $result[0] && $warns ) {    # warnings about order lines not removed
792
        if ($warns) {    # warnings about order lines not cancelled
793
            warn sprintf( "%d order lines were deleted, but %d lines gave a warning\n", $result[0], $warns );
793
            warn sprintf( "%d order lines were cancelled, but %d lines gave a warning\n", $result[0], $warns );
794
        }
794
        }
795
        $error = &DelBiblio($biblionumber);
795
        $error = &DelBiblio($biblionumber);
796
    } catch {
796
    } catch {
(-)a/t/db_dependent/Koha/Acquisition/Orders.t (-3 / +2 lines)
Lines 196-206 subtest 'filter_by_obsolete and cancel' => sub { Link Here
196
    $rs = Koha::Acquisition::Orders->filter_by_obsolete->search($limit);
196
    $rs = Koha::Acquisition::Orders->filter_by_obsolete->search($limit);
197
    is( $rs->count, 3, 'Three obsolete' );
197
    is( $rs->count, 3, 'Three obsolete' );
198
    my @results = $rs->cancel;
198
    my @results = $rs->cancel;
199
    is( $results[0],                            3,           'All should be cancelled' );
199
    is( $results[0],                            2,           'Two should be cancelled, one was cancelled already' );
200
    is( @{ $results[1] },                       0,           'No messages' );
200
    is( @{ $results[1] },                       0,           'No messages' );
201
    is( $order_1->discard_changes->orderstatus, 'cancelled', 'Check orderstatus of order_1' );
201
    is( $order_1->discard_changes->orderstatus, 'cancelled', 'Check orderstatus of order_1' );
202
    isnt( $order_2->discard_changes->datecancellationprinted, undef, 'Cancellation date of order_2 filled' );
202
    isnt( $order_2->discard_changes->datecancellationprinted, undef, 'Cancellation date of order_2 filled' );
203
    isnt( $order_3->discard_changes->datecancellationprinted, undef, 'Cancellation date of order_3 filled' );
203
    is( $order_3->discard_changes->datecancellationprinted, undef, 'order_3 was skipped, so date not touched' );
204
204
205
    $schema->storage->txn_rollback;
205
    $schema->storage->txn_rollback;
206
};
206
};
207
- 

Return to bug 27893