From e5c824400956ca95cd753060200c4e1227269d56 Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Mon, 30 Nov 2009 06:54:47 +0100 Subject: [PATCH 01/80] C4/Search.pm followup auto_truncation 3.0.x cherry-pick Auto_truncation is used even though exact search selected. This patch removes this side effect Conflicts solved: C4/Search.pm Cherry-picked from 3.0.x : 3287252c0 --- C4/Search.pm | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/C4/Search.pm b/C4/Search.pm index be40b1b4ef..5007f238d3 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -934,10 +934,14 @@ sub buildQuery { } if ($auto_truncation){ - # join throws an error if there is a leading space - $operand =~ s/^\s+//; - $operand=~join(" ",map{ "$_*" }split (/\s+/,$operand)); - } + unless ( $index =~ /(st-|phr|ext)/ ) { + #FIXME only valid with LTR scripts + $operand=join(" ",map{ + "$_*" + }split (/\s+/,$operand)); + warn $operand if $DEBUG; + } + } # Detect Truncation my $truncated_operand; @@ -1208,7 +1212,12 @@ sub searchResults { # loop through all of the records we've retrieved for ( my $i = $offset ; $i <= $times - 1 ; $i++ ) { my $marcrecord = MARC::File::USMARC::decode( $marcresults[$i] ); +<<<<<<< HEAD:C4/Search.pm +======= + my $biblionumber; + +>>>>>>> C4/Search.pm followup auto_truncation 3.0.x cherry-pick:C4/Search.pm if ($bibliotag<10){ $fw = GetFrameworkCode($marcrecord->field($bibliotag)->data); }else{ From c8ff9618cd772c355aeae978f492205b7ad57f65 Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Tue, 13 Oct 2009 16:22:24 +0200 Subject: [PATCH 02/80] followup : auto_truncation 3287252c0 truncated words bore a double * which would create an error --- C4/Search.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/C4/Search.pm b/C4/Search.pm index 5007f238d3..993a92f0a5 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -937,7 +937,7 @@ sub buildQuery { unless ( $index =~ /(st-|phr|ext)/ ) { #FIXME only valid with LTR scripts $operand=join(" ",map{ - "$_*" + (index($_,"*")>0?"$_":"$_*") }split (/\s+/,$operand)); warn $operand if $DEBUG; } From e7753ce4652f3a096c8a08ef2c3dc65d5402ff2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Wed, 2 Dec 2009 15:31:15 +0100 Subject: [PATCH 03/80] [2343] Fix currency not showing in aqbudgets --- admin/aqbudgets.pl | 3 +++ .../intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tmpl | 2 +- koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tmpl | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/admin/aqbudgets.pl b/admin/aqbudgets.pl index c74d1d228e..01bfdbc840 100755 --- a/admin/aqbudgets.pl +++ b/admin/aqbudgets.pl @@ -50,6 +50,9 @@ my ($template, $borrowernumber, $cookie, $staffflags ) = get_template_and_user( } ); +my $cur = GetCurrency(); +$template->param( cur => $cur->{symbol} ); + my $op = $input->param('op'); # see if the user want to see all budgets or only owned ones diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tmpl index c226f7c692..d0b592f15c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tmpl @@ -253,7 +253,7 @@

Root budgets administration

- Currency = +

Currency =

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tmpl index 3e567b2fb8..f520d08f64 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tmpl @@ -219,7 +219,7 @@
-

Currency =

+

Currency =

From 39904f9415d098711abdc501afc2b1fe8ae105d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Wed, 2 Dec 2009 16:01:47 +0100 Subject: [PATCH 04/80] [MT2343] Changed the name of the Filter button, and lowered it --- koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tmpl | 1 - 1 file changed, 1 deletion(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tmpl index f520d08f64..e056bbb6a0 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tmpl @@ -154,7 +154,6 @@

Budgets for ''

- From 4ba64ad0e103be1e164dabd189092f3f944acb7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Wed, 2 Dec 2009 16:59:08 +0100 Subject: [PATCH 05/80] [MT2343] Changed the red X for a green V in the root budget table --- .../intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tmpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tmpl index d0b592f15c..5d661c988a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tmpl @@ -276,8 +276,8 @@ - - + + @@ -390,11 +390,11 @@ NAME="name" -->">
" title="View budgets for "> Active  Locked  Active  Locked  ?op=add_form&budget_period_id=">Edit From 612d5c01087328eb9694efd22d090bdd6162acc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Thu, 3 Dec 2009 15:57:34 +0100 Subject: [PATCH 06/80] [MT2343] Moved currency up the table --- koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqplan.tmpl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqplan.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqplan.tmpl index 0fd8915fe5..3947c3c612 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqplan.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqplan.tmpl @@ -155,6 +155,8 @@ YAHOO.util.Event.onAvailable("popmenu", function () { +

Currency =

+ @@ -257,7 +259,6 @@ YAHOO.util.Event.onAvailable("popmenu", function () { Cells contain estimated values only.
- Currency =
From 22f7fc269b40647394c876031845c51d8a1cb7a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Thu, 3 Dec 2009 17:09:23 +0100 Subject: [PATCH 07/80] [MT2343] Removed HTML heresy from aqplan template --- .../intranet-tmpl/prog/en/modules/admin/aqplan.tmpl | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqplan.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqplan.tmpl index 3947c3c612..e04b6d567a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqplan.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqplan.tmpl @@ -21,7 +21,6 @@ Budget planning - - + +Budget planning + + + + + From 10c96100586e7272b35c0052cd5b684a54cae108 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Thu, 10 Dec 2009 12:00:46 +0100 Subject: [PATCH 11/80] [MT1234] Code cleaning --- admin/aqcontract.pl | 121 ++++++++---------- .../prog/en/modules/admin/aqcontract.tmpl | 14 +- 2 files changed, 55 insertions(+), 80 deletions(-) diff --git a/admin/aqcontract.pl b/admin/aqcontract.pl index 9adedfe45d..0d9a8583dc 100755 --- a/admin/aqcontract.pl +++ b/admin/aqcontract.pl @@ -51,8 +51,8 @@ my $script_name = "/cgi-bin/koha/admin/aqcontract.pl"; my $contractnumber = $input->param('contractnumber'); my $booksellerid = $input->param('booksellerid'); my $op = $input->param('op') || ''; -my @bookseller = GetBookSellerFromId("$booksellerid"); +my @bookseller = GetBookSellerFromId($booksellerid); my ( $template, $loggedinuser, $cookie ) = get_template_and_user( { template_name => "admin/aqcontract.tmpl", @@ -69,7 +69,7 @@ $template->param( contractnumber => $contractnumber, searchfield => $searchfield, booksellerid => $booksellerid, - name => $bookseller[0]->{name}, + booksellername => $bookseller[0]->{name}, DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(), ); @@ -77,7 +77,6 @@ $template->param( if ( $op eq 'add_form' ) { $template->param( add_form => 1 ); my $data; - my $booksellername; #---- if primkey exists, it's a modify action, so read values to modify... if ($contractnumber) { @@ -86,14 +85,6 @@ if ( $op eq 'add_form' ) { $sth->execute($contractnumber); $data = $sth->fetchrow_hashref; $sth->finish; - - for ( @bookseller ) { - $booksellername = $$_{name} if $$_{id} eq $$data{booksellerid}; - } - } else { - for ( @bookseller ) { - $booksellername = $$_{name} if $$_{id} eq $booksellerid; - } } $template->param( @@ -102,54 +93,51 @@ if ( $op eq 'add_form' ) { contractdescription => $data->{'contractdescription'}, contractstartdate => format_date( $data->{'contractstartdate'} ), contractenddate => format_date( $data->{'contractenddate'} ), - booksellername => $booksellername, DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(), ); # END $OP eq ADD_FORM - - #ADD_VALIDATE: called by add_form, used to insert/modify data in DB } +#ADD_VALIDATE: called by add_form, used to insert/modify data in DB elsif ( $op eq 'add_validate' ) { ## Please see file perltidy.ERR - $template->param( add_validate => 1 ); - my $is_a_modif = $input->param("is_a_modif"); - my $dbh = C4::Context->dbh; - if ($is_a_modif) { - my $sth = $dbh->prepare( - "UPDATE aqcontract SET contractstartdate=?, - contractenddate=?, - contractname=?, - contractdescription=?, - booksellerid=? WHERE contractnumber=?" - ); - $sth->execute( - format_date_in_iso( $input->param('contractstartdate') ), - format_date_in_iso( $input->param('contractenddate') ), - $input->param('contractname'), - $input->param('contractdescription'), - $input->param('booksellerid'), - $input->param('contractnumber') - ); - $sth->finish; - } else { - my $sth = $dbh->prepare("INSERT INTO aqcontract (contractname,contractdescription,booksellerid,contractstartdate,contractenddate) values (?, ?, ?, ?, ?)"); - $sth->execute( - $input->param('contractname'), - $input->param('contractdescription'), - $input->param('booksellerid'), - format_date_in_iso( $input->param('contractstartdate') ), - format_date_in_iso( $input->param('contractenddate') ) - ); - $sth->finish; - } - print "Content-Type: text/html\n\n"; - exit; + $template->param( add_validate => 1 ); + my $is_a_modif = $input->param("is_a_modif"); + my $dbh = C4::Context->dbh; + if ($is_a_modif) { + my $sth = $dbh->prepare( + "UPDATE aqcontract SET contractstartdate=?, + contractenddate=?, + contractname=?, + contractdescription=?, + booksellerid=? WHERE contractnumber=?" + ); + $sth->execute( + format_date_in_iso( $input->param('contractstartdate') ), + format_date_in_iso( $input->param('contractenddate') ), + $input->param('contractname'), + $input->param('contractdescription'), + $input->param('booksellerid'), + $input->param('contractnumber') + ); + $sth->finish; + } else { + my $sth = $dbh->prepare("INSERT INTO aqcontract (contractname,contractdescription,booksellerid,contractstartdate,contractenddate) values (?, ?, ?, ?, ?)"); + $sth->execute( + $input->param('contractname'), + $input->param('contractdescription'), + $input->param('booksellerid'), + format_date_in_iso( $input->param('contractstartdate') ), + format_date_in_iso( $input->param('contractenddate') ) + ); + $sth->finish; + } + print "Content-Type: text/html\n\n"; + exit; - # END $OP eq ADD_VALIDATE - -#DELETE_CONFIRM: called by default form, used to confirm deletion of data in DB + # END $OP eq ADD_VALIDATE } +#DELETE_CONFIRM: called by default form, used to confirm deletion of data in DB elsif ( $op eq 'delete_confirm' ) { $template->param( delete_confirm => 1 ); @@ -178,9 +166,8 @@ elsif ( $op eq 'delete_confirm' ) { ); # END $OP eq DELETE_CONFIRM - - #DELETE_CONFIRMED: called by delete_confirm, used to effectively confirm deletion of data in DB } +#DELETE_CONFIRMED: called by delete_confirm, used to effectively confirm deletion of data in DB elsif ( $op eq 'delete_confirmed' ) { $template->param( delete_confirmed => 1 ); my $dbh = C4::Context->dbh; @@ -192,30 +179,22 @@ elsif ( $op eq 'delete_confirmed' ) { exit; # END $OP eq DELETE_CONFIRMED - # DEFAULT: Builds a list of contracts and displays them -} else { +} +# DEFAULT: Builds a list of contracts and displays them +else { $template->param(else => 1); my @loop; my ($count,$results)=StringSearch($searchfield); - my $toggle = 0; for (my $i=0; $i < $count; $i++){ if ( ($input->param('booksellerid') && $results->[$i]{'booksellerid'} == $input->param('booksellerid')) || ! $input->param('booksellerid') ) { - my %row = (contractnumber => $results->[$i]{'contractnumber'}, - contractname => $results->[$i]{'contractname'}, - contractdescription => $results->[$i]{'contractdescription'}, - contractstartdate => format_date($results->[$i]{'contractstartdate'}), - contractenddate => format_date($results->[$i]{'contractenddate'}), - booksellerid => $results->[$i]{'booksellerid'}, - toggle => $toggle ); - push @loop, \%row; - if ( $toggle eq 0 ) - { - $toggle = 1; - } - else - { - $toggle = 0; - } + push @loop, { + contractnumber => $results->[$i]{'contractnumber'}, + contractname => $results->[$i]{'contractname'}, + contractdescription => $results->[$i]{'contractdescription'}, + contractstartdate => format_date($results->[$i]{'contractstartdate'}), + contractenddate => format_date($results->[$i]{'contractenddate'}), + booksellerid => $results->[$i]{'booksellerid'}, + }; } } for my $contract (@loop) { diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqcontract.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqcontract.tmpl index eafd17ebb8..a0f6b20f6b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqcontract.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqcontract.tmpl @@ -57,7 +57,7 @@ function Check(ff) { › Administration › - "> + "> › ">Contracts @@ -204,7 +204,7 @@ function Check(ff) {
  • ">New Contract
  • -

    Contract(s) of

    +

    Contract(s) of

    @@ -215,13 +215,9 @@ function Check(ff) { - - - - - - + From 0ed6bcdabbfc82d603b8c15da0f699887c5c2f45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Thu, 10 Dec 2009 17:17:11 +0100 Subject: [PATCH 12/80] [MT1234] Huge rewritte to use the API instead of hardcoded SQL in the script Also fixes a bug in the template. --- C4/Contract.pm | 73 ++++++++ admin/aqcontract.pl | 166 ++++++------------ .../prog/en/modules/admin/aqcontract.tmpl | 1 + 3 files changed, 128 insertions(+), 112 deletions(-) create mode 100644 C4/Contract.pm diff --git a/C4/Contract.pm b/C4/Contract.pm new file mode 100644 index 0000000000..01dadd23de --- /dev/null +++ b/C4/Contract.pm @@ -0,0 +1,73 @@ +package C4::Contract; + +# Copyright 2009-2010 BibLibre SARL +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, +# Suite 330, Boston, MA 02111-1307 USA + +use strict; +use C4::SQLHelper qw(:all); + +use vars qw($VERSION @ISA @EXPORT); + +BEGIN { + # set the version for version checking + $VERSION = 3.2; + require Exporter; + @ISA = qw(Exporter); + @EXPORT = qw( + &GetContract + &AddContract + &ModContract + &DelContract + ); +} + +=head1 NAME + +C4::Contract - Koha functions for dealing with bookseller contracts. + +=head1 SYNOPSIS + +use C4::Contract; + +=head1 DESCRIPTION + +The functions in this module deal with contracts. They allow to +add a new contract, to modify it or to get some informations around +a contract. + +This module is just a wrapper for C4::SQLHelper functions, so take a look at +SQLHelper centralised documentation to know how to use the following subs. + +=cut + +sub GetContract { SearchInTable("aqcontract", shift); } + +sub AddContract { InsertInTable("aqcontract", shift); } + +sub ModContract { UpdateInTable("aqcontract", shift); } + +sub DelContract { DeleteInTable("aqcontract", shift); } + +1; + +__END__ + +=head1 AUTHOR + +Koha Developement team + +=cut diff --git a/admin/aqcontract.pl b/admin/aqcontract.pl index 0d9a8583dc..9476f06464 100755 --- a/admin/aqcontract.pl +++ b/admin/aqcontract.pl @@ -28,26 +28,9 @@ use C4::Auth; use C4::Output; use C4::Dates qw/format_date format_date_in_iso/; use C4::Bookseller qw/GetBookSellerFromId/; - -sub StringSearch { - my ($searchstring)=@_; - my $dbh = C4::Context->dbh; - $searchstring=~ s/\'/\\\'/g; - my @data=split(' ',$searchstring); - $data[0]='' unless $data[0]; - my $sth=$dbh->prepare("Select * from aqcontract where (contractdescription like ? or contractname like ?) order by contractnumber"); - $sth->execute("%$data[0]%","%$data[0]%"); - my @results; - while (my $row=$sth->fetchrow_hashref){ - push(@results,$row); - } - $sth->finish; - return (scalar(@results),\@results); -} +use C4::Contract; my $input = new CGI; -my $searchfield = $input->param('searchfield') || ''; -my $script_name = "/cgi-bin/koha/admin/aqcontract.pl"; my $contractnumber = $input->param('contractnumber'); my $booksellerid = $input->param('booksellerid'); my $op = $input->param('op') || ''; @@ -65,9 +48,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( ); $template->param( - script_name => $script_name, contractnumber => $contractnumber, - searchfield => $searchfield, booksellerid => $booksellerid, booksellername => $bookseller[0]->{name}, DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(), @@ -76,24 +57,17 @@ $template->param( #ADD_FORM: called if $op is 'add_form'. Used to create form to add or modify a record if ( $op eq 'add_form' ) { $template->param( add_form => 1 ); - my $data; - #---- if primkey exists, it's a modify action, so read values to modify... - if ($contractnumber) { - my $dbh = C4::Context->dbh; - my $sth = $dbh->prepare("select * from aqcontract where contractnumber=?"); - $sth->execute($contractnumber); - $data = $sth->fetchrow_hashref; - $sth->finish; - } + # if contractnumber exists, it's a modify action, so read values to modify... + my $contract = @{GetContract( { contractnumber => $contractnumber } )}[0] if $contractnumber; $template->param( - contractnumber => $data->{'contractnumber'}, - contractname => $data->{'contractname'}, - contractdescription => $data->{'contractdescription'}, - contractstartdate => format_date( $data->{'contractstartdate'} ), - contractenddate => format_date( $data->{'contractenddate'} ), - DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(), + contractnumber => $$contract{contractnumber}, + contractname => $$contract{contractname}, + contractdescription => $$contract{contractdescription}, + contractstartdate => format_date( $$contract{contractstartdate} ), + contractenddate => format_date( $$contract{contractenddate} ), + DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar, ); # END $OP eq ADD_FORM @@ -102,37 +76,29 @@ if ( $op eq 'add_form' ) { elsif ( $op eq 'add_validate' ) { ## Please see file perltidy.ERR $template->param( add_validate => 1 ); + my $is_a_modif = $input->param("is_a_modif"); - my $dbh = C4::Context->dbh; - if ($is_a_modif) { - my $sth = $dbh->prepare( - "UPDATE aqcontract SET contractstartdate=?, - contractenddate=?, - contractname=?, - contractdescription=?, - booksellerid=? WHERE contractnumber=?" - ); - $sth->execute( - format_date_in_iso( $input->param('contractstartdate') ), - format_date_in_iso( $input->param('contractenddate') ), - $input->param('contractname'), - $input->param('contractdescription'), - $input->param('booksellerid'), - $input->param('contractnumber') - ); - $sth->finish; + + if ( $is_a_modif ) { + ModContract({ + contractstartdate => format_date_in_iso( $input->param('contractstartdate') ), + contractenddate => format_date_in_iso( $input->param('contractenddate') ), + contractname => $input->param('contractname'), + contractdescription => $input->param('contractdescription'), + booksellerid => $input->param('booksellerid'), + contractnumber => $input->param('contractnumber'), + }); } else { - my $sth = $dbh->prepare("INSERT INTO aqcontract (contractname,contractdescription,booksellerid,contractstartdate,contractenddate) values (?, ?, ?, ?, ?)"); - $sth->execute( - $input->param('contractname'), - $input->param('contractdescription'), - $input->param('booksellerid'), - format_date_in_iso( $input->param('contractstartdate') ), - format_date_in_iso( $input->param('contractenddate') ) - ); - $sth->finish; + AddContract({ + contractname => $input->param('contractname'), + contractdescription => $input->param('contractdescription'), + booksellerid => $input->param('booksellerid'), + contractstartdate => format_date_in_iso( $input->param('contractstartdate') ), + contractenddate => format_date_in_iso( $input->param('contractenddate') ), + }); } - print "Content-Type: text/html\n\n"; + + print $input->redirect("aqcontract.pl?booksellerid=$booksellerid"); exit; # END $OP eq ADD_VALIDATE @@ -141,28 +107,14 @@ elsif ( $op eq 'add_validate' ) { elsif ( $op eq 'delete_confirm' ) { $template->param( delete_confirm => 1 ); - my $dbh = C4::Context->dbh; - my $sth = $dbh->prepare("select contractnumber,contractstartdate,contractenddate, - contractname,contractdescription,booksellerid - from aqcontract where contractnumber=?"); - $sth->execute($contractnumber); - my $data = $sth->fetchrow_hashref; - $sth->finish; - - my $query = "SELECT name FROM aqbooksellers WHERE id LIKE $data->{'booksellerid'}"; - my $sth2 = $dbh->prepare($query); - $sth2->execute; - my $result = $sth2->fetchrow; - my $booksellername = $result; + my $contract = @{GetContract( { contractnumber => $contractnumber } )}[0]; $template->param( - contractnumber => $data->{'contractnumber'}, - contractname => $data->{'contractname'}, - contractdescription => $data->{'contractdescription'}, - contractstartdate => format_date( $data->{'contractstartdate'} ), - contractenddate => format_date( $data->{'contractenddate'} ), - booksellerid => $data->{'booksellerid'}, - booksellername => $booksellername, + contractnumber => $$contract{contractnumber}, + contractname => $$contract{contractname}, + contractdescription => $$contract{contractdescription}, + contractstartdate => format_date( $$contract{contractstartdate} ), + contractenddate => format_date( $$contract{contractenddate} ), ); # END $OP eq DELETE_CONFIRM @@ -170,12 +122,10 @@ elsif ( $op eq 'delete_confirm' ) { #DELETE_CONFIRMED: called by delete_confirm, used to effectively confirm deletion of data in DB elsif ( $op eq 'delete_confirmed' ) { $template->param( delete_confirmed => 1 ); - my $dbh = C4::Context->dbh; - my $contractnumber = $input->param('contractnumber'); - my $sth = $dbh->prepare("delete from aqcontract where contractnumber=?"); - $sth->execute($contractnumber); - $sth->finish; - print "Content-Type: text/html\n\n"; + + DelContract( { contractnumber => $contractnumber } ); + + print $input->redirect("aqcontract.pl?booksellerid=$booksellerid"); exit; # END $OP eq DELETE_CONFIRMED @@ -183,28 +133,20 @@ elsif ( $op eq 'delete_confirmed' ) { # DEFAULT: Builds a list of contracts and displays them else { $template->param(else => 1); - my @loop; - my ($count,$results)=StringSearch($searchfield); - for (my $i=0; $i < $count; $i++){ - if ( ($input->param('booksellerid') && $results->[$i]{'booksellerid'} == $input->param('booksellerid')) || ! $input->param('booksellerid') ) { - push @loop, { - contractnumber => $results->[$i]{'contractnumber'}, - contractname => $results->[$i]{'contractname'}, - contractdescription => $results->[$i]{'contractdescription'}, - contractstartdate => format_date($results->[$i]{'contractstartdate'}), - contractenddate => format_date($results->[$i]{'contractenddate'}), - booksellerid => $results->[$i]{'booksellerid'}, - }; - } + + # get contracts + my @contracts = @{GetContract( { booksellerid => $booksellerid } )}; + + # format dates + for ( @contracts ) { + $$_{contractstartdate} = format_date($$_{contractstartdate}); + $$_{contractenddate} = format_date($$_{contractenddate}); } - for my $contract (@loop) { - my $dbh = C4::Context->dbh; - my $query = "SELECT name FROM aqbooksellers WHERE id LIKE $contract->{'booksellerid'}"; - my $sth =$dbh->prepare($query); - $sth->execute; - my $result=$sth->fetchrow; - $contract->{'booksellername'}=$result; - } - $template->param(loop => \@loop); -} #---- END $OP eq DEFAULT + + $template->param(loop => \@contracts); + + #---- END $OP eq DEFAULT +} + output_html_with_http_headers $input, $cookie, $template->output; + diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqcontract.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqcontract.tmpl index a0f6b20f6b..ae85de202d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqcontract.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqcontract.tmpl @@ -87,6 +87,7 @@ function Check(ff) {
    " method="post"> + " />

    Modify contract for

    From 20df800fae192afa3ead66a7bed6105aa628b5ea Mon Sep 17 00:00:00 2001 From: Matthias Meusburger Date: Thu, 10 Dec 2009 17:35:18 +0100 Subject: [PATCH 13/80] MT2232 : members/notices.pl and members/messaging.pl are doing the same thing --- .../prog/en/includes/circ-menu.inc | 3 - .../prog/en/includes/members-menu.inc | 3 - .../prog/en/modules/members/messaging.tmpl | 68 ------------ members/messaging.pl | 102 ------------------ 4 files changed, 176 deletions(-) delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/members/messaging.tmpl delete mode 100755 members/messaging.pl diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc index 443e12bb58..8db64af45f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc @@ -66,9 +66,6 @@
  • ">Circulation History
  • &src=circ">Modification Log
  • - -
  • ">Messaging
  • -
  • ">Notices
  • diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/members-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/members-menu.inc index 513d415a53..aebb2bfe20 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/members-menu.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/members-menu.inc @@ -7,9 +7,6 @@
  • ">Circulation History
  • ">Modification Log
  • - -
  • ">Messaging
  • - diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/messaging.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/members/messaging.tmpl deleted file mode 100644 index 75bec95196..0000000000 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/messaging.tmpl +++ /dev/null @@ -1,68 +0,0 @@ - -Koha › Patrons › <!-- TMPL_IF NAME="unknowuser" -->Patron does not exist<!-- TMPL_ELSE -->Patron Details for <!-- TMPL_VAR NAME="firstname" --> <!-- TMPL_VAR NAME="surname" --> (<!-- TMPL_VAR NAME="cardnumber" -->)<!-- /TMPL_IF --> - - - - - - - - -
    - -
    -
    -
    - - -
    - -

    Userid / Password update failed

    -Insufficient privileges. -

    Other fields updated.

    - - -

    Unable to delete staff user

    -

    Insufficient privileges.

    - - -

    Unable to delete patrons from other libraries with current settings

    -

    Insufficient privileges.

    - - -

    Unable to delete patron:

    -

    Insufficient privileges.

    - -
    - -
    - -
    - This patron does not exist. -
    - - -
     
    - ?op=add_form&contractnumber="> +
    + ?op=add_form&contractnumber=">
    - - - - - - - - - -
    Message Queue
    TypeSubjectStatusTime Prepared
    There is no record of any messages that have been sent to this patron.
    - - - - - - - - -
    - -
    - - diff --git a/members/messaging.pl b/members/messaging.pl deleted file mode 100755 index 6390dad38b..0000000000 --- a/members/messaging.pl +++ /dev/null @@ -1,102 +0,0 @@ -#!/usr/bin/perl - -# Copyright 2008 LibLime -# -# 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., 59 Temple Place, -# Suite 330, Boston, MA 02111-1307 USA - - -use strict; -use warnings; - -use CGI; -use C4::Context; -use C4::Auth; -use C4::Output; -use C4::Members; -use C4::Members::Messaging; -use C4::Dates; -use C4::Reserves; -use C4::Circulation; -use C4::Koha; -use C4::Letters; -use C4::Biblio; -use C4::Reserves; -use C4::Branch; # GetBranchName - -use Data::Dumper; - -use vars qw($debug); - -BEGIN { - $debug = $ENV{DEBUG} || 0; -} - -my $dbh = C4::Context->dbh; - -my $query = CGI->new(); - -my ( $template, $loggedinuser, $cookie ) = get_template_and_user( - { - template_name => 'members/messaging.tmpl', - query => $query, - type => "intranet", - authnotrequired => 0, - flagsrequired => { borrowers => 1 }, - debug => 1, - } -); -my $borrowernumber = $query->param('borrowernumber'); -my $borrower = GetMember( 'borrowernumber' => $borrowernumber ); -my $branch = C4::Context->userenv->{'branch'}; - -$template->param( $borrower ); - -$borrower = GetMemberDetails( $borrowernumber ); - - - if ( $borrower->{'category_type'} eq 'C') { - my ( $catcodes, $labels ) = GetborCatFromCatType( 'A', 'WHERE category_type = ?' ); - my $cnt = scalar(@$catcodes); - $template->param( 'CATCODE_MULTI' => 1) if $cnt > 1; - $template->param( 'catcode' => $catcodes->[0]) if $cnt == 1; - } - -my ($picture, $dberror) = GetPatronImage($borrower->{'cardnumber'}); -$template->param( picture => 1 ) if $picture; - -# get some recent messages sent to this borrower for display: -my $message_queue = C4::Letters::GetQueuedMessages( { borrowernumber => $query->param('borrowernumber') } ); - -$template->param( messagingview => 1, - message_queue => $message_queue, - DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(), - borrowernumber => $borrowernumber, - branchcode => $borrower->{'branchcode'}, - branchname => GetBranchName($borrower->{'branchcode'}), - dateformat => C4::Context->preference("dateformat"), - categoryname => $borrower->{'description'}, - $borrower->{'categorycode'} => 1, -); - -#$messaging_preferences->{'SMSnumber'}{'value'} = defined $borrower->{'smsalertnumber'} -# ? $borrower->{'smsalertnumber'} : $borrower->{'mobile'}; - -$template->param( BORROWER_INFO => [ $borrower ], - messagingview => 1, - is_child => ($borrower->{'category_type'} eq 'C'), - ); - -output_html_with_http_headers $query, $cookie, $template->output; From 697e8e7014afb1c49e6a0c8a2cf584a5f47f5bf3 Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Thu, 10 Dec 2009 17:34:26 +0100 Subject: [PATCH 14/80] SearchInTable : problem with primary key searches SearchInTable was filtering primary Key thus returning the whole table when asked a search on a primary key --- C4/SQLHelper.pm | 2 +- t/db_dependent/SQLHelper.t | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/C4/SQLHelper.pm b/C4/SQLHelper.pm index d2df0a533e..05e3cc66f0 100644 --- a/C4/SQLHelper.pm +++ b/C4/SQLHelper.pm @@ -97,7 +97,7 @@ $searchtype is string Can be "start_with" or "exact" sub SearchInTable{ my ($tablename,$filters,$orderby, $limit, $columns_out, $filter_columns,$searchtype) = @_; -# $searchtype||="start_with"; + $searchtype||="exact"; my $dbh = C4::Context->dbh; $columns_out||=["*"]; my $sql = do { local $"=', '; diff --git a/t/db_dependent/SQLHelper.t b/t/db_dependent/SQLHelper.t index 4932a05d5d..ffa8d43115 100755 --- a/t/db_dependent/SQLHelper.t +++ b/t/db_dependent/SQLHelper.t @@ -10,8 +10,9 @@ use YAML; use C4::Debug; use C4::SQLHelper qw(:all); -use Test::More tests => 15; +use Test::More tests => 16; +#1 BEGIN { use_ok('C4::SQLHelper'); } @@ -22,31 +23,48 @@ my $branches=C4::Branch->GetBranches; my @branchcodes=keys %$branches; my ($borrid, $borrtmp); $borrtmp=InsertInTable("borrowers",{firstname=>"Jean",surname=>"cocteau",city=>" ",zipcode=>" ",email=>"email",categorycode=>$categories[0]->{categorycode}, branchcode=>$branchcodes[0]}); +#2 ok($borrid=InsertInTable("borrowers",{firstname=>"Jean",surname=>"Valjean",city=>" ",zipcode=>" ",email=>"email",categorycode=>$categories[0]->{categorycode}, branchcode=>$branchcodes[0]}),"Insert In Table"); +#3 ok(my $status=UpdateInTable("borrowers",{borrowernumber=>$borrid,firstname=>"Jean",surname=>"Valjean",city=>"Dampierre",zipcode=>" ",email=>"email", branchcode=>$branchcodes[1]}),"Update In Table"); my $borrowers=SearchInTable("borrowers"); +#4 ok(@$borrowers>0, "Search In Table All values"); +$borrowers=SearchInTable("borrowers",{borrowernumber=>$borrid}); +#5 +ok(@$borrowers==1, "Search In Table by primary key on table"); $borrowers=SearchInTable("borrowers",{firstname=>"Jean"}); +#6 ok(@$borrowers>0, "Search In Table hashref"); $borrowers=SearchInTable("borrowers","Jean"); +#7 ok(@$borrowers>0, "Search In Table string"); eval{$borrowers=SearchInTable("borrowers","Jean Valjean")}; +#8 ok(scalar(@$borrowers)==1 && !($@), "Search In Table does an implicit AND of all the words in strings"); $borrowers=SearchInTable("borrowers",["Valjean",{firstname=>"Jean"}]); +#9 ok(@$borrowers>0, "Search In Table arrayref"); $borrowers=SearchInTable("borrowers",["Valjean",{firstname=>"Jean"}],undef,undef,[qw(borrowernumber)]); +#10 ok(keys %{$$borrowers[0]} ==1, "Search In Table columns out limit"); $borrowers=SearchInTable("borrowers",["Valjean",{firstname=>"Jean"}],undef,undef,[qw(borrowernumber)],[qw(firstname surname title)]); +#11 ok(@$borrowers>0, "Search In Table columns out limit to borrowernumber AND filter firstname surname title"); $borrowers=SearchInTable("borrowers",["Valjean",{firstname=>"Jean"}],undef,undef,[qw(borrowernumber)],[qw(firstname title)]); +#12 ok(@$borrowers==0, "Search In Table columns filter firstname title limit Valjean not in other fields than surname "); $borrowers=SearchInTable("borrowers",["Val",{firstname=>"Jean"}],undef,undef,[qw(borrowernumber)],[qw(surname)],"start_with"); +#13 ok(@$borrowers>0, "Search In Table columns filter surname Val on a wide search found "); $borrowers=SearchInTable("borrowers",["Val",{firstname=>"Jean"}],undef,undef,[qw(borrowernumber)],[qw(surname)],"exact"); +#14 ok(@$borrowers==0, "Search In Table columns filter surname Val in exact search not found "); $borrowers=eval{SearchInTable("borrowers",["Val",{member=>"Jean"}],undef,undef,[qw(borrowernumber)],[qw(firstname title)],"exact")}; +#15 ok(@$borrowers==0 && !($@), "Search In Table fails gracefully when no correct field passed in hash"); $status=DeleteInTable("borrowers",{borrowernumber=>$borrid}); +#16 ok($status>0 && !($@), "DeleteInTable OK"); $status=DeleteInTable("borrowers",{borrowernumber=>$borrtmp}); From db4c107c733e78a6560561a1e1412e653c275639 Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Sun, 13 Dec 2009 19:20:39 +0100 Subject: [PATCH 15/80] Adding optgroup labels to translations --- misc/translator/tmpl_process3.pl | 3 ++- misc/translator/xgettext.pl | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/misc/translator/tmpl_process3.pl b/misc/translator/tmpl_process3.pl index 8bf92bf2e4..80325d077f 100755 --- a/misc/translator/tmpl_process3.pl +++ b/misc/translator/tmpl_process3.pl @@ -50,8 +50,9 @@ sub text_replace_tag ($$) { # value [tag=input], meta my $tag = lc($1) if $t =~ /^<(\S+)/s; my $translated_p = 0; - for my $a ('alt', 'content', 'title', 'value') { + for my $a ('alt', 'content', 'title', 'value','label') { if ($attr->{$a}) { + next if $a eq 'label' && $tag ne 'optgroup'; next if $a eq 'content' && $tag ne 'meta'; next if $a eq 'value' && ($tag ne 'input' || (ref $attr->{'type'} && $attr->{'type'}->[1] =~ /^(?:checkbox|hidden|radio|text)$/)); # FIXME diff --git a/misc/translator/xgettext.pl b/misc/translator/xgettext.pl index 996b952db6..a13be97466 100755 --- a/misc/translator/xgettext.pl +++ b/misc/translator/xgettext.pl @@ -98,8 +98,9 @@ sub text_extract (*) { } elsif ($kind eq TmplTokenType::TAG && %$attr) { # value [tag=input], meta my $tag = lc($1) if $t =~ /^<(\S+)/s; - for my $a ('alt', 'content', 'title', 'value') { + for my $a ('alt', 'content', 'title', 'value','label') { if ($attr->{$a}) { + next if $a eq 'label' && $tag ne 'optgroup'; next if $a eq 'content' && $tag ne 'meta'; next if $a eq 'value' && ($tag ne 'input' || (ref $attr->{'type'} && $attr->{'type'}->[1] =~ /^(?:hidden|radio|submit)$/)); # FIXME From 94cca6a22b4738d4cec857ecbf40ef81fb2fbdcd Mon Sep 17 00:00:00 2001 From: Matthias Meusburger Date: Fri, 11 Dec 2009 11:12:23 +0100 Subject: [PATCH 16/80] MT 2495 : Fix multiple occurences of itemtype in guided reports criteria Signed-off-by: Henri-Damien LAURENT --- C4/Reports/Guided.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/C4/Reports/Guided.pm b/C4/Reports/Guided.pm index a7d6f48006..0c969e3253 100644 --- a/C4/Reports/Guided.pm +++ b/C4/Reports/Guided.pm @@ -82,11 +82,12 @@ $criteria{'1'} = [ 'items.dateaccessioned|date' ]; $criteria{'2'} = - [ 'items.itemnumber|textrange', 'items.biblionumber|textrange', 'items.barcode|textrange', 'biblio.frameworkcode', 'items.holdingbranch', 'items.homebranch', 'biblio.datecreated|daterange', 'biblio.timestamp|daterange', 'items.onloan|daterange', 'items.ccode', 'items.itemcallnumber|textrange', 'items.itype', 'items.itemlost', 'items.location' ]; + [ 'items.itemnumber|textrange', 'items.biblionumber|textrange', 'items.barcode|textrange', 'biblio.frameworkcode', 'items.holdingbranch', 'items.homebranch', 'biblio.datecreated|daterange', 'biblio.timestamp|daterange', 'items.onloan|daterange', 'items.ccode', 'items.itemcallnumber|textrange', 'items.itemlost', 'items.location' ]; $criteria{'3'} = ['borrowers.branchcode']; $criteria{'4'} = ['aqorders.datereceived|date']; $criteria{'5'} = ['borrowers.branchcode']; +# Adds itemtypes to criteria, according to the syspref if (C4::Context->preference('item-level_itypes')) { unshift @{ $criteria{'1'} }, 'items.itype'; unshift @{ $criteria{'2'} }, 'items.itype'; From 7d8b369ba4066d485e5aa7739b1b073f0db80b45 Mon Sep 17 00:00:00 2001 From: Paul Poulain Date: Tue, 15 Dec 2009 19:55:58 +0100 Subject: [PATCH 17/80] Improved guided reports (#3929) added runtime parameters for guided reports. Online help: Can I have run-time defined parameters? Yes, you can: there is a specific syntax that Koha will understand as 'ask for values when running the report'. The syntax is <<Question to ask|authorised_value>>. The << and >> are just delimiters. You must put << at the beginning and >> at the end of your parameter The Question to ask will be displayed on the left of the string to enter. The authorised_value can be omitted if not applicable. If it contains an authorised value category, or branches or itemtype or categorycode, a list with the Koha authorised values will be displayed instead of a free field Note that you can have more than one parameter in a given SQL Note that entering nothing at run time won't probably work as you expect. It will be considered as "value empty" not as "ignore this parameter". For example entering nothing for : "title=<<Enter title>>" will display results with title='' (no title). If you want to have to have something not mandatory, use "title like <<Enter title>>" and enter a % at run time instead of nothing Sample : SELECT surname,firstname FROM borrowers WHERE branchcode=<<Enter patrons library|branches>> AND surname like <<Enter filter for patron surname (% if none)>> --- C4/Reports/Guided.pm | 25 ++- .../modules/help/reports/guided_reports.tmpl | 14 +- .../modules/reports/guided_reports_start.tmpl | 20 ++- reports/guided_reports.pl | 159 ++++++++++++++---- 4 files changed, 181 insertions(+), 37 deletions(-) diff --git a/C4/Reports/Guided.pm b/C4/Reports/Guided.pm index 0c969e3253..d8277b7e31 100644 --- a/C4/Reports/Guided.pm +++ b/C4/Reports/Guided.pm @@ -75,17 +75,27 @@ $keys{'5'} = ['borrowers.borrowernumber=accountlines.borrowernumber']; # have to do someting here to know if its dropdown, free text, date etc our %criteria; +# reports on circulation $criteria{'1'} = [ 'statistics.type', 'borrowers.categorycode', 'statistics.branch', 'biblioitems.publicationyear|date', 'items.dateaccessioned|date' ]; +# reports on catalogue $criteria{'2'} = - [ 'items.itemnumber|textrange', 'items.biblionumber|textrange', 'items.barcode|textrange', 'biblio.frameworkcode', 'items.holdingbranch', 'items.homebranch', 'biblio.datecreated|daterange', 'biblio.timestamp|daterange', 'items.onloan|daterange', 'items.ccode', 'items.itemcallnumber|textrange', 'items.itemlost', 'items.location' ]; -$criteria{'3'} = ['borrowers.branchcode']; + [ 'items.itemnumber|textrange', 'items.biblionumber|textrange', 'items.barcode|textrange', + 'biblio.frameworkcode', 'items.holdingbranch', 'items.homebranch', + 'biblio.datecreated|daterange', 'biblio.timestamp|daterange', 'items.onloan|daterange', + 'items.ccode', 'items.itemcallnumber|textrange', 'items.itype', + 'items.itemlost', 'items.location' ]; +# reports on borrowers +$criteria{'3'} = ['borrowers.branchcode', 'borrowers.categorycode']; +# reports on acquisition $criteria{'4'} = ['aqorders.datereceived|date']; -$criteria{'5'} = ['borrowers.branchcode']; + +# reports on accounting +$criteria{'5'} = ['borrowers.branchcode', 'borrowers.categorycode']; # Adds itemtypes to criteria, according to the syspref if (C4::Context->preference('item-level_itypes')) { @@ -245,7 +255,6 @@ sub _build_query { my $dbh = C4::Context->dbh(); my $joinedtables = join( ',', @$tables ); my $joinedcolumns = join( ',', @$columns ); - my $joinedkeys = join( ' AND ', @$keys ); my $query = "SELECT $totals $joinedcolumns FROM $tables->[0] "; for (my $i=1;$i<@$tables;$i++){ @@ -342,6 +351,14 @@ sub get_criteria { my $sth = $dbh->prepare($query); $sth->execute(); my @values; + # push the runtime choosing option + my $list; + $list='branches' if $column eq 'branchcode' or $column eq 'holdingbranch' or $column eq 'homebranch'; + $list='categorycode' if $column eq 'categorycode'; + $list='itemtype' if $column eq 'itype'; + $list='ccode' if $column eq 'ccode'; + # TODO : improve to let the librarian choose the description at runtime + push @values, { availablevalues => "<<$column".($list?"|$list":'').">>" }; while ( my $row = $sth->fetchrow_hashref() ) { push @values, $row; if ($row->{'availablevalues'} eq '') { $row->{'default'} = 1 }; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/help/reports/guided_reports.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/help/reports/guided_reports.tmpl index 63bf22e868..b6c7b3e1fb 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/help/reports/guided_reports.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/help/reports/guided_reports.tmpl @@ -52,5 +52,17 @@

    NEKLS also has a great page (http://www.nexpresslibrary.org/training/reports-training/) with a list of reports they have written.

    +

    Can I have run-time defined parameters?

    - \ No newline at end of file +

    Yes, you can: there is a specific syntax that Koha will understand as 'ask for values when running the report'. The syntax is <<Question to ask|authorised_value>>.

    +
      +
    • The << and >> are just delimiters. You must put << at the beginning and >> at the end of your parameter
    • +
    • The Question to ask will be displayed on the left of the string to enter. +
    • The authorised_value can be omitted if not applicable. If it contains an authorised value category, or branches or itemtype or categorycode, a list with the Koha authorised values will be displayed instead of a free field
    • +
    +

    Note that you can have more than one parameter in a given SQL

    +

    Note that entering nothing at run time won't probably work as you expect. It will be considered as "value empty" not as "ignore this parameter". For example entering nothing for : "title=<<Enter title>>" will display results with title='' (no title). If you want to have to have something not mandatory, use "title like <<Enter title>>" and enter a % at run time instead of nothing

    +

    Sample :

    +
    • SELECT surname,firstname FROM borrowers WHERE branchcode=<<Enter patrons library|branches>> AND surname like <<Enter filter for patron surname (% if none)>>
    + + diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tmpl index 70fa0bfcd9..731b8664c6 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tmpl @@ -294,7 +294,7 @@ canned reports and writing custom SQL reports.

    Confirm Custom Report

    Your report will be generated with the following SQL statement.

    - +

    -" /> +" /> " />

    You will need to save the report before you can execute it

    @@ -417,10 +417,24 @@ NAME="name" -->">
    + +
    + + +

    Enter parameters for report :

    +

    + +

    :

    + + +
    + +

    Total number of rows matching the (unlimited) query is .

    + diff --git a/reports/guided_reports.pl b/reports/guided_reports.pl index e42974da00..24b7878fa6 100755 --- a/reports/guided_reports.pl +++ b/reports/guided_reports.pl @@ -26,6 +26,7 @@ use C4::Auth; use C4::Output; use C4::Dates; use C4::Debug; +use C4::Branch; # XXX subfield_is_koha_internal_p =head1 NAME @@ -226,7 +227,12 @@ elsif ( $phase eq 'Choose these criteria' ) { if ($value =~ C4::Dates->regexp('syspref')) { $value = C4::Dates->new($value)->output("iso"); } - $query_criteria .= " AND $crit='$value'"; + # don't escape runtime parameters, they'll be at runtime + if ($value =~ /<<.*>>/) { + $query_criteria .= " AND $crit=$value"; + } else { + $query_criteria .= " AND $crit='$value'"; + } } warn $query_criteria; } @@ -304,8 +310,7 @@ elsif ( $phase eq 'Build Report' ) { my $column = $input->param('column'); my $crit = $input->param('criteria'); my $totals = $input->param('totals'); - my $definition = $input->param('definition'); -# my @criteria = split( ',', $crit ); + my $definition = $input->param('definition'); my $query_criteria=$crit; # split the columns up by , my @columns = split( ',', $column ); @@ -377,6 +382,7 @@ elsif ($phase eq 'Run this report'){ my $limit = 20; # page size. # TODO: move to DB or syspref? my $offset = 0; my $report = $input->param('reports'); + my @sql_params = $input->param('sql_params'); # offset algorithm if ($input->param('page')) { $offset = ($input->param('page') - 1) * $limit; @@ -386,33 +392,128 @@ elsif ($phase eq 'Run this report'){ push @errors, {no_sql_for_id=>$report}; } my @rows = (); - my ($sth, $errors) = execute_query($sql, $offset, $limit); - my $total = select_2_select_count_value($sql) || 0; - unless ($sth) { - die "execute_query failed to return sth for report $report: $sql"; - } else { - my $headref = $sth->{NAME} || []; - my @headers = map { +{ cell => $_ } } @$headref; - $template->param(header_row => \@headers); - while (my $row = $sth->fetchrow_arrayref()) { - my @cells = map { +{ cell => $_ } } @$row; - push @rows, { cells => \@cells }; - } - } + # if we have at least 1 parameter, and it's not filled, then don't execute but ask for parameters + if ($sql =~ /<>/,$sql; + my @tmpl_parameters; + for(my $i=0;$i<($#split/2);$i++) { + my ($text,$authorised_value) = split /\|/,$split[$i*2+1]; + my $input; + if ($authorised_value) { + my $dbh=C4::Context->dbh; + my @authorised_values; + my %authorised_lib; + # builds list, depending on authorised value... + if ( $authorised_value eq "branches" ) { + my $branches = GetBranchesLoop(); + foreach my $thisbranch (@$branches) { + push @authorised_values, $thisbranch->{value}; + $authorised_lib{$thisbranch->{value}} = $thisbranch->{branchname}; + } + } + elsif ( $authorised_value eq "itemtypes" ) { + my $sth = $dbh->prepare("SELECT itemtype,description FROM itemtypes ORDER BY description"); + $sth->execute; + while ( my ( $itemtype, $description ) = $sth->fetchrow_array ) { + push @authorised_values, $itemtype; + $authorised_lib{$itemtype} = $description; + } + } + elsif ( $authorised_value eq "cn_source" ) { + my $class_sources = GetClassSources(); + my $default_source = C4::Context->preference("DefaultClassificationSource"); + foreach my $class_source (sort keys %$class_sources) { + next unless $class_sources->{$class_source}->{'used'} or + ($class_source eq $default_source); + push @authorised_values, $class_source; + $authorised_lib{$class_source} = $class_sources->{$class_source}->{'description'}; + } + } + elsif ( $authorised_value eq "categorycode" ) { + my $sth = $dbh->prepare("SELECT categorycode, description FROM categories ORDER BY description"); + $sth->execute; + while ( my ( $categorycode, $description ) = $sth->fetchrow_array ) { + push @authorised_values, $categorycode; + $authorised_lib{$categorycode} = $description; + } - my $totpages = int($total/$limit) + (($total % $limit) > 0 ? 1 : 0); - my $url = "/cgi-bin/koha/reports/guided_reports.pl?reports=$report&phase=Run%20this%20report"; - $template->param( - 'results' => \@rows, - 'sql' => $sql, - 'execute' => 1, - 'name' => $name, - 'notes' => $notes, - 'errors' => $errors, - 'pagination_bar' => pagination_bar($url, $totpages, $input->param('page')), - 'unlimited_total' => $total, - ); -} + #---- "true" authorised value + } + else { + my $authorised_values_sth = $dbh->prepare("SELECT authorised_value,lib FROM authorised_values WHERE category=? ORDER BY lib"); + + $authorised_values_sth->execute( $authorised_value); + + while ( my ( $value, $lib ) = $authorised_values_sth->fetchrow_array ) { + push @authorised_values, $value; + $authorised_lib{$value} = $lib; + # For item location, we show the code and the libelle + $authorised_lib{$value} = $lib; + } + } + $input =CGI::scrolling_list( # FIXME: factor out scrolling_list + -name => "sql_params", + -values => \@authorised_values, +# -default => $value, + -labels => \%authorised_lib, + -override => 1, + -size => 1, + -multiple => 0, + -tabindex => 1, + ); + + } else { + $input = ""; + } + push @tmpl_parameters, {'entry' => $text, 'input' => $input }; + } + $template->param('sql' => $sql, + 'name' => $name, + 'sql_params' => \@tmpl_parameters, + 'enter_params' => 1, + 'reports' => $report, + ); + } else { + # OK, we have parameters, or there are none, we run the report + # if there were parameters, replace before running + # split on ??. Each odd (2,4,6,...) entry should be a parameter to fill + my @split = split /<<|>>/,$sql; + my @tmpl_parameters; + for(my $i=0;$i<$#split/2;$i++) { + my $quoted = C4::Context->dbh->quote($sql_params[$i]); + # if there are special regexp chars, we must \ them + $split[$i*2+1] =~ s/(\||\?|\.|\*|\(|\)|\%)/\\$1/g; + $sql =~ s/<<$split[$i*2+1]>>/$quoted/; + } + my ($sth, $errors) = execute_query($sql, $offset, $limit); + my $total = select_2_select_count_value($sql) || 0; + unless ($sth) { + die "execute_query failed to return sth for report $report: $sql"; + } else { + my $headref = $sth->{NAME} || []; + my @headers = map { +{ cell => $_ } } @$headref; + $template->param(header_row => \@headers); + while (my $row = $sth->fetchrow_arrayref()) { + my @cells = map { +{ cell => $_ } } @$row; + push @rows, { cells => \@cells }; + } + } + + my $totpages = int($total/$limit) + (($total % $limit) > 0 ? 1 : 0); + my $url = "/cgi-bin/koha/reports/guided_reports.pl?reports=$report&phase=Run%20this%20report"; + $template->param( + 'results' => \@rows, + 'sql' => $sql, + 'execute' => 1, + 'name' => $name, + 'notes' => $notes, + 'errors' => $errors, + 'pagination_bar' => pagination_bar($url, $totpages, $input->param('page')), + 'unlimited_total' => $total, + ); + } +} elsif ($phase eq 'Export'){ binmode STDOUT, ':utf8'; From 10c727edf3bcfa5da3b831549adffbdf7fa6c472 Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Wed, 16 Dec 2009 17:01:00 +0100 Subject: [PATCH 18/80] Revert "C4/Search.pm followup auto_truncation 3.0.x cherry-pick" This reverts commit 58406a5e4bb50e18c9620e91b90295d8219842b8. Conflicts: C4/Search.pm --- C4/Search.pm | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/C4/Search.pm b/C4/Search.pm index 993a92f0a5..b35ca9f22d 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -934,13 +934,7 @@ sub buildQuery { } if ($auto_truncation){ - unless ( $index =~ /(st-|phr|ext)/ ) { - #FIXME only valid with LTR scripts - $operand=join(" ",map{ - (index($_,"*")>0?"$_":"$_*") - }split (/\s+/,$operand)); - warn $operand if $DEBUG; - } + $operand=~join(" ",map{ "$_*" }split (/\s+/,$operand)); } # Detect Truncation @@ -1212,12 +1206,6 @@ sub searchResults { # loop through all of the records we've retrieved for ( my $i = $offset ; $i <= $times - 1 ; $i++ ) { my $marcrecord = MARC::File::USMARC::decode( $marcresults[$i] ); -<<<<<<< HEAD:C4/Search.pm - -======= - my $biblionumber; - ->>>>>>> C4/Search.pm followup auto_truncation 3.0.x cherry-pick:C4/Search.pm if ($bibliotag<10){ $fw = GetFrameworkCode($marcrecord->field($bibliotag)->data); }else{ From 0fa37b5bb40c44242f6c85ce8346812c47730489 Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Thu, 17 Dec 2009 15:38:17 +0100 Subject: [PATCH 19/80] Translation scripts : Removing trailing / in scripts --- misc/translator/install-code.pl | 2 +- misc/translator/install.pl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/misc/translator/install-code.pl b/misc/translator/install-code.pl index 2c49da9a4e..6077ab036c 100755 --- a/misc/translator/install-code.pl +++ b/misc/translator/install-code.pl @@ -33,7 +33,7 @@ sub install_code { print $_, " : ", $interface, "\n"; my $cmd = "./tmpl_process3.pl install -r " . "-i ../../koha-tmpl/$interface-tmpl/prog/en/ " . - "-o ../../koha-tmpl/$interface-tmpl/prog/$code/ " . + "-o ../../koha-tmpl/$interface-tmpl/prog/$code " . "-s po/$_"; system $cmd; } diff --git a/misc/translator/install.pl b/misc/translator/install.pl index 2b64495751..ae5e4b9f68 100755 --- a/misc/translator/install.pl +++ b/misc/translator/install.pl @@ -15,7 +15,7 @@ while (defined($po = readdir(DIR))) { my ($lang,$interface) = ($1,$2); $interface =~ s/staff/intranet/; system("mkdir ../../koha-tmpl/$interface-tmpl/prog/$lang"); - system("./tmpl_process3.pl install -i ../../koha-tmpl/$interface-tmpl/prog/en/ -o ../../koha-tmpl/$interface-tmpl/prog/$lang/ -s po/$po -r"); + system("./tmpl_process3.pl install -i ../../koha-tmpl/$interface-tmpl/prog/en/ -o ../../koha-tmpl/$interface-tmpl/prog/$lang -s po/$po -r"); } closedir DIR; From 640595651f6138847d4d64a569b972b84c7ebdbc Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Fri, 18 Dec 2009 12:16:46 +0100 Subject: [PATCH 20/80] (bug #3584) detect ccl queries This patch C4::Search::buildQuery to detect ccl queries, and let zebra to parse them. And set a default index "kw" if not specified. This improve the detection of ccl queries, and do not duplicate the "ccl=" value. Adding = as an index sign Followup to 3037ff9e81149615f94d3c4ff0e5b4c5240f3ce9 Signed-off-by: Henri-Damien LAURENT --- C4/Search.pm | 206 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 205 insertions(+), 1 deletion(-) diff --git a/C4/Search.pm b/C4/Search.pm index b35ca9f22d..252406f94e 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -783,6 +783,194 @@ sub _build_weighted_query { return $weighted_query; } +=head2 getIndexes + +Return an array with available indexes. + +=cut + +sub getIndexes{ + my @indexes = ( + # biblio indexes + 'ab', + 'Abstract', + 'acqdate', + 'allrecords', + 'an', + 'Any', + 'at', + 'au', + 'aub', + 'aud', + 'audience', + 'auo', + 'aut', + 'Author', + 'Author-in-order ', + 'Author-personal-bibliography', + 'Authority-Number', + 'authtype', + 'bc', + 'biblionumber', + 'bio', + 'biography', + 'callnum', + 'cfn', + 'Chronological-subdivision', + 'cn-bib-source', + 'cn-bib-sort', + 'cn-class', + 'cn-item', + 'cn-prefix', + 'cn-suffix', + 'cpn', + 'Code-institution', + 'Conference-name', + 'Conference-name-heading', + 'Conference-name-see', + 'Conference-name-seealso', + 'Content-type', + 'Control-number', + 'copydate', + 'Corporate-name', + 'Corporate-name-heading', + 'Corporate-name-see', + 'Corporate-name-seealso', + 'ctype', + 'date-entered-on-file', + 'Date-of-acquisition', + 'Date-of-publication', + 'Dewey-classification', + 'extent', + 'fic', + 'fiction', + 'Form-subdivision', + 'format', + 'Geographic-subdivision', + 'he', + 'Heading', + 'Heading-use-main-or-added-entry', + 'Heading-use-series-added-entry ', + 'Heading-use-subject-added-entry', + 'Host-item', + 'id-other', + 'Illustration-code', + 'ISBN', + 'ISSN', + 'itemtype', + 'kw', + 'Koha-Auth-Number', + 'l-format', + 'language', + 'lc-card', + 'LC-card-number', + 'lcn', + 'llength', + 'ln', + 'Local-classification', + 'Local-number', + 'Match-heading', + 'Match-heading-see-from', + 'Material-type', + 'mc-itemtype', + 'mc-rtype', + 'mus', + 'Name-geographic', + 'Name-geographic-heading', + 'Name-geographic-see', + 'Name-geographic-seealso', + 'nb', + 'Note', + 'ns', + 'nt', + 'pb', + 'Personal-name', + 'Personal-name-heading', + 'Personal-name-see', + 'Personal-name-seealso', + 'pl', + 'Place-publication', + 'pn', + 'popularity', + 'pubdate', + 'Publisher', + 'Record-type', + 'rtype', + 'se', + 'See', + 'See-also', + 'sn', + 'Stock-number', + 'su', + 'Subject', + 'Subject-heading-thesaurus', + 'Subject-name-personal', + 'Subject-subdivision', + 'Summary', + 'Suppress', + 'su-geo', + 'su-na', + 'su-to', + 'su-ut', + 'ut', + 'Term-genre-form', + 'Term-genre-form-heading', + 'Term-genre-form-see', + 'Term-genre-form-seealso', + 'ti', + 'Title', + 'Title-cover', + 'Title-series', + 'Title-uniform', + 'Title-uniform-heading', + 'Title-uniform-see', + 'Title-uniform-seealso', + 'totalissues', + 'yr', + + # items indexes + 'acqsource', + 'barcode', + 'bc', + 'branch', + 'ccode', + 'classification-source', + 'cn-sort', + 'coded-location-qualifier', + 'copynumber', + 'damaged', + 'datelastborrowed', + 'datelastseen', + 'holdingbranch', + 'homebranch', + 'issues', + 'itemnumber', + 'itype', + 'Local-classification', + 'location', + 'lost', + 'materials-specified', + 'mc-ccode', + 'mc-itype', + 'mc-loc', + 'notforloan', + 'onloan', + 'price', + 'renewals', + 'replacementprice', + 'replacementpricedate', + 'reserves', + 'restricted', + 'stack', + 'uri', + 'withdrawn', + + # subject related + ); + + return \@indexes; +} + =head2 buildQuery ( $error, $query, @@ -838,6 +1026,17 @@ sub buildQuery { my $stopwords_removed; # flag to determine if stopwords have been removed + my $cclq; + my $cclindexes = getIndexes(); + if( $query !~ /\s*ccl=/ ){ + for my $index (@$cclindexes){ + if($query =~ /($index)(,?\w)*[:=]/){ + $cclq = 1; + } + } + $query = "ccl=$query" if($cclq); + } + # for handling ccl, cql, pqf queries in diagnostic mode, skip the rest of the steps # DIAGNOSTIC ONLY!! if ( $query =~ /^ccl=/ ) { @@ -914,6 +1113,11 @@ sub buildQuery { ) = ( 0, 0, 0, 0, 0 ); } + + if(not $index){ + $index = 'kw'; + } + # Set default structure attribute (word list) my $struct_attr; unless ( $indexes_set || !$index || $index =~ /(st-|phr|ext|wrdl)/ ) { @@ -1094,7 +1298,7 @@ sub buildQuery { # Normalize the query and limit strings # This is flawed , means we can't search anything with : in it # if user wants to do ccl or cql, start the query with that -# $query =~ s/:/=/g; + $query =~ s/:/=/g; $limit =~ s/:/=/g; for ( $query, $query_desc, $limit, $limit_desc ) { s/ / /g; # remove extra spaces From f6f80e1b8bd6302b17468286d868431d634ef9f8 Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Wed, 7 Oct 2009 15:49:02 +0200 Subject: [PATCH 21/80] Bug Fix : 3689 Disabling Query_AutoTruncate for NoZebra searches Signed-off-by: Henri-Damien LAURENT --- C4/Search.pm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/C4/Search.pm b/C4/Search.pm index 252406f94e..bdf1434b1b 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -1007,9 +1007,10 @@ sub buildQuery { # no stemming/weight/fuzzy in NoZebra if ( C4::Context->preference("NoZebra") ) { - $stemming = 0; - $weight_fields = 0; - $fuzzy_enabled = 0; + $stemming = 0; + $weight_fields = 0; + $fuzzy_enabled = 0; + $auto_truncation = 0; } my $query = $operands[0]; From f0aee34d3f3faeeed864ae9d535a031763afcc68 Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Fri, 18 Dec 2009 12:24:00 +0100 Subject: [PATCH 22/80] followup : auto_truncation 3287252c0 truncated words bore a double * which would create an error Conflicts solved : C4/Search.pm --- C4/Search.pm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/C4/Search.pm b/C4/Search.pm index bdf1434b1b..47ac7a36d0 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -1139,7 +1139,13 @@ sub buildQuery { } if ($auto_truncation){ - $operand=~join(" ",map{ "$_*" }split (/\s+/,$operand)); + unless ( $index =~ /(st-|phr|ext)/ ) { + #FIXME only valid with LTR scripts + $operand=join(" ",map{ + (index($_,"*")>0?"$_":"$_*") + }split (/\s+/,$operand)); + warn $operand if $DEBUG; + } } # Detect Truncation From 6281ed6b914ab44da573e34323b677d0b4f07f67 Mon Sep 17 00:00:00 2001 From: Matthias Meusburger Date: Thu, 3 Dec 2009 11:58:44 +0100 Subject: [PATCH 23/80] MT 1801 : Opac shelves and basket are displayed the same way This patch also fixes broken location display in both shelves and basket. --- C4/VirtualShelves/Page.pm | 5 +++ .../prog/en/modules/opac-basket.tmpl | 39 +++++++++---------- .../prog/en/modules/opac-shelves.tmpl | 11 ++++++ opac/opac-basket.pl | 7 ---- 4 files changed, 35 insertions(+), 27 deletions(-) diff --git a/C4/VirtualShelves/Page.pm b/C4/VirtualShelves/Page.pm index 72937bd6e9..658b9acc50 100644 --- a/C4/VirtualShelves/Page.pm +++ b/C4/VirtualShelves/Page.pm @@ -191,6 +191,11 @@ SWITCH: { $this_item->{'imageurl'} = getitemtypeinfo($this_item->{'itemtype'})->{'imageurl'}; $this_item->{'coins'} = GetCOinSBiblio($this_item->{'biblionumber'}); $this_item->{'subtitle'} = C4::Biblio::get_koha_field_from_marc('bibliosubtitle', 'subtitle', $record, ''); + + # Getting items infos for location display + my @items_infos = &GetItemsInfo($this_item->{'biblionumber'}, $type); + $this_item->{'ITEM_RESULTS'} = \@items_infos; + } push @paramsloop, {display => 'privateshelves'} if $category == 1; $showadd = 1; diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-basket.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-basket.tmpl index 09a8c0fc71..f1b1a395ec 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-basket.tmpl +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-basket.tmpl @@ -295,7 +295,7 @@ function tagAdded() { - + + @@ -347,27 +348,25 @@ function tagAdded() { " name="bib" id="bib" onclick="selRecord(value,checked);" /> - - + + + &rft.btitle=&rft.date=&rft.tpages=&rft.isbn=&rft.aucorp=&rft.place=&rft.pub=&rft.edition=&rft.series=&rft.genre="> +
    _status" class="tagstatus results_summary" style="display:none">Tag status here.
    + + + + @@ -278,6 +279,16 @@ $(function() { + diff --git a/opac/opac-basket.pl b/opac/opac-basket.pl index c044fee493..e0962bca42 100755 --- a/opac/opac-basket.pl +++ b/opac/opac-basket.pl @@ -73,15 +73,8 @@ foreach my $biblionumber ( @bibs ) { if($dat->{'author'} || @$marcauthorsarray) { $hasauthors = 1; } - - my $shelflocations =GetKohaAuthorisedValues('items.location',$dat->{'frameworkcode'}, 'opac'); my $collections = GetKohaAuthorisedValues('items.ccode',$dat->{'frameworkcode'}, 'opac'); - for my $itm (@items) { - if ($itm->{'location'}){ - $itm->{'location_description'} = $shelflocations->{$itm->{'location'} }; - } - } # COinS format FIXME: for books Only my $coins_format; my $fmt = substr $record->leader(), 6,2; From d8a71ebd61bc2781486fbf18dd079e86abbf6c50 Mon Sep 17 00:00:00 2001 From: Matthias Meusburger Date: Fri, 4 Dec 2009 11:09:13 +0100 Subject: [PATCH 24/80] MT 2426 : Default currency is chosen for price calculation when bookseller's listprice is NULL --- acqui/neworderempty.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/acqui/neworderempty.pl b/acqui/neworderempty.pl index 1bbb71f133..9fb1870de9 100755 --- a/acqui/neworderempty.pl +++ b/acqui/neworderempty.pl @@ -339,7 +339,7 @@ $template->param( name => $bookseller->{'name'}, cur_active_sym => $cur->{'symbol'}, cur_active => $cur->{'currency'}, - currency => $bookseller->{'listprice'}, # eg: 'EUR' + currency => $bookseller->{'listprice'} || $cur->{'currency'}, # eg: 'EUR' loop_currencies => \@loop_currency, orderexists => ( $new eq 'yes' ) ? 0 : 1, title => $data->{'title'}, From 5ff80cb2339600675e9872131bfbdeb4894b2e97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Fri, 18 Dec 2009 16:28:47 +0100 Subject: [PATCH 25/80] [MT2346] Supplier display improvements Used Koha generalized way to display lists of informations. --- .../prog/en/modules/acqui/supplier.tmpl | 65 ++++++++++--------- 1 file changed, 33 insertions(+), 32 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tmpl index a97a818206..8b6b026ace 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tmpl @@ -145,38 +145,39 @@ if (f.company.value == "") {

    -
    -

    Company Name: -

    -

    Postal Address: -

    -

    Physical Address: -

    -

    Phone: -

    -

    Fax: -

    -

    Web site: - ">

    -
    -
    -

    Contact details

    -

    Contact name: -

    -

    Position: -

    -

    Phone: -

    -

    Alternative phone: -

    -

    Fax: -

    -

    Email: - ">

    -

    Notes: -

    - -
    +
    +

    Supplier details

    +
    +
      +
    1. Company Name:
    2. +
    3. Postal Address:
    4. +
    5. Physical Address:
    6. +
    7. Phone:
    8. +
    9. Fax:
    10. + +
    11. Web site: ">
    12. + +
    +
    +
    +
    +

    Contact details

    +
    +
      +
    1. Contact name:
    2. +
    3. Position:
    4. +
    5. Phone:
    6. +
    7. Alternative phone:
    8. +
    9. Fax:
    10. + +
    11. Email: ">
    12. + + +
    13. Notes:
    14. + +
    +
    +

    Ordering information

    From 23a139741906345002fdaefdbef2bedacf5a9c3e Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Fri, 4 Dec 2009 15:20:51 +0100 Subject: [PATCH 26/80] Dates : improvements string recognition Dates can now have one digit for month and day --- C4/Dates.pm | 6 +++--- t/Dates.t | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/C4/Dates.pm b/C4/Dates.pm index 7563b51714..451e2d34b7 100644 --- a/C4/Dates.pm +++ b/C4/Dates.pm @@ -70,10 +70,10 @@ sub regexp ($;$) { # way of saying "does this string match *whatever* format that Dates object is?" ($format eq 'sql') and - return qr/^(\d{4})(\d{2})(\d{2})(?:\s{4}(\d{2})(\d{2})(\d{2}))?/; + return qr/^(\d{4})(\d{1,2})(\d{1,2})(?:\s{4}(\d{2})(\d{2})(\d{2}))?/; ($format eq 'iso') and - return qr/^(\d{4})$delim(\d{2})$delim(\d{2})(?:(?:\s{1}|T)(\d{2})\:?(\d{2})\:?(\d{2}))?Z?/; - return qr/^(\d{2})$delim(\d{2})$delim(\d{4})(?:\s{1}(\d{2})\:?(\d{2})\:?(\d{2}))?/; # everything else + return qr/^(\d{4})$delim(\d{1,2})$delim(\d{1,2})(?:(?:\s{1}|T)(\d{2})\:?(\d{2})\:?(\d{2}))?Z?/; + return qr/^(\d{1,2})$delim(\d{1,2})$delim(\d{4})(?:\s{1}(\d{1,2})\:?(\d{1,2})\:?(\d{1,2}))?/; # everything else } sub dmy_map ($$) { diff --git a/t/Dates.t b/t/Dates.t index 1e71677d50..0f0cbc202f 100644 --- a/t/Dates.t +++ b/t/Dates.t @@ -19,8 +19,8 @@ sub describe ($$) { # Keep the number of test elements per [array] equal or the predicted number of tests # needs to be different for different (fake) sysprefs. my %thash = ( - iso => ['2001-01-01','1989-09-21','1952-01-00', '1989-09-21 13:46:02'], - metric => ["01-01-2001",'21-09-1989','00-01-1952', '21-09-1989 13:46:02'], + iso => ['2001-1-1','1989-9-21','1952-1-0', '1989-9-21 13:46:02','2001-01-01','1989-09-21','1952-01-00', '1989-09-21 13:46:02'], + metric => ["1-1-2001",'21-9-1989','00-1-1952', '21-9-1989 13:46:02',"01-01-2001",'21-09-1989','00-01-1952', '21-09-1989 13:46:02'], us => ["01-01-2001",'09-21-1989','01-00-1952', '09-21-1989 13:46:02'], sql => ['20010101 010101', '19890921 143907', From e4fc74acdd200dc8be8d2ccbad682fa352997cd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Mon, 21 Dec 2009 09:34:52 +0100 Subject: [PATCH 27/80] [MT2346] Hide basket actions if no basket --- .../prog/en/includes/acquisitions-toolbar.inc | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) 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 13a8f6ee1e..99c8c4b743 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-toolbar.inc @@ -14,6 +14,11 @@ new YAHOO.widget.Button("newperiod"); new YAHOO.widget.Button("newbudget"); new YAHOO.widget.Button("newsupplier"); + new YAHOO.widget.Button("newbasket"); + new YAHOO.widget.Button("editsupplier"); + new YAHOO.widget.Button("receive"); + new YAHOO.widget.Button("newcontract"); + new YAHOO.widget.Button("editcontracts"); var manageorders = [ { text: _("New basket"), url: "/cgi-bin/koha/acqui/basketheader.pl?booksellerid=&op=add_form"}, @@ -27,12 +32,9 @@ ] - new YAHOO.widget.Button("newbasket"); - new YAHOO.widget.Button("editsupplier"); - new YAHOO.widget.Button("receive"); - new YAHOO.widget.Button("newcontract"); - new YAHOO.widget.Button("editcontracts"); - new YAHOO.widget.Button({type: "menu", label: _("Manage orders"), name: "manageorders", menu: manageorders, container: "toolbar-list"}); + + new YAHOO.widget.Button({type: "menu", label: _("Manage orders"), name: "manageorders", menu: manageorders, container: "toolbar-list"}); + } @@ -43,6 +45,9 @@
  • &op=enter">Edit
  • ">New Contract
  • ">Contracts
  • + +
  • ">New Basket
  • +
  • New Vendor
  • From 1d98bd2a96011382956b7323334f8aacc695d693 Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Fri, 30 Jan 2009 15:10:54 +0100 Subject: [PATCH 28/80] Bug 3983 : Needed authorised values list for french frameworks. --- .../fr-FR/1-Obligatoire/authorised_values.sql | 353 ++++++++++++++++++ .../fr-FR/1-Obligatoire/authorised_values.txt | 1 + 2 files changed, 354 insertions(+) create mode 100644 installer/data/mysql/fr-FR/1-Obligatoire/authorised_values.sql create mode 100644 installer/data/mysql/fr-FR/1-Obligatoire/authorised_values.txt diff --git a/installer/data/mysql/fr-FR/1-Obligatoire/authorised_values.sql b/installer/data/mysql/fr-FR/1-Obligatoire/authorised_values.sql new file mode 100644 index 0000000000..dc5fce8cf6 --- /dev/null +++ b/installer/data/mysql/fr-FR/1-Obligatoire/authorised_values.sql @@ -0,0 +1,353 @@ +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'ETAT', '0', ' Empruntable'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'ETAT', '1', 'Exclu du prêt'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'ETAT', '3', 'En reliure'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'ETAT', '4', 'Indisponible'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'qualif', '570', 'Autres'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'qualif', '205', ' Collaborateur'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'qualif', '210', 'Commentaire'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'qualif', '571', 'Coordinateur'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'qualif', '573', 'Diffuseur'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'qualif', '651', ' Directeur de la pub'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'qualif', '650', ' Editeur'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'qualif', '440', 'Illustrateur'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'qualif', '075', 'Postfacier'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'qualif', '080', ' Préfacier'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'qualif', '574', 'Présentateur'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'qualif', '710', 'Rédacteur'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'qualif', '575', 'Responsable'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'qualif', '730', ' Traducteur'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'qualif', '020', 'Annotateur'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'qualif', '723', 'Commanditaire'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'qualif', '675', 'Critique'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'qualif', '600', 'Photographe'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'ETAT', '5', 'En traitement'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'CAND', 'Candidat descripteur', 'Candidat descripteur'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'CAND', 'Rejeté', 'Mot clé abandonné'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'an', 'Antilles Néerlandaises'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'cr', 'Costa Rica'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'er', 'Allemagne'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', ' fr', ' France'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'de', 'Allemagne'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'cn', 'Chine'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'in', 'Inde'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'is', 'Islande'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'nl', 'Pays Bas'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'pa', 'Espagne'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 're', 'France'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'es', 'Espagne'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'us', ' EtatsUnis'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'gb', ' GrandeBretagne'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'ad', 'Andorre'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'af', 'Afghanistan'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'al', 'Albanie'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'ag', 'AntiguaetBarbuda'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'am', 'Arménie'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'ao', 'Angola'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'aq', 'Antarctique'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'ar', 'Argentine'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'as', 'Samoa américaines'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'at', 'Autriche'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'au', 'Australie'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'aw', 'Aruba'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'ax', 'Aland, îles d'''); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'az', 'Azerbaïdjan'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'ba', 'BosnieHerzégovine'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'bb', 'Barbade'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'bd', 'Bangladesh'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'be', 'Belgique'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'bf', 'Burkina Faso'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'bf', 'HauteVolta'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'bg', 'Bulgarie'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'bh', 'Bahreïn'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'bi', 'Burundi'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'bj', 'Bénin'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'bm', 'Bermudes'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'bn', 'Brunéi'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'bo', 'Bolivie'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'br', 'Brésil'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'bs', 'Bahamas'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'bt', 'Bhoutan'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'bv', 'Bouvet, île'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'bw', 'Botswana'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'by', 'Biélorussie'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'bz', 'Belize'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'ca', 'Canada'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'cc', 'Cocos, île des'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'cc', 'Keeling'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'cd', 'Zaïre'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'cd', 'Congo'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'cf', 'Centrafrique'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'cg', 'Congo'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'ch', ' Suisse'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'ci', 'Côte d''Ivoire'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'ck', 'Cook, îles'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'cl', 'Chili'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'cm', 'Cameroun'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'cs', 'SerbieetMonténégro'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'cu', 'Cuba'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'cv', 'CapVert'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'cx', 'Christmas, île'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'cy', 'Chypre'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'cz', 'Tchèque, République'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'dj', 'Djibouti'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'dk', 'Danemark'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'dm', 'Dominique'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'do', 'Dominicaine, République'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'dz', 'Algérie'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'ec', 'Equateur'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'ee', 'Estonie'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'eg', 'Egypte'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'eh', 'Sahara occidental'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'fi', 'Finlande'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'fj', 'Fidji'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'fk', 'Falkland, îles'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'fm', 'Micronésie'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'fo', 'Féroé, îles'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'ga', 'Gabon'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'gd', 'Grenade'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'ge', 'Géorgie'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'gf', 'Guyane française'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'gh', 'Ghana'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'gi', 'Gibraltar'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'gl', 'Groenland'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'gm', 'Gambie'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'gn', 'Guinée'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'gp', 'Guadeloupe'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'gq', 'Guinée'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'gq', 'Guinée équatoriale'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'gr', 'Grèce'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'gs', 'Géorgie du sud et les îles sandwich du Sud'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'gt', 'Guatemala'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'gu', 'Guam'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'gw', 'GuinéeBissau'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'gy', 'Guyana'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'hk', 'HongKong'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'hm', 'Heard et îles McDonald, île'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'hn', 'Honduras'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'hr', 'Croatie'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'ht', 'Haïti'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'hu', 'Hongrie'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'id', 'Indonésie'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'ie', 'Irlande'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'ii', 'intergouvernemental'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'il', 'Israël'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'iq', 'Iraq'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'ir', 'Iran'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'it', 'Italie'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'jm', 'Jamaïque'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'jo', 'Jordanie'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'jp', 'Japon'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'ke', 'Kenya'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'kg', 'Kirghizistan'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'kh', 'Cambodge'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'ki', 'Kiribati'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'km', 'Comores'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'kn', 'SaintKittsetNevis'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'kp', 'Corée du Nord'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'kr', 'Corée du Sud'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'kw', 'Koweït'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'ky', 'Caïmanes, îles'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'kz', 'Kazakhstan'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'la', 'Lao'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'lb', 'Liban'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'lc', 'SainteLucie'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'li', 'Liechtenstein'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'lk', 'Sri Lanka'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'lr', 'Libéria'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'ls', 'Lesotho'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'lt', 'Lituanie'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'lu', 'Luxembourg'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'lv', 'Lettonie'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'ly', 'Lybie'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'ma', 'Maroc'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'mc', 'Monaco'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'md', 'Moldavie'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'mg', 'Madagascar'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'mh', 'Marshall, îles'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'mk', 'Macédoine'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'ml', 'Mali'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'mm', 'Birmanie'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'mm', 'Myanmar'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'mn', 'Mongolie'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'mo', 'Macao'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'mp', 'Mariannes du Nord, îles'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'mq', 'Martinique'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'mr', 'Mauritanie'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'ms', 'Montserrat'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'mt', 'Malte'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'mu', 'Maurice'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'mv', 'Maldives'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'mw', 'Malawi'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'mx', 'Mexique'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'my', 'Malaisie'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'mz', 'Mozambique'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'na', 'Namibie'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'nc', 'NouvelleCalédonie'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'ne', 'Niger'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'nf', 'Norfolk'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'ni', 'Nicaragua'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'no', 'Norvège'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'np', 'Népal'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'nr', 'Nauru'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'nu', 'Nioué'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'nz', 'NouvelleZélande'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'om', 'Oman'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'pe', 'Pérou'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'pf', 'Polynésie française'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'pg', 'Papouasie NouvelleGuinée'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'ph', 'Philippines'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'pk', 'Pakistan'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'pm', 'SaintPierreetMiquelon'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'pn', 'Pitcairn'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'pr', 'Porto Rico'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'ps', 'Palestine'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'pt', 'Portugal'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'pw', 'Palau'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'py', 'Paraguay'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'qa', 'Qatar'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'ro', 'Roumanie'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'ru', 'Russie'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'rw', 'Rwanda'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'sa', 'Arabie saoudite'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'sb', 'Salomon, îles'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'sc', 'Seychelles'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'sd', 'Soudan'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'se', 'Suède'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'sg', 'Singapour'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'sh', 'SainteHélène'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'si', 'Slovénie'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'sj', 'Svalbard et île Jan Mayen'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'sk', 'Slovaquie'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'sl', 'Sierra Leone'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'sm', 'SaintMarin'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'sn', 'Sénégal'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'so', 'Somalie'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'sr', 'Suriname'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'st', 'Sao ToméetPrincipe'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'su', 'URSS'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'sv', 'Salvador'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'sy', 'Syrie'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'sz', 'Swaziland'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'tc', 'Turks et Caïques, îles'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'td', 'Tchad'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'tg', 'Togo'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'th', 'Thaïlande'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'tj', 'Tadjikistan'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'tk', 'Tokélau'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'tl', 'Timor oriental'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'tm', 'Turkménistan'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'tn', 'Tunisie'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'to', 'Tonga'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'tr', 'Turquie'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'tt', 'TrinitéetTobago'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'tv', 'Tuvalu'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'tw', 'taïwan'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'tz', 'Tanzanie'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'ua', 'Ukraine'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'ug', 'Ouganda'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'um', 'îles mineures éloignées des Etatsunis'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'uy', 'Uruguay'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'uz', 'Ouzbékistan'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'va', 'Vatican'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'vc', 'SaintVincentetles Grenadines'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 've', 'Venezuela'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'vg', 'Iles Vierges britanniques'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'vi', 'Iles Vierges (Etatsunis)'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'vn', 'Viet Nam'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'vu', 'Vanuatu'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'wf', 'Wallis et Futuna, îles'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'ws', 'Samoa'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'xc', 'Tchécoslovaquie'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'xd', 'Allemagne avant 1945'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'xe', 'Europe'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'xk', 'Corée avant 1948'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'yd', 'Yémen'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'Yu', 'Yougoslavie'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'za', 'Afrique du Sud'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'zm', 'Zambie'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'zw', 'Zimbabwe'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'zz', 'multiple'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'COUNTRY', 'ta', 'Italie'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'qualif', '370', 'Réalisateur'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'qualif', '673', ' Directeur'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'qualif', '605', 'Présentateur'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'afr', 'afrikaans'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'akk', 'akkadien'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'amh', 'amharique'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'ang', 'anglosaxon (ca. 4501100)'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'ara', 'arabe'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'arc', 'araméen'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'arm', 'arménien'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'bul', 'bulgare'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'chi', 'chinois'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'cop', 'copte'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'cze', 'tchèque'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'dan', 'danois'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'deu', 'Hollandais'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'dum', 'néerlandais moyen (ca. 10501350)'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'dut', 'néerlandais'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'egy', 'egyptien'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'eng', 'anglais'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'esp', 'espéranto'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'fin', 'finnois'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'fre', 'français'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'frm', 'français moyen (ca. 14001600)'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'fro', 'français ancien (842ca. 1400)'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'ger', 'allemand'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'gmh', 'allemand, moyen haut (ca. 10501500)'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'got', 'gothique'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'grc', 'grec classique'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'gre', 'grec moderne'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'heb', 'hébreu'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'hin', 'hindi'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'hun', 'hongrois'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'ind', 'indonésien'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'ine', 'indoeuropéennes, autres'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'ita', 'italien'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'jpn', 'japonais'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'kor', 'coréen'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'lan', 'occitan (post 1500)'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'lat', 'latin'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'map', 'malayopolynésiennes, autres'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'mla', 'malgache'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'mul', 'multilingue'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'nic', 'nigérocongolaises, autres'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'nor', 'norvégien'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'per', 'persan'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'pol', 'polonais'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'por', 'portugais'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'pro', 'provencal ancien (jusqu''à 1500)'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'rom', 'tzigane'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'rum', 'roumain'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'rus', 'russe'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'sam', 'samaritain'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'san', 'sanskrit'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'sem', 'sémitique, autres langues'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'sla', 'slave, autres langues'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'spa', 'espagnol'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'swe', 'suedois'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'syr', 'syriaque'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'tib', 'tibétain'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'tur', 'turc'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'uga', 'ougaritique'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'und', 'inconnue'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LANG', 'yid', 'yiddish'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'qualif', '070', ' Auteur'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LOC', 'Magasin', ' Magasin'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LOC', 'Salle de lecture', 'Salle de lecture'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LOC', 'Magasin des périodiques', 'Magasin des périodiques'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LOC', 'Bureau des bibliothécaires', 'Bureau des bibliothécaires'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'ETAT', '6', 'Non communicable'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'qualif', '557', 'Organisateur congrès'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LOC', 'Manquant', 'Manquant'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'qualif', '340', 'Editeur scientifique'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'qualif', '727', 'Directeur de thèse'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LOC', 'Secrétariat', 'Secrétariat'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'qualif', '220', 'Compilateur'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'qualif', '395', 'Fondateur'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'qualif', '100', 'Auteur oeuvre adaptée'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'qualif', '230', 'Compositeur'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'qualif', '520', 'Parolier'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'qualif', '295', 'Donneur de grades'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'qualif', '010', 'Adaptateur'); +INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LOC', 'En reliure', 'En reliure'); diff --git a/installer/data/mysql/fr-FR/1-Obligatoire/authorised_values.txt b/installer/data/mysql/fr-FR/1-Obligatoire/authorised_values.txt new file mode 100644 index 0000000000..8f49e0ef50 --- /dev/null +++ b/installer/data/mysql/fr-FR/1-Obligatoire/authorised_values.txt @@ -0,0 +1 @@ +Des listes de valeurs autorisées bien utiles pour la constitution des grilles de catalogage. From 5f61beed724e55195a1cd6ed843585d6a73f4dee Mon Sep 17 00:00:00 2001 From: Matthias Meusburger Date: Tue, 22 Dec 2009 14:06:56 +0100 Subject: [PATCH 29/80] MT2408 : UI Changes / CSV Export --- C4/Acquisition.pm | 62 +++++++++++++++++++ acqui/basket.pl | 7 +++ acqui/basketgroup.pl | 7 ++- .../prog/en/modules/acqui/basket.tmpl | 2 + .../prog/en/modules/acqui/basketgroup.tmpl | 24 +++++-- 5 files changed, 94 insertions(+), 8 deletions(-) diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm index 0ad03e9819..f26e243250 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -25,6 +25,7 @@ use C4::Debug; use C4::Dates qw(format_date format_date_in_iso); use MARC::Record; use C4::Suggestions; +use C4::Biblio; use C4::Debug; use C4::SQLHelper qw(InsertInTable); @@ -40,6 +41,7 @@ BEGIN { @ISA = qw(Exporter); @EXPORT = qw( &GetBasket &NewBasket &CloseBasket &DelBasket &ModBasket + &GetBasketAsCSV &GetBasketsByBookseller &GetBasketsByBasketgroup &ModBasketHeader @@ -222,6 +224,66 @@ sub CloseBasket { #------------------------------------------------------------# +=head3 GetBasketAsCSV + +=over 4 + +&GetBasketAsCSV($basketno); + +Export a basket as CSV + +=back + +=cut +sub GetBasketAsCSV { + my ($basketno) = @_; + my $basket = GetBasket($basketno); + my @orders = GetOrders($basketno); + my $contract = GetContract($basket->{'contractnumber'}); + my $csv = Text::CSV->new(); + my $output; + + # TODO: Translate headers + my @headers = qw(contractname ordernumber line entrydate isbn author title publishercode collectiontitle notes quantity rrp); + + $csv->combine(@headers); + $output = $csv->string() . "\n"; + + my @rows; + foreach my $order (@orders) { + my @cols; + my $bd = GetBiblioData($order->{'biblionumber'}); + push(@cols, + $contract->{'contractname'}, + $order->{'ordernumber'}, + $order->{'entrydate'}, + $order->{'isbn'}, + $bd->{'author'}, + $bd->{'title'}, + $bd->{'publishercode'}, + $bd->{'collectiontitle'}, + $order->{'notes'}, + $order->{'quantity'}, + $order->{'rrp'}, + ); + push (@rows, \@cols); + } + + # Sort by publishercode + # TODO: Sort by publishercode then by title + @rows = sort { @$a[7] cmp @$b[7] } @rows; + + foreach my $row (@rows) { + $csv->combine(@$row); + $output .= $csv->string() . "\n"; + + } + + return $output; + +} + + =head3 CloseBasketgroup =over 4 diff --git a/acqui/basket.pl b/acqui/basket.pl index 492417abb7..9687b88f83 100755 --- a/acqui/basket.pl +++ b/acqui/basket.pl @@ -135,6 +135,13 @@ if ( $op eq 'delete_confirm' ) { } elsif ($op eq 'attachbasket' && $template->{'param_map'}->{'CAN_user_acquisition_group_manage'} == 1) { print $query->redirect('/cgi-bin/koha/acqui/basketgroup.pl?basketno=' . $basket->{'basketno'} . '&op=attachbasket&booksellerid=' . $booksellerid); # check if we have to "close" a basket before building page +} elsif ($op eq 'export') { + print $query->header( + -type => 'text/csv', + -attachment => 'basket' . $basket->{'basketno'} . '.csv', + ); + print GetBasketAsCSV($query->param('basketno')); + exit; } elsif ($op eq 'close') { my $confirm = $query->param('confirm'); if ($confirm) { diff --git a/acqui/basketgroup.pl b/acqui/basketgroup.pl index 7e407b3aa2..e8273a92d2 100755 --- a/acqui/basketgroup.pl +++ b/acqui/basketgroup.pl @@ -437,8 +437,10 @@ if ( $op eq "add" ) { }; $basketgroupid = NewBasketgroup($basketgroup); } - - print $input->redirect('/cgi-bin/koha/acqui/basketgroup.pl?booksellerid=' . $booksellerid); + + my $url = '/cgi-bin/koha/acqui/basketgroup.pl?booksellerid=' . $booksellerid; + $url .= "&closed=1" if ($input->param("closed")); + print $input->redirect($url); }else{ my $basketgroups = &GetBasketgroups($booksellerid); @@ -447,5 +449,6 @@ if ( $op eq "add" ) { displaybasketgroups($basketgroups, $bookseller, $baskets); } +$template->param(closed => $input->param("closed")); #prolly won't use all these, maybe just use print, the rest can be done inside validate output_html_with_http_headers $input, $cookie, $template->output; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tmpl index 5124441710..561ce9a9de 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tmpl @@ -74,6 +74,7 @@ new YAHOO.widget.Button("closebutton"); new YAHOO.widget.Button("basketheadbutton"); + new YAHOO.widget.Button("exportbutton"); new YAHOO.widget.Button("delbasketbutton"); } //]]> @@ -87,6 +88,7 @@
  • ?op=close&basketno=&booksellerid=" class="button" id="closebutton">Close this basket
  • +
  • ?op=export&basketno=&booksellerid=" class="button" id="exportbutton">Export this basket as CSV
  • diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tmpl index baca7505af..e0245c3a7c 100755 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tmpl @@ -114,6 +114,18 @@ fieldset.various li { YAHOO.util.Event.onDOMReady(DDApp.init, DDApp, true); var tabView = new YAHOO.widget.TabView('bgtabs'); //]]> + + +function submitForm(form) { + if (form.close.checked == true) { + var input = document.createElement("input"); + input.setAttribute("type", "hidden"); + input.setAttribute("name", "closed"); + input.setAttribute("value", "1"); + form.appendChild(input); + } +} + @@ -172,8 +184,8 @@ fieldset.various li {
    -
    -
    +
    +
    " method="post" name="basketgroups" id="basketgroups">
    @@ -202,8 +214,8 @@ fieldset.various li {
    -
    - +
    +

    " /> @@ -257,8 +269,8 @@ fieldset.various li {
    From 8e3464e9b39d2e779b26f8dc278188ea568187a0 Mon Sep 17 00:00:00 2001 From: Nicolas Morin Date: Tue, 22 Dec 2009 16:09:21 +0100 Subject: [PATCH 30/80] correcting spelling mistake: firstname is surname --- koha-tmpl/opac-tmpl/prog/en/modules/ilsdi.tmpl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/ilsdi.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/ilsdi.tmpl index ff8a03ea42..ffae61ddea 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/ilsdi.tmpl +++ b/koha-tmpl/opac-tmpl/prog/en/modules/ilsdi.tmpl @@ -366,8 +366,7 @@
    the type of the identifier, possible values:
    • cardnumber
    • -
    • firstname
    • -
    • userid
    • +
    • surname
    • borrowernumber
    From 51241b66b277a5e4ed21e9d34ed5c9ea44cee82c Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Thu, 10 Dec 2009 11:02:55 +0100 Subject: [PATCH 31/80] bug Fixing: updatedatabase Here comes a patch for update database. Can you please test and tell me if it works ? Thanks a lot --- installer/data/mysql/updatedatabase.pl | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 41dfa3f515..e2edf01f1e 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -2725,8 +2725,12 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { $DBversion = '3.01.00.066'; if (C4::Context->preference("Version") < TransformToNum($DBversion)) { - $dbh->do('ALTER TABLE issuingrules ADD COLUMN `reservesallowed` smallint(6) NOT NULL default "0" AFTER `renewalsallowed`;'); - + $dbh->do("ALTER TABLE issuingrules + ADD COLUMN `finedays` int(11) default NULL AFTER `fine`, + ADD COLUMN `renewalsallowed` smallint(6) default NULL, + ADD COLUMN `reservesallowed` smallint(6) default NULL; + "); + my $maxreserves = C4::Context->preference('maxreserves'); $sth = $dbh->prepare('UPDATE issuingrules SET reservesallowed = ?;'); $sth->execute($maxreserves); @@ -2748,8 +2752,6 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { $DBversion = "3.01.00.068"; if (C4::Context->preference("Version") < TransformToNum($DBversion)) { - $dbh->do("ALTER TABLE issuingrules ADD COLUMN `finedays` int(11) default NULL AFTER `fine` "); - print "Upgrade done (Adding finedays in issuingrules table)\n"; } @@ -2905,7 +2907,7 @@ ADDPERIODS $dbh->do(<selectcol_arrayref(< Date: Fri, 25 Sep 2009 16:32:41 +0200 Subject: [PATCH 32/80] (bug #3667) fix borrowers cleanup This add a check of borrower expiry date, and don't delete the borrower if he's still active. --- C4/Members.pm | 10 ++++++---- tools/cleanborrowers.pl | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/C4/Members.pm b/C4/Members.pm index bed69abc4c..96c7b472a8 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -1827,9 +1827,8 @@ this function get all borrowers who haven't borrowed since the date given on inp =cut sub GetBorrowersWhoHaveNotBorrowedSince { -### TODO : It could be dangerous to delete Borrowers who have just been entered and who have not yet borrowed any book. May be good to add a dateexpiry or dateenrolled filter. - - my $filterdate = shift||POSIX::strftime("%Y-%m-%d",localtime()); + my $filterdate = shift||POSIX::strftime("%Y-%m-%d",localtime()); + my $filterexpiry = shift; my $filterbranch = shift || ((C4::Context->preference('IndependantBranches') && C4::Context->userenv @@ -1849,7 +1848,10 @@ sub GetBorrowersWhoHaveNotBorrowedSince { if ($filterbranch && $filterbranch ne ""){ $query.=" AND borrowers.branchcode= ?"; push @query_params,$filterbranch; - } + } + if($filterexpiry){ + $query .= " AND dateexpiry < NOW() "; + } $query.=" GROUP BY borrowers.borrowernumber"; if ($filterdate){ $query.=" HAVING latestissue {'step2'} ) { my $totalDel; my $membersToDelete; if ($checkboxes{borrower}) { - $membersToDelete = GetBorrowersWhoHaveNotBorrowedSince($filterdate1); + $membersToDelete = GetBorrowersWhoHaveNotBorrowedSince($filterdate1, 1); $totalDel = scalar @$membersToDelete; } @@ -109,7 +109,7 @@ if ( $params->{'step3'} ) { # delete members if ($do_delete) { - my $membersToDelete = GetBorrowersWhoHaveNotBorrowedSince($filterdate1); + my $membersToDelete = GetBorrowersWhoHaveNotBorrowedSince($filterdate1, 1); $totalDel = scalar(@$membersToDelete); $radio = $params->{'radio'}; if ( $radio eq 'trash' ) { From 67bc72d7bb2ec1b0fe09303f7f98cdb094b41bfa Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Wed, 23 Dec 2009 13:12:42 +0100 Subject: [PATCH 33/80] Test Improvements : Adding Reserves.t --- t/db_dependent/Reserves.t | 62 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100755 t/db_dependent/Reserves.t diff --git a/t/db_dependent/Reserves.t b/t/db_dependent/Reserves.t new file mode 100755 index 0000000000..177febb58a --- /dev/null +++ b/t/db_dependent/Reserves.t @@ -0,0 +1,62 @@ +#!/usr/bin/perl + +use strict; +use warnings; +use C4::Branch; + +use Test::More tests => 4; + +BEGIN { + use FindBin; + use lib $FindBin::Bin; + use_ok('C4::Reserves'); +} + +my $dbh = C4::Context->dbh; +my $query = qq/SELECT borrowernumber + FROM borrowers + LIMIT 1/; +my $sth = $dbh->prepare($query); +$sth->execute; +my $borrower = $sth->fetchrow_hashref; + +$query = qq/SELECT biblionumber, title, itemnumber, barcode + FROM biblio + LEFT JOIN items USING (biblionumber) + WHERE barcode <> "" + AND barcode IS NOT NULL + LIMIT 1/; +$sth = $dbh->prepare($query); +$sth->execute; +my $biblio = $sth->fetchrow_hashref; + + +my $borrowernumber = $borrower->{'borrowernumber'}; +my $biblionumber = $biblio->{'biblionumber'}; +my $itemnumber = $biblio->{'itemnumber'}; +my $barcode = $biblio->{'barcode'}; + +my $constraint = 'a'; +my $bibitems = ''; +my $priority = '1'; +my $notes = ''; +my $title = $biblio->{'title'}; +my $checkitem = undef; +my $found = undef; + +my @branches = GetBranchesLoop(); +my $branch = $branches[0][0]{value}; + +AddReserve($branch, $borrowernumber, $biblionumber, + $constraint, $bibitems, $priority, $notes, + $title, $checkitem, $found); + +my ($status, $reserve) = CheckReserves($itemnumber, $barcode); +ok($status eq "Reserved", "CheckReserves Test 1"); + +($status, $reserve) = CheckReserves($itemnumber); +ok($status eq "Reserved", "CheckReserves Test 2"); + +($status, $reserve) = CheckReserves(undef, $barcode); +ok($status eq "Reserved", "CheckReserves Test 3"); + From 473b38185e7246910a329cf74ab4d6d11d3a0107 Mon Sep 17 00:00:00 2001 From: Nahuel ANGELINETTI Date: Wed, 4 Nov 2009 16:01:43 +0100 Subject: [PATCH 34/80] (bug #3760) fix and improve some reports This patch fix some problems with dates, and itemtypes level. And it improve some sql queries. --- reports/borrowers_out.pl | 24 +++++------------------- reports/cat_issues_top.pl | 38 +++++++++++++++++--------------------- 2 files changed, 22 insertions(+), 40 deletions(-) diff --git a/reports/borrowers_out.pl b/reports/borrowers_out.pl index 8bc3097b03..e6990291cd 100755 --- a/reports/borrowers_out.pl +++ b/reports/borrowers_out.pl @@ -46,6 +46,7 @@ my $fullreportname = "reports/borrowers_out.tmpl"; my $limit = $input->param("Limit"); my $column = $input->param("Criteria"); my @filters = $input->param("Filter"); +$filters[1] = format_date_in_iso($filters[1]) if $filters[1]; my $output = $input->param("output"); my $basename = $input->param("basename"); my $mime = $input->param("MIME"); @@ -186,7 +187,7 @@ sub calculate { $colorder .= $column; my $strsth2; - $strsth2 .= "select distinctrow $colfield FROM borrowers LEFT JOIN `old_issues` ON old_issues.borrowernumber=borrowers.borrowernumber"; + $strsth2 .= "select distinctrow $colfield FROM borrowers LEFT JOIN `old_issues` USING(borrowernumber)"; if ($colfilter[0]) { $colfilter[0] =~ s/\*/%/g; $strsth2 .= " and $column LIKE '$colfilter[0]' " ; @@ -197,7 +198,6 @@ sub calculate { my $sth2 = $dbh->prepare( $strsth2 ); $sth2->execute; - while (my ($celvalue) = $sth2->fetchrow) { my %cell; # my %ft; @@ -235,24 +235,11 @@ sub calculate { $strcalc .= "WHERE 1 "; @$filters[0]=~ s/\*/%/g if (@$filters[0]); $strcalc .= " AND borrowers.categorycode like '" . @$filters[0] ."'" if ( @$filters[0] ); + my $strqueryfilter = "SELECT DISTINCT borrowernumber FROM old_issues WHERE borrowernumber IS NOT NULL "; if (@$filters[1]){ - my $strqueryfilter="SELECT DISTINCT borrowernumber FROM old_issues where old_issues.timestamp> @$filters[1] "; -# my $queryfilter = $dbh->prepare("SELECT DISTINCT borrowernumber FROM old_issues where old_issues.timestamp> ".format_date_in_iso(@$filters[1])); - $strcalc .= " AND borrowers.borrowernumber not in ($strqueryfilter)"; - -# $queryfilter->execute(@$filters[1]); -# while (my ($borrowernumber)=$queryfilter->fetchrow){ -# $strcalc .= " AND borrowers.borrowernumber <> $borrowernumber "; -# } - } else { - my $strqueryfilter="SELECT DISTINCT borrowernumber FROM old_issues "; -# my $queryfilter = $dbh->prepare("SELECT DISTINCT borrowernumber FROM old_issues "); -# $queryfilter->execute; - $strcalc .= " AND borrowers.borrowernumber not in ($strqueryfilter)"; -# while (my ($borrowernumber)=$queryfilter->fetchrow){ -# $strcalc .= " AND borrowers.borrowernumber <> $borrowernumber "; -# } + my $strqueryfilter .= "AND old_issues.timestamp> @$filters[1] "; } + $strcalc .= " AND borrowers.borrowernumber not in ($strqueryfilter)"; $strcalc .= " group by borrowers.borrowernumber"; $strcalc .= ", $colfield" if ($column); $strcalc .= " order by $colfield " if ($colfield); @@ -263,7 +250,6 @@ sub calculate { } else { $max=$line;} $strcalc .= " LIMIT 0,$max"; } -# warn "SQL :". $strcalc; my $dbcalc = $dbh->prepare($strcalc); $dbcalc->execute; diff --git a/reports/cat_issues_top.pl b/reports/cat_issues_top.pl index 96205a81a5..ed0b2c773f 100755 --- a/reports/cat_issues_top.pl +++ b/reports/cat_issues_top.pl @@ -48,6 +48,8 @@ my $column = $input->param("Criteria"); my @filters = $input->param("Filter"); $filters[0]=format_date_in_iso($filters[0]); $filters[1]=format_date_in_iso($filters[1]); +$filters[2]=format_date_in_iso($filters[2]); +$filters[3]=format_date_in_iso($filters[3]); my $output = $input->param("output"); my $basename = $input->param("basename"); my $mime = $input->param("MIME"); @@ -209,7 +211,9 @@ sub calculate { my $colorder; if ($column){ $column = "old_issues.".$column if (($column=~/branchcode/) or ($column=~/timestamp/)); - $column = "biblioitems.".$column if $column=~/itemtype/; + if($column=~/itemtype/){ + $column = C4::Context->preference('item-level_itypes') ? "items.itype": "biblioitems.itemtype"; + } $column = "borrowers.".$column if $column=~/categorycode/; my @colfilter ; $colfilter[0] = @$filters[0] if ($column =~ /timestamp/ ) ; @@ -310,11 +314,10 @@ sub calculate { $strcalc .= "SELECT DISTINCT biblio.title, COUNT(biblio.biblionumber) AS RANK, biblio.biblionumber AS ID"; $strcalc .= " , $colfield " if ($colfield); $strcalc .= " FROM `old_issues` - LEFT JOIN borrowers ON old_issues.borrowernumber=borrowers.borrowernumber - LEFT JOIN (items - LEFT JOIN biblioitems ON biblioitems.biblioitemnumber=items.biblioitemnumber) - ON items.itemnumber=old_issues.itemnumber - LEFT JOIN biblio ON (biblio.biblionumber=items.biblionumber) + LEFT JOIN items USING(itemnumber) + LEFT JOIN biblio USING(biblionumber) + LEFT JOIN biblioitems USING(biblionumber) + LEFT JOIN borrowers USING(borrowernumber) WHERE 1"; @$filters[0]=~ s/\*/%/g if (@$filters[0]); @@ -328,7 +331,14 @@ sub calculate { @$filters[4]=~ s/\*/%/g if (@$filters[4]); $strcalc .= " AND old_issues.branchcode like '" . @$filters[4] ."'" if ( @$filters[4] ); @$filters[5]=~ s/\*/%/g if (@$filters[5]); - $strcalc .= " AND biblioitems.itemtype like '" . @$filters[5] ."'" if ( @$filters[5] ); + if ( @$filters[5] ){ + if(C4::Context->preference('item-level_itypes') ){ + $strcalc .= " AND items.itype like " + }else{ + $strcalc .= " AND biblioitems.itemtype like " + } + $strcalc .= "'" . @$filters[5] ."'" ; + } @$filters[6]=~ s/\*/%/g if (@$filters[6]); $strcalc .= " AND borrowers.categorycode like '" . @$filters[6] ."'" if ( @$filters[6] ); @$filters[7]=~ s/\*/%/g if (@$filters[7]); @@ -342,17 +352,9 @@ sub calculate { $strcalc .= ", $colfield" if ($column); $strcalc .= " order by RANK DESC"; $strcalc .= ", $colfield " if ($colfield); - -# my $max; -# if (@loopcol) { -# $max = $line*@loopcol; -# } else { $max=$line;} -# $strcalc .= " LIMIT 0,$max"; - warn "SQL :". $strcalc; my $dbcalc = $dbh->prepare($strcalc); $dbcalc->execute; -# warn "filling table"; my $previous_col; my %indice; while (my @data = $dbcalc->fetchrow) { @@ -362,7 +364,6 @@ sub calculate { $table[$indice{$col}]->{$col}->{'name'}=$row; $table[$indice{$col}]->{$col}->{'count'}=$rank; $table[$indice{$col}]->{$col}->{'link'}=$id; -# warn " ".$i." ".$col. " ".$row; $indice{$col}++; } @@ -370,12 +371,10 @@ sub calculate { for ($i=1; $i<=$line;$i++) { my @loopcell; - warn " $i"; #@loopcol ensures the order for columns is common with column titles # and the number matches the number of columns my $colcount=0; foreach my $col ( @loopcol ) { -# warn " colonne :$col->{coltitle}"; my $value; my $count=0; my $link; @@ -388,15 +387,12 @@ sub calculate { $count =$table[$i]->{"zzEMPTY"}->{'count'}; $link =$table[$i]->{"zzEMPTY"}->{'link'}; } -# warn " ".$i ." value:$value count:$count reference:$link"; push @loopcell, {value => $value, count =>$count, reference => $link} ; } - #warn "row : $row colcount:$colcount"; #my $total = $table[$i]->{totalrow}/$colcount if ($colcount>0); push @looprow,{ 'rowtitle' => $i , 'loopcell' => \@loopcell, 'hilighted' => ($hilighted >0), - #'totalrow' => ($total)?sprintf("%.2f",$total):0 }; $hilighted = -$hilighted; } From 05b61e4f3a57828d0bc7d400cfc4bb97c4402a71 Mon Sep 17 00:00:00 2001 From: Nahuel ANGELINETTI Date: Mon, 2 Nov 2009 16:42:01 +0100 Subject: [PATCH 35/80] (bug #3745) fix deletion of borrowers rights detection This patch fix the rights checking for borrower deletion. --- .../prog/en/includes/members-toolbar.inc | 2 +- members/moremember.pl | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc index dcd55a487e..7e5bb6c6f0 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc @@ -58,7 +58,7 @@ function update_child() { var moremenu = [ { text: _("Renew Patron"), onclick: { fn: confirm_reregistration } }, { text: _("Set Permissions"), url: "/cgi-bin/koha/members/member-flags.pl?member=", disabled: true}, - { text: _("Delete"), onclick: { fn: confirm_deletion}, disabled: true }, + { text: _("Delete"), onclick: { fn: confirm_deletion}, disabled: true }, { text: _("Update Child to Adult Patron") , onclick: { fn: update_child }, disabled: true} ]; diff --git a/members/moremember.pl b/members/moremember.pl index 63b09bf3ff..691ad1d57c 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -359,6 +359,20 @@ foreach (@$alerts) { $_->{relatedto} = findrelatedto( $_->{type}, $_->{externalid} ); } +my $candeleteuser; +my $userenv = C4::Context->userenv; +if($userenv->{flags} % 2 == 1){ + $candeleteuser = 1; +}elsif ( C4::Context->preference("IndependantBranches") ) { + $candeleteuser = ( $data->{'branchcode'} eq $userenv->{branch} ); +}else{ + if( C4::Auth::getuserflags( $userenv->{flags},$userenv->{number})->{borrowers} ) { + $candeleteuser = 1; + }else{ + $candeleteuser = 0; + } +} + # check to see if patron's image exists in the database # basically this gives us a template var to condition the display of # patronimage related interface on @@ -389,6 +403,7 @@ $template->param( detailview => 1, AllowRenewalLimitOverride => C4::Context->preference("AllowRenewalLimitOverride"), DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(), + CANDELETEUSER => $candeleteuser, roaddetails => $roaddetails, borrowernumber => $borrowernumber, categoryname => $data->{'description'}, From f64de645da6cc97f12f9a502e16c552e262bb477 Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Wed, 23 Dec 2009 15:25:08 +0100 Subject: [PATCH 36/80] Bug :authid empty in Authorities Default summary --- C4/AuthoritiesMarc.pm | 1 - 1 file changed, 1 deletion(-) diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm index 12ba169d28..907d543b60 100644 --- a/C4/AuthoritiesMarc.pm +++ b/C4/AuthoritiesMarc.pm @@ -1027,7 +1027,6 @@ sub BuildSummary{ $summary = $resultstring; } else { my $heading; - my $authid; my $altheading; my $seealso; my $broaderterms; From 01ba63a84f4767d7b93108115eb8e76b18981eaa Mon Sep 17 00:00:00 2001 From: Paul Poulain Date: Thu, 24 Dec 2009 14:43:13 +0100 Subject: [PATCH 37/80] #4003 default value in PrepareItemrecordDisplay The default value you can define in cataloguing framework was not used for item created from acq or serial recieve --- C4/Biblio.pm | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index 7b17981f22..8b918dbff3 100755 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -2294,14 +2294,15 @@ sub PrepareItemrecordDisplay { $subfield_data{repeatable} = $tagslib->{$tag}->{$subfield}->{repeatable}; $subfield_data{hidden} = "display:none" if $tagslib->{$tag}->{$subfield}->{hidden}; - my ( $x, $value ); + my ( $x, $defaultvalue ); if ($itemrecord) { - ( $x, $value ) = _find_value( $tag, $subfield, $itemrecord ); + ( $x, $defaultvalue ) = _find_value( $tag, $subfield, $itemrecord ); } - if ( !defined $value ) { - $value = q||; + $defaultvalue = $tagslib->{$tag}->{$subfield}->{defaultvalue} unless $defaultvalue; + if ( !defined $defaultvalue ) { + $defaultvalue = q||; } - $value =~ s/"/"/g; + $defaultvalue =~ s/"/"/g; # search for itemcallnumber if applicable if ( $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.itemcallnumber' @@ -2310,7 +2311,7 @@ sub PrepareItemrecordDisplay { my $CNsubfield = substr( C4::Context->preference('itemcallnumber'), 3, 1 ); my $temp = $itemrecord->field($CNtag) if ($itemrecord); if ($temp) { - $value = $temp->subfield($CNsubfield); + $defaultvalue = $temp->subfield($CNsubfield); } } if ( $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.itemcallnumber' @@ -2318,7 +2319,7 @@ sub PrepareItemrecordDisplay { && $defaultvalues->{'callnumber'} ) { my $temp = $itemrecord->field($subfield) if ($itemrecord); unless ($temp) { - $value = $defaultvalues->{'callnumber'} if $defaultvalues; + $defaultvalue = $defaultvalues->{'callnumber'} if $defaultvalues; } } if ( ( $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.holdingbranch' || $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.homebranch' ) @@ -2326,7 +2327,7 @@ sub PrepareItemrecordDisplay { && $defaultvalues->{'branchcode'} ) { my $temp = $itemrecord->field($subfield) if ($itemrecord); unless ($temp) { - $value = $defaultvalues->{branchcode} if $defaultvalues; + $defaultvalue = $defaultvalues->{branchcode} if $defaultvalues; } } if ( $tagslib->{$tag}->{$subfield}->{authorised_value} ) { @@ -2381,14 +2382,14 @@ sub PrepareItemrecordDisplay { $subfield_data{marc_value} = CGI::scrolling_list( -name => 'field_value', -values => \@authorised_values, - -default => "$value", + -default => "$defaultvalue", -labels => \%authorised_lib, -size => 1, -tabindex => '', -multiple => 0, ); } else { - $subfield_data{marc_value} = ""; + $subfield_data{marc_value} = ""; } push( @loop_data, \%subfield_data ); } From c85e22ad538f97ba4fc8bfc6762497d0763b2aea Mon Sep 17 00:00:00 2001 From: Paul Poulain Date: Thu, 24 Dec 2009 17:06:33 +0100 Subject: [PATCH 38/80] aqbudget display, minor changes - removed 2 total that means nothing (and were troubling users) - reindented a little (removed tab) --- admin/aqbudgets.pl | 11 +++-------- .../prog/en/modules/admin/aqbudgets.tmpl | 10 ++++------ 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/admin/aqbudgets.pl b/admin/aqbudgets.pl index 01bfdbc840..71514c4b74 100755 --- a/admin/aqbudgets.pl +++ b/admin/aqbudgets.pl @@ -221,13 +221,13 @@ if ($op eq 'add_form') { } else { AddBudget( $budget_hash ); } - } + } my $branches = GetBranches(); my $budget_period_dropbox = GetBudgetPeriodsDropbox($$period{budget_period_id} ); $template->param( budget_period_dropbox => $budget_period_dropbox, budget_id => $budget_id, - %$period, + %$period, ); my $moo = GetBudgetHierarchy($$period{budget_period_id}, C4::Context->userenv->{branchcode}, $show_mine?$borrower_id:''); @@ -236,7 +236,7 @@ if ($op eq 'add_form') { my $toggle = 0; my @loop; my $period_total = 0; - my ( $period_alloc_total, $base_alloc_total, $base_spent_total, $base_remaining_total ); + my ( $period_alloc_total, $base_spent_total ); use YAML; $debug && warn Dump(@budgets); @@ -282,10 +282,8 @@ if ($op eq 'add_form') { ## TOTALS # adds to total - only if budget is a 'top-level' budget $period_alloc_total += $budget->{'budget_amount_total'} if $budget->{'depth'} == 0; - $base_alloc_total += $budget->{'budget_amount'}; $base_spent_total += $budget->{'budget_spent'}; $budget->{'budget_remaining'} = $budget->{'budget_amount'} - $budget->{'budget_spent'}; - $base_remaining_total += $budget->{'budget_remaining'}; # if amount == 0 dont display... delete $budget->{'budget_unalloc_sublevel'} if $budget->{'budget_unalloc_sublevel'} == 0 ; @@ -312,10 +310,7 @@ if ($op eq 'add_form') { budget => \@loop, budget_period_total => $budget_period_total, period_alloc_total => $num->format_price($period_alloc_total), - base_alloc_total => $num->format_price($base_alloc_total), base_spent_total => $num->format_price($base_spent_total), - base_remaining_total => $num->format_price($base_remaining_total), - period_remaining_total => $num->format_price( $period_alloc_total - $base_alloc_total ), branchloop => \@branchloop2, ); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tmpl index e056bbb6a0..de3d738dbf 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tmpl @@ -7,8 +7,8 @@ + diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tmpl index 05b47479e2..a794b6029f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tmpl @@ -1,16 +1,6 @@ Koha › Patrons <!-- TMPL_IF NAME="searching" -->› Search Results<!-- /TMPL_IF --> - - @@ -124,9 +114,16 @@ $(document).ready(function() {
    -
    + + diff --git a/members/member.pl b/members/member.pl index 51a3bf33f0..2937706b65 100755 --- a/members/member.pl +++ b/members/member.pl @@ -30,6 +30,7 @@ use C4::Members; use C4::Branch; use C4::Category; use File::Basename; +use YAML; my $input = new CGI; my $quicksearch = $input->param('quicksearch'); @@ -81,23 +82,28 @@ if (C4::Context->preference("AddPatronLists")=~/code/){ } my $member=$input->param('member'); -my $orderby=$input->param('orderby'); -$orderby = "surname,firstname" unless $orderby; +my $orderbyparams=$input->param('orderby'); +my @orderby; +if ($orderbyparams){ + my @orderbyelt=split(/,/,$orderbyparams); + push @orderby, {$orderbyelt[0]=>$orderbyelt[1]||0}; +} +else { + @orderby = ({surname=>1},{firstname=>1}); +} +warn Data::Dumper::Dumper(@orderby); $member =~ s/,//g; #remove any commas from search string $member =~ s/\*/%/g; my ($count,$results); -$$patron{firstname}.="\%" if ($$patron{firstname}); -$$patron{surname}.="\%" if ($$patron{surname}); - my @searchpatron; push @searchpatron, $member if ($member); push @searchpatron, $patron if (keys %$patron); my $from= ($startfrom-1)*$resultsperpage; my $to=$from+$resultsperpage; #($results)=Search(\@searchpatron,{surname=>1,firstname=>1},[$from,$to],undef,["firstname","surname","email","othernames"] ) if (@searchpatron); - ($results)=Search(\@searchpatron,{surname=>1,firstname=>1},undef,undef,["firstname","surname","email","othernames","cardnumber","userid"],"start_with" ) if (@searchpatron); + ($results)=Search(\@searchpatron,\@orderby,undef,undef,["firstname","surname","email","othernames","cardnumber","userid"],"start_with" ) if (@searchpatron); if ($results){ $count =scalar(@$results); } @@ -134,7 +140,7 @@ if ($$patron{categorycode}){ } my %parameters= ( %$patron - , 'orderby' => $orderby + , 'orderby' => $orderbyparams , 'resultsperpage' => $resultsperpage , 'type'=> 'intranet'); my $base_url = diff --git a/t/db_dependent/SQLHelper.t b/t/db_dependent/SQLHelper.t index ffa8d43115..3c2fd48a9a 100755 --- a/t/db_dependent/SQLHelper.t +++ b/t/db_dependent/SQLHelper.t @@ -10,7 +10,7 @@ use YAML; use C4::Debug; use C4::SQLHelper qw(:all); -use Test::More tests => 16; +use Test::More tests => 18; #1 BEGIN { @@ -22,10 +22,8 @@ my @categories=C4::Category->all; my $branches=C4::Branch->GetBranches; my @branchcodes=keys %$branches; my ($borrid, $borrtmp); -$borrtmp=InsertInTable("borrowers",{firstname=>"Jean",surname=>"cocteau",city=>" ",zipcode=>" ",email=>"email",categorycode=>$categories[0]->{categorycode}, branchcode=>$branchcodes[0]}); -#2 ok($borrid=InsertInTable("borrowers",{firstname=>"Jean",surname=>"Valjean",city=>" ",zipcode=>" ",email=>"email",categorycode=>$categories[0]->{categorycode}, branchcode=>$branchcodes[0]}),"Insert In Table"); -#3 +$borrtmp=InsertInTable("borrowers",{firstname=>"Jean",surname=>"cocteau",city=>" ",zipcode=>" ",email=>"email",categorycode=>$categories[0]->{categorycode}, branchcode=>$branchcodes[0]}); ok(my $status=UpdateInTable("borrowers",{borrowernumber=>$borrid,firstname=>"Jean",surname=>"Valjean",city=>"Dampierre",zipcode=>" ",email=>"email", branchcode=>$branchcodes[1]}),"Update In Table"); my $borrowers=SearchInTable("borrowers"); #4 @@ -36,6 +34,10 @@ ok(@$borrowers==1, "Search In Table by primary key on table"); $borrowers=SearchInTable("borrowers",{firstname=>"Jean"}); #6 ok(@$borrowers>0, "Search In Table hashref"); +$borrowers=SearchInTable("borrowers",{firstname=>"Jean"},[{firstname=>1},{borrowernumber=>1}],undef, [qw(borrowernumber)]); +ok(($$borrowers[0]{borrowernumber} + 0) > ($$borrowers[1]{borrowernumber} + 0), "Search In Table Order"); +$borrowers=SearchInTable("borrowers",{firstname=>"Jean"},[{surname=>0},{firstname=>1}], undef, [qw(firstname surname)]); +ok(uc($$borrowers[0]{surname}) lt uc($$borrowers[1]{surname}), "Search In Table Order"); $borrowers=SearchInTable("borrowers","Jean"); #7 ok(@$borrowers>0, "Search In Table string"); @@ -63,6 +65,8 @@ ok(@$borrowers==0, "Search In Table columns filter surname Val in exact search $borrowers=eval{SearchInTable("borrowers",["Val",{member=>"Jean"}],undef,undef,[qw(borrowernumber)],[qw(firstname title)],"exact")}; #15 ok(@$borrowers==0 && !($@), "Search In Table fails gracefully when no correct field passed in hash"); +$borrowers=eval{SearchInTable("borrowers",["Jean"],undef,undef,undef,[qw(firstname surname borrowernumber)],"start_with")}; +ok(@$borrowers==0 && !($@), "Search In Table fails gracefully when no correct field passed in hash"); $status=DeleteInTable("borrowers",{borrowernumber=>$borrid}); #16 From 3b43a79c430764daa679a44cbd30c117d388a1ce Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Wed, 23 Dec 2009 22:55:11 +0100 Subject: [PATCH 41/80] Suggestions.pm :Changing $$ notation to $ -> --- C4/Suggestions.pm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/C4/Suggestions.pm b/C4/Suggestions.pm index ed2bbfa1bb..72c3d34841 100644 --- a/C4/Suggestions.pm +++ b/C4/Suggestions.pm @@ -137,7 +137,7 @@ sub SearchSuggestion { LEFT JOIN categories AS C2 ON C2.categorycode = U2.categorycode WHERE STATUS NOT IN ('CLAIMED') } , map { - if ( my $s = $$suggestion{$_} ) { + if ( my $s = $suggestion->{$_} ) { push @sql_params,'%'.$s.'%'; " and suggestions.$_ like ? "; } else { () } @@ -147,7 +147,7 @@ sub SearchSuggestion { my $userenv = C4::Context->userenv; if (C4::Context->preference('IndependantBranches')) { if ($userenv) { - if (($userenv->{flags} % 2) != 1 && !$$suggestion{branchcode}){ + if (($userenv->{flags} % 2) != 1 && !$suggestion->{branchcode}){ push @sql_params,$$userenv{branch}; push @query,q{ and (branchcode = ? or branchcode ='')}; } @@ -161,7 +161,7 @@ sub SearchSuggestion { >} keys %$suggestion ) { if ($$suggestion{$field}){ - push @sql_params,$$suggestion{$field}; + push @sql_params,$suggestion->{$field}; push @query, " and suggestions.$field=?"; } else { @@ -380,12 +380,12 @@ sub ModSuggestion { my $status_update_table=UpdateInTable("suggestions", $suggestion); # check mail sending. if ($$suggestion{STATUS}){ - my $letter=C4::Letters::getletter('suggestions',$$suggestion{STATUS}); + my $letter=C4::Letters::getletter('suggestions',$suggestion->{STATUS}); if ($letter){ my $enqueued = C4::Letters::EnqueueLetter({ letter=>$letter, - borrowernumber=>$$suggestion{suggestedby}, - suggestionid=>$$suggestion{suggestionid}, + borrowernumber=>$suggestion->{suggestedby}, + suggestionid=>$suggestion->{suggestionid}, msg_transport_type=>'email' }); if (!$enqueued){warn "can't enqueue letter $letter";} From a97d12faa7e75a35382a9aa606907d61ef8575c9 Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Thu, 24 Dec 2009 09:25:17 +0100 Subject: [PATCH 42/80] C4::SQLHelper Changing $$ notation to $ -> --- C4/SQLHelper.pm | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/C4/SQLHelper.pm b/C4/SQLHelper.pm index 1d600346ab..0b0c520304 100644 --- a/C4/SQLHelper.pm +++ b/C4/SQLHelper.pm @@ -118,7 +118,7 @@ sub SearchInTable{ #Order by desc by default my @orders; foreach my $order (@$orderby){ - push @orders,map{ "$_".($$order{$_}? " DESC " : "") } keys %$order; + push @orders,map{ "$_".($order->{$_}? " DESC " : "") } keys %$order; } $sql.= do { local $"=', '; qq{ ORDER BY @orders} @@ -236,7 +236,7 @@ sub DeleteInTable{ sub GetPrimaryKeys($) { my $tablename=shift; my $hash_columns=_get_columns($tablename); - return grep { $$hash_columns{$_}{'Key'} =~/PRI/i} keys %$hash_columns; + return grep { $hash_columns->{$_}->{'Key'} =~/PRI/i} keys %$hash_columns; } =head2 _get_columns @@ -344,6 +344,7 @@ sub _filter_fields{ } } else{ + $debug && warn "filterstring : $filter_input"; my ($keys, $values) = _filter_string($tablename,$filter_input, $searchtype,$filtercolumns); if ($keys){ my $stringkey="(".join (") AND (",@$keys).")"; @@ -367,8 +368,8 @@ sub _filter_hash{ my $elements=join "|",@columns_filtered; foreach my $field (grep {/\b($elements)\b/} keys %$filter_input){ ## supposed to be a hash of simple values, hashes of arrays could be implemented - $$filter_input{$field}=format_date_in_iso($$filter_input{$field}) if ($$columns{$field}{Type}=~/date/ && $$filter_input{$field} !~C4::Dates->regexp("iso")); - my ($tmpkeys, $localvalues)=_Process_Operands($$filter_input{$field},"$tablename.$field",$searchtype,$columns); + $filter_input->{$field}=format_date_in_iso($filter_input->{$field}) if ($columns->{$field}{Type}=~/date/ && $filter_input->{$field} !~C4::Dates->regexp("iso")); + my ($tmpkeys, $localvalues)=_Process_Operands($filter_input->{$field},"$tablename.$field",$searchtype,$columns); if (@$tmpkeys){ push @values, @$localvalues; push @keys, @$tmpkeys; @@ -424,7 +425,7 @@ sub _Process_Operands{ if ($field=~/(?{$col_field}->{Type}=~/varchar|text/i){ my @localvaluesextended; if ($searchtype eq "contain"){ push @tmpkeys,(" $field LIKE ? "); From 9d1e7f43e15b869afc3fccd80c1545170cc84ea0 Mon Sep 17 00:00:00 2001 From: Paul Poulain Date: Thu, 31 Dec 2009 09:07:54 +0100 Subject: [PATCH 43/80] (bug #4020) XSLT unimarc display When using XSLT Display, and UNIMARC, since marcFlavour is not used in encoding data, when data is true utf8, as_xml fails on some subfields. Moreover, because transformMARCXMLForXSLT edits some values in the marc record and the PERL UTF8 is not handled by MARC::File::USMARC, it endsup in double encoding the data. Sending a patch to fix both issues. This patch adds - two functions in C4/Charset.pm NormalizeString (uses Unicode::Normalize) SetUTF8Flag (This function in my opinion belongs to MARC::Record, or at least MARC::File::USMARC) - edits C4::XSLT in order to cope with the correct marcflavour - edits C4::Search searchResults to use setUTF8Flag --- C4/Charset.pm | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++ C4/Search.pm | 5 ++++ C4/XSLT.pm | 5 ++-- 3 files changed, 90 insertions(+), 2 deletions(-) diff --git a/C4/Charset.pm b/C4/Charset.pm index e1b6c96efa..e39637acf3 100644 --- a/C4/Charset.pm +++ b/C4/Charset.pm @@ -23,6 +23,7 @@ use warnings; use MARC::Charset qw/marc8_to_utf8/; use Text::Iconv; use C4::Debug; +use Unicode::Normalize; use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); @@ -34,6 +35,7 @@ BEGIN { @EXPORT = qw( IsStringUTF8ish MarcToUTF8Record + SetUTF8Flag SetMarcUnicodeFlag StripNonXmlChars ); @@ -111,6 +113,86 @@ sub IsStringUTF8ish { return utf8::decode($str); } +=head2 SetUTF8Flag + +=over 4 + +my $marc_record = SetUTF8Flag($marc_record); + +=back + +This function sets the PERL UTF8 flag for data. +It is required when using new_from_usmarc +since MARC::File::USMARC does not handle PERL UTF8 setting. +When editing unicode marc records fields and subfields, you +would end up in double encoding without using this function. + +FIXME +In my opinion, this function belongs to MARC::Record and not +to this package. +But since it handles charset, and MARC::Record, it finds its way in that package + +=cut + +sub SetUTF8Flag{ + my ($record)=@_; + return unless ($record && $record->fields()); + foreach my $field ($record->fields()){ + if ($field->tag()>=10){ + my @subfields; + foreach my $subfield ($field->subfields()){ + push @subfields,($$subfield[0],NormalizeString($$subfield[1])); + } + my $newfield=MARC::Field->new( + $field->tag(), + $field->indicator(1), + $field->indicator(2), + @subfields + ); + $field->replace_with($newfield); + } + } +} + +=head2 NormalizeString + +=over 4 + + my $normalized_string=NormalizeString($string); + +=back + Given + a string + nfc : If you want to set NFC and not NFD + transform : If you expect all the signs to be removed + Sets the PERL UTF8 Flag on your initial data if need be + and applies cleaning if required + + Returns a utf8 NFD normalized string + + Sample code : + my $string=NormalizeString ("l'ornithoptère"); + #results into ornithoptère in NFD form and sets UTF8 Flag +=cut + +sub NormalizeString{ + my ($string,$nfc,$transform)=@_; + utf8::decode($string) unless (utf8::is_utf8($string)); + if ($nfc){ + $string= NFD($string); + } + else { + $string=NFC($string); + } + if ($transform){ + $string=~s/\<|\>|\^|\;|\.|\?|,|\-|\(|\)|\[|\]|\{|\}|\$|\%|\!|\*|\:|\\|\/|\&|\"|\'/ /g; + #removing one letter words "d'" "l'" was changed into "d " "l " + $string=~s/\b\S\b//g; + $string=~s/\s+$//g; + } + return $string; +} + =head2 MarcToUTF8Record =over 4 diff --git a/C4/Search.pm b/C4/Search.pm index 47ac7a36d0..e403672800 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -448,6 +448,7 @@ sub getRecords { # not an index scan else { $record = $results[ $i - 1 ]->record($j)->raw(); + warn $results[$i-1]->record($j)->render() ; # warn "RECORD $j:".$record; $results_hash->{'RECORDS'}[$j] = $record; @@ -1647,6 +1648,10 @@ sub searchResults { } # XSLT processing of some stuff + my $debug=1; + use C4::Charset; + SetUTF8Flag($marcrecord); + $debug && warn $marcrecord->as_formatted; if (C4::Context->preference("XSLTResultsDisplay") && !$scan) { $oldbiblio->{XSLTResultsRecord} = XSLTParse4Display( $oldbiblio->{biblionumber}, $marcrecord, 'Results' ); diff --git a/C4/XSLT.pm b/C4/XSLT.pm index 8a67e04090..1c7184a11d 100644 --- a/C4/XSLT.pm +++ b/C4/XSLT.pm @@ -124,8 +124,9 @@ sub XSLTParse4Display { my $record = transformMARCXML4XSLT($biblionumber, $orig_record); #return $record->as_formatted(); my $itemsxml = buildKohaItemsNamespace($biblionumber); - my $xmlrecord = $record->as_xml(); + my $xmlrecord = $record->as_xml(C4::Context->preference('marcflavour')); my $sysxml = "\n"; + warn $xmlrecord; foreach my $syspref ( qw/OPACURLOpenInNewWindow DisplayOPACiconsXSLT URLLinkText/ ) { $sysxml .= "" . C4::Context->preference( $syspref ) . @@ -137,7 +138,7 @@ sub XSLTParse4Display { my $parser = XML::LibXML->new(); # don't die when you find &, >, etc - $parser->recover_silently(1); + $parser->recover_silently(0); my $source = $parser->parse_string($xmlrecord); unless ( $stylesheet ) { my $xslt = XML::LibXSLT->new(); From c2e245e2da01b565c1b94c070bb9c4a19257779e Mon Sep 17 00:00:00 2001 From: Nahuel ANGELINETTI Date: Tue, 29 Dec 2009 16:06:35 +0100 Subject: [PATCH 44/80] [followup](bug #3667) cleaning borrowers fix This fix GetBorrowersWhoHaveNotBorrowedSince to select only borrowers that have no issues and have no old_issues more recent than a specified date. --- C4/Members.pm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/C4/Members.pm b/C4/Members.pm index 96c7b472a8..71eef78b3d 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -1724,7 +1724,7 @@ Looks up the different title . Returns array with all borrowers title =cut sub GetTitles { - my @borrowerTitle = split /,|\|/,C4::Context->preference('BorrowersTitles'); + my @borrowerTitle = split (/,|\|/,C4::Context->preference('BorrowersTitles')); unshift( @borrowerTitle, "" ); my $count=@borrowerTitle; if ($count == 1){ @@ -1838,10 +1838,13 @@ sub GetBorrowersWhoHaveNotBorrowedSince { : ""); my $dbh = C4::Context->dbh; my $query = " - SELECT borrowers.borrowernumber,max(issues.timestamp) as latestissue + SELECT borrowers.borrowernumber, + max(old_issues.timestamp) as latestissue, + max(issues.timestamp) as currentissue FROM borrowers JOIN categories USING (categorycode) - LEFT JOIN issues ON borrowers.borrowernumber = issues.borrowernumber + LEFT JOIN old_issues USING (borrowernumber) + LEFT JOIN issues USING (borrowernumber) WHERE category_type <> 'S' "; my @query_params; @@ -1854,7 +1857,8 @@ sub GetBorrowersWhoHaveNotBorrowedSince { } $query.=" GROUP BY borrowers.borrowernumber"; if ($filterdate){ - $query.=" HAVING latestissue Date: Wed, 30 Dec 2009 11:40:52 +0100 Subject: [PATCH 45/80] [followup](bug #3667) fix dateexpiry filtering this fix the dateexpiry used to filter users, now we use date specified. --- C4/Members.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/C4/Members.pm b/C4/Members.pm index 71eef78b3d..7c5355e6e1 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -1853,7 +1853,8 @@ sub GetBorrowersWhoHaveNotBorrowedSince { push @query_params,$filterbranch; } if($filterexpiry){ - $query .= " AND dateexpiry < NOW() "; + $query .= " AND dateexpiry < ? "; + push @query_params,$filterdate; } $query.=" GROUP BY borrowers.borrowernumber"; if ($filterdate){ From da2ba2759c4b48032386971011c09741b9453dc9 Mon Sep 17 00:00:00 2001 From: Nahuel ANGELINETTI Date: Wed, 30 Dec 2009 16:50:46 +0100 Subject: [PATCH 46/80] [followup](bug #3667) don't delete if member is guarantor this fix cleanborrowers to don't delete guanrantors. --- C4/Members.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/C4/Members.pm b/C4/Members.pm index 7c5355e6e1..c7220d5214 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -1846,6 +1846,7 @@ sub GetBorrowersWhoHaveNotBorrowedSince { LEFT JOIN old_issues USING (borrowernumber) LEFT JOIN issues USING (borrowernumber) WHERE category_type <> 'S' + AND borrowernumber NOT IN (SELECT guarantorid FROM borrowers WHERE guarantorid IS NOT NULL AND guarantorid <> 0) "; my @query_params; if ($filterbranch && $filterbranch ne ""){ From 800494a5ef27ff3066843bf5f20d2064dd3de284 Mon Sep 17 00:00:00 2001 From: Nahuel ANGELINETTI Date: Thu, 24 Dec 2009 15:20:47 +0100 Subject: [PATCH 47/80] (bug #4004) disallow access for non-logged in users in opac This doesn't define borrowernumber = 0 if a borrower is NOT logged. We know borrowernumber 0 is mysqluser... So in virtualshelves, a non logged user have all permissions. --- C4/Auth.pm | 3 ++- C4/VirtualShelves.pm | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index f0be27cb91..ea10d16816 100755 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -165,7 +165,8 @@ sub get_template_and_user { $template->param( bartotal => $total->{'bartotal'}, ) if ($total->{'bartotal'} > scalar (@$barshelves)); } - $borrowernumber = getborrowernumber($user); + $borrowernumber = getborrowernumber($user) if defined($user); + my ( $borr ) = GetMemberDetails( $borrowernumber ); my @bordat; $bordat[0] = $borr; diff --git a/C4/VirtualShelves.pm b/C4/VirtualShelves.pm index eda6840cbc..735087e1a6 100644 --- a/C4/VirtualShelves.pm +++ b/C4/VirtualShelves.pm @@ -476,6 +476,7 @@ sub ShelfPossibleAction { $sth->execute($shelfnumber); my ( $owner, $category ) = $sth->fetchrow; my $borrower = GetMemberDetails($user); + return 0 if not defined($user); return 1 if ( $category >= 3); # open list return 1 if (($category >= 2) and defined($action) and $action eq 'view'); # public list, anybody can view From 73605d792f51a8ff4bd41fb32406b8e3c1cbd307 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Mon, 4 Jan 2010 10:38:08 +0100 Subject: [PATCH 48/80] [MT2590] Removed root budget duplicate checkings --- admin/aqbudgetperiods.pl | 27 ----------------- .../prog/en/includes/duplicates.inc | 30 ------------------- .../en/modules/admin/aqbudgetperiods.tmpl | 3 +- 3 files changed, 1 insertion(+), 59 deletions(-) delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/duplicates.inc diff --git a/admin/aqbudgetperiods.pl b/admin/aqbudgetperiods.pl index 779f22c0d6..fadf83dbca 100755 --- a/admin/aqbudgetperiods.pl +++ b/admin/aqbudgetperiods.pl @@ -61,7 +61,6 @@ my $input = new CGI; my $searchfield = $input->param('searchfield'); my $budget_period_id = $input->param('budget_period_id'); my $op = $input->param('op')||"else"; -my $check_duplicate = $input->param('confirm_not_duplicate')||0; my $budget_period_hashref= $input->Vars; #my $sort1_authcat = $input->param('sort1_authcat'); @@ -127,7 +126,6 @@ if ( $op eq 'add_form' ) { ); } # IF-MOD $template->param( DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),); - $template->param( confirm_not_duplicate => $check_duplicate ); } elsif ( $op eq 'add_validate' ) { @@ -139,31 +137,6 @@ elsif ( $op eq 'add_validate' ) { my $status=ModBudgetPeriod($budget_period_hashref); } else { # ELSE ITS AN ADD - unless ($check_duplicate){ - my $candidates=GetBudgetPeriods({ - budget_period_startdate => $$budget_period_hashref{budget_period_startdate} - , budget_period_enddate => $$budget_period_hashref{budget_period_enddate} - }); - if (@$candidates){ - my @duplicates=map{ - { dupid => $$_{budget_period_id} - , duplicateinformation => - $$_{budget_period_description}." ".$$_{budget_period_startdate}." ".$$_{budget_period_enddate} - } - } @$candidates; - $template->param(url => "aqbudgetperiods.pl", - field_name => "budget_period_id", - action_dup_yes_url=> "aqbudgets.pl", - action_dup_no_url => "aqbudgetperiods.pl?op=add_validate", - confirm_not_duplicate => 0 - ); - delete $$budget_period_hashref{budget_period_id}; - $template->param(duplicates=>\@duplicates,%$budget_period_hashref); - $template->param("add_form"=>1); - output_html_with_http_headers $input, $cookie, $template->output; - exit; - } - } my $budget_period_id=AddBudgetPeriod($budget_period_hashref); } $op='else'; diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/duplicates.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/duplicates.inc deleted file mode 100644 index a2a5bc320d..0000000000 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/duplicates.inc +++ /dev/null @@ -1,30 +0,0 @@ -
    - - - -

    Duplicate suspected

    -

    Is this a duplicate of -

    -

    -
    " method="get"> - - -
    - diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tmpl index 5d661c988a..41af729597 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tmpl @@ -130,7 +130,7 @@ - +

    Modify root budget

    @@ -142,7 +142,6 @@ - " /> " />
    1. From 022978d4f4dd8750a44587cb507636a9d07a5a58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Mon, 4 Jan 2010 15:35:43 +0100 Subject: [PATCH 49/80] [MT2593] Added "ordered" column in acqui-home budget display --- C4/Budgets.pm | 22 ++++++++++++-- acqui/acqui-home.pl | 30 +++++++++---------- .../prog/en/includes/acquisitions-toolbar.inc | 2 +- .../prog/en/modules/acqui/acqui-home.tmpl | 3 ++ 4 files changed, 39 insertions(+), 18 deletions(-) diff --git a/C4/Budgets.pm b/C4/Budgets.pm index 8ef85edbf9..4a8b3b6487 100644 --- a/C4/Budgets.pm +++ b/C4/Budgets.pm @@ -39,6 +39,7 @@ BEGIN { &ModBudget &DelBudget &GetBudgetSpent + &GetBudgetOrdered &GetPeriodsCount &GetBudgetPeriod @@ -300,9 +301,26 @@ sub GetBudgetSpent { my ($budget_id) = @_; my $dbh = C4::Context->dbh; my $sth = $dbh->prepare(qq| - SELECT SUM(ecost * quantity ) AS sum FROM aqorders + SELECT SUM(ecost * quantity) AS sum FROM aqorders WHERE budget_id = ? AND - datecancellationprinted IS NULL + quantityreceived > 0 AND + datecancellationprinted IS NULL + |); + + $sth->execute($budget_id); + my $sum = $sth->fetchrow_array; + return $sum; +} + +# ------------------------------------------------------------------- +sub GetBudgetOrdered { + my ($budget_id) = @_; + my $dbh = C4::Context->dbh; + my $sth = $dbh->prepare(qq| + SELECT SUM(ecost * quantity) AS sum FROM aqorders + WHERE budget_id = ? AND + quantityreceived = 0 AND + datecancellationprinted IS NULL |); $sth->execute($budget_id); diff --git a/acqui/acqui-home.pl b/acqui/acqui-home.pl index 8c6fcc8d74..ef457b7b52 100755 --- a/acqui/acqui-home.pl +++ b/acqui/acqui-home.pl @@ -78,6 +78,7 @@ my $branchname = GetBranchName($homebranch); my $classlist = ''; my $total = 0; my $totspent = 0; +my $totordered = 0; my $totcomtd = 0; my $totavail = 0; my @loop_budget = (); @@ -149,22 +150,20 @@ foreach my $result (@results) { my $member = GetMember( $result->{'budget_owner_id'} ); my $member_full = $member->{'firstname'} . ' ' . $member->{'surname'} if $member; - $result->{'budget_owner'} = $member_full; - if ($result->{'budget_spent'}){ - $result->{'budget_avail'} = $result->{'budget_amount'} - $result->{'budget_spent'}; - } - else { - $result->{'budget_avail'} = $result->{'budget_amount'}; - } - $result->{'budget_spent'} = GetBudgetSpent( $result->{'budget_id'} ); + $result->{'budget_owner'} = $member_full; + $result->{'budget_ordered'} = GetBudgetOrdered( $result->{'budget_id'} ); + $result->{'budget_avail'} = $result->{'budget_amount'} - $result->{'budget_spent'} - $result->{'budget_ordered'}; + $result->{'budget_spent'} = GetBudgetSpent( $result->{'budget_id'} ); - $total += $result->{'budget_amount'}; - $totspent += $result->{'budget_spent'} if $result->{'budget_spent'}; - $totavail += $result->{'budget_avail'}; + $total += $result->{'budget_amount'}; + $totspent += $result->{'budget_spent'}; + $totordered += $result->{'budget_ordered'}; + $totavail += $result->{'budget_avail'}; - $result->{'budget_amount'} = $num->format_price( $result->{'budget_amount'} ); - $result->{'budget_spent'} = $num->format_price( $result->{'budget_spent'} ); - $result->{'budget_avail'} = $num->format_price( $result->{'budget_avail'} ); + $result->{'budget_amount'} = $num->format_price( $result->{'budget_amount'} ); + $result->{'budget_spent'} = $num->format_price( $result->{'budget_spent'} ); + $result->{'budget_ordered'} = $num->format_price( $result->{'budget_ordered'} ); + $result->{'budget_avail'} = $num->format_price( $result->{'budget_avail'} ); # my $spent_percent = ( $result->{'budget_spent'} / $result->{'budget_amount'} ) * 100; # $result->{'budget_spent_percent'} = sprintf( "%00d", $spent_percent ); @@ -184,7 +183,8 @@ $template->param( branchname => $branchname, budget => $period->{budget_name}, total => $num->format_price( $total ), - totspent => $num->format_price($totspent ), + totspent => $num->format_price( $totspent ), + totordered => $num->format_price( $totordered ), totcomtd => $num->format_price( $totcomtd ), totavail => $num->format_price( $totavail ), suggestion => $suggestion, 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 c3376fefc5..df9ff2fa68 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-toolbar.inc @@ -45,7 +45,7 @@
    2. &op=enter">Edit
    3. ">New Contract
    4. -
    5. ">New Basket
    6. +
    7. &op=add_form">New Basket
    8. New Vendor
    9. diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/acqui-home.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/acqui-home.tmpl index 5d793c07a6..697443317f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/acqui-home.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/acqui-home.tmpl @@ -74,6 +74,7 @@
    + @@ -84,6 +85,7 @@ + @@ -99,6 +101,7 @@ + From c6027e73c562a309f20dda804aed921982006e1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Mon, 4 Jan 2010 17:06:17 +0100 Subject: [PATCH 50/80] Fixed a major bug in ModReceiveOrder Orders were not splited correctly. --- C4/Acquisition.pm | 4 +++- acqui/parcel.pl | 2 -- koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tmpl | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm index f26e243250..2b60f39442 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -1226,7 +1226,7 @@ sub ModReceiveOrder { , unitprice=? , freight=? , rrp=? - , quantityreceived=? + , quantity=? WHERE biblionumber=? AND ordernumber=?"); $sth->execute($quantrec,$datereceived,$invoiceno,$cost,$freight,$rrp,$quantrec,$biblionumber,$ordernumber); @@ -1236,6 +1236,8 @@ sub ModReceiveOrder { foreach my $orderkey ( "linenumber", "allocation" ) { delete($order->{'$orderkey'}); } + $order->{'quantity'} -= $quantrec; + $order->{'quantityreceived'} = 0; my $newOrder = NewOrder($order); } else { $sth=$dbh->prepare("update aqorders diff --git a/acqui/parcel.pl b/acqui/parcel.pl index 7b93a158f1..863bb7f329 100755 --- a/acqui/parcel.pl +++ b/acqui/parcel.pl @@ -111,7 +111,6 @@ if($input->param('format') eq "json"){ $data->{author} = $order->{author}; $data->{biblionumber} = $order->{biblionumber}; $data->{freight} = $order->{freight}; - $data->{quantrem} = $order->{quantity} - $order->{quantityreceived}; $data->{quantity} = $order->{quantity}; $data->{ecost} = $order->{ecost}; $data->{ordertotal} = sprintf("%.2f",$order->{ecost}*$order->{quantity}); @@ -234,7 +233,6 @@ for (my $i = 0 ; $i < $countpendings ; $i++) { my %line; %line = %{$pendingorders->[$i]}; $line{quantity}+=0; - $line{quantrem} = $line{quantity} - $line{quantityreceived}; $line{quantityreceived}+=0; $line{unitprice}+=0; $totalPunitprice += $line{unitprice}; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tmpl index c97c26eb79..5a6e8a71dd 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tmpl @@ -179,7 +179,7 @@ - + @@ -209,7 +209,7 @@
    Publisher : - +
    Location(s)

    - + , () @@ -333,7 +333,8 @@ function tagAdded() {

      TitleItem TypeAuthorYear Location
    ',)"> + + ',)"> - - -

    - - - - - -

    - -

    - - - &rft.btitle=&rft.date=&rft.tpages=&rft.isbn=&rft.aucorp=&rft.place=&rft.pub=&rft.edition=&rft.series=&rft.genre="> -
    _status" class="tagstatus results_summary" style="display:none">Tag status here.
    - -
    + + + + + +

    - + , () diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tmpl index c35655359d..f99f7b2077 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tmpl +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tmpl @@ -247,6 +247,7 @@ $(function() {

    Title Author YearLocation
    + +

    + , + + () + +

    + This record has no items. +
    Owner Branch AmountOrdered Spent Avail
       
    Order Summary View RecordStill on orderQuantity Unit cost Order cost   " title="MARC" rel="gb_page_center[600,500]">MARC | " title="MARC" rel="gb_page_center[600,500]">Card / From b5800a41b744b61cfe96812a3c838b75f1842e2e Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Mon, 4 Jan 2010 17:30:34 +0100 Subject: [PATCH 51/80] followup (bug #4020) XSLT unimarc display C4::Search removing unconditionnal warning --- C4/Search.pm | 1 - 1 file changed, 1 deletion(-) diff --git a/C4/Search.pm b/C4/Search.pm index e403672800..16c6a559af 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -448,7 +448,6 @@ sub getRecords { # not an index scan else { $record = $results[ $i - 1 ]->record($j)->raw(); - warn $results[$i-1]->record($j)->render() ; # warn "RECORD $j:".$record; $results_hash->{'RECORDS'}[$j] = $record; From 696a9cb601aa17216c1e36b5978f3f9b105f7639 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Tue, 5 Jan 2010 09:18:45 +0100 Subject: [PATCH 52/80] [MT2593] Fixed budget amount computation in acqui-home --- acqui/acqui-home.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/acqui/acqui-home.pl b/acqui/acqui-home.pl index ef457b7b52..63e913afb7 100755 --- a/acqui/acqui-home.pl +++ b/acqui/acqui-home.pl @@ -152,8 +152,8 @@ foreach my $result (@results) { $result->{'budget_owner'} = $member_full; $result->{'budget_ordered'} = GetBudgetOrdered( $result->{'budget_id'} ); - $result->{'budget_avail'} = $result->{'budget_amount'} - $result->{'budget_spent'} - $result->{'budget_ordered'}; $result->{'budget_spent'} = GetBudgetSpent( $result->{'budget_id'} ); + $result->{'budget_avail'} = $result->{'budget_amount'} - $result->{'budget_spent'} - $result->{'budget_ordered'}; $total += $result->{'budget_amount'}; $totspent += $result->{'budget_spent'}; From 8ecfe0f756c10c0b216d6c89bf6f058b836e6d39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Fri, 8 Jan 2010 10:49:52 +0100 Subject: [PATCH 53/80] [MT2370] Basket header display improvement The name is mandatory, it is now displayed in red. --- koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketheader.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketheader.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketheader.tmpl index e6279abf16..e3f8e3e9f1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketheader.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketheader.tmpl @@ -121,7 +121,7 @@ li.list2 {
  • -   +   " />
  • From 55ece2a028da464fa9ec621de422bce557ea0ad0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Fri, 8 Jan 2010 10:54:37 +0100 Subject: [PATCH 54/80] [MT2370] Fixed basketheader breadcrumb There was to link to get back to the supplier. --- .../intranet-tmpl/prog/en/modules/acqui/basketheader.tmpl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketheader.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketheader.tmpl index e3f8e3e9f1..91e67739a0 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketheader.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketheader.tmpl @@ -91,9 +91,10 @@ li.list2 { From 6247c38600da4effba9f847a7ae7c8f1d6d9563d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Fri, 8 Jan 2010 11:29:21 +0100 Subject: [PATCH 55/80] [MT2370] Basket header workflow improvement The "Data Recorded" page was useless, I removed it. --- acqui/basketheader.pl | 9 +++++---- .../prog/en/modules/acqui/basketheader.tmpl | 6 +----- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/acqui/basketheader.pl b/acqui/basketheader.pl index 58e5773332..47f210e2f5 100755 --- a/acqui/basketheader.pl +++ b/acqui/basketheader.pl @@ -112,13 +112,14 @@ if ( $op eq 'add_form' ) { #End Edit } elsif ( $op eq 'add_validate' ) { #we are confirming the changes, save the basket - $template->param(add_validate => 1); + my $basketno; if ( $is_an_edit ) { + $basketno = $input->param('basketno'); ModBasketHeader($input->param('basketno'),$input->param('basketname'),$input->param('basketnote'),$input->param('basketbooksellernote'),$input->param('basketcontractnumber')); - $template->param( basketno => $basketno ); } else { #New basket - my $basketno = NewBasket($booksellerid, $loggedinuser, $input->param('basketname'), $input->param('basketnote'), $input->param('basketbooksellernote'), $input->param('basketcontractnumber')); - $template->param( basketno => $basketno ); + $basketno = NewBasket($booksellerid, $loggedinuser, $input->param('basketname'), $input->param('basketnote'), $input->param('basketbooksellernote'), $input->param('basketcontractnumber')); } + print $input->redirect('basket.pl?basketno='.$basketno); + exit 0; } output_html_with_http_headers $input, $cookie, $template->output; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketheader.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketheader.tmpl index 91e67739a0..1fb9d4f54f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketheader.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketheader.tmpl @@ -94,7 +94,7 @@ li.list2 { "> › Edit basket '' - Add a basket + add a basket to @@ -155,10 +155,6 @@ li.list2 { - -

    Data recorded

    - "> -
    From 6961f2e7572d9c9c13c681c03066a70e664c1e8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Fri, 8 Jan 2010 11:41:21 +0100 Subject: [PATCH 56/80] [MT2390] Fixed addorderiso2709 breadcrumb Booksellername was not showing. --- acqui/addorderiso2709.pl | 3 +++ .../intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tmpl | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/acqui/addorderiso2709.pl b/acqui/addorderiso2709.pl index 3c05ca0ae7..a02820596d 100755 --- a/acqui/addorderiso2709.pl +++ b/acqui/addorderiso2709.pl @@ -38,6 +38,7 @@ use C4::Items; use C4::Koha qw/GetItemTypes/; use C4::Budgets qw/GetBudgets/; use C4::Acquisition qw/NewOrderItem/; +use C4::Bookseller qw/GetBookSellerFromId/; my $input = new CGI; my ($template, $loggedinuser, $cookie) = get_template_and_user({ @@ -51,9 +52,11 @@ my ($template, $loggedinuser, $cookie) = get_template_and_user({ my $cgiparams = $input->Vars; my $op = $cgiparams->{'op'}; my $booksellerid = $input->param('booksellerid'); +my $bookseller = GetBookSellerFromId($booksellerid); $template->param(scriptname => "/cgi-bin/koha/acqui/addorderiso2709.pl", booksellerid => $booksellerid, + booksellername => $bookseller->{name}, ); my $ordernumber; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tmpl index e5756a4e5b..35b7d1df9b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tmpl @@ -10,7 +10,7 @@ - +
    @@ -93,4 +93,4 @@
    - \ No newline at end of file + From c219a8c4820b8c8c9793705014e0e959243cd9a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Fri, 8 Jan 2010 11:56:46 +0100 Subject: [PATCH 57/80] [MT2390] Added tablesorter on staged files --- .../en/modules/acqui/addorderiso2709.tmpl | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tmpl index 35b7d1df9b..94637d1332 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tmpl @@ -7,6 +7,19 @@ + + + @@ -66,7 +79,8 @@
    - +
    + @@ -75,6 +89,8 @@ + + @@ -85,6 +101,7 @@ +
    File name Comments# Bibs  
    ?import_batch_id=&basketno=&booksellerid=">Add orders
    From 2086615a35b8924b6b4b77f555a13d56507d3e26 Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Thu, 14 Jan 2010 18:51:28 +0100 Subject: [PATCH 58/80] SQLHelper : InsertInTable enhancement InsertInTable can now add values to table where primaryKey requires user input such as branches table --- C4/SQLHelper.pm | 8 ++++---- t/db_dependent/SQLHelper.t | 4 +++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/C4/SQLHelper.pm b/C4/SQLHelper.pm index 0b0c520304..08ba90f648 100644 --- a/C4/SQLHelper.pm +++ b/C4/SQLHelper.pm @@ -140,7 +140,7 @@ sub SearchInTable{ =over 4 - $data_id_in_table = &InsertInTable($tablename,$data_hashref); + $data_id_in_table = &InsertInTable($tablename,$data_hashref,$withprimarykeys); =back @@ -149,9 +149,9 @@ sub SearchInTable{ =cut sub InsertInTable{ - my ($tablename,$data) = @_; + my ($tablename,$data,$withprimarykeys) = @_; my $dbh = C4::Context->dbh; - my ($keys,$values)=_filter_hash($tablename,$data,0); + my ($keys,$values)=_filter_hash($tablename,$data,($withprimarykeys?"exact":0)); my $query = qq{ INSERT INTO $tablename SET }.join(", ",@$keys); $debug && warn $query, join(",",@$values); @@ -418,7 +418,7 @@ sub _Process_Operands{ push @tmpkeys, " $field = ? "; push @values, $operand; #By default, exact search - unless ($searchtype){ + if (!$searchtype ||$searchtype eq "exact"){ return \@tmpkeys,\@values; } my $col_field=(index($field,".")>0?substr($field, index($field,".")+1):$field); diff --git a/t/db_dependent/SQLHelper.t b/t/db_dependent/SQLHelper.t index 3c2fd48a9a..c620ebb5d1 100755 --- a/t/db_dependent/SQLHelper.t +++ b/t/db_dependent/SQLHelper.t @@ -10,7 +10,7 @@ use YAML; use C4::Debug; use C4::SQLHelper qw(:all); -use Test::More tests => 18; +use Test::More tests => 19; #1 BEGIN { @@ -19,6 +19,8 @@ BEGIN { use C4::Category; use C4::Branch; my @categories=C4::Category->all; +my $insert; +ok(($insert=InsertInTable("branches",{branchcode=>"ZZZZ",branchname=>"Brancheinconnue",city=>" ",zipcode=>" "},1))==0,"AddBranch (Insert In Table with primary key defined)"); my $branches=C4::Branch->GetBranches; my @branchcodes=keys %$branches; my ($borrid, $borrtmp); From a404384b11d1514692de71acb863dc4dc71b6498 Mon Sep 17 00:00:00 2001 From: Matthias Meusburger Date: Fri, 15 Jan 2010 17:42:43 +0100 Subject: [PATCH 59/80] MT2116: Addons to the CSV export Add user-defined headers Add CSV, field and subfield separator selection --- C4/Csv.pm | 13 +++ C4/Record.pm | 79 +++++++++++++----- installer/data/mysql/updatedatabase.pl | 12 +++ .../prog/en/modules/tools/csv-profiles.tmpl | 83 ++++++++++++++++++- kohaversion.pl | 2 +- test.pl | 30 +++++++ tools/csv-profiles.pl | 21 +++-- 7 files changed, 208 insertions(+), 32 deletions(-) create mode 100644 test.pl diff --git a/C4/Csv.pm b/C4/Csv.pm index 292cd4edad..a53fcb91df 100644 --- a/C4/Csv.pm +++ b/C4/Csv.pm @@ -31,6 +31,7 @@ $VERSION = 3.00; @EXPORT = qw( &GetCsvProfiles + &GetCsvProfile &GetCsvProfilesLoop &GetMarcFieldsForCsv ); @@ -48,6 +49,18 @@ sub GetCsvProfiles { } +# Returns all informations about a given csv profile +sub GetCsvProfile { + my ($id) = @_; + my $dbh = C4::Context->dbh; + my $query = "SELECT * FROM export_format WHERE export_format_id=?"; + + $sth = $dbh->prepare($query); + $sth->execute($id); + + return ($sth->fetchrow_hashref); +} + # Returns fields to extract for the given csv profile sub GetMarcFieldsForCsv { diff --git a/C4/Record.pm b/C4/Record.pm index 127d5214bd..80f5c47bcb 100644 --- a/C4/Record.pm +++ b/C4/Record.pm @@ -341,6 +341,8 @@ C<$record> - a MARC::Record object C<$csvprofileid> - the id of the CSV profile to use for the export (see export_format.export_format_id and the GetCsvProfiles function in C4::Csv) +C<$header> - true if the headers are to be printed (typically at first pass) + =back =back @@ -351,36 +353,72 @@ C<$csvprofileid> - the id of the CSV profile to use for the export (see export_f sub marc2csv { my ($record, $id, $header) = @_; my $output; - my $csv = Text::CSV->new(); # Get the information about the csv profile - my $marcfieldslist = GetMarcFieldsForCsv($id); + my $profile = GetCsvProfile($id); + + # Getting separators + my $csvseparator = $profile->{csv_separator} || ','; + my $fieldseparator = $profile->{field_separator} || '#'; + my $subfieldseparator = $profile->{subfield_separator} || '|'; + + # TODO: Be more generic (in case we have to handle other protected chars or more separators) + if ($csvseparator eq '\t') { $csvseparator = "\t" } + if ($fieldseparator eq '\t') { $fieldseparator = "\t" } + if ($subfieldseparator eq '\t') { $subfieldseparator = "\t" } + + # Init CSV + my $csv = Text::CSV->new({ sep_char => $csvseparator }); + + # Getting the marcfields + my $marcfieldslist = $profile->{marcfields}; # Getting the marcfields as an array - my @marcfields = split('\|', $marcfieldslist); + my @marcfieldsarray = split('\|', $marcfieldslist); + + # Separating the marcfields from the the user-supplied headers + my @marcfields; + foreach (@marcfieldsarray) { + my @result = split('=', $_); + if (scalar(@result) == 2) { + push @marcfields, { header => $result[0], field => $result[1] }; + } else { + push @marcfields, { field => $result[0] } + } + } # If we have to insert the headers if ($header) { my @marcfieldsheaders; - my $dbh = C4::Context->dbh; # For each field or subfield foreach (@marcfields) { - # We get the matching tag name - if (index($_, '$') > 0) { - my ($fieldtag, $subfieldtag) = split('\$', $_); - my $query = "SELECT liblibrarian FROM marc_subfield_structure WHERE tagfield=? AND tagsubfield=?"; - my $sth = $dbh->prepare($query); - $sth->execute($fieldtag, $subfieldtag); - my @results = $sth->fetchrow_array(); - push @marcfieldsheaders, $results[0]; + + my $field = $_->{field}; + + # If we have a user-supplied header, we use it + if (exists $_->{header}) { + push @marcfieldsheaders, $_->{header}; } else { - my $query = "SELECT liblibrarian FROM marc_tag_structure WHERE tagfield=?"; - my $sth = $dbh->prepare($query); - $sth->execute($_); - my @results = $sth->fetchrow_array(); - push @marcfieldsheaders, $results[0]; +warn "else"; + # If not, we get the matching tag name from koha + if (index($field, '$') > 0) { + my ($fieldtag, $subfieldtag) = split('\$', $field); + my $query = "SELECT liblibrarian FROM marc_subfield_structure WHERE tagfield=? AND tagsubfield=?"; + my $sth = $dbh->prepare($query); + $sth->execute($fieldtag, $subfieldtag); + my @results = $sth->fetchrow_array(); +warn "subfield $fieldtag, $subfieldtag"; + push @marcfieldsheaders, $results[0]; + } else { + my $query = "SELECT liblibrarian FROM marc_tag_structure WHERE tagfield=?"; + my $sth = $dbh->prepare($query); + $sth->execute($field); + my @results = $sth->fetchrow_array(); +warn "field $results[0]"; + push @marcfieldsheaders, $results[0]; + } } } $csv->combine(@marcfieldsheaders); @@ -389,7 +427,8 @@ sub marc2csv { # For each marcfield to export my @fieldstab; - foreach my $marcfield (@marcfields) { + foreach (@marcfields) { + my $marcfield = $_->{field}; # If it is a subfield if (index($marcfield, '$') > 0) { my ($fieldtag, $subfieldtag) = split('\$', $marcfield); @@ -405,11 +444,11 @@ sub marc2csv { push @tmpfields, $subfield; } } - push (@fieldstab, join(',', @tmpfields)); + push (@fieldstab, join($subfieldseparator, @tmpfields)); # Or a field } else { my @fields = ($record->field($marcfield)); - push (@fieldstab, join(',', map($_->as_string(), @fields))); + push (@fieldstab, join($fieldseparator, map($_->as_string(), @fields))); } }; diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index e2edf01f1e..915570318d 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -3358,6 +3358,18 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { SetVersion ($DBversion); } +$DBversion = '3.01.00.108'; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + $dbh->do(qq{ + ALTER TABLE `export_format` ADD `csv_separator` VARCHAR( 2 ) NOT NULL AFTER `marcfields` , + ADD `field_separator` VARCHAR( 2 ) NOT NULL AFTER `csv_separator` , + ADD `subfield_separator` VARCHAR( 2 ) NOT NULL AFTER `field_separator` + }); + print "Upgrade done (added separators for csv export)\n"; + SetVersion ($DBversion); +} + + =item DropAllForeignKeys($table) Drop all foreign keys of the table $table diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/csv-profiles.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/csv-profiles.tmpl index e84f783bd8..dfd3b6367d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/csv-profiles.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/csv-profiles.tmpl @@ -59,11 +59,48 @@ function reloadPage(p) {
  • -
  • + + +

    + + + +

    + + + +

    + + -

    Define which fields or subfields you want to export, separated by pipes.
    - For example: 200|210$a|301 -

  • +

    You have to define which fields or subfields you want to export, separated by pipes.
    + You can also use your own headers (instead of the ones from koha) by prefixing the field number with an header, followed by the equal sign.
    + Example : Personal name=200|Entry element=210$a|300 +

    @@ -86,6 +123,44 @@ function reloadPage(p) {
  • + + +

    + + + + +

    + + + +

    + +
  • diff --git a/kohaversion.pl b/kohaversion.pl index 1183d82893..79ca979648 100644 --- a/kohaversion.pl +++ b/kohaversion.pl @@ -10,7 +10,7 @@ use strict; sub kohaversion { - our $VERSION = '3.01.00.107'; + our $VERSION = '3.01.00.108'; # version needs to be set this way # so that it can be picked up by Makefile.PL # during install diff --git a/test.pl b/test.pl new file mode 100644 index 0000000000..e4bab7b420 --- /dev/null +++ b/test.pl @@ -0,0 +1,30 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +my $string = $ARGV[0]; + +# Getting the marcfields as an array + my @marcfieldsarray = split('\|', $string); + + # Separating the marcfields from the the user-supplied headers + my @marcfields; + foreach (@marcfieldsarray) { + my @result = split('=', $_); + if (scalar(@result) == 2) { + push @marcfields, { header => $result[0], field => $result[1] }; + } else { + push @marcfields, { field => $result[0] } + } + } + +use Data::Dumper; +print Dumper(@marcfields); + + +foreach (@marcfields) { + print $_->{field}; +} + + diff --git a/tools/csv-profiles.pl b/tools/csv-profiles.pl index 1d54da9e7a..8ba84aee8d 100755 --- a/tools/csv-profiles.pl +++ b/tools/csv-profiles.pl @@ -63,6 +63,9 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( my $profile_name = $input->param("profile_name"); my $profile_description = $input->param("profile_description"); my $profile_content = $input->param("profile_content"); +my $csv_separator = $input->param("csv_separator"); +my $field_separator = $input->param("field_separator"); +my $subfield_separator = $input->param("subfield_separator"); my $action = $input->param("action"); my $delete = $input->param("delete"); my $id = $input->param("id"); @@ -72,17 +75,17 @@ if ($profile_name && $profile_content && $action) { my $rows; if ($action eq "create") { - my $query = "INSERT INTO export_format(export_format_id, profile, description, marcfields) VALUES (NULL, ?, ?, ?)"; + my $query = "INSERT INTO export_format(export_format_id, profile, description, marcfields, csv_separator, field_separator, subfield_separator) VALUES (NULL, ?, ?, ?, ?, ?, ?)"; my $sth = $dbh->prepare($query); - $rows = $sth->execute($profile_name, $profile_description, $profile_content); + $rows = $sth->execute($profile_name, $profile_description, $profile_content, $csv_separator, $field_separator, $subfield_separator); } if ($action eq "edit") { - my $query = "UPDATE export_format SET description=?, marcfields=? WHERE export_format_id=? LIMIT 1"; + my $query = "UPDATE export_format SET description=?, marcfields=?, csv_separator=?, field_separator=?, subfield_separator=? WHERE export_format_id=? LIMIT 1"; my $sth = $dbh->prepare($query); - $rows = $sth->execute($profile_description, $profile_content, $profile_name); - + $rows = $sth->execute($profile_description, $profile_content, $csv_separator, $field_separator, $subfield_separator, $profile_name); +warn "id $id"; } if ($action eq "delete") { @@ -100,17 +103,21 @@ if ($profile_name && $profile_content && $action) { # If a profile has been selected for modification if ($id) { - my $query = "SELECT export_format_id, profile, description, marcfields FROM export_format WHERE export_format_id = ?"; + my $query = "SELECT export_format_id, profile, description, marcfields, csv_separator, field_separator, subfield_separator FROM export_format WHERE export_format_id = ?"; my $sth; $sth = $dbh->prepare($query); $sth->execute($id); my $selected_profile = $sth->fetchrow_arrayref(); + warn "value : " . $selected_profile->[4]; $template->param( selected_profile_id => $selected_profile->[0], selected_profile_name => $selected_profile->[1], selected_profile_description => $selected_profile->[2], - selected_profile_marcfields => $selected_profile->[3] + selected_profile_marcfields => $selected_profile->[3], + selected_csv_separator => $selected_profile->[4], + selected_field_separator => $selected_profile->[5], + selected_subfield_separator => $selected_profile->[6] ); } From d9b155ff0c52aeb61c24db12bda753b2fbc3f8bc Mon Sep 17 00:00:00 2001 From: Matthias Meusburger Date: Fri, 15 Jan 2010 17:42:43 +0100 Subject: [PATCH 60/80] MT2116: Addons to the CSV export Add user-defined headers Add CSV, field and subfield separator selection --- .../prog/en/modules/tools/csv-profiles.tmpl | 74 +++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/csv-profiles.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/csv-profiles.tmpl index dfd3b6367d..c1b0ff924b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/csv-profiles.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/csv-profiles.tmpl @@ -95,6 +95,42 @@ function reloadPage(p) {

    + + +

    + + + +

    + + + +

    +

    You have to define which fields or subfields you want to export, separated by pipes.
    @@ -161,6 +197,44 @@ function reloadPage(p) {

    + + +

    + + + + +

    + + + +

    + + From 664a538cb6b2fc086bff1a2339d5116969e5b2c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Wed, 20 Jan 2010 14:16:38 +0100 Subject: [PATCH 61/80] [MT2049] Stocknumber value builder --- cataloguing/value_builder/stocknumberam123.pl | 118 ++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100755 cataloguing/value_builder/stocknumberam123.pl diff --git a/cataloguing/value_builder/stocknumberam123.pl b/cataloguing/value_builder/stocknumberam123.pl new file mode 100755 index 0000000000..5786c3d991 --- /dev/null +++ b/cataloguing/value_builder/stocknumberam123.pl @@ -0,0 +1,118 @@ +#!/usr/bin/perl + +# Copyright 2010 BibLibre SARL +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, +# Suite 330, Boston, MA 02111-1307 USA + +use strict; +use warnings; +use C4::Auth; +use CGI; +use C4::Context; + +=head1 + +This plugin is specific to AM123 but could be used as a base for similar operations. +It is used for stocknumber computation. + +If the user send an empty string, we return a simple incremented stocknumber. +If a prefix is submited, we look for the highest stocknumber with this prefix, and return it incremented. +In this case, a stocknumber has this form : "PREFIX 0009678570". + - PREFIX is an upercase word + - a space separator + - 10 digits, with leading 0s if needed + +=cut + +sub plugin_parameters { +} + +sub plugin_javascript { + my ($dbh,$record,$tagslib,$field_number,$tabloop) = @_; + my $res=" + + "; + + return ($field_number,$res); +} + +sub plugin { + my ($input) = @_; + my $code = $input->param('code'); + + my ($template, $loggedinuser, $cookie) = get_template_and_user({ + template_name => "cataloguing/value_builder/ajax.tmpl", + query => $input, + type => "intranet", + authnotrequired => 0, + flagsrequired => {editcatalogue => '*'}, + debug => 1, + }); + + my $dbh = C4::Context->dbh; + # If the textbox is empty, we return a simple incremented stocknumber + if ( $code eq "" ) { + my $sth = $dbh->prepare("SELECT MAX(CAST(stocknumber AS SIGNED)) FROM items"); + $sth->execute; + + if ( my $max = $sth->fetchrow ) { + $template->param( + return => $max+1, + ); + } + # If a prefix is submited, we look for the highest stocknumber with this prefix, and return it incremented + } elsif ( $code =~ m/^[A-Z]+$/ ) { + my $sth = $dbh->prepare("SELECT MAX(CAST(SUBSTRING_INDEX(stocknumber,' ',-1) AS SIGNED)) FROM items WHERE stocknumber LIKE ?"); + $sth->execute($code.' %'); + + if ( my $max = $sth->fetchrow ) { + $template->param( + return => $code.' '.sprintf('%010s',($max+1)), + ); + } + # The user entered a custom value, we don't touch it, this could be handled in js + } else { + $template->param( + return => $code, + ); + } + warn $code; + output_html_with_http_headers $input, $cookie, $template->output; +} + +1; From b40d4052b9ebb6139d43c6155e13c4e6497cac5d Mon Sep 17 00:00:00 2001 From: Matthias Meusburger Date: Tue, 26 Jan 2010 14:52:36 +0100 Subject: [PATCH 62/80] MT2116 : Addons to the CSV Export Add encoding selection Add authorised values handling --- C4/Koha.pm | 54 +++++++++++++++++++ C4/Record.pm | 34 ++++++++---- Makefile.PL | 1 + about.pl | 1 + basket/downloadcart.pl | 2 +- installer/data/mysql/kohastructure.sql | 4 ++ installer/data/mysql/updatedatabase.pl | 8 +++ .../prog/en/modules/tools/csv-profiles.tmpl | 20 ++++++- opac/opac-downloadcart.pl | 2 +- opac/opac-downloadshelf.pl | 2 +- tools/csv-profiles.pl | 21 +++++--- virtualshelves/downloadshelf.pl | 2 +- 12 files changed, 127 insertions(+), 24 deletions(-) diff --git a/C4/Koha.pm b/C4/Koha.pm index 31bd6784db..18af528a70 100644 --- a/C4/Koha.pm +++ b/C4/Koha.pm @@ -53,6 +53,7 @@ BEGIN { &GetAuthorisedValues &GetAuthorisedValueCategories &GetKohaAuthorisedValues + &GetKohaAuthorisedValuesFromField &GetAuthValCode &GetNormalizedUPC &GetNormalizedISBN @@ -1064,6 +1065,30 @@ sub GetAuthValCode { return $authvalcode; } +=head2 GetAuthValCodeFromField + +$authvalcode = GetAuthValCodeFromField($field,$subfield,$frameworkcode); + +C<$subfield> can be undefined + +=cut + +sub GetAuthValCodeFromField { + my ($field,$subfield,$fwcode) = @_; + my $dbh = C4::Context->dbh; + $fwcode='' unless $fwcode; + my $sth; + if (defined $subfield) { + $sth = $dbh->prepare('select authorised_value from marc_subfield_structure where tagfield=? and tagsubfield=? and frameworkcode=?'); + $sth->execute($field,$subfield,$fwcode); + } else { + $sth = $dbh->prepare('select authorised_value from marc_tag_structure where tagfield=? and frameworkcode=?'); + $sth->execute($field,$fwcode); + } + my ($authvalcode) = $sth->fetchrow_array; + return $authvalcode; +} + =head2 GetAuthorisedValues $authvalues = GetAuthorisedValues([$category], [$selected]); @@ -1146,6 +1171,35 @@ sub GetKohaAuthorisedValues { } } +=head2 GetKohaAuthorisedValuesFromField + + Takes $field, $subfield $fwcode as parameters. + If $opac parameter is set to a true value, displays OPAC descriptions rather than normal ones when they exist. + $subfield can be undefined + Returns hashref of Code => description + Returns undef + if no authorised value category is defined for the given field and subfield + +=cut + +sub GetKohaAuthorisedValuesFromField { + my ($field, $subfield, $fwcode,$opac) = @_; + $fwcode='' unless $fwcode; + my %values; + my $dbh = C4::Context->dbh; + my $avcode = GetAuthValCodeFromField($field, $subfield, $fwcode); + if ($avcode) { + my $sth = $dbh->prepare("select authorised_value, lib, lib_opac from authorised_values where category=? "); + $sth->execute($avcode); + while ( my ($val, $lib, $lib_opac) = $sth->fetchrow_array ) { + $values{$val} = ($opac && $lib_opac) ? $lib_opac : $lib; + } + return \%values; + } else { + return undef; + } +} + =head2 display_marc_indicators =over 4 diff --git a/C4/Record.pm b/C4/Record.pm index 80f5c47bcb..7c3fcc5ebb 100644 --- a/C4/Record.pm +++ b/C4/Record.pm @@ -31,7 +31,8 @@ use XML::LibXSLT; use XML::LibXML; use C4::Biblio; #marc2bibtex use C4::Csv; #marc2csv -use Text::CSV; #marc2csv +use C4::Koha; #marc2csv +use Text::CSV::Encoded; #marc2csv use vars qw($VERSION @ISA @EXPORT); @@ -331,13 +332,13 @@ sub marc2endnote { =over 4 -my ($csv) = marc2csv($record, $csvprofileid); +my ($csv) = marc2csv($record, $csvprofileid, $header); Returns a CSV scalar =over 2 -C<$record> - a MARC::Record object +C<$biblio> - a biblionumber C<$csvprofileid> - the id of the CSV profile to use for the export (see export_format.export_format_id and the GetCsvProfiles function in C4::Csv) @@ -351,12 +352,21 @@ C<$header> - true if the headers are to be printed (typically at first pass) sub marc2csv { - my ($record, $id, $header) = @_; + my ($biblio, $id, $header) = @_; my $output; - # Get the information about the csv profile + # Getting the record + my $record = GetMarcBiblio($biblio); + + # Getting the framework + my $frameworkcode = GetFrameworkCode($biblio); + + # Getting information about the csv profile my $profile = GetCsvProfile($id); + # Getting output encoding + my $encoding = $profile->{encoding} || 'utf8'; + # Getting separators my $csvseparator = $profile->{csv_separator} || ','; my $fieldseparator = $profile->{field_separator} || '#'; @@ -368,7 +378,8 @@ sub marc2csv { if ($subfieldseparator eq '\t') { $subfieldseparator = "\t" } # Init CSV - my $csv = Text::CSV->new({ sep_char => $csvseparator }); + my $csv = Text::CSV::Encoded->new({ sep_char => $csvseparator }); + $csv = $csv->encoding_out($encoding) if ($encoding ne 'utf8'); # Getting the marcfields my $marcfieldslist = $profile->{marcfields}; @@ -401,7 +412,6 @@ sub marc2csv { if (exists $_->{header}) { push @marcfieldsheaders, $_->{header}; } else { -warn "else"; # If not, we get the matching tag name from koha if (index($field, '$') > 0) { my ($fieldtag, $subfieldtag) = split('\$', $field); @@ -409,14 +419,12 @@ warn "else"; my $sth = $dbh->prepare($query); $sth->execute($fieldtag, $subfieldtag); my @results = $sth->fetchrow_array(); -warn "subfield $fieldtag, $subfieldtag"; push @marcfieldsheaders, $results[0]; } else { my $query = "SELECT liblibrarian FROM marc_tag_structure WHERE tagfield=?"; my $sth = $dbh->prepare($query); $sth->execute($field); my @results = $sth->fetchrow_array(); -warn "field $results[0]"; push @marcfieldsheaders, $results[0]; } } @@ -441,14 +449,18 @@ warn "field $results[0]"; # We take every matching subfield my @subfields = $field->subfield($subfieldtag); foreach my $subfield (@subfields) { - push @tmpfields, $subfield; + + # Getting authorised value + my $authvalues = GetKohaAuthorisedValuesFromField($fieldtag, $subfieldtag, $frameworkcode, undef); + push @tmpfields, (defined $authvalues->{$subfield}) ? $authvalues->{$subfield} : $subfield; } } push (@fieldstab, join($subfieldseparator, @tmpfields)); # Or a field } else { my @fields = ($record->field($marcfield)); - push (@fieldstab, join($fieldseparator, map($_->as_string(), @fields))); + my $authvalues = GetKohaAuthorisedValuesFromField($marcfield, undef, $frameworkcode, undef); + push (@fieldstab, join($fieldseparator, map((defined $authvalues->{$_->as_string}) ? $authvalues->{$_->as_string} : $_->as_string, @fields))); } }; diff --git a/Makefile.PL b/Makefile.PL index a7cd3cf98c..584bbdbc64 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -606,6 +606,7 @@ WriteMakefile( 'Test::More' => 0.80, 'Text::CSV' => 0.01, 'Text::CSV_XS' => 0.32, + 'Text::CSV::Encoded' => 0.09, 'Text::Iconv' => 1.7, 'Text::Wrap' => 2005.082401, 'Time::HiRes' => 1.86, diff --git a/about.pl b/about.pl index 17316bf6f6..23012b59bc 100755 --- a/about.pl +++ b/about.pl @@ -130,6 +130,7 @@ Test::Harness Test::More Text::CSV Text::CSV_XS +Text::CSV::Encoded Text::Iconv Text::Wrap Time::HiRes diff --git a/basket/downloadcart.pl b/basket/downloadcart.pl index 9733c116da..4be46dda28 100755 --- a/basket/downloadcart.pl +++ b/basket/downloadcart.pl @@ -68,7 +68,7 @@ if ($bib_list && $format) { case "ris" { $output .= marc2ris($record); } case "bibtex" { $output .= marc2bibtex($record, $biblio); } # We're in the case of a csv profile (firstpass is used for headers printing) : - case /^\d+$/ { $output .= marc2csv($record, $format, $firstpass); } + case /^\d+$/ { $output .= marc2csv($biblio, $format, $firstpass); } } $firstpass = 0; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 1697f85ff3..3045f13e49 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -755,6 +755,10 @@ CREATE TABLE `export_format` ( `profile` varchar(255) NOT NULL, `description` mediumtext NOT NULL, `marcfields` mediumtext NOT NULL, + `csv_separator` varchar(2) NOT NULL, + `field_separator` varchar(2) NOT NULL, + `subfield_separator` varchar(2) NOT NULL, + `encoding` varchar(255) NOT NULL, PRIMARY KEY (`export_format_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Used for CSV export'; diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 915570318d..f418f4c275 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -3369,6 +3369,14 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { SetVersion ($DBversion); } +$DBversion = "3.01.00.102"; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + $dbh->do(qq{ + ALTER TABLE `export_format` ADD `encoding` VARCHAR(255) NOT NULL AFTER `subfield_separator` + }); + print "Upgrade done (added encoding for csv export)\n"; + SetVersion ($DBversion); +} =item DropAllForeignKeys($table) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/csv-profiles.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/csv-profiles.tmpl index c1b0ff924b..1b21c052e8 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/csv-profiles.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/csv-profiles.tmpl @@ -130,12 +130,21 @@ function reloadPage(p) {

    + + + +

    +

    You have to define which fields or subfields you want to export, separated by pipes.
    You can also use your own headers (instead of the ones from koha) by prefixing the field number with an header, followed by the equal sign.
    - Example : Personal name=200|Entry element=210$a|300 + Example : Personal name=200|Entry element=210$a|300|009

    @@ -234,6 +243,15 @@ function reloadPage(p) {

    + + +

    + + diff --git a/opac/opac-downloadcart.pl b/opac/opac-downloadcart.pl index fe80f3008c..241f879b4b 100755 --- a/opac/opac-downloadcart.pl +++ b/opac/opac-downloadcart.pl @@ -68,7 +68,7 @@ if ($bib_list && $format) { case "ris" { $output .= marc2ris($record); } case "bibtex" { $output .= marc2bibtex($record, $biblio); } # We're in the case of a csv profile (firstpass is used for headers printing) : - case /^\d+$/ { $output .= marc2csv($record, $format, $firstpass); } + case /^\d+$/ { $output .= marc2csv($biblio, $format, $firstpass); } } $firstpass = 0; diff --git a/opac/opac-downloadshelf.pl b/opac/opac-downloadshelf.pl index 976412b1de..a03a79bda5 100755 --- a/opac/opac-downloadshelf.pl +++ b/opac/opac-downloadshelf.pl @@ -69,7 +69,7 @@ if ($shelfid && $format) { case "ris" { $output .= marc2ris($record); } case "bibtex" { $output .= marc2bibtex($record, $biblionumber); } # We're in the case of a csv profile (firstpass is used for headers printing) : - case /^\d+$/ { $output .= marc2csv($record, $format, $firstpass); } + case /^\d+$/ { $output .= marc2csv($biblionumber, $format, $firstpass); } } $firstpass = 0; } diff --git a/tools/csv-profiles.pl b/tools/csv-profiles.pl index 8ba84aee8d..15b90de586 100755 --- a/tools/csv-profiles.pl +++ b/tools/csv-profiles.pl @@ -36,6 +36,7 @@ This script allow the user to define a new profile for CSV export use strict; use Data::Dumper; +use Encode; use C4::Auth; use C4::Context; @@ -59,6 +60,10 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( } ); +# Getting available encodings list +my @encodings = Encode->encodings(); +my @encodings_loop = map{{encoding => $_}} @encodings; +$template->param(encodings => \@encodings_loop); my $profile_name = $input->param("profile_name"); my $profile_description = $input->param("profile_description"); @@ -66,6 +71,7 @@ my $profile_content = $input->param("profile_content"); my $csv_separator = $input->param("csv_separator"); my $field_separator = $input->param("field_separator"); my $subfield_separator = $input->param("subfield_separator"); +my $encoding = $input->param("encoding"); my $action = $input->param("action"); my $delete = $input->param("delete"); my $id = $input->param("id"); @@ -75,17 +81,16 @@ if ($profile_name && $profile_content && $action) { my $rows; if ($action eq "create") { - my $query = "INSERT INTO export_format(export_format_id, profile, description, marcfields, csv_separator, field_separator, subfield_separator) VALUES (NULL, ?, ?, ?, ?, ?, ?)"; + my $query = "INSERT INTO export_format(export_format_id, profile, description, marcfields, csv_separator, field_separator, subfield_separator, encoding) VALUES (NULL, ?, ?, ?, ?, ?, ?, ?)"; my $sth = $dbh->prepare($query); - $rows = $sth->execute($profile_name, $profile_description, $profile_content, $csv_separator, $field_separator, $subfield_separator); + $rows = $sth->execute($profile_name, $profile_description, $profile_content, $csv_separator, $field_separator, $subfield_separator, $encoding); } if ($action eq "edit") { - my $query = "UPDATE export_format SET description=?, marcfields=?, csv_separator=?, field_separator=?, subfield_separator=? WHERE export_format_id=? LIMIT 1"; + my $query = "UPDATE export_format SET description=?, marcfields=?, csv_separator=?, field_separator=?, subfield_separator=?, encoding=? WHERE export_format_id=? LIMIT 1"; my $sth = $dbh->prepare($query); - $rows = $sth->execute($profile_description, $profile_content, $csv_separator, $field_separator, $subfield_separator, $profile_name); -warn "id $id"; + $rows = $sth->execute($profile_description, $profile_content, $csv_separator, $field_separator, $subfield_separator, $encoding, $profile_name); } if ($action eq "delete") { @@ -103,13 +108,12 @@ warn "id $id"; # If a profile has been selected for modification if ($id) { - my $query = "SELECT export_format_id, profile, description, marcfields, csv_separator, field_separator, subfield_separator FROM export_format WHERE export_format_id = ?"; + my $query = "SELECT export_format_id, profile, description, marcfields, csv_separator, field_separator, subfield_separator, encoding FROM export_format WHERE export_format_id = ?"; my $sth; $sth = $dbh->prepare($query); $sth->execute($id); my $selected_profile = $sth->fetchrow_arrayref(); - warn "value : " . $selected_profile->[4]; $template->param( selected_profile_id => $selected_profile->[0], selected_profile_name => $selected_profile->[1], @@ -117,7 +121,8 @@ warn "id $id"; selected_profile_marcfields => $selected_profile->[3], selected_csv_separator => $selected_profile->[4], selected_field_separator => $selected_profile->[5], - selected_subfield_separator => $selected_profile->[6] + selected_subfield_separator => $selected_profile->[6], + selected_encoding => $selected_profile->[7] ); } diff --git a/virtualshelves/downloadshelf.pl b/virtualshelves/downloadshelf.pl index 03f3a5ce8d..f75d2d46f5 100755 --- a/virtualshelves/downloadshelf.pl +++ b/virtualshelves/downloadshelf.pl @@ -69,7 +69,7 @@ if ($shelfid && $format) { case "ris" { $output .= marc2ris($record); } case "bibtex" { $output .= marc2bibtex($record, $biblionumber); } # We're in the case of a csv profile (firstpass is used for headers printing) : - case /^\d+$/ { $output .= marc2csv($record, $format, $firstpass); } + case /^\d+$/ { $output .= marc2csv($biblionumber, $format, $firstpass); } } $firstpass = 0; } From dc9991d9b48665af60038e4a65ee0b0293ab2bf7 Mon Sep 17 00:00:00 2001 From: Nahuel ANGELINETTI Date: Fri, 15 Jan 2010 12:40:48 +0100 Subject: [PATCH 63/80] (MT823) add the possibility to have enrolment end date this patch add the possibility to have an end date of enrolment, instead of a period. Like for a user category, all this category can have the same expiry date. The librarian can configure one of both, but not both. --- C4/Members.pm | 14 ++++-- admin/categorie.pl | 46 ++++++++++++------- installer/data/mysql/updatedatabase.pl | 7 +++ .../prog/en/modules/admin/categorie.tmpl | 40 ++++++++++++++-- 4 files changed, 82 insertions(+), 25 deletions(-) diff --git a/C4/Members.pm b/C4/Members.pm index c7220d5214..f9c2050d55 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -1269,16 +1269,20 @@ Return date is also in ISO format. sub GetExpiryDate { my ( $categorycode, $dateenrolled ) = @_; - my $enrolmentperiod = 12; # reasonable default + my $enrolments; if ($categorycode) { my $dbh = C4::Context->dbh; - my $sth = $dbh->prepare("select enrolmentperiod from categories where categorycode=?"); + my $sth = $dbh->prepare("SELECT enrolmentperiod,enrolmentperioddate FROM categories WHERE categorycode=?"); $sth->execute($categorycode); - $enrolmentperiod = $sth->fetchrow; + $enrolments = $sth->fetchrow_hashref; } # die "GetExpiryDate: for enrollmentperiod $enrolmentperiod (category '$categorycode') starting $dateenrolled.\n"; - my @date = split /-/,$dateenrolled; - return sprintf("%04d-%02d-%02d", Add_Delta_YM(@date,0,$enrolmentperiod)); + my @date = split (/-/,$dateenrolled); + if($enrolments->{enrolmentperiod}){ + return sprintf("%04d-%02d-%02d", Add_Delta_YM(@date,0,$enrolments->{enrolmentperiod})); + }else{ + return $enrolments->{enrolmentperioddate}; + } } =head2 checkuserpassword (OUEST-PROVENCE) diff --git a/admin/categorie.pl b/admin/categorie.pl index 57e30d9be3..cb3cd7b446 100755 --- a/admin/categorie.pl +++ b/admin/categorie.pl @@ -41,6 +41,7 @@ use CGI; use C4::Context; use C4::Auth; use C4::Output; +use C4::Dates; use C4::Form::MessagingPreferences; sub StringSearch { @@ -90,14 +91,17 @@ if ($op eq 'add_form') { my $data; if ($categorycode) { my $dbh = C4::Context->dbh; - my $sth=$dbh->prepare("select categorycode,description,enrolmentperiod,upperagelimit,dateofbirthrequired,enrolmentfee,issuelimit,reservefee,overduenoticerequired,category_type from categories where categorycode=?"); + my $sth=$dbh->prepare("select categorycode,description,enrolmentperiod,enrolmentperioddate,upperagelimit,dateofbirthrequired,enrolmentfee,issuelimit,reservefee,overduenoticerequired,category_type from categories where categorycode=?"); $sth->execute($categorycode); $data=$sth->fetchrow_hashref; $sth->finish; } + $data->{'enrolmentperioddate'} = undef if ($data->{'enrolmentperioddate'} eq '0000-00-00'); + $template->param(description => $data->{'description'}, enrolmentperiod => $data->{'enrolmentperiod'}, + enrolmentperioddate => C4::Dates::format_date($data->{'enrolmentperioddate'}), upperagelimit => $data->{'upperagelimit'}, dateofbirthrequired => $data->{'dateofbirthrequired'}, enrolmentfee => sprintf("%.2f",$data->{'enrolmentfee'}), @@ -105,6 +109,7 @@ if ($op eq 'add_form') { issuelimit => $data->{'issuelimit'}, reservefee => sprintf("%.2f",$data->{'reservefee'}), category_type => $data->{'category_type'}, + DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(), "type_".$data->{'category_type'} => 1, ); if (C4::Context->preference('EnhancedMessagingPreferences')) { @@ -117,13 +122,17 @@ if ($op eq 'add_form') { $template->param(add_validate => 1); my $is_a_modif = $input->param("is_a_modif"); my $dbh = C4::Context->dbh; + if($input->param('enrolmentperioddate')){ + $input->param('enrolmentperioddate' => C4::Dates::format_date_in_iso($input->param('enrolmentperioddate')) ); + } + if ($is_a_modif) { - my $sth=$dbh->prepare("UPDATE categories SET description=?,enrolmentperiod=?,upperagelimit=?,dateofbirthrequired=?,enrolmentfee=?,reservefee=?,overduenoticerequired=?,category_type=? WHERE categorycode=?"); - $sth->execute(map { $input->param($_) } ('description','enrolmentperiod','upperagelimit','dateofbirthrequired','enrolmentfee','reservefee','overduenoticerequired','category_type','categorycode')); + my $sth=$dbh->prepare("UPDATE categories SET description=?,enrolmentperiod=?, enrolmentperioddate=?,upperagelimit=?,dateofbirthrequired=?,enrolmentfee=?,reservefee=?,overduenoticerequired=?,category_type=? WHERE categorycode=?"); + $sth->execute(map { $input->param($_) } ('description','enrolmentperiod','enrolmentperioddate','upperagelimit','dateofbirthrequired','enrolmentfee','reservefee','overduenoticerequired','category_type','categorycode')); $sth->finish; } else { - my $sth=$dbh->prepare("INSERT INTO categories (categorycode,description,enrolmentperiod,upperagelimit,dateofbirthrequired,enrolmentfee,reservefee,overduenoticerequired,category_type) values (?,?,?,?,?,?,?,?,?)"); - $sth->execute(map { $input->param($_) } ('categorycode','description','enrolmentperiod','upperagelimit','dateofbirthrequired','enrolmentfee','reservefee','overduenoticerequired','category_type')); + my $sth=$dbh->prepare("INSERT INTO categories (categorycode,description,enrolmentperiod,enrolmentperioddate,upperagelimit,dateofbirthrequired,enrolmentfee,reservefee,overduenoticerequired,category_type) values (?,?,?,?,?,?,?,?,?,?)"); + $sth->execute(map { $input->param($_) } ('categorycode','description','enrolmentperiod','enrolmentperioddate','upperagelimit','dateofbirthrequired','enrolmentfee','reservefee','overduenoticerequired','category_type')); $sth->finish; } if (C4::Context->preference('EnhancedMessagingPreferences')) { @@ -146,7 +155,7 @@ if ($op eq 'add_form') { $sth->finish; $template->param(total => $total->{'total'}); - my $sth2=$dbh->prepare("select categorycode,description,enrolmentperiod,upperagelimit,dateofbirthrequired,enrolmentfee,issuelimit,reservefee,overduenoticerequired,category_type from categories where categorycode=?"); + my $sth2=$dbh->prepare("select categorycode,description,enrolmentperiod,enrolmentperioddate,upperagelimit,dateofbirthrequired,enrolmentfee,issuelimit,reservefee,overduenoticerequired,category_type from categories where categorycode=?"); $sth2->execute($categorycode); my $data=$sth2->fetchrow_hashref; $sth2->finish; @@ -154,8 +163,9 @@ if ($op eq 'add_form') { $template->param(totalgtzero => 1); } - $template->param(description => $data->{'description'}, + $template->param( description => $data->{'description'}, enrolmentperiod => $data->{'enrolmentperiod'}, + enrolmentperioddate => C4::Dates::format_date($data->{'enrolmentperioddate'}), upperagelimit => $data->{'upperagelimit'}, dateofbirthrequired => $data->{'dateofbirthrequired'}, enrolmentfee => sprintf("%.2f",$data->{'enrolmentfee'}), @@ -183,16 +193,18 @@ if ($op eq 'add_form') { my @loop; my ($count,$results)=StringSearch($searchfield,'web'); for (my $i=0; $i < $count; $i++){ - my %row = (categorycode => $results->[$i]{'categorycode'}, - description => $results->[$i]{'description'}, - enrolmentperiod => $results->[$i]{'enrolmentperiod'}, - upperagelimit => $results->[$i]{'upperagelimit'}, - dateofbirthrequired => $results->[$i]{'dateofbirthrequired'}, - enrolmentfee => sprintf("%.2f",$results->[$i]{'enrolmentfee'}), - overduenoticerequired => $results->[$i]{'overduenoticerequired'}, - issuelimit => $results->[$i]{'issuelimit'}, - reservefee => sprintf("%.2f",$results->[$i]{'reservefee'}), - category_type => $results->[$i]{'category_type'}, + my %row = ( + categorycode => $results->[$i]{'categorycode'}, + description => $results->[$i]{'description'}, + enrolmentperiod => $results->[$i]{'enrolmentperiod'}, + enrolmentperioddate => C4::Dates::format_date($results->[$i]{'enrolmentperioddate'}), + upperagelimit => $results->[$i]{'upperagelimit'}, + dateofbirthrequired => $results->[$i]{'dateofbirthrequired'}, + enrolmentfee => sprintf("%.2f",$results->[$i]{'enrolmentfee'}), + overduenoticerequired => $results->[$i]{'overduenoticerequired'}, + issuelimit => $results->[$i]{'issuelimit'}, + reservefee => sprintf("%.2f",$results->[$i]{'reservefee'}), + category_type => $results->[$i]{'category_type'}, "type_".$results->[$i]{'category_type'} => 1); if (C4::Context->preference('EnhancedMessagingPreferences')) { my $brief_prefs = _get_brief_messaging_prefs($results->[$i]{'categorycode'}); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index f418f4c275..d2890d4bba 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -3378,6 +3378,13 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { SetVersion ($DBversion); } +$DBversion = '3.02.00.015'; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + $dbh->do('ALTER TABLE `categories` ADD COLUMN `enrolmentperioddate` DATE NULL DEFAULT NULL AFTER `enrolmentperiod`'); + print "Upgrade done (Add enrolment period date support)\n"; + SetVersion ($DBversion); +} + =item DropAllForeignKeys($table) Drop all foreign keys of the table $table diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categorie.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categorie.tmpl index 720463f0c8..faacf1b509 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categorie.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categorie.tmpl @@ -4,6 +4,7 @@ Cannot Delete: Category in UseConfirm Deletion of Category '' Category Deleted + +
    Cannot have "months" and "until date" at the same time
    +
  •   " size="3" maxlength="3" /> years
  •   " /> years
  • " />
  • @@ -164,7 +183,15 @@ Confirm Deletion of Category - + + + @@ -250,7 +277,14 @@ Confirm Deletion of Category StaffStatistical - + From 7540dda2eb5b2914ca7428e9a28e536d44d71980 Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Fri, 15 Jan 2010 16:27:31 +0100 Subject: [PATCH 64/80] Bug Fixing Search By initials incorrect Adding a research scope : field_start_with Using this kind of research if searching by initial --- C4/SQLHelper.pm | 8 ++++++-- members/member.pl | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/C4/SQLHelper.pm b/C4/SQLHelper.pm index 08ba90f648..4db8c4960a 100644 --- a/C4/SQLHelper.pm +++ b/C4/SQLHelper.pm @@ -431,9 +431,13 @@ sub _Process_Operands{ push @tmpkeys,(" $field LIKE ? "); push @localvaluesextended,("\%$operand\%") ; } + if ($searchtype eq "field_start_with"){ + push @tmpkeys,("$field LIKE ?"); + push @localvaluesextended, ("$operand\%") ; + } if ($searchtype eq "start_with"){ - push @tmpkeys,(" $field LIKE ? ","$field LIKE ?"); - push @localvaluesextended, ("\% $operand\%","$operand\%") ; + push @tmpkeys,("$field LIKE ?","$field LIKE ?"); + push @localvaluesextended, ("$operand\%", " $operand\%") ; } push @values,@localvaluesextended; } diff --git a/members/member.pl b/members/member.pl index 2937706b65..1ae50f3bd8 100755 --- a/members/member.pl +++ b/members/member.pl @@ -103,7 +103,8 @@ push @searchpatron, $patron if (keys %$patron); my $from= ($startfrom-1)*$resultsperpage; my $to=$from+$resultsperpage; #($results)=Search(\@searchpatron,{surname=>1,firstname=>1},[$from,$to],undef,["firstname","surname","email","othernames"] ) if (@searchpatron); - ($results)=Search(\@searchpatron,\@orderby,undef,undef,["firstname","surname","email","othernames","cardnumber","userid"],"start_with" ) if (@searchpatron); + my $search_scope=($quicksearch?"field_start_with":"start_with"); + ($results)=Search(\@searchpatron,\@orderby,undef,undef,["firstname","surname","email","othernames","cardnumber","userid"],$search_scope ) if (@searchpatron); if ($results){ $count =scalar(@$results); } From ed9d4873d4c09a050a60532202d6758bc634c122 Mon Sep 17 00:00:00 2001 From: Nahuel ANGELINETTI Date: Fri, 15 Jan 2010 17:01:21 +0100 Subject: [PATCH 65/80] Fix ordering in member search This fix the default ordering when the librarian browser by "last name". It must be ordered by "family name". --- members/member.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/members/member.pl b/members/member.pl index 1ae50f3bd8..f2392c55d9 100755 --- a/members/member.pl +++ b/members/member.pl @@ -89,9 +89,9 @@ if ($orderbyparams){ push @orderby, {$orderbyelt[0]=>$orderbyelt[1]||0}; } else { - @orderby = ({surname=>1},{firstname=>1}); + @orderby = ({firstname=>1},{surname=>1}); } -warn Data::Dumper::Dumper(@orderby); + $member =~ s/,//g; #remove any commas from search string $member =~ s/\*/%/g; From d639b9b79d01e6195cc3062a1e981a9e53d3760b Mon Sep 17 00:00:00 2001 From: Nahuel ANGELINETTI Date: Fri, 15 Jan 2010 17:20:58 +0100 Subject: [PATCH 66/80] (MT2690) fix search by letter This patch fix searching by name that "begins" by one letter, using now the quicksearch arg. And improve a bit the template, now it won't list all the alphabet... --- .../prog/en/modules/members/member.tmpl | 29 ++----------------- members/member.pl | 17 ++++------- 2 files changed, 8 insertions(+), 38 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tmpl index a794b6029f..44cedfe186 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tmpl @@ -19,32 +19,9 @@
    Browse by last name: - A - B - C - D - E - F - G - H - I - J - K - L - M - N - O - P - Q - R - S - T - U - V - W - X - Y - Z + + "> +
    diff --git a/members/member.pl b/members/member.pl index f2392c55d9..bc1980c385 100755 --- a/members/member.pl +++ b/members/member.pl @@ -37,24 +37,14 @@ my $quicksearch = $input->param('quicksearch'); my $startfrom = $input->param('startfrom')||1; my $resultsperpage = $input->param('resultsperpage')||C4::Context->preference("PatronsPerPage")||20; -my ($template, $loggedinuser, $cookie); -if($quicksearch){ - ($template, $loggedinuser, $cookie) - = get_template_and_user({template_name => "members/member-quicksearch-results.tmpl", - query => $input, - type => "intranet", - authnotrequired => 0, - flagsrequired => {borrowers => 1}, - }); -} else { - ($template, $loggedinuser, $cookie) +my ($template, $loggedinuser, $cookie) = get_template_and_user({template_name => "members/member.tmpl", query => $input, type => "intranet", authnotrequired => 0, flagsrequired => {borrowers => 1}, }); -} + my $theme = $input->param('theme') || "default"; my $patron = $input->Vars; @@ -151,6 +141,9 @@ my $base_url = map { "$_=$parameters{$_}" } (keys %parameters) ); +my @letters = map { {letter => $_} } ( 'A' .. 'Z'); +$template->param( letters => \@letters ); + $template->param( paginationbar => pagination_bar( $base_url, int( $count / $resultsperpage ) + 1, From b00aa412343f7a6fe69824ec6ba805339ff6a83f Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Tue, 19 Jan 2010 12:26:24 +0100 Subject: [PATCH 67/80] MT2637, Follow-up : Adds a test to check for missing sysprefs in the database Adds a non-test mode (--showsql option) that displays the missing sysprefs as sql inserts. Some sysprefs were missed from the syspref file due to extra spaces in the insert : fixed. The test now checks if there are at least as many sysprefs in the database as in the syspref file (instead of checking for the exact number) --- xt/check_sysprefs.t | 131 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 131 insertions(+) create mode 100755 xt/check_sysprefs.t diff --git a/xt/check_sysprefs.t b/xt/check_sysprefs.t new file mode 100755 index 0000000000..bc37740f3e --- /dev/null +++ b/xt/check_sysprefs.t @@ -0,0 +1,131 @@ +#!/usr/bin/perl + +# Copyright (C) 2010 BibLibre +# +# 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., 59 Temple Place, +# Suite 330, Boston, MA 02111-1307 USA + +use strict; +use warnings; + +use Getopt::Long; +use C4::Context; + + +# When this option is set, no tests are performed. +# The missing sysprefs are displayed as sql inserts instead. +our $showsql = 0; +GetOptions ('showsql' => \$showsql); + + +use Test::More qw(no_plan); +our $dbh = C4::Context->dbh; +my $root_dir = C4::Context->config( 'intranetdir' ) . '/installer/data/mysql'; +my $base_syspref_file = "en/mandatory/sysprefs.sql"; + + +open( my $ref_fh, "<$root_dir/$base_syspref_file" ); +my $ref_syspref = get_syspref_from_file( $ref_fh ); +my @ref_sysprefs = sort { lc $a cmp lc $b } keys %$ref_syspref; +if (!$showsql) { + cmp_ok( + $#ref_sysprefs, '>=', 0, + "Found " . ($#ref_sysprefs + 1) . " sysprefs" + ); +} + +check_db($ref_syspref); + + +# +# Get sysprefs from SQL file populating sysprefs table with INSERT statement. +# +# Exemple: +# 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') +# +sub get_syspref_from_file { + my $fh = shift; + my %syspref; + while ( <$fh> ) { + next if /^--/; # Comment line + my $query = $_; + if ($_ =~ /\([\s]*\'([\w\-:]+)\'/) { + my $variable = $1; + if ($variable) { + $syspref{$variable} = $query; + } + } + } + return \%syspref; +} + + +sub check_db { + my $sysprefs = shift; + + # Checking the number of sysprefs in the database + my $query = "SELECT COUNT(*) FROM systempreferences"; + my $sth = $dbh->prepare($query); + $sth->execute; + my $res = $sth->fetchrow_arrayref; + my $dbcount = $res->[0]; + if (!$showsql) { + cmp_ok ( + $dbcount, ">=", scalar(keys %$sysprefs), "There are at least as many sysprefs in the database as in the sysprefs.sql" + ); + } + + # Checking for missing sysprefs in the database + $query = "SELECT COUNT(*) FROM systempreferences WHERE variable=?"; + $sth = $dbh->prepare($query); + foreach (keys %$sysprefs) { + $sth->execute($_); + my $res = $sth->fetchrow_arrayref; + my $count = $res->[0]; + if (!$showsql) { + is( + $count, 1, "Syspref $_ exists in the database" + ); + } else { + if ($count != 1) { + print $sysprefs->{$_}; + } + } + } +} + + +=head1 NAME + +syspref.t + +=head1 DESCRIPTION + +This test checks for missing sysprefs in the database. + +Sysprefs are gathered from the installation file. The database is +then queried to check if all the sysprefs are in it. + +=head1 USAGE + +prove -v check_sysprefs.t + +If you want to display the missing sysprefs as sql inserts : +perl check_sysprefs.t --showsql + +=cut + From bc5aa652a6f22fa526084e83665dda62b6e3a689 Mon Sep 17 00:00:00 2001 From: Paul Poulain Date: Tue, 12 Jan 2010 23:45:44 +0100 Subject: [PATCH 68/80] BuildSummary AuthoritiesMarc Enhancement Change in BuildSummary for UNIMARC --- C4/AuthoritiesMarc.pm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm index 907d543b60..3d4564e2a0 100644 --- a/C4/AuthoritiesMarc.pm +++ b/C4/AuthoritiesMarc.pm @@ -1039,7 +1039,7 @@ sub BuildSummary{ # construct UNIMARC summary, that is quite different from MARC21 one # accepted form foreach my $field ($record->field('2..')) { - $heading.= $field->subfield('a'); + $heading.= $field->as_string('abcdefghijlmnopqrstuvwxyz'); } # rejected form(s) foreach my $field ($record->field('3..')) { @@ -1048,18 +1048,18 @@ sub BuildSummary{ foreach my $field ($record->field('4..')) { if ($field->subfield('2')) { my $thesaurus = "thes. : ".$thesaurus{"$field->subfield('2')"}." : "; - $see.= ''.$thesaurus.$field->subfield('a')." -- \n"; + $see.= ''.$thesaurus.$field->as_string('abcdefghijlmnopqrstuvwxyz')." -- \n"; } } # see : foreach my $field ($record->field('5..')) { if (($field->subfield('5')) && ($field->subfield('a')) && ($field->subfield('5') eq 'g')) { - $broaderterms.= ' '.$field->subfield('a')." -- \n"; - } elsif (($field->subfield('5')) && ($field->subfield('a')) && ($field->subfield('5') eq 'h')){ - $narrowerterms.= ''.$field->subfield('a')." -- \n"; + $broaderterms.= ' '.$field->as_string('abcdefgjxyz')." -- \n"; + } elsif (($field->subfield('5')) && ($field->as_string) && ($field->subfield('5') eq 'h')){ + $narrowerterms.= ''.$field->as_string('abcdefgjxyz')." -- \n"; } elsif ($field->subfield('a')) { - $seealso.= ''.$field->subfield('a')." -- \n"; + $seealso.= ''.$field->as_string('abcdefgxyz')." -- \n"; } } # // form From a6e1f838aeaa5095a05d1c5d65e8122da7ed53aa Mon Sep 17 00:00:00 2001 From: Paul Poulain Date: Tue, 12 Jan 2010 23:47:04 +0100 Subject: [PATCH 69/80] bulkmarcimport : removing warnings --- misc/migration_tools/bulkmarcimport.pl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/misc/migration_tools/bulkmarcimport.pl b/misc/migration_tools/bulkmarcimport.pl index 2e583c87ec..6a8a16b6df 100755 --- a/misc/migration_tools/bulkmarcimport.pl +++ b/misc/migration_tools/bulkmarcimport.pl @@ -21,6 +21,7 @@ use MARC::Charset; use C4::Context; use C4::Biblio; use C4::Koha; +use C4::Debug; use C4::Charset; use C4::Items; use Unicode::Normalize; @@ -267,16 +268,16 @@ RECORD: while ( ) { my $server=($authorities?'authorityserver':'biblioserver'); my ($error, $results,$totalhits)=C4::Search::SimpleSearch( $query, 0, 3, [$server] ); die "unable to search the database for duplicates : $error" if (defined $error); - warn "$query $server : $totalhits"; + #warn "$query $server : $totalhits"; if ($results && scalar(@$results)==1){ my $marcrecord = MARC::File::USMARC::decode($results->[0]); $id=GetRecordId($marcrecord,$tagid,$subfieldid); } elsif ($results && scalar(@$results)>1){ - warn "more than one match for $query"; + $debug && warn "more than one match for $query"; } else { - warn "nomatch for $query"; + $debug && warn "nomatch for $query"; } } my $originalid; From ac7cea8dba852fa9ff191cbb877793e7e7270ddb Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Wed, 27 Jan 2010 09:52:49 +0100 Subject: [PATCH 70/80] MT2268 Printing html notices on pdf printers This adds a shell script which is able to turn html files into pdf and print them on a printer It takes a directory where pdf files is laid, a css filename, a host for printer and a Printername printoverdues : generates PDF files from html files in directorys and prints them usage : printoverdues.sh directory [css [printer_host [printername]]] - directory directory to use to apply html2pdf transform - css css file to apply to html - printer_host Network Name or IP of the printer (port possibly included) - printer_name printername Note that css printerhost and printername are optional parameters Note that this script uses xhtml2pdf command xhtml2pdf command comes with pisa (a python library) To install you need setuptools library for python then type easy_install pisa --- misc/cronjobs/printoverdues.sh | 46 ++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100755 misc/cronjobs/printoverdues.sh diff --git a/misc/cronjobs/printoverdues.sh b/misc/cronjobs/printoverdues.sh new file mode 100755 index 0000000000..3cf1c3d4a2 --- /dev/null +++ b/misc/cronjobs/printoverdues.sh @@ -0,0 +1,46 @@ +#!/usr/bin/bash + +print_usage(){ + echo "$0 : generates PDF files from html files in directorys and prints them"; + echo "usage :"; + echo "$0 directory [css [printer_host [printername]]]" + echo " - directory directory to use to apply html2pdf transform"; + echo " - css css file to apply to html "; + echo " - printer_host Network Name or IP of the printer (port possibly included) "; + echo " - printer_name printername "; + echo "Note that css printerhost and printername are optional parameters "; + echo "Note that this script uses xhtml2pdf command "; + echo " xhtml2pdf command comes with pisa (a python library) + To install you need setuptools library for python + then type easy_install pisa "; + + exit 1; +} +if [ $# -lt 1 ] +then + print_usage +fi +if [[ ! -d $1 ]] +then + echo "$1 : directory expected"; + exit 1; +fi +if [[ -n $2 && -f $2 ]] +then + set $optpisa "--css $2"; +fi +if [[ -n $3 ]] +then + set $optprinter "-h $3"; +fi +if [[ -n $4 ]] +then + set $optprinter "$optprinter -d $4"; +fi +for i in $1/*.html +do + xhtml2pdf $optpisa $i +done +lp $optprinter $1/*.pdf +tar cvfz $directory`date "+%Y%m%d"`.tar.gz $directory +rm -rf $directory From ea3277d98d8460703433885636fdf105990bacb7 Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Tue, 26 Jan 2010 13:39:21 +0100 Subject: [PATCH 71/80] monthly_circulation_statistics.pl :Hard Coded date inside Fixing that point --- misc/cronjobs/stats/monthly_circulation_statistics.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/misc/cronjobs/stats/monthly_circulation_statistics.pl b/misc/cronjobs/stats/monthly_circulation_statistics.pl index 961d7e4914..57d273b854 100755 --- a/misc/cronjobs/stats/monthly_circulation_statistics.pl +++ b/misc/cronjobs/stats/monthly_circulation_statistics.pl @@ -67,8 +67,8 @@ my $sth3 = $dbh->prepare ("SELECT COUNT(*) FROM biblioitems,items,statistics WHE # number of renewals for this library my $sth4 = $dbh->prepare ("SELECT COUNT(statistics.itemnumber) FROM statistics,items,biblioitems - WHERE YEAR(statistics.datetime)=YEAR(SUBDATE('2007-01-01',INTERVAL 1 MONTH)) - AND MONTH(statistics.datetime)=MONTH(SUBDATE('2007-01-01',INTERVAL 1 MONTH)) + WHERE YEAR(statistics.datetime)=YEAR(SUBDATE(CURDATE(),INTERVAL 1 MONTH)) + AND MONTH(statistics.datetime)=MONTH(SUBDATE(CURDATE(),INTERVAL 1 MONTH)) AND statistics.itemnumber=items.itemnumber AND biblioitems.ccode=? AND homebranch=? From d17a72ed5b23ef8e67ce21ae974a7076b21ea62b Mon Sep 17 00:00:00 2001 From: Paul Poulain Date: Fri, 22 Jan 2010 17:02:17 +0100 Subject: [PATCH 72/80] (MT 2671): Serial management in koha_add_biblio serial management in koha_add_biblio is only relying on presence of $biblio->{seriestitle} It is not correct, $biblio->{serial} definition should prevail over this test --- C4/Biblio.pm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index 8b918dbff3..ded50fc254 100755 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -2971,8 +2971,10 @@ sub _koha_add_biblio { my $error; # set the series flag - my $serial = 0; - if ( $biblio->{'seriestitle'} ) { $serial = 1 } + unless (defined $biblio->{'serial'}){ + $biblio->{'serial'} = 0; + if ( $biblio->{'seriestitle'} ) { $biblio->{'serial'} = 1 } + } my $query = "INSERT INTO biblio SET frameworkcode = ?, @@ -2989,7 +2991,7 @@ sub _koha_add_biblio { my $sth = $dbh->prepare($query); $sth->execute( $frameworkcode, $biblio->{'author'}, $biblio->{'title'}, $biblio->{'unititle'}, $biblio->{'notes'}, - $serial, $biblio->{'seriestitle'}, $biblio->{'copyrightdate'}, $biblio->{'abstract'} + $biblio->{'serial'}, $biblio->{'seriestitle'}, $biblio->{'copyrightdate'}, $biblio->{'abstract'} ); my $biblionumber = $dbh->{'mysql_insertid'}; From dfa8a38d42402327ebd4e72a9f5ea42740312f4b Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Wed, 27 Jan 2010 18:58:03 +0100 Subject: [PATCH 73/80] Fixing updatedatabase Some lines were not correct (subscription updates) The two latest version lines were incorrect --- installer/data/mysql/updatedatabase.pl | 16 +++++++++------- kohaversion.pl | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index d2890d4bba..7bd153606b 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -1,3 +1,5 @@ +- $dbh->do("ALTER TABLE issuingrules ADD COLUMN `finedays` int(11) default NULL AFTER `fine` "); +- print "Upgrade done (Adding finedays in issuingrules table)\n"; #!/usr/bin/perl @@ -2725,11 +2727,7 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { $DBversion = '3.01.00.066'; if (C4::Context->preference("Version") < TransformToNum($DBversion)) { - $dbh->do("ALTER TABLE issuingrules - ADD COLUMN `finedays` int(11) default NULL AFTER `fine`, - ADD COLUMN `renewalsallowed` smallint(6) default NULL, - ADD COLUMN `reservesallowed` smallint(6) default NULL; - "); + $dbh->do('ALTER TABLE issuingrules ADD COLUMN `reservesallowed` smallint(6) NOT NULL default "0" AFTER `renewalsallowed`;'); my $maxreserves = C4::Context->preference('maxreserves'); $sth = $dbh->prepare('UPDATE issuingrules SET reservesallowed = ?;'); @@ -2748,10 +2746,14 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { $dbh->do("INSERT INTO permissions (module_bit, code, description) VALUES ( 13, 'batchmod', 'Perform batch modification of items')"); $dbh->do("INSERT INTO permissions (module_bit, code, description) VALUES ( 13, 'batchdel', 'Perform batch deletion of items')"); print "Upgrade to $DBversion done (added permissions for batch modification and deletion)\n"; + SetVersion ($DBversion); } $DBversion = "3.01.00.068"; if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + $dbh->do("ALTER TABLE issuingrules ADD COLUMN `finedays` int(11) default NULL AFTER `fine` "); + print "Upgrade done (Adding finedays in issuingrules table)\n"; + SetVersion ($DBversion); } @@ -3369,7 +3371,7 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { SetVersion ($DBversion); } -$DBversion = "3.01.00.102"; +$DBversion = "3.01.00.109"; if (C4::Context->preference("Version") < TransformToNum($DBversion)) { $dbh->do(qq{ ALTER TABLE `export_format` ADD `encoding` VARCHAR(255) NOT NULL AFTER `subfield_separator` @@ -3378,7 +3380,7 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { SetVersion ($DBversion); } -$DBversion = '3.02.00.015'; +$DBversion = '3.01.00.110'; if (C4::Context->preference("Version") < TransformToNum($DBversion)) { $dbh->do('ALTER TABLE `categories` ADD COLUMN `enrolmentperioddate` DATE NULL DEFAULT NULL AFTER `enrolmentperiod`'); print "Upgrade done (Add enrolment period date support)\n"; diff --git a/kohaversion.pl b/kohaversion.pl index 79ca979648..dde10313d7 100644 --- a/kohaversion.pl +++ b/kohaversion.pl @@ -10,7 +10,7 @@ use strict; sub kohaversion { - our $VERSION = '3.01.00.108'; + our $VERSION = '3.01.00.110'; # version needs to be set this way # so that it can be picked up by Makefile.PL # during install From eea1a290760e827a9c670a29cb94d4f9d36f812c Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Wed, 27 Jan 2010 22:02:19 +0100 Subject: [PATCH 74/80] [followup MT2343] fixing aqplan.tmpl Rebase introduced duplication of headers --- koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqplan.tmpl | 5 ----- 1 file changed, 5 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqplan.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqplan.tmpl index e04b6d567a..4e2702e043 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqplan.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqplan.tmpl @@ -9,11 +9,6 @@ Budget planning /menu/assets/menu.css" rel="stylesheet" type="text/css" /> /container/assets/skins/sam/container.css" rel="stylesheet" type="text/css" /> - - - - - From ebbd0003b8777e6cb8fa61a09d490244da5f7975 Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Wed, 27 Jan 2010 22:15:17 +0100 Subject: [PATCH 75/80] Reverting staff-global.css changes introduced in label are used in only one page namely members-home.pl and break many --- koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css | 6 ------ 1 file changed, 6 deletions(-) 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 22636ab417..0be3df7a56 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css +++ b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css @@ -519,12 +519,6 @@ div.yui-b fieldset.brief { padding : .4em .7em; } -label { - float: left; - width: 12em; - margin-right: 1em; - text-align: left; -} div.yui-b fieldset.brief ol { font-size : 85%; margin : 0; From 1e1c87a1afb9b6bad651dde1cf45a8dcc5fafce6 Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Wed, 27 Jan 2010 22:19:44 +0100 Subject: [PATCH 76/80] (followup MT2690) search on first letter followup commit 5a669826fa8e6cfbf2c53aa40271e0a2f8465a6c letters were not introduced in first page --- members/members-home.pl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/members/members-home.pl b/members/members-home.pl index e641feb78d..e497f4adaf 100755 --- a/members/members-home.pl +++ b/members/members-home.pl @@ -59,5 +59,7 @@ $template->param( $template->param( "AddPatronLists_".C4::Context->preference("AddPatronLists")=> "1", ); +my @letters = map { {letter => $_} } ( 'A' .. 'Z'); +$template->param( letters => \@letters ); output_html_with_http_headers $query, $cookie, $template->output; From e154413382f753dbaa14bfce96d208820195ec44 Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Thu, 28 Jan 2010 09:22:42 +0100 Subject: [PATCH 77/80] Revert "MT2232 : members/notices.pl and members/messaging.pl are doing the same thing" This reverts commit 653de3c295b5b21ddfe11f0597b4ba7092f1effc. Should remove members/notices.pl instead --- .../prog/en/includes/circ-menu.inc | 3 + .../prog/en/includes/members-menu.inc | 3 + .../prog/en/modules/members/messaging.tmpl | 68 ++++++++++++ members/messaging.pl | 102 ++++++++++++++++++ 4 files changed, 176 insertions(+) create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/members/messaging.tmpl create mode 100755 members/messaging.pl diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc index 8db64af45f..443e12bb58 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc @@ -66,6 +66,9 @@
  • ">Circulation History
  • &src=circ">Modification Log
  • + +
  • ">Messaging
  • +
  • ">Notices
  • diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/members-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/members-menu.inc index aebb2bfe20..513d415a53 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/members-menu.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/members-menu.inc @@ -7,6 +7,9 @@
  • ">Circulation History
  • ">Modification Log
  • + +
  • ">Messaging
  • + diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/messaging.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/members/messaging.tmpl new file mode 100644 index 0000000000..75bec95196 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/messaging.tmpl @@ -0,0 +1,68 @@ + +Koha › Patrons › <!-- TMPL_IF NAME="unknowuser" -->Patron does not exist<!-- TMPL_ELSE -->Patron Details for <!-- TMPL_VAR NAME="firstname" --> <!-- TMPL_VAR NAME="surname" --> (<!-- TMPL_VAR NAME="cardnumber" -->)<!-- /TMPL_IF --> + + + + + + + + +
    + +
    +
    +
    + + +
    + +

    Userid / Password update failed

    +Insufficient privileges. +

    Other fields updated.

    + + +

    Unable to delete staff user

    +

    Insufficient privileges.

    + + +

    Unable to delete patrons from other libraries with current settings

    +

    Insufficient privileges.

    + + +

    Unable to delete patron:

    +

    Insufficient privileges.

    + +
    + +
    + +
    + This patron does not exist. +
    + + +
    Category code:
    Description:
    Enrollment period: months
    Enrollment period: + + months + + until + +
    Age required: years
    Upperage limit: years
    Enrollment fee:
    months + + months + + until + + + years years
    + + + + + + + + + +
    Message Queue
    TypeSubjectStatusTime Prepared
    There is no record of any messages that have been sent to this patron.
    + + + + + + + + +
    + +
    + + diff --git a/members/messaging.pl b/members/messaging.pl new file mode 100755 index 0000000000..6390dad38b --- /dev/null +++ b/members/messaging.pl @@ -0,0 +1,102 @@ +#!/usr/bin/perl + +# Copyright 2008 LibLime +# +# 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., 59 Temple Place, +# Suite 330, Boston, MA 02111-1307 USA + + +use strict; +use warnings; + +use CGI; +use C4::Context; +use C4::Auth; +use C4::Output; +use C4::Members; +use C4::Members::Messaging; +use C4::Dates; +use C4::Reserves; +use C4::Circulation; +use C4::Koha; +use C4::Letters; +use C4::Biblio; +use C4::Reserves; +use C4::Branch; # GetBranchName + +use Data::Dumper; + +use vars qw($debug); + +BEGIN { + $debug = $ENV{DEBUG} || 0; +} + +my $dbh = C4::Context->dbh; + +my $query = CGI->new(); + +my ( $template, $loggedinuser, $cookie ) = get_template_and_user( + { + template_name => 'members/messaging.tmpl', + query => $query, + type => "intranet", + authnotrequired => 0, + flagsrequired => { borrowers => 1 }, + debug => 1, + } +); +my $borrowernumber = $query->param('borrowernumber'); +my $borrower = GetMember( 'borrowernumber' => $borrowernumber ); +my $branch = C4::Context->userenv->{'branch'}; + +$template->param( $borrower ); + +$borrower = GetMemberDetails( $borrowernumber ); + + + if ( $borrower->{'category_type'} eq 'C') { + my ( $catcodes, $labels ) = GetborCatFromCatType( 'A', 'WHERE category_type = ?' ); + my $cnt = scalar(@$catcodes); + $template->param( 'CATCODE_MULTI' => 1) if $cnt > 1; + $template->param( 'catcode' => $catcodes->[0]) if $cnt == 1; + } + +my ($picture, $dberror) = GetPatronImage($borrower->{'cardnumber'}); +$template->param( picture => 1 ) if $picture; + +# get some recent messages sent to this borrower for display: +my $message_queue = C4::Letters::GetQueuedMessages( { borrowernumber => $query->param('borrowernumber') } ); + +$template->param( messagingview => 1, + message_queue => $message_queue, + DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(), + borrowernumber => $borrowernumber, + branchcode => $borrower->{'branchcode'}, + branchname => GetBranchName($borrower->{'branchcode'}), + dateformat => C4::Context->preference("dateformat"), + categoryname => $borrower->{'description'}, + $borrower->{'categorycode'} => 1, +); + +#$messaging_preferences->{'SMSnumber'}{'value'} = defined $borrower->{'smsalertnumber'} +# ? $borrower->{'smsalertnumber'} : $borrower->{'mobile'}; + +$template->param( BORROWER_INFO => [ $borrower ], + messagingview => 1, + is_child => ($borrower->{'category_type'} eq 'C'), + ); + +output_html_with_http_headers $query, $cookie, $template->output; From 9d1a31c7f67f9885fe89081604ba01e045960004 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Demians?= Date: Fri, 27 Nov 2009 09:46:06 +0100 Subject: [PATCH 78/80] Bug 3813: SIP2, Bad Patron Information Response to Message 64 This fix returns item's barcodes in AU fields --- C4/SIP/Sip/MsgType.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/C4/SIP/Sip/MsgType.pm b/C4/SIP/Sip/MsgType.pm index 67ccc218c2..1b210ca1cc 100644 --- a/C4/SIP/Sip/MsgType.pm +++ b/C4/SIP/Sip/MsgType.pm @@ -904,7 +904,7 @@ sub summary_info { syslog("LOG_DEBUG", "summary_info: list = (%s)", join(", ", @{$itemlist})); foreach my $i (@{$itemlist}) { - $resp .= add_field($fid, $i); + $resp .= add_field($fid, $i->{barcode}); } return $resp; From fca7926374e7f30a5c435678f76d26b619758020 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Demians?= Date: Fri, 27 Nov 2009 18:16:55 +0100 Subject: [PATCH 79/80] Bug 3814: SIP2 Server logging doesn't work on OpenSolaris This patch put in SIPconfig.xml SIP2 server logging parameters. This is way it's possible to modify where SIP2 logs are sent. And fix OpenSolaris bug. WARNING: After an upgrade, installation using a custom SIP2 server config file will need to copy default SIPconfig.xml added section: --- C4/SIP/SIPServer.pm | 10 +--------- C4/SIP/SIPconfig.xml | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/C4/SIP/SIPServer.pm b/C4/SIP/SIPServer.pm index 55b2380f73..c6de11e464 100644 --- a/C4/SIP/SIPServer.pm +++ b/C4/SIP/SIPServer.pm @@ -59,16 +59,8 @@ foreach my $svc (keys %{$config->{listeners}}) { # Jun 16 21:21:31 server08 steve_sip[19305]: ILS::Transaction::Checkout performing checkout... # [ TIMESTAMP ] [ HOST ] [ IDENT ] PID : Message... # -# The IDENT is determined by $ENV{KOHA_SIP_LOG_IDENT}, if present. -# Otherwise it is "_sip" appended to $USER, if present, or "acs-server" as a fallback. -# +# The IDENT is determined by config file 'server-params' arguments -my $syslog_ident = $ENV{KOHA_SIP_LOG_IDENT} || ($ENV{USER} ? $ENV{USER} . "_sip" : 'acs-server'); - -push @parms, - "log_file=Sys::Syslog", - "syslog_ident=$syslog_ident", - "syslog_facility=" . LOG_SIP; # # Server Management: set parameters for the Net::Server::PreFork diff --git a/C4/SIP/SIPconfig.xml b/C4/SIP/SIPconfig.xml index 0e5f05ed31..f229b9a51b 100644 --- a/C4/SIP/SIPconfig.xml +++ b/C4/SIP/SIPconfig.xml @@ -2,10 +2,18 @@ - - + +