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

(-)a/C4/Biblio.pm (-4 / +13 lines)
Lines 914-930 sub GetBiblioFromItemNumber { Link Here
914
914
915
=head2 GetISBDView 
915
=head2 GetISBDView 
916
916
917
  $isbd = &GetISBDView($biblionumber);
917
  $isbd = &GetISBDView({
918
      'record'    => $marc_record,
919
      'template'  => $interface, # opac/intranet
920
      'framework' => $framework,
921
  });
918
922
919
Return the ISBD view which can be included in opac and intranet
923
Return the ISBD view which can be included in opac and intranet
920
924
921
=cut
925
=cut
922
926
923
sub GetISBDView {
927
sub GetISBDView {
924
    my ( $biblionumber, $template ) = @_;
928
    my ( $params ) = @_;
925
    my $record   = GetMarcBiblio($biblionumber, 1);
929
930
    # Expecting record WITH items.
931
    my $record    = $params->{record};
926
    return unless defined $record;
932
    return unless defined $record;
927
    my $itemtype = &GetFrameworkCode($biblionumber);
933
934
    my $template  = $params->{template};
935
    my $framework = $params->{framework};
936
    my $itemtype  = $framework;
928
    my ( $holdingbrtagf, $holdingbrtagsubf ) = &GetMarcFromKohaField( "items.holdingbranch", $itemtype );
937
    my ( $holdingbrtagf, $holdingbrtagsubf ) = &GetMarcFromKohaField( "items.holdingbranch", $itemtype );
929
    my $tagslib = &GetMarcStructure( 1, $itemtype );
938
    my $tagslib = &GetMarcStructure( 1, $itemtype );
930
939
(-)a/catalogue/ISBDdetail.pl (-4 / +24 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({ filters => 'ViewPolicy' });
83
my $record_filtered  = $record_unfiltered->clone();
84
my $record           = $record_processor->process($record_filtered);
85
86
if ( not defined $record ) {
87
       # biblionumber invalid -> report and exit
88
       $template->param( unknownbiblionumber => 1,
89
                                biblionumber => $biblionumber
90
       );
91
       output_html_with_http_headers $query, $cookie, $template->output;
92
       exit;
93
}
94
95
my $framework = GetFrameworkCode( $biblionumber );
96
my $res = GetISBDView({
97
    'record'    => $record,
98
    'template'  => 'intranet',
99
    'framework' => $framework,
100
});
101
81
if($query->cookie("holdfor")){ 
102
if($query->cookie("holdfor")){ 
82
    my $holdfor_patron = GetMember('borrowernumber' => $query->cookie("holdfor"));
103
    my $holdfor_patron = GetMember('borrowernumber' => $query->cookie("holdfor"));
83
    $template->param(
104
    $template->param(
Lines 101-107 if ($subscriptionsnumber) { Link Here
101
        subscriptiontitle   => $subscriptiontitle,
122
        subscriptiontitle   => $subscriptiontitle,
102
    );
123
    );
103
}
124
}
104
my $record = GetMarcBiblio($biblionumber);
105
125
106
$template->param (
126
$template->param (
107
    ISBD                => $res,
127
    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 (-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 248-258 if ( $op eq 'view' ) { Link Here
248
249
249
            my $borrower = GetMember( borrowernumber => $loggedinuser );
250
            my $borrower = GetMember( borrowernumber => $loggedinuser );
250
251
252
            my $record_processor = Koha::RecordProcessor->new({ filters => 'ViewPolicy' });
251
            my @items;
253
            my @items;
252
            while ( my $content = $contents->next ) {
254
            while ( my $content = $contents->next ) {
253
                my $this_item;
255
                my $this_item;
254
                my $biblionumber = $content->biblionumber->biblionumber;
256
                my $biblionumber = $content->biblionumber->biblionumber;
255
                my $record       = GetMarcBiblio($biblionumber);
257
                my $record_unfiltered = GetMarcBiblio($biblionumber);
258
                my $record_filtered   = $record_unfiltered->clone();
259
                my $record       = $record_processor->process($record_filtered);
256
260
257
                if ( C4::Context->preference("OPACXSLTResultsDisplay") ) {
261
                if ( C4::Context->preference("OPACXSLTResultsDisplay") ) {
258
                    $this_item->{XSLTBloc} = XSLTParse4Display( $biblionumber, $record, "OPACXSLTResultsDisplay" );
262
                    $this_item->{XSLTBloc} = XSLTParse4Display( $biblionumber, $record, "OPACXSLTResultsDisplay" );
259
- 

Return to bug 11592