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

(-)a/C4/Auth.pm (-6 / +1 lines)
Lines 389-394 sub get_template_and_user { Link Here
389
        noItemTypeImages   => C4::Context->preference("noItemTypeImages"),
389
        noItemTypeImages   => C4::Context->preference("noItemTypeImages"),
390
        marcflavour        => C4::Context->preference("marcflavour"),
390
        marcflavour        => C4::Context->preference("marcflavour"),
391
        persona            => C4::Context->preference("persona"),
391
        persona            => C4::Context->preference("persona"),
392
        OPACBaseURL        => C4::Context->preference('OPACBaseURL'),
392
    );
393
    );
393
    if ( $in->{'type'} eq "intranet" ) {
394
    if ( $in->{'type'} eq "intranet" ) {
394
        $template->param(
395
        $template->param(
Lines 460-470 sub get_template_and_user { Link Here
460
            $opac_name = C4::Context->userenv->{'branch'};
461
            $opac_name = C4::Context->userenv->{'branch'};
461
        }
462
        }
462
463
463
        # FIXME Under Plack the CGI->https method always returns 'OFF' ($using_https will be set to 0 in this case)
464
        my $opac_base_url = C4::Context->preference("OPACBaseURL");    #FIXME uses $using_https below as well
465
        if ( !$opac_base_url ) {
466
            $opac_base_url = $ENV{'SERVER_NAME'} . ( $ENV{'SERVER_PORT'} eq ( $using_https ? "443" : "80" ) ? '' : ":$ENV{'SERVER_PORT'}" );
467
        }
468
        $template->param(
464
        $template->param(
469
            OpacAdditionalStylesheet                   => C4::Context->preference("OpacAdditionalStylesheet"),
465
            OpacAdditionalStylesheet                   => C4::Context->preference("OpacAdditionalStylesheet"),
470
            AnonSuggestions                       => "" . C4::Context->preference("AnonSuggestions"),
466
            AnonSuggestions                       => "" . C4::Context->preference("AnonSuggestions"),
Lines 483-489 sub get_template_and_user { Link Here
483
            OPACUserCSS                           => "" . C4::Context->preference("OPACUserCSS"),
479
            OPACUserCSS                           => "" . C4::Context->preference("OPACUserCSS"),
484
            OPACViewOthersSuggestions             => "" . C4::Context->preference("OPACViewOthersSuggestions"),
480
            OPACViewOthersSuggestions             => "" . C4::Context->preference("OPACViewOthersSuggestions"),
485
            OpacAuthorities                       => C4::Context->preference("OpacAuthorities"),
481
            OpacAuthorities                       => C4::Context->preference("OpacAuthorities"),
486
            OPACBaseURL                           => ( $using_https ? "https://" : "http://" ) . $opac_base_url,
487
            opac_css_override                     => $ENV{'OPAC_CSS_OVERRIDE'},
482
            opac_css_override                     => $ENV{'OPAC_CSS_OVERRIDE'},
488
            opac_search_limit                     => $opac_search_limit,
483
            opac_search_limit                     => $opac_search_limit,
489
            opac_limit_override                   => $opac_limit_override,
484
            opac_limit_override                   => $opac_limit_override,
(-)a/C4/Auth_with_shibboleth.pm (-1 / +15 lines)
Lines 113-119 sub _get_uri { Link Here
113
113
114
    my $protocol = "https://";
114
    my $protocol = "https://";
115
115
116
    my $return = $protocol . C4::Context->preference('OPACBaseURL');
116
    my $uri = C4::Context->preference('OPACBaseURL') // '';
117
    if ($uri eq '') {
118
        $debug and warn 'OPACBaseURL not set!';
119
    }
120
    if ($uri =~ /(.*):\/\/(.*)/) {
121
        my $oldprotocol = $1;
122
        if ($oldprotocol ne 'https') {
123
            $debug
124
                and warn
125
                  'Shibboleth requires OPACBaseURL to use the https protocol!';
126
        }
127
        $uri = $2;
128
    }
129
130
    my $return = $protocol . $uri;
117
    return $return;
131
    return $return;
118
}
132
}
119
133
(-)a/C4/Context.pm (+5 lines)
Lines 609-614 sub set_preference { Link Here
609
609
610
    $value = 0 if ( $type && $type eq 'YesNo' && $value eq '' );
610
    $value = 0 if ( $type && $type eq 'YesNo' && $value eq '' );
611
611
612
    # force explicit protocol on OPACBaseURL
613
    if ($var eq 'opacbaseurl' && substr($value,0,4) !~ /http/) {
614
        $value = 'http://' . $value;
615
    }
616
612
    my $sth = $dbh->prepare( "
617
    my $sth = $dbh->prepare( "
613
      INSERT INTO systempreferences
618
      INSERT INTO systempreferences
614
        ( variable, value )
619
        ( variable, value )
(-)a/catalogue/detail.pl (-6 lines)
Lines 397-408 if ( (C4::Context->preference("HTML5MediaEnabled") eq 'both') or (C4::Context->p Link Here
397
    $template->param( C4::HTML5Media->gethtml5media($record));
397
    $template->param( C4::HTML5Media->gethtml5media($record));
398
}
398
}
399
399
400
401
# Get OPAC URL
402
if (C4::Context->preference('OPACBaseURL')){
403
     $template->param( OpacUrl => C4::Context->preference('OPACBaseURL') );
404
}
405
406
# Displaying tags
400
# Displaying tags
407
401
408
my $tag_quantity;
402
my $tag_quantity;
(-)a/installer/data/mysql/de-DE/mandatory/sample_notices.sql (-1 / +1 lines)
Lines 101-107 VALUES ( Link Here
101
101
102
Ihr Bibliothekskonto wurde angelegt. Bitte bestätigen Sie Ihre E-Mail-Adresse indem Sie auf folgenden Link klicken:
102
Ihr Bibliothekskonto wurde angelegt. Bitte bestätigen Sie Ihre E-Mail-Adresse indem Sie auf folgenden Link klicken:
103
103
104
http://<<OPACBaseURL>>/cgi-bin/koha/opac-registration-verify.pl?token=<<borrower_modifications.verification_token>>
104
<<OPACBaseURL>>/cgi-bin/koha/opac-registration-verify.pl?token=<<borrower_modifications.verification_token>>
105
105
106
Wenn Sie keine Kontoanmeldung durchgeführt haben, können Sie diese Benachrichtigung ignorieren. Sie wird in Kürze ungültig.
106
Wenn Sie keine Kontoanmeldung durchgeführt haben, können Sie diese Benachrichtigung ignorieren. Sie wird in Kürze ungültig.
107
107
(-)a/installer/data/mysql/en/mandatory/sample_notices.sql (-1 / +1 lines)
Lines 115-121 VALUES ( Link Here
115
115
116
Your library account has been created. Please verify your email address by clicking this link to complete the signup process:
116
Your library account has been created. Please verify your email address by clicking this link to complete the signup process:
117
117
118
http://<<OPACBaseURL>>/cgi-bin/koha/opac-registration-verify.pl?token=<<borrower_modifications.verification_token>>
118
<<OPACBaseURL>>/cgi-bin/koha/opac-registration-verify.pl?token=<<borrower_modifications.verification_token>>
119
119
120
If you did not initiate this request, you may safely ignore this one-time message. The request will expire shortly.'
120
If you did not initiate this request, you may safely ignore this one-time message. The request will expire shortly.'
121
);
121
);
(-)a/installer/data/mysql/es-ES/mandatory/sample_notices.sql (-1 / +1 lines)
Lines 112-118 VALUES ( Link Here
112
112
113
Your library account has been created. Please verify your email address by clicking this link to complete the signup process:
113
Your library account has been created. Please verify your email address by clicking this link to complete the signup process:
114
114
115
http://<<OPACBaseURL>>/cgi-bin/koha/opac-registration-verify.pl?token=<<borrower_modifications.verification_token>>
115
<<OPACBaseURL>>/cgi-bin/koha/opac-registration-verify.pl?token=<<borrower_modifications.verification_token>>
116
116
117
If you did not initiate this request, you may safely ignore this one-time message. The request will expire shortly.'
117
If you did not initiate this request, you may safely ignore this one-time message. The request will expire shortly.'
118
);
118
);
(-)a/installer/data/mysql/fr-FR/1-Obligatoire/sample_notices.sql (-1 / +1 lines)
Lines 115-121 VALUES ( Link Here
115
115
116
Votre compte de bibliothèque a été créé. Veuillez valider votre adresse email et le processus d''inscription en cliquant sur ce lien:
116
Votre compte de bibliothèque a été créé. Veuillez valider votre adresse email et le processus d''inscription en cliquant sur ce lien:
117
117
118
http://<<OPACBaseURL>>/cgi-bin/koha/opac-registration-verify.pl?token=<<borrower_modifications.verification_token>>
118
<<OPACBaseURL>>/cgi-bin/koha/opac-registration-verify.pl?token=<<borrower_modifications.verification_token>>
119
119
120
Si vous n''êtes pas à l''origine de cette inscription, vous pouvez ignorer ce message.'
120
Si vous n''êtes pas à l''origine de cette inscription, vous pouvez ignorer ce message.'
121
);
121
);
(-)a/installer/data/mysql/it-IT/necessari/notices.sql (-1 / +1 lines)
Lines 115-121 VALUES ( Link Here
115
115
116
Your library account has been created. Please verify your email address by clicking this link to complete the signup process:
116
Your library account has been created. Please verify your email address by clicking this link to complete the signup process:
117
117
118
http://<<OPACBaseURL>>/cgi-bin/koha/opac-registration-verify.pl?token=<<borrower_modifications.verification_token>>
118
<<OPACBaseURL>>/cgi-bin/koha/opac-registration-verify.pl?token=<<borrower_modifications.verification_token>>
119
119
120
If you did not initiate this request, you may safely ignore this one-time message. The request will expire shortly.'
120
If you did not initiate this request, you may safely ignore this one-time message. The request will expire shortly.'
121
);
121
);
(-)a/installer/data/mysql/nb-NO/1-Obligatorisk/sample_notices.sql (-1 / +1 lines)
Lines 137-143 VALUES ( Link Here
137
137
138
D har blitt registrert som bruker av biblioteket. Verifiser epostadressen din ved å klikke på lenka nedenfor:
138
D har blitt registrert som bruker av biblioteket. Verifiser epostadressen din ved å klikke på lenka nedenfor:
139
139
140
http://<<OPACBaseURL>>/cgi-bin/koha/opac-registration-verify.pl?token=<<borrower_modifications.verification_token>>
140
<<OPACBaseURL>>/cgi-bin/koha/opac-registration-verify.pl?token=<<borrower_modifications.verification_token>>
141
141
142
Dersom du ikke har bedt om å bli registret som bruker av biblioteket kan du se bort fra denne engangsmeldingen. Forespørselen vil snart gå ut på dato.'
142
Dersom du ikke har bedt om å bli registret som bruker av biblioteket kan du se bort fra denne engangsmeldingen. Forespørselen vil snart gå ut på dato.'
143
);
143
);
(-)a/installer/data/mysql/pl-PL/mandatory/sample_notices.sql (-1 / +1 lines)
Lines 114-120 VALUES ( Link Here
114
114
115
Your library account has been created. Please verify your email address by clicking this link to complete the signup process:
115
Your library account has been created. Please verify your email address by clicking this link to complete the signup process:
116
116
117
http://<<OPACBaseURL>>/cgi-bin/koha/opac-registration-verify.pl?token=<<borrower_modifications.verification_token>>
117
<<OPACBaseURL>>/cgi-bin/koha/opac-registration-verify.pl?token=<<borrower_modifications.verification_token>>
118
118
119
If you did not initiate this request, you may safely ignore this one-time message. The request will expire shortly.'
119
If you did not initiate this request, you may safely ignore this one-time message. The request will expire shortly.'
120
);
120
);
(-)a/installer/data/mysql/ru-RU/mandatory/sample_notices.sql (-1 / +1 lines)
Lines 115-121 VALUES ( Link Here
115
115
116
Your library account has been created. Please verify your email address by clicking this link to complete the signup process:
116
Your library account has been created. Please verify your email address by clicking this link to complete the signup process:
117
117
118
http://<<OPACBaseURL>>/cgi-bin/koha/opac-registration-verify.pl?token=<<borrower_modifications.verification_token>>
118
<<OPACBaseURL>>/cgi-bin/koha/opac-registration-verify.pl?token=<<borrower_modifications.verification_token>>
119
119
120
If you did not initiate this request, you may safely ignore this one-time message. The request will expire shortly.'
120
If you did not initiate this request, you may safely ignore this one-time message. The request will expire shortly.'
121
);
121
);
(-)a/installer/data/mysql/sysprefs.sql (-1 / +1 lines)
Lines 245-251 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
245
('OPACAllowUserToChooseBranch','1','1','Allow the user to choose the branch they want to pickup their hold from','YesNo'),
245
('OPACAllowUserToChooseBranch','1','1','Allow the user to choose the branch they want to pickup their hold from','YesNo'),
246
('OPACAmazonCoverImages','0','','Display cover images on OPAC from Amazon Web Services','YesNo'),
246
('OPACAmazonCoverImages','0','','Display cover images on OPAC from Amazon Web Services','YesNo'),
247
('OpacAuthorities','1',NULL,'If ON, enables the search authorities link on OPAC','YesNo'),
247
('OpacAuthorities','1',NULL,'If ON, enables the search authorities link on OPAC','YesNo'),
248
('OPACBaseURL',NULL,NULL,'Specify the Base URL of the OPAC, e.g., opac.mylibrary.com, the http:// will be added automatically by Koha.','Free'),
248
('OPACBaseURL',NULL,NULL,'Specify the Base URL of the OPAC, e.g., http://opac.mylibrary.com, including the protocol (http:// or https://). Otherwise, the http:// will be added automatically by Koha upon saving.','Free'),
249
('opacbookbag','1','','If ON, enables display of Cart feature','YesNo'),
249
('opacbookbag','1','','If ON, enables display of Cart feature','YesNo'),
250
('OpacBrowser','0',NULL,'If ON, enables subject authorities browser on OPAC (needs to set misc/cronjob/sbuild_browser_and_cloud.pl)','YesNo'),
250
('OpacBrowser','0',NULL,'If ON, enables subject authorities browser on OPAC (needs to set misc/cronjob/sbuild_browser_and_cloud.pl)','YesNo'),
251
('OpacBrowseResults','1',NULL,'Disable/enable browsing and paging search results from the OPAC detail page.','YesNo'),
251
('OpacBrowseResults','1',NULL,'Disable/enable browsing and paging search results from the OPAC detail page.','YesNo'),
(-)a/installer/data/mysql/uk-UA/mandatory/sample_notices.sql (-1 / +1 lines)
Lines 114-120 VALUES ( Link Here
114
114
115
Your library account has been created. Please verify your email address by clicking this link to complete the signup process:
115
Your library account has been created. Please verify your email address by clicking this link to complete the signup process:
116
116
117
http://<<OPACBaseURL>>/cgi-bin/koha/opac-registration-verify.pl?token=<<borrower_modifications.verification_token>>
117
<<OPACBaseURL>>/cgi-bin/koha/opac-registration-verify.pl?token=<<borrower_modifications.verification_token>>
118
118
119
If you did not initiate this request, you may safely ignore this one-time message. The request will expire shortly.'
119
If you did not initiate this request, you may safely ignore this one-time message. The request will expire shortly.'
120
);
120
);
(-)a/installer/data/mysql/updatedatabase.pl (+23 lines)
Lines 10392-10397 if ( CheckVersion($DBversion) ) { Link Here
10392
    SetVersion ($DBversion);
10392
    SetVersion ($DBversion);
10393
}
10393
}
10394
10394
10395
$DBversion = '3.19.00.XXX';
10396
if ( CheckVersion($DBversion) ) {
10397
    my $OPACBaseURL = C4::Context->preference('OPACBaseURL');
10398
    if (defined($OPACBaseURL) && substr($OPACBaseURL,0,4) ne "http") {
10399
        my $explanation = q{Specify the Base URL of the OPAC, e.g., http://opac.mylibrary.com, including the protocol (http:// or https://). Otherwise, the http:// will be added automatically by Koha upon saving.};
10400
        $OPACBaseURL = 'http://' . $OPACBaseURL;
10401
        my $sth_OPACBaseURL = $dbh->prepare( q{
10402
            UPDATE systempreferences SET value=?,explanation=?
10403
            WHERE variable='OPACBaseURL'; } );
10404
        $sth_OPACBaseURL->execute($OPACBaseURL,$explanation);
10405
    }
10406
    if (defined($OPACBaseURL)) {
10407
        $dbh->do( q{ UPDATE letter
10408
                     SET content=replace(content,
10409
                                         'http://<<OPACBaseURL>>',
10410
                                         '<<OPACBaseURL>>')
10411
                     WHERE content LIKE "%http://<<OPACBaseURL>>%"; } );
10412
    }
10413
10414
    print "Upgrade to $DBversion done (Bug 5010: Fix OPACBaseURL to include protocol)\n";
10415
    SetVersion($DBversion);
10416
}
10417
10395
# DEVELOPER PROCESS, search for anything to execute in the db_update directory
10418
# DEVELOPER PROCESS, search for anything to execute in the db_update directory
10396
# SEE bug 13068
10419
# SEE bug 13068
10397
# if there is anything in the atomicupdate, read and execute it.
10420
# if there is anything in the atomicupdate, read and execute it.
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (-2 / +2 lines)
Lines 13-22 OPAC: Link Here
13
                  prog: prog
13
                  prog: prog
14
            - theme as the fallback theme on the OPAC.
14
            - theme as the fallback theme on the OPAC.
15
        -
15
        -
16
            - "The OPAC is located at http://"
16
            - "The OPAC is located at "
17
            - pref: OPACBaseURL
17
            - pref: OPACBaseURL
18
              class: url
18
              class: url
19
            - . Do not include a trailing slash in the URL. (This must be filled in correctly for RSS, unAPI, and search plugins to work.)
19
            - . This should be a complete URL, starting with <code>http://</code> or <code>https://</code>. Do not include a trailing slash in the URL. (This must be filled in correctly for RSS, unAPI, and search plugins to work.)
20
        -
20
        -
21
            - Show
21
            - Show
22
            - pref: LibraryName
22
            - pref: LibraryName
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt (-2 / +2 lines)
Lines 445-453 function verify_images() { Link Here
445
</li>
445
</li>
446
    [% END %]
446
    [% END %]
447
    
447
    
448
    [% IF ( OpacUrl ) %]
448
    [% IF ( OPACBaseURL ) %]
449
        <li><strong>OPAC view:</strong>
449
        <li><strong>OPAC view:</strong>
450
    	<a href="http://[% OpacUrl %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblionumber %]" target="_blank">Open in new window</a>
450
	<a href="[% OPACBaseURL %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblionumber %]" target="_blank">Open in new window</a>
451
		</li>
451
		</li>
452
	[% END %]
452
	[% END %]
453
        <li id="catalogue_detail_marc_preview">
453
        <li id="catalogue_detail_marc_preview">
(-)a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl (-1 / +1 lines)
Lines 937-943 Link Here
937
937
938
        <xsl:if test="$OPACBaseURL!=''">
938
        <xsl:if test="$OPACBaseURL!=''">
939
        <span class="results_summary"><span class="label">OPAC view: </span>
939
        <span class="results_summary"><span class="label">OPAC view: </span>
940
            <a><xsl:attribute name="href">http://<xsl:value-of select="$OPACBaseURL"/>/cgi-bin/koha/opac-detail.pl?biblionumber=<xsl:value-of select="marc:datafield[@tag=999]/marc:subfield[@code='c']"/></xsl:attribute><xsl:attribute name="target">_blank</xsl:attribute>Open in new window</a>.
940
            <a><xsl:attribute name="href"><xsl:value-of select="$OPACBaseURL"/>/cgi-bin/koha/opac-detail.pl?biblionumber=<xsl:value-of select="marc:datafield[@tag=999]/marc:subfield[@code='c']"/></xsl:attribute><xsl:attribute name="target">_blank</xsl:attribute>Open in new window</a>.
941
        </span>
941
        </span>
942
        </xsl:if>
942
        </xsl:if>
943
943
(-)a/koha-tmpl/intranet-tmpl/prog/en/xslt/NORMARCslim2intranetDetail.xsl (-1 / +1 lines)
Lines 588-594 Link Here
588
        <!-- This will only work if the OPACBaseURL syspref is set. -->
588
        <!-- This will only work if the OPACBaseURL syspref is set. -->
589
        <xsl:if test="string-length($OPACBaseURL) > 0">
589
        <xsl:if test="string-length($OPACBaseURL) > 0">
590
        <p>OPAC View: <a>
590
        <p>OPAC View: <a>
591
                      <xsl:attribute name="href">http://<xsl:value-of select="$OPACBaseURL"/>/cgi-bin/koha/opac-detail.pl?biblionumber=<xsl:value-of select="$biblionumber"/></xsl:attribute>
591
                      <xsl:attribute name="href"><xsl:value-of select="$OPACBaseURL"/>/cgi-bin/koha/opac-detail.pl?biblionumber=<xsl:value-of select="$biblionumber"/></xsl:attribute>
592
                      <xsl:attribute name="target">_blank</xsl:attribute>
592
                      <xsl:attribute name="target">_blank</xsl:attribute>
593
                      Open in new window
593
                      Open in new window
594
                      </a></p>
594
                      </a></p>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt (-5 / +5 lines)
Lines 1117-1128 Link Here
1117
                [% IF ( SocialNetworks ) %]
1117
                [% IF ( SocialNetworks ) %]
1118
                    <div id="social_networks" class="clearfix">
1118
                    <div id="social_networks" class="clearfix">
1119
                        <span>Share</span>
1119
                        <span>Share</span>
1120
                        <div><a id="facebook" href="http://www.facebook.com/sharer.php?u=[% protocol %][% current_url |url %]&amp;t=[% title |url %]" title="Share on Facebook">Facebook</a></div>
1120
                        <div><a id="facebook" href="http://www.facebook.com/sharer.php?u=[% current_url |url %]&amp;t=[% title |url %]" title="Share on Facebook">Facebook</a></div>
1121
                        <div><a id="linkedin" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=[% protocol %][% current_url |url %]&amp;title=[% title |url %]" title="Share on LinkedIn">LinkedIn</a></div>
1121
                        <div><a id="linkedin" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=[% current_url |url %]&amp;title=[% title |url %]" title="Share on LinkedIn">LinkedIn</a></div>
1122
                        <div><a id="delicious" href="http://www.delicious.com/save?url=[% protocol %][% current_url |url %]&amp;title=[% title |url %]" title="Share on Delicious">Delicious</a></div>
1122
                        <div><a id="delicious" href="http://www.delicious.com/save?url=[% current_url |url %]&amp;title=[% title |url %]" title="Share on Delicious">Delicious</a></div>
1123
                        <div><a id="email" href="mailto:?subject=[% title |url %]&amp;body=[% title |url %]%20([% protocol %][% current_url |url %])" title="Share by email">Email</a></div>
1123
                        <div><a id="email" href="mailto:?subject=[% title |url %]&amp;body=[% title |url %]%20([% current_url |url %])" title="Share by email">Email</a></div>
1124
                        <div><div class="g-plusone" data-size="small" data-count="false"></div></div>
1124
                        <div><div class="g-plusone" data-size="small" data-count="false"></div></div>
1125
                        <div><a id="twitter" href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-text="[% title %]" data-lang="[% lang %]">Tweet</a></div>
1125
                        <div><a id="twitter" href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-text="[% title |url %]" data-lang="[% lang %]">Tweet</a></div>
1126
                    </div>
1126
                    </div>
1127
                [% END %]
1127
                [% END %]
1128
            </div> <!-- / .ulactioncontainer -->
1128
            </div> <!-- / .ulactioncontainer -->
(-)a/opac/opac-shareshelf.pl (-2 / +1 lines)
Lines 179-186 sub send_invitekey { Link Here
179
    my ($param) = @_;
179
    my ($param) = @_;
180
    my $fromaddr = C4::Context->preference('KohaAdminEmailAddress');
180
    my $fromaddr = C4::Context->preference('KohaAdminEmailAddress');
181
    my $url =
181
    my $url =
182
        'http://'
182
        C4::Context->preference('OPACBaseURL')
183
      . C4::Context->preference('OPACBaseURL')
184
      . "/cgi-bin/koha/opac-shareshelf.pl?shelfnumber="
183
      . "/cgi-bin/koha/opac-shareshelf.pl?shelfnumber="
185
      . $param->{shelfnumber}
184
      . $param->{shelfnumber}
186
      . "&op=accept&key=";
185
      . "&op=accept&key=";
(-)a/t/Auth_with_shibboleth.t (-2 / +24 lines)
Lines 27-33 use C4::Context; Link Here
27
27
28
BEGIN {
28
BEGIN {
29
    if ( check_install( module => 'Test::DBIx::Class' ) ) {
29
    if ( check_install( module => 'Test::DBIx::Class' ) ) {
30
        plan tests => 6;
30
        plan tests => 9;
31
    } else {
31
    } else {
32
        plan skip_all => "Need Test::DBIx::Class"
32
        plan skip_all => "Need Test::DBIx::Class"
33
    }
33
    }
Lines 59-64 sub mockedConfig { Link Here
59
}
59
}
60
60
61
### Mock ->preference
61
### Mock ->preference
62
my $OPACBaseURL = "testopac.com";
62
$context->mock( 'preference', \&mockedPref );
63
$context->mock( 'preference', \&mockedPref );
63
64
64
sub mockedPref {
65
sub mockedPref {
Lines 66-72 sub mockedPref { Link Here
66
    my $return;
67
    my $return;
67
68
68
    if ( $param eq 'OPACBaseURL' ) {
69
    if ( $param eq 'OPACBaseURL' ) {
69
        $return = "testopac.com";
70
        $return = $OPACBaseURL;
70
    }
71
    }
71
72
72
    return $return;
73
    return $return;
Lines 237-244 subtest "checkpw_shib tests" => sub { Link Here
237
};
238
};
238
239
239
## _get_uri
240
## _get_uri
241
$OPACBaseURL = "testopac.com";
240
is( C4::Auth_with_shibboleth::_get_uri(),
242
is( C4::Auth_with_shibboleth::_get_uri(),
241
    "https://testopac.com", "https opac uri returned" );
243
    "https://testopac.com", "https opac uri returned" );
242
244
245
$OPACBaseURL = "http://testopac.com";
246
my $result;
247
warnings_are { $result = C4::Auth_with_shibboleth::_get_uri() }
248
             [ { carped =>
249
                 'Shibboleth requires OPACBaseURL to use the https protocol!' },
250
             ],
251
             "improper protocol - received expected warning";
252
is( $result, "https://testopac.com", "https opac uri returned" );
253
254
$OPACBaseURL = "https://testopac.com";
255
is( C4::Auth_with_shibboleth::_get_uri(),
256
    "https://testopac.com", "https opac uri returned" );
257
258
$OPACBaseURL = undef;
259
warnings_are { $result = C4::Auth_with_shibboleth::_get_uri() }
260
             [ { carped => 'OPACBaseURL not set!' },
261
             ],
262
             "undefined OPACBaseURL - received expected warning";
263
is( $result, "https://", "https opac uri returned" );
264
243
## _get_shib_config
265
## _get_shib_config
244
# Internal helper function, covered in tests above
266
# Internal helper function, covered in tests above
(-)a/t/db_dependent/Auth.t (-1 / +29 lines)
Lines 8-14 use Modern::Perl; Link Here
8
use CGI qw ( -utf8 );
8
use CGI qw ( -utf8 );
9
use Test::MockModule;
9
use Test::MockModule;
10
use List::MoreUtils qw/all any none/;
10
use List::MoreUtils qw/all any none/;
11
use Test::More tests => 6;
11
use Test::More tests => 8;
12
use C4::Members;
12
use C4::Members;
13
use Koha::AuthUtils qw/hash_password/;
13
use Koha::AuthUtils qw/hash_password/;
14
14
Lines 107-112 $dbh->{RaiseError} = 1; Link Here
107
        'BZ9735: invalid language, then default to en');
107
        'BZ9735: invalid language, then default to en');
108
}
108
}
109
109
110
# Check that there is always an OPACBaseURL set.
111
my $input = CGI->new();
112
my ( $template1, $borrowernumber, $cookie );
113
( $template1, $borrowernumber, $cookie ) = get_template_and_user(
114
    {
115
        template_name => "opac-detail.tt",
116
        type => "opac",
117
        query => $input,
118
        authnotrequired => 1,
119
    }
120
);
121
122
ok( ( any { 'OPACBaseURL' eq $_ } keys %{$template1->{VARS}} ),
123
    'OPACBaseURL is in OPAC template' );
124
125
my ( $template2 );
126
( $template2, $borrowernumber, $cookie ) = get_template_and_user(
127
    {
128
        template_name => "catalogue/detail.tt",
129
        type => "intranet",
130
        query => $input,
131
        authnotrequired => 1,
132
    }
133
);
134
135
ok( ( any { 'OPACBaseURL' eq $_ } keys %{$template2->{VARS}} ),
136
    'OPACBaseURL is in Staff template' );
137
110
my $hash1 = hash_password('password');
138
my $hash1 = hash_password('password');
111
my $hash2 = hash_password('password');
139
my $hash2 = hash_password('password');
112
140
(-)a/t/db_dependent/Auth_with_cas.t (-1 / +1 lines)
Lines 38-44 my $dbh = C4::Context->dbh; Link Here
38
$dbh->{ AutoCommit } = 0;
38
$dbh->{ AutoCommit } = 0;
39
$dbh->{ RaiseError } = 1;
39
$dbh->{ RaiseError } = 1;
40
40
41
C4::Context->set_preference('OPACBaseURL','localhost');
41
C4::Context->set_preference('OPACBaseURL','http://localhost');
42
C4::Context->set_preference('staffClientBaseURL','localhost:8080');
42
C4::Context->set_preference('staffClientBaseURL','localhost:8080');
43
43
44
my $opac_base_url = C4::Context->preference('OpacBaseURL');
44
my $opac_base_url = C4::Context->preference('OpacBaseURL');
(-)a/t/db_dependent/Context.t (-1 / +27 lines)
Lines 18-25 BEGIN { Link Here
18
		use_ok('C4::Context');
18
		use_ok('C4::Context');
19
}
19
}
20
20
21
ok($koha = C4::Context->new,  'C4::Context->new');
22
ok($dbh = C4::Context->dbh(), 'Getting dbh from C4::Context');
21
ok($dbh = C4::Context->dbh(), 'Getting dbh from C4::Context');
22
23
$dbh->begin_work;
24
C4::Context->disable_syspref_cache();
25
C4::Context->set_preference('OPACBaseURL','junk');
26
C4::Context->clear_syspref_cache();
27
my $OPACBaseURL = C4::Context->preference('OPACBaseURL');
28
is($OPACBaseURL,'http://junk','OPACBaseURL saved with http:// when missing it');
29
30
C4::Context->set_preference('OPACBaseURL','https://junk');
31
C4::Context->clear_syspref_cache();
32
$OPACBaseURL = C4::Context->preference('OPACBaseURL');
33
is($OPACBaseURL,'https://junk','OPACBaseURL saved with https:// as specified');
34
35
C4::Context->set_preference('OPACBaseURL','http://junk2');
36
C4::Context->clear_syspref_cache();
37
$OPACBaseURL = C4::Context->preference('OPACBaseURL');
38
is($OPACBaseURL,'http://junk2','OPACBaseURL saved with http:// as specified');
39
40
C4::Context->set_preference('SillyPreference','random');
41
C4::Context->clear_syspref_cache();
42
my $SillyPeference = C4::Context->preference('SillyPreference');
43
is($SillyPeference,'random','SillyPreference saved as specified');
44
C4::Context->clear_syspref_cache();
45
C4::Context->enable_syspref_cache();
46
$dbh->rollback;
47
48
ok($koha = C4::Context->new,  'C4::Context->new');
23
my @keys = keys %$koha;
49
my @keys = keys %$koha;
24
my $width = 0;
50
my $width = 0;
25
if (ok(@keys)) { 
51
if (ok(@keys)) { 
(-)a/virtualshelves/sendshelf.pl (-6 lines)
Lines 101-111 if ($email) { Link Here
101
        push( @results, $dat );
101
        push( @results, $dat );
102
    }
102
    }
103
103
104
    if ( C4::Context->preference('OPACBaseURL') ) {
105
        $template2->param(
106
            OPACBaseURL => C4::Context->preference('OPACBaseURL') );
107
    }
108
109
    $template2->param(
104
    $template2->param(
110
        BIBLIO_RESULTS => \@results,
105
        BIBLIO_RESULTS => \@results,
111
        email_sender   => $mail{'from'},
106
        email_sender   => $mail{'from'},
112
- 

Return to bug 5010