@@ -, +, @@ --- C4/Auth.pm | 16 + Koha/Patron.pm | 19 + admin/preferences.pl | 122 ++++--- admin/systempreferences.pl | 1 + ...g_version_column_to_systempreferences_table.sql | 69 ++++ installer/data/mysql/kohastructure.sql | 1 + installer/featurereleasetool.pl | 192 ++++++++++ installer/install.pl | 19 +- koha-tmpl/intranet-tmpl/prog/css/staff-global.css | 5 + .../intranet-tmpl/prog/en/includes/newsform.inc | 98 +++++ koha-tmpl/intranet-tmpl/prog/en/includes/team.inc | 403 +++++++++++++++++++++ .../prog/en/modules/admin/preferences.tt | 182 +++++----- .../en/modules/installer/featurereleasetool.tt | 210 +++++++++++ .../prog/en/modules/installer/step3.tt | 5 +- .../prog/en/modules/tools/koha-news.tt | 76 +--- mainpage.pl | 16 + tools/koha-news.pl | 4 +- 17 files changed, 1209 insertions(+), 229 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/18645_adding_version_column_to_systempreferences_table.sql create mode 100755 installer/featurereleasetool.pl create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/newsform.inc create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/team.inc create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/installer/featurereleasetool.tt --- a/C4/Auth.pm +++ a/C4/Auth.pm @@ -2029,6 +2029,22 @@ sub get_all_subpermissions { return $all_perms; } +=head2 check_feature_tool_required + +my $featuretoolrequired = C4::Auth->check_feature_tool_required(); + +Returns 1 from the userflags table if the authenticating user is required to be redirected to the feature release tool process. The 'featuretoolrequired' field is set in the mainpage.pl + +=cut +sub check_feature_tool_required { + my $dbh = C4::Context->dbh; + my $sth = $dbh->prepare(" + SELECT featuretoolrequired FROM userflags WHERE bit = 0"); + $sth->execute(); + my $onboardingrequired = $sth->fetchrow(); + return $onboardingrequired; +} + =head2 haspermission $flags = ($userid, $flagsrequired); --- a/Koha/Patron.pm +++ a/Koha/Patron.pm @@ -638,6 +638,25 @@ sub get_enrollable_clubs { return wantarray ? $e->as_list : $e; } +=head3 check_if_patrons_have_flags + +my $patron_has_flags = Koha::Patron->check_if_patrons_have_flag s(); + +All sample patrons that can optionally be installed whilst running the Koha web installer have the flag value of NULL, this subroutine checks if any borrower records in the borrowers table contain a number, and so this means that they must have been manually added. If there is a numberical flag returned then this subroutine will return a 1 to mainpage.pl script to ensure that users are appropriately redirected to the feature release change tool + +=cut +sub check_if_patrons_have_flags { + my $dbh = C4::Context->dbh; + my $sth = $dbh->prepare(" + select * from borrowers where flags != 'NULL'"); + $sth->execute(); + my $no_patrons_with_flags; + if ( $sth->rows ) { + $no_patrons_with_flags = 1; + } + return $no_patrons_with_flags; +} + =head3 account_locked my $is_locked = $patron->account_locked --- a/admin/preferences.pl +++ a/admin/preferences.pl @@ -58,74 +58,74 @@ sub GetTab { } sub _get_chunk { - my ( $value, %options ) = @_; + my ( $value, %options ) = @_; - my $name = $options{'pref'}; - my $chunk = { name => $name, value => $value, type => $options{'type'} || 'input', class => $options{'class'} }; + my $name = $options{'pref'}; + my $chunk = { name => $name, value => $value, type => $options{'type'} || 'input', class => $options{'class'} }; - if ( $options{'class'} && $options{'class'} eq 'password' ) { - $chunk->{'input_type'} = 'password'; - } elsif ( $options{'class'} && $options{'class'} eq 'date' ) { - $chunk->{'dateinput'} = 1; - } elsif ( $options{'type'} && ( $options{'type'} eq 'opac-languages' || $options{'type'} eq 'staff-languages' ) ) { - my $current_languages = { map { +$_, 1 } split( /\s*,\s*/, $value ) }; + if ( $options{'class'} && $options{'class'} eq 'password' ) { + $chunk->{'input_type'} = 'password'; + } elsif ( $options{'class'} && $options{'class'} eq 'date' ) { + $chunk->{'dateinput'} = 1; + } elsif ( $options{'type'} && ( $options{'type'} eq 'opac-languages' || $options{'type'} eq 'staff-languages' ) ) { + my $current_languages = { map { +$_, 1 } split( /\s*,\s*/, $value ) }; - my $theme; - my $interface; - if ( $options{'type'} eq 'opac-languages' ) { + my $theme; + my $interface; + if ( $options{'type'} eq 'opac-languages' ) { # this is the OPAC - $interface = 'opac'; - $theme = C4::Context->preference('opacthemes'); - } else { - # this is the staff client - $interface = 'intranet'; - $theme = C4::Context->preference('template'); - } - $chunk->{'languages'} = getTranslatedLanguages( $interface, $theme, $lang, $current_languages ); - $chunk->{'type'} = 'languages'; - } elsif ( $options{ 'choices' } ) { - if ( $options{'choices'} && ref( $options{ 'choices' } ) eq '' ) { - if ( $options{'choices'} eq 'class-sources' ) { - my $sources = GetClassSources(); - $options{'choices'} = { map { $_ => $sources->{$_}->{'description'} } keys %$sources }; - } elsif ( $options{'choices'} eq 'opac-templates' ) { - $options{'choices'} = { map { $_ => $_ } getallthemes( 'opac' ) } - } elsif ( $options{'choices'} eq 'staff-templates' ) { - $options{'choices'} = { map { $_ => $_ } getallthemes( 'intranet' ) } - } else { - die 'Unrecognized source of preference values: ' . $options{'choices'}; - } - } - - $value ||= 0; + $interface = 'opac'; + $theme = C4::Context->preference('opacthemes'); + } else { + # this is the staff client + $interface = 'intranet'; + $theme = C4::Context->preference('template'); + } + $chunk->{'languages'} = getTranslatedLanguages( $interface, $theme, $lang, $current_languages ); + $chunk->{'type'} = 'languages'; + } elsif ( $options{ 'choices' } ) { + if ( $options{'choices'} && ref( $options{ 'choices' } ) eq '' ) { + if ( $options{'choices'} eq 'class-sources' ) { + my $sources = GetClassSources(); + $options{'choices'} = { map { $_ => $sources->{$_}->{'description'} } keys %$sources }; + } elsif ( $options{'choices'} eq 'opac-templates' ) { + $options{'choices'} = { map { $_ => $_ } getallthemes( 'opac' ) } + } elsif ( $options{'choices'} eq 'staff-templates' ) { + $options{'choices'} = { map { $_ => $_ } getallthemes( 'intranet' ) } + } else { + die 'Unrecognized source of preference values: ' . $options{'choices'}; + } + } + + $value ||= 0; $chunk->{'type'} = 'select'; - $chunk->{'CHOICES'} = [ - sort { $a->{'text'} cmp $b->{'text'} } - map { { text => $options{'choices'}->{$_}, value => $_, selected => ( $_ eq $value || ( $_ eq '' && ( $value eq '0' || !$value ) ) ) } } - keys %{ $options{'choices'} } - ]; - } elsif ( $options{'multiple'} ) { - my @values; - @values = split /,/, $value if defined($value); - $chunk->{type} = 'multiple'; - $chunk->{CHOICES} = [ - sort { $a->{'text'} cmp $b->{'text'} } - map { - my $option_value = $_; - { - text => $options{multiple}->{$option_value}, - value => $option_value, - selected => (grep /^$option_value$/, @values) ? 1 : 0, - } - } - keys %{ $options{multiple} } - ]; - } + $chunk->{'CHOICES'} = [ + sort { $a->{'text'} cmp $b->{'text'} } + map { { text => $options{'choices'}->{$_}, value => $_, selected => ( $_ eq $value || ( $_ eq '' && ( $value eq '0' || !$value ) ) ) } } + keys %{ $options{'choices'} } + ]; + } elsif ( $options{'multiple'} ) { + my @values; + @values = split /,/, $value if defined($value); + $chunk->{type} = 'multiple'; + $chunk->{CHOICES} = [ + sort { $a->{'text'} cmp $b->{'text'} } + map { + my $option_value = $_; + { + text => $options{multiple}->{$option_value}, + value => $option_value, + selected => (grep /^$option_value$/, @values) ? 1 : 0, + } + } + keys %{ $options{multiple} } + ]; + } $chunk->{ 'type_' . $chunk->{'type'} } = 1; - return $chunk; + return $chunk; } sub TransformPrefsToHTML { @@ -165,7 +165,8 @@ sub TransformPrefsToHTML { } else { $value = $row->{'value'}; } - my $chunk = _get_chunk( $value, %$piece ); + my $source = "preferences"; + my $chunk = _get_chunk( $value, $source, %$piece ); # No highlighting of inputs yet, but would be useful $chunk->{'highlighted'} = 1 if ( $searchfield && $name =~ /^$searchfield$/i ); @@ -225,6 +226,7 @@ sub SearchPrefs { my ( $input, $searchfield ) = @_; my @tabs; + warn $input, $searchfield; my %tab_files = _get_pref_files( $input ); our @terms = split( /\s+/, $searchfield ); --- a/admin/systempreferences.pl +++ a/admin/systempreferences.pl @@ -339,6 +339,7 @@ if ( $op eq 'add_form' ) { unless C4::Context->config('demo'); print $input->redirect("/cgi-bin/koha/admin/systempreferences.pl?tab="); exit; + ################## DELETE_CONFIRM ################################## # called by default form, used to confirm deletion of data in DB } elsif ( $op eq 'delete_confirm' ) { --- a/installer/data/mysql/atomicupdate/18645_adding_version_column_to_systempreferences_table.sql +++ a/installer/data/mysql/atomicupdate/18645_adding_version_column_to_systempreferences_table.sql @@ -0,0 +1,69 @@ +ALTER TABLE systempreferences ADD version varchar(12) DEFAULT NULL; +ALTER TABLE systempreferences ADD display_choices mediumtext DEFAULT NULL; +INSERT INTO systempreferences (variable, explanation) VALUES ("PreviousVersion", "The most recent Koha database version that this Koha instance upgraded from. WARNING: Do not change this, it is used by the feature release tool to display appropriate installed system preferences after each update process"); +UPDATE systempreferences SET version="16.06.00.003" WHERE variable ="MaxItemsToProcessForBatchMod"; +UPDATE systempreferences SET version="16.06.00.003" WHERE variable ="MaxItemsToDisplayForBatchDel"; +UPDATE systempreferences SET version="16.06.00.004" WHERE variable ="OPACXSLTListsDisplay"; +UPDATE systempreferences SET version="16.06.00.004" WHERE variable ="XSLTListsDisplay"; +UPDATE systempreferences SET version="16.06.00.005" WHERE variable ="XSLTListsDisplay"; +UPDATE systempreferences SET version="16.06.00.006", display_choices="check-in library.|item home branch.|item holding branch." WHERE variable="RefundLostOnReturnControl"; +UPDATE systempreferences SET version="16.06.00.007" WHERE variable="PatronQuickAddFields"; +UPDATE systempreferences SET version="16.06.00.008", display_choices="Do|Unless overridden, do|Unless overridden, do not|Do not" WHERE variable="CheckPrevCheckout"; +UPDATE systempreferences SET version="16.06.00.009", display_choices="Don't show|Show" WHERE variable="IntranetCatalogSearchPulldown"; +UPDATE systempreferences SET version="16.06.00.010" WHERE variable="MaxOpenSuggestions"; +UPDATE systempreferences SET version="16.06.00.011", display_choices="Don't add|add" WHERE variable="NovelistSelectStaffEnabled"; +UPDATE systempreferences SET version="16.06.00.011", display_choices="in a tab|above the holdings table|below the holdings table" WHERE variable="NovelistSelectStaffView"; +UPDATE systempreferences SET version="16.06.00.013", display_choices="home library|current location" WHERE variable="OPACResultsLibrary"; +UPDATE systempreferences SET version="16.06.00.015", display_choices="Don't log|Log" WHERE variable="HoldsLog"; +UPDATE systempreferences SET version="16.06.00.020", display_choices="Don't switch|Switch" WHERE variable="SwitchOnSiteCheckouts"; +UPDATE systempreferences SET version="16.06.00.027", display_choices="Don't|Do" WHERE variable="TrackLastPatronActivity"; +UPDATE systempreferences SET version="16.06.00.021", display_choices="Do not consider|Consider" WHERE variable="PatronSelfRegistrationEmailMustBeUnique"; +UPDATE systempreferences SET version="16.06.00.023" WHERE variable="timeout"; +UPDATE systempreferences SET version="16.06.00.025", display_choices="Do not make|Make" WHERE variable="makePreviousSerialAvailable"; +UPDATE systempreferences SET version="16.06.00.026" WHERE variable="PatronSelfRegistrationLibraryList"; +UPDATE systempreferences SET version="16.06.00.027", display_choices="Don't|Do" WHERE variable="TrackLastPatronActivity"; +UPDATE systempreferences SET version="16.06.00.029", display_choices="public|school|academic|research|private|society or association|corporate|government|religious organization|subscription" WHERE variable="UsageStatsLibraryType"; +UPDATE systempreferences SET version="16.06.00.029", options="Afghanistan|Albania|Algeria|Andorra|Angola|Angitua & Deps|Argentina|Armenia|Australia|Austria|Azerbaijan|Bahamas|Bahrain|Bangladesh|Barbados|Belarus|Barbados|Belgium|Beliza|Benin|Bhutan|Bolizia|Bosnia Herz.|Botswana|Brazil|Brunei|Bulgaria|Burkina|Burundi|Cambodia|Cameroon|Canada|Capre Verde|Centr. Afr. Rep|Chad|Chile|China|Colombia|Comoros|Congo|Costa Rica|Croatia|Cuba|Cyprus|Czeck Rpublic|Denmark|Djibouti|Dominica|Dominican Rep.|East Timor|Ecuador|Egypt|El Salvador|Equator. Guinea|Eritrea|Estonia|Ethiopia|Fiji|Finland|France|Gabon|Gambia|Georgia|Germany|Ghana|Greece|Grenada|Guatemala|Guinea|Guinea-Bissau|Guyana|Haiti|Honduras|Hungary|Iceland|India|Indonesia|Iran|Iraq|Ireland|Isreal|Italy|Ivory Coast|Jamaica|Japan|Jordan|Kazakhstan|Kenya|Kiribati|Korea North|Korea South|Kosovo|Kuwait|Kyrgyzstan|Laos|Latvia|Lebanon|Lesotho|Liberia|Libya|Liechtenstein|Lithuania|Luxembourg|Macedonia|Madagascar|Malawi|Malyasia|Maldives|Mali|Malta|Marshall Isl.|Mauritania|Mauritius|Mexico|Micronesia|Moldova|Monaco|Mongolia|Montenegro|Morocco|Mozambique|Myanmar|Namibia|Nauru|Nepal|Netherlands|New Zealand|Nicaragua|Niger|Nigeria|Norway|Oman|Pakistan|Palau|Papua N. Guinea|Paraguay|Peru|Philippines|Poland|Portugal|Qatar|Romania|Russian Fed.|Rwanada|St Kitts & Nev.|St Lucia|St Vincent|Samoa|San Marino|Sao Tome|Saudi Arabia|Senegal|Serbia|Seychelles|Sierra Leone|Singapore|Slovakia|Slovenia|Solomon Islands|Somalia|South Africa|Spain|Sri Lanka|Sudan|Suriname|Swaziland|Sweden|Switzerland|Syria|Taiwan|Tajikistan|Tanzania|Thailand|Togo|Tonga|Trinidad & Tob.|Tunisia|Turkey|Turkmenistan|Tuvalu|Uganda|Ukraine|UAE|United Kingdom|USA|Uruguay|Uzbekistan|Vanuatu|Vatican City|Venezuela|Vietnam|Yemen|Zambia|Zimbabwe", display_choices="Afghanistan|Albania|Algeria|Andorra|Angola|Angitua & Deps|Argentina|Armenia|Australia|Austria|Azerbaijan|Bahamas|Bahrain|Bangladesh|Barbados|Belarus|Barbados|Belgium|Beliza|Benin|Bhutan|Bolizia|Bosnia Herz.|Botswana|Brazil|Brunei|Bulgaria|Burkina|Burundi|Cambodia|Cameroon|Canada|Capre Verde|Centr. Afr. Rep|Chad|Chile|China|Colombia|Comoros|Congo|Costa Rica|Croatia|Cuba|Cyprus|Czeck Rpublic|Denmark|Djibouti|Dominica|Dominican Rep.|East Timor|Ecuador|Egypt|El Salvador|Equator. Guinea|Eritrea|Estonia|Ethiopia|Fiji|Finland|France|Gabon|Gambia|Georgia|Germany|Ghana|Greece|Grenada|Guatemala|Guinea|Guinea-Bissau|Guyana|Haiti|Honduras|Hungary|Iceland|India|Indonesia|Iran|Iraq|Ireland|Isreal|Italy|Ivory Coast|Jamaica|Japan|Jordan|Kazakhstan|Kenya|Kiribati|Korea North|Korea South|Kosovo|Kuwait|Kyrgyzstan|Laos|Latvia|Lebanon|Lesotho|Liberia|Libya|Liechtenstein|Lithuania|Luxembourg|Macedonia|Madagascar|Malawi|Malyasia|Maldives|Mali|Malta|Marshall Isl.|Mauritania|Mauritius|Mexico|Micronesia|Moldova|Monaco|Mongolia|Montenegro|Morocco|Mozambique|Myanmar|Namibia|Nauru|Nepal|Netherlands|New Zealand|Nicaragua|Niger|Nigeria|Norway|Oman|Pakistan|Palau|Papua N. Guinea|Paraguay|Peru|Philippines|Poland|Portugal|Qatar|Romania|Russian Fed.|Rwanada|St Kitts & Nev.|St Lucia|Saint Vincent|Samoa|San Marino|Sao Tome|Saudi Arabia|Senegal|Serbia|Seychelles|Sierra Leone|Singapore|Slovakia|Slovenia|Solomon Islands|Somalia|South Africa|Spain|Sri Lanka|Sudan|Suriname|Swaziland|Sweden|Switzerland|Syria|Taiwan|Tajikistan|Tanzania|Thailand|Togo|Tonga|Trinidad & Tob.|Tunisia|Turkey|Turkmenistan|Tuvalu|Uganda|Ukraine|UAE|United Kingdom|USA|Uruguay|Uzbekistan|Vanuatu|Vatican City|Venezuela|Vietnam|Yemen|Zambia|Zimbabwe" WHERE variable="UsageStatsCountry"; +UPDATE systempreferences SET version="16.06.00.030", display_choices="First column of the table|Home library|Holding library" WHERE variable="OPACHoldingsDefaultSortField"; +UPDATE systempreferences SET version="16.06.00.031", display_choices="Do not display and prefill|Display and prefill" WHERE variable="PatronSelfRegistrationPrefillForm"; +UPDATE systempreferences SET version="16.06.00.035", display_choices="Don't allow|Allow" WHERE variable="AllowItemsOnHoldCheckoutSCO"; +UPDATE systempreferences SET version="16.06.00.036", display_choices="Disable|Enable" WHERE variable="HouseboundModule"; +UPDATE systempreferences SET version="16.06.00.037", display_choices="Don't enable|Enable" WHERE variable="ArticleRequests"; +UPDATE systempreferences SET version="16.06.00.037", display_choices="Title|Author|Volume|Issue|Date|Pages|Chapters" WHERE variable="ArticleRequestsMandatoryFields"; +UPDATE systempreferences SET version="16.06.00.037", display_choices="Title|Author|Volume|Issue|Date|Pages|Chapters" WHERE variable="ArticleRequestsMandatoryFieldsItemsOnly"; +UPDATE systempreferences SET version="16.06.00.037", display_choices="Title|Author|Volume|Issue|Date|Pages|Chapters" WHERE variable="ArticleRequestsMandatoryFieldsRecordOnly"; +UPDATE systempreferences SET version="16.06.00.038", display_choices="surname,firstname,othernames,cardnumber,userid" WHERE variable="DefaultPatronSearchFields"; +UPDATE systempreferences SET version="16.06.00.041", display_choices="don't|do" WHERE variable="AggressiveMatchOnISSN"; +UPDATE systempreferences SET version="16.06.00.045", display_choices="current membership expiry date.|current date.|the latter of the current and expiry date." WHERE variable="BorrowerRenewalPeriodBase"; +UPDATE systempreferences SET version="16.06.00.049" WHERE variable="ReplytoDefault"; +UPDATE systempreferences SET version="16.06.00.049" WHERE variable="ReturnpathDefault"; +UPDATE systempreferences SET version="16.12.00.005", display_choices="loose|strict" WHERE variable="AuthorityMergeMode"; +UPDATE systempreferences SET version="16.12.00.008" WHERE variable="MarcItemFieldsToOrder"; +UPDATE systempreferences SET version="16.12.00.009", display_choices="Don't allow|Allow" WHERE variable="OPACHoldsIfAvailableAtPickup"; +UPDATE systempreferences SET version="16.12.00.009" WHERE variable="OPACHoldsIfAvailableAtPickupExceptions"; +UPDATE systempreferences SET version="16.12.00.010", display_choices="Don't enable|Enable" WHERE variable="OverDriveCirculation"; +UPDATE systempreferences SET version="16.12.00.012", display_choices="Don't display|Display" WHERE variable="OpacNewsLibrarySelect"; +UPDATE systempreferences SET version="16.12.00.013", display_choices="Deactivate|Activate" WHERE variable="CircSidebar"; +UPDATE systempreferences SET version="16.12.00.014", display_choices="Don't load|Load" WHERE variable="LoadSearchHistoryToTheFirstLoggedUser"; +UPDATE systempreferences SET version="16.12.00.015" WHERE variable="UsageStatsGeolocation"; +UPDATE systempreferences SET version="16.12.00.015", display_choices="Do not Share|Share" WHERE variable="UsageStatsLibrariesInfo"; +UPDATE systempreferences SET version="16.12.00.015" WHERE variable="UsageStatsPublicID"; +UPDATE systempreferences SET version="16.12.00.017", display_choices="Don't cumulate|Cumulate" WHERE variable="CumulativeRestrictionPeriods"; +UPDATE systempreferences SET version="16.12.00.020", display_choices="any time a hold is placed.|only if all items are checked out and the record has at least one hold already.|any time a hold is collected." WHERE variable="HoldFeeMode"; +UPDATE systempreferences SET version="16.12.00.021", display_choices="Don't log|Log" WHERE variable="RenewalLog"; +UPDATE systempreferences SET version="16.12.00.023" WHERE variable="AuthorityMergeLimit"; +UPDATE systempreferences SET version="16.12.00.024" WHERE variable="OverdueNoticeBcc"; +UPDATE systempreferences SET version="16.12.00.024" WHERE variable="NoticeBcc"; +UPDATE systempreferences SET version="16.12.00.025" WHERE variable="UploadPurgeTemporaryFilesDays"; +UPDATE systempreferences SET version="16.12.00.028", display_choices="Germany style ([Address][Street number] - [ZIP/Postal Code] - [Country])|French style ([Street number][Address] - [ZIP/Postal COde][City] - [Country])|US style ([Street number], [Address] - [City], [ ZIP/Postal Code], [Country})" WHERE variable="AddressFormat"; +UPDATE systempreferences SET version="16.12.00.029", display_choices="Don't allow|Allow" WHERE variable="AllowCheckoutNotes"; +UPDATE systempreferences SET version="16.12.00.032", display_choices="Don't allow|Allow" WHERE variable="ExcludeHolidaysFromMaxPickUpDelay"; +UPDATE systempreferences SET version="16.12.00.033", display_choices="Don't allow|Allow" WHERE variable="TranslateNotices"; +UPDATE systempreferences SET version="16.12.00.034", display_choices="Block|Allow" WHERE variable="OPACFineNoRenewalsBlockAutoRenew"; +UPDATE systempreferences SET version="16.12.00.036" WHERE variable="NumSavedReports"; +UPDATE systempreferences SET version="16.12.00.037" WHERE variable="FailedLoginAttempts"; +UPDATE systempreferences SET version="16.12.00.038" WHERE variable="ExportRemoveFields"; +UPDATE systempreferences SET version="16.12.00.039", display_choices="Disable|Enable" WHERE variable="TalkingTechItivaPhoneNotification"; + + + --- a/installer/data/mysql/kohastructure.sql +++ a/installer/data/mysql/kohastructure.sql @@ -2257,6 +2257,7 @@ CREATE TABLE `userflags` ( `flag` varchar(30) default NULL, `flagdesc` varchar(255) default NULL, `defaulton` int(11) default NULL, + `featuretoolrequired` int(1) default NULL, PRIMARY KEY (`bit`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- a/installer/featurereleasetool.pl +++ a/installer/featurereleasetool.pl @@ -0,0 +1,192 @@ +#!/usr/bin/perl + +# This file is part of Koha. +# +# Copyright (C) 2017 Catalyst IT +# +# Koha is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# Koha is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Koha; if not, see . + +use strict; +use warnings; +use diagnostics; + +use C4::InstallAuth; +use CGI qw ( -utf8 ); +use POSIX qw(strftime); +use Koha; +use C4::Context; +use C4::Output; +use C4::Templates; +use C4::Languages qw(getAllLanguages getTranslatedLanguages); +use C4::Installer; +use C4::NewsChannels; +use Data::Dumper; +use Koha::DateUtils; +use Date::Calc qw/Date_to_Days Today/; +our $lang; + +my $query = new CGI; +my $step = $query->param('step'); +my $kohaversion = $query->param('kohaversion'); #Retrieve kohaversion number from url +my $dbversion = $query->param('dbversion'); +my $dbh = C4::Context->dbh; +my $op = $query->param('op'); +my $language = $query->param('language'); +my ( $template, $loggedinuser, $cookie ); + +my $all_languages = getAllLanguages(); + +if ( defined($language) ) { + C4::Templates::setlanguagecookie( $query, $language, "install.pl?step=1" ); +} + +#Set featurereleasetool.tt as template +( $template, $loggedinuser, $cookie ) = get_template_and_user( + { + template_name => "installer/featurereleasetool.tt", + query => $query, + type => "intranet", + authnotrequired => 0, + debug => 1, + } +); + +#Database settings +my $installer = C4::Installer->new(); +my %info; +$info{'dbname'} = C4::Context->config("database"); +$info{'dbms'} = ( + C4::Context->config("db_scheme") + ? C4::Context->config("db_scheme") + : "mysql" +); +$info{'hostname'} = C4::Context->config("hostname"); +$info{'port'} = C4::Context->config("port"); +$info{'user'} = C4::Context->config("user"); +$info{'password'} = C4::Context->config("pass"); +$info{'tls'} = C4::Context->config("tls"); + if ($info{'tls'} && $info{'tls'} eq 'yes'){ + $info{'ca'} = C4::Context->config('ca'); + $info{'cert'} = C4::Context->config('cert'); + $info{'key'} = C4::Context->config('key'); + $info{'tlsoptions'} = ";mysql_ssl=1;mysql_ssl_client_key=".$info{key}.";mysql_ssl_client_cert=".$info{cert}.";mysql_ssl_ca_file=".$info{ca}; + $info{'tlscmdline'} = " --ssl-cert ". $info{cert} . " --ssl-key " . $info{key} . " --ssl-ca ".$info{ca}." " + } + +my $location = "feature"; + +$template->param( + 'kohaversion' => $kohaversion, + 'dbversion' => $dbversion, + 'location' => $location, +); + +my $logdir = C4::Context->config('logdir'); +my @logs = `cd $logdir && ls -t | grep "updatedatabase_2*"`; + +my $filename_suffix = $logs[0]; +my $path = $logdir . '/' . $filename_suffix; +my $file; +my $count = 0; +$file = `cat $path`; +$file = `echo "$file" | grep -Eo '?[0-9]+[.][0-9]+[.][0-9]+[.][0-9]+?'`; + +my @prefsloop; +my @lines = split /\n/, $file; +foreach my $line (@lines) { + my $query = qq| + SELECT variable, value, options, display_choices, explanation, type from systempreferences WHERE version= ? |; + my $sth = $dbh->prepare($query); + $sth->execute($line); + while (my ($variable, $value, $options, $display_choices, $explanation, $type) = $sth->fetchrow) { + if ($options) { + push @prefsloop, { + variable => $variable, + value => $value, + options => $options, + explanation => $explanation, + type => $type, + display_choices => $display_choices, + }; + } else { + push @prefsloop, { + variable => $variable, + value => $value, + explanation => $explanation, + type => $type, + display_choices => $display_choices, + }; + } + } +}; + +$template->param( prefs => \@prefsloop, submitted_form => $op ); + +#If the user has finished using the feature release change tool then redirect to mainpage +if ( $op && $op eq 'finished' ) { + $dbh->do(q{UPDATE userflags SET featuretoolrequired = 0 WHERE bit = ?}, {}, 0); + print $query->redirect("/cgi-bin/koha/mainpage.pl"); + exit; +} +elsif ( $op && $op eq 'save' ) { #Submit changed systempreferences + unless ( C4::Context->config( 'demo' ) ) { + foreach my $param ( $query->param() ) { + my ( $prefname ) = ( $param =~ /pref_(.*)/ ); + next if ( !defined( $prefname ) ); + my $wholevalue = join( ',', $query->param($param) ); + my ($name, $value) = split(/,/,$wholevalue); + C4::Context->set_preference( $name, $value ); + } + } +} + +#Submit news item +my $id = $query->param('id'); +my $title = $query->param('title'); +my $content = $query->param('featurecontent'); +my $expirationdate; +if ( $query->param('expirationdate') ) { + $expirationdate = output_pref({ dt => dt_from_string( scalar $query->param('expirationdate') ), dateformat => 'iso', dateonly => 1 } ); +} +my $timestamp = output_pref({ dt => dt_from_string( scalar $query->param('timestamp') ), dateformat => 'iso', dateonly => 1 }); +my $number = $query->param('number'); +my $lang = $query->param('lang'); +my $branchcode = $query->param('branch'); + +my $error_message = $query->param('error_message'); +$branchcode = undef if (defined($branchcode) && $branchcode eq ''); + +$template->param( error_message => $error_message ) if $error_message; + +my $new_detail = get_opac_new($id); + +if ($title) { + my $newsposting = add_opac_new( + { + title => $title, + content => $content, + lang => $lang, + expirationdate => $expirationdate, + timestamp => $timestamp, + number => $number, + branchcode => $branchcode, + borrowernumber => $loggedinuser, + } + ); + if ($newsposting) { + $template->param( newsposted => $newsposting ); + } +} + +output_html_with_http_headers $query, $cookie, $template->output; --- a/installer/install.pl +++ a/installer/install.pl @@ -226,6 +226,12 @@ elsif ( $step && $step == 3 ) { # # we have finished, just redirect to mainpage. # + $dbh->do(q{UPDATE userflags SET featuretoolrequired = 1 WHERE bit = ?}, {}, 0); + my $dbversion = $query->param('dbversion'); + my $dbquery = qq| + UPDATE systempreferences SET value = ? WHERE variable = "PreviousVersion" |; + my $sth = $dbh->prepare($dbquery); + $sth->execute($dbversion); print $query->redirect("/cgi-bin/koha/mainpage.pl"); exit; } @@ -237,6 +243,11 @@ elsif ( $step && $step == 3 ) { # And we redirect people to mainpage. # The installer will have to relogin since we do not pass cookie to redirection. $template->param( "$op" => 1 ); + }elsif ( $op && $op eq 'featurereleasetool' ) { + my $dbversion = $query->param('dbversion'); + my $kohaversion = $query->param('kohaversion'); + print $query->redirect("/cgi-bin/koha/installer/featurereleasetool.pl?dbversion=$dbversion&kohaversion=$kohaversion"); + exit; } elsif ( $op && $op eq 'addframeworks' ) { @@ -382,6 +393,11 @@ elsif ( $step && $step == 3 ) { my $kohaversion = Koha::version; $kohaversion =~ s/(.*\..*)\.(.*)\.(.*)/$1$2$3/; + $template->param( + "dbversion" => $dbversion, + "kohaversion" => $kohaversion + ); + my $filename_suffix = join '_', $now, $dbversion, $kohaversion; my ( $logfilepath, $logfilepath_errors ) = ( chk_log( $logdir, "updatedatabase_$filename_suffix" ), @@ -400,7 +416,8 @@ elsif ( $step && $step == 3 ) { close $fh; if (@report) { $template->param( update_report => - [ map { { line => $_ } } split( /\n/, join( '', @report ) ) ] + [ map { { line => $_ } } split( /\n/, join( '', @report ) ) ], + raw_report => @report ); $template->param( has_update_succeeds => 1 ); } --- a/koha-tmpl/intranet-tmpl/prog/css/staff-global.css +++ a/koha-tmpl/intranet-tmpl/prog/css/staff-global.css @@ -3028,3 +3028,8 @@ fieldset.rows + fieldset.action { #patron_search #filters { display: none; } + +#news_posted { + width: 50%; + background-color: #F1F1F1; +} --- a/koha-tmpl/intranet-tmpl/prog/en/includes/newsform.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/newsform.inc @@ -0,0 +1,98 @@ +
+ [% IF location == "feature" %] +
+ [% ELSIF location == "intranet" %] + + [% END %] + + + + +
+ OPAC and Koha news +
  1. + + +
  2. +
  3. + + +
  4. +
  5. + + [% IF location == "feature" %] + Required + [% ELSE %] + Required + [% END %] +
  6. +
  7. + + +
    [% INCLUDE 'date-format.inc' %]
    +
  8. +
  9. + + +
    [% INCLUDE 'date-format.inc' %]
    +
  10. +
  11. + + [% IF ( new_detail.number ) %] + + [% ELSE %] + + [% END %] +
  12. +
  13. + [% IF location=="feature" %] +

    +
    + Our institution is proud to announce that we have upgraded our Koha library management system to Koha version [%kohaversion%]. This new Koha version comes with many new exciting features. +
    +

    Read about the enhancements here: Koha 17.05 release notes link

    +

    During the upgrade the following new systempreferences were also installed:

    + [% FOREACH pref IN prefs %] + [% pref.variable %] + [% pref.value %] + [% END %] +
    +
    + [% ELSIF location=="intranet" %] + + [% END %] +
  14. +
+ +
+
+
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/team.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/team.inc @@ -0,0 +1,403 @@ +
+

Special thanks to the following organizations

+ + +

Koha 17.05 release team

+ + +

Koha development team

+ +

Contributing companies and institutions

+ + +

Additional thanks to...

+ +
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt @@ -76,119 +76,117 @@
No system preferences matched your search for: [% searchfield |html %]
- [% ELSIF searchfield %]

You searched for: [% searchfield | html %]

[% END %] [% FOREACH TAB IN TABS %] -
-

[% TAB.tab_title %] preferences

-
- [% UNLESS ( searchfield ) %]
[% END %] - - - - [% FOREACH LINE IN TAB.LINES %] - [% IF ( LINE.is_group_title ) %] - [% UNLESS ( loop.first ) %][% END %] -

[% LINE.title %]

- - - [% UNLESS ( loop.last ) %][% END %] - [% ELSE %] - [% IF ( loop.first ) %]
PreferenceValue
[% END %] - - -
PreferenceValue
- - [% FOREACH NAME IN LINE.NAMES %] - - [% UNLESS ( loop.last ) %]
[% END %] - [% END %] -
-
- [% FOREACH CHUNK IN LINE.CHUNKS %] - [% IF ( CHUNK.type_text ) %] +
+

[% TAB.tab_title %] preferences

+ + [% UNLESS ( searchfield ) %]
[% END %] + + + [% FOREACH LINE IN TAB.LINES %] + [% IF ( LINE.is_group_title ) %] + [% UNLESS ( loop.first ) %]
[% END %] +

[% LINE.title %]

+ + + [% UNLESS ( loop.last ) %][% END %] + [% ELSE %] + [% IF ( loop.first ) %]
PreferenceValue
[% END %] + + + - - [% IF ( loop.last ) %]
PreferenceValue
+ + [% FOREACH NAME IN LINE.NAMES %] + + [% UNLESS ( loop.last ) %]
[% END %] + [% END %] +
+
+ [% FOREACH CHUNK IN LINE.CHUNKS %] + [% IF ( CHUNK.type_text ) %] [% CHUNK.contents %] - [% ELSIF ( CHUNK.type_input ) %] + [% ELSIF ( CHUNK.type_input ) %] [% IF ( CHUNK.dateinput ) %][% INCLUDE 'date-format.inc' %][% END %] - [% ELSIF ( CHUNK.type_select ) %] + [% ELSIF ( CHUNK.type_select ) %] [% ELSIF ( CHUNK.type_multiple ) %] - [% ELSIF ( CHUNK.type_textarea ) || ( CHUNK.type_htmlarea )%] + [% ELSIF ( CHUNK.type_textarea ) || ( CHUNK.type_htmlarea )%] [% IF ( CHUNK.type_htmlarea ) && ( Koha.Preference('UseWYSIWYGinSystemPreferences') ) %] - + [% ELSE %] - - - + + + [% END %] - [% ELSIF ( CHUNK.type_languages ) %] -
- [% FOREACH language IN CHUNK.languages %] - [% IF ( language.plural ) %] -
- [% IF ( language.native_description ) %][% language.native_description %][% ELSE %][% language.rfc4646_subtag %][% END %] -
- [% FOREACH sublanguages_loo IN language.sublanguages_loop %] -
- - [% IF ( sublanguages_loo.enabled ) %] - - [% ELSE %] - + [% ELSIF ( CHUNK.type_languages ) %] +
+ [% FOREACH language IN CHUNK.languages %] + [% IF ( language.plural ) %] +
+ [% IF ( language.native_description ) %][% language.native_description %][% ELSE %][% language.rfc4646_subtag %][% END %] +
+ [% FOREACH sublanguages_loo IN language.sublanguages_loop %] +
+ + [% IF ( sublanguages_loo.enabled ) %] + + [% ELSE %] + + [% END %] +
[% END %] -
- [% END %] - [% ELSE %] -
- + [% ELSE %] +
+ [% IF ( language.group_enabled ) %] - + [% ELSE %] - + + [% END %] +
[% END %] - [% END %] - [% END %] -
- [% END %] - [% END %] -
[% END %] - [% END %] - [% END %] -
Cancel
-
-
- [% END %] + + [% END %] + [% END %] + + + [% IF ( loop.last ) %][% END %] + [% END %] + [% END %] +
Cancel
+ + + [% END %]
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/installer/featurereleasetool.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/installer/featurereleasetool.tt @@ -0,0 +1,210 @@ +[% INCLUDE 'doc-head-open.inc' %] + +Koha › Web installer › Feature Release Change Tool + + + +[% IF ( finish ) %][% END %] +[% INCLUDE 'installer-doc-head-close.inc' %] + + + +
+
+
+

Koha

+
+ + +
+ +
+

New sysprefs added to Koha since Koha [% dbversion %]

+
+

The system preferences listed below were all installed in the update from Koha [% dbversion %] to Koha [% kohaversion %]. The default values of each of the system preferences are displayed for you to review and modify and submit by selecting the 'Save all preferences' button

+
+ + + + + + + + [% FOREACH pref IN prefs %] + + + + + + [% END %] +
Preference DescriptionValue
+ + [% pref.variable %] + + [% pref.explanation %] + + [% IF (pref.value != '') %] + [% IF (pref.type == "Integer") || (pref.type == "integer" ) || (pref.type == "Free") %] + + [% ELSIF (pref.type == "Choice") %] + + [% ELSIF (pref.type == "YesNo") %] + + [% END %] + [% ELSE %] + No default value + [% END %] +
+ [% IF !(submitted_form) %] + + [% END %] +
+
+
+ +
+

Koha version [% kohaversion %] release notes

+ Koha 17.05 release notes link +
+
+
+ +

+
+
+
+
+ + + + +[% INCLUDE 'intranet-bottom.inc' %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/installer/step3.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/installer/step3.tt @@ -235,7 +235,7 @@ [% END # / IF default %] [% IF ( updatestructure ) %] -

Updating database structure

+

Updating database structure from [%dbversion%] to [%kohaversion%]

[% IF ( has_update_succeeds ) %]

Update report :

--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt @@ -96,79 +96,9 @@ Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %] [% IF ( op == 'add' ) %][% default_lang = lang %] [% ELSE %][% default_lang = new_detail.lang %] [% END %] -
- - -
- OPAC and Koha news -
  1. - - -
  2. -
  3. - - -
  4. -
  5. - - Required -
  6. -
  7. - - -
    [% INCLUDE 'date-format.inc' %]
    -
  8. -
  9. - - -
    [% INCLUDE 'date-format.inc' %]
    -
  10. -
  11. - - [% IF ( new_detail.number ) %] - - [% ELSE %] - - [% END %] -
  12. -
  13. - -
  14. -
-
- -
Cancel
-
+ + [% INCLUDE 'newsform.inc' %] + [% ELSE %]
--- a/mainpage.pl +++ a/mainpage.pl @@ -89,6 +89,22 @@ $template->param( # unless ($loggedinuser) { $template->param(adminWarning => 1); +} else { + my $patron_has_flags = Koha::Patron->check_if_patrons_have_flags(); + if ($patron_has_flags) { + my $featuretoolrequired = C4::Auth->check_feature_tool_required(); + if ($featuretoolrequired) { + my $kohaversion = Koha::version(); + my $dbh = C4::Context->dbh; + my $dbquery = qq| + SELECT value FROM systempreferences WHERE variable="PreviousVersion" |; + my $sth = $dbh->prepare($dbquery); + $sth->execute(); + my $dbversion = $sth->fetchrow; + print $query->redirect("/cgi-bin/koha/installer/featurereleasetool.pl?dbversion=$dbversion&kohaversion=$kohaversion"); + exit; + } + } } output_html_with_http_headers $query, $cookie, $template->output; --- a/tools/koha-news.pl +++ a/tools/koha-news.pl @@ -83,8 +83,10 @@ foreach my $language ( @$tlangs ) { } } +my $location = "intranet"; $template->param( lang_list => \@lang_list, - branchcode => $branchcode ); + branchcode => $branchcode, + location => $location ); my $op = $cgi->param('op') // ''; --