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

(-)a/C4/Auth.pm (-6 / +1 lines)
Lines 370-375 sub get_template_and_user { Link Here
370
            noItemTypeImages             => C4::Context->preference("noItemTypeImages"),
370
            noItemTypeImages             => C4::Context->preference("noItemTypeImages"),
371
            marcflavour                  => C4::Context->preference("marcflavour"),
371
            marcflavour                  => C4::Context->preference("marcflavour"),
372
            persona                      => C4::Context->preference("persona"),
372
            persona                      => C4::Context->preference("persona"),
373
            OPACBaseURL                  => C4::Context->preference('OPACBaseURL'),
373
    );
374
    );
374
    if ( $in->{'type'} eq "intranet" ) {
375
    if ( $in->{'type'} eq "intranet" ) {
375
        $template->param(
376
        $template->param(
Lines 436-446 sub get_template_and_user { Link Here
436
        } elsif (C4::Context->preference("SearchMyLibraryFirst") && C4::Context->userenv && C4::Context->userenv->{'branch'}) {
437
        } elsif (C4::Context->preference("SearchMyLibraryFirst") && C4::Context->userenv && C4::Context->userenv->{'branch'}) {
437
            $opac_name = C4::Context->userenv->{'branch'};
438
            $opac_name = C4::Context->userenv->{'branch'};
438
        }
439
        }
439
        # FIXME Under Plack the CGI->https method always returns 'OFF' ($using_https will be set to 0 in this case)
440
        my $opac_base_url = C4::Context->preference("OPACBaseURL"); #FIXME uses $using_https below as well
441
        if (!$opac_base_url){
442
            $opac_base_url = $ENV{'SERVER_NAME'} . ($ENV{'SERVER_PORT'} eq ($using_https ? "443" : "80") ? '' : ":$ENV{'SERVER_PORT'}");
443
        }
444
        $template->param(
440
        $template->param(
445
            opaccolorstylesheet       => C4::Context->preference("opaccolorstylesheet"),
441
            opaccolorstylesheet       => C4::Context->preference("opaccolorstylesheet"),
446
            AnonSuggestions           => "" . C4::Context->preference("AnonSuggestions"),
442
            AnonSuggestions           => "" . C4::Context->preference("AnonSuggestions"),
Lines 460-466 sub get_template_and_user { Link Here
460
            OPACUserCSS               => "". C4::Context->preference("OPACUserCSS"),
456
            OPACUserCSS               => "". C4::Context->preference("OPACUserCSS"),
461
            OPACViewOthersSuggestions => "" . C4::Context->preference("OPACViewOthersSuggestions"),
457
            OPACViewOthersSuggestions => "" . C4::Context->preference("OPACViewOthersSuggestions"),
462
            OpacAuthorities           => C4::Context->preference("OpacAuthorities"),
458
            OpacAuthorities           => C4::Context->preference("OpacAuthorities"),
463
            OPACBaseURL               => ($using_https ? "https://" : "http://") . $opac_base_url,
464
            opac_css_override         => $ENV{'OPAC_CSS_OVERRIDE'},
459
            opac_css_override         => $ENV{'OPAC_CSS_OVERRIDE'},
465
            opac_search_limit         => $opac_search_limit,
460
            opac_search_limit         => $opac_search_limit,
466
            opac_limit_override       => $opac_limit_override,
461
            opac_limit_override       => $opac_limit_override,
(-)a/C4/Auth_with_shibboleth.pm (-1 / +14 lines)
Lines 112-119 sub checkpw_shib { Link Here
112
sub _get_uri {
112
sub _get_uri {
113
113
114
    my $protocol = "https://";
114
    my $protocol = "https://";
115
    my $uri = C4::Context->preference('OPACBaseURL') // '';
116
    if ($uri eq '') {
117
        $debug and warn 'OPACBaseURL not set!';
118
    }
119
    if ($uri =~ /(.*):\/\/(.*)/) {
120
        my $oldprotocol = $1;
121
        if ($oldprotocol ne 'https') {
122
            $debug
123
              and warn
124
                'Shibboleth requires OPACBaseURL to use the https protocol!';
125
        }
126
        $uri = $2;
127
    }
115
128
116
    my $return = $protocol . C4::Context->preference('OPACBaseURL');
129
    my $return = $protocol . $uri;
117
    return $return;
130
    return $return;
118
}
131
}
119
132
(-)a/C4/Context.pm (+5 lines)
Lines 637-642 sub set_preference { Link Here
637
637
638
    $value = 0 if ( $type && $type eq 'YesNo' && $value eq '' );
638
    $value = 0 if ( $type && $type eq 'YesNo' && $value eq '' );
639
639
640
    # force explicit protocol on OPACBaseURL
641
    if ($var eq 'opacbaseurl' && substr($value,0,4) !~ /http/) {
642
        $value = 'http://' . $value;
643
    }
644
640
    my $sth = $dbh->prepare( "
645
    my $sth = $dbh->prepare( "
641
      INSERT INTO systempreferences
646
      INSERT INTO systempreferences
642
        ( variable, value )
647
        ( variable, value )
(-)a/catalogue/detail.pl (-6 lines)
Lines 396-407 if ( (C4::Context->preference("HTML5MediaEnabled") eq 'both') or (C4::Context->p Link Here
396
    $template->param( C4::HTML5Media->gethtml5media($record));
396
    $template->param( C4::HTML5Media->gethtml5media($record));
397
}
397
}
398
398
399
400
# Get OPAC URL
401
if (C4::Context->preference('OPACBaseURL')){
402
     $template->param( OpacUrl => C4::Context->preference('OPACBaseURL') );
403
}
404
405
# Displaying tags
399
# Displaying tags
406
400
407
my $tag_quantity;
401
my $tag_quantity;
(-)a/installer/data/mysql/de-DE/mandatory/sample_notices.sql (-1 / +1 lines)
Lines 100-106 VALUES ( Link Here
100
100
101
Ihr Bibliothekskonto wurde angelegt. Bitte bestätigen Sie Ihre E-Mail-Adresse indem Sie auf folgenden Link klicken:
101
Ihr Bibliothekskonto wurde angelegt. Bitte bestätigen Sie Ihre E-Mail-Adresse indem Sie auf folgenden Link klicken:
102
102
103
http://<<OPACBaseURL>>/cgi-bin/koha/opac-registration-verify.pl?token=<<borrower_modifications.verification_token>>
103
<<OPACBaseURL>>/cgi-bin/koha/opac-registration-verify.pl?token=<<borrower_modifications.verification_token>>
104
104
105
Wenn Sie keine Kontoanmeldung durchgeführt haben, können Sie diese Benachrichtigung ignorieren. Sie wird in Kürze ungültig.
105
Wenn Sie keine Kontoanmeldung durchgeführt haben, können Sie diese Benachrichtigung ignorieren. Sie wird in Kürze ungültig.
106
106
(-)a/installer/data/mysql/en/mandatory/sample_notices.sql (-1 / +1 lines)
Lines 113-119 VALUES ( Link Here
113
113
114
Your library account has been created. Please verify your email address by clicking this link to complete the signup process:
114
Your library account has been created. Please verify your email address by clicking this link to complete the signup process:
115
115
116
http://<<OPACBaseURL>>/cgi-bin/koha/opac-registration-verify.pl?token=<<borrower_modifications.verification_token>>
116
<<OPACBaseURL>>/cgi-bin/koha/opac-registration-verify.pl?token=<<borrower_modifications.verification_token>>
117
117
118
If you did not initiate this request, you may safely ignore this one-time message. The request will expire shortly.'
118
If you did not initiate this request, you may safely ignore this one-time message. The request will expire shortly.'
119
);
119
);
(-)a/installer/data/mysql/nb-NO/1-Obligatorisk/sample_notices.sql (-1 / +1 lines)
Lines 134-140 VALUES ( Link Here
134
134
135
D har blitt registrert som bruker av biblioteket. Verifiser epostadressen din ved å klikke på lenka nedenfor:
135
D har blitt registrert som bruker av biblioteket. Verifiser epostadressen din ved å klikke på lenka nedenfor:
136
136
137
http://<<OPACBaseURL>>/cgi-bin/koha/opac-registration-verify.pl?token=<<borrower_modifications.verification_token>>
137
<<OPACBaseURL>>/cgi-bin/koha/opac-registration-verify.pl?token=<<borrower_modifications.verification_token>>
138
138
139
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.'
139
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.'
140
);
140
);
(-)a/installer/data/mysql/sysprefs.sql (-1 / +1 lines)
Lines 237-243 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
237
('OPACAllowUserToChooseBranch','1','1','Allow the user to choose the branch they want to pickup their hold from','YesNo'),
237
('OPACAllowUserToChooseBranch','1','1','Allow the user to choose the branch they want to pickup their hold from','YesNo'),
238
('OPACAmazonCoverImages','0','','Display cover images on OPAC from Amazon Web Services','YesNo'),
238
('OPACAmazonCoverImages','0','','Display cover images on OPAC from Amazon Web Services','YesNo'),
239
('OpacAuthorities','1',NULL,'If ON, enables the search authorities link on OPAC','YesNo'),
239
('OpacAuthorities','1',NULL,'If ON, enables the search authorities link on OPAC','YesNo'),
240
('OPACBaseURL',NULL,NULL,'Specify the Base URL of the OPAC, e.g., opac.mylibrary.com, the http:// will be added automatically by Koha.','Free'),
240
('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'),
241
('opacbookbag','1','','If ON, enables display of Cart feature','YesNo'),
241
('opacbookbag','1','','If ON, enables display of Cart feature','YesNo'),
242
('OpacBrowser','0',NULL,'If ON, enables subject authorities browser on OPAC (needs to set misc/cronjob/sbuild_browser_and_cloud.pl)','YesNo'),
242
('OpacBrowser','0',NULL,'If ON, enables subject authorities browser on OPAC (needs to set misc/cronjob/sbuild_browser_and_cloud.pl)','YesNo'),
243
('OpacBrowseResults','1',NULL,'Disable/enable browsing and paging search results from the OPAC detail page.','YesNo'),
243
('OpacBrowseResults','1',NULL,'Disable/enable browsing and paging search results from the OPAC detail page.','YesNo'),
(-)a/installer/data/mysql/updatedatabase.pl (+22 lines)
Lines 9525-9530 if ( CheckVersion($DBversion) ) { Link Here
9525
    SetVersion($DBversion);
9525
    SetVersion($DBversion);
9526
}
9526
}
9527
9527
9528
$DBversion = '3.17.00.XXX';
9529
if ( CheckVersion($DBversion) ) {
9530
    my $OPACBaseURL = C4::Context->preference('OPACBaseURL');
9531
    if (defined($OPACBaseURL) && substr($OPACBaseURL,0,4) ne "http") {
9532
        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.};
9533
        $OPACBaseURL = 'http://' . $OPACBaseURL;
9534
        my $sth_OPACBaseURL = $dbh->prepare( q{
9535
            UPDATE systempreferences SET value=?,explanation=?
9536
            WHERE variable='OPACBaseURL'; } );
9537
        $sth->execute($OPACBaseURL,$explanation);
9538
        $dbh->do( q{ UPDATE letter
9539
                     SET content=replace(content,
9540
                                         'http://<<OPACBaseURL>>',
9541
                                         '<<OPACBaseURL>>')
9542
                     WHERE content LIKE "%http://<<OPACBaseURL>>%"; } );
9543
    }
9544
9545
    print "Upgrade to $DBversion done (Bug 5010: Fix OPACBaseURL to include protocol)\n";
9546
    SetVersion($DBversion);
9547
}
9548
9549
9528
=head1 FUNCTIONS
9550
=head1 FUNCTIONS
9529
9551
9530
=head2 TableExists($table)
9552
=head2 TableExists($table)
(-)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 418-426 function verify_images() { Link Here
418
</li>
418
</li>
419
    [% END %]
419
    [% END %]
420
    
420
    
421
    [% IF ( OpacUrl ) %]
421
    [% IF ( OPACBaseURL ) %]
422
        <li><strong>OPAC view:</strong>
422
        <li><strong>OPAC view:</strong>
423
    	<a href="http://[% OpacUrl %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblionumber %]" target="_blank">Open in new window</a>
423
        <a href="[% OPACBaseURL %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblionumber %]" target="_blank">Open in new window</a>
424
		</li>
424
		</li>
425
	[% END %]
425
	[% END %]
426
        <li id="catalogue_detail_marc_preview">
426
        <li id="catalogue_detail_marc_preview">
(-)a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl (-1 / +1 lines)
Lines 859-865 Link Here
859
859
860
        <xsl:if test="$OPACBaseURL!=''">
860
        <xsl:if test="$OPACBaseURL!=''">
861
        <span class="results_summary"><span class="label">OPAC view: </span>
861
        <span class="results_summary"><span class="label">OPAC view: </span>
862
            <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>.
862
            <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>.
863
        </span>
863
        </span>
864
        </xsl:if>
864
        </xsl:if>
865
865
(-)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 1097-1108 Link Here
1097
                [% IF ( SocialNetworks ) %]
1097
                [% IF ( SocialNetworks ) %]
1098
                    <div id="social_networks" class="clearfix">
1098
                    <div id="social_networks" class="clearfix">
1099
                        <span>Share</span>
1099
                        <span>Share</span>
1100
                        <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>
1100
                        <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>
1101
                        <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>
1101
                        <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>
1102
                        <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>
1102
                        <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>
1103
                        <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>
1103
                        <div><a id="email" href="mailto:?subject=[% title |url %]&amp;body=[% title |url %]%20([% current_url |url %])" title="Share by email">Email</a></div>
1104
                        <div><div class="g-plusone" data-size="small" data-count="false"></div></div>
1104
                        <div><div class="g-plusone" data-size="small" data-count="false"></div></div>
1105
                        <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>
1105
                        <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>
1106
                    </div>
1106
                    </div>
1107
                [% END %]
1107
                [% END %]
1108
            </div> <!-- / .ulactioncontainer -->
1108
            </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;
8
use CGI;
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
42
43
my $opac_base_url = C4::Context->preference('OpacBaseURL');
43
my $opac_base_url = C4::Context->preference('OpacBaseURL');
44
my $query_string = 'ticket=foo&bar=baz';
44
my $query_string = 'ticket=foo&bar=baz';
(-)a/t/db_dependent/Context.t (-1 / +28 lines)
Lines 6-11 use warnings; Link Here
6
6
7
use Test::More;
7
use Test::More;
8
use Test::MockModule;
8
use Test::MockModule;
9
use Data::Dumper;
9
use vars qw($debug $koha $dbh $config $ret);
10
use vars qw($debug $koha $dbh $config $ret);
10
11
11
BEGIN {
12
BEGIN {
Lines 18-25 BEGIN { Link Here
18
		use_ok('C4::Context');
19
		use_ok('C4::Context');
19
}
20
}
20
21
21
ok($koha = C4::Context->new,  'C4::Context->new');
22
ok($dbh = C4::Context->dbh(), 'Getting dbh from C4::Context');
22
ok($dbh = C4::Context->dbh(), 'Getting dbh from C4::Context');
23
24
$dbh->begin_work;
25
C4::Context->disable_syspref_cache();
26
C4::Context->set_preference('OPACBaseURL','junk');
27
C4::Context->clear_syspref_cache();
28
my $OPACBaseURL = C4::Context->preference('OPACBaseURL');
29
is($OPACBaseURL,'http://junk','OPACBaseURL saved with http:// when missing it');
30
31
C4::Context->set_preference('OPACBaseURL','https://junk');
32
C4::Context->clear_syspref_cache();
33
$OPACBaseURL = C4::Context->preference('OPACBaseURL');
34
is($OPACBaseURL,'https://junk','OPACBaseURL saved with https:// as specified');
35
36
C4::Context->set_preference('OPACBaseURL','http://junk2');
37
C4::Context->clear_syspref_cache();
38
$OPACBaseURL = C4::Context->preference('OPACBaseURL');
39
is($OPACBaseURL,'http://junk2','OPACBaseURL saved with http:// as specified');
40
41
C4::Context->set_preference('SillyPreference','random');
42
C4::Context->clear_syspref_cache();
43
my $SillyPeference = C4::Context->preference('SillyPreference');
44
is($SillyPeference,'random','SillyPreference saved as specified');
45
C4::Context->clear_syspref_cache();
46
C4::Context->enable_syspref_cache();
47
$dbh->rollback;
48
49
ok($koha = C4::Context->new,  'C4::Context->new');
23
ok($ret = C4::Context->KOHAVERSION, '  (function)  KOHAVERSION = ' . ($ret||''));
50
ok($ret = C4::Context->KOHAVERSION, '  (function)  KOHAVERSION = ' . ($ret||''));
24
ok($ret =       $koha->KOHAVERSION, '       $koha->KOHAVERSION = ' . ($ret||''));
51
ok($ret =       $koha->KOHAVERSION, '       $koha->KOHAVERSION = ' . ($ret||''));
25
ok(
52
ok(
(-)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