Bugzilla – Attachment 27049 Details for
Bug 5010
Fix OPACBaseURL to include protocol
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 5010: Fix incomplete links in carts and lists sent from the staff client
Bug-5010-Fix-incomplete-links-in-carts-and-lists-s.patch (text/plain), 9.80 KB, created by
Mark Tompsett
on 2014-04-12 01:01:59 UTC
(
hide
)
Description:
Bug 5010: Fix incomplete links in carts and lists sent from the staff client
Filename:
MIME Type:
Creator:
Mark Tompsett
Created:
2014-04-12 01:01:59 UTC
Size:
9.80 KB
patch
obsolete
>From f193a77cefd3b928c51df478d5404b0a8d1b7c78 Mon Sep 17 00:00:00 2001 >From: Mark Tompsett <mtompset@hotmail.com> >Date: Fri, 11 Apr 2014 13:44:16 -0400 >Subject: [PATCH] Bug 5010: Fix incomplete links in carts and lists sent from > the staff client > >While the list email hardcoded http:// in front of the URL, the cart email >was missing http(s)://. > >As there seems to be no reliable way to determine in staff >if the OPAC is using SSL or not, this patch introduces a new >OPAC system preference, OpacProtocol, in the Policy subsection. >It defaults to "doesn't use" (http://), but can be changed to >"uses" (https://). > >basket/sendbasket.pl was tweaked for OpacProtocol changes. > >opac/opac-sendshelf.pl was returned to previous state, because >it affects doc-head-close.inc if OPACBaseURL is not passed. This >should be fixed to use the OpacProtocol system preference in >another bug fix. > >virtualshelves/sendshelf.pl was returned to previous >state, because the OpacProtocol logic is now in the >virtualshelves/sendshelf.tt template file. > >TEST PLAN >--------- >1) Back up your database >2) Drop your koha database and recreate it empty >3) In the mysql client: > > SOURCE .../installer/data/mysql/sysprefs.sql; > -- It should run without error. > > SELECT variable,value from systempreferences WHERE variable='OpacProtocol'; > -- It should have the value 'http://' >4) Restore your database >5) $ ./installer/data/mysql/updatedatabase.pl > -- It should run the upgrade to insert OpacProtocol. >6) In the mysql client: > > SELECT variable,value from systempreferences WHERE variable='OpacProtocol'; > -- It should have the value 'http://' >7) Log into the staff client >8) Click 'Koha administration' >9) Click 'Global system preferences' >10) Click the 'OPAC' tab on the left side. >11) Scroll down to the Policy section, and find the OpacProtocol > preference. > -- It should have a value of "doesn't use" in the drop down. >12) Fill your cart with something(s). >13) Make sure you have a list filled with something(s). >14) Click 'Cart' in the top menu bar area. >15) Click 'Send', and send it to yourself. >16) Click 'Close window' >17) Click 'Hide window' >18) Click 'More' and click 'Lists' >19) Choose a list and 'Send list' to yourself. >20) Check your email > -- both emails should have OPAC URLs which start with http:// >21) Change the OPAC system preference OpacProtocol to > 'uses' (https://), log out and log in (to force refresh of > cached system preferences), and repeat steps 14 through 19. >22) Check your email > -- the two new emails should have OPAC URLS which start with > https:// > >NOTE: Other URLs may be broken as well, this bug only fixes carts > and lists sent from staff. >--- > basket/sendbasket.pl | 10 +++++----- > installer/data/mysql/sysprefs.sql | 2 +- > installer/data/mysql/updatedatabase.pl | 4 ++-- > .../prog/en/modules/admin/preferences/opac.pref | 6 +++--- > .../prog/en/modules/virtualshelves/sendshelf.tt | 4 ++-- > opac/opac-sendshelf.pl | 4 ++++ > virtualshelves/sendshelf.pl | 3 +-- > 7 files changed, 18 insertions(+), 15 deletions(-) > >diff --git a/basket/sendbasket.pl b/basket/sendbasket.pl >index 265b269..a0261d6 100755 >--- a/basket/sendbasket.pl >+++ b/basket/sendbasket.pl >@@ -86,7 +86,7 @@ if ( $email_add ) { > if($dat->{'author'} || @$marcauthorsarray) { > $hasauthors = 1; > } >- >+ > > $dat->{MARCNOTES} = $marcnotesarray; > $dat->{MARCSUBJCTS} = $marcsubjctsarray; >@@ -100,10 +100,10 @@ if ( $email_add ) { > push( @results, $dat ); > } > >- my $protocol = C4::Context->preference('PublicCatalogUsesSSL') ? "https://" : "http://"; >- if (C4::Context->preference('OPACBaseURL')){ >- $template2->param( OPACBaseURL => $protocol . C4::Context->preference('OPACBaseURL') ); >- } >+ if (C4::Context->preference('OPACBaseURL')){ >+ my $protocol = C4::Context->preference('OpacProtocol') // 'http://'; >+ $template2->param( OPACBaseURL => $protocol . C4::Context->preference('OPACBaseURL') ); >+ } > > my $resultsarray = \@results; > $template2->param( >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index d4a670b..5f9a941 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -253,6 +253,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('OPACPatronDetails','1','','If OFF the patron details tab in the OPAC is disabled.','YesNo'), > ('OPACpatronimages','0',NULL,'Enable patron images in the OPAC','YesNo'), > ('OpacPrivacy','0',NULL,'if ON, allows patrons to define their privacy rules (reading history)','YesNo'), >+('OpacProtocol','http://','http://|https://','Public catalog/OPAC uses SSL','Choice'), > ('OpacPublic','1',NULL,'Turn on/off public OPAC','YesNo'), > ('opacreadinghistory','1','','If ON, enables display of Patron Circulation History in OPAC','YesNo'), > ('OpacRenewalAllowed','0',NULL,'If ON, users can renew their issues directly from their OPAC account','YesNo'), >@@ -306,7 +307,6 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('previousIssuesDefaultSortOrder','asc','asc|desc','Specify the sort order of Previous Issues on the circulation page','Choice'), > ('printcirculationslips','1','','If ON, enable printing circulation receipts','YesNo'), > ('PrintNoticesMaxLines','0','','If greater than 0, sets the maximum number of lines an overdue notice will print. If the number of items is greater than this number, the notice will end with a warning asking the borrower to check their online account for a full list of overdue items.','Integer'), >-('PublicCatalogUsesSSL',0,'','Public catalog/OPAC uses SSL','YesNo'), > ('QueryAutoTruncate','1',NULL,'If ON, query truncation is enabled by default','YesNo'), > ('QueryFuzzy','1',NULL,'If ON, enables fuzzy option for searches','YesNo'), > ('QueryStemming','1',NULL,'If ON, enables query stemming','YesNo'), >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 2bc9868..3b5303a 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -8110,8 +8110,8 @@ if(CheckVersion($DBversion)) { > $DBversion = "3.15.00.XXX"; > if ( CheckVersion($DBversion) ) { > $dbh->do(q{INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES >- ('PublicCatalogUsesSSL',0,'','Public catalog/OPAC uses SSL','YesNo');}); >- print "Upgrade to $DBversion done (Bug 5010: Add PublicCatalogUsesSSL system preference)\n"; >+ ('OpacProtocol','http://','http://|https://','Public catalog/OPAC uses SSL','Choice');}); >+ print "Upgrade to $DBversion done (Bug 5010: Add OpacProtocol system preference)\n"; > SetVersion($DBversion); > } > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >index 2b10221..8f58240 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >@@ -447,10 +447,10 @@ OPAC: > - patrons to select their branch on the OPAC or show branch names with callnumbers. > - > - The public catalog >- - pref: PublicCatalogUsesSSL >+ - pref: OpacProtocol > choices: >- yes: uses >- no: "doesn't use" >+ "https://": uses >+ "http://": "doesn't use" > - SSL. > - > - pref: SearchMyLibraryFirst >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/sendshelf.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/sendshelf.tt >index 7a2a90e..9e3e96a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/sendshelf.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/sendshelf.tt >@@ -1,4 +1,4 @@ >-<SUBJECT> >+[% USE Koha -%]<SUBJECT> > Your List : [% shelfname %] > <END_SUBJECT> > >@@ -35,7 +35,7 @@ Classification: [% BIBLIO_RESULT.classification %][% END %][% IF ( BIBLIO_RESULT > LCCN: [% BIBLIO_RESULT.lccn %][% END %][% IF ( BIBLIO_RESULT.url ) %] > URL : [% BIBLIO_RESULT.url %][% END %][% IF ( OPACBaseURL ) %] > In the online catalog: >- [% OPACBaseURL %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% BIBLIO_RESULT.biblionumber |url %][% END %] >+ [% Koha.Preference( 'OPACProtocol' ) %][% OPACBaseURL %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% BIBLIO_RESULT.biblionumber |url %][% END %] > Items : [% FOREACH ITEM_RESULT IN BIBLIO_RESULT.ITEM_RESULTS %] > [% ITEM_RESULT.branchname %] [% ITEM_RESULT.location %] [% IF ( ITEM_RESULT.itemcallnumber ) %]([% ITEM_RESULT.itemcallnumber %])[% END %] [% ITEM_RESULT.barcode %][% END %] > >diff --git a/opac/opac-sendshelf.pl b/opac/opac-sendshelf.pl >index d0507fb..80b54e2 100755 >--- a/opac/opac-sendshelf.pl >+++ b/opac/opac-sendshelf.pl >@@ -107,6 +107,10 @@ if ( $email ) { > > my $user = GetMember(borrowernumber => $borrowernumber); > >+ if (C4::Context->preference('OPACBaseURL')){ >+ $template2->param( OPACBaseURL => C4::Context->preference('OPACBaseURL') ); >+ } >+ > $template2->param( > BIBLIO_RESULTS => \@results, > email_sender => $email_from, >diff --git a/virtualshelves/sendshelf.pl b/virtualshelves/sendshelf.pl >index f8c46a8..37a98ec 100755 >--- a/virtualshelves/sendshelf.pl >+++ b/virtualshelves/sendshelf.pl >@@ -100,9 +100,8 @@ if ( $email ) { > push( @results, $dat ); > } > >- my $protocol = C4::Context->preference('PublicCatalogUsesSSL') ? "https://" : "http://"; > if (C4::Context->preference('OPACBaseURL')){ >- $template2->param( OPACBaseURL => $protocol . C4::Context->preference('OPACBaseURL') ); >+ $template2->param( OPACBaseURL => C4::Context->preference('OPACBaseURL') ); > } > > $template2->param( >-- >1.7.9.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 5010
:
22945
|
23436
|
23457
|
25877
|
25878
|
25879
|
27049
|
27072
|
27431
|
27432
|
27433
|
27435
|
27436
|
27437
|
27673
|
27779
|
27951
|
27952
|
27953
|
27954
|
31727
|
31728
|
31729
|
31787
|
33726
|
35662
|
35760
|
35833
|
35847
|
35852
|
35853
|
35854
|
36177
|
37695
|
38128
|
38658
|
38659
|
38833
|
38834
|
39008
|
39009
|
39086
|
39087
|
39358
|
39359