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

(-)a/Koha/Acquisition/Order.pm (-1 / +33 lines)
Lines 169-174 sub subscription { Link Here
169
    return Koha::Subscription->_new_from_dbic( $subscription_rs );
169
    return Koha::Subscription->_new_from_dbic( $subscription_rs );
170
}
170
}
171
171
172
=head3 current_holds
173
174
    my $holds = $order->current_holds;
175
176
Returns the current holds associated to the order. It returns a I<Koha::Holds>
177
resultset in scalar context or a list of I<Koha::Hold> objects in list context.
178
179
It returns B<undef> if no I<biblio> or no I<items> are linked to the order.
180
181
=cut
182
183
sub current_holds {
184
    my ($self) = @_;
185
186
    my $items_rs     = $self->_result->aqorders_items;
187
    my @item_numbers = $items_rs->get_column('itemnumber')->all;
188
189
    return unless @item_numbers;
190
191
    my $biblio = $self->biblio;
192
    return unless $biblio;
193
194
    return $biblio->current_holds->search(
195
        {
196
            itemnumber => {
197
                -in => \@item_numbers
198
            }
199
        }
200
    );
201
}
202
172
=head3 items
203
=head3 items
173
204
174
    my $items = $order->items
205
    my $items = $order->items
Lines 196-202 Returns the bibliographic record associated to the order Link Here
196
227
197
sub biblio {
228
sub biblio {
198
    my ( $self ) = @_;
229
    my ( $self ) = @_;
199
    my $biblio_rs= $self->_result->biblionumber;
230
    my $biblio_rs= $self->_result->biblio;
231
    return unless $biblio_rs;
200
    return Koha::Biblio->_new_from_dbic( $biblio_rs );
232
    return Koha::Biblio->_new_from_dbic( $biblio_rs );
201
}
233
}
202
234
(-)a/Koha/Schema/Result/Aqorder.pm (-1 / +14 lines)
Lines 664-675 __PACKAGE__->many_to_many("borrowernumbers", "aqorder_users", "borrowernumber"); Link Here
664
# Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-08-31 11:51:37
664
# Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-08-31 11:51:37
665
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:GQEXetlivZm7buQohl8m4A
665
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:GQEXetlivZm7buQohl8m4A
666
666
667
__PACKAGE__->belongs_to(
668
  "biblio",
669
  "Koha::Schema::Result::Biblio",
670
  { 'foreign.biblionumber' => "self.biblionumber" },
671
  {
672
    is_deferrable => 1,
673
    join_type     => "LEFT",
674
    on_delete     => "SET NULL",
675
    on_update     => "CASCADE",
676
  },
677
);
678
667
sub koha_objects_class {
679
sub koha_objects_class {
668
    'Koha::Acquisition::Orders';
680
    'Koha::Acquisition::Orders';
669
}
681
}
682
670
sub koha_object_class {
683
sub koha_object_class {
671
    'Koha::Acquisition::Order';
684
    'Koha::Acquisition::Order';
672
}
685
}
686
673
__PACKAGE__->add_columns(
687
__PACKAGE__->add_columns(
674
    '+uncertainprice' => { is_boolean => 1 }
688
    '+uncertainprice' => { is_boolean => 1 }
675
);
689
);
676
- 

Return to bug 24440