From: Paul Poulain Date: Fri, 7 Sep 2012 16:42:21 +0000 (+0200) Subject: Merge remote-tracking branch 'origin/new/bug_8408' X-Git-Tag: v3.10.01~501 X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=commitdiff_plain;h=c8ef17ea3965f04ed3b0bebb85d4c70dd1cfc131;hp=8e590abebbd4d95bd5bb829aa6c2dd76f5548a9f;p=srvgit Merge remote-tracking branch 'origin/new/bug_8408' --- diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm index 9678ffc7cd..fc1e817869 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -565,7 +565,12 @@ sub GetBasketsInfosByBookseller { SELECT aqbasket.*, SUM(aqorders.quantity) AS total_items, COUNT(DISTINCT aqorders.biblionumber) AS total_biblios, - SUM(IF(aqorders.datereceived IS NULL, aqorders.quantity, 0)) AS expected_items + SUM( + IF(aqorders.datereceived IS NULL + AND aqorders.datecancellationprinted IS NULL + , aqorders.quantity + , 0) + ) AS expected_items FROM aqbasket LEFT JOIN aqorders ON aqorders.basketno = aqbasket.basketno WHERE booksellerid = ? @@ -794,29 +799,23 @@ sub GetBasketgroups { =head3 GetPendingOrders - $orders = &GetPendingOrders($booksellerid, $grouped, $owner); +$orders = &GetPendingOrders($supplierid,$grouped,$owner,$basketno,$ordernumber,$search,$ean); Finds pending orders from the bookseller with the given ID. Ignores completed and cancelled orders. C<$booksellerid> contains the bookseller identifier -C<$grouped> contains 0 or 1. 0 means returns the list, 1 means return the total C<$owner> contains 0 or 1. 0 means any owner. 1 means only the list of orders entered by the user itself. - -C<$orders> is a reference-to-array; each element is a -reference-to-hash with the following fields: C<$grouped> is a boolean that, if set to 1 will group all order lines of the same basket in a single result line +C<$orders> is a reference-to-array; each element is a reference-to-hash. -=over - -=item C - -=item C +Used also by the filter in parcel.pl +I have added: -=item C - -=back +C<$ordernumber> +C<$search> +C<$ean> These give the value of the corresponding field in the aqorders table of the Koha database. @@ -826,41 +825,55 @@ Results are ordered from most to least recent. =cut sub GetPendingOrders { - my ($supplierid,$grouped,$owner,$basketno) = @_; + my ($supplierid,$grouped,$owner,$basketno,$ordernumber,$search,$ean) = @_; my $dbh = C4::Context->dbh; my $strsth = " - SELECT ".($grouped?"count(*),":"")."aqbasket.basketno, - surname,firstname,biblio.*,biblioitems.isbn, - aqbasket.closedate, aqbasket.creationdate, aqbasket.basketname, - aqorders.* - FROM aqorders + SELECT ".($grouped?"count(*),":"")."aqbasket.basketno, + surname,firstname,biblio.*,biblioitems.isbn, + aqbasket.closedate, aqbasket.creationdate, aqbasket.basketname, + aqorders.* + FROM aqorders LEFT JOIN aqbasket ON aqbasket.basketno=aqorders.basketno LEFT JOIN borrowers ON aqbasket.authorisedby=borrowers.borrowernumber LEFT JOIN biblio ON biblio.biblionumber=aqorders.biblionumber LEFT JOIN biblioitems ON biblioitems.biblionumber=biblio.biblionumber - WHERE booksellerid=? - AND (quantity > quantityreceived OR quantityreceived is NULL) - AND datecancellationprinted IS NULL"; - my @query_params = ( $supplierid ); + WHERE (quantity > quantityreceived OR quantityreceived is NULL) + AND datecancellationprinted IS NULL"; + my @query_params; my $userenv = C4::Context->userenv; if ( C4::Context->preference("IndependantBranches") ) { if ( ($userenv) && ( $userenv->{flags} != 1 ) ) { - $strsth .= " and (borrowers.branchcode = ? + $strsth .= " AND (borrowers.branchcode = ? or borrowers.branchcode = '')"; push @query_params, $userenv->{branch}; } } - if ($owner) { - $strsth .= " AND aqbasket.authorisedby=? "; - push @query_params, $userenv->{'number'}; + if ($supplierid) { + $strsth .= " AND aqbasket.booksellerid = ?"; + push @query_params, $supplierid; + } + if($ordernumber){ + $strsth .= " AND (aqorders.ordernumber=?)"; + push @query_params, $ordernumber; + } + if($search){ + $strsth .= " AND (biblio.title like ? OR biblio.author LIKE ? OR biblioitems.isbn like ?)"; + push @query_params, ("%$search%","%$search%","%$search%"); + } + if ($ean) { + $strsth .= " AND biblioitems.ean = ?"; + push @query_params, $ean; } if ($basketno) { $strsth .= " AND aqbasket.basketno=? "; push @query_params, $basketno; } + if ($owner) { + $strsth .= " AND aqbasket.authorisedby=? "; + push @query_params, $userenv->{'number'}; + } $strsth .= " group by aqbasket.basketno" if $grouped; $strsth .= " order by aqbasket.basketno"; - my $sth = $dbh->prepare($strsth); $sth->execute( @query_params ); my $results = $sth->fetchall_arrayref({}); @@ -1756,6 +1769,7 @@ sub GetHistory { my $to_placed_on = $params{to_placed_on}; my $basket = $params{basket}; my $booksellerinvoicenumber = $params{booksellerinvoicenumber}; + my $basketgroupname = $params{basketgroupname}; my @order_loop; my $total_qty = 0; my $total_qtyreceived = 0; @@ -1845,6 +1859,11 @@ sub GetHistory { push @query_params, "%$booksellerinvoicenumber%", "%$booksellerinvoicenumber%"; } + if ($basketgroupname) { + $query .= " AND aqbasketgroups.name LIKE ? "; + push @query_params, "%$basketgroupname%"; + } + if ( C4::Context->preference("IndependantBranches") ) { my $userenv = C4::Context->userenv; if ( $userenv && ($userenv->{flags} || 0) != 1 ) { diff --git a/C4/Auth.pm b/C4/Auth.pm index b6dc2f5ad2..59c99551d7 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -334,10 +334,7 @@ sub get_template_and_user { if ( $in->{'type'} eq "intranet" ) { $template->param( - AmazonContent => C4::Context->preference("AmazonContent"), AmazonCoverImages => C4::Context->preference("AmazonCoverImages"), - AmazonEnabled => C4::Context->preference("AmazonEnabled"), - AmazonSimilarItems => C4::Context->preference("AmazonSimilarItems"), AutoLocation => C4::Context->preference("AutoLocation"), "BiblioDefaultView".C4::Context->preference("IntranetBiblioDefaultView") => 1, CalendarFirstDayOfWeek => (C4::Context->preference("CalendarFirstDayOfWeek") eq "Sunday")?0:1, @@ -388,17 +385,8 @@ sub get_template_and_user { } elsif (C4::Context->preference("SearchMyLibraryFirst") && C4::Context->userenv && C4::Context->userenv->{'branch'}) { $opac_name = C4::Context->userenv->{'branch'}; } - my $checkstyle = C4::Context->preference("opaccolorstylesheet"); - if ($checkstyle =~ /http/) - { - $template->param( opacexternalsheet => $checkstyle); - } else - { - my $opaccolorstylesheet = C4::Context->preference("opaccolorstylesheet"); - $template->param( opaccolorstylesheet => $opaccolorstylesheet); - } $template->param( - AmazonContent => "" . C4::Context->preference("AmazonContent"), + opaccolorstylesheet => C4::Context->preference("opaccolorstylesheet"), AnonSuggestions => "" . C4::Context->preference("AnonSuggestions"), AuthorisedValueImages => C4::Context->preference("AuthorisedValueImages"), BranchesLoop => GetBranchesLoop($opac_name), @@ -406,10 +394,7 @@ sub get_template_and_user { LibraryName => "" . C4::Context->preference("LibraryName"), LibraryNameTitle => "" . $LibraryNameTitle, LoginBranchname => C4::Context->userenv?C4::Context->userenv->{"branchname"}:"", - OPACAmazonEnabled => C4::Context->preference("OPACAmazonEnabled"), - OPACAmazonSimilarItems => C4::Context->preference("OPACAmazonSimilarItems"), OPACAmazonCoverImages => C4::Context->preference("OPACAmazonCoverImages"), - OPACAmazonReviews => C4::Context->preference("OPACAmazonReviews"), OPACFRBRizeEditions => C4::Context->preference("OPACFRBRizeEditions"), OpacHighlightedWords => C4::Context->preference("OpacHighlightedWords"), OPACItemHolds => C4::Context->preference("OPACItemHolds"), @@ -441,7 +426,6 @@ sub get_template_and_user { hidelostitems => C4::Context->preference("hidelostitems"), mylibraryfirst => (C4::Context->preference("SearchMyLibraryFirst") && C4::Context->userenv) ? C4::Context->userenv->{'branch'} : '', opaclayoutstylesheet => "" . C4::Context->preference("opaclayoutstylesheet"), - opacstylesheet => "" . C4::Context->preference("opacstylesheet"), opacbookbag => "" . C4::Context->preference("opacbookbag"), opaccredits => "" . C4::Context->preference("opaccredits"), OpacFavicon => C4::Context->preference("OpacFavicon"), @@ -946,19 +930,12 @@ sub checkauth { } my $template_name = ( $type eq 'opac' ) ? 'opac-auth.tmpl' : 'auth.tmpl'; - my $template = C4::Templates::gettemplate( $template_name, $type, $query ); - $template->param(branchloop => \@branch_loop,); - my $checkstyle = C4::Context->preference("opaccolorstylesheet"); - if ($checkstyle =~ /\//) - { - $template->param( opacexternalsheet => $checkstyle); - } else - { - my $opaccolorstylesheet = C4::Context->preference("opaccolorstylesheet"); - $template->param( opaccolorstylesheet => $opaccolorstylesheet); - } + my $template = C4::Templates::gettemplate($template_name, $type, $query ); $template->param( - login => 1, + branchloop => \@branch_loop, + opaccolorstylesheet => C4::Context->preference("opaccolorstylesheet"), + opaclayoutstylesheet => C4::Context->preference("opaclayoutstylesheet"), + login => 1, INPUTS => \@inputs, casAuthentication => C4::Context->preference("casAuthentication"), suggestion => C4::Context->preference("suggestion"), @@ -972,7 +949,6 @@ sub checkauth { OpacFavicon => C4::Context->preference("OpacFavicon"), opacreadinghistory => C4::Context->preference("opacreadinghistory"), opacsmallimage => C4::Context->preference("opacsmallimage"), - opaclayoutstylesheet => C4::Context->preference("opaclayoutstylesheet"), opaclanguagesdisplay => C4::Context->preference("opaclanguagesdisplay"), opacuserjs => C4::Context->preference("opacuserjs"), opacbookbag => "" . C4::Context->preference("opacbookbag"), @@ -983,7 +959,6 @@ sub checkauth { opacheader => C4::Context->preference("opacheader"), TagsEnabled => C4::Context->preference("TagsEnabled"), OPACUserCSS => C4::Context->preference("OPACUserCSS"), - opacstylesheet => C4::Context->preference("opacstylesheet"), intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), intranetstylesheet => C4::Context->preference("intranetstylesheet"), diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm index 9ba916dcf9..6593ee2e96 100644 --- a/C4/AuthoritiesMarc.pm +++ b/C4/AuthoritiesMarc.pm @@ -199,7 +199,7 @@ sub SearchAuthorities { } } else { my $query; - my $attr; + my $attr = ''; # the marclist may contain "mainentry". In this case, search the tag_to_report, that depends on # the authtypecode. Then, search on $a of this tag_to_report # also store main entry MARC tag, to extract it at end of search @@ -230,9 +230,6 @@ sub SearchAuthorities { elsif ( @$tags[$i] eq "mainentry" ) { $attr = " \@attr 1=Heading "; } - elsif ( @$tags[$i] eq "any" ) { - $attr = " \@attr 1=Any "; - } elsif ( @$tags[$i] eq "match" ) { $attr = " \@attr 1=Match "; } @@ -245,6 +242,9 @@ sub SearchAuthorities { elsif ( @$tags[$i] eq "thesaurus" ) { $attr = " \@attr 1=Subject-heading-thesaurus "; } + else { # Assume any if no index was specified + $attr = " \@attr 1=Any "; + } if ( @$operator[$i] eq 'is' ) { $attr .= " \@attr 4=1 \@attr 5=100 " ; ##Phrase, No truncation,all of subfield field must match @@ -354,7 +354,7 @@ sub SearchAuthorities { my $thisauthtype = GetAuthType(GetAuthTypeCode($authid)); $newline{authtype} = defined ($thisauthtype) ? $thisauthtype->{'authtypetext'} : - GetAuthType($authtypecode)->{'authtypetext'}; + (GetAuthType($authtypecode) ? $_->{'authtypetext'} : ''); $newline{summary} = $summary; $newline{even} = $counter % 2; $newline{reported_tag} = $reported_tag; @@ -1356,7 +1356,7 @@ sub merge { my $marcdata = $rec->raw(); my $marcrecordzebra= MARC::Record->new_from_xml($marcdata,"utf8",C4::Context->preference("marcflavour")); my ( $biblionumbertagfield, $biblionumbertagsubfield ) = &GetMarcFromKohaField( "biblio.biblionumber", '' ); - my $i = $marcrecordzebra->subfield($biblionumbertagfield, $biblionumbertagsubfield); + my $i = ($biblionumbertagfield < 10) ? $marcrecordzebra->field($biblionumbertagfield)->data : $marcrecordzebra->subfield($biblionumbertagfield, $biblionumbertagsubfield); my $marcrecorddb=GetMarcBiblio($i); push @reccache, $marcrecorddb; $z++; diff --git a/C4/Barcodes.pm b/C4/Barcodes.pm index 4a5fa1972c..2e81da60fe 100644 --- a/C4/Barcodes.pm +++ b/C4/Barcodes.pm @@ -28,6 +28,7 @@ use C4::Dates; use C4::Barcodes::hbyymmincr; use C4::Barcodes::annual; use C4::Barcodes::incremental; +use C4::Barcodes::EAN13; use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); use vars qw($debug $cgi_debug); # from C4::Debug, of course @@ -138,7 +139,7 @@ sub next_value { $debug and warn "$incr"; $head = $self->process_head($head,$max,$specific); - $tail = $self->process_tail($tail,$max,$specific); + $tail = $self->process_tail($tail,$incr,$specific); # XXX use $incr and not $max! my $next_value = $head . $incr . $tail; $debug and print STDERR "( next ) max barcode found: $next_value\n"; return $next_value; @@ -177,6 +178,7 @@ our $types = { incremental => sub {C4::Barcodes::incremental->new_object(@_);}, hbyymmincr => sub {C4::Barcodes::hbyymmincr->new_object(@_); }, OFF => sub {C4::Barcodes::OFF->new_object(@_); }, + EAN13 => sub {C4::Barcodes::EAN13->new_object(@_); }, }; sub new { diff --git a/C4/Barcodes/EAN13.pm b/C4/Barcodes/EAN13.pm new file mode 100644 index 0000000000..da27c414f6 --- /dev/null +++ b/C4/Barcodes/EAN13.pm @@ -0,0 +1,57 @@ +package C4::Barcodes::EAN13; + +# Copyright 2012 Koha Development team +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 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 C4::Context; +use C4::Debug; + +use Algorithm::CheckDigits; + +use vars qw($VERSION @ISA); +use vars qw($debug $cgi_debug); # from C4::Debug, of course + +BEGIN { + $VERSION = 0.01; + @ISA = qw(C4::Barcodes); +} + +sub parse { + my $self = shift; + my $barcode = (@_) ? shift : $self->value; + my $ean = CheckDigits('ean'); + if ( $ean->is_valid($barcode) ) { + return ( '', $ean->basenumber($barcode), $ean->checkdigit($barcode) ); + } else { + die "$barcode not valid EAN-13 barcode"; + } +} + +sub process_tail { + my ( $self,$tail,$whole,$specific ) = @_; + my $ean = CheckDigits('ean'); + my $full = $ean->complete($whole); + my $chk = $ean->checkdigit($full); + $debug && warn "# process_tail $tail -> $chk [$whole -> $full] $specific"; + return $chk; +} + +1; +__END__ diff --git a/C4/Barcodes/ValueBuilder.pm b/C4/Barcodes/ValueBuilder.pm new file mode 100644 index 0000000000..13c57924f9 --- /dev/null +++ b/C4/Barcodes/ValueBuilder.pm @@ -0,0 +1,109 @@ +#!/usr/bin/perl +# +# Copyright 2008-2010 Foundations Bible College +# Parts copyright 2012 C & P Bibliography Services +# +# 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. + +package C4::Barcodes::ValueBuilder::incremental; +use C4::Context; +my $DEBUG = 0; + +sub get_barcode { + my ($args) = @_; + my $nextnum; + # not the best, two catalogers could add the same barcode easily this way :/ + my $query = "select max(abs(barcode)) from items"; + my $sth = C4::Context->dbh->prepare($query); + $sth->execute(); + while (my ($count)= $sth->fetchrow_array) { + $nextnum = $count; + } + $nextnum++; + return $nextnum; +} + +1; + +package C4::Barcodes::ValueBuilder::hbyymmincr; +use C4::Context; +my $DEBUG = 0; + +sub get_barcode { + my ($args) = @_; + my $nextnum; + my $year = substr($args->{year}, -2); + my $query = "SELECT MAX(CAST(SUBSTRING(barcode,-4) AS signed)) AS number FROM items WHERE barcode REGEXP ?"; + my $sth = C4::Context->dbh->prepare($query); + $sth->execute("^[-a-zA-Z]{1,}$year"); + while (my ($count)= $sth->fetchrow_array) { + $nextnum = $count if $count; + $nextnum = 0 if $nextnum == 9999; # this sequence only allows for cataloging 10000 books per month + warn "Existing incremental number = $nextnum" if $DEBUG; + } + $nextnum++; + $nextnum = sprintf("%0*d", "4",$nextnum); + $nextnum = $year . $args->{mon} . $nextnum; + warn "New hbyymmincr Barcode = $nextnum" if $DEBUG; + my $scr = " + for (i=0 ; i{loctag}' && document.f.subfield[i].value == '$args->{locsubfield}') { + fnum = i; + } + } + if (\$('#' + id).val() == '') { + \$('#' + id).val(document.f.field_value[fnum].value + '$nextnum'); + } + "; + return $nextnum, $scr; +} + + +package C4::Barcodes::ValueBuilder::annual; +use C4::Context; +my $DEBUG = 0; + +sub get_barcode { + my ($args) = @_; + my $nextnum; + my $query = "select max(cast( substring_index(barcode, '-',-1) as signed)) from items where barcode like ?"; + my $sth=C4::Context->dbh->prepare($query); + $sth->execute("$args->{year}%"); + while (my ($count)= $sth->fetchrow_array) { + warn "Examining Record: $count" if $DEBUG; + $nextnum = $count if $count; + } + $nextnum++; + $nextnum = sprintf("%0*d", "4",$nextnum); + $nextnum = "$args->{year}-$nextnum"; + return $nextnum; +} + +1; + + +=head1 Barcodes::ValueBuilder + +This module is intended as a shim to ease the eventual transition from +having all barcode-related code in the value builder plugin .pl file +to using C4::Barcodes. Since the shift will require a rather significant +amount of refactoring, this module will return value builder-formatted +results, at first by merely running the code that was formerly in the +barcodes.pl value builder, but later by using C4::Barcodes. + +=cut + +1; diff --git a/C4/Biblio.pm b/C4/Biblio.pm index f8ba09924d..19a23affdf 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -105,6 +105,7 @@ BEGIN { &ModBiblioframework &ModZebra &UpdateTotalIssues + &RemoveAllNsb ); # To delete something @@ -138,16 +139,6 @@ BEGIN { ); } -eval { - if (C4::Context->ismemcached) { - require Memoize::Memcached; - import Memoize::Memcached qw(memoize_memcached); - - memoize_memcached( 'GetMarcStructure', - memcached => C4::Context->memcached); - } -}; - =head1 NAME C4::Biblio - cataloging management functions @@ -1056,16 +1047,18 @@ sub GetMarcStructure { my ( $forlibrarian, $frameworkcode ) = @_; my $dbh = C4::Context->dbh; $frameworkcode = "" unless $frameworkcode; + my $cache; if ( defined $marc_structure_cache and exists $marc_structure_cache->{$forlibrarian}->{$frameworkcode} ) { return $marc_structure_cache->{$forlibrarian}->{$frameworkcode}; } - - # my $sth = $dbh->prepare( - # "SELECT COUNT(*) FROM marc_tag_structure WHERE frameworkcode=?"); - # $sth->execute($frameworkcode); - # my ($total) = $sth->fetchrow; - # $frameworkcode = "" unless ( $total > 0 ); + if (Koha::Cache->is_cache_active()) { + $cache = Koha::Cache->new(); + if ($cache) { + my $cached = $cache->get_from_cache("GetMarcStructure:$frameworkcode:$forlibrarian"); + return $cached if $cached; + } + } my $sth = $dbh->prepare( "SELECT tagfield,liblibrarian,libopac,mandatory,repeatable FROM marc_tag_structure @@ -1129,6 +1122,9 @@ sub GetMarcStructure { $marc_structure_cache->{$forlibrarian}->{$frameworkcode} = $res; + if (Koha::Cache->is_cache_active() && defined $cache) { + $cache->set_in_cache("GetMarcStructure:$frameworkcode:$forlibrarian",$res,10000); + } return $res; } @@ -3103,7 +3099,7 @@ sub _koha_marc_update_bib_ids { my ( $biblio_tag, $biblio_subfield ) = GetMarcFromKohaField( "biblio.biblionumber", $frameworkcode ); die qq{No biblionumber tag for framework "$frameworkcode"} unless $biblio_tag; my ( $biblioitem_tag, $biblioitem_subfield ) = GetMarcFromKohaField( "biblioitems.biblioitemnumber", $frameworkcode ); - die qq{No biblioitemnumber tag for framework "$frameworkcode"} unless $biblio_tag; + die qq{No biblioitemnumber tag for framework "$frameworkcode"} unless $biblioitem_tag; if ( $biblio_tag == $biblioitem_tag ) { @@ -3318,7 +3314,8 @@ sub _koha_modify_biblioitem_nonmarc { cn_suffix = ?, cn_sort = ?, totalissues = ?, - ean = ? + ean = ?, + agerestriction = ? where biblioitemnumber = ? "; my $sth = $dbh->prepare($query); @@ -3330,8 +3327,7 @@ sub _koha_modify_biblioitem_nonmarc { $biblioitem->{'pages'}, $biblioitem->{'bnotes'}, $biblioitem->{'size'}, $biblioitem->{'place'}, $biblioitem->{'lccn'}, $biblioitem->{'url'}, $biblioitem->{'biblioitems.cn_source'}, $biblioitem->{'cn_class'}, $biblioitem->{'cn_item'}, $biblioitem->{'cn_suffix'}, $cn_sort, $biblioitem->{'totalissues'}, - $biblioitem->{'ean'}, - $biblioitem->{'biblioitemnumber'} + $biblioitem->{'ean'}, $biblioitem->{'agerestriction'}, $biblioitem->{'biblioitemnumber'} ); if ( $dbh->errstr ) { $error .= "ERROR in _koha_modify_biblioitem_nonmarc $query" . $dbh->errstr; @@ -3383,7 +3379,8 @@ sub _koha_add_biblioitem { cn_suffix = ?, cn_sort = ?, totalissues = ?, - ean = ? + ean = ?, + agerestriction = ? "; my $sth = $dbh->prepare($query); $sth->execute( @@ -3394,7 +3391,7 @@ sub _koha_add_biblioitem { $biblioitem->{'pages'}, $biblioitem->{'bnotes'}, $biblioitem->{'size'}, $biblioitem->{'place'}, $biblioitem->{'lccn'}, $biblioitem->{'marc'}, $biblioitem->{'url'}, $biblioitem->{'biblioitems.cn_source'}, $biblioitem->{'cn_class'}, $biblioitem->{'cn_item'}, $biblioitem->{'cn_suffix'}, $cn_sort, - $biblioitem->{'totalissues'}, $biblioitem->{'ean'} + $biblioitem->{'totalissues'}, $biblioitem->{'ean'}, $biblioitem->{'agerestriction'} ); my $bibitemnum = $dbh->{'mysql_insertid'}; @@ -3876,6 +3873,50 @@ sub UpdateTotalIssues { return; } +=head2 RemoveAllNsb + + &RemoveAllNsb($record); + +Removes all nsb/nse chars from a record + +=cut + +sub RemoveAllNsb { + my $record = shift; + + SetUTF8Flag($record); + + foreach my $field ($record->fields()) { + if ($field->is_control_field()) { + $field->update(nsb_clean($field->data())); + } else { + my @subfields = $field->subfields(); + my @new_subfields; + foreach my $subfield (@subfields) { + push @new_subfields, $subfield->[0] => nsb_clean($subfield->[1]); + } + if (scalar(@new_subfields) > 0) { + my $new_field; + eval { + $new_field = MARC::Field->new( + $field->tag(), + $field->indicator(1), + $field->indicator(2), + @new_subfields + ); + }; + if ($@) { + warn "error in RemoveAllNsb : $@"; + } else { + $field->replace_with($new_field); + } + } + } + } + + return $record; +} + 1; diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 1a13e7ae58..8bd53b9f54 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -38,11 +38,21 @@ use C4::Branch; # GetBranches use C4::Log; # logaction use C4::Koha qw(GetAuthorisedValueByCode); use C4::Overdues qw(CalcFine UpdateFine); +use Algorithm::CheckDigits; + use Data::Dumper; use Koha::DateUtils; use Koha::Calendar; use Carp; - +use Date::Calc qw( + Today + Today_and_Now + Add_Delta_YM + Add_Delta_DHMS + Date_to_Days + Day_of_Week + Add_Delta_Days +); use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); BEGIN { @@ -169,6 +179,14 @@ sub barcodedecode { $barcode =~ s/^(\D+)[0]*(\d+)$/$branch-$1-$2/i; } } + } elsif ($filter eq 'EAN13') { + my $ean = CheckDigits('ean'); + if ( $ean->is_valid($barcode) ) { + #$barcode = sprintf('%013d',$barcode); # this doesn't work on 32-bit systems + $barcode = '0' x ( 13 - length($barcode) ) . $barcode; + } else { + warn "# [$barcode] not valid EAN-13/UPC-A\n"; + } } return $barcode; # return barcode, modified or not } @@ -931,6 +949,62 @@ sub CanBookBeIssued { } } } + # + # CHECK AGE RESTRICTION + # + + # get $marker from preferences. Could be something like "FSK|PEGI|Alter|Age:" + my $markers = C4::Context->preference('AgeRestrictionMarker' ); + my $bibvalues = $biblioitem->{'agerestriction'}; + if (($markers)&&($bibvalues)) + { + # Split $bibvalues to something like FSK 16 or PEGI 6 + my @values = split ' ', $bibvalues; + + # Search first occurence of one of the markers + my @markers = split /\|/, $markers; + my $index = 0; + my $take = -1; + for my $value (@values) { + $index ++; + for my $marker (@markers) { + $marker =~ s/^\s+//; #remove leading spaces + $marker =~ s/\s+$//; #remove trailing spaces + if (uc($marker) eq uc($value)) { + $take = $index; + last; + } + } + if ($take > -1) { + last; + } + } + # Index points to the next value + my $restrictionyear = 0; + if (($take <= $#values) && ($take >= 0)){ + $restrictionyear += @values[$take]; + } + + if ($restrictionyear > 0) { + if ( $borrower->{'dateofbirth'} ) { + my @alloweddate = split /-/,$borrower->{'dateofbirth'} ; + @alloweddate[0] += $restrictionyear; + #Prevent runime eror on leap year (invalid date) + if ((@alloweddate[1] == 2) && (@alloweddate[2] == 29)) { + @alloweddate[2] = 28; + } + + if ( Date_to_Days(Today) < Date_to_Days(@alloweddate) -1 ) { + if (C4::Context->preference('AgeRestrictionOverride' )) { + $needsconfirmation{AGE_RESTRICTION} = "$bibvalues"; + } + else { + $issuingimpossible{AGE_RESTRICTION} = "$bibvalues"; + } + } + } + } + } return ( \%issuingimpossible, \%needsconfirmation, \%alerts ); } @@ -1202,53 +1276,16 @@ Get the Hard Due Date and it's comparison for an itemtype, a borrower type and a sub GetHardDueDate { my ( $borrowertype, $itemtype, $branchcode ) = @_; - my $dbh = C4::Context->dbh; - my $sth = - $dbh->prepare( -"select hardduedate, hardduedatecompare from issuingrules where categorycode=? and itemtype=? and branchcode=?" - ); - $sth->execute( $borrowertype, $itemtype, $branchcode ); - my $results = $sth->fetchrow_hashref; - return (dt_from_string($results->{hardduedate}, 'iso'),$results->{hardduedatecompare}) - if defined($results) && $results->{hardduedate}; - - $sth->execute( $borrowertype, "*", $branchcode ); - $results = $sth->fetchrow_hashref; - return (dt_from_string($results->{hardduedate}, 'iso'),$results->{hardduedatecompare}) - if defined($results) && $results->{hardduedate}; - - $sth->execute( "*", $itemtype, $branchcode ); - $results = $sth->fetchrow_hashref; - return (dt_from_string($results->{hardduedate}, 'iso'),$results->{hardduedatecompare}) - if defined($results) && $results->{hardduedate}; - - $sth->execute( "*", "*", $branchcode ); - $results = $sth->fetchrow_hashref; - return (dt_from_string($results->{hardduedate}, 'iso'),$results->{hardduedatecompare}) - if defined($results) && $results->{hardduedate}; - $sth->execute( $borrowertype, $itemtype, "*" ); - $results = $sth->fetchrow_hashref; - return (dt_from_string($results->{hardduedate}, 'iso'),$results->{hardduedatecompare}) - if defined($results) && $results->{hardduedate}; - - $sth->execute( $borrowertype, "*", "*" ); - $results = $sth->fetchrow_hashref; - return (dt_from_string($results->{hardduedate}, 'iso'),$results->{hardduedatecompare}) - if defined($results) && $results->{hardduedate}; - - $sth->execute( "*", $itemtype, "*" ); - $results = $sth->fetchrow_hashref; - return (dt_from_string($results->{hardduedate}, 'iso'),$results->{hardduedatecompare}) - if defined($results) && $results->{hardduedate}; + my $rule = GetIssuingRule( $borrowertype, $itemtype, $branchcode ); - $sth->execute( "*", "*", "*" ); - $results = $sth->fetchrow_hashref; - return (dt_from_string($results->{hardduedate}, 'iso'),$results->{hardduedatecompare}) - if defined($results) && $results->{hardduedate}; - - # if no rule is set => return undefined - return (undef, undef); + if ( defined( $rule ) ) { + if ( $rule->{hardduedate} ) { + return (dt_from_string($rule->{hardduedate}, 'iso'),$rule->{hardduedatecompare}); + } else { + return (undef, undef); + } + } } =head2 GetIssuingRule @@ -3091,10 +3128,12 @@ sub ReturnLostItem{ MarkIssueReturned( $borrowernumber, $itemnum ); my $borrower = C4::Members::GetMember( 'borrowernumber'=>$borrowernumber ); + my $item = C4::Items::GetItem( $itemnum ); + my $old_note = ($item->{'paidfor'} && ($item->{'paidfor'} ne q{})) ? $item->{'paidfor'}.' / ' : q{}; my @datearr = localtime(time); my $date = ( 1900 + $datearr[5] ) . "-" . ( $datearr[4] + 1 ) . "-" . $datearr[3]; my $bor = "$borrower->{'firstname'} $borrower->{'surname'} $borrower->{'cardnumber'}"; - ModItem({ paidfor => "Paid for by $bor $date" }, undef, $itemnum); + ModItem({ paidfor => $old_note."Paid for by $bor $date" }, undef, $itemnum); } diff --git a/C4/Context.pm b/C4/Context.pm index 9ce6c74914..0a56aa888e 100644 --- a/C4/Context.pm +++ b/C4/Context.pm @@ -18,7 +18,9 @@ package C4::Context; use strict; use warnings; -use vars qw($VERSION $AUTOLOAD $context @context_stack $servers $memcached $ismemcached); +use vars qw($VERSION $AUTOLOAD $context @context_stack); + +use Koha::Cache; BEGIN { if ($ENV{'HTTP_USER_AGENT'}) { @@ -79,22 +81,6 @@ BEGIN { } } # else there is no browser to send fatals to! - # Check if there are memcached servers set - $servers = $ENV{'MEMCACHED_SERVERS'}; - if ($servers) { - # Load required libraries and create the memcached object - require Cache::Memcached; - $memcached = Cache::Memcached->new({ - servers => [ $servers ], - debug => 0, - compress_threshold => 10_000, - expire_time => 600, - namespace => $ENV{'MEMCACHED_NAMESPACE'} || 'koha' - }); - # Verify memcached available (set a variable and test the output) - $ismemcached = $memcached->set('ismemcached','1'); - } - $VERSION = '3.07.00.049'; } @@ -248,38 +234,14 @@ Returns undef in case of error. sub read_config_file { # Pass argument naming config file to read my $koha = XMLin(shift, keyattr => ['id'], forcearray => ['listen', 'server', 'serverinfo'], suppressempty => ''); - if ($ismemcached) { - $memcached->set('kohaconf',$koha); + if (Koha::Cache->is_cache_active()) { + my $cache = Koha::Cache->new(); + $cache->set_in_cache('kohaconf', $koha) if defined $cache; } return $koha; # Return value: ref-to-hash holding the configuration } -=head2 ismemcached - -Returns the value of the $ismemcached variable (0/1) - -=cut - -sub ismemcached { - return $ismemcached; -} - -=head2 memcached - -If $ismemcached is true, returns the $memcache variable. -Returns undef otherwise - -=cut - -sub memcached { - if ($ismemcached) { - return $memcached; - } else { - return undef; - } -} - # db_scheme2dbi # Translates the full text name of a database into de appropiate dbi name # @@ -323,9 +285,8 @@ Allocates a new context. Initializes the context from the specified file, which defaults to either the file given by the C<$KOHA_CONF> environment variable, or F. -It saves the koha-conf.xml values in the declared memcached server(s) -if currently available and uses those values until them expire and -re-reads them. +It saves the koha-conf.xml values in the cache (if configured) and uses +those values until them expire and re-reads them. C<&new> does not set this context as the new default context; for that, use C<&set_context>. @@ -362,15 +323,14 @@ sub new { } } - if ($ismemcached) { - # retreive from memcached - $self = $memcached->get('kohaconf'); - if (not defined $self) { - # not in memcached yet - $self = read_config_file($conf_fname); - } - } else { - # non-memcached env, read from file + if (Koha::Cache->is_cache_active()) { + # retrieve from cache + my $cache = Koha::Cache->new(); + $self = $cache->get_from_cache('kohaconf') if defined $cache; + $self = { }; + } + if (!keys %$self) { + # not cached yet $self = read_config_file($conf_fname); } @@ -527,11 +487,20 @@ my %sysprefs; sub preference { my $self = shift; my $var = lc(shift); # The system preference to return + my $cache; if (exists $sysprefs{$var}) { return $sysprefs{$var}; } + if (Koha::Cache->is_cache_active()) { + $cache = Koha::Cache->new(); + if (defined $cache) { + $sysprefs{$var} = $cache->get_from_cache("syspref:$var"); + return $sysprefs{$var} if (defined $sysprefs{$var}); + } + } + my $dbh = C4::Context->dbh or return 0; # Look up systempreferences.variable==$var @@ -542,6 +511,9 @@ sub preference { LIMIT 1 END_SQL $sysprefs{$var} = $dbh->selectrow_array( $sql, {}, $var ); + if (Koha::Cache->is_cache_active() && defined $cache) { + $cache->set_in_cache("syspref:$var"); + } return $sysprefs{$var}; } @@ -564,6 +536,10 @@ will not be seen by this process. sub clear_syspref_cache { %sysprefs = (); + if (Koha::Cache->is_cache_active()) { + my $cache = Koha::Cache->new(); + $cache->flush_all() if defined $cache; # Sorry, this is unpleasant + } } =head2 set_preference @@ -594,6 +570,10 @@ sub set_preference { " ); if($sth->execute( $var, $value )) { + if (Koha::Cache->is_cache_active()) { + my $cache = Koha::Cache->new(); + $cache->set_in_cache("syspref:$var", $value) if defined $cache; + } $sysprefs{$var} = $value; } $sth->finish; diff --git a/C4/Creators/Lib.pm b/C4/Creators/Lib.pm index 67ee0e8fff..0a57b598f1 100644 --- a/C4/Creators/Lib.pm +++ b/C4/Creators/Lib.pm @@ -90,7 +90,7 @@ my $barcode_types = [ {type => 'CODE39MOD', name => 'Code 39 + Modulo43', desc => 'Translates the characters 0-9, A-Z, \'-\', \'*\', \'+\', \'$\', \'%\', \'/\', \'.\' and \' \' to a barcode pattern. Encodes Mod 43 checksum.', selected => 0}, {type => 'CODE39MOD10', name => 'Code 39 + Modulo10', desc => 'Translates the characters 0-9, A-Z, \'-\', \'*\', \'+\', \'$\', \'%\', \'/\', \'.\' and \' \' to a barcode pattern. Encodes Mod 10 checksum.', selected => 0}, {type => 'COOP2OF5', name => 'COOP2of5', desc => 'Creates COOP2of5 barcodes from a string consisting of the numeric characters 0-9', selected => 0}, -# {type => 'EAN13', name => 'EAN13', desc => 'Creates EAN13 barcodes from a string of 12 or 13 digits. The check number (the 13:th digit) is calculated if not supplied.', selected => 0}, + {type => 'EAN13', name => 'EAN13', desc => 'Creates EAN13 barcodes from a string of 12 or 13 digits. The check number (the 13:th digit) is calculated if not supplied.', selected => 0}, # {type => 'EAN8', name => 'EAN8', desc => 'Translates a string of 7 or 8 digits to EAN8 barcodes. The check number (the 8:th digit) is calculated if not supplied.', selected => 0}, # {type => 'IATA2of5', name => 'IATA2of5', desc => 'Creates IATA2of5 barcodes from a string consisting of the numeric characters 0-9', selected => 0}, {type => 'INDUSTRIAL2OF5', name => 'Industrial2of5', desc => 'Creates Industrial2of5 barcodes from a string consisting of the numeric characters 0-9', selected => 0}, diff --git a/C4/External/Amazon.pm b/C4/External/Amazon.pm index 53ebbd3230..1e70f11352 100644 --- a/C4/External/Amazon.pm +++ b/C4/External/Amazon.pm @@ -17,14 +17,6 @@ package C4::External::Amazon; # with Koha; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -use XML::Simple; -use LWP::Simple; -use LWP::UserAgent; -use HTTP::Request::Common; -use C4::Koha; -use URI::Escape; -use POSIX; -use Digest::SHA qw(hmac_sha256_base64); use strict; use warnings; @@ -36,7 +28,6 @@ BEGIN { $VERSION = 3.07.00.049; @ISA = qw(Exporter); @EXPORT = qw( - get_amazon_details get_amazon_tld ); } @@ -68,35 +59,6 @@ This module provides facilities for retrieving Amazon.com content in Koha =over -=item get_amazon_detail( $isbn, $record, $marcflavour, $services ) - -Get editorial reviews, customer reviews, and similar products using Amazon Web Services. - -Parameters: - -=over - -=item $isbn - -Biblio record isbn - -=item $record - -Biblio MARC record - -=item $marcflavour - -MARC flavor, MARC21 or UNIMARC - -=item $services - -Requested Amazon services: A ref to an array. For example, -[ 'Similarities', 'EditorialReviews', 'Reviews' ]. -No other service will be accepted. Services must be spelled exactly. -If no sercice is requested, AWS isn't called. - -=back - =item get_amazon_tld() Get Amazon Top Level Domain depending on Amazon local preference: AmazonLocal. @@ -106,96 +68,6 @@ For example, if AmazonLocal is 'UK', returns '.co.uk'. =cut - -sub get_amazon_details { - my ( $isbn, $record, $marcflavour, $aws_ref ) = @_; - - return unless defined $aws_ref; - my @aws = @$aws_ref; - return if $#aws == -1; - - # Normalize the fields - $isbn = GetNormalizedISBN($isbn); - my $upc = GetNormalizedUPC($record,$marcflavour); - my $ean = GetNormalizedEAN($record,$marcflavour); - # warn "ISBN: $isbn | UPC: $upc | EAN: $ean"; - - # Choose the appropriate and available item identifier - my ( $id_type, $item_id ) = - defined($isbn) && length($isbn) == 13 ? ( 'EAN', $isbn ) : - $isbn ? ( 'ASIN', $isbn ) : - $upc ? ( 'UPC', $upc ) : - $ean ? ( 'EAN', $upc ) : ( undef, undef ); - return unless defined($id_type); - - # grab the item format to determine Amazon search index - my %hformat = ( a => 'Books', g => 'Video', j => 'Music' ); - my $search_index = $hformat{ substr($record->leader(),6,1) } || 'Books'; - - my $parameters={Service=>"AWSECommerceService" , - "AWSAccessKeyId"=> C4::Context->preference('AWSAccessKeyID') , - "Operation"=>"ItemLookup", - "AssociateTag"=> C4::Context->preference('AmazonAssocTag') , - "Version"=>"2009-06-01", - "ItemId"=>$item_id, - "IdType"=>$id_type, - "ResponseGroup"=> join( ',', @aws ), - "Timestamp"=>strftime("%Y-%m-%dT%H:%M:%SZ", gmtime) - }; - $$parameters{"SearchIndex"} = $search_index if $id_type ne 'ASIN'; - my @params; - while (my ($key,$value)=each %$parameters){ - push @params, qq{$key=}.uri_escape($value, "^A-Za-z0-9\-_.~" ); - } - - my $url; - if (C4::Context->preference('AWSPrivateKey')) { - $url = qq{http://webservices.amazon} . get_amazon_tld() . - "/onca/xml?" . join("&",sort @params) . qq{&Signature=} . uri_escape(SignRequest(@params),"^A-Za-z0-9\-_.~" ); - } else { - $url = qq{http://webservices.amazon} . get_amazon_tld() . "/onca/xml?" .join("&",sort @params); - warn "MUST set AWSPrivateKey syspref after 2009-08-15 in order to access Amazon web services"; - } - - my $content = get($url); - warn "could not retrieve $url" unless $content; - my $xmlsimple = XML::Simple->new(); - my $response = $xmlsimple->XMLin( - $content, - forcearray => [ qw(SimilarProduct EditorialReview Review Item) ], - ) unless !$content; - return $response; -} - -sub SignRequest{ - my @params=@_; - my $tld=get_amazon_tld(); - my $string = qq{GET\nwebservices.amazon$tld\n/onca/xml\n} . join("&",sort @params); - return hmac_sha256_base64($string,C4::Context->preference('AWSPrivateKey')) . '='; -} - -sub check_search_inside { - my $isbn = shift; - my $ua = LWP::UserAgent->new( - agent => "Mozilla/4.76 [en] (Win98; U)", - keep_alive => 1, - env_proxy => 1, - ); - my $available = 1; - my $uri = "http://www.amazon.com/gp/reader/$isbn/ref=sib_dp_pt/002-7879865-0184864#reader-link"; - my $req = HTTP::Request->new(GET => $uri); - $req->header ( - 'Accept' => 'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png, */*', - 'Accept-Charset' => 'iso-8859-1,*,utf-8', - 'Accept-Language' => 'en-US' ); - my $res = $ua->request($req); - my $content = $res->content(); - if ($content =~ m/This book is temporarily unavailable/) { - undef $available; - } - return $available; -} - 1; __END__ diff --git a/C4/External/BakerTaylor.pm b/C4/External/BakerTaylor.pm index 3503db0ba8..d7526774a3 100644 --- a/C4/External/BakerTaylor.pm +++ b/C4/External/BakerTaylor.pm @@ -134,7 +134,6 @@ Such response will trigger a warning for each request (potentially many). Point =head1 SEE ALSO -C4::External::Amazon LWP::UserAgent =head1 AUTHOR diff --git a/C4/Installer/PerlDependencies.pm b/C4/Installer/PerlDependencies.pm index a9c68a855c..c43309d506 100644 --- a/C4/Installer/PerlDependencies.pm +++ b/C4/Installer/PerlDependencies.pm @@ -249,6 +249,11 @@ our $PERL_DEPS = { 'required' => '0', 'min_ver' => '0.03' }, + 'Cache::Memcached::Fast' => { + 'usage' => 'Caching', + 'required' => '0', + 'min_ver' => '0.17' + }, 'CHI' => { 'usage' => 'Caching', 'required' => '0', @@ -569,6 +574,11 @@ our $PERL_DEPS = { 'required' => '0', 'min_ver' => '1.7', }, + 'DBD::Mock' => { + 'usage' => 'Core', + 'required' => '0', + 'min_ver' => '1.39' + }, 'Test::MockModule' => { 'usage' => 'Core', 'required' => '0', @@ -580,6 +590,11 @@ our $PERL_DEPS = { 'min_ver' => '0.14', }, + 'Test::YAML::Valid' => { + 'usage' => 'Core', + 'required' => '0', + 'min_ver' => '0.04', + }, 'Text::Unaccent' => { 'usage' => 'Core', 'required' => '1', diff --git a/C4/Items.pm b/C4/Items.pm index a9c0a16084..e9af3dd67d 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -936,7 +936,8 @@ sub GetLostItems { my $dbh = C4::Context->dbh; my $query = " - SELECT * + SELECT title, author, lib, itemlost, authorised_value, barcode, datelastseen, price, replacementprice, homebranch, + itype, itemtype, holdingbranch, location, itemnotes, items.biblionumber as biblionumber FROM items LEFT JOIN biblio ON (items.biblionumber = biblio.biblionumber) LEFT JOIN biblioitems ON (items.biblionumber = biblioitems.biblionumber) diff --git a/C4/Koha.pm b/C4/Koha.pm index 4f386e469d..26106cf418 100644 --- a/C4/Koha.pm +++ b/C4/Koha.pm @@ -674,6 +674,7 @@ sub getallthemes { opendir D, "$htdocs"; my @dirlist = readdir D; foreach my $directory (@dirlist) { + next if $directory eq 'lib'; -d "$htdocs/$directory/en" and push @themes, $directory; } return @themes; @@ -1232,7 +1233,7 @@ sub GetNormalizedUPC { } # Normalizes and returns the first valid ISBN found in the record -# ISBN13 are converted into ISBN10. This is required to get Amazon cover book. +# ISBN13 are converted into ISBN10. This is required to get some book cover images. sub GetNormalizedISBN { my ($isbn,$record,$marcflavour) = @_; my @fields; diff --git a/C4/Labels/Label.pm b/C4/Labels/Label.pm index 7b1fafd6f4..760bacfed9 100644 --- a/C4/Labels/Label.pm +++ b/C4/Labels/Label.pm @@ -553,6 +553,28 @@ sub barcode { warn sprintf('Barcode generation failed for item %s with this error: %s', $self->{'item_number'}, $@); } } + elsif ($params{'barcode_type'} eq 'EAN13') { + $bar_length = 4; # FIXME + $num_of_bars = 13; + $tot_bar_length = ($bar_length * $num_of_bars) + ($guard_length * 2); + $x_scale_factor = ($params{'width'} / $tot_bar_length) * 0.9; + eval { + PDF::Reuse::Barcode::EAN13( + x => $params{'llx'}, + y => $params{'lly'}, + value => sprintf('%013d',$params{barcode_data}), +# xSize => $x_scale_factor, +# ySize => $params{'y_scale_factor'}, + mode => 'graphic', + ); + }; + if ($@) { + warn sprintf('Barcode generation failed for item %s with this error: %s', $self->{'item_number'}, $@); + } + } + else { + warn "unknown barcode_type: $params{barcode_type}"; + } } sub csv_data { @@ -608,6 +630,9 @@ This module provides methods for creating, and otherwise manipulating single lab =item . INDUSTRIAL2OF5 = The standard 2 of 5 barcode (a binary level bar code developed by Identicon Corp. and Computer Identics Corp. in 1970) +=item . + EAN13 = The standard EAN-13 barcode + =back C Defines the general layout to be used on labels. NOTE: At present there are only five printing types supported in the label creator code: diff --git a/C4/Languages.pm b/C4/Languages.pm index d0eed6982e..415a798f6b 100644 --- a/C4/Languages.pm +++ b/C4/Languages.pm @@ -23,19 +23,9 @@ use strict; #use warnings; FIXME - Bug 2505 use Carp; use C4::Context; +use Koha::Cache; use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $DEBUG); -eval { - if (C4::Context->ismemcached) { - require Memoize::Memcached; - import Memoize::Memcached qw(memoize_memcached); - - memoize_memcached('getTranslatedLanguages', memcached => C4::Context->memcached); - memoize_memcached('getFrameworkLanguages' , memcached => C4::Context->memcached); - memoize_memcached('getAllLanguages', memcached => C4::Context->memcached); - } -}; - BEGIN { $VERSION = 3.07.00.049; require Exporter; @@ -77,6 +67,15 @@ Returns a reference to an array of hashes: =cut sub getFrameworkLanguages { + + my $cache; + if (Koha::Cache->is_cache_active()) { + $cache = Koha::Cache->new(); + if (defined $cache) { + my $cached = $cache->get_from_cache("getFrameworkLanguages"); + return $cached if $cached; + } + } # get a hash with all language codes, names, and locale names my $all_languages = getAllLanguages(); my @languages; @@ -99,6 +98,9 @@ sub getFrameworkLanguages { } } } + if (Koha::Cache->is_cache_active() && defined $cache) { + $cache->set_in_cache("getFrameworkLanguages",\@languages,1000) + } return \@languages; } @@ -179,6 +181,17 @@ Returns a reference to an array of hashes: =cut sub getAllLanguages { + # retrieve from cache if applicable + my $cache; + if (Koha::Cache->is_cache_active()) { + $cache = Koha::Cache->new(); + if (defined $cache) { + my $cached = $cache->get_from_cache("getAllLanguages"); + if ($cached) { + return $cached; + } + } + } my @languages_loop; my $dbh=C4::Context->dbh; my $current_language = shift || 'en'; @@ -213,6 +226,9 @@ sub getAllLanguages { } push @languages_loop, $language_subtag_registry; } + if (Koha::Cache->is_cache_active() && defined $cache) { + $cache->set_in_cache("getAllLanguages",\@languages_loop,1000); + } return \@languages_loop; } diff --git a/C4/Members.pm b/C4/Members.pm index 2e59c916ca..2e315aadc1 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -899,11 +899,8 @@ sub fixup_cardnumber { return "V$cardnumber$rem"; } else { - # MODIFIED BY JF: mysql4.1 allows casting as an integer, which is probably - # better. I'll leave the original in in case it needs to be changed for you - # my $sth=$dbh->prepare("select max(borrowers.cardnumber) from borrowers"); my $sth = $dbh->prepare( - "select max(cast(cardnumber as signed)) from borrowers" + 'SELECT MAX( CAST( cardnumber AS SIGNED ) ) FROM borrowers WHERE cardnumber REGEXP "^-?[0-9]+$"' ); $sth->execute; my ($result) = $sth->fetchrow; diff --git a/C4/Output.pm b/C4/Output.pm index 8cfa35192c..57faa00d39 100644 --- a/C4/Output.pm +++ b/C4/Output.pm @@ -42,13 +42,13 @@ BEGIN { @ISA = qw(Exporter); @EXPORT_OK = qw(&is_ajax ajax_fail); # More stuff should go here instead - %EXPORT_TAGS = ( all =>[qw(&themelanguage &gettemplate setlanguagecookie pagination_bar &gettemplate + %EXPORT_TAGS = ( all =>[qw(setlanguagecookie pagination_bar &output_with_http_headers &output_ajax_with_http_headers &output_html_with_http_headers)], ajax =>[qw(&output_with_http_headers &output_ajax_with_http_headers is_ajax)], html =>[qw(&output_with_http_headers &output_html_with_http_headers)] ); push @EXPORT, qw( - &themelanguage &gettemplate setlanguagecookie getlanguagecookie pagination_bar &gettemplate + setlanguagecookie getlanguagecookie pagination_bar ); push @EXPORT, qw( &output_html_with_http_headers &output_ajax_with_http_headers &output_with_http_headers FormatData FormatNumber diff --git a/C4/Reports/Guided.pm b/C4/Reports/Guided.pm index fbc25d8b8f..e5c28f3d6e 100644 --- a/C4/Reports/Guided.pm +++ b/C4/Reports/Guided.pm @@ -413,11 +413,44 @@ sub select_2_select_count ($) { $sql =~ s/\bSELECT\W+(?:\w+\W+){1,}?FROM\b|\bSELECT\W\*\WFROM\b/SELECT count(*) FROM /ig; return $sql; } -sub strip_limit ($) { - my $sql = shift or return; - ($sql =~ /\bLIMIT\b/i) or return ($sql, 0, undef); - $sql =~ s/\bLIMIT\b\s*(\d+)(\s*\,\s*(\d+))?\s*/ /ig; - return ($sql, (defined $2 ? $1 : 0), (defined $3 ? $3 : $1)); # offset can default to 0, LIMIT cannot! + +# This removes the LIMIT from the query so that a custom one can be specified. +# Usage: +# ($new_sql, $offset, $limit) = strip_limit($sql); +# +# Where: +# $sql is the query to modify +# $new_sql is the resulting query +# $offset is the offset value, if the LIMIT was the two-argument form, +# 0 if it wasn't otherwise given. +# $limit is the limit value +# +# Notes: +# * This makes an effort to not break subqueries that have their own +# LIMIT specified. It does that by only removing a LIMIT if it comes after +# a WHERE clause (which isn't perfect, but at least should make more cases +# work - subqueries with a limit in the WHERE will still break.) +# * If your query doesn't have a WHERE clause then all LIMITs will be +# removed. This may break some subqueries, but is hopefully rare enough +# to not be a big issue. +sub strip_limit { + my ($sql) = @_; + + return unless $sql; + return ($sql, 0, undef) unless $sql =~ /\bLIMIT\b/i; + + # Two options: if there's no WHERE clause in the SQL, we simply capture + # any LIMIT that's there. If there is a WHERE, we make sure that we only + # capture a LIMIT after the last one. This prevents stomping on subqueries. + if ($sql !~ /\bWHERE\b/i) { + (my $res = $sql) =~ s/\bLIMIT\b\s*(\d+)(\s*\,\s*(\d+))?\s*/ /ig; + return ($res, (defined $2 ? $1 : 0), (defined $3 ? $3 : $1)); + } else { + my $res = $sql; + $res =~ m/.*\bWHERE\b/gsi; + $res =~ s/\G(.*)\bLIMIT\b\s*(\d+)(\s*\,\s*(\d+))?\s*/$1 /is; + return ($res, (defined $3 ? $2 : 0), (defined $4 ? $4 : $2)); + } } sub execute_query ($;$$$) { @@ -769,7 +802,7 @@ sub _get_column_defs { my $columns_def_file = "columns.def"; my $htdocs = C4::Context->config('intrahtdocs'); my $section='intranet'; - my ($theme, $lang) = C4::Templates::themelanguage($htdocs, $columns_def_file, $section,$cgi); + my ($theme, $lang, $availablethemes) = C4::Templates::themelanguage($htdocs, $columns_def_file, $section,$cgi); my $full_path_to_columns_def_file="$htdocs/$theme/$lang/$columns_def_file"; open (COLUMNS,$full_path_to_columns_def_file); diff --git a/C4/SQLHelper.pm b/C4/SQLHelper.pm index 703c28d662..e86d2b71a9 100644 --- a/C4/SQLHelper.pm +++ b/C4/SQLHelper.pm @@ -24,26 +24,10 @@ use List::MoreUtils qw(first_value any); use C4::Context; use C4::Dates qw(format_date_in_iso); use C4::Debug; +use Koha::Cache; require Exporter; use vars qw($VERSION @ISA @EXPORT_OK %EXPORT_TAGS); -eval { - my $servers = C4::Context->config('memcached_servers'); - if ($servers) { - require Memoize::Memcached; - import Memoize::Memcached qw(memoize_memcached); - - my $memcached = { - servers => [$servers], - key_prefix => C4::Context->config('memcached_namespace') || 'koha', - expire_time => 600 - }; # cache for 10 mins - - memoize_memcached( '_get_columns', memcached => $memcached ); - memoize_memcached( 'GetPrimaryKeys', memcached => $memcached ); - } -}; - BEGIN { # set the version for version checking $VERSION = 3.07.00.049; @@ -236,7 +220,7 @@ sub DeleteInTable{ my $result; eval{$result=$sth->execute(@$values)}; warn $@ if ($@ && $debug); - return $result; + return $result; } } @@ -250,8 +234,22 @@ Get the Primary Key field names of the table sub GetPrimaryKeys($) { my $tablename=shift; - my $hash_columns=_get_columns($tablename); - return grep { $hash_columns->{$_}->{'Key'} =~/PRI/i} keys %$hash_columns; + my $result; + my $cache; + if (Koha::Cache->is_cache_active()) { + $cache = Koha::Cache->new(); + if (defined $cache) { + $result = $cache->get_from_cache("sqlhelper:GetPrimaryKeys:$tablename"); + } + } + unless (defined $result) { + my $hash_columns=_get_columns($tablename); + $result = grep { $hash_columns->{$_}->{'Key'} =~/PRI/i} keys %$hash_columns; + if (Koha::Cache->is_cache_active() && defined $cache) { + $cache->set_in_cache("sqlhelper:GetPrimaryKeys:$tablename", $result); + } + } + return $result; } @@ -286,12 +284,25 @@ With sub _get_columns($) { my ($tablename) = @_; - unless ( exists( $hashref->{$tablename} ) ) { + my $cache; + if ( exists( $hashref->{$tablename} ) ) { + return $hashref->{$tablename}; + } + if (Koha::Cache->is_cache_active()) { + $cache = Koha::Cache->new(); + if (defined $cache) { + $hashref->{$tablename} = $cache->get_from_cache("sqlhelper:_get_columns:$tablename"); + } + } + unless ( defined $hashref->{$tablename} ) { my $dbh = C4::Context->dbh; my $sth = $dbh->prepare_cached(qq{SHOW COLUMNS FROM $tablename }); $sth->execute; my $columns = $sth->fetchall_hashref(qw(Field)); $hashref->{$tablename} = $columns; + if (Koha::Cache->is_cache_active() && defined $cache) { + $cache->set_in_cache("sqlhelper:_get_columns:$tablename", $hashref->{$tablename}); + } } return $hashref->{$tablename}; } diff --git a/C4/Search.pm b/C4/Search.pm index fd8161084c..3edf118557 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -1415,7 +1415,7 @@ sub buildQuery { my @search_results = searchResults($search_context, $searchdesc, $hits, $results_per_page, $offset, $scan, - @marcresults, $hidelostitems); + @marcresults); Format results in a form suitable for passing to the template @@ -1469,12 +1469,7 @@ sub searchResults { } #search item field code - my $sth = - $dbh->prepare( -"SELECT tagfield FROM marc_subfield_structure WHERE kohafield LIKE 'items.itemnumber'" - ); - $sth->execute; - my ($itemtag) = $sth->fetchrow; + my ($itemtag, undef) = &GetMarcFromKohaField( "items.itemnumber", "" ); ## find column names of items related to MARC my $sth2 = $dbh->prepare("SHOW COLUMNS FROM items"); @@ -1792,7 +1787,7 @@ sub searchResults { # XSLT processing of some stuff use C4::Charset; SetUTF8Flag($marcrecord); - $debug && warn $marcrecord->as_formatted; + warn $marcrecord->as_formatted if $DEBUG; my $interface = $search_context eq 'opac' ? 'OPAC' : ''; if (!$scan && C4::Context->preference($interface . "XSLTResultsDisplay")) { $oldbiblio->{XSLTResultsRecord} = XSLTParse4Display($oldbiblio->{biblionumber}, $marcrecord, $interface."XSLTResultsDisplay", 1, \@hiddenitems); @@ -1823,8 +1818,6 @@ sub searchResults { $oldbiblio->{intransitcount} = $item_in_transit_count; $oldbiblio->{onholdcount} = $item_onhold_count; $oldbiblio->{orderedcount} = $ordered_count; - # deleting - in isbn to enable amazon content - $oldbiblio->{isbn} =~ s/-//g; if (C4::Context->preference("AlternateHoldingsField") && $items_count == 0) { my $fieldspec = C4::Context->preference("AlternateHoldingsField"); diff --git a/C4/Serials.pm b/C4/Serials.pm index 58b6078c28..98660e9e87 100644 --- a/C4/Serials.pm +++ b/C4/Serials.pm @@ -53,6 +53,7 @@ BEGIN { &check_routing &updateClaim &removeMissingIssue &CountIssues HasItems + &GetSubscriptionsFromBorrower ); } @@ -755,7 +756,7 @@ sub GetLatestSerials { FROM serial WHERE subscriptionid = ? AND (status =2 or status=4) - ORDER BY planneddate DESC LIMIT 0,$limit + ORDER BY publisheddate DESC LIMIT 0,$limit "; my $sth = $dbh->prepare($strsth); $sth->execute($subscriptionid); @@ -2175,6 +2176,40 @@ sub in_array { # used in next sub down return 0; } +=head2 GetSubscriptionsFromBorrower + +($count,@routinglist) = GetSubscriptionsFromBorrower($borrowernumber) + +this gets the info from subscriptionroutinglist for each $subscriptionid + +return : +a count of the serial subscription routing lists to which a patron belongs, +with the titles of those serial subscriptions as an array. Each element of the array +contains a hash_ref with subscriptionID and title of subscription. + +=cut + +sub GetSubscriptionsFromBorrower { + my ($borrowernumber) = @_; + my $dbh = C4::Context->dbh; + my $sth = $dbh->prepare( + "SELECT subscription.subscriptionid, biblio.title + FROM subscription + JOIN biblio ON biblio.biblionumber = subscription.biblionumber + JOIN subscriptionroutinglist USING (subscriptionid) + WHERE subscriptionroutinglist.borrowernumber = ? ORDER BY title ASC + " + ); + $sth->execute($borrowernumber); + my @routinglist; + my $count = 0; + while ( my $line = $sth->fetchrow_hashref ) { + $count++; + push( @routinglist, $line ); + } + return ( $count, @routinglist ); +} + =head2 GetNextDate $resultdate = GetNextDate($planneddate,$subscription) diff --git a/C4/Templates.pm b/C4/Templates.pm index 47bda045b2..507e077fb3 100644 --- a/C4/Templates.pm +++ b/C4/Templates.pm @@ -36,7 +36,7 @@ use C4::Languages qw(getTranslatedLanguages get_bidi regex_lang_subtags language use C4::Context; -__PACKAGE__->mk_accessors(qw( theme lang filename htdocs interface vars)); +__PACKAGE__->mk_accessors(qw( theme activethemes preferredtheme lang filename htdocs interface vars)); @@ -53,17 +53,19 @@ sub new { else { $htdocs = C4::Context->config('intrahtdocs'); } - my ($theme, $lang)= themelanguage( $htdocs, $tmplbase, $interface, $query); + my ($theme, $lang, $activethemes)= themelanguage( $htdocs, $tmplbase, $interface, $query); + my @includes; + foreach (@$activethemes) { + push @includes, "$htdocs/$_/$lang/includes"; + push @includes, "$htdocs/$_/en/includes" unless $lang eq 'en'; + } my $template = Template->new( { EVAL_PERL => 1, ABSOLUTE => 1, PLUGIN_BASE => 'Koha::Template::Plugin', COMPILE_EXT => C4::Context->config('template_cache_dir')?'.ttc':'', COMPILE_DIR => C4::Context->config('template_cache_dir')?C4::Context->config('template_cache_dir'):'',, - INCLUDE_PATH => [ - "$htdocs/$theme/$lang/includes", - "$htdocs/$theme/en/includes" - ], + INCLUDE_PATH => \@includes, FILTERS => {}, } ) or die Template->error(); @@ -74,6 +76,8 @@ sub new { bless $self, $class; $self->theme($theme); $self->lang($lang); + $self->activethemes($activethemes); + $self->preferredtheme($activethemes->[0]); $self->filename($filename); $self->htdocs($htdocs); $self->interface($interface); @@ -95,18 +99,19 @@ sub output { $vars->{themelang} = '/opac-tmpl'; } $vars->{lang} = $self->lang; - $vars->{themelang} .= '/' . $self->theme . '/' . $self->lang; + $vars->{themelang} .= '/' . $self->preferredtheme . '/' . $self->lang; $vars->{yuipath} = ( C4::Context->preference("yuipath") eq "local" - ? $vars->{themelang} . "/lib/yui" + ? ( $self->interface eq 'intranet' ? $vars->{themelang} . "/lib/yui" : "/opac-tmpl/lib/yui" ) : C4::Context->preference("yuipath") ); $vars->{interface} = ( $self->{interface} ne 'intranet' ? '/opac-tmpl' : '/intranet-tmpl' ); $vars->{theme} = $self->theme; $vars->{opaccolorstylesheet} = - C4::Context->preference('opaccolorstylesheet'); + C4::Context->preference('opaccolorstylesheet'); $vars->{opacsmallimage} = C4::Context->preference('opacsmallimage'); - $vars->{opacstylesheet} = C4::Context->preference('opacstylesheet'); + $vars->{opaclayoutstylesheet} = + C4::Context->preference('opaclayoutstylesheet'); # add variables set via param to $vars for processing # and clean any utf8 mess @@ -210,8 +215,7 @@ sub _get_template_file { my $is_intranet = $interface eq 'intranet'; my $htdocs = C4::Context->config($is_intranet ? 'intrahtdocs' : 'opachtdocs'); - my ($theme, $lang) = themelanguage($htdocs, $tmplbase, $interface, $query); - my $opacstylesheet = C4::Context->preference('opacstylesheet'); + my ($theme, $lang, $availablethemes) = themelanguage($htdocs, $tmplbase, $interface, $query); # if the template doesn't exist, load the English one as a last resort my $filename = "$htdocs/$theme/$lang/modules/$tmplbase"; @@ -227,24 +231,25 @@ sub gettemplate { my ( $tmplbase, $interface, $query ) = @_; ($query) or warn "no query in gettemplate"; my $path = C4::Context->preference('intranet_includes') || 'includes'; - my $opacstylesheet = C4::Context->preference('opacstylesheet'); $tmplbase =~ s/\.tmpl$/.tt/; my ($htdocs, $theme, $lang, $filename) = _get_template_file($tmplbase, $interface, $query); my $template = C4::Templates->new($interface, $filename, $tmplbase, $query); - my $is_intranet = $interface eq 'intranet'; - my $themelang = - ($is_intranet ? '/intranet-tmpl' : '/opac-tmpl') . - "/$theme/$lang"; - $template->param( - themelang => $themelang, - yuipath => C4::Context->preference("yuipath") eq "local" - ? "$themelang/lib/yui" - : C4::Context->preference("yuipath"), - interface => $is_intranet ? '/intranet-tmpl' : '/opac-tmpl', - theme => $theme, - lang => $lang - ); +# NOTE: Commenting these out rather than deleting them so that those who need +# to know how we previously shimmed these directories will be able to understand. +# my $is_intranet = $interface eq 'intranet'; +# my $themelang = +# ($is_intranet ? '/intranet-tmpl' : '/opac-tmpl') . +# "/$theme/$lang"; +# $template->param( +# themelang => $themelang, +# yuipath => C4::Context->preference("yuipath") eq "local" +# ? "$themelang/lib/yui" +# : C4::Context->preference("yuipath"), +# interface => $is_intranet ? '/intranet-tmpl' : '/opac-tmpl', +# theme => $theme, +# lang => $lang +# ); # Bidirectionality my $current_lang = regex_lang_subtags($lang); @@ -287,11 +292,11 @@ sub themelanguage { for my $theme (@themes) { if ( -e "$htdocs/$theme/$lang/modules/$tmpl" ) { $_current_language = $lang; - return ($theme, $lang) + return ($theme, $lang, \@themes) } } # Otherwise, return prog theme in English 'en' - return ('prog', 'en'); + return ('prog', 'en', \@themes); } diff --git a/C4/VirtualShelves.pm b/C4/VirtualShelves.pm index 20f36206cf..8c0b15e275 100644 --- a/C4/VirtualShelves.pm +++ b/C4/VirtualShelves.pm @@ -221,7 +221,7 @@ Returns the above-mentioned fields for passed virtual shelf number. =cut -sub GetShelf ($) { +sub GetShelf { my ($shelfnumber) = @_; my $query = qq( SELECT shelfnumber, shelfname, owner, category, sortfield, @@ -252,7 +252,7 @@ from C4::Circulation. =cut -sub GetShelfContents ($;$$$) { +sub GetShelfContents { my ($shelfnumber, $row_count, $offset, $sortfield) = @_; my $dbh=C4::Context->dbh(); my $sth1 = $dbh->prepare("SELECT count(*) FROM virtualshelfcontents WHERE shelfnumber = ?"); @@ -351,7 +351,7 @@ sub AddToShelf { my $sth = $dbh->prepare($query); $sth->execute( $shelfnumber, $biblionumber ); - ($sth->rows) and return undef; # already on shelf + ($sth->rows) and return; # already on shelf $query = qq( INSERT INTO virtualshelfcontents (shelfnumber, biblionumber, flags, borrowernumber) @@ -464,7 +464,7 @@ sub ShelfPossibleAction { $sth->execute($user, $shelfnumber); my $shelf= $sth->fetchrow_hashref; - return 0 unless $shelf && ($shelf->{category}==2 || $shelf->{owner}==$user || $shelf->{borrowernumber}==$user); + return 0 unless $shelf && ($shelf->{category}==2 || $shelf->{owner}==$user || ($user && $shelf->{borrowernumber}==$user)); if($action eq 'view') { #already handled in the above condition return 1; @@ -658,15 +658,6 @@ sub _biblionumber_sth { #only used in obsolete sub below $sth; } -sub each_biblionumbers (&$) { #OBSOLETE - my ($code,$shelf) = @_; - my $ref = _biblionumber_sth($shelf)->fetchall_arrayref; - map { - $_=$$_[0]; - $code->(); - } @$ref; -} - sub _CheckShelfName { my ($name, $cat, $owner, $number)= @_; diff --git a/C4/XSLT.pm b/C4/XSLT.pm index cbe1ff0fbc..d17b82832e 100644 --- a/C4/XSLT.pm +++ b/C4/XSLT.pm @@ -140,35 +140,35 @@ sub XSLTParse4Display { my ( $biblionumber, $orig_record, $xslsyspref, $fixamps, $hidden_items ) = @_; my $xslfilename = C4::Context->preference($xslsyspref); if ( $xslfilename =~ /^\s*"?default"?\s*$/i ) { + my $htdocs; + my $theme; + my $lang = C4::Templates::_current_language(); + my $xslfile; if ($xslsyspref eq "XSLTDetailsDisplay") { - $xslfilename = C4::Context->config('intrahtdocs') . - '/' . C4::Context->preference("template") . - '/' . C4::Templates::_current_language() . - '/xslt/' . - C4::Context->preference('marcflavour') . - "slim2intranetDetail.xsl"; + $htdocs = C4::Context->config('intrahtdocs'); + $theme = C4::Context->preference("template"); + $xslfile = C4::Context->preference('marcflavour') . + "slim2intranetDetail.xsl"; } elsif ($xslsyspref eq "XSLTResultsDisplay") { - $xslfilename = C4::Context->config('intrahtdocs') . - '/' . C4::Context->preference("template") . - '/' . C4::Templates::_current_language() . - '/xslt/' . - C4::Context->preference('marcflavour') . + $htdocs = C4::Context->config('intrahtdocs'); + $theme = C4::Context->preference("template"); + $xslfile = C4::Context->preference('marcflavour') . "slim2intranetResults.xsl"; } elsif ($xslsyspref eq "OPACXSLTDetailsDisplay") { - $xslfilename = C4::Context->config('opachtdocs') . - '/' . C4::Context->preference("opacthemes") . - '/' . C4::Templates::_current_language() . - '/xslt/' . - C4::Context->preference('marcflavour') . - "slim2OPACDetail.xsl"; + $htdocs = C4::Context->config('opachtdocs'); + $theme = C4::Context->preference("opacthemes"); + $xslfile = C4::Context->preference('marcflavour') . + "slim2OPACDetail.xsl"; } elsif ($xslsyspref eq "OPACXSLTResultsDisplay") { - $xslfilename = C4::Context->config('opachtdocs') . - '/' . C4::Context->preference("opacthemes") . - '/' . C4::Templates::_current_language() . - '/xslt/' . - C4::Context->preference('marcflavour') . - "slim2OPACResults.xsl"; + $htdocs = C4::Context->config('opachtdocs'); + $theme = C4::Context->preference("opacthemes"); + $xslfile = C4::Context->preference('marcflavour') . + "slim2OPACResults.xsl"; } + $xslfilename = "$htdocs/$theme/$lang/xslt/$xslfile"; + $xslfilename = "$htdocs/$theme/en/xslt/$xslfile" unless ( $lang ne 'en' && !-f $xslfilename ); + $xslfilename = "$htdocs/prog/$lang/xslt/$xslfile" unless ( !-f $xslfilename ); + $xslfilename = "$htdocs/prog/en/xslt/$xslfile" unless ( $lang ne 'en' && !-f $xslfilename ); } if ( $xslfilename =~ m/\{langcode\}/ ) { @@ -187,7 +187,8 @@ sub XSLTParse4Display { OPACBaseURL TraceCompleteSubfields UseICU UseAuthoritiesForTracings TraceSubjectSubdivisions Display856uAsImage OPACDisplay856uAsImage - UseControlNumber + UseControlNumber IntranetBiblioDefaultView BiblioDefaultView + singleBranchMode AlternateHoldingsField AlternateHoldingsSeparator / ) { my $sp = C4::Context->preference( $syspref ); diff --git a/INSTALL.ubuntu.12.04 b/INSTALL.ubuntu.12.04 new file mode 100644 index 0000000000..8c1c0febe8 --- /dev/null +++ b/INSTALL.ubuntu.12.04 @@ -0,0 +1,578 @@ +================================================================= +Installation Guide for Installing Koha +on Ubuntu Precise Pangolin (12.04 LTS) with MySQL 5.5 +================================================================= + +Copyright (C) 2007, 2008 LibLime (http://liblime.com) +Some parts copyright 2010 Chris Nighswonger +Some parts copyright 2012 Tomas Cohen Arazi +Some parts copyright 2012 Mark Tompsett + +Original author: Joshua Ferraro +Modified for Ubuntu by: Chris Nighswonger + (cnighswonger AT foundations DOT edu) + +More updates by: Tomas Cohen Arazi (tomascohen AT gmail DOT com) + Mark Tompsett (mtompset AT hotmail DOT com) + +Feedback/bug reports: Koha Developer's List: +http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel + +This document last modified: 24 July 2012 + +Installation Instructions +================================================================= + +Running commands can mostly be performed as a system user with +sudo privileges, however some need to be run directly as root. + +1. Prepare System and Install Dependencies + +1.1 Install Ubuntu 12.04 LTS via CD/DVD/USB + + Download and install Ubuntu from the official site. + - Server edition (command-line only) + http://www.ubuntu.com/download/server + - Desktop edition + http://www.ubuntu.com/download/desktop + To keep your Koha installation minimal and to free resources + for running, the Server edition is recommended, though the + Desktop edition will work as well. + + As Apache and MySQL will be installed in the instructions + later, there is no need to select any packages during the + installation of Ubuntu. + +1.2 Add koha repository to your apt sources + + NOTE: This is not required for koha 3.6.7 under Ubuntu 12.04 + if Zebra indexing (see step 5.2) is done via cron jobs. + NOTE: 3.8.x is the recommended current stable release to use. + + There are currently three active repositories: oldstable, + squeeze, and squeeze-dev. As of 2012-07-24, they represent + 3.6.x, 3.8.x, and master respectively. This will change when + 3.10.x is released. They will represent 3.8.x, 3.10.x, and + master respectively. + + It is recommended to use squeeze at this time, as 3.8.x is the + current stable release. + + Run these commands: + $ echo "deb http://debian.koha-community.org/koha squeeze main" | sudo tee /etc/apt/sources.list.d/koha-community.list + $ wget -O- http://debian.koha-community.org/koha/gpg.asc | sudo apt-key add - + $ sudo apt-get update ; sudo apt-get upgrade + +1.3 Install Apache2 and MySQL 5.5 + + Install the Apache2 server: + $ sudo apt-get install apache2 + + If your MySQL server will be on your Koha server, or this + instruction is confusing: + $ sudo apt-get install mysql-server + + NOTE: You will be prompted to set your root password for MySQL. + +1.4 Set up your locale + + Your locale should be set to UTF-8, as should Apache2 and + MySQL 5.5. This step is VERY IMPORTANT for a UNICODE compliant + system. You _MUST_ be sure to set this BEFORE you install Koha. + +1.4.1 Ubuntu Locale + + Verify you have a UTF-8 locale in use: + $ locale + You will recognize if it is UTF-8 or not. Ubuntu 12.04 should + not generally require any further steps. + + If it is not set to something UTF-8, use: + $ locale -a + + You can select one (note that utf8 becomes UTF-8) and use: + $ sudo update-locale LANG=en_US.UTF-8 + + You have to log out and back in to see locale change reflected + in the locale command. + + Verify your system local by running the following command: + $ locale + +1.4.2 Apache2 and MySQL Locales + Please read over the following document carefully for more + information: + http://wiki.koha-community.org/wiki/Koha_on_Ubuntu#Configuring_the_Character_Set + +1.5 Get Koha + + There are three suggested ways to install Koha. If you will be + participating in Koha's development, the Download from Git + is the recommended way (See 1.5.1 below). + If you would like to skip some of these tedious tasks, visit + the following URL: + http://wiki.koha-community.org/wiki/Koha_3.8_on_Debian_Squeeze + If you will not be, then follow the Download from Tarball + instructions (See 1.5.2 below). + + 1.5.1 Download from Git + + Install Git: + $ sudo apt-get install git-core + + Download Koha: + $ git clone git://git.koha-community.org/koha.git kohaclone + $ cd kohaclone + $ git checkout -b myinstall origin + + NOTE: for more information about Git, please see the Koha Git + Usage Guide: + http://wiki.koha-community.org/wiki/Version_Control_Using_Git + + 1.5.2 Download from Tarball + + You can get the sources from + http://download.koha-community.org. Issuing the following + command you can get the latest stable release (recommended): + + Download and Unpack Koha: + $ wget http://download.koha-community.org/koha-latest.tar.gz + $ tar xvf koha-latest.tar.gz + + Determine the version and change directory: + $ ls + koha-3.08.03 koha-lastest.tar.gz + $ cd koha-3.08.03 + + +1.6 Install additional Ubuntu dependencies + + Several Koha dependencies have been conveniently packaged and + will be installed issuing the following commands: + + $ sudo apt-get install dselect + $ sudo dpkg --set-selections < install_misc/ubuntu.packages + $ sudo dselect + + Choose [I]nstall and accept packages to be installed and hit + return. Be patient. This may take a long time. + Choose [C]onfigure, [R]emove and [Q]uit until dselect has + completed. + + +1.7 Install Perl dependencies that aren't packaged + +**************************************************************** + IMPORTANT: You should only use CPAN for Perl dependencies + which are NOT available from the package + maintainer. You have been warned! +**************************************************************** + + Run the test script to identify missing libraries + $ ./koha_perl_deps.pl -m -u + + If there are any dependencies which are missing or need + upgrading, first attempt aptitude searches: + $ aptitude search libbusiness-isdn-perl + + Notice how the name transformed to 'lib' plus the lowercase + library name using '-'s instead of '::'s plus '-perl'. This + will generally help find what is missing. And then a simple + apt-get install can be done: + $ sudo apt-get install libbusiness-isdn-perl + + Do this for all the dependencies listed. Then re-run the + command: + $ ./koha_perl_deps.pl -m -u + + In general, the repositories on debian.koha-community.org + should have any missing pieces. The list should be empty. + + If any are still listed, they can be installed using the 'cpan' + command. If and only if you are unable to find any of the + dependencies should you use the cpan command. For example: + $ sudo cpan GD GD::Barcode::UPCE Algorithm::CheckDigits + + NOTE: you may need to run CPAN initialization if you've not run + cpan before: +-------- + /etc/perl/CPAN/Config.pm initialized. + + CPAN is the world-wide archive of perl resources. It consists of about + 100 sites that all replicate the same contents all around the globe. + Many countries have at least one CPAN site already. The resources + found on CPAN are easily accessible with the CPAN.pm module. If you + want to use CPAN.pm, you have to configure it properly. + + If you do not want to enter a dialog now, you can answer 'no' to this + question and I'll try to autoconfigure. (Note: you can revisit this + dialog anytime later by typing 'o conf init' at the cpan prompt.) + + Are you ready for manual configuration? [yes] +-------- + When the configuration is completed CPAN will install the Perl + modules passed on the command-line. + + For further explanation and reading see: + http://wiki.koha-community.org/wiki/Koha_on_Ubuntu#Ubuntu_Packages_for_Perl_Dependencies + + +2. Configuration of dependencies + +2.1 Update root MySQL password + + If during the installation of MySQL you were not prompted to + set the MySQL password: + $ sudo mysqladmin password + +2.2 Create the Koha database + + Create the database and user with associated privileges. To do + this, decide on the koha database name, the koha user name, and + the koha user password. Substitute these into the following + commands: + $ mysql -u root -p + Enter mysql root password: + Welcome to the MySQL monitor. Commands end with ; or \g. + Your MySQL connection id is 42 + Server version: 5.5.24-0ubuntu0.12.04.1 (Ubuntu) + + Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. + + Oracle is a registered trademark of Oracle Corporation and/or its + affiliates. Other names may be trademarks of their respective + owners. + + Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. + + mysql> CREATE DATABASE {kohadatabasename}; + mysql> SHOW DATABASES; + mysql> CREATE user '{kohauserbasename}'@'localhost' IDENTIFIED by '{kohauserpassword}'; + mysql> GRANT ALL ON {kohadatabasename}.* TO '{kohausername}'@'localhost' IDENTIFIED BY '{kohauserpassword}'; + mysql> USE mysql; + mysql> SELECT host,user FROM user; + mysql> DELETE FROM user WHERE user=''; + mysql> SELECT host,user FROM user; + mysql> FLUSH PRIVILEGES; + mysql> QUIT + + For further explanation of these commands see: + http://wiki.koha-community.org/wiki/Koha_on_Ubuntu#Create_MySQL_Database_and_Grant_Privileges + + +2.3 Test your SAX Parser and correct where necessary + + You must be sure you're using the XML::LibXML SAX parser, not + Expat or PurePerl, both of which have outstanding bugs with + pre-composed characters. Test your SAX parser by running: + $ ./misc/sax_parser_print.pl + + If your setup is wrong, the script will output something like: + Koha wants something like: + XML::LibXML::SAX::Parser=HASH(0x81fe220) + You have: + XML::SAX::Expat=HASH(0x1a94e88) + Looks bad, check INSTALL.* documentation. + + It means you are using Expat (it could also say PurePerl). + You'll need to edit your ini file, located at: + /etc/perl/XML/SAX/ParserDetails.ini + + Move the entire section for '[XML::LibXML::SAX::Parser]' to the + bottom of the ini file. Then run the script again. The output + should look like this: + $ misc/sax_parser_print.pl + Koha wants something like: + XML::LibXML::SAX::Parser=HASH(0x81fe220) + You have: + XML::LibXML::SAX::Parser=HASH(0x16dfee8) + Looks good. + + For further details see: + http://wiki.koha-community.org/wiki/Koha_on_Ubuntu#Test_to_make_sure_the_SAX_Parser_is_setup_correctly + + +3. Run the Koha installer + + Add a user for installing koha and running zebra: + $ sudo adduser koha + + Build and install Koha: + $ perl Makefile.PL + ( answer questions ) + $ make + $ make test + $ sudo make install + + +4. Configure and start Apache + + This will help make koha available to be a website: + $ sudo ln -s /etc/koha/koha-httpd.conf /etc/apache2/sites-available/koha + + NOTE: the path to koha-httpd.conf may be different depending on + your installation choices. + + Make sure you have this lines in /etc/apache2/ports.conf: + Listen 80 + Listen 8080 + Add the missing one. + + The default installation of Koha does not use named virtual + hosts. If you will not be running named virtual hosts, comment + out the following line: + NameVirtualHost *:80 + + Run the following commands: + $ sudo a2enmod rewrite deflate + $ sudo a2ensite koha + $ sudo apache2ctl restart + + Note: you may still see the usual Apache default site if your + VirtualHost configuration isn't correct. The command + "sudo a2dissite default" may be a quick fix, but may have + side-effects. See the Apache HTTPD manual section on + virtual hosts for full instructions. + + +5. Configure and start Zebra + + This process send responses to search requests sent by Koha or + Z39.50/SRU/SRW clients. + + NOTE: the user you run Zebra as will be the only user with + write permission on the Zebra index; in development mode, + you may wish to use your system user. + + +5.1 Zebra Search Server + + Set the zebra daemon to run on start: + $ sudo ln -s /usr/share/koha/bin/koha-zebra-ctl.sh /etc/init.d/koha-zebra-daemon + $ sudo update-rc.d koha-zebra-daemon defaults + $ sudo /etc/init.d/koha-zebra-daemon start + + NOTE: change the path to koha-zebra-ctl.sh to match your setup + if not using the default. + + +5.2 Zebra Indexer + + There are two ways to do this. ONLY DO ONE! DO NOT DO BOTH! + + Option 1: + You can configure zebra-indexing as an background daemon, see + http://wiki.koha-community.org/wiki/Background_indexing_with_Zebra + + Option 2: + + Add an entry in Koha user crontab to scheduled + added/updated/deleted records indexing by Zebra with this + command: + /misc/migration_tools/rebuild_zebra -z -b -a + + See check misc/cronjobs/crontab.example for usage examples. + + NOTE: This job should be setup under the kohauser + (the default is 'koha'). + + +6. Run the Web Installer, populate the database, + initial configuration of settings + + The hope is that your server is accessible via a nice browser + somewhere. If not, install lynx to finish the web install on + your Koha server: + $ sudo apt-get install lynx + + Point your browser to http://:8080/ + + If you installed lynx, and are using defaults, it might be + something like: + $ lynx http://127.0.1.1:8080/ + + It should redirect you to the Web Installer where you can + continue the setup. You can install the sample data for + libraries, patrons, etc. via the Web Installer + + +7. Install additional languages + + In your install directory you can run this commands to have + your Koha setup translated to your language: + + Set your environment variables: + $ export KOHA_CONF=/etc/koha/sites/koha/koha-conf.xml + $ export PERL5LIB=/usr/share/koha/lib/ + + NOTE: the path to koha-conf.xml may be different depending on + your installation choices. + + Run the translator script: + $ cd /usr/share/koha/misc/translator + $ perl translate install + + must be one of the included in the + misc/translator/po directory. + + NOTE: You can add as many languages as you need. In order to + use them you will have to enable them first in the + 'I18N/L10N' section of the Koha preferences. + + +8. What next? + + NOTE: You can use the 'Stage MARC records for import' from the + Tools area of Koha's Staff Client to import a batch of + MARC records, rather than these instructions. + + Once the installer has completed, you can import and index MARC + records from the command line thusly: + $ export KOHA_CONF=/usr/share/koha/etc/koha-conf.xml + NOTE: use the correct path to your koha-conf.xml + +8.1 Import + + Bibliographic data in MARC21 format: + $ misc/migration_tools/bulkmarcimport.pl -file /path/to/marc.iso2709 + + Authority data in MARC21 format: + $ misc/migration_tools/bulkauthimport.pl -file /path/to/auth.iso2709 + +8.2 Fast Index: + + NOTE: This script must be run as the kohauser otherwise + permission errors and indexing problems will follow. + (the default is 'koha' -- see step 3). + + $ misc/migration_tools/rebuild_zebra.pl -b -w + + Once the indexing has completed, you will be able to search for + records in your system. + + +8.3 Public Z39.50/SRU server + + To enable public Z39.50/SRU servers, you'll need to edit your + koha-conf.xml and change the options to listen on a + TCP port; then restart the zebra daemon. + + +UPGRADE +================================================================= + + If you are running in another language other than English, + please switch to English before doing the upgrade, the + templating system has changed and the templates will need to be + regenerated. + + Once you have upgraded, please regenerate your templates in + your chosen languages. + + +1. Install new Perl dependencies + + If you are upgrading from a previous installation of Koha 3.x, + you can use the following to identify new Perl dependencies: + $ ./koha_perl_deps.pl -u -m + + Install any missing modules using the instructions on sections + 1.6 and 1.7. + + +2. Upgrade Koha + + $ perl Makefile.PL --prev-install-log /path/to/koha-install-log + $ make + $ make test + $ sudo make upgrade + + +3. Pre-3.4 upgrades + + Koha 3.4.x or later no longer stores items in biblio records so + if you are upgrading from an older version as part of the + upgrade you will need to do the following two steps, they can + take a long time (several hours) to complete for large + databases: + $ misc/maintenance/remove_items_from_biblioitems.pl --run + $ misc/migration_tools/rebuild_zebra.pl -b -r + + +Uninstall Instructions +================================================================= + +1. Stop Services: + + Firstly, remove the apache website: + $ sudo a2dissite koha + $ sudo rm /etc/apache2/sites-available/koha + $ sudo apache2ctl restart + + Next, remove the koha-zebra-daemon: + $ sudo update-rc.d koha-zebra-daemon remove + $ sudo rm /etc/init.d/koha-zebra-daemon + + +2a. Remove Database: + + Remember the , + need to be substituted on the following commands: + $ mysql -u -p + mysql> drop database ; + + +2b. Remove Indexes: + + To help determine what should be substituted with, + run the following command: + $ sudo find / -name "zebra-biblios.cfg" + /etc/koha/zebradb/zebra-biblios.cfg + /home/user/koha-3.08.03/etc/zebradb/zebra-biblios.cfg + /home/user/koha-3.08.03/blib/ZEBRA_CONF_DIR/zebra-biblios.cfg + There may be three copies, two of which will likely be in the + user account that installed Koha. In this example, our + is '/etc/koha'. + + Once you know the value of prefix, run these commands + substituting in the correct value: + $ zebraidx -c /zebradb/zebra-biblios.cfg -g iso2709 -d biblios init + $ zebraidx -c /zebradb/zebra-authorities.cfg -g iso2709 -d authorities init + + +3. Remove Koha Install Directories and Configuration Files + Don't forget about any crontab entries + + +Tested on the following operating environments +================================================================= + - Ubuntu Precise Pangolin 12.04 + + +Installer Bug reports +================================================================= + Please log any installer bug reports at + http://bugs.koha-community.org + + +Other Notes +================================================================= +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: + Free Software Foundation + 51 Franklin Street, Fifth Floor + Boston, MA 02110-1301 + USA +Or visit their website: http://www.fsf.org/ diff --git a/Koha/Cache.pm b/Koha/Cache.pm index 740a1335c8..8850c0691b 100644 --- a/Koha/Cache.pm +++ b/Koha/Cache.pm @@ -84,7 +84,7 @@ sub new { } sub is_cache_active { - return $ENV{CACHING_SYSTEM} ? '1' : ''; + return $ENV{CACHING_SYSTEM} ? '1' : undef; } sub set_in_cache { diff --git a/Koha/DateUtils.pm b/Koha/DateUtils.pm index a1fd088fe4..b2c1df8c8a 100644 --- a/Koha/DateUtils.pm +++ b/Koha/DateUtils.pm @@ -80,6 +80,7 @@ sub dt_from_string { } elsif ( $date_format eq 'sql' ) { $date_string =~ s/(\d{4})(\d{2})(\d{2})\s+(\d{2})(\d{2})(\d{2})/$1-$2-$3T$4:$5:$6/; + return if ($date_string =~ /^0000-00-00/); $date_string =~ s/00T/01T/; } } @@ -94,7 +95,8 @@ s/(\d{4})(\d{2})(\d{2})\s+(\d{2})(\d{2})(\d{2})/$1-$2-$3T$4:$5:$6/; $date_string = output_pref($dt, [$format] ); -Returns a string containing the time & date formatted as per the C4::Context setting +Returns a string containing the time & date formatted as per the C4::Context setting, +or C if C was provided. A second parameter allows overriding of the syspref value. This is for testing only In usage use the DateTime objects own methods for non standard formatting @@ -104,6 +106,9 @@ In usage use the DateTime objects own methods for non standard formatting sub output_pref { my $dt = shift; my $force_pref = shift; # if testing we want to override Context + + return unless defined $dt; + my $pref = defined $force_pref ? $force_pref : C4::Context->preference('dateformat'); given ($pref) { @@ -158,6 +163,7 @@ sub format_sqldatetime { my $force_pref = shift; # if testing we want to override Context if ( defined $str && $str =~ m/^\d{4}-\d{2}-\d{2}/ ) { my $dt = dt_from_string( $str, 'sql' ); + return q{} unless $dt; $dt->truncate( to => 'minute' ); return output_pref( $dt, $force_pref ); } diff --git a/Koha/SearchEngine/Solr/Search.pm b/Koha/SearchEngine/Solr/Search.pm index 5c626ba8c8..b177ca43ae 100644 --- a/Koha/SearchEngine/Solr/Search.pm +++ b/Koha/SearchEngine/Solr/Search.pm @@ -38,7 +38,8 @@ sub search { ) : ( "recordid", "id" ); - my $recordtype = ref($filters->{recordtype}) eq 'ARRAY' + my $recordtype; + $recordtype = ref($filters->{recordtype}) eq 'ARRAY' ? $filters->{recordtype}[0] : $filters->{recordtype} if defined $filters && defined $filters->{recordtype}; diff --git a/acqui/histsearch.pl b/acqui/histsearch.pl index 7f799b5f9c..e89bcae394 100755 --- a/acqui/histsearch.pl +++ b/acqui/histsearch.pl @@ -65,6 +65,7 @@ my $isbn = $input->param('isbn'); my $name = $input->param( 'name' ); my $ean = $input->param('ean'); my $basket = $input->param( 'basket' ); +my $basketgroupname = $input->param('basketgroupname'); my $booksellerinvoicenumber = $input->param( 'booksellerinvoicenumber' ); my $do_search = $input->param('do_search') || 0; my $from_placed_on = C4::Dates->new($input->param('from')); @@ -108,6 +109,7 @@ if ($do_search) { to_placed_on => $to_iso, basket => $basket, booksellerinvoicenumber => $booksellerinvoicenumber, + basketgroupname => $basketgroupname, ); } @@ -127,6 +129,7 @@ $template->param( name => $name, basket => $basket, booksellerinvoicenumber => $booksellerinvoicenumber, + basketgroupname => $basketgroupname, from_placed_on => $from_date, to_placed_on => $to_date, DHTMLcalendar_dateformat=> C4::Dates->DHTMLcalendar(), diff --git a/acqui/parcel.pl b/acqui/parcel.pl index bf14ff0993..527aa3cd7e 100755 --- a/acqui/parcel.pl +++ b/acqui/parcel.pl @@ -78,61 +78,17 @@ my $invoice=$input->param('invoice') || ''; my $freight=$input->param('freight'); my $input_gst = ($input->param('gst') eq '' ? undef : $input->param('gst')); my $gst= $input_gst // $bookseller->{gstrate} // C4::Context->preference("gist") // 0; -my $datereceived = ($input->param('op') eq 'new') ? C4::Dates->new($input->param('datereceived')) - : C4::Dates->new($input->param('datereceived'), 'iso') ; +my $datereceived = ($input->param('op') eq ('new' or "search")) ? C4::Dates->new($input->param('datereceived')) + : C4::Dates->new($input->param('datereceived'), 'iso'); $datereceived = C4::Dates->new() unless $datereceived; my $code = $input->param('code'); my @rcv_err = $input->param('error'); my @rcv_err_barcode = $input->param('error_bc'); - my $startfrom=$input->param('startfrom'); my $resultsperpage = $input->param('resultsperpage'); $resultsperpage = 20 unless ($resultsperpage); $startfrom=0 unless ($startfrom); -if($input->param('format') eq "json"){ - my ($template, $loggedinuser, $cookie) - = get_template_and_user({template_name => "acqui/ajax.tmpl", - query => $input, - type => "intranet", - authnotrequired => 0, - flagsrequired => {acquisition => 'order_receive'}, - debug => 1, - }); - - my @datas; - my $search = $input->param('search') || ''; - my $ean = $input->param('ean') || ''; - my $supplier = $input->param('booksellerid') || ''; - my $basketno = $input->param('basketno') || ''; - my $orderno = $input->param('orderno') || ''; - - my $orders = SearchOrder($orderno, $search, $ean, $supplier, $basketno); - foreach my $order (@$orders) { - if ( $order->{quantityreceived} < $order->{quantity} ) { - my $data = {}; - - $data->{basketno} = $order->{basketno}; - $data->{ordernumber} = $order->{ordernumber}; - $data->{title} = $order->{title}; - $data->{author} = $order->{author}; - $data->{isbn} = $order->{isbn}; - $data->{booksellerid} = $order->{booksellerid}; - $data->{biblionumber} = $order->{biblionumber}; - $data->{freight} = $order->{freight}; - $data->{quantity} = $order->{quantity}; - $data->{ecost} = $order->{ecost}; - $data->{ordertotal} = sprintf("%.2f",$order->{ecost}*$order->{quantity}); - push @datas, $data; - } - } - - my $json_text = to_json(\@datas); - $template->param(return => $json_text); - output_html_with_http_headers $input, $cookie, $template->output; - exit; -} - my ($template, $loggedinuser, $cookie) = get_template_and_user({template_name => "acqui/parcel.tmpl", query => $input, @@ -196,7 +152,19 @@ for (my $i = 0 ; $i < $countlines ; $i++) { $tototal += $total; } -my $pendingorders = GetPendingOrders($booksellerid); +# We get the pending orders either all or filtered +my $pendingorders; +if($input->param('op') eq "search"){ + my $search = $input->param('summaryfilter') || ''; + my $ean = $input->param('eanfilter') || ''; + my $basketno = $input->param('basketfilter') || ''; + my $orderno = $input->param('orderfilter') || ''; + my $grouped; + my $owner; + $pendingorders = GetPendingOrders($booksellerid,$grouped,$owner,$basketno,$orderno,$search,$ean); +}else{ + $pendingorders = GetPendingOrders($booksellerid); +} my $countpendings = scalar @$pendingorders; # pending orders totals @@ -252,7 +220,7 @@ for (my $i = 0 ; $i < $countpendings ; $i++) { $line{left_subscription} = 1 if scalar @subscriptions >= 1; $line{subscriptions} = scalar @subscriptions; $line{left_holds} = 1 if $holds >= 1; - $line{left_holds_on_order} = 1 if $line{left_holds}==1 && ($line{items} == 0 || $itemholds ); + $line{left_holds_on_order} = 1 if $line{left_holds} == 1 && ($line{items} == 0 || $itemholds ); $line{holds} = $holds; $line{holds_on_order} = $itemholds?$itemholds:$holds if $line{left_holds_on_order}; @@ -260,7 +228,6 @@ for (my $i = 0 ; $i < $countpendings ; $i++) { push @loop_orders, \%line if ($i >= $startfrom and $i < $startfrom + $resultsperpage); } $freight = $totalfreight unless $freight; - my $count = $countpendings; if ($count>$resultsperpage){ diff --git a/admin/systempreferences.pl b/admin/systempreferences.pl index e12bd5f1cc..f7a7d05838 100755 --- a/admin/systempreferences.pl +++ b/admin/systempreferences.pl @@ -266,18 +266,10 @@ $tabsysprefs{AdvancedSearchTypes} = "Searching"; $tabsysprefs{DisplayMultiPlaceHold} = "Searching"; # EnhancedContent -$tabsysprefs{AmazonEnabled} = "EnhancedContent"; -$tabsysprefs{OPACAmazonEnabled} = "EnhancedContent"; $tabsysprefs{AmazonCoverImages} = "EnhancedContent"; $tabsysprefs{OPACAmazonCoverImages} = "EnhancedContent"; -$tabsysprefs{AWSAccessKeyID} = "EnhancedContent"; -$tabsysprefs{AWSPrivateKey} = "EnhancedContent"; $tabsysprefs{AmazonLocale} = "EnhancedContent"; $tabsysprefs{AmazonAssocTag} = "EnhancedContent"; -$tabsysprefs{AmazonSimilarItems} = "EnhancedContent"; -$tabsysprefs{OPACAmazonSimilarItems} = "EnhancedContent"; -$tabsysprefs{AmazonReviews} = "EnhancedContent"; -$tabsysprefs{OPACAmazonReviews} = "EnhancedContent"; # Babelthèque $tabsysprefs{Babeltheque} = "EnhancedContent"; @@ -335,7 +327,6 @@ $tabsysprefs{opaccredits} = "OPAC"; $tabsysprefs{opaclayoutstylesheet} = "OPAC"; $tabsysprefs{OpacNav} = "OPAC"; $tabsysprefs{opacsmallimage} = "OPAC"; -$tabsysprefs{opacstylesheet} = "OPAC"; $tabsysprefs{opacthemes} = "OPAC"; $tabsysprefs{opacuserjs} = "OPAC"; $tabsysprefs{opacheader} = "OPAC"; diff --git a/authorities/auth_finder.pl b/authorities/auth_finder.pl index a3821ee74a..8182299685 100755 --- a/authorities/auth_finder.pl +++ b/authorities/auth_finder.pl @@ -35,6 +35,7 @@ my $authtypecode = $query->param('authtypecode'); my $index = $query->param('index'); my $tagid = $query->param('tagid'); my $resultstring = $query->param('result'); +my $relationship = $query->param('relationship'); my $dbh = C4::Context->dbh; my $startfrom = $query->param('startfrom'); @@ -192,6 +193,9 @@ $template->param( authtypecode => $authtypecode, ); +$template->{VARS}->{source} = $query->param('source') || ''; +$template->{VARS}->{relationship} = $query->param('relationship') || ''; + # Print the page output_html_with_http_headers $query, $cookie, $template->output; diff --git a/authorities/authorities-home.pl b/authorities/authorities-home.pl index d687c78033..bc565d156f 100755 --- a/authorities/authorities-home.pl +++ b/authorities/authorities-home.pl @@ -31,20 +31,24 @@ use C4::Acquisition; use C4::Koha; # XXX subfield_is_koha_internal_p use C4::Biblio; -my $query = new CGI; -my $op = $query->param('op'); +my $query = new CGI; +my $op = $query->param('op'); $op ||= q{}; my $authtypecode = $query->param('authtypecode'); $authtypecode ||= q{}; -my $dbh = C4::Context->dbh; +my $dbh = C4::Context->dbh; my $authid = $query->param('authid'); my ( $template, $loggedinuser, $cookie ); my $authtypes = getauthtypes; my @authtypesloop; -foreach my $thisauthtype ( sort { $authtypes->{$a}{'authtypetext'} cmp $authtypes->{$b}{'authtypetext'} } - keys %$authtypes ) +foreach my $thisauthtype ( + sort { + $authtypes->{$a}{'authtypetext'} cmp $authtypes->{$b}{'authtypetext'} + } + keys %$authtypes + ) { my %row = ( value => $thisauthtype, @@ -54,6 +58,21 @@ foreach my $thisauthtype ( sort { $authtypes->{$a}{'authtypetext'} cmp $authtype push @authtypesloop, \%row; } +if ( $op eq "delete" ) { + ( $template, $loggedinuser, $cookie ) = get_template_and_user( + { + template_name => "authorities/authorities-home.tmpl", + query => $query, + type => 'intranet', + authnotrequired => 0, + flagsrequired => { catalogue => 1 }, + debug => 1, + } + ); + &DelAuthority( $authid, 1 ); + + $op = "do_search"; +} if ( $op eq "do_search" ) { my @marclist = $query->param('marclist'); my @and_or = $query->param('and_or'); @@ -69,7 +88,7 @@ if ( $op eq "do_search" ) { SearchAuthorities( \@marclist, \@and_or, \@excluding, \@operator, \@value, ( $startfrom - 1 ) * $resultsperpage, $resultsperpage, $authtypecode, $orderby ); -# use Data::Dumper; warn Data::Dumper::Dumper(@$results); + ( $template, $loggedinuser, $cookie ) = get_template_and_user( { template_name => "authorities/searchresultlist.tmpl", @@ -81,6 +100,18 @@ if ( $op eq "do_search" ) { } ); + $template->param( + marclist => $query->param('marclist'), + and_or => $query->param('and_or'), + excluding => $query->param('excluding'), + operator => $query->param('operator'), + orderby => $query->param('orderby'), + value => $query->param('value'), + authtypecode => $query->param('authtypecode'), + startfrom => $startfrom, + resultsperpage => $resultsperpage, + ); + my @field_data = (); # we must get parameters once again. Because if there is a mainentry, it @@ -88,19 +119,19 @@ if ( $op eq "do_search" ) { # next/previous would not work anymore my @marclist_ini = $query->param('marclist'); for ( my $i = 0 ; $i <= $#marclist ; $i++ ) { - if ($value[$i]){ - push @field_data, { term => "marclist", val => $marclist_ini[$i] }; - if (!defined $and_or[$i]) { - $and_or[$i] = q{}; - } - push @field_data, { term => "and_or", val => $and_or[$i] }; - if (!defined $excluding[$i]) { - $excluding[$i] = q{}; - } - push @field_data, { term => "excluding", val => $excluding[$i] }; - push @field_data, { term => "operator", val => $operator[$i] }; - push @field_data, { term => "value", val => $value[$i] }; - } + if ( $value[$i] ) { + push @field_data, { term => "marclist", val => $marclist_ini[$i] }; + if ( !defined $and_or[$i] ) { + $and_or[$i] = q{}; + } + push @field_data, { term => "and_or", val => $and_or[$i] }; + if ( !defined $excluding[$i] ) { + $excluding[$i] = q{}; + } + push @field_data, { term => "excluding", val => $excluding[$i] }; + push @field_data, { term => "operator", val => $operator[$i] }; + push @field_data, { term => "value", val => $value[$i] }; + } } # construction of the url of each page @@ -121,7 +152,7 @@ if ( $op eq "do_search" ) { my $from = ( $startfrom - 1 ) * $resultsperpage + 1; my $to; - if (!defined $total) { + if ( !defined $total ) { $total = 0; } @@ -146,20 +177,7 @@ if ( $op eq "do_search" ) { ); } -elsif ( $op eq "delete" ) { - ( $template, $loggedinuser, $cookie ) = get_template_and_user( - { - template_name => "authorities/authorities-home.tmpl", - query => $query, - type => 'intranet', - authnotrequired => 0, - flagsrequired => { catalogue => 1 }, - debug => 1, - } - ); - &DelAuthority( $authid, 1 ); -} -else { +if ( $op eq '' ) { ( $template, $loggedinuser, $cookie ) = get_template_and_user( { template_name => "authorities/authorities-home.tmpl", @@ -173,9 +191,7 @@ else { } -$template->param( - authtypesloop => \@authtypesloop, -); +$template->param( authtypesloop => \@authtypesloop, ); $template->{VARS}->{marcflavour} = C4::Context->preference("marcflavour"); diff --git a/authorities/blinddetail-biblio-search.pl b/authorities/blinddetail-biblio-search.pl index 7de7db3095..4aa2093ef9 100755 --- a/authorities/blinddetail-biblio-search.pl +++ b/authorities/blinddetail-biblio-search.pl @@ -54,6 +54,7 @@ my $dbh = C4::Context->dbh; my $authid = $query->param('authid'); my $index = $query->param('index'); my $tagid = $query->param('tagid'); +my $relationship = $query->param('relationship'); my $authtypecode = &GetAuthTypeCode($authid); my $tagslib = &GetTagsLabels( 1, $authtypecode ); @@ -95,6 +96,8 @@ if ($authid) { my $letter = $_ || '@'; push( @subfield_loop, {marc_subfield => $letter, marc_values => $subfields{$_}} ); } + + push( @subfield_loop, { marc_subfield => 'w', marc_values => $relationship } ) if ( $relationship ); } else { # authid is empty => the user want to empty the entry. diff --git a/authorities/ysearch.pl b/authorities/ysearch.pl index c9e7c47063..65841232f9 100755 --- a/authorities/ysearch.pl +++ b/authorities/ysearch.pl @@ -69,9 +69,9 @@ my $i = 0; foreach my $result (@$results) { if($i > 0){ print ","; } my $value = ''; - my $authorized = $result->{'summary'}->{authorized}; + my $authorized = $result->{'summary'}->{'authorized'}; foreach my $heading (@$authorized) { - $value .= $heading . ' '; + $value .= $heading->{'heading'} . ' '; } $value = "{\"summary\":\"" . $value . "\"" . "}"; print nsb_clean($value) . "\n"; diff --git a/catalogue/detail.pl b/catalogue/detail.pl index d110740ee8..f2ad4ebe5f 100755 --- a/catalogue/detail.pl +++ b/catalogue/detail.pl @@ -325,7 +325,7 @@ foreach ( keys %{$dat} ) { # does not work: my %views_enabled = map { $_ => 1 } $template->query(loop => 'EnableViews'); # method query not found?!?! - +$template->param( AmazonTld => get_amazon_tld() ) if ( C4::Context->preference("AmazonCoverImages")); $template->param( itemloop => \@itemloop, biblionumber => $biblionumber, @@ -352,45 +352,6 @@ if (C4::Context->preference("FRBRizeEditions")==1) { }; if ($@) { warn "XISBN Failed $@"; } } -if ( C4::Context->preference("AmazonEnabled") == 1 ) { - $template->param( AmazonTld => get_amazon_tld() ); - my $amazon_reviews = C4::Context->preference("AmazonReviews"); - my $amazon_similars = C4::Context->preference("AmazonSimilarItems"); - my @services; - if ( $amazon_reviews ) { - $template->param( AmazonReviews => 1 ); - push( @services, 'EditorialReview' ); - } - if ( $amazon_similars ) { - $template->param( AmazonSimilarItems => 1 ); - push( @services, 'Similarities' ); - } - my $amazon_details = &get_amazon_details( $isbn, $record, $marcflavour, \@services ); - if ( $amazon_similars ) { - my $similar_products_exist; - my @similar_products; - for my $similar_product (@{$amazon_details->{Items}->{Item}->[0]->{SimilarProducts}->{SimilarProduct}}) { - # do we have any of these isbns in our collection? - my $similar_biblionumbers = get_biblionumber_from_isbn($similar_product->{ASIN}); - # verify that there is at least one similar item - if (scalar(@$similar_biblionumbers)){ - $similar_products_exist++ if ($similar_biblionumbers && $similar_biblionumbers->[0]); - push @similar_products, +{ similar_biblionumbers => $similar_biblionumbers, title => $similar_product->{Title}, ASIN => $similar_product->{ASIN} }; - } - } - $template->param( AmazonSimilarItems => $similar_products_exist ); - $template->param( AMAZON_SIMILAR_PRODUCTS => \@similar_products ); - } - if ( $amazon_reviews ) { - my $item = $amazon_details->{Items}->{Item}->[0]; - my $editorial_reviews = \@{ $item->{EditorialReviews}->{EditorialReview} }; - #my $customer_reviews = \@{$amazon_details->{Items}->{Item}->[0]->{CustomerReviews}->{Review}}; - #my $average_rating = $amazon_details->{Items}->{Item}->[0]->{CustomerReviews}->{AverageRating} || 0; - #$template->param( amazon_average_rating => $average_rating * 20 ); - #$template->param( AMAZON_CUSTOMER_REVIEWS => $customer_reviews ); - $template->param( AMAZON_EDITORIAL_REVIEWS => $editorial_reviews ); - } -} if ( C4::Context->preference("LocalCoverImages") == 1 ) { my @images = ListImagesForBiblio($biblionumber); diff --git a/catalogue/moredetail.pl b/catalogue/moredetail.pl index 809430cf05..3eee676f5d 100755 --- a/catalogue/moredetail.pl +++ b/catalogue/moredetail.pl @@ -28,7 +28,7 @@ use C4::Items; use C4::Branch; use C4::Acquisition; use C4::Bookseller qw(GetBookSellerFromId); -use C4::Output; # contains gettemplate +use C4::Output; use C4::Auth; use C4::Serials; use C4::Circulation; # to use itemissues diff --git a/cataloguing/addbooks.pl b/cataloguing/addbooks.pl index 79534a4470..7bca2f3f46 100755 --- a/cataloguing/addbooks.pl +++ b/cataloguing/addbooks.pl @@ -70,8 +70,7 @@ if ($query) { # build query my @operands = $query; - my (@operators, @indexes, @sort_by, @limits) = (); - my ( $builterror,$builtquery,$simple_query,$query_cgi,$query_desc,$limit,$limit_cgi,$limit_desc,$stopwords_removed,$query_type) = buildQuery(\@operators,\@operands,\@indexes,@limits,\@sort_by,undef,undef); + my ( $builterror,$builtquery,$simple_query,$query_cgi,$query_desc,$limit,$limit_cgi,$limit_desc,$stopwords_removed,$query_type) = buildQuery(undef,\@operands); # find results my ( $error, $marcresults, $total_hits ) = SimpleSearch($builtquery, $results_per_page * ($page - 1), $results_per_page); diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl index 684e6f62df..7b7dbac671 100755 --- a/cataloguing/additem.pl +++ b/cataloguing/additem.pl @@ -33,6 +33,9 @@ use C4::ClassSource; use C4::Dates; use List::MoreUtils qw/any/; use C4::Search; +use Storable qw(thaw freeze); +use URI::Escape; + use MARC::File::XML; use URI::Escape; @@ -277,6 +280,33 @@ sub generate_subfield_form { return \%subfield_data; } +# Removes some subfields when prefilling items +# This function will remove any subfield that is not in the SubfieldsToUseWhenPrefill syspref +sub removeFieldsForPrefill { + + my $item = shift; + + # Getting item tag + my ($tag, $subtag) = GetMarcFromKohaField("items.barcode", ''); + + # Getting list of subfields to keep + my $subfieldsToUseWhenPrefill = C4::Context->preference('SubfieldsToUseWhenPrefill'); + + # Removing subfields that are not in the syspref + if ($tag && $subfieldsToUseWhenPrefill) { + my $field = $item->field($tag); + my @subfieldsToUse= split(/ /,$subfieldsToUseWhenPrefill); + foreach my $subfield ($field->subfields()) { + if (!grep { $subfield->[0] eq $_ } @subfieldsToUse) { + $field->delete_subfield(code => $subfield->[0]); + } + + } + } + + return $item; + +} my $input = new CGI; my $error = $input->param('error'); @@ -315,9 +345,26 @@ my $oldrecord = TransformMarcToKoha($dbh,$record); my $itemrecord; my $nextop="additem"; my @errors; # store errors found while checking data BEFORE saving item. + +# Getting last created item cookie +my $prefillitem = C4::Context->preference('PrefillItem'); +my $justaddeditem; +my $cookieitemrecord; +if ($prefillitem) { + my $lastitemcookie = $input->cookie('LastCreatedItem'); + if ($lastitemcookie) { + $lastitemcookie = uri_unescape($lastitemcookie); + if ( thaw($lastitemcookie) ) { + $cookieitemrecord = thaw($lastitemcookie) ; + $cookieitemrecord = removeFieldsForPrefill($cookieitemrecord); + } + } +} + #------------------------------------------------------------------------------- if ($op eq "additem") { -#------------------------------------------------------------------------------- + + #------------------------------------------------------------------------------- # rebuild my @tags = $input->param('tag'); my @subfields = $input->param('subfield'); @@ -334,26 +381,55 @@ if ($op eq "additem") { my $add_multiple_copies_submit = $input->param('add_multiple_copies_submit'); my $number_of_copies = $input->param('number_of_copies'); + # This is a bit tricky : if there is a cookie for the last created item and + # we just added an item, the cookie value is not correct yet (it will be updated + # next page). To prevent the form from being filled with outdated values, we + # force the use of "add and duplicate" feature, so the form will be filled with + # correct values. + $add_duplicate_submit = 1 if ($prefillitem); + $justaddeditem = 1; + + # if autoBarcode is set to 'incremental', calculate barcode... + if ( C4::Context->preference('autoBarcode') eq 'incremental' ) { + $record = _increment_barcode($record, $frameworkcode); + } + + if (C4::Context->preference('autoBarcode') eq 'incremental') { $record = _increment_barcode($record, $frameworkcode); } - my $addedolditem = TransformMarcToKoha($dbh,$record); + my $addedolditem = TransformMarcToKoha( $dbh, $record ); # If we have to add or add & duplicate, we add the item - if ($add_submit || $add_duplicate_submit) { - # check for item barcode # being unique - my $exist_itemnumber = get_item_from_barcode($addedolditem->{'barcode'}); - push @errors,"barcode_not_unique" if($exist_itemnumber); - # if barcode exists, don't create, but report The problem. - unless ($exist_itemnumber) { - my ($oldbiblionumber,$oldbibnum,$oldbibitemnum) = AddItemFromMarc($record,$biblionumber); - set_item_default_location($oldbibitemnum); - } - $nextop = "additem"; - if ($exist_itemnumber) { - $itemrecord = $record; - } + if ( $add_submit || $add_duplicate_submit ) { + + # check for item barcode # being unique + my $exist_itemnumber = get_item_from_barcode( $addedolditem->{'barcode'} ); + push @errors, "barcode_not_unique" if ($exist_itemnumber); + + # if barcode exists, don't create, but report The problem. + unless ($exist_itemnumber) { + my ( $oldbiblionumber, $oldbibnum, $oldbibitemnum ) = AddItemFromMarc( $record, $biblionumber ); + set_item_default_location($oldbibitemnum); + + # Pushing the last created item cookie back + if ($prefillitem && defined $record) { + my $itemcookie = $input->cookie( + -name => 'LastCreatedItem', + # We uri_escape the whole freezed structure so we're sure we won't have any encoding problems + -value => uri_escape_utf8( freeze( $record ) ), + -expires => '' + ); + + $cookie = [ $cookie, $itemcookie ]; + } + + } + $nextop = "additem"; + if ($exist_itemnumber) { + $itemrecord = $record; + } } # If we have to add & duplicate @@ -370,6 +446,7 @@ if ($op eq "additem") { $fieldItem->delete_subfields($tagsubfield); $itemrecord->insert_fields_ordered($fieldItem); } + $itemrecord = removeFieldsForPrefill($itemrecord) if ($prefillitem); } # If we have to add multiple copies @@ -696,6 +773,11 @@ if($itemrecord){ } # and now we add fields that are empty +# Using last created item if it exists + +$itemrecord = $cookieitemrecord if ($prefillitem and not $justaddeditem and $op ne "edititem"); + +# We generate form, and fill with values if defined foreach my $tag ( keys %{$tagslib}){ foreach my $subtag (keys %{$tagslib->{$tag}}){ next if subfield_is_koha_internal_p($subtag); diff --git a/cataloguing/value_builder/barcode.pl b/cataloguing/value_builder/barcode.pl index c5e1fd3834..5aeae9f61e 100755 --- a/cataloguing/value_builder/barcode.pl +++ b/cataloguing/value_builder/barcode.pl @@ -22,8 +22,11 @@ use warnings; no warnings 'redefine'; # otherwise loading up multiple plugins fills the log with subroutine redefine warnings use C4::Context; +require C4::Barcodes::ValueBuilder; require C4::Dates; +use Algorithm::CheckDigits; + my $DEBUG = 0; =head1 @@ -55,14 +58,14 @@ the 3 scripts are inserted after the in the html code sub plugin_javascript { my ($dbh,$record,$tagslib,$field_number,$tabloop) = @_; my $function_name= "barcode".(int(rand(100000))+1); + my %args; # find today's date - my ($year, $mon, $day) = split('-', C4::Dates->today('iso')); - my ($tag,$subfield) = GetMarcFromKohaField("items.barcode", ''); - my ($loctag,$locsubfield) = GetMarcFromKohaField("items.homebranch", ''); + ($args{year}, $args{mon}, $args{day}) = split('-', C4::Dates->today('iso')); + ($args{tag},$args{subfield}) = GetMarcFromKohaField("items.barcode", ''); + ($args{loctag},$args{locsubfield}) = GetMarcFromKohaField("items.homebranch", ''); my $nextnum; - my $query; my $scr; my $autoBarcodeType = C4::Context->preference("autoBarcode"); warn "Barcode type = $autoBarcodeType" if $DEBUG; @@ -77,51 +80,34 @@ sub plugin_javascript { "); } if ($autoBarcodeType eq 'annual') { - $query = "select max(cast( substring_index(barcode, '-',-1) as signed)) from items where barcode like ?"; - my $sth=$dbh->prepare($query); - $sth->execute("$year%"); - while (my ($count)= $sth->fetchrow_array) { - warn "Examining Record: $count" if $DEBUG; - $nextnum = $count if $count; - } - $nextnum++; - $nextnum = sprintf("%0*d", "4",$nextnum); - $nextnum = "$year-$nextnum"; + ($nextnum, $scr) = C4::Barcodes::ValueBuilder::annual::get_barcode(\%args); } elsif ($autoBarcodeType eq 'incremental') { - # not the best, two catalogers could add the same barcode easily this way :/ - $query = "select max(abs(barcode)) from items"; - my $sth = $dbh->prepare($query); - $sth->execute(); - while (my ($count)= $sth->fetchrow_array) { - $nextnum = $count; - } - $nextnum++; + ($nextnum, $scr) = C4::Barcodes::ValueBuilder::incremental::get_barcode(\%args); } elsif ($autoBarcodeType eq 'hbyymmincr') { # Generates a barcode where hb = home branch Code, yymm = year/month catalogued, incr = incremental number, reset yearly -fbcit - $year = substr($year, -2); - $query = "SELECT MAX(CAST(SUBSTRING(barcode,-4) AS signed)) AS number FROM items WHERE barcode REGEXP ?"; + ($nextnum, $scr) = C4::Barcodes::ValueBuilder::hbyymmincr::get_barcode(\%args); + } + elsif ($autoBarcodeType eq 'EAN13') { + # not the best, two catalogers could add the same barcode easily this way :/ + my $query = "select max(abs(barcode)) from items"; my $sth = $dbh->prepare($query); - $sth->execute("^[-a-zA-Z]{1,}$year"); - while (my ($count)= $sth->fetchrow_array) { - $nextnum = $count if $count; - $nextnum = 0 if $nextnum == 9999; # this sequence only allows for cataloging 10000 books per month - warn "Existing incremental number = $nextnum" if $DEBUG; + $sth->execute(); + while (my ($last)= $sth->fetchrow_array) { + $nextnum = $last; } - $nextnum++; - $nextnum = sprintf("%0*d", "4",$nextnum); - $nextnum = $year . $mon . $nextnum; - warn "New hbyymmincr Barcode = $nextnum" if $DEBUG; - $scr = " - for (i=0 ; iis_valid($nextnum) ) { + my $next = $ean->basenumber( $nextnum ) + 1; + $nextnum = $ean->complete( $next ); + $nextnum = '0' x ( 13 - length($nextnum) ) . $nextnum; # pad zeros + } else { + warn "ERROR: invalid EAN-13 $nextnum, using increment"; + $nextnum++; } - if (\$('#' + id).val() == '' || force) { - \$('#' + id).val(document.f.field_value[fnum].value + '$nextnum'); - } - "; + } + else { + warn "ERROR: unknown autoBarcode: $autoBarcodeType"; } # default js body (if not filled by hbyymmincr) diff --git a/cataloguing/value_builder/barcode_manual.pl b/cataloguing/value_builder/barcode_manual.pl new file mode 100755 index 0000000000..7b2e465641 --- /dev/null +++ b/cataloguing/value_builder/barcode_manual.pl @@ -0,0 +1,132 @@ +#!/usr/bin/perl +# Copyright 2000-2002 Katipo Communications +# Parts copyright 2008-2010 Foundations Bible College +# +# 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; +no warnings 'redefine'; # otherwise loading up multiple plugins fills the log with subroutine redefine warnings + +use C4::Context; +require C4::Barcodes::ValueBuilder; +require C4::Dates; + +my $DEBUG = 0; + +=head1 + +plugin_parameters : other parameters added when the plugin is called by the dopop function + +=cut + +sub plugin_parameters { +# my ($dbh,$record,$tagslib,$i,$tabloop) = @_; + return ""; +} + +=head1 + +plugin_javascript : the javascript function called when the user enters the subfield. +contain 3 javascript functions : +* one called when the field is entered (OnFocus). Named FocusXXX +* one called when the field is leaved (onBlur). Named BlurXXX +* one called when the ... link is clicked () named ClicXXX + +returns : +* XXX +* a variable containing the 3 scripts. +the 3 scripts are inserted after the in the html code + +=cut + +sub plugin_javascript { + my ($dbh,$record,$tagslib,$field_number,$tabloop) = @_; + my $function_name= "barcode".(int(rand(100000))+1); + my %args; + + $args{dbh} = $dbh; + +# find today's date + ($args{year}, $args{mon}, $args{day}) = split('-', C4::Dates->today('iso')); + ($args{tag},$args{subfield}) = GetMarcFromKohaField("items.barcode", ''); + ($args{loctag},$args{locsubfield}) = GetMarcFromKohaField("items.homebranch", ''); + + my $nextnum; + my $scr; + my $autoBarcodeType = C4::Context->preference("autoBarcode"); + warn "Barcode type = $autoBarcodeType" if $DEBUG; + if ((not $autoBarcodeType) or $autoBarcodeType eq 'OFF') { +# don't return a value unless we have the appropriate syspref set + return ($function_name, + ""); + } + if ($autoBarcodeType eq 'annual') { + ($nextnum, $scr) = C4::Barcodes::ValueBuilder::annual::get_barcode(\%args); + } + elsif ($autoBarcodeType eq 'incremental') { + ($nextnum, $scr) = C4::Barcodes::ValueBuilder::incremental::get_barcode(\%args); + } + elsif ($autoBarcodeType eq 'hbyymmincr') { # Generates a barcode where hb = home branch Code, yymm = year/month catalogued, incr = incremental number, reset yearly -fbcit + ($nextnum, $scr) = C4::Barcodes::ValueBuilder::hbyymmincr::get_barcode(\%args); + } + +# default js body (if not filled by hbyymmincr) + $scr or $scr = < + // + +END_OF_JS + return ($function_name, $js); +} + +=head1 + +plugin: useless here + +=cut + +sub plugin { +# my ($input) = @_; + return ""; +} + +1; diff --git a/cataloguing/z3950_search.pl b/cataloguing/z3950_search.pl index a44b5ea50c..5e22636b5a 100755 --- a/cataloguing/z3950_search.pl +++ b/cataloguing/z3950_search.pl @@ -117,10 +117,14 @@ else { my $s = 0; my $query = ''; my $nterms; - if ($isbn || $issn) { - $term=$isbn if ($isbn); - $term=$issn if ($issn); - $query .= " \@or \@attr 1=8 \"$term\" \@attr 1=7 \"$term\" "; + if ($isbn) { + $term=$isbn; + $query .= " \@attr 1=7 \@attr 5=1 \"$term\" "; + $nterms++; + } + if ($issn) { + $term=$issn; + $query .= " \@attr 1=8 \@attr 5=1 \"$term\" "; $nterms++; } if ($title) { diff --git a/circ/circulation.pl b/circ/circulation.pl index 551cebab1c..78ac1a4db9 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -148,8 +148,6 @@ if($duedatespec_allow){ if ($duedatespec) { if ($duedatespec =~ C4::Dates->regexp('syspref')) { $datedue = dt_from_string($duedatespec); - $datedue->set_hour(23); - $datedue->set_minute(59); } else { $invalidduedate = 1; $template->param(IMPOSSIBLE=>1, INVALID_DATE=>$duedatespec); diff --git a/circ/pendingreserves.pl b/circ/pendingreserves.pl index 52a045044c..61bace969a 100755 --- a/circ/pendingreserves.pl +++ b/circ/pendingreserves.pl @@ -142,6 +142,7 @@ if ( $run_report ) { AND items.itemnumber NOT IN (SELECT itemnumber FROM branchtransfers where datearrived IS NULL) AND issues.itemnumber IS NULL AND reserves.priority <> 0 + AND reserves.suspend = 0 AND notforloan = 0 AND damaged = 0 AND itemlost = 0 AND wthdrawn = 0 "; # GROUP BY reserves.biblionumber allows only items that are not checked out, else multiples occur when diff --git a/circ/returns.pl b/circ/returns.pl index 1fbdcaf6ad..743bf180ba 100755 --- a/circ/returns.pl +++ b/circ/returns.pl @@ -573,6 +573,7 @@ foreach ( sort { $a <=> $b } keys %returneditems ) { # my %ri; my $biblio = GetBiblioFromItemNumber(GetItemnumberFromBarcode($bar_code)); + my $item = GetItem( GetItemnumberFromBarcode($bar_code) ); # fix up item type for display $biblio->{'itemtype'} = C4::Context->preference('item-level_itypes') ? $biblio->{'itype'} : $biblio->{'itemtype'}; $ri{itembiblionumber} = $biblio->{'biblionumber'}; @@ -584,6 +585,8 @@ foreach ( sort { $a <=> $b } keys %returneditems ) { $ri{ccode} = $biblio->{'ccode'}; $ri{itemnumber} = $biblio->{'itemnumber'}; $ri{barcode} = $bar_code; + $ri{homebranch} = $item->{'homebranch'}; + $ri{holdingbranch} = $item->{'holdingbranch'}; $ri{location} = $biblio->{'location'}; my $shelfcode = $ri{'location'}; diff --git a/debian/scripts/koha-create b/debian/scripts/koha-create index bb2b642082..b0c418c1bc 100755 --- a/debian/scripts/koha-create +++ b/debian/scripts/koha-create @@ -163,7 +163,7 @@ opacdomain="$OPACPREFIX$name$OPACSUFFIX$DOMAIN" intradomain="$INTRAPREFIX$name$INTRASUFFIX$DOMAIN" -if [ `cat $PASSWDFILE | grep "^$name:"` ] +if [ -f $PASSWDFILE ] && [ `cat $PASSWDFILE | grep "^$name:"` ] then passwdline=`cat $PASSWDFILE | grep "^$name:"` mysqluser=`echo $passwdline | cut -d ":" -f 2` @@ -221,11 +221,15 @@ then # Generate Zebra database password. zebrapwd="$(pwgen -s 12 1)" + # Future enhancement: make this configurable for when your db is on + # another server. + mysql_hostname="localhost" # Set up MySQL database for this instance. if [ "$op" = create ] then mysql --defaults-extra-file=/etc/mysql/koha-common.cnf < /dev/null && deluser --quiet "$name-koha" # in case the site has already been disabled, we don't want to break the loop now. - a2dissite "$name" | /bin/true + a2dissite "$name" || /bin/true done service apache2 restart diff --git a/edithelp.pl b/edithelp.pl index 5cde3149d4..28586b3910 100755 --- a/edithelp.pl +++ b/edithelp.pl @@ -67,7 +67,7 @@ sub _get_filepath ($;$) { $referer =~ /koha\/(.*)\.pl/; my $from = "help/$1.tt"; my $htdocs = C4::Context->config('intrahtdocs'); - my ($theme, $lang) = C4::Templates::themelanguage( $htdocs, $from, "intranet", $input ); + my ($theme, $lang, $availablethemes) = C4::Templates::themelanguage( $htdocs, $from, "intranet", $input ); $debug and print STDERR "help filepath: $htdocs/$theme/$lang/modules/$from"; return "$htdocs/$theme/$lang/modules/$from"; } diff --git a/etc/koha-conf.xml b/etc/koha-conf.xml index bb79355a9a..a54c173357 100644 --- a/etc/koha-conf.xml +++ b/etc/koha-conf.xml @@ -189,7 +189,7 @@ __PAZPAR2_TOGGLE_XML_POST__ __ZEBRA_DATA_DIR__/biblios __ZEBRA_CONF_DIR__/__ZEBRA_BIB_CFG__ __ZEBRA_CONF_DIR__/pqf.properties - diff --git a/etc/zebradb/marc_defs/marc21/authorities/record.abs b/etc/zebradb/marc_defs/marc21/authorities/record.abs index c50384709a..dcd2c24a3d 100644 --- a/etc/zebradb/marc_defs/marc21/authorities/record.abs +++ b/etc/zebradb/marc_defs/marc21/authorities/record.abs @@ -23,46 +23,46 @@ melm 001 Local-Number,Local-Number:s melm 942$a authtype:w,authtype:p # Personal Name -melm 100$a Personal-name-heading:w,Personal-name-heading:p,Personal-name-heading:s,Personal-name:w,Personal-name:p,Heading:w,Heading:p,Heading:s,Heading-Main:w,Heading-Main:p,Heading-Main:s -melm 100 Personal-name:w,Personal-name:p,Personal-name:s,Heading:w,Heading:p,Heading:s -melm 400 Personal-name-see-from:w,Personal-name-see-from:p,Personal-name-see-from:s,See-from:w,See-from:p,See-from:s -melm 500 Personal-name-see-also-from:w,Personal-name-see-also-from:p,Personal-name-see-also-from:s,See-also-from:w,See-also-from:p,See-also-from:s +melm 100$a Personal-name-heading:w,Personal-name-heading:p,Personal-name-heading:s,Personal-name:w,Personal-name:p,Heading:w,Heading:p,Heading:s,Heading-Main:w,Heading-Main:p,Heading-Main:s,Match:w,Match:p,Match-heading:w,Match-heading:p +melm 100 Personal-name:w,Personal-name:p,Personal-name:s,Heading:w,Heading:p,Heading:s,Match:w,Match:p,Match-heading:w,Match-heading:p +melm 400 Personal-name-see-from:w,Personal-name-see-from:p,Personal-name-see-from:s,See-from:w,See-from:p,See-from:s,Match:w,Match:p +melm 500 Personal-name-see-also-from:w,Personal-name-see-also-from:p,Personal-name-see-also-from:s,See-also-from:w,See-also-from:p,See-also-from:s,Match:w,Match:p # Corporate Name -melm 110$a Corporate-name-heading:w,Corporate-name-heading:p,Corporate-name-heading:s,Corporate-name:w,Corporate-name:p,Heading:w,Heading:p,Heading:s,Heading-Main:w,Heading-Main:p,Heading-Main:s -melm 110 Corporate-name:w,Corporate-name:p,Corporate-name:s,Heading:w,Heading:p,Heading:s -melm 410 Corporate-name-see-from:w,Corporate-name-see-from:p,Corporate-name-see-from:s,See-from:w,See-from:p,See-from:s -melm 510 Corporate-name-see-also-from:w,Corporate-name-see-also-from:p,Corporate-name-see-also-from:s,See-also-from:w,See-also-from:p,See-also-from:s +melm 110$a Corporate-name-heading:w,Corporate-name-heading:p,Corporate-name-heading:s,Corporate-name:w,Corporate-name:p,Heading:w,Heading:p,Heading:s,Heading-Main:w,Heading-Main:p,Heading-Main:s,Match:w,Match:p,Match-heading:w,Match-heading:p +melm 110 Corporate-name:w,Corporate-name:p,Corporate-name:s,Heading:w,Heading:p,Heading:s,Match:w,Match:p,Match-heading:w,Match-heading:p +melm 410 Corporate-name-see-from:w,Corporate-name-see-from:p,Corporate-name-see-from:s,See-from:w,See-from:p,See-from:s,Match:w,Match:p +melm 510 Corporate-name-see-also-from:w,Corporate-name-see-also-from:p,Corporate-name-see-also-from:s,See-also-from:w,See-also-from:p,See-also-from:s,Match:w,Match:p # Meeting Name -melm 111$a Meeting-name-heading:w,Meeting-name-heading:p,Meeting-name-heading:s,Meeting-name:w,Meeting-name:p,Heading:w,Heading:p,Heading:s,Heading-Main:w,Heading-Main:p,Heading-Main:s -melm 111 Meeting-name:w,Meeting-name:p,Meeting-name:s,Heading:w,Heading:p,Heading:s -melm 411 Meeting-name-see-from:w,Meeting-name-see-from:p,Meeting-name-see-from:s,See-from:w,See-from:p,See-from:s -melm 511 Meeting-name-see-also-from:w,Meeting-name-see-also-from:p,Meeting-name-see-also-from:s,See-also-from:w,See-also-from:p,See-also-from:s +melm 111$a Meeting-name-heading:w,Meeting-name-heading:p,Meeting-name-heading:s,Meeting-name:w,Meeting-name:p,Heading:w,Heading:p,Heading:s,Heading-Main:w,Heading-Main:p,Heading-Main:s,Match:w,Match:p,Match-heading:w,Match-heading:p +melm 111 Meeting-name:w,Meeting-name:p,Meeting-name:s,Heading:w,Heading:p,Heading:s,Match:w,Match:p,Match-heading:w,Match-heading:p +melm 411 Meeting-name-see-from:w,Meeting-name-see-from:p,Meeting-name-see-from:s,See-from:w,See-from:p,See-from:s,Match:w,Match:p +melm 511 Meeting-name-see-also-from:w,Meeting-name-see-also-from:p,Meeting-name-see-also-from:s,See-also-from:w,See-also-from:p,See-also-from:s,Match:w,Match:p # Uniform Title -melm 130$a Title-uniform-heading:w,Title-uniform-heading:p,Title-uniform-heading:s,Title-uniform:w,Title-uniform:p,Heading:w,Heading:p,Heading:s,Heading-Main:w,Heading-Main:p,Heading-Main:s -melm 130 Title-uniform:w,Title-uniform:p,Title-uniform:s,Heading:w,Heading:p,Heading:s -melm 431 Title-uniform-see-from:w,Title-uniform-see-from:p,Title-uniform-see-from:s,See-from:w,See-from:p,See-from:s -melm 531 Title-uniform-see-also-from:w,Title-uniform-see-also-from:p,Title-uniform-see-also-from:s,See-also-from:w,See-also-from:p,See-also-from:s +melm 130$a Title-uniform-heading:w,Title-uniform-heading:p,Title-uniform-heading:s,Title-uniform:w,Title-uniform:p,Heading:w,Heading:p,Heading:s,Heading-Main:w,Heading-Main:p,Heading-Main:s,Match:w,Match:p,Match-heading:w,Match-heading:p +melm 130 Title-uniform:w,Title-uniform:p,Title-uniform:s,Heading:w,Heading:p,Heading:s,Match:w,Match:p,Match-heading:w,Match-heading:p +melm 431 Title-uniform-see-from:w,Title-uniform-see-from:p,Title-uniform-see-from:s,See-from:w,See-from:p,See-from:s,Match:w,Match:p +melm 531 Title-uniform-see-also-from:w,Title-uniform-see-also-from:p,Title-uniform-see-also-from:s,See-also-from:w,See-also-from:p,See-also-from:s,Match:w,Match:p # Topical Term -melm 150$a Subject-topical-heading:w,Subject-topical-heading:p,Subject-topical-heading:s,Subject-topical:w,Subject-topical:p,Heading:w,Heading:p,Heading:s,Heading-Main:w,Heading-Main:p,Heading-Main:s -melm 150 Subject-topical:w,Subject-topical:p,Subject-topical:s,Heading:w,Heading:p,Heading:s -melm 450 Subject-topical-see-from:w,Subject-topical-see-from:p,Subject-topical-see-from:s,See-from:w,See-from:p,See-from:s -melm 550 Subject-topical-see-also-from:w,Subject-topical-see-also-from:p,Subject-topical-see-also-from:s,See-also-from:w,See-also-from:p,See-also-from:s +melm 150$a Subject-topical-heading:w,Subject-topical-heading:p,Subject-topical-heading:s,Subject-topical:w,Subject-topical:p,Heading:w,Heading:p,Heading:s,Heading-Main:w,Heading-Main:p,Heading-Main:s,Match:w,Match:p,Match-heading:w,Match-heading:p +melm 150 Subject-topical:w,Subject-topical:p,Subject-topical:s,Heading:w,Heading:p,Heading:s,Match:w,Match:p,Match-heading:w,Match-heading:p +melm 450 Subject-topical-see-from:w,Subject-topical-see-from:p,Subject-topical-see-from:s,See-from:w,See-from:p,See-from:s,Match:w,Match:p +melm 550 Subject-topical-see-also-from:w,Subject-topical-see-also-from:p,Subject-topical-see-also-from:s,See-also-from:w,See-also-from:p,See-also-from:s,Match:w,Match:p # Geographic Name -melm 151$a Name-geographic-heading:w,Name-geographic-heading:w,Name-geographic-heading:s,Name-geographic:w,Name-geographic:p,Heading:w,Heading:p,Heading:s,Heading-Main:w,Heading-Main:p,Heading-Main:s -melm 151 Name-geographic:w,Name-geographic:p,Name-geographic:s,Heading:w,Heading:p,Heading:s -melm 451 Name-geographic-see-from:w,Name-geographic-see-from:p,Name-geographic-see-from:s,See-from:w,See-from:p,See-from:s -melm 551 Name-geographic-see-also-from:w,Name-geographic-see-also-from:p,Name-geographic-see-also-from:s,See-also-from:w,See-also-from:p,See-also-from:s +melm 151$a Name-geographic-heading:w,Name-geographic-heading:w,Name-geographic-heading:s,Name-geographic:w,Name-geographic:p,Heading:w,Heading:p,Heading:s,Heading-Main:w,Heading-Main:p,Heading-Main:s,Match:w,Match:p,Match-heading:w,Match-heading:p +melm 151 Name-geographic:w,Name-geographic:p,Name-geographic:s,Heading:w,Heading:p,Heading:s,Match:w,Match:p,Match-heading:w,Match-heading:p +melm 451 Name-geographic-see-from:w,Name-geographic-see-from:p,Name-geographic-see-from:s,See-from:w,See-from:p,See-from:s,Match:w,Match:p +melm 551 Name-geographic-see-also-from:w,Name-geographic-see-also-from:p,Name-geographic-see-also-from:s,See-also-from:w,See-also-from:p,See-also-from:s,Match:w,Match:p # Genre/Form Term -melm 155$a Term-genre-form-heading:w,Term-genre-form-heading:p,Term-genre-form-heading:s,Term-genre-form:w,Term-genre-form:p,Heading:w,Heading:p,Heading:s,Heading-Main:w,Heading-Main:p,Heading-Main:s -melm 155 Term-genre-form:w,Term-genre-form:p,Term-genre-form:s,Heading:w,Heading:p,Heading:s -melm 455 Term-genre-form-see-from:w,Term-genre-form-see-from:p,Term-genre-form-see-from:s,See-from:w,See-from:p,See-from:s -melm 555 Term-genre-form-see-also-from:w,Term-genre-form-see-also-from:p,Term-genre-form-see-also-from:s,See-also-from:w,See-also-from:p,See-also-from:s +melm 155$a Term-genre-form-heading:w,Term-genre-form-heading:p,Term-genre-form-heading:s,Term-genre-form:w,Term-genre-form:p,Heading:w,Heading:p,Heading:s,Heading-Main:w,Heading-Main:p,Heading-Main:s,Match:w,Match:p,Match-heading:w,Match-heading:p +melm 155 Term-genre-form:w,Term-genre-form:p,Term-genre-form:s,Heading:w,Heading:p,Heading:s,Match:w,Match:p,Match-heading:w,Match-heading:p +melm 455 Term-genre-form-see-from:w,Term-genre-form-see-from:p,Term-genre-form-see-from:s,See-from:w,See-from:p,See-from:s,Match:w,Match:p +melm 555 Term-genre-form-see-also-from:w,Term-genre-form-see-also-from:p,Term-genre-form-see-also-from:s,See-also-from:w,See-also-from:p,See-also-from:s,Match:w,Match:p # NOTE: subdivisions management missing from Koha # General Subdivision diff --git a/install_misc/ubuntu-pkg-check.sh b/install_misc/ubuntu-pkg-check.sh index 9303082ef0..75bec3f320 100755 --- a/install_misc/ubuntu-pkg-check.sh +++ b/install_misc/ubuntu-pkg-check.sh @@ -1,19 +1,27 @@ #!/bin/sh -UBUNTU_PACKAGES=`dirname $0`/ubuntu.packages +# determine what directory this script is in, because the packages files +# should be there too. +DIR=`dirname $0` -# sanity checks +#determine which vbersion of ubuntu +VERSION=`lsb_release -r | cut -f2 -d' '` +UBUNTU_PACKAGES=$DIR/ubuntu.$VERSION.packages +# sanity checks if [ ! -e $UBUNTU_PACKAGES ]; then - echo ERROR: Could not find $UBUNTU_PACKAGES file for running check. - exit + echo "WARNING! We strongly recommend an LTS release." + UBUNTU_PACKAGES=$DIR/ubuntu.packages fi +echo "Using the $UBUNTU_PACKAGES file." # main - UBUNTU_PACKAGES_LIST=`awk '{print $1}' $UBUNTU_PACKAGES | grep -v '^\s*#' | grep -v '^\s*$'` for F in $UBUNTU_PACKAGES_LIST; do - UBUNTU_PKG_POLICY=`apt-cache policy $F | grep "Installed:"` - UBUNTU_PKG_VERSION=`echo $UBUNTU_PKG_POLICY | awk '{print $2}'` - echo "$F = $UBUNTU_PKG_VERSION" + UBUNTU_PKG_POLICY=`apt-cache policy $F 2> /dev/null | grep "Installed:"` + if [ "${#UBUNTU_PKG_POLICY}" -eq "0" ]; then + UBUNTU_PKG_POLICY="Installed: \(none\)\*" + fi + UBUNTU_PKG_VERSION=`echo $UBUNTU_PKG_POLICY | awk '{print $2}'` + echo "$F = $UBUNTU_PKG_VERSION" done diff --git a/install_misc/ubuntu.10.04.packages b/install_misc/ubuntu.10.04.packages new file mode 100644 index 0000000000..61fbebf946 --- /dev/null +++ b/install_misc/ubuntu.10.04.packages @@ -0,0 +1,134 @@ +apache2 install +at install +daemon install +gcc install +gettext install +make install + +# mysql packages + +mysql-server install +libmysqlclient16 install +libmysqlclient16-dev install + +# yaz packages + +yaz install +yaz-doc install +libyaz3 install +libyaz3-dev install + +# zebra packages + +idzebra-2.0 install +idzebra-2.0-common install +idzebra-2.0-doc install +idzebra-2.0-utils install +libidzebra-2.0-0 install +libidzebra-2.0-dev install +libidzebra-2.0-mod-alvis install +libidzebra-2.0-mod-grs-marc install +libidzebra-2.0-mod-grs-regx install +libidzebra-2.0-mod-grs-xml install +libidzebra-2.0-mod-text install +libidzebra-2.0-modules install + +# crypto packages + +libgcrypt11 install +libgcrypt11-dev install + +# xml/xslt packages + +libxml2 install +libxml2-dev install +libxml2-utils install +libxslt1.1 install +libxslt1-dev install + +# perl packages + +libalgorithm-checkdigits-perl install +libauthen-cas-client-perl install +libbiblio-endnotestyle-perl install +libbusiness-isbn-perl install +libcgi-session-driver-memcached-perl install +libcgi-session-perl install +libcgi-session-serialize-yaml-perl install +libclass-factory-util-perl install +libdata-ical-perl install +libdate-calc-perl install +libdate-manip-perl install +libdatetime-perl install +libdatetime-format-dateparse-perl install +libdatetime-format-ical-perl install +libdatetime-format-mail-perl install +libdatetime-format-strptime-perl install +libdatetime-format-w3cdtf-perl install +libdatetime-locale-perl install +libdatetime-timezone-perl install +libdbd-mysql-perl install +libdbd-sqlite2-perl install +libdbi-perl install +libemail-date-perl install +libgd-barcode-perl install +libgraphics-magick-perl install +libgravatar-url-perl install +libhtml-scrubber-perl install +libhtml-template-pro-perl install +libhttp-oai-perl install +liblingua-ispell-perl install +liblingua-stem-perl install +liblingua-stem-snowball-perl install +liblist-moreutils-perl install +liblocale-currency-format-perl install +liblocale-gettext-perl install +liblocale-po-perl install +libmail-sendmail-perl install +libmarc-charset-perl install +libmarc-crosswalk-dublincore-perl install +libmarc-record-perl install +libmarc-xml-perl install +libmemoize-memcached-perl install +libmime-lite-perl install +libmodern-perl install +libmodule-install-perl install +libnet-ldap-perl install +libnet-server-perl install +libpdf-api2-simple-perl install +libreadonly-perl install +libreadonly-xs-perl install +libnet-z3950-zoom-perl install +libnumber-format-perl install +libpdf-api2-perl install +libpdf-reuse-perl install +libpdf-reuse-barcode-perl install +libpdf-table-perl install +libpoe-perl install +libschedule-at-perl install +libsms-send-perl install +libtemplate-perl install +libtext-charwidth-perl install +libtext-csv-encoded-perl install +libtext-csv-perl install +libtext-iconv-perl install +libtext-wrapi18n-perl install +libtimedate-perl install +libtime-duration-perl install +libtime-format-perl install +libuniversal-require-perl install +libunix-syslog-perl install +libxml-perl install +libxml-dom-perl install +libxml-dumper-perl install +libxml-libxml-perl install +libxml-libxslt-perl install +libxml-namespacesupport-perl install +libxml-parser-perl install +libxml-regexp-perl install +libxml-rss-perl install +libxml-sax-writer-perl install +libxml-simple-perl install +libxml-xslt-perl install +libyaml-perl install +libyaml-syck-perl install diff --git a/install_misc/ubuntu.10.10.packages b/install_misc/ubuntu.10.10.packages new file mode 100644 index 0000000000..9b806bbdad --- /dev/null +++ b/install_misc/ubuntu.10.10.packages @@ -0,0 +1,129 @@ + +apache2 install +at install +daemon install +gcc install +gettext install +make install + +# mysql packages + +mysql-server install +libmysqlclient16 install +libmysqlclient16-dev install + +# yaz packages + +yaz install +yaz-doc install +libyaz3 install +libyaz3-dev install + +# zebra packages + +idzebra-2.0 install +idzebra-2.0-common install +idzebra-2.0-doc install +idzebra-2.0-utils install +libidzebra-2.0-0 install +libidzebra-2.0-dev install +libidzebra-2.0-mod-alvis install +libidzebra-2.0-mod-grs-marc install +libidzebra-2.0-mod-grs-regx install +libidzebra-2.0-mod-grs-xml install +libidzebra-2.0-mod-text install +libidzebra-2.0-modules install + +# crypto packages + +libgcrypt11 install +libgcrypt11-dev install + +# xml/xslt packages + +libxml2 install +libxml2-dev install +libxml2-utils install +libxslt1.1 install +libxslt1-dev install + +# perl packages + +libalgorithm-checkdigits-perl install +libauthen-cas-client-perl install +libbiblio-endnotestyle-perl install +libbusiness-isbn-perl install +libcgi-session-perl install +libcgi-session-serialize-yaml-perl install +libclass-factory-util-perl install +libdata-ical-perl install +libdate-calc-perl install +libdate-manip-perl install +libdatetime-perl install +libdatetime-format-ical-perl install +libdatetime-format-mail-perl install +libdatetime-format-strptime-perl install +libdatetime-format-w3cdtf-perl install +libdatetime-locale-perl install +libdatetime-timezone-perl install +libdbd-mysql-perl install +libdbd-sqlite2-perl install +libdbi-perl install +libemail-date-perl install +libgd-barcode-perl install +libgraphics-magick-perl install +libhtml-scrubber-perl install +libhtml-template-pro-perl install +libhttp-oai-perl install +liblingua-ispell-perl install +liblingua-stem-perl install +liblingua-stem-snowball-perl install +liblist-moreutils-perl install +liblocale-currency-format-perl install +liblocale-gettext-perl install +liblocale-po-perl install +libmail-sendmail-perl install +libmarc-charset-perl install +libmarc-crosswalk-dublincore-perl install +libmarc-record-perl install +libmarc-xml-perl install +libmemoize-memcached-perl install +libmime-lite-perl install +libmodule-install-perl install +libnet-ldap-perl install +libnet-server-perl install +libnet-z3950-zoom-perl install +libnumber-format-perl install +libpdf-api2-perl install +libpdf-reuse-perl install +libpdf-api2-simple-perl install +libpdf-reuse-barcode-perl install +libpdf-table-perl install +libpoe-perl install +libschedule-at-perl install +libsms-send-perl install +libtemplate-perl install +libtext-charwidth-perl install +libtext-csv-encoded-perl install +libtext-csv-perl install +libtext-iconv-perl install +libtext-wrapi18n-perl install +libtimedate-perl install +libtime-duration-perl install +libtime-format-perl install +libuniversal-require-perl install +libunix-syslog-perl install +libxml-perl install +libxml-dom-perl install +libxml-dumper-perl install +libxml-libxml-perl install +libxml-libxslt-perl install +libxml-namespacesupport-perl install +libxml-parser-perl install +libxml-regexp-perl install +libxml-rss-perl install +libxml-sax-writer-perl install +libxml-simple-perl install +libxml-xslt-perl install +libyaml-perl install +libyaml-syck-perl install diff --git a/install_misc/ubuntu.12.04.packages b/install_misc/ubuntu.12.04.packages new file mode 100644 index 0000000000..340ce82626 --- /dev/null +++ b/install_misc/ubuntu.12.04.packages @@ -0,0 +1,157 @@ +apache2 install +at install +daemon install +gcc install +gettext install +make install + +# mysql packages + +mysql-server install +libmysqlclient18 install + +# yaz packages + +yaz install +yaz-doc install +libyaz4 install +libyaz4-dev install + +# zebra packages + +idzebra-2.0 install +idzebra-2.0-common install +idzebra-2.0-doc install +idzebra-2.0-utils install +libidzebra-2.0-0 install +libidzebra-2.0-dev install +libidzebra-2.0-mod-alvis install +libidzebra-2.0-mod-grs-marc install +libidzebra-2.0-mod-grs-regx install +libidzebra-2.0-mod-grs-xml install +libidzebra-2.0-mod-text install +libidzebra-2.0-modules install + +# crypto packages + +libgcrypt11 install +libgcrypt11-dev install + +# xml/xslt packages + +libxml2 install +libxml2-dev install +libxml2-utils install +libxslt1.1 install +libxslt1-dev install + +# perl packages + +libalgorithm-checkdigits-perl install +libauthen-cas-client-perl install +libbiblio-endnotestyle-perl install +libbusiness-isbn-perl install +libcgi-session-driver-memcached-perl install +libcgi-session-perl install +libcgi-session-serialize-yaml-perl install +libchi-driver-memcached-perl install +libchi-perl install +libclass-accessor-perl install +libclass-factory-util-perl install +libdata-ical-perl install +libdate-calc-perl install +libdate-manip-perl install +libdatetime-perl install +libdatetime-event-ical-perl install +libdatetime-format-dateparse-perl install +libdatetime-format-ical-perl install +libdatetime-format-mail-perl install +libdatetime-format-mysql-perl install +libdatetime-format-strptime-perl install +libdatetime-format-w3cdtf-perl install +libdatetime-locale-perl install +libdatetime-set-perl install +libdatetime-timezone-perl install +libdbd-mysql-perl install +libdbd-sqlite2-perl install +libdbi-perl install +libemail-date-perl install +libgd-barcode-perl install +libgd-gd2-perl install +libgraphics-magick-perl install +libgravatar-url-perl install +libhtml-format-perl install +libhtml-scrubber-perl install +libhtml-template-pro-perl install +libhttp-cookies-perl install +libhttp-message-perl install +libhttp-oai-perl install +libjson-any-perl install +libjson-perl install +liblingua-ispell-perl install +liblingua-stem-perl install +liblingua-stem-snowball-perl install +liblist-moreutils-perl install +liblocale-currency-format-perl install +liblocale-gettext-perl install +liblocale-po-perl install +libmail-sendmail-perl install +libmarc-charset-perl install +libmarc-crosswalk-dublincore-perl install +libmarc-record-perl install +libmarc-xml-perl install +libmemoize-memcached-perl install +libmime-lite-perl install +libmodern-perl install +libmodern-perl-perl install +libmodule-install-perl install +libmoosex-storage-perl install +libmoosex-types-perl install +libnet-ldap-perl install +libnet-server-perl install +libpdf-api2-simple-perl install +libreadonly-perl install +libreadonly-xs-perl install +libnet-z3950-zoom-perl install +libnumber-format-perl install +libpdf-api2-perl install +libpdf-reuse-perl install +libpdf-reuse-barcode-perl install +libpdf-table-perl install +libpoe-perl install +libschedule-at-perl install +libsms-send-perl install +libstring-rewriteprefix-perl install +libtemplate-perl install +libtest-mockmodule-perl install +libtest-strict-perl install +libtext-charwidth-perl install +libtext-csv-encoded-perl install +libtext-csv-perl install +libtext-csv-xs-perl install +libtext-iconv-perl install +libtext-unaccent-perl install +libtext-wrapi18n-perl install +libtimedate-perl install +libtime-duration-perl install +libtime-format-perl install +libtime-progress-perl install +libuniversal-require-perl install +libunix-syslog-perl install +liburi-perl install +libwww-perl install +libxml-perl install +libxml-dom-perl install +libxml-dumper-perl install +libxml-libxml-perl install +libxml-libxslt-perl install +libxml-namespacesupport-perl install +libxml-parser-perl install +libxml-regexp-perl install +libxml-rss-perl install +libxml-sax-perl install +libxml-sax-writer-perl install +libxml-simple-perl install +libxml-xslt-perl install +libyaml-perl install +libyaml-syck-perl install diff --git a/install_misc/ubuntu.packages b/install_misc/ubuntu.packages index 61fbebf946..340ce82626 100644 --- a/install_misc/ubuntu.packages +++ b/install_misc/ubuntu.packages @@ -8,15 +8,14 @@ make install # mysql packages mysql-server install -libmysqlclient16 install -libmysqlclient16-dev install +libmysqlclient18 install # yaz packages yaz install yaz-doc install -libyaz3 install -libyaz3-dev install +libyaz4 install +libyaz4-dev install # zebra packages @@ -55,28 +54,40 @@ libbusiness-isbn-perl install libcgi-session-driver-memcached-perl install libcgi-session-perl install libcgi-session-serialize-yaml-perl install +libchi-driver-memcached-perl install +libchi-perl install +libclass-accessor-perl install libclass-factory-util-perl install libdata-ical-perl install libdate-calc-perl install libdate-manip-perl install libdatetime-perl install +libdatetime-event-ical-perl install libdatetime-format-dateparse-perl install libdatetime-format-ical-perl install libdatetime-format-mail-perl install +libdatetime-format-mysql-perl install libdatetime-format-strptime-perl install libdatetime-format-w3cdtf-perl install libdatetime-locale-perl install +libdatetime-set-perl install libdatetime-timezone-perl install libdbd-mysql-perl install libdbd-sqlite2-perl install libdbi-perl install libemail-date-perl install libgd-barcode-perl install +libgd-gd2-perl install libgraphics-magick-perl install libgravatar-url-perl install +libhtml-format-perl install libhtml-scrubber-perl install libhtml-template-pro-perl install +libhttp-cookies-perl install +libhttp-message-perl install libhttp-oai-perl install +libjson-any-perl install +libjson-perl install liblingua-ispell-perl install liblingua-stem-perl install liblingua-stem-snowball-perl install @@ -92,7 +103,10 @@ libmarc-xml-perl install libmemoize-memcached-perl install libmime-lite-perl install libmodern-perl install +libmodern-perl-perl install libmodule-install-perl install +libmoosex-storage-perl install +libmoosex-types-perl install libnet-ldap-perl install libnet-server-perl install libpdf-api2-simple-perl install @@ -107,17 +121,25 @@ libpdf-table-perl install libpoe-perl install libschedule-at-perl install libsms-send-perl install +libstring-rewriteprefix-perl install libtemplate-perl install +libtest-mockmodule-perl install +libtest-strict-perl install libtext-charwidth-perl install libtext-csv-encoded-perl install libtext-csv-perl install +libtext-csv-xs-perl install libtext-iconv-perl install +libtext-unaccent-perl install libtext-wrapi18n-perl install libtimedate-perl install libtime-duration-perl install libtime-format-perl install +libtime-progress-perl install libuniversal-require-perl install libunix-syslog-perl install +liburi-perl install +libwww-perl install libxml-perl install libxml-dom-perl install libxml-dumper-perl install @@ -127,6 +149,7 @@ libxml-namespacesupport-perl install libxml-parser-perl install libxml-regexp-perl install libxml-rss-perl install +libxml-sax-perl install libxml-sax-writer-perl install libxml-simple-perl install libxml-xslt-perl install diff --git a/install_misc/ubuntu_maverick.packages b/install_misc/ubuntu_maverick.packages deleted file mode 100644 index 9b806bbdad..0000000000 --- a/install_misc/ubuntu_maverick.packages +++ /dev/null @@ -1,129 +0,0 @@ - -apache2 install -at install -daemon install -gcc install -gettext install -make install - -# mysql packages - -mysql-server install -libmysqlclient16 install -libmysqlclient16-dev install - -# yaz packages - -yaz install -yaz-doc install -libyaz3 install -libyaz3-dev install - -# zebra packages - -idzebra-2.0 install -idzebra-2.0-common install -idzebra-2.0-doc install -idzebra-2.0-utils install -libidzebra-2.0-0 install -libidzebra-2.0-dev install -libidzebra-2.0-mod-alvis install -libidzebra-2.0-mod-grs-marc install -libidzebra-2.0-mod-grs-regx install -libidzebra-2.0-mod-grs-xml install -libidzebra-2.0-mod-text install -libidzebra-2.0-modules install - -# crypto packages - -libgcrypt11 install -libgcrypt11-dev install - -# xml/xslt packages - -libxml2 install -libxml2-dev install -libxml2-utils install -libxslt1.1 install -libxslt1-dev install - -# perl packages - -libalgorithm-checkdigits-perl install -libauthen-cas-client-perl install -libbiblio-endnotestyle-perl install -libbusiness-isbn-perl install -libcgi-session-perl install -libcgi-session-serialize-yaml-perl install -libclass-factory-util-perl install -libdata-ical-perl install -libdate-calc-perl install -libdate-manip-perl install -libdatetime-perl install -libdatetime-format-ical-perl install -libdatetime-format-mail-perl install -libdatetime-format-strptime-perl install -libdatetime-format-w3cdtf-perl install -libdatetime-locale-perl install -libdatetime-timezone-perl install -libdbd-mysql-perl install -libdbd-sqlite2-perl install -libdbi-perl install -libemail-date-perl install -libgd-barcode-perl install -libgraphics-magick-perl install -libhtml-scrubber-perl install -libhtml-template-pro-perl install -libhttp-oai-perl install -liblingua-ispell-perl install -liblingua-stem-perl install -liblingua-stem-snowball-perl install -liblist-moreutils-perl install -liblocale-currency-format-perl install -liblocale-gettext-perl install -liblocale-po-perl install -libmail-sendmail-perl install -libmarc-charset-perl install -libmarc-crosswalk-dublincore-perl install -libmarc-record-perl install -libmarc-xml-perl install -libmemoize-memcached-perl install -libmime-lite-perl install -libmodule-install-perl install -libnet-ldap-perl install -libnet-server-perl install -libnet-z3950-zoom-perl install -libnumber-format-perl install -libpdf-api2-perl install -libpdf-reuse-perl install -libpdf-api2-simple-perl install -libpdf-reuse-barcode-perl install -libpdf-table-perl install -libpoe-perl install -libschedule-at-perl install -libsms-send-perl install -libtemplate-perl install -libtext-charwidth-perl install -libtext-csv-encoded-perl install -libtext-csv-perl install -libtext-iconv-perl install -libtext-wrapi18n-perl install -libtimedate-perl install -libtime-duration-perl install -libtime-format-perl install -libuniversal-require-perl install -libunix-syslog-perl install -libxml-perl install -libxml-dom-perl install -libxml-dumper-perl install -libxml-libxml-perl install -libxml-libxslt-perl install -libxml-namespacesupport-perl install -libxml-parser-perl install -libxml-regexp-perl install -libxml-rss-perl install -libxml-sax-writer-perl install -libxml-simple-perl install -libxml-xslt-perl install -libyaml-perl install -libyaml-syck-perl install diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 69304e1e83..91d42a29fb 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -178,6 +178,7 @@ CREATE TABLE `biblioitems` ( -- information related to bibliographic records in `cn_item` varchar(10) default NULL, `cn_suffix` varchar(10) default NULL, `cn_sort` varchar(30) default NULL, + `agerestriction` varchar(255) default NULL, `totalissues` int(10), `marcxml` longtext NOT NULL, -- full bibliographic MARC record in MARCXML PRIMARY KEY (`biblioitemnumber`), @@ -650,6 +651,7 @@ CREATE TABLE `deletedbiblioitems` ( -- information about bibliographic records t `cn_item` varchar(10) default NULL, `cn_suffix` varchar(10) default NULL, `cn_sort` varchar(30) default NULL, + `agerestriction` varchar(255) default NULL, `totalissues` int(10), `marcxml` longtext NOT NULL, -- full bibliographic MARC record in MARCXML PRIMARY KEY (`biblioitemnumber`), @@ -770,7 +772,7 @@ CREATE TABLE `deleteditems` ( `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- date and time this item was last altered `location` varchar(80) default NULL, -- authorized value for the shelving location for this item (MARC21 952$c) `permanent_location` varchar(80) default NULL, -- linked to the CART and PROC temporary locations feature, stores the permanent shelving location - `onloan` date default NULL, -- defines if this item is currently checked out (1 for yes, 0 for no) + `onloan` date default NULL, -- defines if item is checked out (NULL for not checked out, and checkout date for checked out) `cn_source` varchar(10) default NULL, -- classification source used on this item (MARC21 952$2) `cn_sort` varchar(30) default NULL, -- normalized form of the call number (MARC21 952$o) used for sorting `ccode` varchar(10) default NULL, -- authorized value for the collection code associated with this item (MARC21 952$8) @@ -1038,7 +1040,7 @@ CREATE TABLE `items` ( -- holdings/item information `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- date and time this item was last altered `location` varchar(80) default NULL, -- authorized value for the shelving location for this item (MARC21 952$c) `permanent_location` varchar(80) default NULL, -- linked to the CART and PROC temporary locations feature, stores the permanent shelving location - `onloan` date default NULL, -- defines if this item is currently checked out (1 for yes, 0 for no) + `onloan` date default NULL, -- defines if item is checked out (NULL for not checked out, and checkout date for checked out) `cn_source` varchar(10) default NULL, -- classification source used on this item (MARC21 952$2) `cn_sort` varchar(30) default NULL, -- normalized form of the call number (MARC21 952$o) used for sorting `ccode` varchar(10) default NULL, -- authorized value for the collection code associated with this item (MARC21 952$8) diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 6a5337997b..35f92cccc7 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -2,20 +2,14 @@ INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('advancedMARCeditor',0,"If ON, the MARC editor won't display field/subfield descriptions",'','YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('AllowHoldDateInFuture','0','If set a date field is displayed on the Hold screen of the Staff Interface, allowing the hold date to be set in the future.','','YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('OPACAllowHoldDateInFuture','0','If set, along with the AllowHoldDateInFuture system preference, OPAC users can set the date of a hold to be in the future.','','YesNo'); -INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AmazonEnabled',0,'Turn ON Amazon Content - You MUST set AWSAccessKeyID, AWSPrivateKey, and AmazonAssocTag if enabled','','YesNo'); -INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AmazonReviews',0,'Display Amazon review on staff interface - You MUST set AWSAccessKeyID, AWSPrivateKey, and AmazonAssocTag if enabled','','YesNo'); -INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AmazonSimilarItems',0,'Turn ON Amazon Similar Items feature - You MUST set AWSAccessKeyID, AWSPrivateKey, and AmazonAssocTag if enabled','','YesNo'); -INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACAmazonEnabled',0,'Turn ON Amazon Content in the OPAC - You MUST set AWSAccessKeyID, AWSPrivateKey, and AmazonAssocTag if enabled','','YesNo'); -INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACAmazonSimilarItems',0,'Turn ON Amazon Similar Items feature - You MUST set AWSAccessKeyID, AWSPrivateKey, and AmazonAssocTag if enabled','','YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AmazonLocale','US','Use to set the Locale of your Amazon.com Web Services','US|CA|DE|FR|JP|UK','Choice'); -INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AWSAccessKeyID','','See: http://aws.amazon.com','','free'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AmazonAssocTag','','See: http://aws.amazon.com','','free'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AnonSuggestions',0,'Set to enable Anonymous suggestions to AnonymousPatron borrowernumber',NULL,'YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AnonymousPatron', '0', 'Set the identifier (borrowernumber) of the anonymous patron. Used for Suggestion and reading history privacy',NULL,''); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('Babeltheque',0,'Turn ON Babeltheque content - See babeltheque.com to subscribe to this service','','YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('authoritysep','--','Used to separate a list of authorities in a display. Usually --',10,'free'); -INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('autoBarcode','OFF','Used to autogenerate a barcode: incremental will be of the form 1, 2, 3; annual of the form 2007-0001, 2007-0002; hbyymmincr of the form HB08010001 where HB=Home Branch','incremental|annual|hbyymmincr|OFF','Choice'); +INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('autoBarcode','OFF','Used to autogenerate a barcode: incremental will be of the form 1, 2, 3; annual of the form 2007-0001, 2007-0002; hbyymmincr of the form HB08010001 where HB=Home Branch','incremental|annual|hbyymmincr|EAN13|OFF','Choice'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AutoLocation',0,'If ON, IP authentication is enabled, blocking access to the staff client from unauthorized IP addresses',NULL,'YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AutomaticItemReturn',1,'If ON, Koha will automatically set up a transfer of this item to its homebranch',NULL,'YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('autoMemberNum',1,'If ON, patron number is auto-calculated','','YesNo'); @@ -90,7 +84,6 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('opacreadinghistory',1,'If ON, enables display of Patron Circulation History in OPAC','','YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACResultsSidebar','','Define HTML to be included on the search results page, underneath the facets sidebar','70|10','Textarea'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('opacsmallimage','','Enter a complete URL to an image to replace the default Koha logo','','free'); -INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('opacstylesheet','','Enter a complete URL to use an alternate layout stylesheet in OPAC','','free'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('opacthemes','prog','Define the current theme for the OPAC interface.','','Themes'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacTopissue',0,'If ON, enables the \'most popular items\' link on OPAC. Warning, this is an EXPERIMENTAL feature, turning ON may overload your server',NULL,'YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacPublic',1,'Turn on/off public OPAC',NULL,'YesNo'); @@ -155,10 +148,10 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('SelfCheckHelpMessage','','Enter HTML to include under the basic Web-based Self Checkout instructions on the Help page','70|10','Textarea'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('numSearchResults',20,'Specify the maximum number of results to display on a page of results',NULL,'Integer'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACnumSearchResults',20,'Specify the maximum number of results to display on a page of results',NULL,'Integer'); -INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('defaultSortField',NULL,'Specify the default field used for sorting','relevance|popularity|call_number|pubdate|acqdate|title|author','Choice'); -INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('defaultSortOrder',NULL,'Specify the default sort order','asc|dsc|az|za','Choice'); -INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACdefaultSortField',NULL,'Specify the default field used for sorting','relevance|popularity|call_number|pubdate|acqdate|title|author','Choice'); -INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACdefaultSortOrder',NULL,'Specify the default sort order','asc|dsc|za|az','Choice'); +INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('defaultSortField','relevance','Specify the default field used for sorting','relevance|popularity|call_number|pubdate|acqdate|title|author','Choice'); +INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('defaultSortOrder','dsc','Specify the default sort order','asc|dsc|az|za','Choice'); +INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACdefaultSortField','relevance','Specify the default field used for sorting','relevance|popularity|call_number|pubdate|acqdate|title|author','Choice'); +INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACdefaultSortOrder','dsc','Specify the default sort order','asc|dsc|za|az','Choice'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('FacetLabelTruncationLength',20,'Specify the facet max length in OPAC',NULL,'Integer'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('staffClientBaseURL','','Specify the base URL of the staff client',NULL,'free'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('minPasswordLength',3,'Specify the minimum length of a patron/staff password',NULL,'free'); @@ -166,7 +159,7 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('emailLibrarianWhenHoldIsPlaced',0,'If ON, emails the librarian whenever a hold is placed',NULL,'YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('numReturnedItemsToShow','20','Number of returned items to show on the check-in page',NULL,'Integer'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('finesMode','test','Choose the fines mode, \'off\', \'test\' (emails admin report) or \'production\' (accrue overdue fines). Requires accruefines cronjob.','off|test|production','Choice'); -INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('itemBarcodeInputFilter','','If set, allows specification of a item barcode input filter','whitespace|T-prefix|cuecat|libsuite8','Choice'); +INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('itemBarcodeInputFilter','','If set, allows specification of a item barcode input filter','whitespace|T-prefix|cuecat|libsuite8|EAN13','Choice'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('singleBranchMode',0,'Operate in Single-branch mode, hide branch selection in the OPAC',NULL,'YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('URLLinkText','','Text to display as the link anchor in the OPAC',NULL,'free'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACViewOthersSuggestions',0,'If ON, allows all suggestions to be displayed in the OPAC',NULL,'YesNo'); @@ -256,7 +249,6 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ( INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('NovelistSelectPassword',NULL,'Enable Novelist user Profile',NULL,'free'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('NovelistSelectView','tab','Where to display Novelist Select content','tab|above|below|right','Choice'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OPACAmazonCoverImages', '0', 'Display cover images on OPAC from Amazon Web Services','','YesNo'); -INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OPACAmazonReviews', '0', 'Display Amazon readers reviews on OPAC','','YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('AmazonCoverImages', '0', 'Display Cover Images in Staff Client from Amazon Web Services','','YesNo'); INSERT INTO `systempreferences` ( `variable` , `value` , `options` , `explanation` , `type` ) VALUES ( 'StaffSerialIssueDisplayCount', '3', '', 'Number of serial issues to display per subscription in the Staff client', 'Integer'); INSERT INTO `systempreferences` ( `variable` , `value` , `options` , `explanation` , `type` ) VALUES ( 'OPACSerialIssueDisplayCount', '3', '', 'Number of serial issues to display per subscription in the OPAC', 'Integer'); @@ -272,7 +264,6 @@ INSERT INTO systempreferences (variable,value,explanation,options,type)VALUES('v INSERT INTO systempreferences (variable,value,explanation,options,type)VALUES('FilterBeforeOverdueReport','0','Do not run overdue report until filter selected','','YesNo'); INSERT INTO systempreferences (variable,value,options,explanation,type)VALUES('SpineLabelFormat', '', '30|10', 'This preference defines the format for the quick spine label printer. Just list the fields you would like to see in the order you would like to see them, surrounded by <>, for example .', 'Textarea'); INSERT INTO systempreferences (variable,value,options,explanation,type)VALUES('SpineLabelAutoPrint', '0', '', 'If this setting is turned on, a print dialog will automatically pop up for the quick spine label printer.', 'YesNo'); -INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AWSPrivateKey','','See: http://aws.amazon.com. Note that this is required after 2009/08/15 in order to retrieve any enhanced content other than book covers from Amazon.','','free'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACFineNoRenewals','100','Fine limit above which user cannot renew books via OPAC','','Integer'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OverdueNoticeBcc','','Email address to bcc outgoing overdue notices sent by email','','free'); INSERT INTO `systempreferences` ( `variable` , `value` , `options` , `explanation` , `type` ) VALUES ( 'NewItemsDefaultLocation', '', '', 'If set, all new items will have a location of the given Location Code ( Authorized Value type LOC )', ''); @@ -281,7 +272,7 @@ INSERT INTO `systempreferences` ( `variable` , `value` , `options` , `explanatio INSERT INTO `systempreferences` ( `variable` , `value` , `options` , `explanation` , `type` ) VALUES ( 'DisplayClearScreenButton', '0', '', 'If set to ON, a clear screen button will appear on the circulation page.', 'YesNo'); INSERT INTO systempreferences (variable,value,options,explanation,type)VALUES('HidePatronName', '0', '', 'If this is switched on, patron''s cardnumber will be shown instead of their name on the holds and catalog screens', 'YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('OPACSearchForTitleIn','
  • Other Libraries (WorldCat)
  • \n
  • Other Databases (Google Scholar)
  • \n
  • Online Stores (Bookfinder.com)
  • \n
  • Open Library (openlibrary.org)
  • ','Enter the HTML that will appear in the \'Search for this title in\' box on the detail page in the OPAC. Enter {TITLE}, {AUTHOR}, or {ISBN} in place of their respective variables in the URL. Leave blank to disable \'More Searches\' menu.','70|10','Textarea'); -INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('OPACMySummaryHTML','','Enter the HTML that will appear in a column on the \'my profile\' tab when a user is logged in to the OPAC. Enter {BIBLIONUMBER}, {TITLE}, {AUTHOR}, or {ISBN} in place of their respective variables in the HTML. Leave blank to disable.','70|10','Textarea'); +INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('OPACMySummaryHTML','','Enter the HTML that will appear in a column on the \'my summary\' and \'my reading history\' tabs when a user is logged in to the OPAC. Enter {BIBLIONUMBER}, {TITLE}, {AUTHOR}, or {ISBN} in place of their respective variables in the HTML. Leave blank to disable.','70|10','Textarea'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('OPACPatronDetails','1','If OFF the patron details tab in the OPAC is disabled.','','YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('OPACFinesTab','1','If OFF the patron fines tab in the OPAC is disabled.','','YesNo'); INSERT INTO systempreferences (variable,value,options,explanation,type)VALUES('DisplayOPACiconsXSLT', '1', '', 'If ON, displays the format, audience, type icons in XSLT MARC21 results and display pages.', 'YesNo'); @@ -375,3 +366,8 @@ INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ( INSERT INTO systempreferences (variable,value,explanation,type) VALUES('EnableBorrowerFiles','0','If enabled, allows librarians to upload and attach arbitrary files to a borrower record.','YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('UpdateTotalIssuesOnCirc','0','Whether to update the totalissues field in the biblio on each circ.',NULL,'YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('IntranetSlipPrinterJS','','Use this JavaScript for printing slips. Define at least function printThenClose(). For use e.g. with Firefox PlugIn jsPrintSetup, see http://jsprintsetup.mozdev.org/','','Free'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacSuppressionByIPRange','','Restrict the suppression to IP adresses outside of the IP range','','free'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('PrefillItem','0','When a new item is added, should it be prefilled with last created item values?','','YesNo'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SubfieldsToUseWhenPrefill','','Define a list of subfields to use when prefilling items (separated by space)','','Free'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AgeRestrictionMarker','','Markers for age restriction indication, e.g. FSK|PEGI|Age|',NULL,'free'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AgeRestrictionOverride',0,'Allow staff to check out an item with age restriction.',NULL,'YesNo'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 9977f6328a..25cd3676ce 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -5569,8 +5569,8 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { $DBversion = "3.09.00.028"; if (C4::Context->preference("Version") < TransformToNum($DBversion)) { unless ( C4::Context->preference('marcflavour') eq 'UNIMARC' ) { - my %referencetypes = ( '00' => 'PERSO_CODE', - '10' => 'ORGO_CODE', + my %referencetypes = ( '00' => 'PERSO_NAME', + '10' => 'CORPO_NAME', '11' => 'MEETI_NAME', '30' => 'UNIF_TITLE', '48' => 'CHRON_TERM', @@ -5610,6 +5610,92 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { SetVersion($DBversion); } +$DBversion = "3.09.00.029"; # FIXME +if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { + $dbh->do("UPDATE systempreferences SET options=concat(options,'|EAN13') WHERE variable='itemBarcodeInputFilter' AND options NOT LIKE '%EAN13%'"); + print "Upgrade to $DBversion done (Add itemBarcodeInputFilter choice EAN13)\n"; + + $dbh->do("UPDATE systempreferences SET options = concat(options,'|EAN13'), explanation = concat(explanation,'; EAN13 - incremental') WHERE variable = 'autoBarcode' AND options NOT LIKE '%EAN13%'"); + print "Upgrade to $DBversion done ( Added EAN13 barcode autogeneration sequence )\n"; + + SetVersion($DBversion); +} + +$DBversion ="3.09.00.030"; +if(C4::Context->preference("Version") < TransformToNum($DBversion) ) { + my $query = "SELECT value FROM systempreferences WHERE variable='opacstylesheet'"; + my $remote= $dbh->selectrow_arrayref($query); + $dbh->do("DELETE from systempreferences WHERE variable='opacstylesheet'"); + if($remote && $remote->[0]) { + $query="UPDATE systempreferences SET value=? WHERE variable='opaclayoutstylesheet'"; + $dbh->do($query,undef,$remote->[0]); + print "NOTE: The URL of your remote opac css file has been moved to preference opaclayoutstylesheet.\n"; + } + print "Upgrade to $DBversion done (BZ 8263: Make OPAC stylesheet preferences more consistent)\n"; + SetVersion($DBversion); +} + +$DBversion = "3.09.00.031"; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + $dbh->do("DELETE FROM systempreferences WHERE variable='AmazonReviews'"); + $dbh->do("DELETE FROM systempreferences WHERE variable='AmazonSimilarItems'"); + $dbh->do("DELETE FROM systempreferences WHERE variable='AWSAccessKeyID'"); + $dbh->do("DELETE FROM systempreferences WHERE variable='AWSPrivateKey'"); + $dbh->do("DELETE FROM systempreferences WHERE variable='OPACAmazonReviews'"); + $dbh->do("DELETE FROM systempreferences WHERE variable='OPACAmazonSimilarItems'"); + $dbh->do("DELETE FROM systempreferences WHERE variable='AmazonEnabled'"); + $dbh->do("DELETE FROM systempreferences WHERE variable='OPACAmazonEnabled'"); + print "Upgrade to $DBversion done ('Remove preferences controlling broken Amazon features (Bug 8679')\n"; + SetVersion ($DBversion); +} + +$DBversion = "3.09.00.032"; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + $dbh->do("UPDATE systempreferences SET value = 'call_number' WHERE variable = 'defaultSortField' AND value = 'callnumber'"); + $dbh->do("UPDATE systempreferences SET value = 'call_number' WHERE variable = 'OPACdefaultSortField' AND value = 'callnumber'"); + print "Upgrade to $DBversion done (Bug 8657 - Default sort by call number does not work. Correcting system preference value.)\n"; + SetVersion ($DBversion); +} + +$DBversion = '3.09.00.033'; +if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { + $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacSuppressionByIPRange','','Restrict the suppression to IP adresses outside of the IP range','','free');"); + print "Upgrade to $DBversion done (Add OpacSuppressionByIPRange syspref)\n"; + SetVersion ($DBversion); +} + +$DBversion ="3.09.00.034"; +if(C4::Context->preference("Version") < TransformToNum($DBversion) ) { + $dbh->do("UPDATE auth_subfield_structure SET frameworkcode = 'PERSO_NAME' WHERE frameworkcode = 'PERSO_CODE'"); + $dbh->do("UPDATE auth_subfield_structure SET frameworkcode = 'CORPO_NAME' WHERE frameworkcode = 'ORGO_CODE'"); + print "Upgrade to $DBversion done (Bug 8207: correct typo in authority types)\n"; + SetVersion ($DBversion); +} + +$DBversion = "3.09.00.035"; +if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { + $dbh->do(" + INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('PrefillItem','0','When a new item is added, should it be prefilled with last created item values?','','YesNo'); + "); + $dbh->do( + "INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SubfieldsToUseWhenPrefill','','Define a list of subfields to use when prefilling items (separated by space)','','Free'); + "); + print "Upgrade to $DBversion done (Adding PrefillItem and SubfieldsToUseWhenPrefill sysprefs)\n"; +} + +$DBversion = "3.09.00.036"; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + # biblioitems changes + $dbh->do("ALTER TABLE biblioitems ADD COLUMN agerestriction VARCHAR(255) DEFAULT NULL AFTER cn_sort"); + $dbh->do("ALTER TABLE deletedbiblioitems ADD COLUMN agerestriction VARCHAR(255) DEFAULT NULL AFTER cn_sort"); + # preferences changes + $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AgeRestrictionMarker','','Markers for age restriction indication, e.g. FSK|PEGI|Age|. See: http://wiki.koha-community.org/wiki/Age_restriction',NULL,'free')"); + $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AgeRestrictionOverride',0,'Allow staff to check out an item with age restriction.',NULL,'YesNo')"); + + print "Upgrade to $DBversion done (Add colum agerestriction to biblioitems and deletedbiblioitems, add system preferences AgeRestrictionMarker and AgeRestrictionOverride)\n"; + SetVersion($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) @@ -5632,8 +5718,6 @@ sub TableExists { Drop all foreign keys of the table $table =cut - - sub DropAllForeignKeys { my ($table) = @_; # get the table description @@ -5694,4 +5778,3 @@ sub SetVersion { C4::Context::clear_syspref_cache(); # invalidate cached preferences } exit; - diff --git a/koha-tmpl/intranet-tmpl/prog/en/css/datatables.css b/koha-tmpl/intranet-tmpl/prog/en/css/datatables.css index a54c6126a2..214e543c96 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/css/datatables.css +++ b/koha-tmpl/intranet-tmpl/prog/en/css/datatables.css @@ -64,7 +64,6 @@ div.dataTables_filter { } div.dataTables_paginate { background-color : #F4F4F4; - font-size: 110%; padding : 0; } @@ -131,7 +130,7 @@ div.dataTables_paginate.paging_four_button { background-color : transparent; border-right : 1px solid #686868; border-left : 1px solid #FFF; - line-height : 1.8em; + line-height : 2.5em; } .paginate_disabled_first, .paginate_enabled_first, @@ -141,37 +140,64 @@ div.dataTables_paginate.paging_four_button { .paginate_enabled_next, .paginate_disabled_last, .paginate_enabled_last { - float: left; - height: 16px; - margin: .5em; - width: 16px; + cursor: pointer; + *cursor: hand; + padding: .1em 0; +} + +.paginate_disabled_previous, +.paginate_enabled_previous, +.paginate_disabled_next, +.paginate_enabled_next { + color: #111 !important; +} + +.paginate_disabled_previous, +.paginate_enabled_previous { + padding-left: 23px; +} +.paginate_disabled_next, +.paginate_enabled_next, +.paginate_disabled_last, +.paginate_enabled_last { + padding-right: 23px; + margin-left: 10px; + margin-right : .3em; +} + +.paging_four_button .paginate_disabled_first, +.paging_four_button .paginate_disabled_previous, +.paging_four_button .paginate_enabled_first, +.paging_four_button .paginate_enabled_previous { + margin-left : .3em; } + .paginate_disabled_first { - background-image: url("../../img/first-disabled.png"); + background: transparent url("../../img/first-disabled.png") no-repeat 3px top; } .paginate_enabled_first { - background-image: url("../../img/first.png"); + background: transparent url("../../img/first.png") no-repeat 3px top; cursor: pointer; } .paginate_disabled_previous { - background-image: url("../../img/prev-disabled.png"); + background: transparent url("../../img/prev-disabled.png") no-repeat 3px top; } .paginate_enabled_previous { - background-image: url("../../img/prev.png"); + background: transparent url("../../img/prev.png") no-repeat 3px top; cursor: pointer; } .paginate_disabled_next { - background-image: url("../../img/next-disabled.png"); + background: transparent url("../../img/next-disabled.png") no-repeat right top; } .paginate_enabled_next { - background-image: url("../../img/next.png"); + background: transparent url("../../img/next.png") no-repeat right top; cursor: pointer; } .paginate_disabled_last { - background-image: url("../../img/last-disabled.png"); + background: transparent url("../../img/last-disabled.png") no-repeat right top; } .paginate_enabled_last { - background-image: url("../../img/last.png"); + background: transparent url("../../img/last.png") no-repeat right top; cursor: pointer; } @@ -191,10 +217,6 @@ div.dataTables_paginate.paging_four_button { width: 250px; } -input { - border-radius: 5px; -} - tr.odd.selected td { background-color: #D3D3D3; } @@ -203,90 +225,3 @@ tr.even.selected td { background-color: #D3D3D3; } -/* -table.display { - width: 100%; -} -table.display thead th { - border-bottom: 1px solid black; - cursor: pointer; - font-weight: bold; - padding: 3px 18px 3px 10px; -} -.dataTables_wrapper { - clear: both; - position: relative; -} -.dataTables_processing { - background-color: white; - border: 1px solid #DDDDDD; - color: #999999; - font-size: 14px; - height: 30px; - left: 50%; - margin-left: -125px; - margin-top: -15px; - padding: 14px 0 2px; - position: fixed; - text-align: center; - top: 50%; - width: 250px; -} -.dataTables_info { - float: left; - width: 60%; -} -.dataTables_paginate { - float: right; - text-align: right; - width: 44px; -} -.paging_full_numbers { - height: 22px; - line-height: 22px; - width: 400px; -} -.paging_full_numbers span.paginate_button, - .paging_full_numbers span.paginate_active { - border: 1px solid #aaa; - -webkit-border-radius: 5px; - -moz-border-radius: 5px; - padding: 2px 5px; - margin: 0 3px; - cursor: pointer; - *cursor: hand; -} - -.paging_full_numbers span.paginate_button { - background-color: #ddd; -} - -.paging_full_numbers span.paginate_button:hover { - background-color: #ccc; -} - -.paging_full_numbers span.paginate_active { - background-color: #99B3FF; -} -.paginate_disabled_previous, .paginate_enabled_previous, .paginate_disabled_next, .paginate_enabled_next { - float: left; - height: 19px; - margin-left: 3px; - width: 19px; -} -.paginate_disabled_previous { - background-image: url("../../img/datatables/back_disabled.jpg"); -} -.paginate_enabled_previous { - background-image: url("../../img/datatables/back_enabled.jpg"); -} -.paginate_disabled_next { - background-image: url("../../img/datatables/forward_disabled.jpg"); -} -.paginate_enabled_next { - background-image: url("../../img/datatables/forward_enabled.jpg"); -} -.spacer { - clear: both; - height: 20px; -} 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 436b7280f7..afe98f7059 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css +++ b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css @@ -634,8 +634,9 @@ fieldset.rows label, fieldset.rows span.label { } fieldset.rows fieldset { + background-color: #FFF; border-width : 1px; - margin : 0 0 .5em 0; + margin : 1em; padding : .3em; } @@ -734,6 +735,10 @@ fieldset.action, div.action { width: auto; } +div.rows+div.rows { + margin-top : .6em; +} + div.rows { float : left; clear : left; @@ -1184,6 +1189,16 @@ div.alert strong { list-style-position:inside; } +a.clear-field { + background : transparent url("../../img/clear-field.png") center left no-repeat; + padding-left : 16px; +} + +a.clone-field { + background : transparent url("../../img/clone-field.png") center left no-repeat; + padding-left : 20px; +} + a.document { background-position : left middle; background-repeat : no-repeat; @@ -1260,6 +1275,10 @@ span.required { margin-left : .5em; } +.missing{ + background-color : #FFFFCC; +} + .term { background-color: #FFC; color : #990000; @@ -2351,6 +2370,33 @@ ul.ui-tabs-nav li { float: right; } +.contents { + width: 75%; +} + +.contentblock { + position: relative; + margin-left: 2em; +} + +.contents .t:first-child:before { + content: "→ "; +} + +.contents .t:before { + content: "\A→ "; + white-space: pre; +} + +.contents .t { + font-weight: bold; + display: inline; +} + +.contents .r { + display: inline; +} + /* jQuery UI Datepicker */ .ui-datepicker-trigger { vertical-align: middle; @@ -2361,3 +2407,11 @@ ul.ui-tabs-nav li { -webkit-box-shadow: 1px 1px 3px 0 #666; box-shadow: 1px 1px 3px 0 #666; } + +/* css for timepicker */ +.ui-timepicker-div .ui-widget-header { margin-bottom: 8px; } +.ui-timepicker-div dl { text-align: left; } +.ui-timepicker-div dl dt { height: 25px; margin-bottom: -25px; } +.ui-timepicker-div dl dd { margin: 0 10px 10px 65px; } +.ui-timepicker-div td { font-size: 90%; } +.ui-tpicker-grid-label { background: none; border: none; margin: 0; padding: 0; } diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-toolbar.inc index 11d7b3938f..0c52cc2677 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-toolbar.inc @@ -23,7 +23,9 @@ var manageorders = [ [% IF ( CAN_user_acquisition_order_manage ) %] + [% IF (active) %] { text: _("New basket"), url: "/cgi-bin/koha/acqui/basketheader.pl?booksellerid=[% booksellerid %]&op=add_form"}, + [% END %] { text: _("Baskets"), url: "/cgi-bin/koha/acqui/booksellers.pl?booksellerid=[% booksellerid %]"}, { text: _("Basket groups"), url: "/cgi-bin/koha/acqui/basketgroup.pl?booksellerid=[% booksellerid %]"}, [% END %] @@ -52,7 +54,7 @@ [% END %]
  • New contract
  • Contracts
  • - [% UNLESS ( basketcount ) %] + [% IF (active && !basketcount) %]
  • New basket
  • [% END %] [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/admin-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/admin-menu.inc index 5611a043c4..72162d382d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/admin-menu.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/admin-menu.inc @@ -27,12 +27,12 @@
    Patrons and circulation
    Catalog
    diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/auth-finder-search.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/auth-finder-search.inc index fe22d6b09d..7bffbc5d49 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/auth-finder-search.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/auth-finder-search.inc @@ -1,3 +1,4 @@ +[% PROCESS 'form-blocks.inc' %] - [% INCLUDE 'header.inc' %] @@ -237,7 +174,7 @@ Basket Order line Summary - View record + View record Quantity Unit cost Order cost @@ -421,7 +358,7 @@
    -
    +

    Filter

    @@ -430,28 +367,32 @@
  • - +
  • - +
  • - +
  • [% IF (UNIMARC) %]
  • - +
  • [% END %]
    - - Clear + + + + + + Clear
    diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt index a85d490c35..3906c46657 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt @@ -42,21 +42,21 @@
    Patron categories
    Define patron categories.
    -
    Cities and towns
    -
    Define cities and towns that your patrons live in.
    -
    Road types -
    -
    Define road types (street, avenue, way, etc.). Road types display as authorized values when adding/editing patrons and can be used in geographic statistics.
    -
    Patron attribute types
    -
    Define extended attributes (identifiers and statistical categories) for patron records
    [% IF CAN_user_parameters_manage_circ_rules %] -
    Circulation and fines rules
    -
    Define circulation and fines rules for combinations of libraries, patron categories, and item types
    +
    Circulation and fines rules
    +
    Define circulation and fines rules for combinations of libraries, patron categories, and item types
    [% END %] +
    Patron attribute types
    +
    Define extended attributes (identifiers and statistical categories) for patron records
    Library transfer limits
    Limit the ability to transfer items between libraries based on the library sending, the library receiving, and the item type involved. These rules only go into effect if the preference UseBranchTransferLimits is set to ON.
    Item circulation alerts
    Define rules for check-in and checkout notifications for combinations of libraries, patron categories, and item types
    +
    Cities and towns
    +
    Define cities and towns that your patrons live in.
    +
    Road types +
    +
    Define road types (street, avenue, way, etc.). Road types display as authorized values when adding/editing patrons and can be used in geographic statistics.
    diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categorie.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categorie.tt index e0be34be00..f1b82548b7 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categorie.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categorie.tt @@ -53,10 +53,18 @@ var ok=0; var _alertString=_("Form not submitted because of the following problem(s)"); _alertString +="\n-------------------------------------------------------------------\n\n"; - if (ff.categorycode.value.length==0) { - ok=1; - _alertString += _("- categorycode missing") + "\n"; - } + ff.categorycode.value = ff.categorycode.value.trim(); + if (ff.categorycode.value.length==0) { + ok=1; + _alertString += _("- categorycode missing") + "\n"; + } + else{ + var patt=/^[a-zA-Z0-9\-_]+$/g; + if ( !patt.test(ff.categorycode.value) ) { + ok=1; + _alertString += _("- category code can only contain the following characters: letters, numbers, - and _") + "\n"; + } + } if (!(ff.category_type.value)){ ok=1; _alertString += _("- category type missing") + "\n"; @@ -290,7 +298,7 @@ Confirm deletion of category [% categorycode |html %][% END %] [% loo.categorycode |html %] - [% loo.description |html %] + [% loo.description |html %] [% IF ( loo.type_A ) %]Adult[% END %] @@ -337,8 +345,8 @@ Confirm deletion of category [% categorycode |html %][% END %] [% END %] [% END %] - Edit - Delete + Edit + Delete [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref index fe5fd05fc5..404a04ed65 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref @@ -93,7 +93,18 @@ Cataloging: incremental: generated in the form 1, 2, 3. annual: generated in the form <year>-0001, <year>-0002. hbyymmincr: generated in the form <branchcode>yymm0001. + EAN13: incremental EAN-13 barcodes "OFF": not generated automatically. + - + - When a new item is added, should it be prefilled with last created item values? + - pref: PrefillItem + choices: + yes: the new item is prefilled with last created item values + no: the new item is not prefilled with last created item values + - + - Define a list of subfields to use when prefilling items (separated by space) + - pref: SubfieldsToUseWhenPrefill + Display: - - 'Separate multiple displayed authors, series or subjects with ' @@ -141,4 +152,8 @@ Cataloging: yes: Hide no: "Don't hide" - items marked as suppressed from OPAC search results. Note that you must have the Suppress index set up in Zebra and at least one suppressed item, or your searches will be broken. + - Restrict the suppression to IP adresses outside of the IP range + - pref: OpacSuppressionByIPRange + class: short + - (Leave blank if not used. Define a range like 192.168..) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref index e07fc0ded1..a9ed6f7a72 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref @@ -16,6 +16,7 @@ Circulation: cuecat: Convert from CueCat form T-prefix: Remove the first number from T-prefix style libsuite8: Convert from Libsuite8 form + EAN13: EAN-13 or zero-padded UPC-A from - scanned item barcodes. - - Sort previous checkouts on the circulation page from @@ -214,6 +215,15 @@ Circulation: no: "Prevent" - patrons from checking out an item whose rental charge would take them over the limit. - + - pref: AgeRestrictionMarker + - "E.g. FSK|PEGI|Age| (No white space near |). Entry in MARC field (e.g. 521a) as defined for agerestriction in Koha to MARC mapping. Entry in MARC field like FSK 12 or PEGI 12 would mean: Borrower must be 12 years old. (Empty: Do not apply age restriction.)" + - + - pref: AgeRestrictionOverride + choices: + yes: Allow + no: "Don't allow" + - staff to check out an item with age restriction. + - - Prevent patrons from checking out books if they have more than - pref: noissuescharge class: integer diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref index bb3bc2d89e..d1f281490f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref @@ -18,20 +18,6 @@ Enhanced Content: - other editions of an item on the OPAC. Amazon: - - - pref: AmazonEnabled - default: 0 - choices: - yes: Use - no: "Don't use" - - data from Amazon on the staff interface (including reviews and "Search Inside" links on item detail pages). This requires that you have signed up for and entered an access key. - - - - pref: OPACAmazonEnabled - default: 0 - choices: - yes: Use - no: "Don't use" - - data from Amazon on the OPAC (including reviews and "Search Inside" links on item detail pages). This requires that you have signed up for and entered an access key. - - - Use Amazon data from its - pref: AmazonLocale choices: @@ -43,14 +29,6 @@ Enhanced Content: UK: British - website. - - - Access Amazon content using the access key - - pref: AWSAccessKeyID - - (free, at http://aws.amazon.com/). - - - - Access Amazon content (other than book jackets) using the private key - - pref: AWSPrivateKey - - (free, at http://aws.amazon.com/). - - - Put the associate tag - pref: AmazonAssocTag - on links to Amazon. This can net your library referral fees if a patron decides to buy an item. @@ -62,40 +40,12 @@ Enhanced Content: no: "Don't show" - cover images from Amazon on search results and item detail pages on the staff interface. - - - pref: AmazonReviews - default: 1 - choices: - yes: Show - no: "Don't show" - - reviews from Amazon on item detail pages on the staff interface. - - - - pref: AmazonSimilarItems - default: 1 - choices: - yes: Show - no: "Don't show" - - similar items, as determined by Amazon, on item detail pages on the staff interface. - - - pref: OPACAmazonCoverImages default: 1 choices: yes: Show no: "Don't show" - cover images from Amazon on search results and item detail pages on the OPAC. - - - - pref: OPACAmazonSimilarItems - default: 1 - choices: - yes: Show - no: "Don't show" - - similar items, as determined by Amazon, on item detail pages on the OPAC. - - - - pref: OPACAmazonReviews - default: 1 - choices: - yes: Show - no: "Don't show" - - reviews from Amazon on item detail pages on the OPAC. Babelthèque: - - pref: Babeltheque 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 4a4d4de010..4df81b4cc8 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 @@ -151,17 +151,12 @@ OPAC: - Include the additional CSS stylesheet - pref: opaccolorstylesheet class: file - - to override specified settings from the default stylesheet (leave blank to disable). Enter a filename or a complete URL beginning with http:// (if the file lives on a remote server). Please note that if you enter a filename, the file should be in the css subdirectory for each active theme and language within the Koha templates directory. + - to override specified settings from the default stylesheet (leave blank to disable). Enter just a filename, a full local path or a complete URL starting with http:// (if the file lives on a remote server). Please note that if you just enter a filename, the file should be in the css subdirectory for each active theme and language within the Koha templates directory. A full local path is expected to start from your HTTP document root. - - Use the CSS stylesheet - pref: opaclayoutstylesheet class: file - - on all pages in the OPAC, instead of the default (leave blank to disable). Please enter filename only. The file should be in the css subdirectory for each active theme and language within the Koha templates directory. - - - - Use the remote CSS stylesheet - - pref: opacstylesheet - class: file - - on all pages in the OPAC, instead of the default. (This should be a complete URL, starting with http://.) + - on all pages in the OPAC, instead of the default css (used when leaving this field blank). Enter just a filename, a full local path or a complete URL starting with http:// (if the file lives on a remote server). Please note that if you just enter a filename, the file should be in the css subdirectory for each active theme and language within the Koha templates directory. A full local path is expected to start from your HTTP document root. - - "Include the following CSS on all pages in the OPAC:" - pref: OPACUserCSS @@ -204,7 +199,7 @@ OPAC: type: textarea class: code - - - 'Include a "Links" column on the "my summary" tab when a user is logged in to the OPAC, with the following HTML (leave blank to disable):' + - 'Include a "Links" column on the "my summary" and "my reading history" tabs when a user is logged in to the OPAC, with the following HTML (leave blank to disable):' - '
    Note: The placeholders {BIBLIONUMBER}, {TITLE}, {ISBN} and {AUTHOR} will be replaced with information from the displayed record.' - pref: OPACMySummaryHTML type: textarea @@ -364,7 +359,7 @@ OPAC: choices: yes: "Don't allow" no: Allow - - patrons to select their library on the OPAC. + - patrons to select their branch on the OPAC or show branch names with callnumbers. - - pref: SearchMyLibraryFirst choices: diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref index e324680b72..5176d520b3 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref @@ -99,7 +99,7 @@ Searching: choices: relevance: relevance popularity: total number of checkouts - callnumber: call number + call_number: call number pubdate: date of publication acqdate: date added title: title @@ -131,7 +131,7 @@ Searching: choices: relevance: relevance popularity: total number of checkouts - callnumber: call number + call_number: call number pubdate: date of publication acqdate: date added title: title diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/searchengine/solr/indexes.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/searchengine/solr/indexes.tt index 2ccbe5a376..7f5be96365 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/searchengine/solr/indexes.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/searchengine/solr/indexes.tt @@ -129,19 +129,51 @@ [% IF ( index.mandatory ) %] [% END %] - + [% ELSE %] + - + [% IF ( index.sortable ) %] + + [% ELSE %] + + [% END %] - + [% IF ( index.facetable ) %] + + [% ELSE %] + + [% END %]