From b7c12c671024ecd15eaacd46ce3f24f6198deaa4 Mon Sep 17 00:00:00 2001 From: Chris Cormack Date: Wed, 23 Mar 2011 22:11:54 +1300 Subject: [PATCH 01/16] Bumping database number --- installer/data/mysql/updatedatabase.pl | 15 +++++++-------- kohaversion.pl | 2 +- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 21b40888a2..839564451c 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -4105,14 +4105,6 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { SetVersion ($DBversion); } -$DBversion = "3.03.00.XXX"; -if (C4::Context->preference("Version") < TransformToNum($DBversion)) { - $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacFavicon','','Enter a complete URL to an image to replace the default Koha favicon on the OPAC','','free')"); - $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('IntranetFavicon','','Enter a complete URL to an image to replace the default Koha favicon on the Staff client','','free')"); - print "Upgrade to $DBversion done (Add sysprefs to control custom favicons)\n"; - SetVersion ($DBversion); -} - $DBversion = "3.03.00.029"; if (C4::Context->preference("Version") < TransformToNum($DBversion)) { $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('AllowPurchaseSuggestionBranchChoice', 0, 'Allow user to choose branch when making a purchase suggestion','1','YesNo')"); @@ -4120,6 +4112,13 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { SetVersion ($DBversion); } +$DBversion = "3.03.00.030"; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacFavicon','','Enter a complete URL to an image to replace the default Koha favicon on the OPAC','','free')"); + $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('IntranetFavicon','','Enter a complete URL to an image to replace the default Koha favicon on the Staff client','','free')"); + print "Upgrade to $DBversion done (Add sysprefs to control custom favicons)\n"; + SetVersion ($DBversion); +} =head1 FUNCTIONS diff --git a/kohaversion.pl b/kohaversion.pl index cb73e9a86b..8ac68dfd2a 100644 --- a/kohaversion.pl +++ b/kohaversion.pl @@ -16,7 +16,7 @@ the kohaversion is divided in 4 parts : use strict; sub kohaversion { - our $VERSION = '3.03.00.029'; + our $VERSION = '3.03.00.030'; # version needs to be set this way # so that it can be picked up by Makefile.PL # during install From cce98a2914c85ce1e1c5563b64a986c880024079 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9rick=20Capovilla?= Date: Wed, 23 Mar 2011 15:19:57 +0100 Subject: [PATCH 02/16] Bug 5883 : Prevent re-encoding the items if they are already in UTF-8 in ModBiblio. Signed-off-by: Julian Maurice Signed-off-by: Chris Cormack --- C4/Biblio.pm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index 8143ee1095..1b378df766 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -320,10 +320,15 @@ sub ModBiblio { foreach my $fielditem (@fields) { my $field; foreach ( $fielditem->subfields() ) { + # re-encode the subfield only if it isn't already in utf-8. + my ($tag, $value) = @$_; + $tag = Encode::encode('utf-8', $tag) unless utf8::is_utf8($tag); + $value = Encode::encode('utf-8', $value) unless utf8::is_utf8($value); + if ($field) { - $field->add_subfields( Encode::encode( 'utf-8', $_->[0] ) => Encode::encode( 'utf-8', $_->[1] ) ); + $field->add_subfields( $tag => $value ); } else { - $field = MARC::Field->new( "$itemtag", '', '', Encode::encode( 'utf-8', $_->[0] ) => Encode::encode( 'utf-8', $_->[1] ) ); + $field = MARC::Field->new( "$itemtag", '', '', $tag => $value ); } } $record->append_fields($field); From b585b63ec7f0b243f7fa2bf0aa2f17b269ce2665 Mon Sep 17 00:00:00 2001 From: Jared Camins-Esakov Date: Sun, 22 May 2011 17:36:43 -0400 Subject: [PATCH 03/16] Bug 5921: Add enumchron to the items detail page This patch adds the Serial enumeration/chronology field to the items display in moredetail.pl. Signed-off-by: Nicole C. Engard Signed-off-by: Chris Cormack --- .../intranet-tmpl/prog/en/modules/catalogue/moredetail.tmpl | 1 + 1 file changed, 1 insertion(+) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tmpl index e67a864237..c8c0c06b94 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tmpl @@ -172,6 +172,7 @@
  • Previous Borrower: "> 
  • Previous Borrower: "> 
  • Paid for?:  
  • +
  • Serial enumeration/chronology:  
  • Public Note:
    " /> From 52ade1d437a1e6e7e0b3c6c022bfe75cb9f3b714 Mon Sep 17 00:00:00 2001 From: Jared Camins-Esakov Date: Mon, 23 May 2011 03:34:07 -0400 Subject: [PATCH 04/16] Bug 5939: "Save and edit items" button broken When modifying an existing biblio, the "Save and edit items" option in the "Save" menu did not redirect to the edit items screen. Instead, it redirected to the regular details screen. Signed-off-by: Nicole C. Engard Signed-off-by: Chris Cormack --- cataloguing/addbiblio.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl index da5816613b..cd5691e3c7 100755 --- a/cataloguing/addbiblio.pl +++ b/cataloguing/addbiblio.pl @@ -933,7 +933,7 @@ if ( $op eq "addbiblio" ) { else { ( $biblionumber, $oldbibitemnum ) = AddBiblio( $record, $frameworkcode ); } - if ($mode ne "popup" && !$is_a_modif && $redirect eq "items"){ + if ($redirect eq "items" || ($mode ne "popup" && !$is_a_modif && $redirect ne "view")){ print $input->redirect( "/cgi-bin/koha/cataloguing/additem.pl?biblionumber=$biblionumber&frameworkcode=$frameworkcode" ); From 009036b53722881f607ed01b5701bd300abd6735 Mon Sep 17 00:00:00 2001 From: Jared Camins-Esakov Date: Sun, 22 May 2011 17:31:47 -0400 Subject: [PATCH 05/16] Bug 3098 follow-up: Clean up formatting This patch cleans up the formatting of the 856 display code in MARC21slim2OPACDetail.xsl. Tabstops are correct, and the OPACURLOpenInNewWindow syspref check is moved to control the use of a 'target="_blank"' attribute, rather than having two blocks of almost-identical code. Signed-off-by: Nicole C. Engard Signed-off-by: Chris Cormack --- .../prog/en/xslt/MARC21slim2OPACDetail.xsl | 77 +++++++------------ 1 file changed, 29 insertions(+), 48 deletions(-) diff --git a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl b/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl index 24a6440d89..63fd0bf69d 100755 --- a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl +++ b/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl @@ -504,59 +504,40 @@ Online Resources: - - - - - - y3z - - - - - - - - - Click here to access online - - - - - - - - - - - - y3z - - - - - - - - - Click here to access online - - - - - - - - - | - - + + + _blank + + + + + y3z + + + + + + + + + Click here to access online + + + + + + + + | + + + - + Incomplete contents: From 1deadb34c324df9b307c0cb35284e6949dd8dcaa Mon Sep 17 00:00:00 2001 From: Jared Camins-Esakov Date: Sun, 22 May 2011 17:32:07 -0400 Subject: [PATCH 06/16] Bug 5919: Display MARC21 fields 583, 586, 530 This patch adds the MARC21 fields 583 (Action note), 586 (Awards note), and 530 (Additional physical form available note) to the OPAC details display in the XSLT-controlled portion of the page. In order to allow libraries to hide these notes if they do not want them added, the notes have been given CSS classes. Depends on patch for Bug 3098. Signed-off-by: Nicole C. Engard Signed-off-by: Chris Cormack --- .../prog/en/xslt/MARC21slim2OPACDetail.xsl | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl b/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl index 63fd0bf69d..38cc6a8d78 100755 --- a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl +++ b/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl @@ -534,6 +534,25 @@ + + + + + + abcd + + + + + _blank + + + + + + + + @@ -565,6 +584,38 @@ + + + + + + + + + + + + abcdefgijklnou + + + + + + + + + + + + + + Awards: + + + + + + From 0e1ea3ef817ac58a4894f3e3328b15b8d6bcb649 Mon Sep 17 00:00:00 2001 From: Colin Campbell Date: Tue, 22 Mar 2011 15:24:06 +0000 Subject: [PATCH 07/16] Bug 5880: Correct misleading pod in new subroutine Also remove some whitespace noise from prev commit Signed-off-by: Chris Cormack --- C4/Koha.pm | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/C4/Koha.pm b/C4/Koha.pm index 2f94aa07e5..974afcc697 100644 --- a/C4/Koha.pm +++ b/C4/Koha.pm @@ -57,8 +57,8 @@ BEGIN { &GetKohaAuthorisedValues &GetKohaAuthorisedValuesFromField &GetKohaAuthorisedValueLib - &GetAuthorisedValueByCode - &GetKohaImageurlFromAuthorisedValues + &GetAuthorisedValueByCode + &GetKohaImageurlFromAuthorisedValues &GetAuthValCode &GetNormalizedUPC &GetNormalizedISBN @@ -957,9 +957,9 @@ sub GetKohaImageurlFromAuthorisedValues { my $dbh = C4::Context->dbh; my $sth = $dbh->prepare("SELECT imageurl FROM authorised_values WHERE category=? AND lib =?"); $sth->execute( $category, $lib ); - while ( my $data = $sth->fetchrow_hashref ) { - return $data->{'imageurl'}; - } + while ( my $data = $sth->fetchrow_hashref ) { + return $data->{'imageurl'}; + } } =head2 GetAuthValCode @@ -1060,19 +1060,20 @@ sub GetAuthorisedValueCategories { $authhorised_value = GetAuthorisedValueByCode( $category, $authvalcode ); -Return an hashref of the authorised value represented by $authvalcode. +Return the lib attribute from authorised_values from the row identified +by the passed category and code =cut sub GetAuthorisedValueByCode { - my ( $category, $authvalcode ) = @_; - + my ( $category, $authvalcode ) = @_; + my $dbh = C4::Context->dbh; my $sth = $dbh->prepare("SELECT lib FROM authorised_values WHERE category=? AND authorised_value =?"); $sth->execute( $category, $authvalcode ); - while ( my $data = $sth->fetchrow_hashref ) { - return $data->{'lib'}; - } + while ( my $data = $sth->fetchrow_hashref ) { + return $data->{'lib'}; + } } =head2 GetKohaAuthorisedValues From f7190f48aad671485bcf8a535bf7e48f493d8c22 Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Thu, 24 Mar 2011 09:58:12 +0100 Subject: [PATCH 08/16] Bug 5944 : (MT #3000) new cronjob script to delete old suggestions This patch is a new script that delete suggestion that have be processed by librarians. It take on argument, it's a number of days to keep suggestions. Suggestions olders than TODAY - $days will be deleted. This script should be used to purge suggestions and clean the table in intranet. Signed-off-by: Julian Maurice Signed-off-by: Chris Cormack --- C4/Suggestions.pm | 20 +++++++++- misc/cronjobs/purge_suggestions.pl | 60 ++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+), 1 deletion(-) create mode 100755 misc/cronjobs/purge_suggestions.pl diff --git a/C4/Suggestions.pm b/C4/Suggestions.pm index 81ff731696..9cb2c189cd 100644 --- a/C4/Suggestions.pm +++ b/C4/Suggestions.pm @@ -1,6 +1,7 @@ package C4::Suggestions; # Copyright 2000-2002 Katipo Communications +# Parts Copyright Biblibre 2011 # # This file is part of Koha. # @@ -43,9 +44,9 @@ our @EXPORT = qw< ModSuggestion NewSuggestion SearchSuggestion + DelSuggestionsOlderThan >; - =head1 NAME C4::Suggestions - Some useful functions for dealings with aqorders. @@ -429,6 +430,23 @@ sub DelSuggestion { } } +=head2 DelSuggestionsOlderThan + &DelSuggestionsOlderThan($days) + + Delete all suggestions older than TODAY-$days , that have be accepted or rejected. + +=cut +sub DelSuggestionsOlderThan { + my ($days) = @_; + return if not $days; + my $dbh = C4::Context->dbh; + + my $sth = $dbh->prepare(" + DELETE FROM suggestions WHERE STATUS <> 'ASKED' AND date < ADDDATE(NOW(), ?); + "); + $sth->execute("-$days"); +} + 1; __END__ diff --git a/misc/cronjobs/purge_suggestions.pl b/misc/cronjobs/purge_suggestions.pl new file mode 100755 index 0000000000..d38a7bf3c0 --- /dev/null +++ b/misc/cronjobs/purge_suggestions.pl @@ -0,0 +1,60 @@ +#!/usr/bin/perl -w + +# Copyright 2010 Biblibre SARL +# +# 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 2 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, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +use strict; +use warnings; +use utf8; + +BEGIN { + + # find Koha's Perl modules + # test carefully before changing this + use FindBin; + eval { require "$FindBin::Bin/../kohalib.pl" }; +} + +use Getopt::Long; +use Pod::Usage; +use C4::Suggestions; + +my ($help, $days); + +GetOptions( + 'help|?' => \$help, + 'days=s' => \$days, +); + +if($help or not $days){ + print < Date: Thu, 24 Mar 2011 10:44:29 +0100 Subject: [PATCH 09/16] Bug 5932 Remove itemdata sub from C4::Serials C4/Serials does not need to retrieve full item data just to check if barcode is unique. Replace with a lighter weight subroutine make code logic clearer and cleaner Signed-off-by: Julian Maurice Signed-off-by: Chris Cormack --- C4/Serials.pm | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/C4/Serials.pm b/C4/Serials.pm index da0f4bda7c..32c9bcbce5 100644 --- a/C4/Serials.pm +++ b/C4/Serials.pm @@ -1481,9 +1481,9 @@ sub ItemizeSerials { my $fwk = GetFrameworkCode( $data->{'biblionumber'} ); if ( $info->{barcode} ) { my @errors; - my $exists = itemdata( $info->{'barcode'} ); - push @errors, "barcode_not_unique" if ($exists); - unless ($exists) { + if ( is_barcode_in_use( $info->{barcode} ) ) { + push @errors, 'barcode_not_unique'; + } else { my $marcrecord = MARC::Record->new(); my ( $tag, $subfield ) = GetMarcFromKohaField( "items.barcode", $fwk ); my $newField = MARC::Field->new( "$tag", '', '', "$subfield" => $info->{barcode} ); @@ -2338,29 +2338,24 @@ sub GetNextDate(@) { return "$resultdate"; } -=head2 itemdata +=head2 is_barcode_in_use - $item = itemdata($barcode); - -Looks up the item with the given barcode, and returns a -reference-to-hash containing information about that item. The keys of -the hash are the fields from the C and C tables in -the Koha database. +Returns number of occurence of the barcode in the items table +Can be used as a boolean test of whether the barcode has +been deployed as yet =cut -#' -sub itemdata { - my ($barcode) = @_; +sub is_barcode_in_use { + my $barcode = shift; my $dbh = C4::Context->dbh; - my $sth = $dbh->prepare( - "Select * from items LEFT JOIN biblioitems ON items.biblioitemnumber=biblioitems.biblioitemnumber - WHERE barcode=?" + my $occurences = $dbh->selectall_arrayref( + 'SELECT itemnumber from items where barcode = ?', + {}, $barcode + ); - $sth->execute($barcode); - my $data = $sth->fetchrow_hashref; - $sth->finish; - return ($data); + + return @{$occurences}; } 1; From eeb0d7c0d3f81a016429961d52c6126a7bab563b Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Tue, 22 Mar 2011 15:34:53 +0100 Subject: [PATCH 10/16] Bug 5926 : Fixing Hierarchies : taking any heading subfield Conflicts solved: C4/AuthoritiesMarc.pm Signed-off-by: Julian Maurice Signed-off-by: Chris Cormack --- C4/AuthoritiesMarc.pm | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm index 3c3f6bcbad..1eeb96454e 100644 --- a/C4/AuthoritiesMarc.pm +++ b/C4/AuthoritiesMarc.pm @@ -1182,16 +1182,17 @@ sub BuildUnimarcHierarchy{ my $class = shift @_; my $authid_constructed = shift @_; return undef unless ($record); - my $authid=$record->subfield('2..','3'); + my $authid=$record->field('001')->data(); my %cell; my $parents=""; my $children=""; my (@loopparents,@loopchildren); - foreach my $field ($record->field('550')){ + foreach my $field ($record->field('5..')){ + my $subfauthid=_get_authid_subfield($field); if ($field->subfield('5') && $field->subfield('a')){ if ($field->subfield('5') eq 'h'){ - push @loopchildren, { "childauthid"=>$field->subfield('3'),"childvalue"=>$field->subfield('a')}; + push @loopchildren, { "childauthid"=>$subfauthid,"childvalue"=>$field->subfield('a')}; }elsif ($field->subfield('5') eq 'g'){ - push @loopparents, { "parentauthid"=>$field->subfield('3'),"parentvalue"=>$field->subfield('a')}; + push @loopparents, { "parentauthid"=>$subfauthid,"parentvalue"=>$field->subfield('a')}; } # brothers could get in there with an else } @@ -1207,6 +1208,10 @@ sub BuildUnimarcHierarchy{ return \%cell; } +sub _get_authid_subfield{ + my ($field)=@_; + return $field->subfield('9')||$field->subfield('3'); +} =head2 GetHeaderAuthority $ref= &GetHeaderAuthority( $authid) From a898b69dccc667f62b00f975392ccc9c4bcd6f8d Mon Sep 17 00:00:00 2001 From: Paul Poulain Date: Tue, 22 Mar 2011 15:58:01 +0100 Subject: [PATCH 11/16] Bug 5930 : improving/modifying authority display on OPAC - changing some terms that are unclear for a patron - removing tag & subfields values & indicators - removing UNIMARC coded fields - changing the search page (removing options useless for a patron) Signed-off-by: Julian Maurice Signed-off-by: Chris Cormack --- .../opac-tmpl/prog/en/includes/masthead.inc | 2 +- .../en/modules/opac-authorities-home.tmpl | 35 +++---------------- .../en/modules/opac-authoritiesdetail.tmpl | 16 ++++----- opac/opac-authoritiesdetail.pl | 5 +++ 4 files changed, 18 insertions(+), 40 deletions(-) diff --git a/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc index 310e7b8387..3a3d4b94d2 100644 --- a/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc +++ b/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc @@ -110,7 +110,7 @@
    Advanced Search | Browse by Hierarchy - | Browse by Subject + | Browse by author or subject | Tag Cloud | Subject Cloud | Most Popular diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-authorities-home.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-authorities-home.tmpl index 91a1412287..8c11df20ee 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-authorities-home.tmpl +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-authorities-home.tmpl @@ -1,4 +1,4 @@ -Koha Online Catalog › Authority Search +Koha Online Catalog › Browse by author or subject @@ -13,7 +13,7 @@
    -Authority search + Browse by author or subject
    1. - - - " /> - - - -
    2. -
    3. - - - " /> - - - -
    4. -
    5. - " /> - +