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

(-)a/catalogue/detail.pl (-58 / +8 lines)
Lines 190-204 $template->param( Link Here
190
);
190
);
191
191
192
my $itemtypes = { map { $_->itemtype => $_ } @{ Koha::ItemTypes->search_with_localization->as_list } };
192
my $itemtypes = { map { $_->itemtype => $_ } @{ Koha::ItemTypes->search_with_localization->as_list } };
193
my $all_items = $biblio->items->search_ordered;
193
my $params;
194
my @items;
195
my $patron = Koha::Patrons->find( $borrowernumber );
194
my $patron = Koha::Patrons->find( $borrowernumber );
196
while ( my $item = $all_items->next ) {
195
$params->{ itemlost } = 0 if $patron->category->hidelostitems && !$showallitems;
197
    push @items, $item
196
my @items = $biblio->items->search_ordered( $params )->as_list;
198
      unless $item->itemlost
199
      && $patron->category->hidelostitems
200
      && !$showallitems;
201
}
202
197
203
# flag indicating existence of at least one item linked via a host record
198
# flag indicating existence of at least one item linked via a host record
204
my $hostrecords;
199
my $hostrecords;
Lines 210-215 if ( $hostitems->count ) { Link Here
210
}
205
}
211
206
212
my $dat = &GetBiblioData($biblionumber);
207
my $dat = &GetBiblioData($biblionumber);
208
$dat->{'count'} = $biblio->items->count + $hostitems->count;
209
$dat->{'showncount'} = scalar @items + $hostitems->count;
210
$dat->{'hiddencount'} = $dat->{'count'} - $dat->{'showncount'};
211
212
213
213
214
#is biblio a collection and are bundles enabled
214
#is biblio a collection and are bundles enabled
215
my $leader = $marc_record->leader();
215
my $leader = $marc_record->leader();
Lines 320-335 if ( defined $dat->{'itemtype'} ) { Link Here
320
    $dat->{imageurl} = getitemtypeimagelocation( 'intranet', $itemtypes->{ $dat->{itemtype} }->imageurl );
320
    $dat->{imageurl} = getitemtypeimagelocation( 'intranet', $itemtypes->{ $dat->{itemtype} }->imageurl );
321
}
321
}
322
322
323
$dat->{'count'} = $all_items->count + $hostitems->count;
324
$dat->{'showncount'} = scalar @items + $hostitems->count;
325
$dat->{'hiddencount'} = $all_items->count + $hostitems->count - scalar @items;
326
327
my $shelflocations =
328
  { map { $_->{authorised_value} => $_->{lib} } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => $fw, kohafield => 'items.location' } ) };
329
my $collections =
330
  { map { $_->{authorised_value} => $_->{lib} } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => $fw, kohafield => 'items.ccode' } ) };
331
my $copynumbers =
332
  { map { $_->{authorised_value} => $_->{lib} } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => $fw, kohafield => 'items.copynumber' } ) };
333
my (@itemloop, @otheritemloop, %itemfields);
323
my (@itemloop, @otheritemloop, %itemfields);
334
324
335
my $mss = Koha::MarcSubfieldStructures->search({ frameworkcode => $fw, kohafield => 'items.itemlost', authorised_value => [ -and => {'!=' => undef }, {'!=' => ''}] });
325
my $mss = Koha::MarcSubfieldStructures->search({ frameworkcode => $fw, kohafield => 'items.itemlost', authorised_value => [ -and => {'!=' => undef }, {'!=' => ''}] });
Lines 371-384 foreach my $item (@items) { Link Here
371
    my $item_info = $item->unblessed;
361
    my $item_info = $item->unblessed;
372
    $item_info->{itemtype} = $itemtypes->{$item->effective_itemtype};
362
    $item_info->{itemtype} = $itemtypes->{$item->effective_itemtype};
373
363
374
    #get shelf location and collection code description if they are authorised value.
375
    # same thing for copy number
376
    my $shelfcode = $item->location;
377
    $item_info->{'location'} = $shelflocations->{$shelfcode} if ( defined( $shelfcode ) && defined($shelflocations) && exists( $shelflocations->{$shelfcode} ) );
378
    my $ccode = $item->ccode;
379
    $item_info->{'ccode'} = $collections->{$ccode} if ( defined( $ccode ) && defined($collections) && exists( $collections->{$ccode} ) );
380
    my $copynumber = $item->copynumber;
381
    $item_info->{'copynumber'} = $copynumbers->{$copynumber} if ( defined($copynumber) && defined($copynumbers) && exists( $copynumbers->{$copynumber} ) );
382
    foreach (qw(ccode enumchron copynumber stocknumber itemnotes itemnotes_nonpublic uri )) {
364
    foreach (qw(ccode enumchron copynumber stocknumber itemnotes itemnotes_nonpublic uri )) {
383
        $itemfields{$_} = 1 if $item->$_;
365
        $itemfields{$_} = 1 if $item->$_;
384
    }
366
    }
Lines 398-418 foreach my $item (@items) { Link Here
398
        $item_info->{first_hold} = $first_hold;
380
        $item_info->{first_hold} = $first_hold;
399
    }
381
    }
400
382
401
    $item_info->{checkout} = $item->checkout;
402
403
    # Check the transit status
404
    my $transfer = $item->get_transfer;
405
    if ( $transfer ) {
406
        $item_info->{transfer} = $transfer;
407
    }
408
409
    foreach my $f (qw( itemnotes )) {
410
        if ($item_info->{$f}) {
411
            $item_info->{$f} =~ s|\n|<br />|g;
412
            $itemfields{$f} = 1;
413
        }
414
    }
415
416
    #item has a host number if its biblio number does not match the current bib
383
    #item has a host number if its biblio number does not match the current bib
417
384
418
    if ($item->biblionumber ne $biblionumber){
385
    if ($item->biblionumber ne $biblionumber){
Lines 444-466 foreach my $item (@items) { Link Here
444
411
445
    $item_info->{can_be_edited} = $patron->can_edit_items_from( $item->homebranch );
412
    $item_info->{can_be_edited} = $patron->can_edit_items_from( $item->homebranch );
446
413
447
    if ( C4::Context->preference("LocalCoverImages") == 1 ) {
448
        $item_info->{cover_images} = $item->cover_images;
449
    }
450
451
    if ( C4::Context->preference('UseRecalls') ) {
452
        $item_info->{recall} = $item->recall;
453
    }
454
455
    if ( C4::Context->preference('IndependentBranches') ) {
456
        my $userenv = C4::Context->userenv();
457
        if ( not C4::Context->IsSuperLibrarian()
458
            and $userenv->{branch} ne $item->homebranch ) {
459
            $item_info->{cannot_be_edited} = 1;
460
            $item_info->{not_same_branch} = 1;
461
        }
462
    }
463
464
    if ( $item->is_bundle ) {
414
    if ( $item->is_bundle ) {
465
        $item_info->{bundled} =
415
        $item_info->{bundled} =
466
          $item->bundle_items->search( { itemlost => { '!=' => 0 } } )
416
          $item->bundle_items->search( { itemlost => { '!=' => 0 } } )
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt (-44 / +37 lines)
Lines 391-397 Link Here
391
                        <td class="cover">
391
                        <td class="cover">
392
                            <div class="bookcoverimg">
392
                            <div class="bookcoverimg">
393
                                <div class="cover-slider">
393
                                <div class="cover-slider">
394
                                    [% FOREACH image IN item.cover_images %]
394
                                    [% FOREACH image IN item.object.cover_images %]
395
                                        <div class="cover-image local-coverimg">
395
                                        <div class="cover-image local-coverimg">
396
                                            <a href="/cgi-bin/koha/catalogue/image.pl?itemnumber=[% image.itemnumber | uri %]&amp;imagenumber=[% image.imagenumber | uri %]" title="Local cover image">
396
                                            <a href="/cgi-bin/koha/catalogue/image.pl?itemnumber=[% image.itemnumber | uri %]&amp;imagenumber=[% image.imagenumber | uri %]" title="Local cover image">
397
                                                <img src="/cgi-bin/koha/catalogue/image.pl?thumbnail=1&amp;imagenumber=[% image.imagenumber | uri %]" alt="Local cover image" data-link="/cgi-bin/koha/catalogue/imageviewer.pl?itemnumber=[% item.itemnumber | uri %]&amp;imagenumber=[% image.imagenumber | uri %]" />
397
                                                <img src="/cgi-bin/koha/catalogue/image.pl?thumbnail=1&amp;imagenumber=[% image.imagenumber | uri %]" alt="Local cover image" data-link="/cgi-bin/koha/catalogue/imageviewer.pl?itemnumber=[% item.itemnumber | uri %]&amp;imagenumber=[% image.imagenumber | uri %]" />
Lines 416-437 Link Here
416
                    <td class="homebranch">
416
                    <td class="homebranch">
417
                        <span class="homebranchdesc">[% Branches.GetName(item.homebranch) | html %]</span>
417
                        <span class="homebranchdesc">[% Branches.GetName(item.homebranch) | html %]</span>
418
                        <span class="shelvingloc">
418
                        <span class="shelvingloc">
419
<!--
419
                    [%# If permanent location is defined, show description or code and
420
If permanent location is defined, show description or code and display current location in parentheses. If not, display current location.
420
                        display current location in parentheses. If not, display current location.
421
Note that permanent location is a code, and location may be an authval.
421
                        Note that permanent location is a code, and location may be an authval.
422
-->
422
                    %]
423
                            [% IF item.permanent_location %]
423
                            [% IF item.permanent_location %]
424
                                [% SET permloc_authval = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => item.permanent_location ) %]
424
                                [% SET permloc_authval = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => item.permanent_location ) %]
425
                                [% permloc_authval | html %]
425
                                [% permloc_authval | html %]
426
                                [% IF item.location AND item.location != permloc_authval AND item.location != item.permanent_location %]
426
                                [% SET item_locatoin = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => item.location ) %]
427
                                    ([% item.location | html %])
427
                                [% IF item_location AND item_location != permloc_authval AND item.location != item.permanent_location %]
428
                                    ([% item_location | html %])
428
                                [% END %]
429
                                [% END %]
429
                            [% ELSE %]
430
                            [% ELSE %]
430
                                [% item.location | html %]
431
                                [% item_location | html %]
431
                            [% END %]
432
                            [% END %]
432
                        </span>
433
                        </span>
433
                    </td>
434
                    </td>
434
                    [% IF ( itemdata_ccode ) %]<td>[% item.ccode | html %]</td>[% END %]
435
                    [% IF ( itemdata_ccode ) %]<td>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => item.ccode ) | html %]</td>[% END %]
435
                    [% IF Koha.Preference('EnableItemGroups') %]<td class="item_group">[% item.object.item_group.description | html %]</td>[% END %]
436
                    [% IF Koha.Preference('EnableItemGroups') %]<td class="item_group">[% item.object.item_group.description | html %]</td>[% END %]
436
                    <td class="itemcallnumber">[% IF ( item.itemcallnumber ) %] [% item.itemcallnumber | html %][% END %]</td>
437
                    <td class="itemcallnumber">[% IF ( item.itemcallnumber ) %] [% item.itemcallnumber | html %][% END %]</td>
437
                    [% IF ( volinfo ) %]
438
                    [% IF ( volinfo ) %]
Lines 462-523 Note that permanent location is a code, and location may be an authval. Link Here
462
                    [% END %]
463
                    [% END %]
463
                    <td class="status">
464
                    <td class="status">
464
465
465
                        [% IF item.checkout %]
466
                        [% IF item.object.checkout %]
466
                          [% IF item.checkout.onsite_checkout %]
467
                          [% IF item.checkout.onsite_checkout %]
467
                            <span>Currently in local use
468
                            <span>Currently in local use
468
                          [% ELSE %]
469
                          [% ELSE %]
469
                            <span class="datedue">Checked out
470
                            <span class="datedue">Checked out
470
                          [% END %]
471
                          [% END %]
471
                                [% UNLESS ( item.not_same_branch) %]
472
                                [% IF item.can_be_edited %]
472
                                  [% IF item.checkout.onsite_checkout %]
473
                                  [% IF item.object.checkout.onsite_checkout %]
473
                                    by
474
                                    by
474
                                  [% ELSE %]
475
                                  [% ELSE %]
475
                                    to
476
                                    to
476
                                  [% END %]
477
                                  [% END %]
477
                                  [% INCLUDE 'patron-title.inc' patron=item.checkout.patron hide_patron_infos_if_needed=1 %]
478
                                  [% INCLUDE 'patron-title.inc' patron=item.checkout.patron hide_patron_infos_if_needed=1 %]
478
                                [% END %]
479
                                [% END %]
479
                                : due [% item.checkout.date_due | $KohaDates as_due_date => 1 %]
480
                                : due [% item.object.checkout.date_due | $KohaDates as_due_date => 1 %]
480
                            </span>
481
                            </span>
481
                        [% ELSIF ( item.transfer ) %]
482
                        [% ELSIF ( transfer = item.object.get_transfer ) %]
482
                            [% IF (item.transfer.datesent) %]
483
                            [% IF (transfer.datesent) %]
483
                                <span class="intransit">In transit from [% Branches.GetName( item.transfer.frombranch ) | html %] to [% Branches.GetName( item.transfer.tobranch ) | html %] since [% item.transfer.datesent | $KohaDates %]</span>
484
                                <span class="intransit">In transit from [% Branches.GetName( transfer.frombranch ) | html %] to [% Branches.GetName( transfer.tobranch ) | html %] since [% transfer.datesent | $KohaDates %]</span>
484
                            [% ELSE %]
485
                            [% ELSE %]
485
                                <span class="transitrequested">Transit pending from [% Branches.GetName( item.transfer.frombranch ) | html %] to [% Branches.GetName( item.transfer.tobranch ) | html %] since [% item.transfer.daterequested | $KohaDates %]</span>
486
                                <span class="transitrequested">Transit pending from [% Branches.GetName( transfer.frombranch ) | html %] to [% Branches.GetName( transfer.tobranch ) | html %] since [% item.transfer.daterequested | $KohaDates %]</span>
486
487
487
                            [% END %]
488
                            [% END %]
488
                        [% END %]
489
                        [% END %]
489
490
490
                        [% IF ( item.itemlost ) %]
491
                        [% IF ( item.itemlost ) %]
492
                            [% SET itemlost_description = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.itemlost', authorised_value => item.itemlost ) %]
491
                            [% IF itemlostloop %]
493
                            [% IF itemlostloop %]
492
                                [% FOREACH itemlostloo IN itemlostloop %]
494
                                <span class="lost">[% itemlost_description | html %]</span>
493
                                    [% IF itemlostloo.authorised_value == item.itemlost %]
494
                                        <span class="lost">[% itemlostloo.lib | html %]</span>
495
                                    [% END %]
496
                                [% END %]
497
                            [% ELSE %]
495
                            [% ELSE %]
498
                                <span class="lost">Unavailable (lost or missing)</span>
496
                                <span class="lost">Unavailable (lost or missing)</span>
499
                            [% END %]
497
                            [% END %]
500
                        [% END %]
498
                        [% END %]
501
499
502
                        [% IF ( item.withdrawn ) %]
500
                        [% IF ( item.withdrawn ) %]
503
                            [% IF itemwithdrawnloop %]
501
                            [% SET withdrawn_description = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.withdrawn', authorised_value => item.withdrawn ) %]
504
                                [% FOREACH itemwithdrawnloo IN itemwithdrawnloop %]
502
                            [% IF withdrawn_description %]
505
                                    [% IF itemwithdrawnloo.authorised_value == item.withdrawn %]
503
                                <span class="wdn">[% withdrawn_description | html %]</span>
506
                                        <span class="wdn">[% itemwithdrawnloo.lib | html %]</span>
507
                                    [% END %]
508
                                [% END %]
509
                            [% ELSE %]
504
                            [% ELSE %]
510
                                <span class="wdn">Withdrawn</span>
505
                                <span class="wdn">Withdrawn</span>
511
                            [% END %]
506
                            [% END %]
512
                        [% END %]
507
                        [% END %]
513
508
514
                        [% IF ( item.damaged ) %]
509
                        [% IF ( item.damaged ) %]
515
                            [% IF itemdamagedloop %]
510
                            [% SET damaged_description = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.damaged', authorised_value => item.damaged ) %]
516
                                [% FOREACH itemdamagedloo IN itemdamagedloop %]
511
                            [% IF damaged_description %]
517
                                    [% IF itemdamagedloo.authorised_value == item.damaged %]
512
                                <span class="dmg">[% damaged_description | html %]</span>
518
                                        <span class="dmg">[% itemdamagedloo.lib | html %]</span>
519
                                    [% END %]
520
                                [% END %]
521
                            [% ELSE %]
513
                            [% ELSE %]
522
                                <span class="dmg">Damaged</span>
514
                                <span class="dmg">Damaged</span>
523
                            [% END %]
515
                            [% END %]
Lines 545-557 Note that permanent location is a code, and location may be an authval. Link Here
545
                            [% END %]
537
                            [% END %]
546
                        [% END %]
538
                        [% END %]
547
539
548
                        [% SET recall = item.recall %]
540
                        [% IF Koha.Preference('UseRecalls') %]
549
                        [% IF recall %]
541
                            [% SET recall = item.object.recall %]
550
                            [% IF recall.waiting_date %]
542
                            [% IF recall %]
551
                                <span>Waiting at [% Branches.GetName( recall.pickup_library_id ) | html %] since [% recall.waiting_date | $KohaDates %]</span>
543
                                [% IF recall.waiting_date %]
552
                            [% ELSE %]
544
                                    <span>Waiting at [% Branches.GetName( recall.pickup_library_id ) | html %] since [% recall.waiting_date | $KohaDates %]</span>
553
                                [% patron_link = BLOCK %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% recall.patron_id | uri %]">[% recall.patron.firstname | html %] [% recall.patron.surname | html %] ([% recall.patron.cardnumber | html %])</a>[% END %]
545
                                [% ELSE %]
554
                                <span>recalled by [% patron_link| $raw %] on [% recall.created_date | $KohaDates %]</span>
546
                                    [% patron_link = BLOCK %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% recall.patron_id | uri %]">[% recall.patron.firstname | html %] [% recall.patron.surname | html %] ([% recall.patron.cardnumber | html %])</a>[% END %]
547
                                    <span>recalled by [% patron_link| $raw %] on [% recall.created_date | $KohaDates %]</span>
548
                                [% END %]
555
                            [% END %]
549
                            [% END %]
556
                        [% END %]
550
                        [% END %]
557
551
Lines 588-594 Note that permanent location is a code, and location may be an authval. Link Here
588
                        [% END %]
582
                        [% END %]
589
                    [% END %]
583
                    [% END %]
590
                    [% IF ( itemdata_copynumber ) %]
584
                    [% IF ( itemdata_copynumber ) %]
591
                        <td class="copynumber">[% item.copynumber | html %]</td>
585
                        <td class="copynumber">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.copynumber', authorised_value => item.copynumber ) | html %]</td>
592
                    [% END %]
586
                    [% END %]
593
                    [% IF ( itemdata_stocknumber ) %]
587
                    [% IF ( itemdata_stocknumber ) %]
594
                        <td class="stocknumber">[% item.stocknumber | html %]</td>
588
                        <td class="stocknumber">[% item.stocknumber | html %]</td>
Lines 597-603 Note that permanent location is a code, and location may be an authval. Link Here
597
                        <td class="materials"> [% item.materials | html %] </td>
591
                        <td class="materials"> [% item.materials | html %] </td>
598
                    [% END %]
592
                    [% END %]
599
                    [% IF ( itemdata_itemnotes ) %]
593
                    [% IF ( itemdata_itemnotes ) %]
600
                        <td><div class="itemnotes">[% item.itemnotes | $raw %]</div></td>
594
                        <td><div class="itemnotes">[% item.object.itemnotes.replace('\n','<br />') | $raw %]</div></td>
601
                    [% END %]
595
                    [% END %]
602
                    [% IF itemdata_nonpublicnotes %]
596
                    [% IF itemdata_nonpublicnotes %]
603
                        <td class="nonpublicnote">[% item.itemnotes_nonpublic | html %]</td>
597
                        <td class="nonpublicnote">[% item.itemnotes_nonpublic | html %]</td>
604
- 

Return to bug 33167