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

(-)a/C4/Biblio.pm (-6 / +14 lines)
Lines 917-935 sub GetBiblioFromItemNumber { Link Here
917
917
918
=head2 GetISBDView 
918
=head2 GetISBDView 
919
919
920
  $isbd = &GetISBDView($biblionumber);
920
  $isbd = &GetISBDView({
921
      'record'    => $marc_record,
922
      'template'  => $interface, # opac/intranet
923
      'framework' => $framework,
924
  });
921
925
922
Return the ISBD view which can be included in opac and intranet
926
Return the ISBD view which can be included in opac and intranet
923
927
924
=cut
928
=cut
925
929
926
sub GetISBDView {
930
sub GetISBDView {
927
    my ( $biblionumber, $template ) = @_;
931
    my ( $params ) = @_;
928
    my $record   = GetMarcBiblio($biblionumber, 1);
932
929
    $template ||= '';
933
    # Expecting record WITH items.
930
    my $sysprefname = $template eq 'opac' ? 'opacisbd' : 'isbd';
934
    my $record    = $params->{record};
931
    return unless defined $record;
935
    return unless defined $record;
932
    my $itemtype = &GetFrameworkCode($biblionumber);
936
937
    my $template  = $params->{template} // q{};
938
    my $sysprefname = $template eq 'opac' ? 'opacisbd' : 'isbd';
939
    my $framework = $params->{framework};
940
    my $itemtype  = $framework;
933
    my ( $holdingbrtagf, $holdingbrtagsubf ) = &GetMarcFromKohaField( "items.holdingbranch", $itemtype );
941
    my ( $holdingbrtagf, $holdingbrtagsubf ) = &GetMarcFromKohaField( "items.holdingbranch", $itemtype );
934
    my $tagslib = &GetMarcStructure( 1, $itemtype );
942
    my $tagslib = &GetMarcStructure( 1, $itemtype );
935
943
(-)a/catalogue/ISBDdetail.pl (-4 / +29 lines)
Lines 48-53 use C4::Members; # to use GetMember Link Here
48
use C4::Serials;    # CountSubscriptionFromBiblionumber
48
use C4::Serials;    # CountSubscriptionFromBiblionumber
49
use C4::Search;		# enabled_staff_search_views
49
use C4::Search;		# enabled_staff_search_views
50
use C4::Acquisition qw(GetOrdersByBiblionumber);
50
use C4::Acquisition qw(GetOrdersByBiblionumber);
51
use Koha::RecordProcessor;
51
52
52
53
53
#---- Internal function
54
#---- Internal function
Lines 70-85 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
70
    }
71
    }
71
);
72
);
72
73
73
my $res = GetISBDView($biblionumber, "intranet");
74
if ( not defined $biblionumber ) {
74
if ( not defined $res ) {
75
       # biblionumber invalid -> report and exit
75
       # biblionumber invalid -> report and exit
76
       $template->param( unknownbiblionumber => 1,
76
       $template->param( unknownbiblionumber => 1,
77
                               biblionumber => $biblionumber
77
                                biblionumber => $biblionumber
78
       );
78
       );
79
       output_html_with_http_headers $query, $cookie, $template->output;
79
       output_html_with_http_headers $query, $cookie, $template->output;
80
       exit;
80
       exit;
81
}
81
}
82
82
83
my $record_unfiltered = GetMarcBiblio($biblionumber,1);
84
my $record_processor = Koha::RecordProcessor->new({
85
    filters => 'ViewPolicy',
86
    options => {
87
        interface => 'intranet',
88
    },
89
});
90
my $record_filtered  = $record_unfiltered->clone();
91
my $record           = $record_processor->process($record_filtered);
92
93
if ( not defined $record ) {
94
       # biblionumber invalid -> report and exit
95
       $template->param( unknownbiblionumber => 1,
96
                                biblionumber => $biblionumber
97
       );
98
       output_html_with_http_headers $query, $cookie, $template->output;
99
       exit;
100
}
101
102
my $framework = GetFrameworkCode( $biblionumber );
103
my $res = GetISBDView({
104
    'record'    => $record,
105
    'template'  => 'intranet',
106
    'framework' => $framework,
107
});
108
83
if($query->cookie("holdfor")){ 
109
if($query->cookie("holdfor")){ 
84
    my $holdfor_patron = GetMember('borrowernumber' => $query->cookie("holdfor"));
110
    my $holdfor_patron = GetMember('borrowernumber' => $query->cookie("holdfor"));
85
    $template->param(
111
    $template->param(
Lines 103-109 if ($subscriptionsnumber) { Link Here
103
        subscriptiontitle   => $subscriptiontitle,
129
        subscriptiontitle   => $subscriptiontitle,
104
    );
130
    );
105
}
131
}
106
my $record = GetMarcBiblio($biblionumber);
107
132
108
$template->param (
133
$template->param (
109
    ISBD                => $res,
134
    ISBD                => $res,
(-)a/opac/opac-ISBDdetail.pl (-2 / +7 lines)
Lines 92-98 if (scalar @items >= 1) { Link Here
92
    }
92
    }
93
}
93
}
94
94
95
my $record_unfiltered = GetMarcBiblio($biblionumber);
95
my $record_unfiltered = GetMarcBiblio($biblionumber,1);
96
if ( ! $record_unfiltered ) {
96
if ( ! $record_unfiltered ) {
97
    print $query->redirect("/cgi-bin/koha/errors/404.pl");
97
    print $query->redirect("/cgi-bin/koha/errors/404.pl");
98
    exit;
98
    exit;
Lines 150-156 $template->param( Link Here
150
150
151
my $norequests = 1;
151
my $norequests = 1;
152
my $allow_onshelf_holds;
152
my $allow_onshelf_holds;
153
my $res = GetISBDView($biblionumber, "opac");
153
my $framework = GetFrameworkCode( $biblionumber );
154
my $res = GetISBDView({
155
    'record'    => $record,
156
    'template'  => 'opac',
157
    'framework' => $framework
158
});
154
159
155
my $itemtypes = GetItemTypes();
160
my $itemtypes = GetItemTypes();
156
my $borrower = GetMember( 'borrowernumber' => $loggedinuser );
161
my $borrower = GetMember( 'borrowernumber' => $loggedinuser );
(-)a/opac/opac-MARCdetail.pl (-3 / +9 lines)
Lines 57-62 use C4::Members; Link Here
57
use C4::Acquisition;
57
use C4::Acquisition;
58
use C4::Koha;
58
use C4::Koha;
59
use List::MoreUtils qw( any uniq );
59
use List::MoreUtils qw( any uniq );
60
use Koha::RecordProcessor;
60
61
61
my $query = new CGI;
62
my $query = new CGI;
62
63
Lines 84-94 my $tagslib = &GetMarcStructure( 0, $itemtype ); Link Here
84
my ($tag_itemnumber,$subtag_itemnumber) = &GetMarcFromKohaField('items.itemnumber',$itemtype);
85
my ($tag_itemnumber,$subtag_itemnumber) = &GetMarcFromKohaField('items.itemnumber',$itemtype);
85
my $biblio = GetBiblioData($biblionumber);
86
my $biblio = GetBiblioData($biblionumber);
86
$biblionumber = $biblio->{biblionumber};
87
$biblionumber = $biblio->{biblionumber};
87
my $record = GetMarcBiblio($biblionumber, 1);
88
my $record_unfiltered = GetMarcBiblio($biblionumber, 1);
88
if ( ! $record ) {
89
if ( ! $record_unfiltered ) {
89
    print $query->redirect("/cgi-bin/koha/errors/404.pl");
90
    print $query->redirect("/cgi-bin/koha/errors/404.pl");
90
    exit;
91
    exit;
91
}
92
}
93
my $record_processor = Koha::RecordProcessor->new({ filters => 'ViewPolicy' });
94
my $record_filtered  = $record_unfiltered->clone();
95
my $record           = $record_processor->process($record_filtered);
96
92
# open template
97
# open template
93
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
98
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
94
    {
99
    {
Lines 103-109 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
103
my ($bt_tag,$bt_subtag) = GetMarcFromKohaField('biblio.title',$itemtype);
108
my ($bt_tag,$bt_subtag) = GetMarcFromKohaField('biblio.title',$itemtype);
104
$template->param(
109
$template->param(
105
    bibliotitle => $biblio->{title},
110
    bibliotitle => $biblio->{title},
106
) if $tagslib->{$bt_tag}->{$bt_subtag}->{hidden} <= 0; #<=0 is OPAC visible.
111
) if $tagslib->{$bt_tag}->{$bt_subtag}->{hidden} <= 0 && # <=0 OPAC visible.
112
     $tagslib->{$bt_tag}->{$bt_subtag}->{hidden} > -8;   # except -8;
107
113
108
# get biblionumbers stored in the cart
114
# get biblionumbers stored in the cart
109
if(my $cart_list = $query->cookie("bib_list")){
115
if(my $cart_list = $query->cookie("bib_list")){
(-)a/opac/opac-basket.pl (-2 / +5 lines)
Lines 26-31 use C4::Items; Link Here
26
use C4::Circulation;
26
use C4::Circulation;
27
use C4::Auth;
27
use C4::Auth;
28
use C4::Output;
28
use C4::Output;
29
use Koha::RecordProcessor;
29
30
30
my $query = new CGI;
31
my $query = new CGI;
31
32
Lines 57-69 if (C4::Context->preference('TagsEnabled')) { Link Here
57
	}
58
	}
58
}
59
}
59
60
60
61
my $record_processor = Koha::RecordProcessor->new({ filters => 'ViewPolicy' });
61
foreach my $biblionumber ( @bibs ) {
62
foreach my $biblionumber ( @bibs ) {
62
    $template->param( biblionumber => $biblionumber );
63
    $template->param( biblionumber => $biblionumber );
63
64
64
    my $dat              = &GetBiblioData($biblionumber);
65
    my $dat              = &GetBiblioData($biblionumber);
65
    next unless $dat;
66
    next unless $dat;
66
    my $record           = &GetMarcBiblio($biblionumber);
67
    my $record_unfiltered = &GetMarcBiblio($biblionumber);
68
    my $record_filtered   = $record_unfiltered->clone();
69
    my $record            = $record_processor->process($record_filtered);
67
    next unless $record;
70
    next unless $record;
68
    my $marcnotesarray   = GetMarcNotes( $record, $marcflavour );
71
    my $marcnotesarray   = GetMarcNotes( $record, $marcflavour );
69
    my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
72
    my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
(-)a/opac/opac-downloadcart.pl (-3 / +15 lines)
Lines 28-35 use C4::Items; Link Here
28
use C4::Output;
28
use C4::Output;
29
use C4::Record;
29
use C4::Record;
30
use C4::Ris;
30
use C4::Ris;
31
32
use Koha::CsvProfiles;
31
use Koha::CsvProfiles;
32
use Koha::RecordProcessor;
33
33
34
use utf8;
34
use utf8;
35
my $query = new CGI;
35
my $query = new CGI;
Lines 63-71 if ($bib_list && $format) { Link Here
63
63
64
        # Other formats
64
        # Other formats
65
    } else {
65
    } else {
66
        my $record_processor = Koha::RecordProcessor->new({
67
            filters => 'ViewPolicy'
68
        });
66
        foreach my $biblio (@bibs) {
69
        foreach my $biblio (@bibs) {
67
70
68
            my $record = GetMarcBiblio($biblio, 1);
71
            my $record_unfiltered = GetMarcBiblio($biblio, 1);
72
            my $record_filtered   = $record_unfiltered->clone();
73
            my $record            =
74
                $record_processor->process($record_filtered);
75
69
            next unless $record;
76
            next unless $record;
70
77
71
            if ($format eq 'iso2709') {
78
            if ($format eq 'iso2709') {
Lines 78-84 if ($bib_list && $format) { Link Here
78
                $output .= marc2bibtex($record, $biblio);
85
                $output .= marc2bibtex($record, $biblio);
79
            }
86
            }
80
            elsif ( $format eq 'isbd' ) {
87
            elsif ( $format eq 'isbd' ) {
81
                $output   .= GetISBDView($biblio, "opac");
88
                my $framework = GetFrameworkCode( $biblio );
89
                $output   .= GetISBDView({
90
                    'record'    => $record,
91
                    'template'  => 'opac',
92
                    'framework' => $framework,
93
                });
82
                $extension = "txt";
94
                $extension = "txt";
83
                $type      = "text/plain";
95
                $type      = "text/plain";
84
            }
96
            }
(-)a/opac/opac-downloadshelf.pl (-3 / +13 lines)
Lines 28-35 use C4::Items; Link Here
28
use C4::Output;
28
use C4::Output;
29
use C4::Record;
29
use C4::Record;
30
use C4::Ris;
30
use C4::Ris;
31
32
use Koha::CsvProfiles;
31
use Koha::CsvProfiles;
32
use Koha::RecordProcessor;
33
use Koha::Virtualshelves;
33
use Koha::Virtualshelves;
34
34
35
use utf8;
35
use utf8;
Lines 76-85 if ( $shelf and $shelf->can_be_viewed( $borrowernumber ) ) { Link Here
76
            $output = marc2csv(\@biblios, $format);
76
            $output = marc2csv(\@biblios, $format);
77
        # Other formats
77
        # Other formats
78
        } else {
78
        } else {
79
            my $record_processor = Koha::RecordProcessor->new({
80
                filters => 'ViewPolicy'
81
            });
79
            while ( my $content = $contents->next ) {
82
            while ( my $content = $contents->next ) {
80
                my $biblionumber = $content->biblionumber->biblionumber;
83
                my $biblionumber = $content->biblionumber->biblionumber;
81
84
82
                my $record = GetMarcBiblio($biblionumber, 1);
85
                my $record_unfiltered = GetMarcBiblio($biblionumber, 1);
86
                my $record_filtered   = $record_unfiltered->clone();
87
                my $record = $record_processor->process($record_filtered);
83
                next unless $record;
88
                next unless $record;
84
89
85
                if ($format eq 'iso2709') {
90
                if ($format eq 'iso2709') {
Lines 92-98 if ( $shelf and $shelf->can_be_viewed( $borrowernumber ) ) { Link Here
92
                    $output .= marc2bibtex($record, $biblionumber);
97
                    $output .= marc2bibtex($record, $biblionumber);
93
                }
98
                }
94
                elsif ( $format eq 'isbd' ) {
99
                elsif ( $format eq 'isbd' ) {
95
                    $output   .= GetISBDView($biblionumber, "opac");
100
                    my $framework = GetFrameworkCode( $biblionumber );
101
                    $output   .= GetISBDView({
102
                        'record'    => $record,
103
                        'template'  => 'opac',
104
                        'framework' => $framework,
105
                    });
96
                    $extension = "txt";
106
                    $extension = "txt";
97
                    $type      = "text/plain";
107
                    $type      = "text/plain";
98
                }
108
                }
(-)a/opac/opac-export.pl (-1 / +6 lines)
Lines 93-99 elsif ($format =~ /marcstd/) { Link Here
93
    $format = 'marcstd';
93
    $format = 'marcstd';
94
}
94
}
95
elsif ( $format =~ /isbd/ ) {
95
elsif ( $format =~ /isbd/ ) {
96
    $marc   = GetISBDView($biblionumber, "opac");
96
    my $framework = GetFrameworkCode( $biblionumber );
97
    $marc   = GetISBDView({
98
        'record'    => $marc,
99
        'template'  => 'opac',
100
        'framework' => $framework,
101
    });
97
    $format = 'isbd';
102
    $format = 'isbd';
98
}
103
}
99
else {
104
else {
(-)a/opac/opac-shelves.pl (-2 / +5 lines)
Lines 28-33 use C4::Output; Link Here
28
use C4::Tags qw( get_tags );
28
use C4::Tags qw( get_tags );
29
use C4::XSLT;
29
use C4::XSLT;
30
use Koha::Virtualshelves;
30
use Koha::Virtualshelves;
31
use Koha::RecordProcessor;
31
32
32
my $query = new CGI;
33
my $query = new CGI;
33
34
Lines 253-263 if ( $op eq 'view' ) { Link Here
253
            my $lang   = $xslfile ? C4::Languages::getlanguage()  : undef;
254
            my $lang   = $xslfile ? C4::Languages::getlanguage()  : undef;
254
            my $sysxml = $xslfile ? C4::XSLT::get_xslt_sysprefs() : undef;
255
            my $sysxml = $xslfile ? C4::XSLT::get_xslt_sysprefs() : undef;
255
256
257
            my $record_processor = Koha::RecordProcessor->new({ filters => 'ViewPolicy' });
256
            my @items;
258
            my @items;
257
            while ( my $content = $contents->next ) {
259
            while ( my $content = $contents->next ) {
258
                my $biblionumber = $content->biblionumber->biblionumber;
260
                my $biblionumber = $content->biblionumber->biblionumber;
259
                my $this_item    = GetBiblioData($biblionumber);
261
                my $this_item    = GetBiblioData($biblionumber);
260
                my $record       = GetMarcBiblio($biblionumber);
262
                my $record_unfiltered = GetMarcBiblio($biblionumber);
263
                my $record_filtered   = $record_unfiltered->clone();
264
                my $record       = $record_processor->process($record_filtered);
261
265
262
                if ( $xslfile ) {
266
                if ( $xslfile ) {
263
                    $this_item->{XSLTBloc} = XSLTParse4Display( $biblionumber, $record, "OPACXSLTListsDisplay",
267
                    $this_item->{XSLTBloc} = XSLTParse4Display( $biblionumber, $record, "OPACXSLTListsDisplay",
264
- 

Return to bug 11592