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

(-)a/C4/Biblio.pm (+60 lines)
Lines 90-101 BEGIN { Link Here
90
      &GetMarcFromKohaField
90
      &GetMarcFromKohaField
91
      &GetFrameworkCode
91
      &GetFrameworkCode
92
      &TransformKohaToMarc
92
      &TransformKohaToMarc
93
      &TransformMarcToXml
93
      &PrepHostMarcField
94
      &PrepHostMarcField
94
95
95
      &CountItemsIssued
96
      &CountItemsIssued
96
      &CountBiblioInOrders
97
      &CountBiblioInOrders
97
      &GetSubscriptionsId
98
      &GetSubscriptionsId
98
      &GetHolds
99
      &GetHolds
100
      
101
      &GetMarcBiblioWithoutHiddenFields
99
    );
102
    );
100
103
101
    # To modify something
104
    # To modify something
Lines 2011-2016 sub TransformKohaToMarc { Link Here
2011
    return $record;
2014
    return $record;
2012
}
2015
}
2013
2016
2017
=head TransformMarcToXml
2018
2019
    $marcxml = TransformMarcToKoha( $record );
2020
    
2021
    Accepts a Marc::Record and returns record converted to marc xml.
2022
    
2023
=cut
2024
2025
sub TransformMarcToXml {
2026
    my ( $record ) = @_;
2027
2028
    return MARC::File::XML::header() . MARC::File::XML::record( $record ) . MARC::File::XML::footer();
2029
}
2030
2014
=head2 PrepHostMarcField
2031
=head2 PrepHostMarcField
2015
2032
2016
    $hostfield = PrepHostMarcField ( $hostbiblionumber,$hostitemnumber,$marcflavour )
2033
    $hostfield = PrepHostMarcField ( $hostbiblionumber,$hostitemnumber,$marcflavour )
Lines 3654-3659 sub GetHolds { Link Here
3654
    return ($holds);
3671
    return ($holds);
3655
}
3672
}
3656
3673
3674
=head2 GetMarcBiblioWithoutHiddenFields
3675
3676
  $record = GetMarcBiblioWithoutHiddenFields( $biblionumber );
3677
3678
  Returns a marc record where all fields marked as hidden
3679
  have been removed.
3680
  
3681
=cut
3682
3683
sub GetMarcBiblioWithoutHiddenFields {
3684
    my ( $biblionumber ) = @_;
3685
    
3686
    return unless $biblionumber;
3687
    
3688
    my $itemtype     = GetFrameworkCode( $biblionumber );
3689
    my $tagslib      = GetMarcStructure( 0, $itemtype );
3690
    my $record       = GetMarcBiblio($biblionumber);
3691
    
3692
    foreach my $field_name ( keys %$tagslib ) {
3693
        my $field =  $tagslib->{$field_name};
3694
3695
        foreach my $subfield_name ( keys %$field ) {
3696
            next if ( $subfield_name eq 'lib' 
3697
                   || $subfield_name eq 'repeatable' 
3698
                   || $subfield_name eq 'mandatory' 
3699
                   || $subfield_name eq 'tab' );
3700
            
3701
            my $subfield = $tagslib->{ $field_name }->{ $subfield_name };
3702
3703
            if ( $tagslib->{ $field_name }->{ $subfield_name }->{'hidden'} ) {
3704
                 my @fields = $record->field( $field_name );
3705
                 foreach my $field ( @fields ) {
3706
                     $field->delete_subfield( code => $subfield_name );
3707
                     
3708
                     $record->delete_field( $field ) unless ( $field->subfields() );
3709
                 }
3710
            }
3711
        }
3712
    }
3713
3714
    return $record;
3715
}
3716
3657
=head2 prepare_host_field
3717
=head2 prepare_host_field
3658
3718
3659
$marcfield = prepare_host_field( $hostbiblioitem, $marcflavour );
3719
$marcfield = prepare_host_field( $hostbiblioitem, $marcflavour );
(-)a/opac/opac-showmarc.pl (-2 / +3 lines)
Lines 66-72 if ($importid) { Link Here
66
}
66
}
67
67
68
if ($view eq 'card' || $view eq 'html') {
68
if ($view eq 'card' || $view eq 'html') {
69
    $xmlrecord = GetXmlBiblio($biblionumber) unless $xmlrecord;
69
    $record = GetMarcBiblioWithoutHiddenFields($biblionumber) unless $record;
70
    $xmlrecord = TransformMarcToXml( $record );
71
70
    my $xslfile;
72
    my $xslfile;
71
    my $themelang = '/' . C4::Context->preference("opacthemes") .  '/' . C4::Templates::_current_language();
73
    my $themelang = '/' . C4::Context->preference("opacthemes") .  '/' . C4::Templates::_current_language();
72
74
73
- 

Return to bug 7933