diff --git a/C4/Biblio.pm b/C4/Biblio.pm index b5c870d635..7920bb3047 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -1218,14 +1218,8 @@ sub GetMarcBiblio { return; } - my $dbh = C4::Context->dbh; - my $sth = $dbh->prepare("SELECT biblioitemnumber FROM biblioitems WHERE biblionumber=? "); - $sth->execute($biblionumber); - my $row = $sth->fetchrow_hashref; - my $biblioitemnumber = $row->{'biblioitemnumber'}; my $marcxml = GetXmlBiblio( $biblionumber ); $marcxml = StripNonXmlChars( $marcxml ); - my $frameworkcode = GetFrameworkCode($biblionumber); MARC::File::XML->default_record_format( C4::Context->preference('marcflavour') ); my $record = MARC::Record->new(); @@ -1237,8 +1231,6 @@ sub GetMarcBiblio { if ($@) { warn " problem with :$biblionumber : $@ \n$marcxml"; } return unless $record; - C4::Biblio::_koha_marc_update_bib_ids( $record, $frameworkcode, $biblionumber, - $biblioitemnumber ); C4::Biblio::EmbedItemsInMarcBiblio({ marc_record => $record, biblionumber => $biblionumber, diff --git a/Koha.pm b/Koha.pm index 4c8120c217..98ead88d8b 100644 --- a/Koha.pm +++ b/Koha.pm @@ -29,7 +29,7 @@ use vars qw{ $VERSION }; # - #4 : the developer version. The 4th number is the database subversion. # used by developers when the database changes. updatedatabase take care of the changes itself # and is automatically called by Auth.pm when needed. -$VERSION = "21.11.21.000"; +$VERSION = "21.11.22.000"; sub version { return $VERSION; diff --git a/debian/docs/koha-worker.xml b/debian/docs/koha-worker.xml index 3cb19e63cf..b7f5f039b6 100644 --- a/debian/docs/koha-worker.xml +++ b/debian/docs/koha-worker.xml @@ -59,10 +59,10 @@ - | - - Enable verbose output. - + + + Allows specifying the queue worker (defaults to 'default'). + | diff --git a/debian/scripts/koha-foreach b/debian/scripts/koha-foreach index 2f5a150fcb..d2e98dd7de 100755 --- a/debian/scripts/koha-foreach +++ b/debian/scripts/koha-foreach @@ -72,3 +72,5 @@ do [ "$chdir" != "no" ] && cd "$starting_dir" fi done + +exit 0 diff --git a/installer/data/mysql/db_revs/211120000.pl b/installer/data/mysql/db_revs/211120000.pl old mode 100644 new mode 100755 diff --git a/installer/data/mysql/db_revs/211112000.pl~ b/installer/data/mysql/db_revs/211121000.pl similarity index 61% rename from installer/data/mysql/db_revs/211112000.pl~ rename to installer/data/mysql/db_revs/211121000.pl index 212549da1f..2fda5dddc2 100755 --- a/installer/data/mysql/db_revs/211112000.pl~ +++ b/installer/data/mysql/db_revs/211121000.pl @@ -2,6 +2,7 @@ use Modern::Perl; return { bug_number => undef, - description => 'Koha 21.11.12 release', + description => 'Koha 21.11.21 release', up => sub {}, } + diff --git a/installer/data/mysql/db_revs/211122000.pl b/installer/data/mysql/db_revs/211122000.pl new file mode 100755 index 0000000000..36760bc8e2 --- /dev/null +++ b/installer/data/mysql/db_revs/211122000.pl @@ -0,0 +1,8 @@ +use Modern::Perl; + +return { + bug_number => undef, + description => 'Koha 21.11.22 release', + up => sub {}, +} + diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/oai_sets.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/oai_sets.tt index a433a8c10b..44a14f9354 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/oai_sets.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/oai_sets.tt @@ -72,7 +72,11 @@
  1. - + [% IF ( spec == "" ) %] + + [% ELSE %] + + [% END %] Required
  2. diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref index 787477b7f1..26942043de 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref @@ -376,22 +376,22 @@ Patrons: choices: 1: Enable 0: Disable - - "pseudonymization to comply with GDPR for personal information." - - "Patrons and transactions will be copied to a separate table for statistics purpose." + - "pseudonymization to comply with data privacy policies and regulations like GDPR for managing personal information." + - "Patrons and transactions will be copied to a separate table for statistical purposes." - "
    Use the following fields for patrons:" - pref: PseudonymizationPatronFields multiple: title: "Patron's title" city: "City" state: "State" - zipcode: "Zipcode" + zipcode: "ZIP/Postal code" country: "Country" branchcode: "Patron's library" - categorycode: "Patron's category" + categorycode: "Patron category" dateenrolled: "Date the patron was added to Koha" sex: "Patron's gender" - sort1: "Sort1" - sort2: "Sort2" + sort1: "Sort 1" + sort2: "Sort 2" - "
    And the following fields for the transactions:" - pref: PseudonymizationTransactionFields multiple: diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/z3950servers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/z3950servers.tt index 585e6bc86b..889c4e2d08 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/z3950servers.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/z3950servers.tt @@ -95,7 +95,12 @@
    1. - Required + [% IF server.servername %] + + [% ELSE %] + + [% END %] + Required
    2. Required diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt index ca1f81a101..79b946f6da 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt @@ -451,20 +451,6 @@ function PopupMARCFieldDoc(field) { } } - function PopupMARCFieldDoc(field) { - [% IF Koha.Preference('marcfielddocurl') %] - var docurl = "[% Koha.Preference('marcfielddocurl').replace('"','"') | html %]"; - docurl = docurl.replace("{MARC}", "[% marcflavour | html %]"); - docurl = docurl.replace("{FIELD}", ""+field); - docurl = docurl.replace("{LANG}", "[% lang | html %]"); - window.open(docurl); - [% ELSIF ( marcflavour == 'MARC21' ) %] - _MARC21FieldDoc(field); - [% ELSIF ( marcflavour == 'UNIMARC' ) %] - _UNIMARCFieldDoc(field); - [% END %] - } - function _MARC21FieldDoc(field) { if(field == 0) { window.open("http://www.loc.gov/marc/bibliographic/bdleader.html"); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt index c9d41cae35..8b89f5f06c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt @@ -1462,7 +1462,7 @@ var value = parseInt($(this).val()); var found_holds = $("select[name='rank-request'][disabled='disabled']").length ; //Count how many are found if( !isNaN(value) ) { //If moved to 'del' - var after = row.parent().find("tr:nth-child("+(value+1+found_holds )+")"); //Go to the row 1 after the new value (and skip found holds) + var after = row.parent().find(`tr:nth-child(${value+found_holds})`); //Go to the row 1 after the new value (and skip found holds) if (prev_rank_request > value) { row.insertBefore(after); } else { diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt index 4285f92017..07de616b0d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt @@ -395,14 +395,13 @@ [% ELSE %]
      - No log found [% IF ( CATALOGUING ) %] - for Bibliographic record [% object | html %] + No log found for Bibliographic record [% object | html %]. + [% ELSIF ( MEMBERS ) %] + No log found for [% INCLUDE 'patron-title.inc' %]. + [% ELSE %] + No log found. [% END %] - [% IF ( MEMBERS ) %] - for [% INCLUDE 'patron-title.inc' %] - [% END %] - .
      [% END %] [% END %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt index cd21067de1..aae1ef2138 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt @@ -450,6 +450,9 @@ [% BLOCK jsinclude %] [% Asset.js("lib/jquery/plugins/jquery.deserialize.min.js") | $raw %] [% END %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl index c9356a88ae..59a2caba55 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl +++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl @@ -1310,11 +1310,7 @@ - - - - - + @@ -1335,7 +1331,6 @@ Pending hold In transit On hold - Not for loan @@ -1355,7 +1350,12 @@ : - + + + + + + @@ -1374,7 +1374,12 @@ - + + + + + + diff --git a/misc/maintenance/search_for_data_inconsistencies.pl b/misc/maintenance/search_for_data_inconsistencies.pl index c2c94d490c..8a7309208f 100755 --- a/misc/maintenance/search_for_data_inconsistencies.pl +++ b/misc/maintenance/search_for_data_inconsistencies.pl @@ -118,8 +118,10 @@ use C4::Biblio qw( GetMarcFromKohaField ); } } - my @decoding_errors; + my ( @decoding_errors, @ids_not_in_marc ); my $biblios = Koha::Biblios->search; + my ( $biblio_tag, $biblio_subfield ) = C4::Biblio::GetMarcFromKohaField( "biblio.biblionumber" ); + my ( $biblioitem_tag, $biblioitem_subfield ) = C4::Biblio::GetMarcFromKohaField( "biblioitems.biblioitemnumber" ); while ( my $biblio = $biblios->next ) { my $record = eval{$biblio->metadata->record;}; if ($@) { @@ -160,6 +162,33 @@ use C4::Biblio qw( GetMarcFromKohaField ); new_item($_) for @decoding_errors; new_hint("The bibliographic records must have a valid MARCXML or you will face encoding issues or wrong displays"); } + if (@ids_not_in_marc) { + new_section("Bibliographic records have MARCXML without biblionumber or biblioitemnumber"); + for my $id (@ids_not_in_marc) { + if ( exists $id->{biblioitemnumber} ) { + new_item( + sprintf(q{Biblionumber %s has biblioitemnumber '%s' but should be '%s' in %s$%s}, + $id->{biblionumber}, + $id->{biblioitemnumber}, + $id->{biblioitemnumber_in_marc}, + $biblioitem_tag, + $biblioitem_subfield, + ) + ); + } + else { + new_item( + sprintf(q{Biblionumber %s has '%s' in %s$%s}, + $id->{biblionumber}, + $id->{biblionumber_in_marc}, + $biblio_tag, + $biblio_subfield, + ) + ); + } + } + new_hint("The bibliographic records must have the biblionumber and biblioitemnumber in MARCXML"); + } } { diff --git a/t/db_dependent/Biblio.t b/t/db_dependent/Biblio.t index b3d971d833..ff0857a296 100755 --- a/t/db_dependent/Biblio.t +++ b/t/db_dependent/Biblio.t @@ -420,8 +420,6 @@ sub run_tests { is( GetMarcPrice( $record_for_isbn, $marcflavour ), 100, "GetMarcPrice returns the correct value"); - my $newincbiblioitemnumber=$biblioitemnumber+1; - $dbh->do("UPDATE biblioitems SET biblioitemnumber = ? WHERE biblionumber = ?;", undef, $newincbiblioitemnumber, $biblionumber ); my $updatedrecord = GetMarcBiblio({ biblionumber => $biblionumber, embed_items => 0 }); @@ -434,7 +432,6 @@ sub run_tests { } else { $biblioitemnumbertotest = $updatedrecord->field($biblioitem_tag)->subfield($biblioitem_subfield); } - is ($newincbiblioitemnumber, $biblioitemnumbertotest, 'Check newincbiblioitemnumber'); # test for GetMarcUrls $marc_record->append_fields( @@ -597,14 +594,14 @@ sub create_author_field { } subtest 'MARC21' => sub { - plan tests => 47; + plan tests => 46; run_tests('MARC21'); $schema->storage->txn_rollback; $schema->storage->txn_begin; }; subtest 'UNIMARC' => sub { - plan tests => 47; + plan tests => 46; # Mock the auth type data for UNIMARC $dbh->do("UPDATE auth_types SET auth_tag_to_report = '106' WHERE auth_tag_to_report = '100'") or die $dbh->errstr; diff --git a/xt/find-missing-csrf.t b/xt/find-missing-csrf.t new file mode 100755 index 0000000000..15dd6ae626 --- /dev/null +++ b/xt/find-missing-csrf.t @@ -0,0 +1,82 @@ +#!/usr/bin/perl + +# Copyright 2021 Koha development team +# +# This file is part of Koha. +# +# 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 Modern::Perl; +use Test::More tests => 1; +use File::Find; +use File::Slurp; +use Data::Dumper; + +my @themes; + +# OPAC themes +my $opac_dir = 'koha-tmpl/opac-tmpl'; +opendir ( my $dh, $opac_dir ) or die "can't opendir $opac_dir: $!"; +for my $theme ( grep { not /^\.|lib|js|xslt/ } readdir($dh) ) { + push @themes, "$opac_dir/$theme/en"; +} +close $dh; + +# STAFF themes +my $staff_dir = 'koha-tmpl/intranet-tmpl'; +opendir ( $dh, $staff_dir ) or die "can't opendir $staff_dir: $!"; +for my $theme ( grep { not /^\.|lib|js/ } readdir($dh) ) { + push @themes, "$staff_dir/$theme/en"; +} +close $dh; + +my @files; +sub wanted { + my $name = $File::Find::name; + push @files, $name + if $name =~ m[\.(tt|inc)$] and -f $name; +} + +find({ wanted => \&wanted, no_chdir => 1 }, @themes ); + +my @errors; +for my $file ( @files ) { + my @e = check_csrf_in_forms($file); + push @errors, { file => $file, errors => \@e } if @e; +} + +is( @errors, 0, "Template variables should be correctly escaped" ) + or diag(Dumper @errors); + +sub check_csrf_in_forms { + my ( $file ) = @_; + + my @lines = read_file($file); + my @errors; + return @errors unless grep { $_ =~ m| starting on line $open is missing it's corresponding csrf_token include (see bug 22990)" + if !$found; + $found = 0; + } + } + return @errors; +}