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

(-)a/catalogue/detail.pl (-58 / +6 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;
210
$dat->{'hiddencount'} = $dat->{'count'} - $dat->{'showncount'};
213
211
214
#is biblio a collection and are bundles enabled
212
#is biblio a collection and are bundles enabled
215
my $leader = $marc_record->leader();
213
my $leader = $marc_record->leader();
Lines 320-335 if ( defined $dat->{'itemtype'} ) { Link Here
320
    $dat->{imageurl} = getitemtypeimagelocation( 'intranet', $itemtypes->{ $dat->{itemtype} }->imageurl );
318
    $dat->{imageurl} = getitemtypeimagelocation( 'intranet', $itemtypes->{ $dat->{itemtype} }->imageurl );
321
}
319
}
322
320
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);
321
my (@itemloop, @otheritemloop, %itemfields);
334
322
335
my $mss = Koha::MarcSubfieldStructures->search({ frameworkcode => $fw, kohafield => 'items.itemlost', authorised_value => [ -and => {'!=' => undef }, {'!=' => ''}] });
323
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;
359
    my $item_info = $item->unblessed;
372
    $item_info->{itemtype} = $itemtypes->{$item->effective_itemtype};
360
    $item_info->{itemtype} = $itemtypes->{$item->effective_itemtype};
373
361
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 )) {
362
    foreach (qw(ccode enumchron copynumber stocknumber itemnotes itemnotes_nonpublic uri )) {
383
        $itemfields{$_} = 1 if $item->$_;
363
        $itemfields{$_} = 1 if $item->$_;
384
    }
364
    }
Lines 398-418 foreach my $item (@items) { Link Here
398
        $item_info->{first_hold} = $first_hold;
378
        $item_info->{first_hold} = $first_hold;
399
    }
379
    }
400
380
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
381
    #item has a host number if its biblio number does not match the current bib
417
382
418
    if ($item->biblionumber ne $biblionumber){
383
    if ($item->biblionumber ne $biblionumber){
Lines 444-466 foreach my $item (@items) { Link Here
444
409
445
    $item_info->{can_be_edited} = $patron->can_edit_items_from( $item->homebranch );
410
    $item_info->{can_be_edited} = $patron->can_edit_items_from( $item->homebranch );
446
411
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 ) {
412
    if ( $item->is_bundle ) {
465
        $item_info->{bundled} =
413
        $item_info->{bundled} =
466
          $item->bundle_items->search( { itemlost => { '!=' => 0 } } )
414
          $item->bundle_items->search( { itemlost => { '!=' => 0 } } )
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt (-46 / +39 lines)
Lines 382-388 Link Here
382
                        <td class="cover">
382
                        <td class="cover">
383
                            <div class="bookcoverimg">
383
                            <div class="bookcoverimg">
384
                                <div class="cover-slider">
384
                                <div class="cover-slider">
385
                                    [% FOREACH image IN item.cover_images %]
385
                                    [% FOREACH image IN item.object.cover_images %]
386
                                        <div class="cover-image local-coverimg">
386
                                        <div class="cover-image local-coverimg">
387
                                            <a href="/cgi-bin/koha/catalogue/image.pl?itemnumber=[% image.itemnumber | uri %]&amp;imagenumber=[% image.imagenumber | uri %]" title="Local cover image">
387
                                            <a href="/cgi-bin/koha/catalogue/image.pl?itemnumber=[% image.itemnumber | uri %]&amp;imagenumber=[% image.imagenumber | uri %]" title="Local cover image">
388
                                                <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 %]" />
388
                                                <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 407-428 Link Here
407
                    <td class="homebranch">
407
                    <td class="homebranch">
408
                        <span class="homebranchdesc">[% Branches.GetName(item.homebranch) | html %]</span>
408
                        <span class="homebranchdesc">[% Branches.GetName(item.homebranch) | html %]</span>
409
                        <span class="shelvingloc">
409
                        <span class="shelvingloc">
410
<!--
410
                    [%# If permanent location is defined, show description or code and
411
If permanent location is defined, show description or code and display current location in parentheses. If not, display current location.
411
                        display current location in parentheses. If not, display current location.
412
Note that permanent location is a code, and location may be an authval.
412
                        Note that permanent location is a code, and location may be an authval.
413
-->
413
                    %]
414
                            [% IF item.permanent_location %]
414
                            [% IF item.permanent_location %]
415
                                [% SET permloc_authval = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => item.permanent_location ) %]
415
                                [% SET permloc_authval = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => item.permanent_location ) %]
416
                                [% permloc_authval | html %]
416
                                [% permloc_authval | html %]
417
                                [% IF item.location AND item.location != permloc_authval AND item.location != item.permanent_location %]
417
                                [% SET item_location = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => item.location ) %]
418
                                    ([% item.location | html %])
418
                                [% IF item_location AND item_location != permloc_authval AND item.location != item.permanent_location %]
419
                                    ([% item_location | html %])
419
                                [% END %]
420
                                [% END %]
420
                            [% ELSE %]
421
                            [% ELSE %]
421
                                [% item.location | html %]
422
                                [% item_location | html %]
422
                            [% END %]
423
                            [% END %]
423
                        </span>
424
                        </span>
424
                    </td>
425
                    </td>
425
                    [% IF ( itemdata_ccode ) %]<td>[% item.ccode | html %]</td>[% END %]
426
                    [% IF ( itemdata_ccode ) %]<td>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => item.ccode ) | html %]</td>[% END %]
426
                    [% IF Koha.Preference('EnableItemGroups') %]<td class="item_group">[% item.object.item_group.description | html %]</td>[% END %]
427
                    [% IF Koha.Preference('EnableItemGroups') %]<td class="item_group">[% item.object.item_group.description | html %]</td>[% END %]
427
                    <td class="itemcallnumber">[% IF ( item.itemcallnumber ) %] [% item.itemcallnumber | html %][% END %]</td>
428
                    <td class="itemcallnumber">[% IF ( item.itemcallnumber ) %] [% item.itemcallnumber | html %][% END %]</td>
428
                    [% IF ( volinfo ) %]
429
                    [% IF ( volinfo ) %]
Lines 453-514 Note that permanent location is a code, and location may be an authval. Link Here
453
                    [% END %]
454
                    [% END %]
454
                    <td class="status">
455
                    <td class="status">
455
456
456
                        [% IF item.checkout %]
457
                        [% IF item.object.checkout %]
457
                          [% IF item.checkout.onsite_checkout %]
458
                          [% IF item.object.checkout.onsite_checkout %]
458
                            <span>Currently in local use
459
                            <span>Currently in local use
459
                          [% ELSE %]
460
                          [% ELSE %]
460
                            <span class="datedue">Checked out
461
                            <span class="datedue">Checked out
461
                          [% END %]
462
                          [% END %]
462
                                [% UNLESS ( item.not_same_branch) %]
463
                                [% IF item.can_be_edited %]
463
                                  [% IF item.checkout.onsite_checkout %]
464
                                  [% IF item.object.checkout.onsite_checkout %]
464
                                    by
465
                                    by
465
                                  [% ELSE %]
466
                                  [% ELSE %]
466
                                    to
467
                                    to
467
                                  [% END %]
468
                                  [% END %]
468
                                  [% INCLUDE 'patron-title.inc' patron=item.checkout.patron hide_patron_infos_if_needed=1 %]
469
                                  [% INCLUDE 'patron-title.inc' patron=item.object.checkout.patron hide_patron_infos_if_needed=1 %]
469
                                [% END %]
470
                                [% END %]
470
                                : due [% item.checkout.date_due | $KohaDates as_due_date => 1 %]
471
                                : due [% item.object.checkout.date_due | $KohaDates as_due_date => 1 %]
471
                            </span>
472
                            </span>
472
                        [% ELSIF ( item.transfer ) %]
473
                        [% ELSIF ( transfer = item.object.get_transfer ) %]
473
                            [% IF (item.transfer.datesent) %]
474
                            [% IF (transfer.datesent) %]
474
                                <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>
475
                                <span class="intransit">In transit from [% Branches.GetName( transfer.frombranch ) | html %] to [% Branches.GetName( transfer.tobranch ) | html %] since [% transfer.datesent | $KohaDates %]</span>
475
                            [% ELSE %]
476
                            [% ELSE %]
476
                                <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>
477
                                <span class="transitrequested">Transit pending from [% Branches.GetName( transfer.frombranch ) | html %] to [% Branches.GetName( transfer.tobranch ) | html %] since [% item.transfer.daterequested | $KohaDates %]</span>
477
478
478
                            [% END %]
479
                            [% END %]
479
                        [% END %]
480
                        [% END %]
480
481
481
                        [% IF ( item.itemlost ) %]
482
                        [% IF ( item.itemlost ) %]
483
                            [% SET itemlost_description = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.itemlost', authorised_value => item.itemlost ) %]
482
                            [% IF itemlostloop %]
484
                            [% IF itemlostloop %]
483
                                [% FOREACH itemlostloo IN itemlostloop %]
485
                                <span class="lost">[% itemlost_description | html %]</span>
484
                                    [% IF itemlostloo.authorised_value == item.itemlost %]
485
                                        <span class="lost">[% itemlostloo.lib | html %]</span>
486
                                    [% END %]
487
                                [% END %]
488
                            [% ELSE %]
486
                            [% ELSE %]
489
                                <span class="lost">Unavailable (lost or missing)</span>
487
                                <span class="lost">Unavailable (lost or missing)</span>
490
                            [% END %]
488
                            [% END %]
491
                        [% END %]
489
                        [% END %]
492
490
493
                        [% IF ( item.withdrawn ) %]
491
                        [% IF ( item.withdrawn ) %]
494
                            [% IF itemwithdrawnloop %]
492
                            [% SET withdrawn_description = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.withdrawn', authorised_value => item.withdrawn ) %]
495
                                [% FOREACH itemwithdrawnloo IN itemwithdrawnloop %]
493
                            [% IF withdrawn_description %]
496
                                    [% IF itemwithdrawnloo.authorised_value == item.withdrawn %]
494
                                <span class="wdn">[% withdrawn_description | html %]</span>
497
                                        <span class="wdn">[% itemwithdrawnloo.lib | html %]</span>
498
                                    [% END %]
499
                                [% END %]
500
                            [% ELSE %]
495
                            [% ELSE %]
501
                                <span class="wdn">Withdrawn</span>
496
                                <span class="wdn">Withdrawn</span>
502
                            [% END %]
497
                            [% END %]
503
                        [% END %]
498
                        [% END %]
504
499
505
                        [% IF ( item.damaged ) %]
500
                        [% IF ( item.damaged ) %]
506
                            [% IF itemdamagedloop %]
501
                            [% SET damaged_description = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.damaged', authorised_value => item.damaged ) %]
507
                                [% FOREACH itemdamagedloo IN itemdamagedloop %]
502
                            [% IF damaged_description %]
508
                                    [% IF itemdamagedloo.authorised_value == item.damaged %]
503
                                <span class="dmg">[% damaged_description | html %]</span>
509
                                        <span class="dmg">[% itemdamagedloo.lib | html %]</span>
510
                                    [% END %]
511
                                [% END %]
512
                            [% ELSE %]
504
                            [% ELSE %]
513
                                <span class="dmg">Damaged</span>
505
                                <span class="dmg">Damaged</span>
514
                            [% END %]
506
                            [% END %]
Lines 536-548 Note that permanent location is a code, and location may be an authval. Link Here
536
                            [% END %]
528
                            [% END %]
537
                        [% END %]
529
                        [% END %]
538
530
539
                        [% SET recall = item.recall %]
531
                        [% IF Koha.Preference('UseRecalls') %]
540
                        [% IF recall %]
532
                            [% SET recall = item.object.recall %]
541
                            [% IF recall.waiting_date %]
533
                            [% IF recall %]
542
                                <span>Waiting at [% Branches.GetName( recall.pickup_library_id ) | html %] since [% recall.waiting_date | $KohaDates %]</span>
534
                                [% IF recall.waiting_date %]
543
                            [% ELSE %]
535
                                    <span>Waiting at [% Branches.GetName( recall.pickup_library_id ) | html %] since [% recall.waiting_date | $KohaDates %]</span>
544
                                [% 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 %]
536
                                [% ELSE %]
545
                                <span>recalled by [% patron_link| $raw %] on [% recall.created_date | $KohaDates %]</span>
537
                                    [% 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 %]
538
                                    <span>recalled by [% patron_link| $raw %] on [% recall.created_date | $KohaDates %]</span>
539
                                [% END %]
546
                            [% END %]
540
                            [% END %]
547
                        [% END %]
541
                        [% END %]
548
542
Lines 579-585 Note that permanent location is a code, and location may be an authval. Link Here
579
                        [% END %]
573
                        [% END %]
580
                    [% END %]
574
                    [% END %]
581
                    [% IF ( itemdata_copynumber ) %]
575
                    [% IF ( itemdata_copynumber ) %]
582
                        <td class="copynumber">[% item.copynumber | html %]</td>
576
                        <td class="copynumber">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.copynumber', authorised_value => item.copynumber ) | html %]</td>
583
                    [% END %]
577
                    [% END %]
584
                    [% IF ( itemdata_stocknumber ) %]
578
                    [% IF ( itemdata_stocknumber ) %]
585
                        <td class="stocknumber">[% item.stocknumber | html %]</td>
579
                        <td class="stocknumber">[% item.stocknumber | html %]</td>
Lines 588-594 Note that permanent location is a code, and location may be an authval. Link Here
588
                        <td class="materials"> [% item.materials | html %] </td>
582
                        <td class="materials"> [% item.materials | html %] </td>
589
                    [% END %]
583
                    [% END %]
590
                    [% IF ( itemdata_itemnotes ) %]
584
                    [% IF ( itemdata_itemnotes ) %]
591
                        <td><div class="itemnotes">[% item.itemnotes | $raw %]</div></td>
585
                        <td><div class="itemnotes">[% item.object.itemnotes.replace('\n','<br />') | $raw %]</div></td>
592
                    [% END %]
586
                    [% END %]
593
                    [% IF itemdata_nonpublicnotes %]
587
                    [% IF itemdata_nonpublicnotes %]
594
                        <td class="nonpublicnote">[% item.itemnotes_nonpublic | html %]</td>
588
                        <td class="nonpublicnote">[% item.itemnotes_nonpublic | html %]</td>
595
- 

Return to bug 33167