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

(-)a/C4/XSLT.pm (-2 / +2 lines)
Lines 219-226 sub XSLTParse4Display { Link Here
219
    $variables ||= {};
219
    $variables ||= {};
220
    if (C4::Context->preference('OPACShowOpenURL')) {
220
    if (C4::Context->preference('OPACShowOpenURL')) {
221
        my ($biblio) = GetBiblioItemByBiblioNumber($biblionumber);
221
        my ($biblio) = GetBiblioItemByBiblioNumber($biblionumber);
222
        my @itypes = split( /\s/, C4::Context->preference('OPACHideOpenURLForItemTypes') );
222
        my @itypes = split( /\s/, C4::Context->preference('OPACOpenURLItemTypes') );
223
        if (not grep /^$biblio->{itemtype}$/, @itypes) {
223
        if (grep /^$biblio->{itemtype}$/, @itypes) {
224
            $variables->{COinS} = C4::Biblio::GetCOinSBiblio($orig_record);
224
            $variables->{COinS} = C4::Biblio::GetCOinSBiblio($orig_record);
225
        }
225
        }
226
    }
226
    }
(-)a/installer/data/mysql/sysprefs.sql (-1 / +1 lines)
Lines 447-451 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
447
('OpenURLText', '', NULL, 'Text of OpenURL links (or image title if OpenURLImageLocation is defined)', 'Free')
447
('OpenURLText', '', NULL, 'Text of OpenURL links (or image title if OpenURLImageLocation is defined)', 'Free')
448
('OpenURLImageLocation', '', NULL, 'Location of image for OpenURL links', 'Free')
448
('OpenURLImageLocation', '', NULL, 'Location of image for OpenURL links', 'Free')
449
('OPACShowOpenURL', '', NULL, 'Enable display of OpenURL links in OPAC search results and detail page', 'YesNo')
449
('OPACShowOpenURL', '', NULL, 'Enable display of OpenURL links in OPAC search results and detail page', 'YesNo')
450
('OPACHideOpenURLForItemTypes', '', NULL, 'Allow hiding the OpenURL link for some item types', 'Free')
450
('OPACOpenURLItemTypes', '', NULL, 'Show the OpenURL link only for these item types', 'Free')
451
;
451
;
(-)a/installer/data/mysql/updatedatabase.pl (-1 / +1 lines)
Lines 8609-8615 if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { Link Here
8609
    ");
8609
    ");
8610
    $dbh->do("
8610
    $dbh->do("
8611
        INSERT INTO systempreferences (variable,value,explanation,options,type)
8611
        INSERT INTO systempreferences (variable,value,explanation,options,type)
8612
        VALUES('OPACHideOpenURLForItemTypes', '', 'Allow hiding the OpenURL link for some item types', NULL, 'Free');
8612
        VALUES('OPACOpenURLItemTypes', '', 'Show the OpenURL link only for these item types', NULL, 'Free');
8613
    ");
8613
    ");
8614
    print "Upgrade to $DBversion done (Bug 8995 - Add sysprefs for OpenURL)\n";
8614
    print "Upgrade to $DBversion done (Bug 8995 - Add sysprefs for OpenURL)\n";
8615
    SetVersion($DBversion);
8615
    SetVersion($DBversion);
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (-2 / +2 lines)
Lines 335-342 OPAC: Link Here
335
                  no: Disable
335
                  no: Disable
336
            - 'display of OpenURL link in OPAC search results and detail page.'
336
            - 'display of OpenURL link in OPAC search results and detail page.'
337
        -
337
        -
338
            - 'List of item type codes (separated by spaces) for those you do not want to show the OpenURL link:'
338
            - 'List of item type codes (separated by spaces) for those you want to show the OpenURL link:'
339
            - pref: OPACHideOpenURLForItemTypes
339
            - pref: OPACOpenURLItemTypes
340
            - '<br />'
340
            - '<br />'
341
            - 'It uses biblioitems.itemtype field, so if you map a MARC field to it, and link this MARC field to a list of authorised values (for example CCODE), you can use these values for system preference value.'
341
            - 'It uses biblioitems.itemtype field, so if you map a MARC field to it, and link this MARC field to a list of authorised values (for example CCODE), you can use these values for system preference value.'
342
    Features:
342
    Features:
(-)a/opac/opac-detail.pl (-2 / +2 lines)
Lines 1139-1146 $template->param( Link Here
1139
# OpenURL
1139
# OpenURL
1140
if (C4::Context->preference('OPACShowOpenURL')) {
1140
if (C4::Context->preference('OPACShowOpenURL')) {
1141
    my ($biblio) = GetBiblioItemByBiblioNumber($biblionumber);
1141
    my ($biblio) = GetBiblioItemByBiblioNumber($biblionumber);
1142
    my @itypes = split( /\s/, C4::Context->preference('OPACHideOpenURLForItemTypes') );
1142
    my @itypes = split( /\s/, C4::Context->preference('OPACOpenURLItemTypes') );
1143
    if (not grep /^$biblio->{itemtype}$/, @itypes) {
1143
    if (grep /^$biblio->{itemtype}$/, @itypes) {
1144
        $template->param(
1144
        $template->param(
1145
            OPACShowOpenURL => 1,
1145
            OPACShowOpenURL => 1,
1146
            OpenURLResolverURL => C4::Context->preference('OpenURLResolverURL'),
1146
            OpenURLResolverURL => C4::Context->preference('OpenURLResolverURL'),
(-)a/opac/opac-search.pl (-4 / +3 lines)
Lines 490-498 if (C4::Context->preference('OpacSuppression')) { Link Here
490
}
490
}
491
491
492
# OpenURL
492
# OpenURL
493
my @OpenURL_itypes_to_hide;
493
my @OpenURL_itypes;
494
if (C4::Context->preference('OPACShowOpenURL')) {
494
if (C4::Context->preference('OPACShowOpenURL')) {
495
    @OpenURL_itypes_to_hide = split( /\s/, C4::Context->preference('OPACHideOpenURLForItemTypes') );
495
    @OpenURL_itypes = split( /\s/, C4::Context->preference('OPACOpenURLItemTypes') );
496
    $template->param(
496
    $template->param(
497
        OPACShowOpenURL => 1,
497
        OPACShowOpenURL => 1,
498
        OpenURLResolverURL => C4::Context->preference('OpenURLResolverURL'),
498
        OpenURLResolverURL => C4::Context->preference('OpenURLResolverURL'),
Lines 585-591 for (my $i=0;$i<@servers;$i++) { Link Here
585
585
586
            if (C4::Context->preference('COinSinOPACResults')
586
            if (C4::Context->preference('COinSinOPACResults')
587
            or C4::Context->preference('OPACShowOpenURL')) {
587
            or C4::Context->preference('OPACShowOpenURL')) {
588
                if (not grep /^$res->{itemtype}$/, @OpenURL_itypes_to_hide) {
588
                if (grep /^$res->{itemtype}$/, @OpenURL_itypes) {
589
                    $res->{ShowOpenURL} = 1;
589
                    $res->{ShowOpenURL} = 1;
590
                }
590
                }
591
                my $record = GetMarcBiblio($res->{'biblionumber'});
591
                my $record = GetMarcBiblio($res->{'biblionumber'});
592
- 

Return to bug 8995