From tomascohen at gmail.com Mon Jun 2 20:40:38 2014 From: tomascohen at gmail.com (Tomas Cohen Arazi) Date: Mon, 2 Jun 2014 15:40:38 -0300 Subject: [Koha-patches] [PATCH] Bug 12347: Performance improvements in Search.pm Message-ID: <1401734438-14826-1-git-send-email-tomascohen@gmail.com> Short: some costly stuff is done twice, this patch refactors that to make it more reasonable. Long: Bug 11096 introduced a noticeable overhead to the facet building stage of the getRecords code. This patch leverages it by propagating the MARC::Record objects created upon facet building, and reusing them in the C4::Search::searchResults function. To test: - Search for a term on master - Apply the patch - Same results Unit tests reflecting API change in a separate patch. Regards To+ Sponsored-by: Universidad Nacional de Cordoba --- C4/Search.pm | 49 ++++++++++++++++++------------------------------- 1 file changed, 18 insertions(+), 31 deletions(-) diff --git a/C4/Search.pm b/C4/Search.pm index 748bb1c..f41be72 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -485,18 +485,27 @@ sub getRecords { $tmprecord->append_fields($tmptitle); $tmprecord->append_fields($tmpauthor); } - $results_hash->{'RECORDS'}[$j] = - $tmprecord->as_usmarc(); + $results_hash->{'RECORDS'}[$j] = $tmprecord; } # not an index scan else { - $record = $results[ $i - 1 ]->record($j)->raw(); - # warn "RECORD $j:".$record; + $record = new_record_from_zebra ( + 'biblioserver', + $results[ $i - 1 ]->record($j)->raw() + ); + + if ( ! defined $record ) { + warn "ERROR DECODING RECORD - $@: " . + $results[ $i - 1 ]->record($j)->raw(); + next; + } + $results_hash->{'RECORDS'}[$j] = $record; } } + $results_hashref->{ $servers[ $i - 1 ] } = $results_hash; # Fill the facets while we're looping, but only for the biblioserver and not for a scan @@ -507,16 +516,8 @@ sub getRecords { for my $facet (@$facets) { for ( my $j = 0 ; $j < $jmax ; $j++ ) { - my $marc_record = new_record_from_zebra ( - 'biblioserver', - $results[ $i - 1 ]->record($j)->raw() - ); - - if ( ! defined $marc_record ) { - warn "ERROR DECODING RECORD - $@: " . - $results[ $i - 1 ]->record($j)->raw(); - next; - } + my $marc_record = + $results_hashref->{ $servers[ $i - 1 ] }->{'RECORDS'}[$j]; my @used_datas = (); @@ -528,7 +529,8 @@ sub getRecords { # Removed when as_string fixed my @subfields = $subfield_letters =~ /./sg; - my @fields = $marc_record->field($tag_num); + # Check $tag_num is a valid field for $marc_record + my @fields = eval { $marc_record->field($tag_num) }; foreach my $field (@fields) { my $data = $field->as_string( $subfield_letters, $facet->{sep} ); @@ -1715,22 +1717,7 @@ sub searchResults { # loop through all of the records we've retrieved for ( my $i = $offset ; $i <= $times - 1 ; $i++ ) { - my $marcrecord; - if ($scan) { - # For Scan searches we built USMARC data - $marcrecord = MARC::Record->new_from_usmarc( $marcresults->[$i]); - } else { - # Normal search, render from Zebra's output - $marcrecord = new_record_from_zebra( - 'biblioserver', - $marcresults->[$i] - ); - - if ( ! defined $marcrecord ) { - warn "ERROR DECODING RECORD - $@: " . $marcresults->[$i]; - next; - } - } + my $marcrecord = $marcresults->[$i]; my $fw = $scan ? undef -- 1.9.1 From tomascohen at gmail.com Tue Jun 3 01:09:24 2014 From: tomascohen at gmail.com (Tomas Cohen Arazi) Date: Mon, 2 Jun 2014 20:09:24 -0300 Subject: [Koha-patches] [PATCH 1/2] Bug 12347: Unit tests should be updated to new API Message-ID: <1401750565-12025-1-git-send-email-tomascohen@gmail.com> This patch updates t/db_dependent/Search.t to acknowledge the API change. Now getRecords returns MARC::Record objects and thus there's no need to have separate DOM and GRS-1 test cases (at least for it). To test: - Apply both bug's patches - Run prove -v t/db_dependent/Search.t => SUCCESS: all tests pass Best regards To+ Sponsored-by: Universidad Nacional de Cordoba --- t/db_dependent/Search.t | 87 ++++++++++++++----------------------------------- 1 file changed, 24 insertions(+), 63 deletions(-) diff --git a/t/db_dependent/Search.t b/t/db_dependent/Search.t index 46d63f4..8f9d29e 100644 --- a/t/db_dependent/Search.t +++ b/t/db_dependent/Search.t @@ -17,6 +17,7 @@ use open ':std', ':encoding(utf8)'; use Test::More tests => 4; use Test::MockModule; +use Test::Deep; use MARC::Record; use File::Spec; use File::Basename; @@ -349,8 +350,10 @@ sub run_marc21_search_tests { !defined $results_hashref->{biblioserver}->{RECORDS}->[1] && !defined $results_hashref->{biblioserver}->{RECORDS}->[2] && !defined $results_hashref->{biblioserver}->{RECORDS}->[3] && - !defined $results_hashref->{biblioserver}->{RECORDS}->[4] && - $results_hashref->{biblioserver}->{RECORDS}->[5] eq $record5, "getRecords cursor works"); + !defined $results_hashref->{biblioserver}->{RECORDS}->[4], + "getRecords cursor works (undef first 5 results)"); + cmp_deeply( $results_hashref->{biblioserver}->{RECORDS}->[5], + $record5, "getRecords cursor works"); ( undef, $results_hashref, $facets_loop ) = getRecords('ti:book', 'ti:book', [], [ 'biblioserver' ], '20', 0, undef, \%branches, \%itemtypes, 'ccl', undef); @@ -360,82 +363,45 @@ sub run_marc21_search_tests { getRecords('au:Lessig', 'au:Lessig', [], [ 'biblioserver' ], '20', 0, undef, \%branches, \%itemtypes, 'ccl', undef); is($results_hashref->{biblioserver}->{hits}, 4, "getRecords title search for 'Australia' matched right number of records"); -if ( $indexing_mode eq 'dom' ) { ( undef, $results_hashref, $facets_loop ) = getRecords('salud', 'salud', [], [ 'biblioserver' ], '19', 0, undef, \%branches, \%itemtypes, 'ccl', undef); - ok(MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[0],'UTF-8')->title_proper() =~ m/^Efectos del ambiente/ && - MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[7],'UTF-8')->title_proper() eq 'Salud y seguridad de los trabajadores del sector salud: manual para gerentes y administradores^ies' && - MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[18],'UTF-8')->title_proper() =~ m/^Indicadores de resultados identificados/ + ok($results_hashref->{biblioserver}->{RECORDS}->[0]->title_proper() =~ m/^Efectos del ambiente/ && + $results_hashref->{biblioserver}->{RECORDS}->[7]->title_proper() eq 'Salud y seguridad de los trabajadores del sector salud: manual para gerentes y administradores^ies' && + $results_hashref->{biblioserver}->{RECORDS}->[18]->title_proper() =~ m/^Indicadores de resultados identificados/ , "Simple relevance sorting in getRecords matches old behavior"); ( undef, $results_hashref, $facets_loop ) = getRecords('salud', 'salud', [ 'author_az' ], [ 'biblioserver' ], '38', 0, undef, \%branches, \%itemtypes, 'ccl', undef); - ok(MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[0],'UTF-8')->title_proper() =~ m/la enfermedad laboral\^ies$/ && - MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[6],'UTF-8')->title_proper() =~ m/^Indicadores de resultados identificados/ && - MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[18],'UTF-8')->title_proper() eq 'World health statistics 2009^ien' + ok($results_hashref->{biblioserver}->{RECORDS}->[0]->title_proper() =~ m/la enfermedad laboral\^ies$/ && + $results_hashref->{biblioserver}->{RECORDS}->[6]->title_proper() =~ m/^Indicadores de resultados identificados/ && + $results_hashref->{biblioserver}->{RECORDS}->[18]->title_proper() eq 'World health statistics 2009^ien' , "Simple ascending author sorting in getRecords matches old behavior"); ( undef, $results_hashref, $facets_loop ) = getRecords('salud', 'salud', [ 'author_za' ], [ 'biblioserver' ], '38', 0, undef, \%branches, \%itemtypes, 'ccl', undef); - ok(MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[0],'UTF-8')->title_proper() eq 'World health statistics 2009^ien' && - MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[12],'UTF-8')->title_proper() =~ m/^Indicadores de resultados identificados/ && - MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[18],'UTF-8')->title_proper() =~ m/la enfermedad laboral\^ies$/ + ok($results_hashref->{biblioserver}->{RECORDS}->[0]->title_proper() eq 'World health statistics 2009^ien' && + $results_hashref->{biblioserver}->{RECORDS}->[12]->title_proper() =~ m/^Indicadores de resultados identificados/ && + $results_hashref->{biblioserver}->{RECORDS}->[18]->title_proper() =~ m/la enfermedad laboral\^ies$/ , "Simple descending author sorting in getRecords matches old behavior"); ( undef, $results_hashref, $facets_loop ) = getRecords('salud', 'salud', [ 'pubdate_asc' ], [ 'biblioserver' ], '38', 0, undef, \%branches, \%itemtypes, 'ccl', undef); - ok(MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[0],'UTF-8')->title_proper() eq 'Manual de higiene industrial^ies' && - MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[7],'UTF-8')->title_proper() =~ m/seguridad e higiene del trabajo\^ies$/ && - MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[18],'UTF-8')->title_proper() =~ m/^Indicadores de resultados identificados/ + ok($results_hashref->{biblioserver}->{RECORDS}->[0]->title_proper() eq 'Manual de higiene industrial^ies' && + $results_hashref->{biblioserver}->{RECORDS}->[7]->title_proper() =~ m/seguridad e higiene del trabajo\^ies$/ && + $results_hashref->{biblioserver}->{RECORDS}->[18]->title_proper() =~ m/^Indicadores de resultados identificados/ , "Simple ascending publication date sorting in getRecords matches old behavior"); ( undef, $results_hashref, $facets_loop ) = getRecords('salud', 'salud', [ 'pubdate_dsc' ], [ 'biblioserver' ], '38', 0, undef, \%branches, \%itemtypes, 'ccl', undef); - ok(MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[0],'UTF-8')->title_proper() =~ m/^Estado de salud/ && - MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[7],'UTF-8')->title_proper() eq 'World health statistics 2009^ien' && - MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[18],'UTF-8')->title_proper() eq 'Manual de higiene industrial^ies' + ok($results_hashref->{biblioserver}->{RECORDS}->[0]->title_proper() =~ m/^Estado de salud/ && + $results_hashref->{biblioserver}->{RECORDS}->[7]->title_proper() eq 'World health statistics 2009^ien' && + $results_hashref->{biblioserver}->{RECORDS}->[18]->title_proper() eq 'Manual de higiene industrial^ies' , "Simple descending publication date sorting in getRecords matches old behavior"); -} elsif ( $indexing_mode eq 'grs1' ){ - ( undef, $results_hashref, $facets_loop ) = - getRecords('salud', 'salud', [], [ 'biblioserver' ], '19', 0, undef, \%branches, \%itemtypes, 'ccl', undef); - ok(MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[0])->title_proper() =~ m/^Efectos del ambiente/ && - MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[7])->title_proper() eq 'Salud y seguridad de los trabajadores del sector salud: manual para gerentes y administradores^ies' && - MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[18])->title_proper() =~ m/^Indicadores de resultados identificados/ - , "Simple relevance sorting in getRecords matches old behavior"); - - ( undef, $results_hashref, $facets_loop ) = - getRecords('salud', 'salud', [ 'author_az' ], [ 'biblioserver' ], '38', 0, undef, \%branches, \%itemtypes, 'ccl', undef); - ok(MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[0])->title_proper() =~ m/la enfermedad laboral\^ies$/ && - MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[6])->title_proper() =~ m/^Indicadores de resultados identificados/ && - MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[18])->title_proper() eq 'World health statistics 2009^ien' - , "Simple ascending author sorting in getRecords matches old behavior"); - - ( undef, $results_hashref, $facets_loop ) = - getRecords('salud', 'salud', [ 'author_za' ], [ 'biblioserver' ], '38', 0, undef, \%branches, \%itemtypes, 'ccl', undef); - ok(MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[0])->title_proper() eq 'World health statistics 2009^ien' && - MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[12])->title_proper() =~ m/^Indicadores de resultados identificados/ && - MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[18])->title_proper() =~ m/la enfermedad laboral\^ies$/ - , "Simple descending author sorting in getRecords matches old behavior"); - - ( undef, $results_hashref, $facets_loop ) = - getRecords('salud', 'salud', [ 'pubdate_asc' ], [ 'biblioserver' ], '38', 0, undef, \%branches, \%itemtypes, 'ccl', undef); - ok(MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[0])->title_proper() eq 'Manual de higiene industrial^ies' && - MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[7])->title_proper() =~ m/seguridad e higiene del trabajo\^ies$/ && - MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[18])->title_proper() =~ m/^Indicadores de resultados identificados/ - , "Simple ascending publication date sorting in getRecords matches old behavior"); - - ( undef, $results_hashref, $facets_loop ) = - getRecords('salud', 'salud', [ 'pubdate_dsc' ], [ 'biblioserver' ], '38', 0, undef, \%branches, \%itemtypes, 'ccl', undef); - ok(MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[0])->title_proper() =~ m/^Estado de salud/ && - MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[7])->title_proper() eq 'World health statistics 2009^ien' && - MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[18])->title_proper() eq 'Manual de higiene industrial^ies' - , "Simple descending publication date sorting in getRecords matches old behavior"); -} ( undef, $results_hashref, $facets_loop ) = getRecords('books', 'books', [ 'relevance' ], [ 'biblioserver' ], '20', 0, undef, \%branches, \%itemtypes, undef, 1); - $record = MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[0]); + $record = $results_hashref->{biblioserver}->{RECORDS}->[0]; is($record->title_proper(), 'Books', "Scan returned requested item"); is($record->subfield('100', 'a'), 2, "Scan returned correct number of records matching term"); # Time to test buildQuery and searchResults too. @@ -578,12 +544,7 @@ if ( $indexing_mode eq 'dom' ) { ($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); is($results_hashref->{biblioserver}->{hits}, 19, "Weighted query returned correct number of results"); - if ($indexing_mode eq 'grs1') { - is(MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[0])->title_proper(), 'Salud y seguridad de los trabajadores del sector salud: manual para gerentes y administradores^ies', "Weighted query returns best match first"); - } else { - local $TODO = "Query weighting does not behave exactly the same in DOM vs. GRS"; - is(MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[0],'UTF-8')->title_proper(), 'Salud y seguridad de los trabajadores del sector salud: manual para gerentes y administradores^ies', "Weighted query returns best match first"); - } + is($results_hashref->{biblioserver}->{RECORDS}->[0]->title_proper(), 'Salud y seguridad de los trabajadores del sector salud: manual para gerentes y administradores^ies', "Weighted query returns best match first"); $QueryStemming = $QueryWeightFields = $QueryFuzzy = $QueryRemoveStopwords = 0; $QueryAutoTruncate = 1; @@ -914,12 +875,12 @@ sub run_unimarc_search_tests { } subtest 'MARC21 + GRS-1' => sub { - plan tests => 104; + plan tests => 105; run_marc21_search_tests('grs1'); }; subtest 'MARC21 + DOM' => sub { - plan tests => 104; + plan tests => 105; run_marc21_search_tests('dom'); }; -- 1.9.1 From tomascohen at gmail.com Tue Jun 3 01:09:25 2014 From: tomascohen at gmail.com (Tomas Cohen Arazi) Date: Mon, 2 Jun 2014 20:09:25 -0300 Subject: [Koha-patches] [PATCH 2/2] Bug 12347: Performance improvements in Search.pm In-Reply-To: <1401750565-12025-1-git-send-email-tomascohen@gmail.com> References: <1401750565-12025-1-git-send-email-tomascohen@gmail.com> Message-ID: <1401750565-12025-2-git-send-email-tomascohen@gmail.com> Short: some costly stuff is done twice, this patch refactors that to make it more reasonable. Long: Bug 11096 introduced a noticeable overhead to the facet building stage of the getRecords code. This patch leverages it by propagating the MARC::Record objects created upon facet building, and reusing them in the C4::Search::searchResults function. To test: - Search for a term on master - Apply the patch - Same results Unit tests reflecting API change in a separate patch. Regards To+ Sponsored-by: Universidad Nacional de Cordoba --- C4/Search.pm | 51 +++++++++++++++++++++------------------------------ 1 file changed, 21 insertions(+), 30 deletions(-) diff --git a/C4/Search.pm b/C4/Search.pm index 748bb1c..beef11d 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -485,18 +485,27 @@ sub getRecords { $tmprecord->append_fields($tmptitle); $tmprecord->append_fields($tmpauthor); } - $results_hash->{'RECORDS'}[$j] = - $tmprecord->as_usmarc(); + $results_hash->{'RECORDS'}[$j] = $tmprecord; } # not an index scan else { - $record = $results[ $i - 1 ]->record($j)->raw(); - # warn "RECORD $j:".$record; + $record = new_record_from_zebra ( + 'biblioserver', + $results[ $i - 1 ]->record($j)->raw() + ); + + if ( ! defined $record ) { + warn "ERROR DECODING RECORD - $@: " . + $results[ $i - 1 ]->record($j)->raw(); + next; + } + $results_hash->{'RECORDS'}[$j] = $record; } } + $results_hashref->{ $servers[ $i - 1 ] } = $results_hash; # Fill the facets while we're looping, but only for the biblioserver and not for a scan @@ -507,16 +516,10 @@ sub getRecords { for my $facet (@$facets) { for ( my $j = 0 ; $j < $jmax ; $j++ ) { - my $marc_record = new_record_from_zebra ( - 'biblioserver', - $results[ $i - 1 ]->record($j)->raw() - ); - - if ( ! defined $marc_record ) { - warn "ERROR DECODING RECORD - $@: " . - $results[ $i - 1 ]->record($j)->raw(); - next; - } + my $marc_record = + $results_hashref->{ $servers[ $i - 1 ] }->{'RECORDS'}[$j]; + # we skip bad records + next if ( !defined $marc_record ); my @used_datas = (); @@ -528,6 +531,7 @@ sub getRecords { # Removed when as_string fixed my @subfields = $subfield_letters =~ /./sg; + # Check $tag_num is a valid field for $marc_record my @fields = $marc_record->field($tag_num); foreach my $field (@fields) { my $data = $field->as_string( $subfield_letters, $facet->{sep} ); @@ -1715,22 +1719,9 @@ sub searchResults { # loop through all of the records we've retrieved for ( my $i = $offset ; $i <= $times - 1 ; $i++ ) { - my $marcrecord; - if ($scan) { - # For Scan searches we built USMARC data - $marcrecord = MARC::Record->new_from_usmarc( $marcresults->[$i]); - } else { - # Normal search, render from Zebra's output - $marcrecord = new_record_from_zebra( - 'biblioserver', - $marcresults->[$i] - ); - - if ( ! defined $marcrecord ) { - warn "ERROR DECODING RECORD - $@: " . $marcresults->[$i]; - next; - } - } + my $marcrecord = $marcresults->[$i]; + # we skip bad records + next if ( !defined $marcrecord ); my $fw = $scan ? undef -- 1.9.1 From dcook at prosentient.com.au Fri Jun 6 06:59:11 2014 From: dcook at prosentient.com.au (David Cook) Date: Fri, 6 Jun 2014 14:59:11 +1000 Subject: [Koha-patches] [PATCH] Bug 12361 - No default value for opaccolorstylesheet syspref Message-ID: <1402030751-31715-1-git-send-email-dcook@prosentient.com.au> From: Fridolin Somers After install, the syspref opaccolorstylesheet will by default contain colors.css. This file exist in OPAC prog theme but not in bootstrap theme. This patch set the syspref empty by default in installer/data/mysql/sysprefs.sql. Test plan : - Create a fresh install - Look at opaccolorstylesheet content => without this patch : is contains colors.css => with this patch : it is empty - Enable opac bootstrap theme - Go to opac main page - Look at HTTP errors (with firebug for example) => without this patch : there is a 404 error because colors.css does not exist => with this patch : no such error Signed-off-by: David Cook --- installer/data/mysql/sysprefs.sql | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index aff00ab..a2cd457 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -223,7 +223,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('OpacBrowser','0',NULL,'If ON, enables subject authorities browser on OPAC (needs to set misc/cronjob/sbuild_browser_and_cloud.pl)','YesNo'), ('OpacBrowseResults','1',NULL,'Disable/enable browsing and paging search results from the OPAC detail page.','YesNo'), ('OpacCloud','0',NULL,'If ON, enables subject cloud on OPAC','YesNo'), -('opaccolorstylesheet','colors.css','','Define an auxiliary stylesheet for OPAC use, to override specified settings from the primary opac.css stylesheet. Enter the filename (if the file is in the server\'s css directory) or a complete URL beginning with http (if the file lives on a remote server).','free'), +('opaccolorstylesheet','','','Define an auxiliary stylesheet for OPAC use, to override specified settings from the primary opac.css stylesheet. Enter the filename (if the file is in the server\'s css directory) or a complete URL beginning with http (if the file lives on a remote server).','free'), ('opaccredits','','70|10','Define HTML Credits at the bottom of the OPAC page','Textarea'), ('OPACdefaultSortField','relevance','relevance|popularity|call_number|pubdate|acqdate|title|author','Specify the default field used for sorting','Choice'), ('OPACdefaultSortOrder','dsc','asc|dsc|za|az','Specify the default sort order','Choice'), -- 1.7.7.4 From oleonard at myacpl.org Mon Jun 9 15:02:52 2014 From: oleonard at myacpl.org (Owen Leonard) Date: Mon, 9 Jun 2014 09:02:52 -0400 Subject: [Koha-patches] [PATCH] Bug 12380 - can't tab to save buttons on add item Message-ID: <1402318972-22138-1-git-send-email-oleonard@myacpl.org> Many form elements on the add item page are giving a tabindex of "1" by the script. This seems to make it impossible to tab through the add item form fields onto the save buttons. I don't see a reason to set an explicit tabindex of "1," so this patch removes it. To test, apply the patch and open an item for editing. Try tabbing through the add item form fields. It should be possible to tab through the fields and onto the submit buttons at the bottom. Test again when adding a new item. --- cataloguing/additem.pl | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl index 268ef66..7110f7f 100755 --- a/cataloguing/additem.pl +++ b/cataloguing/additem.pl @@ -154,8 +154,8 @@ sub generate_subfield_form { my $input = new CGI; $value = $input->param('barcode'); } - my $attributes_no_value = qq(tabindex="1" id="$subfield_data{id}" name="field_value" class="input_marceditor" size="50" maxlength="$subfield_data{maxlength}" ); - my $attributes_no_value_textarea = qq(tabindex="1" id="$subfield_data{id}" name="field_value" class="input_marceditor" rows="5" cols="64" ); + my $attributes_no_value = qq(id="$subfield_data{id}" name="field_value" class="input_marceditor" size="50" maxlength="$subfield_data{maxlength}" ); + my $attributes_no_value_textarea = qq(id="$subfield_data{id}" name="field_value" class="input_marceditor" rows="5" cols="64" ); my $attributes = qq($attributes_no_value value="$value" ); if ( $subfieldlib->{authorised_value} ) { @@ -224,7 +224,6 @@ sub generate_subfield_form { -override => 1, -size => 1, -multiple => 0, - -tabindex => 1, -id => "tag_".$tag."_subfield_".$subfieldtag."_".$index_subfield, -class => "input_marceditor", ); -- 1.7.9.5 From brendon.ford at manhattan.edu Tue Jun 17 01:19:35 2014 From: brendon.ford at manhattan.edu (Brendon Ford) Date: Mon, 16 Jun 2014 19:19:35 -0400 Subject: [Koha-patches] [PATCH] Bug 12407 - phone label or data switched Message-ID: <1402960775-17463-1-git-send-email-brendon.ford@manhattan.edu> Fix for switched phone numbers on patron details page. This patch fixes switched phone numbers on patron details page and also makes phone number labels more uniform. To Test: 1. Apply the patch. 2. Create/modify a patron entering some unique data into the "Secondary phone:" and "Other phone:" fields (different data for each). 3. Save the patron record. 4. Go to the patrons details page and make sure the data entered into the "Secondary phone:" field is displaying next to the "Secondary phone:" label and that the data entered into the "Other phone:" field is displaying next to the "Other phone:" label. --- .../intranet-tmpl/prog/en/modules/members/moremember-brief.tt | 6 +++--- koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-brief.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-brief.tt index c9fb845..b46424e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-brief.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-brief.tt @@ -33,13 +33,13 @@ [% IF ( emailpro ) %]
  • Organization email: [% emailpro %]
  • [% END %] [% ELSE %] [% IF ( phone ) %]
  • Primary phone: [% phone %]
  • [% END %] - [% IF ( mobile ) %]
  • Secondary phone: [% mobile %]
  • [% END %] - [% IF ( phonepro ) %]
  • Other phone: [% phonepro %]
  • [% END %] + [% IF ( phonepro ) %]
  • Secondary phone: [% phonepro %]
  • [% END %] + [% IF ( mobile ) %]
  • Other phone: [% mobile %]
  • [% END %] [% END %] [% IF ( P ) %] [% IF ( phone ) %]
  • Primary phone: [% phone %]
  • [% END %] - [% IF ( mobile ) %]
  • Secondary mobile: [% mobile %]
  • [% END %] + [% IF ( mobile ) %]
  • Other phone: [% mobile %]
  • [% END %] [% END %] [% IF ( fax ) %]
  • Fax: [% fax %]
  • [% END %] [% UNLESS ( I ) %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt index 345c728..d42ae59 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt @@ -225,13 +225,13 @@ function validate1(date) { [% IF ( emailpro ) %]
  • Organization email: [% emailpro %]
  • [% END %] [% ELSE %] [% IF ( phone ) %]
  • Primary phone: [% phone %]
  • [% END %] - [% IF ( mobile ) %]
  • Secondary phone: [% mobile %]
  • [% END %] - [% IF ( phonepro ) %]
  • Other phone: [% phonepro %]
  • [% END %] + [% IF ( phonepro ) %]
  • Secondary phone: [% phonepro %]
  • [% END %] + [% IF ( mobile ) %]
  • Other phone: [% mobile %]
  • [% END %] [% END %] [% IF ( P ) %] [% IF ( phone ) %]
  • Primary phone: [% phone %]
  • [% END %] - [% IF ( mobile ) %]
  • Secondary phone: [% mobile %]
  • [% END %] + [% IF ( mobile ) %]
  • Other phone: [% mobile %]
  • [% END %] [% END %] [% IF ( fax ) %]
  • Fax: [% fax %]
  • [% END %] [% UNLESS ( I ) %] -- 1.7.10.4 From nengard at bywatersolutions.com Tue Jun 17 16:44:20 2014 From: nengard at bywatersolutions.com (Nicole C. Engard) Date: Tue, 17 Jun 2014 09:44:20 -0500 Subject: [Koha-patches] [PATCH] Bug 12434: Fix Typo in Smart Rules Help Message-ID: <1403016260-29193-1-git-send-email-nengard@bywatersolutions.com> This patch fixes a typos in the help file on the circ and fine rules. To test: Visit admin > circ and fine rules Click help in the top right Confirm that period is not spelled peiod --- .../prog/en/modules/help/admin/smart-rules.tt | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/help/admin/smart-rules.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/help/admin/smart-rules.tt index c0f4a91..8efcdc6 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/help/admin/smart-rules.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/help/admin/smart-rules.tt @@ -56,7 +56,7 @@
  • Next decide if the patron can renew this item type and if so, enter how many times they can renew it in the 'Renewals Allowed' box
  • -
  • If you're allowing renewals you can control how long the renewal loan peiod will be (in the units you have chosen) in the 'Renewal period' box
  • +
  • If you're allowing renewals you can control how long the renewal loan period will be (in the units you have chosen) in the 'Renewal period' box
  • If you're allowing renewals you can control how soon before the due date patrons can renew their materials with the 'No renewals before' box.
    • Items can be renewed at any time if this value is left blank. Otherwise items can only be renewed if the item is before the number in units (days/hours) entered in this box.
  • If the patron can place holds on this item type, enter the total numbers of items (of this type) that can be put on hold in the 'Holds Allowed' field
  • -- 1.7.2.3 From dcook at prosentient.com.au Thu Jun 19 05:33:02 2014 From: dcook at prosentient.com.au (David Cook) Date: Thu, 19 Jun 2014 13:33:02 +1000 Subject: [Koha-patches] [PATCH] Bug 7817 - Items Permanent location (shelving location) is set to NULL when item is edited Message-ID: <1403148782-14120-1-git-send-email-dcook@prosentient.com.au> From: Olli-Antti Kivilahti A quick fix to prevent more damages. No perceived side-effects so far. Signed-off-by: David Cook This is actually a perfectly good fix for this issue. I've changed the explanatory comment to explain why. Another option would be to remove the 'exists' check in the sub _do_column_fixes_for_mod(), but this is just as functional. --- C4/Items.pm | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/C4/Items.pm b/C4/Items.pm index c183644..9db89e3 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -459,7 +459,7 @@ my %default_values_for_mod_from_marc = ( itemnotes => undef, itype => undef, location => undef, - permanent_location => undef, +# permanent_location => undef, # "undef" counts as "exists" which disrupts proper handling of location and permanent_location in _do_column_fixes_for_mod() materials => undef, notforloan => 0, paidfor => undef, -- 1.7.7.4 From dcook at prosentient.com.au Thu Jun 19 06:31:04 2014 From: dcook at prosentient.com.au (David Cook) Date: Thu, 19 Jun 2014 14:31:04 +1000 Subject: [Koha-patches] [PATCH] Bug 12323 [SIGNED OFF] - Acquisitions search results fixed in order of biblionumber Message-ID: <1403152264-937-1-git-send-email-dcook@prosentient.com.au> From: Kyle M Hall The acquisitions search is exhibiting the same behavior as bug 11410. Results are always fixed in order of biblionumber, among other possible issues ( including the ampersand issue ). Test Plan: 1) From an open basket, choose "Add to basket" 2) Run a search for "From an existing record" 3) Note the "View MARC" URLs are fixed in order of biblionumber 4) Apply this patch 5) Refresh the page 6) Note the results are no longer fixed in order of biblionumber Signed-off-by: David Cook Works as described. I think the code could be a bit tidier, but I think it makes sense to use buildQuery here. It'll detect CCL, CQL, and PQF queries, as well as parsing a regular keyword search as one would expect when searching the catalogue. It also has the added bonus of performing relevance searching, so long as QueryAutoTruncation is off, and so long as library staff avoid using the "*" truncation wildcard (see bug 12430). While there are simpler ways to fix this acq bug, I think this was probably the best move, as it adds a bit to the consistency of what librarians can expect from their search results. --- acqui/neworderbiblio.pl | 13 +++++++++++-- 1 files changed, 11 insertions(+), 2 deletions(-) diff --git a/acqui/neworderbiblio.pl b/acqui/neworderbiblio.pl index 0e07066..5cff672 100755 --- a/acqui/neworderbiblio.pl +++ b/acqui/neworderbiblio.pl @@ -94,8 +94,17 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( # Searching the catalog. - # find results -my ( $error, $marcresults, $total_hits ) = SimpleSearch( $query, $results_per_page * ( $page - 1 ), $results_per_page ); +my @operands = $query; +my $QParser; +$QParser = C4::Context->queryparser if (C4::Context->preference('UseQueryParser')); +my $builtquery; +if ($QParser) { + $builtquery = $query; +} else { + my ( $builterror,$simple_query,$query_cgi,$query_desc,$limit,$limit_cgi,$limit_desc,$stopwords_removed,$query_type); + ( $builterror,$builtquery,$simple_query,$query_cgi,$query_desc,$limit,$limit_cgi,$limit_desc,$stopwords_removed,$query_type) = buildQuery(undef,\@operands); +} +my ( $error, $marcresults, $total_hits ) = SimpleSearch( $builtquery, $results_per_page * ( $page - 1 ), $results_per_page ); if (defined $error) { $template->param( -- 1.7.7.4 From dcook at prosentient.com.au Wed Jun 25 08:58:12 2014 From: dcook at prosentient.com.au (David Cook) Date: Wed, 25 Jun 2014 16:58:12 +1000 Subject: [Koha-patches] [PATCH] Bug 12479 - Update mailmap for master Message-ID: <1403679492-8420-1-git-send-email-dcook@prosentient.com.au> Just wanted to add a mailmap entry so that GitStats merges together the commits I made as "David " versus "David Cook ". Also increases accuracy if myself or others does a git shortlog... _TEST PLAN_ Before applying: 1) Run 'git shortlog --author="dcook at prosentient.com.au"' 2) Note two entries: one for "David" and one for "David Cook". 3) Apply patch 4) Repeat step 1 5) Note only one entry for "David Cook" --- .mailmap | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/.mailmap b/.mailmap index 068b4f6..d1af659 100644 --- a/.mailmap +++ b/.mailmap @@ -35,6 +35,7 @@ Owen Leonard Paul Poulain Robin Sheat Srdjan Jankovic +David Cook # Name to name mapping: the name in the right column will be mapped to the name in the left -- 1.7.7.4 From oleonard at myacpl.org Wed Jun 25 19:14:50 2014 From: oleonard at myacpl.org (Owen Leonard) Date: Wed, 25 Jun 2014 13:14:50 -0400 Subject: [Koha-patches] [PATCH] Bug 12220 - bootstrap not responsive on all devices Message-ID: <1403716491-14543-1-git-send-email-oleonard@myacpl.org> The bootstrap theme includes a meta tag attribute which disables zooming on some devices. This was unintentional and not desirable. This patch removes the problematic attribute. See: http://blog.javierusobiaga.com/stop-using-the-viewport-tag-until-you-know-ho To test: Apply the patch and view the OPAC on a device with a touch interface. Attempt to zoom in on any OPAC page. Zooming should work. --- .../bootstrap/en/includes/doc-head-close.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/doc-head-close.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/doc-head-close.inc index ab7b4bb..c3e2d83 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/doc-head-close.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/doc-head-close.inc @@ -1,7 +1,7 @@ - + [% IF ( bidi ) %] -- 1.7.9.5 From reed at typist.geek.nz Thu Jun 26 08:43:05 2014 From: reed at typist.geek.nz (Reed Wade) Date: Thu, 26 Jun 2014 02:43:05 -0400 Subject: [Koha-patches] Bug 8566: Enable koha-foreach to insert the instancename into commands Message-ID: (I haven't submitted a patch in forever. Let me know if I've missed a step.) koha-foreach has been modified to replace __instancename__ with $name on each iteration using sed. The docbook file for koha-foreach has also been updated to reflect the new functionality. To test: koha-foreach ls -ld /etc/koha/sites/__instancename__ should list directories instead of giving an error message. -reed -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-Bug-8566-Enable-koha-foreach-to-insert-the-instancen.patch Type: text/x-patch Size: 1827 bytes Desc: not available URL: From reed at typist.geek.nz Thu Jun 26 15:25:15 2014 From: reed at typist.geek.nz (Reed Wade) Date: Thu, 26 Jun 2014 09:25:15 -0400 Subject: [Koha-patches] [PATCH] Bug 8566: Enable koha-foreach to insert the instancename into commands Message-ID: <1403789115-17562-1-git-send-email-reed@typist.geek.nz> koha-foreach has been modified to replace __instancename__ with $name on each iteration using sed. The docbook file for koha-foreach has also been updated to reflect the new functionality. To test: koha-foreach ls -ld /etc/koha/sites/__instancename__ should list directories instead of giving an error message. --- debian/docs/koha-foreach.xml | 1 + debian/scripts/koha-foreach | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/debian/docs/koha-foreach.xml b/debian/docs/koha-foreach.xml index c8a612c..4e84463 100644 --- a/debian/docs/koha-foreach.xml +++ b/debian/docs/koha-foreach.xml @@ -29,6 +29,7 @@ Description Run a command for each Koha instance. Takes the same arguments as koha-list. + The string "__instancename__" is replaced in the argument list with the name of the Koha instance in each iteration. See also diff --git a/debian/scripts/koha-foreach b/debian/scripts/koha-foreach index 6bda414..6e4d98d 100755 --- a/debian/scripts/koha-foreach +++ b/debian/scripts/koha-foreach @@ -32,12 +32,13 @@ done for name in $(koha-list $listopts) do + cmd=`echo "$@" | sed -e s/__instancename__/${name}/g` ( exec 3>&1 sudo -u "$name-koha" \ env PERL5LIB=/usr/share/koha/lib \ KOHA_CONF="/etc/koha/sites/$name/koha-conf.xml" \ - "$@" 2>&1 >&3 | sed -e "s/^/$name: /" >&2 3>&- + ${cmd} 2>&1 >&3 | sed -e "s/^/$name: /" >&2 3>&- exec 3>&- ) | sed -e "s/^/$name: /" -- 1.9.1 From reed at typist.geek.nz Thu Jun 26 22:55:15 2014 From: reed at typist.geek.nz (Reed Wade) Date: Thu, 26 Jun 2014 16:55:15 -0400 Subject: [Koha-patches] [PATCH] Bug 8567: Set output directory for fines.pl in cron config created by the packages Message-ID: <1403816115-7421-1-git-send-email-reed@typist.geek.nz> Modified debian/koha-common.cron.daily adding instance output dir option to the fines.pl entry as described in the ticket. Requires patch from Bug 8566 which provides the __instancename__ feature for koha-foreach. --- debian/koha-common.cron.daily | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/koha-common.cron.daily b/debian/koha-common.cron.daily index 2f899b0..1f540cd 100644 --- a/debian/koha-common.cron.daily +++ b/debian/koha-common.cron.daily @@ -16,7 +16,7 @@ # along with this program. If not, see . koha-foreach --enabled --email /usr/share/koha/bin/cronjobs/overdue_notices.pl -t -koha-foreach --enabled /usr/share/koha/bin/cronjobs/fines.pl +koha-foreach --enabled /usr/share/koha/bin/cronjobs/fines.pl --out /var/log/koha/__instancename__ koha-foreach --enabled --email /usr/share/koha/bin/cronjobs/advance_notices.pl -c koha-foreach --enabled /usr/share/koha/bin/cronjobs/holds/cancel_expired_holds.pl >/dev/null 2>&1 koha-foreach --enabled /usr/share/koha/bin/cronjobs/services_throttle.pl > /dev/null 2>&1 -- 1.9.1 From reed at typist.geek.nz Fri Jun 27 08:34:02 2014 From: reed at typist.geek.nz (Reed Wade) Date: Fri, 27 Jun 2014 02:34:02 -0400 Subject: [Koha-patches] [PATCH] Bug 10532: koha-run-backups option --output doesn't work Message-ID: <1403850842-5161-1-git-send-email-reed@typist.geek.nz> koha-dump has been modified to accept an optional --output option which is where it will create backup files. koha-run-dumps has been modified to always use that option when calling koha-dump --- debian/docs/koha-dump.xml | 4 +++- debian/scripts/koha-dump | 38 +++++++++++++++++++++++++++++++++++--- debian/scripts/koha-run-backups | 2 +- 3 files changed, 39 insertions(+), 5 deletions(-) diff --git a/debian/docs/koha-dump.xml b/debian/docs/koha-dump.xml index a749fb2..70f0982 100644 --- a/debian/docs/koha-dump.xml +++ b/debian/docs/koha-dump.xml @@ -23,7 +23,9 @@ - koha-dump instancename + koha-dump + directory + instancename diff --git a/debian/scripts/koha-dump b/debian/scripts/koha-dump index bf4bd5f..d463462 100755 --- a/debian/scripts/koha-dump +++ b/debian/scripts/koha-dump @@ -27,24 +27,56 @@ else exit 1 fi +show_help() { + cat </koha-conf.xml) +EOH + +} + # Make sure the files we create are not accessible by anyone else. umask 0077 # Parse command line. -[ "$#" = 1 ] || die "Usage: $0 instancename" + +backupdir="" + +CMD_LINE=`getopt -o h --long output:,help -n 'koha-dump' -- "$@"` + +if [ $? != 0 ] ; then show_help ; exit 1 ; fi + +eval set -- "$CMD_LINE" +while true ; do + case "$1" in + -h|--help) + show_help; exit;; + --output) + backupdir=$2; shift 2 ;; + --) shift ; break ;; + *) echo "Unknown error parsing the command line!" ; exit 1 ;; + esac +done + +[ "$#" = 1 ] || die "Usage: $0 [ --output directory ] instancename" + name="$1" + + kohaconfig="/etc/koha/sites/$name/koha-conf.xml" date="$(date +%Y-%m-%d)" echo "Dumping Koha site $name:" - # Dump database. mysqlhost="$( xmlstarlet sel -t -v 'yazgfs/config/hostname' $kohaconfig )" mysqldb="$( xmlstarlet sel -t -v 'yazgfs/config/database' $kohaconfig )" mysqluser="$( xmlstarlet sel -t -v 'yazgfs/config/user' $kohaconfig )" mysqlpass="$( xmlstarlet sel -t -v 'yazgfs/config/pass' $kohaconfig )" -backupdir="$( xmlstarlet sel -t -v 'yazgfs/config/backupdir' $kohaconfig || true )" +[ -z "$backupdir" ] && backupdir="$( xmlstarlet sel -t -v 'yazgfs/config/backupdir' $kohaconfig || true )" [ -z "$backupdir" ] && backupdir="/var/spool/koha/$name" dbdump="$backupdir/$name-$date.sql.gz" echo "* DB to $dbdump" diff --git a/debian/scripts/koha-run-backups b/debian/scripts/koha-run-backups index 74f879b..164e485 100755 --- a/debian/scripts/koha-run-backups +++ b/debian/scripts/koha-run-backups @@ -57,12 +57,12 @@ done for name in $(koha-list --enabled | grep -Fxv demo) do - koha-dump "$name" > /dev/null if [ -z "$dirname" ]; then backupdir="$( xmlstarlet sel -t -v 'yazgfs/config/backupdir' /etc/koha/sites/$name/koha-conf.xml )"; else backupdir="$dirname/$name"; fi + koha-dump --output "$backupdir" "$name" > /dev/null # Remove old dump files. # FIXME: This could probably be replaced by one line of perl. -- 1.9.1