From tomascohen at gmail.com Wed Aug 6 19:27:48 2014 From: tomascohen at gmail.com (Tomas Cohen Arazi) Date: Wed, 6 Aug 2014 14:27:48 -0300 Subject: [Koha-patches] [PATCH 1/2] Bug 12716: Allow the import patrons form have drop-downs and datepickers Message-ID: <1407346069-11477-1-git-send-email-tomascohen@gmail.com> To reproduce: - Go to Tools > Import patrons - Notice branchcode and categorycode don't have dropdown menus with valid options. - Notice dateofbirth, dateenrolled and dateexpiry don't have date-pickers - Notice each input field is labeled with the column name instead of a proper description. To test: - Apply the patch, go to Tools > Import patrons - Notice branchcode and categorycode have dropdown menus with valid options, and by default the empty value is selected. - Notice that if you go into the dateofbirth, dateenrolled and dateexpiry fields, a nice date picker widget appears. - Notice each field is labeled with the field description, and that the column name is conveniently shown at the right of the input field. Important: test switching the ExtendedPatronAttributes syspref, and verify that if enabled, the patron_attributes field appears, and also the checkbox selector controlling the extended patron attributes import behaviour shows too. Bonus points: Verify that on a different language, the descriptions get translated, and the column names show correctly Regards To+ --- C4/Templates.pm | 47 +++++++++++++++++ .../intranet-tmpl/prog/en/css/staff-global.css | 6 +++ .../prog/en/modules/tools/import_borrowers.tt | 60 +++++++++++++++++++--- tools/import_borrowers.pl | 19 ++++--- 4 files changed, 116 insertions(+), 16 deletions(-) diff --git a/C4/Templates.pm b/C4/Templates.pm index 16eeec1..6a9d48b 100644 --- a/C4/Templates.pm +++ b/C4/Templates.pm @@ -307,4 +307,51 @@ sub getlanguagecookie { return $cookie; } +=head2 GetColumnDefs + + my $columns = GetColumnDefs( $cgi ) + +It is passed a CGI object and returns a hash of hashes containing +the column names and descriptions for each table defined in the +columns.def file corresponding to the CGI object. + +=cut + +sub GetColumnDefs { + + my $query = shift; + + my $columns = {}; + + my $htdocs = C4::Context->config('intrahtdocs'); + my $columns_file = 'columns.def'; + + # Get theme and language to build the path to columns.def + my ($theme, $lang, $availablethemes) = + themelanguage($htdocs, 'about.tt', 'intranet', $query); + # Build columns.def path + my $path = "$htdocs/$theme/$lang/$columns_file"; + my $fh; + if ( ! open ( $fh, q{<}, $path ) ) { + carp "Error opening $path. Check your templates."; + return; + } + # Loop through the columns.def file + while ( my $input = <$fh> ){ + chomp $input; + if ( $input =~ m|(.*)| ) { + my ( $table, $column ) = split( '\.', $1); + my $description = $2; + # Initialize the table array if needed. + @{$columns->{ $table }} = () if ! defined $columns->{ $table }; + # Push field and description + push @{$columns->{ $table }}, + { field => $column, description => $description }; + } + } + close $fh; + + return $columns; +} + 1; diff --git a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css index a4ef390..bbd8458 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css +++ b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css @@ -1844,6 +1844,12 @@ fieldset.rows+h3 {clear:both;padding-top:.5em;} padding-bottom: 10px; } +.field_hint { + color: grey; + font-style: italic; + padding-left: 1em; +} + .m880 { display:block; text-align:right; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt index 40410f8..a0727b8 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt @@ -1,15 +1,27 @@ +[% USE Koha %] [% INCLUDE 'doc-head-open.inc' %] Koha › Tools › Import patrons [% IF ( uploadborrowers ) %]› Results[% END %] [% INCLUDE 'doc-head-close.inc' %] + [% INCLUDE 'header.inc' %] [% INCLUDE 'patron-search.inc' %] +[% INCLUDE 'calendar.inc' %] @@ -112,12 +124,44 @@
Default values
    - [% FOREACH columnkey IN columnkeys %] -
  1. - - -
  2. - [% END %] +[% FOREACH borrower_field IN borrower_fields %] + [% SWITCH borrower_field.field %] + [% CASE 'branchcode' %] +
  3. + + [% borrower_field.field %] +
  4. + [% CASE 'categorycode' %] +
  5. + + [% borrower_field.field %] +
  6. + [% CASE %] +
  7. + + [% borrower_field.field %] +
  8. + [% END %] +[% END %] +[% IF ( Koha.Preference('ExtendedPatronAttributes') == 1 ) %] +
  9. + + + patron_attributes +
  10. +[% END %]
If matching record is already in the borrowers table: @@ -129,7 +173,7 @@
- [% IF ( ExtendedPatronAttributes ) %] + [% IF ( Koha.Preference('ExtendedPatronAttributes') == 1 ) %]
Patron attributes
  1. diff --git a/tools/import_borrowers.pl b/tools/import_borrowers.pl index abbef70..d99db2f 100755 --- a/tools/import_borrowers.pl +++ b/tools/import_borrowers.pl @@ -41,11 +41,13 @@ use C4::Auth; use C4::Output; use C4::Dates qw(format_date_in_iso); use C4::Context; -use C4::Branch qw(GetBranchName); +use C4::Branch qw/GetBranchesLoop GetBranchName/; use C4::Members; use C4::Members::Attributes qw(:all); use C4::Members::AttributeTypes; use C4::Members::Messaging; +use C4::Reports::Guided; +use C4::Templates; use Koha::Borrower::Debarments; use Text::CSV; @@ -60,10 +62,6 @@ my (@errors, @feedback); my $extended = C4::Context->preference('ExtendedPatronAttributes'); my $set_messaging_prefs = C4::Context->preference('EnhancedMessagingPreferences'); my @columnkeys = C4::Members::columns(); -if ($extended) { - push @columnkeys, 'patron_attributes'; -} -my $columnkeystpl = [ map { {'key' => $_} } grep {$_ ne 'borrowernumber' } @columnkeys ]; # ref. to array of hashrefs. my $input = CGI->new(); our $csv = Text::CSV->new({binary => 1}); # binary needed for non-ASCII Unicode @@ -78,7 +76,14 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user({ debug => 1, }); -$template->param(columnkeys => $columnkeystpl); +# get the branches and pass them to the template +my $branches = GetBranchesLoop(); +$template->param( branches => $branches ) if ( $branches ); +# get the patron categories and pass them to the template +my $categories = GetBorrowercategoryList(); +$template->param( categories => $categories ) if ( $categories ); +my $columns = C4::Templates::GetColumnDefs( $input ); +$template->param( borrower_fields => $columns->{borrowers} ); if ($input->param('sample')) { print $input->header( @@ -98,8 +103,6 @@ my $overwrite_cardnumber = $input->param('overwrite_cardnumber'); $template->param( SCRIPT_NAME => $ENV{'SCRIPT_NAME'} ); -($extended) and $template->param(ExtendedPatronAttributes => 1); - if ( $uploadborrowers && length($uploadborrowers) > 0 ) { push @feedback, {feedback=>1, name=>'filename', value=>$uploadborrowers, filename=>$uploadborrowers}; my $handle = $input->upload('uploadborrowers'); -- 1.9.1 From tomascohen at gmail.com Wed Aug 6 19:27:49 2014 From: tomascohen at gmail.com (Tomas Cohen Arazi) Date: Wed, 6 Aug 2014 14:27:49 -0300 Subject: [Koha-patches] [PATCH 2/2] Bug 12716: unit tests for GetColumnDefs In-Reply-To: <1407346069-11477-1-git-send-email-tomascohen@gmail.com> References: <1407346069-11477-1-git-send-email-tomascohen@gmail.com> Message-ID: <1407346069-11477-2-git-send-email-tomascohen@gmail.com> The introduced function gets tested. --- t/Templates.t | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100755 t/Templates.t diff --git a/t/Templates.t b/t/Templates.t new file mode 100755 index 0000000..f50297b --- /dev/null +++ b/t/Templates.t @@ -0,0 +1,49 @@ +#!/usr/bin/perl + +# 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 CGI; + +use Test::More tests => 5; +use Test::Deep; + +BEGIN { + use_ok( 'C4::Templates' ); + can_ok( 'C4::Templates', + qw/ GetColumnDefs + getlanguagecookie + setlanguagecookie + themelanguage + gettemplate + _get_template_file + param + output /); +} + +my $query = CGI->new(); +my $columns = C4::Templates::GetColumnDefs( $query ); + +is( ref( $columns ) eq 'HASH', 1, 'GetColumnDefs returns a hashref' ); +# get the tables names, sorted +my @keys = sort keys $columns; +is( scalar @keys, 5, "GetColumnDefs correctly returns the 5 tables defined in columns.def" ); +my @tables = ( 'biblio', 'biblioitems', 'borrowers', 'items', 'statistics'); +cmp_deeply( \@keys, \@tables, "GetColumnDefs returns the expected tables"); + + +1; -- 1.9.1 From sjohnson at hpplnj.org Thu Aug 7 11:46:16 2014 From: sjohnson at hpplnj.org (sjohnson at hpplnj.org) Date: Thu, 7 Aug 2014 05:46:16 -0400 Subject: [Koha-patches] Out of office Message-ID: I will be out of the library July 26- August 11, 2014.  I will periodically check my email and either get back to you or forward your email to a colleague to answer your query.   If you have an urgent need please call the library at 732-572-2750.   Sherry Johnson -------------- next part -------------- An HTML attachment was scrubbed... URL: From sjohnson at hpplnj.org Fri Aug 8 11:45:59 2014 From: sjohnson at hpplnj.org (sjohnson at hpplnj.org) Date: Fri, 8 Aug 2014 05:45:59 -0400 Subject: [Koha-patches] Out of office Message-ID: <7472c0ade0bc40ceaec410b2eb6f9a8b@ec002f51935b4e7c88d3488d6f58ae41> I will be out of the library July 26- August 11, 2014.  I will periodically check my email and either get back to you or forward your email to a colleague to answer your query.   If you have an urgent need please call the library at 732-572-2750.   Sherry Johnson -------------- next part -------------- An HTML attachment was scrubbed... URL: From tomascohen at gmail.com Fri Aug 8 17:12:14 2014 From: tomascohen at gmail.com (Tomas Cohen Arazi) Date: Fri, 8 Aug 2014 12:12:14 -0300 Subject: [Koha-patches] [PATCH 1/2] Bug 12738: (regression tests) C4::Context should set keyword search as default for QueryParser Message-ID: <1407510735-12029-1-git-send-email-tomascohen@gmail.com> This patch introduces tests for the QueryParser PQF driver usage in Koha. Specifically its initialization on C4::Context, and initial setup. It also introduces a .pl script that is used to load C4::Context with different hash randomization seeds on purpose, to verify the initialization result is deterministic and consistent between runs. To test: $ prove -v t/db_dependent/QueryParser.t It should fail because different default_search_class is set on each run, and it is not often the one we expect. Sponsored-by: Universidad Nacional de Cordoba --- t/db_dependent/QueryParser.t | 70 ++++++++++++++++++++++++++++++++++ t/db_dependent/default_search_class.pl | 37 ++++++++++++++++++ 2 files changed, 107 insertions(+) create mode 100644 t/db_dependent/QueryParser.t create mode 100755 t/db_dependent/default_search_class.pl diff --git a/t/db_dependent/QueryParser.t b/t/db_dependent/QueryParser.t new file mode 100644 index 0000000..1e44b90 --- /dev/null +++ b/t/db_dependent/QueryParser.t @@ -0,0 +1,70 @@ +#!/usr/bin/perl + +# 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 => 7; + +use File::Basename; +use C4::Context; + +C4::Context->set_preference( "UseQueryParser", 1 ); +my $QParser = C4::Context->queryparser(); + +# Check initialization correctly parsed the config file +ok( defined $QParser && ref($QParser) eq "Koha::QueryParser::Driver::PQF" + , 'C4::Context successfully created a QP object' ); + +is( $QParser->search_class_count, 4, + "Initialized 4 search classes" ); +is( scalar(@{$QParser->search_fields()->{'keyword'}}), 111, + "Correct number of search fields for 'keyword' class"); +is( scalar(@{$QParser->search_fields()->{'author'}}), 5, + "Correct number of search fields for 'author' class"); +is( scalar(@{$QParser->search_fields()->{'subject'}}), 12, + "Correct number of search fields for 'subject' class"); +is( scalar(@{$QParser->search_fields()->{'title'}}), 5, + "Correct number of search fields for 'title' class"); + +# Load C4::Context 4 times with different randomization seeds +$ENV{ PERL_PERTURB_KEYS } = "1"; +my $hash_seed = "AB123"; +my $default_search_class1 = get_default_search_class(); +$hash_seed = "CD456"; +my $default_search_class2 = get_default_search_class(); +$hash_seed = "ABCDE"; +my $default_search_class3 = get_default_search_class(); +$hash_seed = "123456"; +my $default_search_class4 = get_default_search_class(); + +ok( $default_search_class1 eq 'keyword' && + $default_search_class2 eq 'keyword' && + $default_search_class3 eq 'keyword' && + $default_search_class4 eq 'keyword', + "C4::Context correctly sets the default search class to 'keyword' (Bug 12738)"); + +sub get_default_search_class { + # get the default search class from a forked proccess + # that just loads C4::Context + $ENV{ PERL_HASH_SEED } = $hash_seed; + my $running_dir = dirname(__FILE__); + my $default_search_class = qx/$running_dir\/default_search_class.pl/; + + return $default_search_class; +} + +1; diff --git a/t/db_dependent/default_search_class.pl b/t/db_dependent/default_search_class.pl new file mode 100755 index 0000000..19268ac --- /dev/null +++ b/t/db_dependent/default_search_class.pl @@ -0,0 +1,37 @@ +#!/usr/bin/perl + +# 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; + +=head1 default_search_class.pl + +The only purpose of this script is to load C4::Context and print +the default search class from the QueryParser object + +=cut + +use C4::Context; + +C4::Context->set_preference("UseQueryParser","1"); + +my $QParser = C4::Context->queryparser(); +my $default_search_class = $QParser->default_search_class(); + +print $default_search_class; + +exit 0; + -- 1.9.1 From tomascohen at gmail.com Fri Aug 8 17:12:15 2014 From: tomascohen at gmail.com (Tomas Cohen Arazi) Date: Fri, 8 Aug 2014 12:12:15 -0300 Subject: [Koha-patches] [PATCH 2/2] Bug 12738: C4::Context should set 'keyword' as the default search class In-Reply-To: <1407510735-12029-1-git-send-email-tomascohen@gmail.com> References: <1407510735-12029-1-git-send-email-tomascohen@gmail.com> Message-ID: <1407510735-12029-2-git-send-email-tomascohen@gmail.com> On a Perl 5.18 environment (e.g. Ubuntu 14.04 LTS): To reproduce: - Have UseQueryParser == "Don't try" - Perform a search typing just a word that would have many matches on your Zebra db. - Take note of the search results count. - Make sure you have the queryparser.yaml file in your config dir. - Set UseQueryParser == "Try" - Perform the same search a couple of times => FAIL: Notice that the search results count differs from one run to the other. - Run the regression tests $ prove -v t/db_dependent/QueryParser.t => FAIL: tests fail To test: - Apply the patch - Run tests $ prove -v t/db_dependent/QueryParser.t => SUCCESS: tests pass - Repeat the steps 'To reproduce' => SUCCESS: Search results count is deterministic :-D - Sign off :-D Sponsored-by: Universidad Nacional de Cordoba --- C4/Context.pm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/C4/Context.pm b/C4/Context.pm index 9a7b75d..63e8ebe 100644 --- a/C4/Context.pm +++ b/C4/Context.pm @@ -988,6 +988,8 @@ sub _new_queryparser { my $config_file = $context->config('queryparser_config'); $config_file ||= '/etc/koha/searchengine/queryparser.yaml'; if ( $QParser->load_config($config_file) ) { + # Set 'keyword' as the default search class + $QParser->default_search_class('keyword'); # TODO: allow indexes to be configured in the database return $QParser; } -- 1.9.1 From sjohnson at hpplnj.org Sat Aug 9 11:45:35 2014 From: sjohnson at hpplnj.org (sjohnson at hpplnj.org) Date: Sat, 9 Aug 2014 05:45:35 -0400 Subject: [Koha-patches] Out of office Message-ID: <71fecce2d854441b916e8845fb994e0e@54668d97fc7342fa878109d841d29a5d> I will be out of the library July 26- August 11, 2014.  I will periodically check my email and either get back to you or forward your email to a colleague to answer your query.   If you have an urgent need please call the library at 732-572-2750.   Sherry Johnson -------------- next part -------------- An HTML attachment was scrubbed... URL: From sjohnson at hpplnj.org Sun Aug 10 11:45:46 2014 From: sjohnson at hpplnj.org (sjohnson at hpplnj.org) Date: Sun, 10 Aug 2014 05:45:46 -0400 Subject: [Koha-patches] Out of office Message-ID: I will be out of the library July 26- August 11, 2014.  I will periodically check my email and either get back to you or forward your email to a colleague to answer your query.   If you have an urgent need please call the library at 732-572-2750.   Sherry Johnson -------------- next part -------------- An HTML attachment was scrubbed... URL: From tomascohen at gmail.com Mon Aug 11 18:00:11 2014 From: tomascohen at gmail.com (Tomas Cohen Arazi) Date: Mon, 11 Aug 2014 13:00:11 -0300 Subject: [Koha-patches] [PATCH] Bug 12745: Add a sanity check for QueryParser configuration on about.pl Message-ID: <1407772811-3519-1-git-send-email-tomascohen@gmail.com> Currently there's no way for the user to know he has a bad QueryParser configuration. Koha would just fallback to not using it. This patch adds a check for QueryParser configuration sanity in about.pl To test: - Have UseQueryParser = "Don't try" - Go to More > About Koha > System information - No QueryParser-related warnings - Set UseQueryParser = "Try" - Go to More > About Koha > System information - On a normal setup you shouldn't have any QueryParser-related warnings - Edit your koha-conf.xml file and change the queryparser_config entry to a non-existent filename. - Reload More > About Koha > System information => SUCCESS: a warning message tells you the filename used, and says it failed. - Now just delete the entry in koha-conf.xml - Reload More > About Koha > System information => SUCCESS: a warning message tells you don't have the queryparser_entry in your koha-conf.xml file. Subtest: a - The file /etc/koha/searchengine/queryparser.yaml exists: => SUCCESS: a warning saying it used a fallback is shown b - The file doesn't exist => SUCCESS: Missing entry warning, plus a failure message for the fallback. - Sign off :-D Regards To+ Sponsored-by: Universidad Nacional de Cordoba --- about.pl | 29 ++++++++++++++++++++++++ koha-tmpl/intranet-tmpl/prog/en/modules/about.tt | 23 ++++++++++++++++++- 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/about.pl b/about.pl index 8b9c1e7..b197cd3 100755 --- a/about.pl +++ b/about.pl @@ -92,6 +92,35 @@ if ( ! defined C4::Context->config('zebra_auth_index_mode') ) { }; } +# Test QueryParser configuration sanity +if ( C4::Context->preference( 'UseQueryParser' ) ) { + # Get the QueryParser configuration file name + my $queryparser_file = C4::Context->config( 'queryparser_config' ); + my $queryparser_fallback_file = '/etc/koha/searchengine/queryparser.yaml'; + # Check QueryParser is functional + my $QParser = C4::Context->queryparser(); + my $queryparser_error = {}; + if ( ! defined $QParser || ref($QParser) ne 'Koha::QueryParser::Driver::PQF' ) { + # Error initializing the QueryParser object + # Get the used queryparser.yaml file path to report the user + $queryparser_error->{ fallback } = ( defined $queryparser_file ) ? 0 : 1; + $queryparser_error->{ file } = ( defined $queryparser_file ) + ? $queryparser_file + : $queryparser_fallback_file; + # Report error data to the template + $template->param( QueryParserError => $queryparser_error ); + } else { + # Check for an absent queryparser_config entry in koha-conf.xml + if ( ! defined $queryparser_file ) { + # Not an error but a warning for the missing entry in koha-conf-xml + push @xml_config_warnings, { + error => 'queryparser_entry_missing', + file => $queryparser_fallback_file + }; + } + } +} + $template->param( kohaVersion => $kohaVersion, osVersion => $osVersion, diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt index d434624..23b3bb0 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt @@ -104,7 +104,8 @@

    Please log in instead with a regular staff account. To create a staff account, create a library, a patron category 'Staff' and add a new patron. Then give this patron permissions from 'More' in the toolbar.

    [% END %]

    Warnings regarding the system configuration

    - [% IF warnPrefBiblioAddsAuthorities || warnPrefEasyAnalyticalRecords || warnPrefAnonymousPatron || warnNoActiveCurrency %] + [% IF warnPrefBiblioAddsAuthorities || warnPrefEasyAnalyticalRecords || warnPrefAnonymousPatron || + warnNoActiveCurrency || QueryParserError %] [% IF (warnPrefBiblioAddsAuthorities) %] @@ -119,6 +120,19 @@ [% IF warnNoActiveCurrency %] [% END %] + [% IF QueryParserError %] + + + [% END %] +
    Preferences and parameters
    Warning No active currency is defined. Please go to Administration > Currencies and exchange rates and mark one currency as active.
    Warning + You have set UseQueryParser but there was a problem inititializing QueryParser. + [% IF QueryParserError.fallback %] + The 'queryparser_config' entry is missing in your configuration file. + [% QueryParserError.file %] was used instead without success. + [% ELSE %] + The following configuration file was used without success: [% QueryParserError.file %]. + [% END %] +
    [% END %] [% IF xml_config_warnings.size %] @@ -129,6 +143,13 @@ Warning The <zebra_bib_index_mode> entry is missing in your configuration file. It should be set to dom or grs1. It will default to grs1 but this could change in the future. [% ELSIF config_entry.error == 'zebra_auth_index_mode_warn' %] Warning The <zebra_auth_index_mode> entry is missing in your configuration file. It should be set to dom or grs1. It will default to dom but this could change in the future. + [% ELSIF config_entry.error == 'queryparser_entry_missing' %] + + Warning + You have set UseQueryParser but the 'queryparser_config' entry is missing in your configuration + file. [% config_entry.file %] is used as a fallback. + + [% END %] [% END %] -- 1.9.1 From tomascohen at gmail.com Tue Aug 12 16:19:26 2014 From: tomascohen at gmail.com (Tomas Cohen Arazi) Date: Tue, 12 Aug 2014 11:19:26 -0300 Subject: [Koha-patches] [PATCH] Bug 12750: koha-create should be able to configure SRU server for the created instance Message-ID: <1407853166-20051-1-git-send-email-tomascohen@gmail.com> This patch adds two parameters to the koha-create command: --enable-sru: makes the koha-create script enabled the SRU server for the created instance --sru-port: lets the user specify a desired port for the SRU server to listen at. It defaults to 7090 To test: - Apply the patch on top of master - Build your own package and install / can be tested just using the koha-create command on a 3.16+ packages install - Create an instance as usual (i.e. without --enable-sru and --sru-port) => SUCCESS: The instance is created, the publicserver sections are both commented out. The first publicserver section has 7090 set as the listening port. - Create an instance as usual, passing --sru-port 456 => SUCCESS: The instance is created, the port is set but the publicserver sections are commented out - Create an instance with --enable-sru (with and without --sru-port) => SUCCESS: Verify the instance is created as expected, with the SRU server enabled (port 7090 if no --sru-port passed, the one we chose otherwise). - Verify that the docs also talk about this new parameters addition. - Sign off :-D Regards To+ Sponsored-by: Universidad Nacional de Cordoba --- debian/docs/koha-create.xml | 16 ++++++++++++++++ debian/scripts/koha-create | 34 +++++++++++++++++++++++++++++++++- debian/templates/koha-conf-site.xml.in | 12 ++++++------ 3 files changed, 55 insertions(+), 7 deletions(-) diff --git a/debian/docs/koha-create.xml b/debian/docs/koha-create.xml index 7fb7956..17b0671 100644 --- a/debian/docs/koha-create.xml +++ b/debian/docs/koha-create.xml @@ -37,6 +37,8 @@ /path/to/passwd database n + + port | instancename @@ -152,6 +154,20 @@ + + + Enable the SRU server for the created instance. + + + + + + + Specifiy a for the SRU server to listen on. + + + + , Print usage information. diff --git a/debian/scripts/koha-create b/debian/scripts/koha-create index 6891ac1..b137645 100755 --- a/debian/scripts/koha-create +++ b/debian/scripts/koha-create @@ -60,6 +60,9 @@ Options: --use-memcached Set the instance to make use of memcache. --memcached-servers str Set a comma-separated list of host:port memcached servers. --memcached-prefix str Set the desired prefix for the instance memcached namespace. + --enable-sru Enable the SRU server (default: disabled). + --sru-port Specifiy a TCP port number for the SRU server to listen on. + (default: 7090). --defaultsql some.sql Specify a default SQL file to be loaded on the DB. --configfile cfg_file Specify an alternate config file for reading default values. --passwdfile passwd Specify an alternate passwd file. @@ -87,6 +90,9 @@ generate_config_file() { -e "s/__ZEBRA_PASS__/$zebrapwd/g" \ -e "s/__ZEBRA_MARC_FORMAT__/$ZEBRA_MARC_FORMAT/g" \ -e "s/__ZEBRA_LANGUAGE__/$ZEBRA_LANGUAGE/g" \ + -e "s/__SRU_BIBLIOS_PORT__/$SRU_SERVER_PORT/g" \ + -e "s/__START_SRU_PUBLICSERVER__/$START_SRU_PUBLICSERVER/g" \ + -e "s/__END_SRU_PUBLICSERVER__/$END_SRU_PUBLICSERVER/g" \ -e "s/__BIBLIOS_INDEXING_MODE__/$BIBLIOS_INDEXING_MODE/g" \ -e "s/__AUTHORITIES_INDEXING_MODE__/$AUTHORITIES_INDEXING_MODE/g" \ -e "s/__ZEBRA_BIBLIOS_CFG__/$ZEBRA_BIBLIOS_CFG/g" \ @@ -280,6 +286,17 @@ set_memcached() } +enable_sru_server() +{ + # remove the commenting symbols + START_SRU_PUBLICSERVER="" + END_SRU_PUBLICSERVER="" + if [ "$SRU_SERVER_PORT" = "" ]; then + # --sru-port not passed, use the default + SRU_SERVER_PORT=$DEFAULT_SRU_SERVER_PORT + fi +} + # Set defaults and read config file, if it exists. DOMAIN="" OPACPORT="80" @@ -302,6 +319,14 @@ MEMCACHED_PREFIX="" DEFAULT_MEMCACHED_SERVERS="127.0.0.1:11211" DEFAULT_MEMCACHED_PREFIX="koha_" +# SRU server variables +ENABLE_SRU="no" +SRU_SERVER_PORT="" +# hardcoded default SRU server port +DEFAULT_SRU_SERVER_PORT="7090" +START_SRU_PUBLICSERVER="" + # Indexing mode variables (default is DOM) BIBLIOS_INDEXING_MODE="dom" AUTHORITIES_INDEXING_MODE="dom" @@ -318,7 +343,7 @@ fi [ $# -ge 1 ] && [ $# -le 16 ] || ( usage ; die "Error: wrong parameters" ) -TEMP=`getopt -o chrpm:l:d:f:b:a: -l create-db,request-db,populate-db,use-db,use-memcached,help,marcflavor:,auth-idx:,biblio-idx:,zebralang:,defaultsql:,configfile:,passwdfile:,database:,adminuser:,memcached-servers:,memcached-prefix:, \ +TEMP=`getopt -o chrpm:l:d:f:b:a: -l create-db,request-db,populate-db,use-db,use-memcached,enable-sru,sru-port:,help,marcflavor:,auth-idx:,biblio-idx:,zebralang:,defaultsql:,configfile:,passwdfile:,database:,adminuser:,memcached-servers:,memcached-prefix:, \ -n "$0" -- "$@"` # Note the quotes around `$TEMP': they are essential! @@ -369,6 +394,10 @@ while true ; do CLO_DATABASE="$2" ; shift 2 ;; -a|--adminuser) CLO_ADMINUSER="$2" ; shift 2 ;; + --enable-sru) + ENABLE_SRU="yes" ; shift ;; + --sru-port) + SRU_SERVER_PORT="$2" ; shift 2 ;; -h|--help) usage ; exit 0 ;; --) @@ -417,6 +446,9 @@ fi set_biblios_indexing_mode $BIBLIOS_INDEXING_MODE $ZEBRA_MARC_FORMAT +if [ "$ENABLE_SRU" != "no" ]; then + enable_sru_server +fi if [ "$CLO_AUTHORITIES_INDEXING_MODE" != "" ]; then AUTHORITIES_INDEXING_MODE=$CLO_AUTHORITIES_INDEXING_MODE diff --git a/debian/templates/koha-conf-site.xml.in b/debian/templates/koha-conf-site.xml.in index 371b1d2..f1c5b2d 100644 --- a/debian/templates/koha-conf-site.xml.in +++ b/debian/templates/koha-conf-site.xml.in @@ -6,9 +6,9 @@ - +__START_SRU_PUBLICSERVER__ +tcp:@:__SRU_BIBLIOS_PORT__ +__END_SRU_PUBLICSERVER__ - +__START_SRU_PUBLICSERVER__ /var/lib/koha/__KOHASITE__/biblios /etc/koha/sites/__KOHASITE__/__ZEBRA_BIBLIOS_CFG__ @@ -245,7 +245,7 @@ kohauser __ZEBRA_PASS__ ---> +__END_SRU_PUBLICSERVER__ mysql -- 1.9.1 From srdjan at catalyst.net.nz Thu Aug 14 05:11:27 2014 From: srdjan at catalyst.net.nz (Srdjan) Date: Thu, 14 Aug 2014 15:11:27 +1200 Subject: [Koha-patches] [PATCH] [SIGNED-OFF] Bug 12177 - Remove HTML from authorities.pl Message-ID: <1407985887-11336-1-git-send-email-srdjan@catalyst.net.nz> From: Bernardo Gonzalez Kriegel This patch removes HTML code from authorities.pl To test: 1. Check no regressions on authority editor, new/edit/save 2. Check new line on translation files, update a language, look for 'Tag editor' Signed-off-by: Srdjan --- authorities/authorities.pl | 136 +++++++++------------ .../prog/en/modules/authorities/authorities.tt | 28 ++++- 2 files changed, 86 insertions(+), 78 deletions(-) diff --git a/authorities/authorities.pl b/authorities/authorities.pl index 60a9343..89049fe 100755 --- a/authorities/authorities.pl +++ b/authorities/authorities.pl @@ -118,18 +118,14 @@ sub build_authorized_values_list { $authorised_lib{$value} = $lib; } } - return CGI::scrolling_list( - -name => "tag_".$tag."_subfield_".$subfield."_".$index_tag."_".$index_subfield, - -values => \@authorised_values, - -default => $value, - -labels => \%authorised_lib, - -override => 1, - -size => 1, - -multiple => 0, - -tabindex => 1, - -id => "tag_".$tag."_subfield_".$subfield."_".$index_tag."_".$index_subfield, - -class => "input_marceditor", - ); + return { + type => 'select', + id => "tag_".$tag."_subfield_".$subfield."_".$index_tag."_".$index_subfield, + name => "tag_".$tag."_subfield_".$subfield."_".$index_tag."_".$index_subfield, + values => \@authorised_values, + labels => \%authorised_lib, + default => $value, + }; } @@ -209,16 +205,13 @@ sub create_input { # it's a thesaurus / authority field } elsif ( $tagslib->{$tag}->{$subfield}->{authtypecode} ) { - $subfield_data{marc_value} = - " - {$tag}->{$subfield}->{authtypecode}."','auth'); return false;\" tabindex=\"1\" title=\"Tag Editor\">... - "; + $subfield_data{marc_value} = { + type => 'text1', + id => $subfield_data{id}, + name => $subfield_data{id}, + value => $value, + authtypecode => $tagslib->{$tag}->{$subfield}->{authtypecode}, + }; # it's a plugin field } elsif ( $tagslib->{$tag}->{$subfield}->{'value_builder'} ) { @@ -238,43 +231,35 @@ sub create_input { my ( $function_name, $javascript ) = plugin_javascript( $dbh, $rec, $tagslib, $subfield_data{id}, $tabloop ); # my ( $function_name, $javascript,$extended_param ); - $subfield_data{marc_value} = - " - ... - $javascript"; + $subfield_data{marc_value} = { + type => 'text2', + id => $subfield_data{id}, + name => $subfield_data{id}, + value => $value, + maxlength => $max_length, + function => $function_name, + index_tag => $index_tag, + javascript => $javascript, + }; # it's an hidden field } elsif ( $tag eq '' ) { - $subfield_data{marc_value} = - " - "; + $subfield_data{marc_value} = { + type => 'hidden', + id => $subfield_data{id}, + name => $subfield_data{id}, + value => $value, + maxlength => $max_length, + } } elsif ( $tagslib->{$tag}->{$subfield}->{'hidden'} ) { - $subfield_data{marc_value} = - ""; + $subfield_data{marc_value} = { + type => 'text', + id => $subfield_data{id}, + name => $subfield_data{id}, + value => $value, + maxlength => $max_length, + }; # it's a standard field } @@ -289,30 +274,24 @@ sub create_input { && C4::Context->preference("marcflavour") eq "MARC21" ) ) { - $subfield_data{marc_value} = - " - "; + $subfield_data{marc_value} = { + type => 'textarea', + id => $subfield_data{id}, + name => $subfield_data{id}, + value => $value, + maxlength => $max_length, + }; + } else { - $subfield_data{marc_value} = - " - "; + $subfield_data{marc_value} = { + type => 'text', + id => $subfield_data{id}, + name => $subfield_data{id}, + value => $value, + maxlength => $max_length, + }; + } } $subfield_data{'index_subfield'} = $index_subfield; @@ -538,7 +517,10 @@ sub build_hidden_data { $subfield_data{marc_lib}=$tagslib->{$tag}->{$subfield}->{lib}; $subfield_data{marc_mandatory}=$tagslib->{$tag}->{$subfield}->{mandatory}; $subfield_data{marc_repeatable}=$tagslib->{$tag}->{$subfield}->{repeatable}; - $subfield_data{marc_value}=""; + $subfield_data{marc_value} = { + type => 'hidden_simple', + name => 'field_value[]', + }; push(@loop_data, \%subfield_data); $i++ } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt index b7dcbf7..a3329cd 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt @@ -311,7 +311,33 @@ function confirmnotdup(redirect){ [% END %] - [% subfield_loo.marc_value %] + [% SET mv = subfield_loo.marc_value %] + [% IF ( mv.type == 'select' ) %] + + [% ELSIF ( mv.type == 'text1' ) %] + + ... + [% ELSIF ( mv.type == 'text2' ) %] + + ... + [% mv.javascript %] + [% ELSIF ( mv.type == 'text' ) %] + + [% ELSIF ( mv.type == 'textarea' ) %] + + [% ELSIF ( mv.type == 'hidden' ) %] + + [% ELSIF ( mv.type == 'hidden_simple' ) %] + + [% END %] [% IF ( subfield_loo.repeatable ) %] -- 1.9.1 From srdjan at catalyst.net.nz Fri Aug 15 03:18:16 2014 From: srdjan at catalyst.net.nz (Srdjan) Date: Fri, 15 Aug 2014 13:18:16 +1200 Subject: [Koha-patches] [PATCH] [SIGNED-OFF] Bug 10589 - Override OpacHiddenItems based on Patron Category Message-ID: <1408065496-23944-1-git-send-email-srdjan@catalyst.net.nz> From: Mark Tompsett Two system preferences, PatronSingleBranch and PatronEveryBranch, have been added to facilitate some granularity on the override. If the home branch of the item and the patron match and the catgegory code of the patron matches one of the pipe delimited values in the PatronSingleBranch patron category code, then an item which would normally be hidden will be visible. If the patron category matches one of the pipe delimited values in the PatronEveryBranch patron category, then every item hidden by OpacHiddenItems will be visible. Since the patron category codes used by default for these two system preferences are not added, OpacHiddenItems will continue function as expected until individual patrons and system preferences are configured. There is no need to provide this functionality to staff, as they have access to the staff client. Rebased to current master (again). Signed-off-by: Srdjan Signed-off-by: Marcel de Rooy Rebased to current master (Marc) Signed-off-by: Srdjan --- C4/Items.pm | 26 +++++++++++++++++++--- installer/data/mysql/sysprefs.sql | 2 ++ installer/data/mysql/updatedatabase.pl | 16 +++++++++++++ .../prog/en/modules/admin/preferences/opac.pref | 8 +++++++ 4 files changed, 49 insertions(+), 3 deletions(-) diff --git a/C4/Items.pm b/C4/Items.pm index f8e2121..05126b4 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -35,7 +35,7 @@ use DateTime::Format::MySQL; use Data::Dumper; # used as part of logging item record changes, not just for # debugging; so please don't remove this use Koha::DateUtils qw/dt_from_string/; - +use C4::Members qw/GetBorrowerCategorycode/; use vars qw($VERSION @ISA @EXPORT); BEGIN { @@ -1697,6 +1697,18 @@ sub GetHiddenItemnumbers { return (); } my $dbh = C4::Context->dbh; + my $borrowernumber = 0; + my $homebranch = q{}; + my $categorycode = q{}; + if (C4::Context->userenv) { + $borrowernumber = C4::Context->userenv->{'number'} || 0; + $homebranch = C4::Context->userenv->{'branch'} || q{}; + } + if ($borrowernumber) { + $categorycode = C4::Members::GetBorrowerCategorycode($borrowernumber) || q{}; + } + my @SingleBranchCodes = split /\|/,C4::Context->preference('PatronSingleBranch'); + my @EveryBranchCodes = split /\|/,C4::Context->preference('PatronEveryBranch'); # For each item foreach my $item (@items) { @@ -1716,8 +1728,16 @@ sub GetHiddenItemnumbers { # If the results matches the values in the yaml file if (any { $val eq $_ } @{$hidingrules->{$field}}) { - # We add the itemnumber to the list - push @resultitems, $item->{'itemnumber'}; + my $override = 0; + if ( ($homebranch eq $item->{'homebranch'} && + (any { /^$categorycode$/ } @SingleBranchCodes ) ) || + (any { /^$categorycode$/ } @EveryBranchCodes ) ) { + $override = 1; + } + if ($override==0) { + # We add the itemnumber to the hidden list + push @resultitems, $item->{'itemnumber'}; + } # If at least one rule matched for an item, no need to test the others last; diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 03a3f1e..0be27c1 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -305,6 +305,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('OverDriveLibraryID','','Library ID for OverDrive integration','','Integer'), ('OverdueNoticeBcc','','','Email address to bcc outgoing overdue notices sent by email','free'), ('OverduesBlockCirc','noblock','noblock|confirmation|block','When checking out an item should overdues block checkout, generate a confirmation dialogue, or allow checkout','Choice'), +('PatronEveryBranch','','Pipe delimited patron category codes which allow viewing hidden items for every branch','',''), ('patronimages','0',NULL,'Enable patron images for the Staff Client','YesNo'), ('PatronSelfRegistration','0',NULL,'If enabled, patrons will be able to register themselves via the OPAC.','YesNo'), ('PatronSelfRegistrationAdditionalInstructions','','','A free text field to display additional instructions to newly self registered patrons.','free'), @@ -313,6 +314,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('PatronSelfRegistrationDefaultCategory','','','A patron registered via the OPAC will receive a borrower category code set in this system preference.','free'), ('PatronSelfRegistrationExpireTemporaryAccountsDelay','0',NULL,'If PatronSelfRegistrationDefaultCategory is enabled, this system preference controls how long a patron can have a temporary status before the account is deleted automatically. It is an integer value representing a number of days to wait before deleting a temporary patron account. Setting it to 0 disables the deleting of temporary accounts.','Integer'), ('PatronSelfRegistrationVerifyByEmail','0',NULL,'If enabled, any patron attempting to register themselves via the OPAC will be required to verify themselves via email to activate his or her account.','YesNo'), +('PatronSingleBranch','',"Pipe delimited patron category codes which allow viewing hidden items for only the patron's home branch",'',''), ('PatronsPerPage','20','20','Number of Patrons Per Page displayed by default','Integer'), ('Persona','0','','Use Mozilla Persona for login','YesNo'), ('PrefillItem','0','','When a new item is added, should it be prefilled with last created item values?','YesNo'), diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 3f1af57..06e87be 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -8603,6 +8603,22 @@ if ( CheckVersion($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.13.00.XXX"; +if ( CheckVersion($DBversion) ) { + $dbh->do( + q{ +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('PatronEveryBranch','',"Pipe delimited patron category codes which allow viewing hidden items for every branch",'',''); +} + ); + $dbh->do( + q{ +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('PatronSingleBranch','',"Pipe delimited patron category codes which allow viewing hidden items for only the patron's home branch",'',''); +} + ); + print "Upgrade to $DBversion done (Bug filtering: Patron Category to override OPACHiddenItems)\n"; + SetVersion($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) 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 739abb3..49c5596 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 @@ -529,6 +529,14 @@ OPAC: class: code - Allows to define custom rules for hiding specific items at opac. See docs/opac/OpacHiddenItems.txt for more informations - + - pref: PatronSingleBranch + class: short + - Patrons matching one of these pipe delimited patron category codes override OpacHiddenItems for their home branch only. + - + - pref: PatronEveryBranch + class: short + - Patrons matching one of these pipe delimited patron category codes override OpacHiddenItems for every branch. + - - pref: OpacAllowPublicListCreation default: 1 choices: -- 1.9.1 From srdjan at catalyst.net.nz Fri Aug 15 03:44:09 2014 From: srdjan at catalyst.net.nz (Srdjan) Date: Fri, 15 Aug 2014 13:44:09 +1200 Subject: [Koha-patches] [PATCH] [SIGNED-OFF] Bug 12180 - Remove HTML from batchMod.pl Message-ID: <1408067049-30622-1-git-send-email-srdjan@catalyst.net.nz> From: Bernardo Gonzalez Kriegel This patch removes HTML code from batchMod.pl To test: 1. Check no regressions on batchMod editor, Go to Tools > Batch item modification, put a know barcode on barcode list, press continue 2. Check new line on translation files, update a language, look for 'Tag editor' Fixed capitalizacion Signed-off-by: Srdjan --- .../prog/en/modules/tools/batchMod-edit.tt | 28 +++++++- tools/batchMod.pl | 76 +++++++++++++--------- 2 files changed, 74 insertions(+), 30 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt index 9cbd901..9fdf1f5 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt @@ -177,7 +177,33 @@ $(document).ready(function(){ [% ite.marc_lib %] [% UNLESS ( ite.mandatory ) %][% ELSE %]Required[% END %] - [% ite.marc_value %] + + [% SET mv = ite.marc_value %] + [% IF ( mv.type == 'select' ) -%] + + [% ELSIF ( mv.type == 'text1' ) %] + + ... + [% ELSIF ( mv.type == 'text2' ) %] + + ... + [% javascript %] + [% ELSIF ( mv.type == 'text' ) %] + + [% ELSIF ( mv.type == 'hidden' ) %] + + [% ELSIF ( mv.type == 'textarea' ) %] + + [%- END -%] + diff --git a/tools/batchMod.pl b/tools/batchMod.pl index e886642..8cf1204 100755 --- a/tools/batchMod.pl +++ b/tools/batchMod.pl @@ -330,9 +330,6 @@ foreach my $tag (sort keys %{$tagslib}) { $subfield_data{visibility} = "display:none;" if (($tagslib->{$tag}->{$subfield}->{hidden} > 4) || ($tagslib->{$tag}->{$subfield}->{hidden} < -4)); # testing branch value if IndependentBranches. - my $attributes_no_value = qq(tabindex="1" id="$subfield_data{id}" name="field_value" class="input_marceditor" size="50" maxlength="255" ); - my $attributes = qq($attributes_no_value value="$value" ); - if ( $tagslib->{$tag}->{$subfield}->{authorised_value} ) { my @authorised_values; my %authorised_lib; @@ -383,25 +380,23 @@ foreach my $tag (sort keys %{$tagslib}) { } $value=""; } - $subfield_data{marc_value} =CGI::scrolling_list( # FIXME: factor out scrolling_list - -name => "field_value", - -values => \@authorised_values, - -default => $value, - -labels => \%authorised_lib, - -override => 1, - -size => 1, - -multiple => 0, - -tabindex => 1, - -id => "tag_".$tag."_subfield_".$subfield."_".$index_subfield, - -class => "input_marceditor", - ); + $subfield_data{marc_value} = { + type => 'select', + id => "tag_".$tag."_subfield_".$subfield."_".$index_subfield, + name => "field_value", + values => \@authorised_values, + labels => \%authorised_lib, + default => $value, + }; # it's a thesaurus / authority field } elsif ( $tagslib->{$tag}->{$subfield}->{authtypecode} ) { - $subfield_data{marc_value} = " - {$tag}->{$subfield}->{authtypecode}."&index=$subfield_data{id}','$subfield_data{id}'); return false;\" title=\"Tag Editor\">... - "; + $subfield_data{marc_value} = { + type => 'text1', + id => $subfield_data{id}, + value => $value, + authtypecode => $tagslib->{$tag}->{$subfield}->{authtypecode}, + } # it's a plugin field } elsif ( $tagslib->{$tag}->{$subfield}->{value_builder} ) { @@ -411,21 +406,36 @@ foreach my $tag (sort keys %{$tagslib}) { my $temp; my $extended_param = plugin_parameters( $dbh, $temp, $tagslib, $subfield_data{id}, \@loop_data ); my ( $function_name, $javascript ) = plugin_javascript( $dbh, $temp, $tagslib, $subfield_data{id}, \@loop_data ); - $subfield_data{marc_value} = qq[ - ... - $javascript]; + $subfield_data{marc_value} = { + type => 'text2', + id => $subfield_data{id}, + value => $value, + function => $function_name, + random => $subfield_data{random}, + javascript => $javascript, + }; } else { warn "Plugin Failed: $plugin"; - $subfield_data{marc_value} = ""; # supply default input form + $subfield_data{marc_value} = { # supply default input form + type => 'text', + id => $subfield_data{id}, + value => $value, + }; } } elsif ( $tag eq '' ) { # it's an hidden field - $subfield_data{marc_value} = qq(); + $subfield_data{marc_value} = { + type => 'hidden', + id => $subfield_data{id}, + value => $value, + }; } elsif ( $tagslib->{$tag}->{$subfield}->{'hidden'} ) { # FIXME: shouldn't input type be "hidden" ? - $subfield_data{marc_value} = qq(); + $subfield_data{marc_value} = { + type => 'text', + id => $subfield_data{id}, + value => $value, + }; } elsif ( length($value) > 100 or (C4::Context->preference("marcflavour") eq "UNIMARC" and @@ -434,10 +444,18 @@ foreach my $tag (sort keys %{$tagslib}) { 500 <= $tag && $tag < 600 ) ) { # oversize field (textarea) - $subfield_data{marc_value} = "\n"; + $subfield_data{marc_value} = { + type => 'textarea', + id => $subfield_data{id}, + value => $value, + }; } else { # it's a standard field - $subfield_data{marc_value} = ""; + $subfield_data{marc_value} = { + type => 'text', + id => $subfield_data{id}, + value => $value, + }; } # $subfield_data{marc_value}=""; push (@loop_data, \%subfield_data); -- 1.9.1 From srdjan at catalyst.net.nz Fri Aug 15 04:05:34 2014 From: srdjan at catalyst.net.nz (Srdjan) Date: Fri, 15 Aug 2014 14:05:34 +1200 Subject: [Koha-patches] [PATCH] [SIGNED-OFF] Bug 9208 : Fix encoding of overdue letters Message-ID: <1408068334-3911-1-git-send-email-srdjan@catalyst.net.nz> From: Sophie Meynieux When overdue letters templates contain symbol like euro, the conversion between html to pdf results in wrong encoding of special characters. Adding explicit utf8 encoding at the beginning of html file resolves this problem. This is already done for hold notices. Signed-off-by: Srdjan --- misc/cronjobs/overdue_notices.pl | 1 + 1 file changed, 1 insertion(+) diff --git a/misc/cronjobs/overdue_notices.pl b/misc/cronjobs/overdue_notices.pl index 943c486..7e897ec 100755 --- a/misc/cronjobs/overdue_notices.pl +++ b/misc/cronjobs/overdue_notices.pl @@ -397,6 +397,7 @@ if ( defined $htmlfilename ) { print $fh "\n"; print $fh "\n"; + print $fh "\n"; print $fh "[% END %] [% PROCESS cssinclude %] + +[% IF ( Koha.Preference('UsejQueryIMEonOPAC') ) %] + +[% END %] +