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

(-)a/C4/XSLT.pm (-18 lines)
Lines 281-304 sub XSLTParse4Display { Link Here
281
        }
281
        }
282
    }
282
    }
283
283
284
    # possibly show analytics link in Detail views
285
    if ( $xslsyspref eq "OPACXSLTDetailsDisplay" || $xslsyspref eq "XSLTDetailsDisplay" ) {
286
        $biblio //= Koha::Biblios->find( $biblionumber );
287
        my $components = $biblio->get_marc_components();
288
        $variables->{show_analytics_link} = ( scalar @{$components} == 0 ) ? 0 : 1;
289
290
        my $showcomp = C4::Context->preference('ShowComponentRecords');
291
        if (
292
            $variables->{show_analytics_link}
293
            && (   $showcomp eq 'both'
294
                || ( $showcomp eq 'staff' && $xslsyspref !~ m/OPAC/ )
295
                || ( $showcomp eq 'opac'  && $xslsyspref =~ m/OPAC/ ) )
296
          )
297
        {
298
             $variables->{show_analytics_link} = 0;
299
        }
300
    }
301
302
    my $varxml = "<variables>\n";
284
    my $varxml = "<variables>\n";
303
    while (my ($key, $value) = each %$variables) {
285
    while (my ($key, $value) = each %$variables) {
304
        $varxml .= "<variable name=\"$key\">$value</variable>\n";
286
        $varxml .= "<variable name=\"$key\">$value</variable>\n";
(-)a/catalogue/detail.pl (-17 / +19 lines)
Lines 123-144 my $fw = GetFrameworkCode($biblionumber); Link Here
123
my $showallitems = $query->param('showallitems');
123
my $showallitems = $query->param('showallitems');
124
my $marcflavour  = C4::Context->preference("marcflavour");
124
my $marcflavour  = C4::Context->preference("marcflavour");
125
125
126
{
127
    # XSLT processing of some stuff
128
129
    $template->param(
130
        XSLTDetailsDisplay => '1',
131
        XSLTBloc => XSLTParse4Display(
132
            {
133
                biblionumber   => $biblionumber,
134
                record         => $record,
135
                xsl_syspref    => "XSLTDetailsDisplay",
136
                fix_amps       => 1,
137
            }
138
        ),
139
    );
140
}
141
142
$template->param( 'SpineLabelShowPrintOnBibDetails' => C4::Context->preference("SpineLabelShowPrintOnBibDetails") );
126
$template->param( 'SpineLabelShowPrintOnBibDetails' => C4::Context->preference("SpineLabelShowPrintOnBibDetails") );
143
127
144
# Catch the exception as Koha::Biblio::Metadata->record can explode if the MARCXML is invalid
128
# Catch the exception as Koha::Biblio::Metadata->record can explode if the MARCXML is invalid
Lines 213-228 foreach my $subscription (@subscriptions) { Link Here
213
197
214
# Get component parts details
198
# Get component parts details
215
my $showcomp = C4::Context->preference('ShowComponentRecords');
199
my $showcomp = C4::Context->preference('ShowComponentRecords');
200
my $show_analytics;
216
if ( $showcomp eq 'both' || $showcomp eq 'staff' ) {
201
if ( $showcomp eq 'both' || $showcomp eq 'staff' ) {
217
    if ( my $components = $biblio->get_marc_components(C4::Context->preference('MaxComponentRecords')) ) {
202
    if ( my $components = $biblio->get_marc_components(C4::Context->preference('MaxComponentRecords')) ) {
203
        $show_analytics = 1; # just show link when having results
218
        my $parts;
204
        my $parts;
219
        for my $part ( @{$components} ) {
205
        for my $part ( @{$components} ) {
220
            $part = C4::Search::new_record_from_zebra( 'biblioserver', $part );
206
            $part = C4::Search::new_record_from_zebra( 'biblioserver', $part );
207
            my $id = Koha::SearchEngine::Search::extract_biblionumber( $part );
221
208
222
            push @{$parts},
209
            push @{$parts},
223
              XSLTParse4Display(
210
              XSLTParse4Display(
224
                {
211
                {
225
                    biblionumber => $biblionumber,
212
                    biblionumber => $id,
226
                    record       => $part,
213
                    record       => $part,
227
                    xsl_syspref  => "XSLTResultsDisplay",
214
                    xsl_syspref  => "XSLTResultsDisplay",
228
                    fix_amps     => 1,
215
                    fix_amps     => 1,
Lines 232-239 if ( $showcomp eq 'both' || $showcomp eq 'staff' ) { Link Here
232
        $template->param( ComponentParts => $parts );
219
        $template->param( ComponentParts => $parts );
233
        $template->param( ComponentPartsQuery => $biblio->get_components_query );
220
        $template->param( ComponentPartsQuery => $biblio->get_components_query );
234
    }
221
    }
222
} else { # check if we should show analytics anyway
223
    $show_analytics = 1 if @{$biblio->get_marc_components(1)}; # count matters here, results does not
235
}
224
}
236
225
226
# XSLT processing of some stuff
227
my $xslt_variables = { show_analytics_link => $show_analytics };
228
$template->param(
229
    XSLTDetailsDisplay => '1',
230
    XSLTBloc => XSLTParse4Display({
231
        biblionumber   => $biblionumber,
232
        record         => $record,
233
        xsl_syspref    => "XSLTDetailsDisplay",
234
        fix_amps       => 1,
235
        xslt_variables => $xslt_variables,
236
    }),
237
);
238
237
# Get acquisition details
239
# Get acquisition details
238
if ( C4::Context->preference('AcquisitionDetails') ) {
240
if ( C4::Context->preference('AcquisitionDetails') ) {
239
    my $orders = Koha::Acquisition::Orders->search(
241
    my $orders = Koha::Acquisition::Orders->search(
(-)a/opac/opac-detail.pl (-35 / +31 lines)
Lines 195-232 SetUTF8Flag($record); Link Here
195
my $marcflavour      = C4::Context->preference("marcflavour");
195
my $marcflavour      = C4::Context->preference("marcflavour");
196
my $ean = GetNormalizedEAN( $record, $marcflavour );
196
my $ean = GetNormalizedEAN( $record, $marcflavour );
197
197
198
{
199
    my $variables = {
200
        anonymous_session   => ($borrowernumber) ? 0 : 1,
201
    };
202
203
    my $lang   = C4::Languages::getlanguage();
204
    my @plugin_responses = Koha::Plugins->call(
205
        'opac_detail_xslt_variables',
206
        {
207
            biblio_id => $biblionumber,
208
            lang      => $lang,
209
            patron_id => $borrowernumber
210
211
        }
212
    );
213
    for my $plugin_variables ( @plugin_responses ) {
214
        $variables = { %$variables, %$plugin_variables };
215
    }
216
217
    $template->param(
218
        XSLTBloc => XSLTParse4Display(
219
            {
220
                biblionumber   => $biblionumber,
221
                record         => $record,
222
                xsl_syspref    => 'OPACXSLTDetailsDisplay',
223
                fix_amps       => 1,
224
                xslt_variables => $variables
225
            }
226
        ),
227
    );
228
}
229
230
my $OpacBrowseResults = C4::Context->preference("OpacBrowseResults");
198
my $OpacBrowseResults = C4::Context->preference("OpacBrowseResults");
231
199
232
# We look for the busc param to build the simple paging from the search
200
# We look for the busc param to build the simple paging from the search
Lines 659-674 my $max_items_to_display = C4::Context->preference('OpacMaxItemsToDisplay') // 5 Link Here
659
627
660
# Get component parts details
628
# Get component parts details
661
my $showcomp = C4::Context->preference('ShowComponentRecords');
629
my $showcomp = C4::Context->preference('ShowComponentRecords');
662
my $parts;
630
my ( $parts, $show_analytics );
663
if ( $showcomp eq 'both' || $showcomp eq 'opac' ) {
631
if ( $showcomp eq 'both' || $showcomp eq 'opac' ) {
664
    if ( my $components = $biblio->get_marc_components(C4::Context->preference('MaxComponentRecords')) ) {
632
    if ( my $components = $biblio->get_marc_components(C4::Context->preference('MaxComponentRecords')) ) {
633
        $show_analytics = 1; # just show link when having results
665
        for my $part ( @{$components} ) {
634
        for my $part ( @{$components} ) {
666
            $part = C4::Search::new_record_from_zebra( 'biblioserver', $part );
635
            $part = C4::Search::new_record_from_zebra( 'biblioserver', $part );
636
            my $id = Koha::SearchEngine::Search::extract_biblionumber( $part );
667
637
668
            push @{$parts},
638
            push @{$parts},
669
              XSLTParse4Display(
639
              XSLTParse4Display(
670
                {
640
                {
671
                    biblionumber => $biblionumber,
641
                    biblionumber => $id,
672
                    record       => $part,
642
                    record       => $part,
673
                    xsl_syspref  => 'OPACXSLTResultsDisplay',
643
                    xsl_syspref  => 'OPACXSLTResultsDisplay',
674
                    fix_amps     => 1,
644
                    fix_amps     => 1,
Lines 678-685 if ( $showcomp eq 'both' || $showcomp eq 'opac' ) { Link Here
678
        $template->param( ComponentParts => $parts );
648
        $template->param( ComponentParts => $parts );
679
        $template->param( ComponentPartsQuery => $biblio->get_components_query );
649
        $template->param( ComponentPartsQuery => $biblio->get_components_query );
680
    }
650
    }
651
} else { # check if we should show analytics anyway
652
    $show_analytics = 1 if @{$biblio->get_marc_components(1)}; # count matters here, results does not
681
}
653
}
682
654
655
# XSLT processing of some stuff
656
my $variables = {};
657
my @plugin_responses = Koha::Plugins->call(
658
    'opac_detail_xslt_variables',
659
    {
660
        biblio_id => $biblionumber,
661
        lang      => C4::Languages::getlanguage(),
662
        patron_id => $borrowernumber,
663
    },
664
);
665
for my $plugin_variables ( @plugin_responses ) {
666
    $variables = { %$variables, %$plugin_variables };
667
}
668
$variables->{anonymous_session} = $borrowernumber ? 0 : 1;
669
$variables->{show_analytics_link} = $show_analytics;
670
$template->param(
671
    XSLTBloc => XSLTParse4Display({
672
        biblionumber   => $biblionumber,
673
        record         => $record,
674
        xsl_syspref    => 'OPACXSLTDetailsDisplay',
675
        fix_amps       => 1,
676
        xslt_variables => $variables,
677
    }),
678
);
679
683
# Get items on order
680
# Get items on order
684
my ( @itemnumbers_on_order );
681
my ( @itemnumbers_on_order );
685
if ( C4::Context->preference('OPACAcquisitionDetails' ) ) {
682
if ( C4::Context->preference('OPACAcquisitionDetails' ) ) {
686
- 

Return to bug 11175