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 386-392 Link Here
386
                        <td class="cover">
386
                        <td class="cover">
387
                            <div class="bookcoverimg">
387
                            <div class="bookcoverimg">
388
                                <div class="cover-slider">
388
                                <div class="cover-slider">
389
                                    [% FOREACH image IN item.cover_images %]
389
                                    [% FOREACH image IN item.object.cover_images %]
390
                                        <div class="cover-image local-coverimg">
390
                                        <div class="cover-image local-coverimg">
391
                                            <a href="/cgi-bin/koha/catalogue/image.pl?itemnumber=[% image.itemnumber | uri %]&amp;imagenumber=[% image.imagenumber | uri %]" title="Local cover image">
391
                                            <a href="/cgi-bin/koha/catalogue/image.pl?itemnumber=[% image.itemnumber | uri %]&amp;imagenumber=[% image.imagenumber | uri %]" title="Local cover image">
392
                                                <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 %]" />
392
                                                <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 411-432 Link Here
411
                    <td class="homebranch">
411
                    <td class="homebranch">
412
                        <span class="homebranchdesc">[% Branches.GetName(item.homebranch) | html %]</span>
412
                        <span class="homebranchdesc">[% Branches.GetName(item.homebranch) | html %]</span>
413
                        <span class="shelvingloc">
413
                        <span class="shelvingloc">
414
<!--
414
                    [%# If permanent location is defined, show description or code and
415
If permanent location is defined, show description or code and display current location in parentheses. If not, display current location.
415
                        display current location in parentheses. If not, display current location.
416
Note that permanent location is a code, and location may be an authval.
416
                        Note that permanent location is a code, and location may be an authval.
417
-->
417
                    %]
418
                            [% IF item.permanent_location %]
418
                            [% IF item.permanent_location %]
419
                                [% SET permloc_authval = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => item.permanent_location ) %]
419
                                [% SET permloc_authval = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => item.permanent_location ) %]
420
                                [% permloc_authval | html %]
420
                                [% permloc_authval | html %]
421
                                [% IF item.location AND item.location != permloc_authval AND item.location != item.permanent_location %]
421
                                [% SET item_location = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => item.location ) %]
422
                                    ([% item.location | html %])
422
                                [% IF item_location AND item_location != permloc_authval AND item.location != item.permanent_location %]
423
                                    ([% item_location | html %])
423
                                [% END %]
424
                                [% END %]
424
                            [% ELSE %]
425
                            [% ELSE %]
425
                                [% item.location | html %]
426
                                [% item_location | html %]
426
                            [% END %]
427
                            [% END %]
427
                        </span>
428
                        </span>
428
                    </td>
429
                    </td>
429
                    [% IF ( itemdata_ccode ) %]<td>[% item.ccode | html %]</td>[% END %]
430
                    [% IF ( itemdata_ccode ) %]<td>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => item.ccode ) | html %]</td>[% END %]
430
                    [% IF Koha.Preference('EnableItemGroups') %]<td class="item_group">[% item.object.item_group.description | html %]</td>[% END %]
431
                    [% IF Koha.Preference('EnableItemGroups') %]<td class="item_group">[% item.object.item_group.description | html %]</td>[% END %]
431
                    <td class="itemcallnumber">[% IF ( item.itemcallnumber ) %] [% item.itemcallnumber | html %][% END %]</td>
432
                    <td class="itemcallnumber">[% IF ( item.itemcallnumber ) %] [% item.itemcallnumber | html %][% END %]</td>
432
                    [% IF ( volinfo ) %]
433
                    [% IF ( volinfo ) %]
Lines 457-518 Note that permanent location is a code, and location may be an authval. Link Here
457
                    [% END %]
458
                    [% END %]
458
                    <td class="status">
459
                    <td class="status">
459
460
460
                        [% IF item.checkout %]
461
                        [% IF item.object.checkout %]
461
                          [% IF item.checkout.onsite_checkout %]
462
                          [% IF item.object.checkout.onsite_checkout %]
462
                            <span>Currently in local use
463
                            <span>Currently in local use
463
                          [% ELSE %]
464
                          [% ELSE %]
464
                            <span class="datedue">Checked out
465
                            <span class="datedue">Checked out
465
                          [% END %]
466
                          [% END %]
466
                                [% UNLESS ( item.not_same_branch) %]
467
                                [% IF item.can_be_edited %]
467
                                  [% IF item.checkout.onsite_checkout %]
468
                                  [% IF item.object.checkout.onsite_checkout %]
468
                                    by
469
                                    by
469
                                  [% ELSE %]
470
                                  [% ELSE %]
470
                                    to
471
                                    to
471
                                  [% END %]
472
                                  [% END %]
472
                                  [% INCLUDE 'patron-title.inc' patron=item.checkout.patron hide_patron_infos_if_needed=1 %]
473
                                  [% INCLUDE 'patron-title.inc' patron=item.object.checkout.patron hide_patron_infos_if_needed=1 %]
473
                                [% END %]
474
                                [% END %]
474
                                : due [% item.checkout.date_due | $KohaDates as_due_date => 1 %]
475
                                : due [% item.object.checkout.date_due | $KohaDates as_due_date => 1 %]
475
                            </span>
476
                            </span>
476
                        [% ELSIF ( item.transfer ) %]
477
                        [% ELSIF ( transfer = item.object.get_transfer ) %]
477
                            [% IF (item.transfer.datesent) %]
478
                            [% IF (transfer.datesent) %]
478
                                <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>
479
                                <span class="intransit">In transit from [% Branches.GetName( transfer.frombranch ) | html %] to [% Branches.GetName( transfer.tobranch ) | html %] since [% transfer.datesent | $KohaDates %]</span>
479
                            [% ELSE %]
480
                            [% ELSE %]
480
                                <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>
481
                                <span class="transitrequested">Transit pending from [% Branches.GetName( transfer.frombranch ) | html %] to [% Branches.GetName( transfer.tobranch ) | html %] since [% item.transfer.daterequested | $KohaDates %]</span>
481
482
482
                            [% END %]
483
                            [% END %]
483
                        [% END %]
484
                        [% END %]
484
485
485
                        [% IF ( item.itemlost ) %]
486
                        [% IF ( item.itemlost ) %]
487
                            [% SET itemlost_description = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.itemlost', authorised_value => item.itemlost ) %]
486
                            [% IF itemlostloop %]
488
                            [% IF itemlostloop %]
487
                                [% FOREACH itemlostloo IN itemlostloop %]
489
                                <span class="lost">[% itemlost_description | html %]</span>
488
                                    [% IF itemlostloo.authorised_value == item.itemlost %]
489
                                        <span class="lost">[% itemlostloo.lib | html %]</span>
490
                                    [% END %]
491
                                [% END %]
492
                            [% ELSE %]
490
                            [% ELSE %]
493
                                <span class="lost">Unavailable (lost or missing)</span>
491
                                <span class="lost">Unavailable (lost or missing)</span>
494
                            [% END %]
492
                            [% END %]
495
                        [% END %]
493
                        [% END %]
496
494
497
                        [% IF ( item.withdrawn ) %]
495
                        [% IF ( item.withdrawn ) %]
498
                            [% IF itemwithdrawnloop %]
496
                            [% SET withdrawn_description = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.withdrawn', authorised_value => item.withdrawn ) %]
499
                                [% FOREACH itemwithdrawnloo IN itemwithdrawnloop %]
497
                            [% IF withdrawn_description %]
500
                                    [% IF itemwithdrawnloo.authorised_value == item.withdrawn %]
498
                                <span class="wdn">[% withdrawn_description | html %]</span>
501
                                        <span class="wdn">[% itemwithdrawnloo.lib | html %]</span>
502
                                    [% END %]
503
                                [% END %]
504
                            [% ELSE %]
499
                            [% ELSE %]
505
                                <span class="wdn">Withdrawn</span>
500
                                <span class="wdn">Withdrawn</span>
506
                            [% END %]
501
                            [% END %]
507
                        [% END %]
502
                        [% END %]
508
503
509
                        [% IF ( item.damaged ) %]
504
                        [% IF ( item.damaged ) %]
510
                            [% IF itemdamagedloop %]
505
                            [% SET damaged_description = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.damaged', authorised_value => item.damaged ) %]
511
                                [% FOREACH itemdamagedloo IN itemdamagedloop %]
506
                            [% IF damaged_description %]
512
                                    [% IF itemdamagedloo.authorised_value == item.damaged %]
507
                                <span class="dmg">[% damaged_description | html %]</span>
513
                                        <span class="dmg">[% itemdamagedloo.lib | html %]</span>
514
                                    [% END %]
515
                                [% END %]
516
                            [% ELSE %]
508
                            [% ELSE %]
517
                                <span class="dmg">Damaged</span>
509
                                <span class="dmg">Damaged</span>
518
                            [% END %]
510
                            [% END %]
Lines 540-552 Note that permanent location is a code, and location may be an authval. Link Here
540
                            [% END %]
532
                            [% END %]
541
                        [% END %]
533
                        [% END %]
542
534
543
                        [% SET recall = item.recall %]
535
                        [% IF Koha.Preference('UseRecalls') %]
544
                        [% IF recall %]
536
                            [% SET recall = item.object.recall %]
545
                            [% IF recall.waiting_date %]
537
                            [% IF recall %]
546
                                <span>Waiting at [% Branches.GetName( recall.pickup_library_id ) | html %] since [% recall.waiting_date | $KohaDates %]</span>
538
                                [% IF recall.waiting_date %]
547
                            [% ELSE %]
539
                                    <span>Waiting at [% Branches.GetName( recall.pickup_library_id ) | html %] since [% recall.waiting_date | $KohaDates %]</span>
548
                                [% 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 %]
540
                                [% ELSE %]
549
                                <span>recalled by [% patron_link| $raw %] on [% recall.created_date | $KohaDates %]</span>
541
                                    [% 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 %]
542
                                    <span>recalled by [% patron_link| $raw %] on [% recall.created_date | $KohaDates %]</span>
543
                                [% END %]
550
                            [% END %]
544
                            [% END %]
551
                        [% END %]
545
                        [% END %]
552
546
Lines 583-589 Note that permanent location is a code, and location may be an authval. Link Here
583
                        [% END %]
577
                        [% END %]
584
                    [% END %]
578
                    [% END %]
585
                    [% IF ( itemdata_copynumber ) %]
579
                    [% IF ( itemdata_copynumber ) %]
586
                        <td class="copynumber">[% item.copynumber | html %]</td>
580
                        <td class="copynumber">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.copynumber', authorised_value => item.copynumber ) | html %]</td>
587
                    [% END %]
581
                    [% END %]
588
                    [% IF ( itemdata_stocknumber ) %]
582
                    [% IF ( itemdata_stocknumber ) %]
589
                        <td class="stocknumber">[% item.stocknumber | html %]</td>
583
                        <td class="stocknumber">[% item.stocknumber | html %]</td>
Lines 592-598 Note that permanent location is a code, and location may be an authval. Link Here
592
                        <td class="materials"> [% item.materials | html %] </td>
586
                        <td class="materials"> [% item.materials | html %] </td>
593
                    [% END %]
587
                    [% END %]
594
                    [% IF ( itemdata_itemnotes ) %]
588
                    [% IF ( itemdata_itemnotes ) %]
595
                        <td><div class="itemnotes">[% item.itemnotes | $raw %]</div></td>
589
                        <td><div class="itemnotes">[% item.object.itemnotes.replace('\n','<br />') | $raw %]</div></td>
596
                    [% END %]
590
                    [% END %]
597
                    [% IF itemdata_nonpublicnotes %]
591
                    [% IF itemdata_nonpublicnotes %]
598
                        <td class="nonpublicnote">[% item.itemnotes_nonpublic | html %]</td>
592
                        <td class="nonpublicnote">[% item.itemnotes_nonpublic | html %]</td>
599
- 

Return to bug 33167