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

(-)a/C4/Biblio.pm (-7 / +14 lines)
Lines 932-938 sub GetISBDView { Link Here
932
    return unless defined $record;
932
    return unless defined $record;
933
    my $itemtype = &GetFrameworkCode($biblionumber);
933
    my $itemtype = &GetFrameworkCode($biblionumber);
934
    my ( $holdingbrtagf, $holdingbrtagsubf ) = &GetMarcFromKohaField( "items.holdingbranch", $itemtype );
934
    my ( $holdingbrtagf, $holdingbrtagsubf ) = &GetMarcFromKohaField( "items.holdingbranch", $itemtype );
935
    my $tagslib = &GetMarcStructure( 1, $itemtype );
935
    my $tagslib = &GetMarcStructure( 1, $itemtype, { unsafe => 1 } );
936
936
937
    my $ISBD = C4::Context->preference($sysprefname);
937
    my $ISBD = C4::Context->preference($sysprefname);
938
    my $bloc = $ISBD;
938
    my $bloc = $ISBD;
Lines 1109-1130 sub IsMarcStructureInternal { Link Here
1109
1109
1110
=head2 GetMarcStructure
1110
=head2 GetMarcStructure
1111
1111
1112
  $res = GetMarcStructure($forlibrarian,$frameworkcode);
1112
  $res = GetMarcStructure($forlibrarian, $frameworkcode, [ $params ]);
1113
1113
1114
Returns a reference to a big hash of hash, with the Marc structure for the given frameworkcode
1114
Returns a reference to a big hash of hash, with the Marc structure for the given frameworkcode
1115
$forlibrarian  :if set to 1, the MARC descriptions are the librarians ones, otherwise it's the public (OPAC) ones
1115
$forlibrarian  :if set to 1, the MARC descriptions are the librarians ones, otherwise it's the public (OPAC) ones
1116
$frameworkcode : the framework code to read
1116
$frameworkcode : the framework code to read
1117
$params allows you to pass { unsafe => 1 } for better performance.
1118
1119
Note: If you call GetMarcStructure with unsafe => 1, do not modify or
1120
even autovivify its contents. It is a cached/shared data structure. Your
1121
changes c/would be passed around in subsequent calls.
1117
1122
1118
=cut
1123
=cut
1119
1124
1120
sub GetMarcStructure {
1125
sub GetMarcStructure {
1121
    my ( $forlibrarian, $frameworkcode ) = @_;
1126
    my ( $forlibrarian, $frameworkcode, $params ) = @_;
1122
    $frameworkcode = "" unless $frameworkcode;
1127
    $frameworkcode = "" unless $frameworkcode;
1123
1128
1124
    $forlibrarian = $forlibrarian ? 1 : 0;
1129
    $forlibrarian = $forlibrarian ? 1 : 0;
1130
    my $unsafe = ($params && $params->{unsafe})? 1: 0;
1125
    my $cache = Koha::Cache->get_instance();
1131
    my $cache = Koha::Cache->get_instance();
1126
    my $cache_key = "MarcStructure-$forlibrarian-$frameworkcode";
1132
    my $cache_key = "MarcStructure-$forlibrarian-$frameworkcode";
1127
    my $cached = $cache->get_from_cache($cache_key);
1133
    my $cached = $cache->get_from_cache($cache_key, { unsafe => $unsafe });
1128
    return $cached if $cached;
1134
    return $cached if $cached;
1129
1135
1130
    my $dbh = C4::Context->dbh;
1136
    my $dbh = C4::Context->dbh;
Lines 1949-1958 sub GetMarcAuthors { Link Here
1949
    }
1955
    }
1950
    my ( $mintag, $maxtag, $fields_filter );
1956
    my ( $mintag, $maxtag, $fields_filter );
1951
1957
1952
    # tagslib useful for UNIMARC author reponsabilities
1958
    # tagslib useful only for UNIMARC author responsibilities
1953
    my $tagslib =
1959
    my $tagslib;
1954
      &GetMarcStructure( 1, '' );    # FIXME : we don't have the framework available, we take the default framework. May be buggy on some setups, will be usually correct.
1955
    if ( $marcflavour eq "UNIMARC" ) {
1960
    if ( $marcflavour eq "UNIMARC" ) {
1961
        # FIXME : we don't have the framework available, we take the default framework. May be buggy on some setups, will be usually correct.
1962
        $tagslib = GetMarcStructure( 1, '', { unsafe => 1 });
1956
        $mintag = "700";
1963
        $mintag = "700";
1957
        $maxtag = "712";
1964
        $maxtag = "712";
1958
        $fields_filter = '7..';
1965
        $fields_filter = '7..';
(-)a/C4/Items.pm (-1 / +5 lines)
Lines 2437-2443 sub _get_unlinked_item_subfields { Link Here
2437
    my $original_item_marc = shift;
2437
    my $original_item_marc = shift;
2438
    my $frameworkcode = shift;
2438
    my $frameworkcode = shift;
2439
2439
2440
    my $marcstructure = GetMarcStructure(1, $frameworkcode);
2440
    my $marcstructure = GetMarcStructure(1, $frameworkcode, { unsafe => 1 });
2441
2441
2442
    # assume that this record has only one field, and that that
2442
    # assume that this record has only one field, and that that
2443
    # field contains only the item information
2443
    # field contains only the item information
Lines 2821-2826 sub PrepareItemrecordDisplay { Link Here
2821
    my $dbh = C4::Context->dbh;
2821
    my $dbh = C4::Context->dbh;
2822
    $frameworkcode = &GetFrameworkCode($bibnum) if $bibnum;
2822
    $frameworkcode = &GetFrameworkCode($bibnum) if $bibnum;
2823
    my ( $itemtagfield, $itemtagsubfield ) = &GetMarcFromKohaField( "items.itemnumber", $frameworkcode );
2823
    my ( $itemtagfield, $itemtagsubfield ) = &GetMarcFromKohaField( "items.itemnumber", $frameworkcode );
2824
2825
    # it would be perhaps beneficial (?) to call GetMarcStructure with 'unsafe' parameter
2826
    # for performance reasons, but $tagslib may be passed to $plugin->build(), and there
2827
    # is no way to ensure that this structure is not getting corrupted somewhere in there
2824
    my $tagslib = &GetMarcStructure( 1, $frameworkcode );
2828
    my $tagslib = &GetMarcStructure( 1, $frameworkcode );
2825
2829
2826
    # return nothing if we don't have found an existing framework.
2830
    # return nothing if we don't have found an existing framework.
(-)a/C4/XSLT.pm (-1 / +1 lines)
Lines 68-74 Is only used in this module currently. Link Here
68
sub transformMARCXML4XSLT {
68
sub transformMARCXML4XSLT {
69
    my ($biblionumber, $record) = @_;
69
    my ($biblionumber, $record) = @_;
70
    my $frameworkcode = GetFrameworkCode($biblionumber) || '';
70
    my $frameworkcode = GetFrameworkCode($biblionumber) || '';
71
    my $tagslib = &GetMarcStructure(1,$frameworkcode);
71
    my $tagslib = &GetMarcStructure(1, $frameworkcode, { unsafe => 1 });
72
    my @fields;
72
    my @fields;
73
    # FIXME: wish there was a better way to handle exceptions
73
    # FIXME: wish there was a better way to handle exceptions
74
    eval {
74
    eval {
(-)a/Koha/Filter/MARC/ViewPolicy.pm (-2 / +1 lines)
Lines 84-90 sub filter { Link Here
84
        my $frameworkcode = $self->{options}->{frameworkcode} // q{};
84
        my $frameworkcode = $self->{options}->{frameworkcode} // q{};
85
        my $hide          = _should_hide_on_interface();
85
        my $hide          = _should_hide_on_interface();
86
86
87
        my $marcsubfieldstructure = GetMarcStructure( 0, $frameworkcode );
87
        my $marcsubfieldstructure = GetMarcStructure( 0, $frameworkcode, { unsafe => 1 } );
88
88
89
        #if ($marcsubfieldstructure->{'000'}->{'@'}->{hidden}>0) {
89
        #if ($marcsubfieldstructure->{'000'}->{'@'}->{hidden}>0) {
90
        # LDR field is excluded from $current_record->fields().
90
        # LDR field is excluded from $current_record->fields().
91
- 

Return to bug 16365