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

(-)a/C4/Auth.pm (-6 / +1 lines)
Lines 383-388 sub get_template_and_user { Link Here
383
        noItemTypeImages   => C4::Context->preference("noItemTypeImages"),
383
        noItemTypeImages   => C4::Context->preference("noItemTypeImages"),
384
        marcflavour        => C4::Context->preference("marcflavour"),
384
        marcflavour        => C4::Context->preference("marcflavour"),
385
        persona            => C4::Context->preference("persona"),
385
        persona            => C4::Context->preference("persona"),
386
        OPACBaseURL        => C4::Context->preference('OPACBaseURL'),
386
    );
387
    );
387
    if ( $in->{'type'} eq "intranet" ) {
388
    if ( $in->{'type'} eq "intranet" ) {
388
        $template->param(
389
        $template->param(
Lines 453-463 sub get_template_and_user { Link Here
453
            $opac_name = C4::Context->userenv->{'branch'};
454
            $opac_name = C4::Context->userenv->{'branch'};
454
        }
455
        }
455
456
456
        # FIXME Under Plack the CGI->https method always returns 'OFF' ($using_https will be set to 0 in this case)
457
        my $opac_base_url = C4::Context->preference("OPACBaseURL");    #FIXME uses $using_https below as well
458
        if ( !$opac_base_url ) {
459
            $opac_base_url = $ENV{'SERVER_NAME'} . ( $ENV{'SERVER_PORT'} eq ( $using_https ? "443" : "80" ) ? '' : ":$ENV{'SERVER_PORT'}" );
460
        }
461
        $template->param(
457
        $template->param(
462
            opaccolorstylesheet                   => C4::Context->preference("opaccolorstylesheet"),
458
            opaccolorstylesheet                   => C4::Context->preference("opaccolorstylesheet"),
463
            AnonSuggestions                       => "" . C4::Context->preference("AnonSuggestions"),
459
            AnonSuggestions                       => "" . C4::Context->preference("AnonSuggestions"),
Lines 477-483 sub get_template_and_user { Link Here
477
            OPACUserCSS                           => "" . C4::Context->preference("OPACUserCSS"),
473
            OPACUserCSS                           => "" . C4::Context->preference("OPACUserCSS"),
478
            OPACViewOthersSuggestions             => "" . C4::Context->preference("OPACViewOthersSuggestions"),
474
            OPACViewOthersSuggestions             => "" . C4::Context->preference("OPACViewOthersSuggestions"),
479
            OpacAuthorities                       => C4::Context->preference("OpacAuthorities"),
475
            OpacAuthorities                       => C4::Context->preference("OpacAuthorities"),
480
            OPACBaseURL                           => ( $using_https ? "https://" : "http://" ) . $opac_base_url,
481
            opac_css_override                     => $ENV{'OPAC_CSS_OVERRIDE'},
476
            opac_css_override                     => $ENV{'OPAC_CSS_OVERRIDE'},
482
            opac_search_limit                     => $opac_search_limit,
477
            opac_search_limit                     => $opac_search_limit,
483
            opac_limit_override                   => $opac_limit_override,
478
            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 638-643 sub set_preference { Link Here
638
638
639
    $value = 0 if ( $type && $type eq 'YesNo' && $value eq '' );
639
    $value = 0 if ( $type && $type eq 'YesNo' && $value eq '' );
640
640
641
    # force explicit protocol on OPACBaseURL
642
    if ($var eq 'opacbaseurl' && substr($value,0,4) !~ /http/) {
643
        $value = 'http://' . $value;
644
    }
645
641
    my $sth = $dbh->prepare( "
646
    my $sth = $dbh->prepare( "
642
      INSERT INTO systempreferences
647
      INSERT INTO systempreferences
643
        ( variable, value )
648
        ( 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 240-246 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
240
('OPACAllowUserToChooseBranch','1','1','Allow the user to choose the branch they want to pickup their hold from','YesNo'),
240
('OPACAllowUserToChooseBranch','1','1','Allow the user to choose the branch they want to pickup their hold from','YesNo'),
241
('OPACAmazonCoverImages','0','','Display cover images on OPAC from Amazon Web Services','YesNo'),
241
('OPACAmazonCoverImages','0','','Display cover images on OPAC from Amazon Web Services','YesNo'),
242
('OpacAuthorities','1',NULL,'If ON, enables the search authorities link on OPAC','YesNo'),
242
('OpacAuthorities','1',NULL,'If ON, enables the search authorities link on OPAC','YesNo'),
243
('OPACBaseURL',NULL,NULL,'Specify the Base URL of the OPAC, e.g., opac.mylibrary.com, the http:// will be added automatically by Koha.','Free'),
243
('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'),
244
('opacbookbag','1','','If ON, enables display of Cart feature','YesNo'),
244
('opacbookbag','1','','If ON, enables display of Cart feature','YesNo'),
245
('OpacBrowser','0',NULL,'If ON, enables subject authorities browser on OPAC (needs to set misc/cronjob/sbuild_browser_and_cloud.pl)','YesNo'),
245
('OpacBrowser','0',NULL,'If ON, enables subject authorities browser on OPAC (needs to set misc/cronjob/sbuild_browser_and_cloud.pl)','YesNo'),
246
('OpacBrowseResults','1',NULL,'Disable/enable browsing and paging search results from the OPAC detail page.','YesNo'),
246
('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 9669-9674 if ( CheckVersion($DBversion) ) { Link Here
9669
    SetVersion ($DBversion);
9669
    SetVersion ($DBversion);
9670
}
9670
}
9671
9671
9672
$DBversion = '3.19.00.XXX';
9673
if ( CheckVersion($DBversion) ) {
9674
    my $OPACBaseURL = C4::Context->preference('OPACBaseURL');
9675
    if (defined($OPACBaseURL) && substr($OPACBaseURL,0,4) ne "http") {
9676
        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.};
9677
        $OPACBaseURL = 'http://' . $OPACBaseURL;
9678
        my $sth_OPACBaseURL = $dbh->prepare( q{
9679
            UPDATE systempreferences SET value=?,explanation=?
9680
            WHERE variable='OPACBaseURL'; } );
9681
        $sth->execute($OPACBaseURL,$explanation);
9682
        $dbh->do( q{ UPDATE letter
9683
                     SET content=replace(content,
9684
                                         'http://<<OPACBaseURL>>',
9685
                                         '<<OPACBaseURL>>')
9686
                     WHERE content LIKE "%http://<<OPACBaseURL>>%"; } );
9687
    }
9688
9689
    print "Upgrade to $DBversion done (Bug 5010: Fix OPACBaseURL to include protocol)\n";
9690
    SetVersion($DBversion);
9691
}
9692
9693
9672
=head1 FUNCTIONS
9694
=head1 FUNCTIONS
9673
9695
9674
=head2 TableExists($table)
9696
=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 425-433 function verify_images() { Link Here
425
</li>
425
</li>
426
    [% END %]
426
    [% END %]
427
    
427
    
428
    [% IF ( OpacUrl ) %]
428
    [% IF ( OPACBaseURL ) %]
429
        <li><strong>OPAC view:</strong>
429
        <li><strong>OPAC view:</strong>
430
    	<a href="http://[% OpacUrl %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblionumber %]" target="_blank">Open in new window</a>
430
        <a href="[% OPACBaseURL %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblionumber %]" target="_blank">Open in new window</a>
431
		</li>
431
		</li>
432
	[% END %]
432
	[% END %]
433
        <li id="catalogue_detail_marc_preview">
433
        <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 1105-1116 Link Here
1105
                [% IF ( SocialNetworks ) %]
1105
                [% IF ( SocialNetworks ) %]
1106
                    <div id="social_networks" class="clearfix">
1106
                    <div id="social_networks" class="clearfix">
1107
                        <span>Share</span>
1107
                        <span>Share</span>
1108
                        <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>
1108
                        <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>
1109
                        <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>
1109
                        <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>
1110
                        <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>
1110
                        <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>
1111
                        <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>
1111
                        <div><a id="email" href="mailto:?subject=[% title |url %]&amp;body=[% title |url %]%20([% current_url |url %])" title="Share by email">Email</a></div>
1112
                        <div><div class="g-plusone" data-size="small" data-count="false"></div></div>
1112
                        <div><div class="g-plusone" data-size="small" data-count="false"></div></div>
1113
                        <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>
1113
                        <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>
1114
                    </div>
1114
                    </div>
1115
                [% END %]
1115
                [% END %]
1116
            </div> <!-- / .ulactioncontainer -->
1116
            </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
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