@@ -, +, @@ 'http://' --- installer/data/mysql/atomicupdate/bug_16401.perl | 8 ++++++++ installer/data/mysql/sysprefs.sql | 2 +- .../prog/en/modules/admin/preferences/staff_client.pref | 4 ++-- svc/import_bib | 2 +- t/db_dependent/Auth_with_cas.t | 2 +- t/db_dependent/selenium/basic_workflow.t | 6 +----- 6 files changed, 14 insertions(+), 10 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_16401.perl --- a/installer/data/mysql/atomicupdate/bug_16401.perl +++ a/installer/data/mysql/atomicupdate/bug_16401.perl @@ -0,0 +1,8 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + $dbh->do( "UPDATE systempreferences SET value = CONCAT('http://', value) WHERE variable = 'staffClientBaseURL' AND value NOT LIKE 'http%'" ); + + # Always end with this (adjust the bug info) + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 16401 - fix potentialy bad set staffClientBaseURL preference)\n"; +} --- a/installer/data/mysql/sysprefs.sql +++ a/installer/data/mysql/sysprefs.sql @@ -495,7 +495,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('SpineLabelAutoPrint','0','','If this setting is turned on, a print dialog will automatically pop up for the quick spine label printer.','YesNo'), ('SpineLabelFormat','','30|10','This preference defines the format for the quick spine label printer. Just list the fields you would like to see in the order you would like to see them, surrounded by <>, for example .','Textarea'), ('SpineLabelShowPrintOnBibDetails','0','','If turned on, a \"Print Label\" link will appear for each item on the bib details page in the staff interface.','YesNo'), -('staffClientBaseURL','',NULL,'Specify the base URL of the staff client','free'), +('staffClientBaseURL','',NULL,'Specify the base URL of the staff client starting with http:// or https://. Do not include a trailing slash in the URL. (This must be filled in correctly for CAS, svc, and load_testing to work.)','free'), ('StaffDetailItemSelection', '1', NULL, 'Enable item selection in record detail page', 'YesNo'), ('StaffLangSelectorMode','footer','top|both|footer','Select the location to display the language selector in staff client','Choice'), ('StaffSearchResultsDisplayBranch','holdingbranch','holdingbranch|homebranch','Controls the display of the home or holding branch for staff search results','Choice'), --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_client.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_client.pref @@ -13,10 +13,10 @@ Staff Client: choices: staff-templates - theme on the staff interface. - - - "The staff client is located at http://" + - "The staff client is located at" - pref: staffClientBaseURL class: url - - . Do not include a trailing slash in the URL. + - This should be a complete URL, starting with http:// or https://. Do not include a trailing slash in the URL. (This must be filled in correctly for CAS, svc, and load_testing to work.) - - Use the CSS stylesheet - pref: intranetstylesheet --- a/svc/import_bib +++ a/svc/import_bib @@ -98,7 +98,7 @@ sub import_bib { $sth = $dbh->prepare("SELECT overlay_status FROM import_records WHERE import_record_id =?"); $sth->execute($import_record_id); my $match_status = $sth->fetchrow_arrayref->[0] || 'no_match'; - my $url = 'http://'. C4::Context->preference('staffClientBaseURL') .'/cgi-bin/koha/catalogue/detail.pl?biblionumber='. $biblionumber; + my $url = C4::Context->preference('staffClientBaseURL') .'/cgi-bin/koha/catalogue/detail.pl?biblionumber='. $biblionumber; $result->{'status'} = "ok"; $result->{'import_batch_id'} = $batch_id; --- a/t/db_dependent/Auth_with_cas.t +++ a/t/db_dependent/Auth_with_cas.t @@ -41,7 +41,7 @@ $dbh->{ RaiseError } = 1; C4::Context->disable_syspref_cache(); t::lib::Mocks::mock_preference('OPACBaseURL','http://localhost'); -t::lib::Mocks::mock_preference('staffClientBaseURL','localhost:8080'); +t::lib::Mocks::mock_preference('staffClientBaseURL','http://localhost:8080'); my $opac_base_url = C4::Context->preference('OpacBaseURL'); my $staff_base_url = C4::Context->preference('staffClientBaseURL'); --- a/t/db_dependent/selenium/basic_workflow.t +++ a/t/db_dependent/selenium/basic_workflow.t @@ -45,14 +45,10 @@ use MARC::Field; my $dbh = C4::Context->dbh; my $login = $ENV{KOHA_USER} || 'koha'; my $password = $ENV{KOHA_PASS} || 'koha'; -my $base_url - = ( $ENV{KOHA_INTRANET_URL} || 'http://' . C4::Context->preference("staffClientBaseURL") ) - . "/cgi-bin/koha/"; +my $base_url= ( $ENV{KOHA_INTRANET_URL} || C4::Context->preference("staffClientBaseURL") ) . "/cgi-bin/koha/"; my $selenium_addr = $ENV{SELENIUM_ADDR} || 'localhost'; my $selenium_port = $ENV{SELENIUM_PORT} || 4444; - - my $number_of_biblios_to_insert = 3; our $sample_data = { category => { --