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

(-)a/svc/checkouts (-15 / +22 lines)
Lines 140-145 $sth->execute(@parameters); Link Here
140
my $item_level_itypes = C4::Context->preference('item-level_itypes');
140
my $item_level_itypes = C4::Context->preference('item-level_itypes');
141
my $claims_returned_lost_value = C4::Context->preference('ClaimReturnedLostValue');
141
my $claims_returned_lost_value = C4::Context->preference('ClaimReturnedLostValue');
142
142
143
my $itemtypes = { map { $_->{itemtype} => $_->{translated_description} } @{ Koha::ItemTypes->search_with_localization->unblessed } };
144
143
my @checkouts_today;
145
my @checkouts_today;
144
my @checkouts_previous;
146
my @checkouts_previous;
145
while ( my $c = $sth->fetchrow_hashref() ) {
147
while ( my $c = $sth->fetchrow_hashref() ) {
Lines 161-190 while ( my $c = $sth->fetchrow_hashref() ) { Link Here
161
    my ( $renewals_count, $renewals_allowed, $renewals_remaining ) =
163
    my ( $renewals_count, $renewals_allowed, $renewals_remaining ) =
162
      GetRenewCount( $c->{borrowernumber}, $c->{itemnumber} );
164
      GetRenewCount( $c->{borrowernumber}, $c->{itemnumber} );
163
165
164
    my $type_for_stat = Koha::ItemTypes->find( $item_level_itypes ? $c->{itype} : $c->{itemtype} );
166
    my ( $itemtype, $recordtype, $type_for_stat );
165
    my $itemtype = Koha::ItemTypes->find( $c->{itype} );
167
    $itemtype      = $itemtypes->{ $c->{itype} }    if $c->{itype};
166
    my $recordtype = Koha::ItemTypes->find( $c->{itemtype} );
168
    $recordtype    = $itemtypes->{ $c->{itemtype} } if $c->{itemtype};
169
    $type_for_stat = $item_level_itypes ? $itemtype : $recordtype;
170
167
    my $location;
171
    my $location;
168
    if ( $c->{location} ) {
172
    if ( $c->{location} ) {
169
        my $av = Koha::AuthorisedValues->search({ category => 'LOC', authorised_value => $c->{location} });
173
        my $av = Koha::AuthorisedValues->get_description_by_koha_field(
170
        $location = $av->count ? $av->next->lib : '';
174
            { kohafield => 'items.location', authorised_value => $c->{location} } );
175
        $location = $av->{lib} ? $av->{lib} : '';
171
    }
176
    }
172
    my $collection;
177
    my $collection;
173
    if ( $c->{collection} ) {
178
    if ( $c->{collection} ) {
174
        my $av = Koha::AuthorisedValues->search({ category => 'CCODE', authorised_value => $c->{collection} });
179
        my $av = Koha::AuthorisedValues->get_description_by_koha_field(
175
        $collection = $av->count ? $av->next->lib : '';
180
            { kohafield => 'items.ccode', authorised_value => $c->{collection} } );
181
        $collection = $av->{lib} ? $av->{lib} : '';
176
    }
182
    }
177
    my $lost;
183
    my $lost;
178
    my $claims_returned;
184
    my $claims_returned;
179
    if ( $c->{itemlost} ) {
185
    if ( $c->{itemlost} ) {
180
        my $av = Koha::AuthorisedValues->search({ category => 'LOST', authorised_value => $c->{itemlost} });
186
        my $av = Koha::AuthorisedValues->get_description_by_koha_field(
181
        $lost = $av->count ? $av->next->lib : '';
187
            { kohafield => 'items.itemlost', authorised_value => $c->{itemlost} } );
188
        $lost            = $av->{lib} ? $av->{lib} : '';
182
        $claims_returned = $c->{itemlost} eq $claims_returned_lost_value;
189
        $claims_returned = $c->{itemlost} eq $claims_returned_lost_value;
183
    }
190
    }
184
    my $damaged;
191
    my $damaged;
185
    if ( $c->{damaged} ) {
192
    if ( $c->{damaged} ) {
186
        my $av = Koha::AuthorisedValues->search({ category => 'DAMAGED', authorised_value => $c->{damaged} });
193
        my $av = Koha::AuthorisedValues->get_description_by_koha_field(
187
        $damaged = $av->count ? $av->next->lib : '';
194
            { kohafield => 'items.damaged', authorised_value => $c->{damaged} } );
195
        $damaged = $av->{lib} ? $av->{lib} : '';
188
    }
196
    }
189
    my @subtitles = split(/ \| /, $c->{'subtitle'} // '' );
197
    my @subtitles = split(/ \| /, $c->{'subtitle'} // '' );
190
    my $checkout = {
198
    my $checkout = {
Lines 196-204 while ( my $c = $sth->fetchrow_hashref() ) { Link Here
196
        part_name            => $c->{part_name} // '',
204
        part_name            => $c->{part_name} // '',
197
        author               => $c->{author},
205
        author               => $c->{author},
198
        barcode              => $c->{barcode},
206
        barcode              => $c->{barcode},
199
        type_for_stat        => $type_for_stat ? $type_for_stat->translated_description : q{},
207
        type_for_stat          => $type_for_stat || q{},
200
        itemtype_description => $itemtype ? $itemtype->translated_description : q{},
208
        itemtype_description   => $itemtype || q{},
201
        recordtype_description => $recordtype ? $recordtype->translated_description : q{},
209
        recordtype_description => $recordtype || q{},
202
        collection           => $collection,
210
        collection           => $collection,
203
        location             => $location,
211
        location             => $location,
204
        homebranch           => $c->{homebranch},
212
        homebranch           => $c->{homebranch},
205
- 

Return to bug 26424