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

(-)a/Koha/Acquisition/Order.pm (-1 / +20 lines)
Lines 25-30 use Koha::Acquisition::Invoices; Link Here
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::Items;
27
use Koha::Items;
28
use Koha::Patrons;
28
use Koha::Subscriptions;
29
use Koha::Subscriptions;
29
30
30
use base qw(Koha::Object);
31
use base qw(Koha::Object);
Lines 110-115 sub add_item { Link Here
110
    $rs->create({ ordernumber => $self->ordernumber, itemnumber => $itemnumber });
111
    $rs->create({ ordernumber => $self->ordernumber, itemnumber => $itemnumber });
111
}
112
}
112
113
114
sub add_user {
115
    my ( $self, $borrowernumber )  = @_;
116
117
    my $schema = Koha::Database->new->schema;
118
    my $rs = $schema->resultset('AqorderUser');
119
    $rs->create({ ordernumber => $self->ordernumber, borrowernumber => $borrowernumber });
120
}
121
113
=head3 basket
122
=head3 basket
114
123
115
    my $basket = Koha::Acquisition::Orders->find( $id )->basket;
124
    my $basket = Koha::Acquisition::Orders->find( $id )->basket;
Lines 177-182 sub items { Link Here
177
    return Koha::Items->search({ itemnumber => \@itemnumbers });
186
    return Koha::Items->search({ itemnumber => \@itemnumbers });
178
}
187
}
179
188
189
sub users {
190
    my ( $self )  = @_;
191
    my $users_rs = $self->_result->aqorder_users;
192
    my @borrowernumbers = $users_rs->get_column( 'borrowernumber' )->all;
193
    return Koha::Patrons->search({ borrowernumber=> \@borrowernumbers });
194
}
195
180
sub duplicate_to {
196
sub duplicate_to {
181
    my ( $self, $basket, $default_values ) = @_;
197
    my ( $self, $basket, $default_values ) = @_;
182
    my $new_order;
198
    my $new_order;
Lines 221-226 sub duplicate_to { Link Here
221
                my $new_item = Koha::Item->new($item_info)->store;
237
                my $new_item = Koha::Item->new($item_info)->store;
222
                $new_order->add_item( $new_item->itemnumber );
238
                $new_order->add_item( $new_item->itemnumber );
223
            }
239
            }
240
            my $users = $self->users; # Do we want ├ža?
241
            while ( my ($user) = $users->next ) {
242
                $new_order->add_user( $user->borrowernumber );
243
            }
224
        }
244
        }
225
    );
245
    );
226
    return $new_order;
246
    return $new_order;
227
- 

Return to bug 15184