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

(-)a/Koha/Acquisition/Order.pm (-8 / +25 lines)
Lines 24-29 use Koha::Acquisition::Funds; Link Here
24
use Koha::Acquisition::Invoices;
24
use Koha::Acquisition::Invoices;
25
use Koha::Database;
25
use Koha::Database;
26
use Koha::DateUtils qw( dt_from_string output_pref );
26
use Koha::DateUtils qw( dt_from_string output_pref );
27
use Koha::Biblios;
27
use Koha::Items;
28
use Koha::Items;
28
use Koha::Subscriptions;
29
use Koha::Subscriptions;
29
30
Lines 185-190 sub items { Link Here
185
    return Koha::Items->search({ itemnumber => \@itemnumbers });
186
    return Koha::Items->search({ itemnumber => \@itemnumbers });
186
}
187
}
187
188
189
=head3 biblio
190
191
    my $biblio = $order->biblio
192
193
Returns the bibliographic record associated to the order
194
195
=cut
196
197
sub biblio {
198
    my ( $self ) = @_;
199
    my $biblio_rs= $self->_result->biblionumber;
200
    return Koha::Biblio->_new_from_dbic( $biblio_rs );
201
}
202
188
=head3 duplicate_to
203
=head3 duplicate_to
189
204
190
    my $duplicated_order = $order->duplicate_to($basket, [$default_values]);
205
    my $duplicated_order = $order->duplicate_to($basket, [$default_values]);
Lines 231-243 sub duplicate_to { Link Here
231
            $order_info->{basketno} = $basket->basketno;
246
            $order_info->{basketno} = $basket->basketno;
232
247
233
            $new_order = Koha::Acquisition::Order->new($order_info)->store;
248
            $new_order = Koha::Acquisition::Order->new($order_info)->store;
234
            my $items = $self->items;
249
235
            while ( my ($item) = $items->next ) {
250
            if ( not $self->biblio->serial || $self->basket->effective_create_items eq 'ordering') { # Do copy items if not a serial OR if items are created on ordering
236
                my $item_info = $item->unblessed;
251
                my $items = $self->items;
237
                undef $item_info->{itemnumber};
252
                while ( my ($item) = $items->next ) {
238
                undef $item_info->{barcode};
253
                    my $item_info = $item->unblessed;
239
                my $new_item = Koha::Item->new($item_info)->store;
254
                    undef $item_info->{itemnumber};
240
                $new_order->add_item( $new_item->itemnumber );
255
                    undef $item_info->{barcode};
256
                    my $new_item = Koha::Item->new($item_info)->store;
257
                    $new_order->add_item( $new_item->itemnumber );
258
                }
241
            }
259
            }
242
        }
260
        }
243
    );
261
    );
244
- 

Return to bug 15184