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 47-52 use C4::Members; # to use GetMember Link Here
47
use C4::Serials;    # CountSubscriptionFromBiblionumber
47
use C4::Serials;    # CountSubscriptionFromBiblionumber
48
use C4::Search;		# enabled_staff_search_views
48
use C4::Search;		# enabled_staff_search_views
49
use C4::Acquisition qw(GetOrdersByBiblionumber);
49
use C4::Acquisition qw(GetOrdersByBiblionumber);
50
use Koha::RecordProcessor;
50
51
51
52
52
#---- Internal function
53
#---- Internal function
Lines 68-83 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
68
    }
69
    }
69
);
70
);
70
71
71
my $res = GetISBDView($biblionumber, "intranet");
72
if ( not defined $biblionumber ) {
72
if ( not defined $res ) {
73
       # biblionumber invalid -> report and exit
73
       # biblionumber invalid -> report and exit
74
       $template->param( unknownbiblionumber => 1,
74
       $template->param( unknownbiblionumber => 1,
75
                               biblionumber => $biblionumber
75
                                biblionumber => $biblionumber
76
       );
76
       );
77
       output_html_with_http_headers $query, $cookie, $template->output;
77
       output_html_with_http_headers $query, $cookie, $template->output;
78
       exit;
78
       exit;
79
}
79
}
80
80
81
my $record_unfiltered = GetMarcBiblio($biblionumber,1);
82
my $record_processor = Koha::RecordProcessor->new({
83
    filters => 'ViewPolicy',
84
    options => {
85
        interface => 'intranet',
86
    },
87
});
88
my $record_filtered  = $record_unfiltered->clone();
89
my $record           = $record_processor->process($record_filtered);
90
91
if ( not defined $record ) {
92
       # biblionumber invalid -> report and exit
93
       $template->param( unknownbiblionumber => 1,
94
                                biblionumber => $biblionumber
95
       );
96
       output_html_with_http_headers $query, $cookie, $template->output;
97
       exit;
98
}
99
100
my $framework = GetFrameworkCode( $biblionumber );
101
my $res = GetISBDView({
102
    'record'    => $record,
103
    'template'  => 'intranet',
104
    'framework' => $framework,
105
});
106
81
if($query->cookie("holdfor")){ 
107
if($query->cookie("holdfor")){ 
82
    my $holdfor_patron = GetMember('borrowernumber' => $query->cookie("holdfor"));
108
    my $holdfor_patron = GetMember('borrowernumber' => $query->cookie("holdfor"));
83
    $template->param(
109
    $template->param(
Lines 101-107 if ($subscriptionsnumber) { Link Here
101
        subscriptiontitle   => $subscriptiontitle,
127
        subscriptiontitle   => $subscriptiontitle,
102
    );
128
    );
103
}
129
}
104
my $record = GetMarcBiblio($biblionumber);
105
130
106
$template->param (
131
$template->param (
107
    ISBD                => $res,
132
    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 (-2 / +15 lines)
Lines 30-35 use C4::Output; Link Here
30
use C4::Record;
30
use C4::Record;
31
use C4::Ris;
31
use C4::Ris;
32
use C4::Csv;
32
use C4::Csv;
33
use Koha::RecordProcessor;
33
use utf8;
34
use utf8;
34
my $query = new CGI;
35
my $query = new CGI;
35
36
Lines 62-70 if ($bib_list && $format) { Link Here
62
63
63
        # Other formats
64
        # Other formats
64
    } else {
65
    } else {
66
        my $record_processor = Koha::RecordProcessor->new({
67
            filters => 'ViewPolicy'
68
        });
65
        foreach my $biblio (@bibs) {
69
        foreach my $biblio (@bibs) {
66
70
67
            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
68
            next unless $record;
76
            next unless $record;
69
77
70
            if ($format eq 'iso2709') {
78
            if ($format eq 'iso2709') {
Lines 77-83 if ($bib_list && $format) { Link Here
77
                $output .= marc2bibtex($record, $biblio);
85
                $output .= marc2bibtex($record, $biblio);
78
            }
86
            }
79
            elsif ( $format eq 'isbd' ) {
87
            elsif ( $format eq 'isbd' ) {
80
                $output   .= GetISBDView($biblio, "opac");
88
                my $framework = GetFrameworkCode( $biblio );
89
                $output   .= GetISBDView({
90
                    'record'    => $record,
91
                    'template'  => 'opac',
92
                    'framework' => $framework,
93
                });
81
                $extension = "txt";
94
                $extension = "txt";
82
                $type      = "text/plain";
95
                $type      = "text/plain";
83
            }
96
            }
(-)a/opac/opac-downloadshelf.pl (-3 / +13 lines)
Lines 30-36 use C4::Output; Link Here
30
use C4::Record;
30
use C4::Record;
31
use C4::Ris;
31
use C4::Ris;
32
use C4::Csv;
32
use C4::Csv;
33
33
use Koha::RecordProcessor;
34
use Koha::Virtualshelves;
34
use Koha::Virtualshelves;
35
35
36
use utf8;
36
use utf8;
Lines 77-86 if ( $shelf and $shelf->can_be_viewed( $borrowernumber ) ) { Link Here
77
            $output = marc2csv(\@biblios, $format);
77
            $output = marc2csv(\@biblios, $format);
78
        # Other formats
78
        # Other formats
79
        } else {
79
        } else {
80
            my $record_processor = Koha::RecordProcessor->new({
81
                filters => 'ViewPolicy'
82
            });
80
            while ( my $content = $contents->next ) {
83
            while ( my $content = $contents->next ) {
81
                my $biblionumber = $content->biblionumber->biblionumber;
84
                my $biblionumber = $content->biblionumber->biblionumber;
82
85
83
                my $record = GetMarcBiblio($biblionumber, 1);
86
                my $record_unfiltered = GetMarcBiblio($biblionumber, 1);
87
                my $record_filtered   = $record_unfiltered->clone();
88
                my $record = $record_processor->process($record_filtered);
84
                next unless $record;
89
                next unless $record;
85
90
86
                if ($format eq 'iso2709') {
91
                if ($format eq 'iso2709') {
Lines 93-99 if ( $shelf and $shelf->can_be_viewed( $borrowernumber ) ) { Link Here
93
                    $output .= marc2bibtex($record, $biblionumber);
98
                    $output .= marc2bibtex($record, $biblionumber);
94
                }
99
                }
95
                elsif ( $format eq 'isbd' ) {
100
                elsif ( $format eq 'isbd' ) {
96
                    $output   .= GetISBDView($biblionumber, "opac");
101
                    my $framework = GetFrameworkCode( $biblionumber );
102
                    $output   .= GetISBDView({
103
                        'record'    => $record,
104
                        'template'  => 'opac',
105
                        'framework' => $framework,
106
                    });
97
                    $extension = "txt";
107
                    $extension = "txt";
98
                    $type      = "text/plain";
108
                    $type      = "text/plain";
99
                }
109
                }
(-)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 (-3 / +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 252-262 if ( $op eq 'view' ) { Link Here
252
            my $lang   = $xslfile ? C4::Languages::getlanguage()  : undef;
253
            my $lang   = $xslfile ? C4::Languages::getlanguage()  : undef;
253
            my $sysxml = $xslfile ? C4::XSLT::get_xslt_sysprefs() : undef;
254
            my $sysxml = $xslfile ? C4::XSLT::get_xslt_sysprefs() : undef;
254
255
256
            my $record_processor = Koha::RecordProcessor->new({ filters => 'ViewPolicy' });
255
            my @items;
257
            my @items;
256
            while ( my $content = $contents->next ) {
258
            while ( my $content = $contents->next ) {
257
                my $biblionumber = $content->biblionumber->biblionumber;
259
                my $biblionumber = $content->biblionumber->biblionumber;
258
                my $this_item    = GetBiblioData($biblionumber);
260
                my $record_unfiltered = GetMarcBiblio($biblionumber);
259
                my $record       = GetMarcBiblio($biblionumber);
261
                my $record_filtered   = $record_unfiltered->clone();
262
                my $record       = $record_processor->process($record_filtered);
260
263
261
                if ( $xslfile ) {
264
                if ( $xslfile ) {
262
                    $this_item->{XSLTBloc} = XSLTParse4Display( $biblionumber, $record, "OPACXSLTResultsDisplay",
265
                    $this_item->{XSLTBloc} = XSLTParse4Display( $biblionumber, $record, "OPACXSLTResultsDisplay",
263
- 

Return to bug 11592