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);
@ISA = qw(Exporter);
@EXPORT = qw(
&GetBasket &NewBasket &CloseBasket &DelBasket &ModBasket
+ &GetBasketAsCSV
&GetBasketsByBookseller &GetBasketsByBasketgroup
&ModBasketHeader
#------------------------------------------------------------#
+=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
, unitprice=?
, freight=?
, rrp=?
- , quantityreceived=?
+ , quantity=?
WHERE biblionumber=? AND ordernumber=?");
$sth->execute($quantrec,$datereceived,$invoiceno,$cost,$freight,$rrp,$quantrec,$biblionumber,$ordernumber);
foreach my $orderkey ( "linenumber", "allocation" ) {
delete($order->{'$orderkey'});
}
+ $order->{'quantity'} -= $quantrec;
+ $order->{'quantityreceived'} = 0;
my $newOrder = NewOrder($order);
} else {
$sth=$dbh->prepare("update aqorders
$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;
$summary = $resultstring;
} else {
my $heading;
- my $authid;
my $altheading;
my $seealso;
my $broaderterms;
# 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..')) {
foreach my $field ($record->field('4..')) {
if ($field->subfield('2')) {
my $thesaurus = "thes. : ".$thesaurus{"$field->subfield('2')"}." : ";
- $see.= '<span class="UF">'.$thesaurus.$field->subfield('a')."</span> -- \n";
+ $see.= '<span class="UF">'.$thesaurus.$field->as_string('abcdefghijlmnopqrstuvwxyz')."</span> -- \n";
}
}
# see :
foreach my $field ($record->field('5..')) {
if (($field->subfield('5')) && ($field->subfield('a')) && ($field->subfield('5') eq 'g')) {
- $broaderterms.= '<span class="BT"> <a href="detail.pl?authid='.$field->subfield('3').'">'.$field->subfield('a')."</a></span> -- \n";
- } elsif (($field->subfield('5')) && ($field->subfield('a')) && ($field->subfield('5') eq 'h')){
- $narrowerterms.= '<span class="NT"><a href="detail.pl?authid='.$field->subfield('3').'">'.$field->subfield('a')."</a></span> -- \n";
+ $broaderterms.= '<span class="BT"> '.$field->as_string('abcdefgjxyz')."</span> -- \n";
+ } elsif (($field->subfield('5')) && ($field->as_string) && ($field->subfield('5') eq 'h')){
+ $narrowerterms.= '<span class="NT">'.$field->as_string('abcdefgjxyz')."</span> -- \n";
} elsif ($field->subfield('a')) {
- $seealso.= '<span class="RT"><a href="detail.pl?authid='.$field->subfield('3').'">'.$field->subfield('a')."</a></span> -- \n";
+ $seealso.= '<span class="RT">'.$field->as_string('abcdefgxyz')."</a></span> -- \n";
}
}
# // form
$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'
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'
&& $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' )
&& $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} ) {
$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} = "<input type=\"text\" name=\"field_value\" value=\"$value\" size=\"50\" maxlength=\"255\" />";
+ $subfield_data{marc_value} = "<input type=\"text\" name=\"field_value\" value=\"$defaultvalue\" size=\"50\" maxlength=\"255\" />";
}
push( @loop_data, \%subfield_data );
}
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 = ?,
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'};
&ModBudget
&DelBudget
&GetBudgetSpent
+ &GetBudgetOrdered
&GetPeriodsCount
&GetBudgetPeriod
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);
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);
@EXPORT = qw(
IsStringUTF8ish
MarcToUTF8Record
+ SetUTF8Flag
SetMarcUnicodeFlag
StripNonXmlChars
);
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
--- /dev/null
+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 <info@koha.org>
+
+=cut
@EXPORT = qw(
&GetCsvProfiles
+ &GetCsvProfile
&GetCsvProfilesLoop
&GetMarcFieldsForCsv
);
}
+# 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 {
# 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 ($$) {
&GetAuthorisedValues
&GetAuthorisedValueCategories
&GetKohaAuthorisedValues
+ &GetKohaAuthorisedValuesFromField
&GetAuthValCode
&GetNormalizedUPC
&GetNormalizedISBN
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]);
}
}
+=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
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)
=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){
=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
: "");
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'
+ AND borrowernumber NOT IN (SELECT guarantorid FROM borrowers WHERE guarantorid IS NOT NULL AND guarantorid <> 0)
";
my @query_params;
if ($filterbranch && $filterbranch ne ""){
$query.=" AND borrowers.branchcode= ?";
push @query_params,$filterbranch;
- }
+ }
+ if($filterexpiry){
+ $query .= " AND dateexpiry < ? ";
+ push @query_params,$filterdate;
+ }
$query.=" GROUP BY borrowers.borrowernumber";
if ($filterdate){
- $query.=" HAVING latestissue <? OR latestissue IS NULL";
+ $query.=" HAVING (latestissue < ? OR latestissue IS NULL)
+ AND currentissue IS NULL";
push @query_params,$filterdate;
}
warn $query if $debug;
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);
=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)
+C<$header> - true if the headers are to be printed (typically at first pass)
+
=back
=back
sub marc2csv {
- my ($record, $id, $header) = @_;
+ my ($biblio, $id, $header) = @_;
my $output;
- my $csv = Text::CSV->new();
- # Get the information about the csv profile
- my $marcfieldslist = GetMarcFieldsForCsv($id);
+ # 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} || '#';
+ 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::Encoded->new({ sep_char => $csvseparator });
+ $csv = $csv->encoding_out($encoding) if ($encoding ne 'utf8');
+
+ # 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];
+ # 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();
+ 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();
+ push @marcfieldsheaders, $results[0];
+ }
}
}
$csv->combine(@marcfieldsheaders);
# 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);
# 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(',', @tmpfields));
+ push (@fieldstab, join($subfieldseparator, @tmpfields));
# Or a field
} else {
my @fields = ($record->field($marcfield));
- push (@fieldstab, join(',', 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)));
}
};
# 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.itype', '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')) {
unshift @{ $criteria{'1'} }, 'items.itype';
unshift @{ $criteria{'2'} }, 'items.itype';
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++){
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 };
use strict;
use warnings;
+use DateTime;
use Sys::Syslog qw(syslog);
use Carp;
# check if its on issue and if so get the borrower
my $issue = GetItemIssue($item->{'itemnumber'});
+ if ( $issue ) {
+ my $date = $issue->{ date_due };
+ my $dt = DateTime->new(
+ year => substr($date, 0, 4),
+ month => substr($date,5,2),
+ day => substr($date, 8, 2) );
+ $item->{ due_date } = $dt->epoch();
+ }
my $borrower = GetMember(borrowernumber=>$issue->{'borrowernumber'});
$item->{patron} = $borrower->{'cardnumber'};
my ($whatever, $arrayref) = GetReservesFromBiblionumber($item->{biblionumber});
# 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
<!-- above address gets nothing, it's just a namespace -->
<error-detect enabled="true" />
-<!-- Set Net::Server::PreFork runtime parameters -->
-<!-- <server-params
- min_servers='1'
- min_spare_servers='0' /> -->
+<!--
+ Set Net::Server::PreFork runtime parameters
+ syslog_ident will identify SIP2 Koha server entries in syslog
+ For OpenSolaris, add: syslog_logsock=stream
+-->
+ <server-params
+ min_servers='1'
+ min_spare_servers='0'
+ log_file='Sys::Syslog'
+ syslog_ident='koha_sip'
+ syslog_facility='local6'
+ />
<listeners>
<!-- vestigial HTTP, never implemented: just use the OPAC!
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;
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 $"=', ';
}
if ($orderby){
#Order by desc by default
- my @orders=map{ "$_".($$orderby{$_}? " DESC" : "") } keys %$orderby;
- $sql.= do { local $"=', ';
- qq{ ORDER BY @orders}
- };
+ my @orders;
+ foreach my $order (@$orderby){
+ push @orders,map{ "$_".($order->{$_}? " DESC " : "") } keys %$order;
+ }
+ $sql.= do { local $"=', ';
+ qq{ ORDER BY @orders}
+ };
}
if ($limit){
$sql.=qq{ LIMIT }.join(",",@$limit);
=over 4
- $data_id_in_table = &InsertInTable($tablename,$data_hashref);
+ $data_id_in_table = &InsertInTable($tablename,$data_hashref,$withprimarykeys);
=back
=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);
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
}
}
else{
+ $debug && warn "filterstring : $filter_input";
my ($keys, $values) = _filter_string($tablename,$filter_input, $searchtype,$filtercolumns);
if ($keys){
my $stringkey="(".join (") AND (",@$keys).")";
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;
push @tmpkeys, " $field = ? ";
push @values, $operand;
#By default, exact search
- unless ($searchtype){
+ if (!$searchtype ||$searchtype eq "exact"){
return \@tmpkeys,\@values;
}
- if ($searchtype eq "contain"){
- my $col_field=(index($field,".")>0?substr($field, index($field,".")+1):$field);
- if ($field=~/(?<!zip)code|(?<!card)number/ ){
- push @tmpkeys,(" $field= '' ","$field IS NULL");
- } elsif ($$columns{$col_field}{Type}=~/varchar|text/i){
- push @tmpkeys,(" $field LIKE ? ");
- my @localvaluesextended=("\%$operand\%") ;
- push @values,@localvaluesextended;
- }
+ my $col_field=(index($field,".")>0?substr($field, index($field,".")+1):$field);
+ if ($field=~/(?<!zip)code|(?<!card)number/ && $searchtype ne "exact"){
+ push @tmpkeys,(" $field= '' ","$field IS NULL");
}
- if ($searchtype eq "start_with"){
- my $col_field=(index($field,".")>0?substr($field, index($field,".")+1):$field);
- if ($field=~/(?<!zip)code|(?<!card)number/ ){
- push @tmpkeys,(" $field= '' ","$field IS NULL");
- } elsif ($$columns{$col_field}{Type}=~/varchar|text/i){
- push @tmpkeys,(" $field LIKE ? ","$field LIKE ?");
- my @localvaluesextended=("\% $operand\%","$operand\%") ;
- push @values,@localvaluesextended;
- }
+ if ($columns->{$col_field}->{Type}=~/varchar|text/i){
+ my @localvaluesextended;
+ if ($searchtype eq "contain"){
+ 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 @values,@localvaluesextended;
}
push @localkeys,qq{ (}.join(" OR ",@tmpkeys).qq{) };
return (\@localkeys,\@values);
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,
# 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];
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=/ ) {
) = ( 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)/ ) {
}
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{
+ (index($_,"*")>0?"$_":"$_*")
+ }split (/\s+/,$operand));
+ warn $operand if $DEBUG;
+ }
+ }
# Detect Truncation
my $truncated_operand;
# 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
# 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] );
-
if ($bibliotag<10){
$fw = GetFrameworkCode($marcrecord->field($bibliotag)->data);
}else{
}
# 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' );
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 { () }
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 ='')};
}
>} keys %$suggestion
) {
if ($$suggestion{$field}){
- push @sql_params,$$suggestion{$field};
+ push @sql_params,$suggestion->{$field};
push @query, " and suggestions.$field=?";
}
else {
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";}
$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
$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;
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 = "<sysprefs>\n";
+ warn $xmlrecord;
foreach my $syspref ( qw/OPACURLOpenInNewWindow DisplayOPACiconsXSLT URLLinkText/ ) {
$sysxml .= "<syspref name=\"$syspref\">" .
C4::Context->preference( $syspref ) .
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();
'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,
Test::More
Text::CSV
Text::CSV_XS
+Text::CSV::Encoded
Text::Iconv
Text::Wrap
Time::HiRes
my $classlist = '';
my $total = 0;
my $totspent = 0;
+my $totordered = 0;
my $totcomtd = 0;
my $totavail = 0;
my @loop_budget = ();
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_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'} 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 );
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,
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({
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;
} 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) {
};
$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);
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;
#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;
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'},
$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});
my %line;
%line = %{$pendingorders->[$i]};
$line{quantity}+=0;
- $line{quantrem} = $line{quantity} - $line{quantityreceived};
$line{quantityreceived}+=0;
$line{unitprice}+=0;
$totalPunitprice += $line{unitprice};
use strict;
use C4::Auth;
use C4::Acquisition;
+use C4::Contract;
use C4::Biblio;
use C4::Output;
+use C4::Dates qw/format_date /;
use CGI;
use C4::Bookseller;
);
my $GST = $booksellers[0]->{'gstrate'} || C4::Context->preference("gist");
$GST *= 100;
+
+my @contracts = GetContracts($id);
+my $contractcount = scalar(@contracts);
+$template->param(hascontracts => 1) if ($contractcount > 0);
+
#build array for currencies
if ($op eq "display") {
+
+ # get contracts
+ my @contracts = @{GetContract( { booksellerid => $id } )};
+
+ # format dates
+ for ( @contracts ) {
+ $$_{contractstartdate} = format_date($$_{contractstartdate});
+ $$_{contractenddate} = format_date($$_{contractenddate});
+ }
+
$template->param(
id => $id,
name => $booksellers[0]->{'name'},
listprice => $booksellers[0]->{'listprice'},
GST => $GST,
basketcount => $booksellers[0]->{'basketcount'},
+ contracts => \@contracts
);
}
elsif ($op eq 'delete') {
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');
);
} # IF-MOD
$template->param( DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),);
- $template->param( confirm_not_duplicate => $check_duplicate );
}
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';
}
);
+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
} 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:'');
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);
## 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 ;
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,
);
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') || '';
-my @bookseller = GetBookSellerFromId("$booksellerid");
+my @bookseller = GetBookSellerFromId($booksellerid);
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
{ template_name => "admin/aqcontract.tmpl",
);
$template->param(
- script_name => $script_name,
contractnumber => $contractnumber,
- searchfield => $searchfield,
booksellerid => $booksellerid,
- name => $bookseller[0]->{name},
+ booksellername => $bookseller[0]->{name},
DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),
);
#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;
-
- for my $bookseller (@bookseller) {
- if ( $bookseller->{'id'} eq $data->{'booksellerid'} ) {
- $bookseller->{'selected'} = 1;
- }
- }
- } else {
- for my $bookseller (@bookseller) {
- if ( $bookseller->{'id'} eq $booksellerid ) {
- $bookseller->{'selected'} = 1;
- }
- }
- }
+
+ # 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'} ),
- booksellerloop => \@bookseller,
- booksellerid => $data->{'booksellerid'},
- 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
-
- #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<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=aqcontract.pl?booksellerid=$booksellerid\"></html>";
- exit;
-
- # END $OP eq ADD_VALIDATE
+ $template->param( add_validate => 1 );
+
+ my $is_a_modif = $input->param("is_a_modif");
+
+ 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 {
+ 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') ),
+ });
+ }
-#DELETE_CONFIRM: called by default form, used to confirm deletion of data in DB
+ print $input->redirect("/cgi-bin/koha/acqui/supplier.pl?supplierid=$booksellerid");
+ exit;
+
+ # 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 );
- 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
-
- #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;
- 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<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=aqcontract.pl?booksellerid=$booksellerid\"></html>";
+
+ DelContract( { contractnumber => $contractnumber } );
+
+ print $input->redirect("/cgi-bin/koha/acqui/supplier.pl?supplierid=$booksellerid");
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;
- }
- }
- }
- 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;
+
+ # get contracts
+ my @contracts = @{GetContract( { booksellerid => $booksellerid } )};
+
+ # format dates
+ for ( @contracts ) {
+ $$_{contractstartdate} = format_date($$_{contractstartdate});
+ $$_{contractenddate} = format_date($$_{contractenddate});
}
- $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;
+
use C4::Context;
use C4::Auth;
use C4::Output;
+use C4::Dates;
use C4::Form::MessagingPreferences;
sub StringSearch {
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'}),
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')) {
$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')) {
$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;
$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'}),
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'});
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;
--- /dev/null
+#!/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="
+ <script type='text/javascript'>
+ function Focus$field_number() {
+ return 1;
+ }
+
+ function Blur$field_number() {
+ var code = document.getElementById('$field_number');
+ var url = '../cataloguing/plugin_launcher.pl?plugin_name=stocknumberam123.pl&code=' + code.value;
+ var blurcallbackstocknumber = {
+ success: function(o) {
+ var field = document.getElementById('$field_number');
+ field.value = o.responseText;
+ return 1;
+ }
+ }
+ var transaction = YAHOO.util.Connect.asyncRequest('GET',url, blurcallbackstocknumber, null);
+ return 1;
+ }
+
+ function Clic$field_number() {
+ return 1;
+ }
+ </script>
+ ";
+
+ 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;
--- /dev/null
+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');
--- /dev/null
+Des listes de valeurs autorisées bien utiles pour la constitution des grilles de catalogage.
`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';
+- $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
$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`;');
-
+
my $maxreserves = C4::Context->preference('maxreserves');
$sth = $dbh->prepare('UPDATE issuingrules SET reservesallowed = ?;');
$sth->execute($maxreserves);
$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);
}
$dbh->do(<<BUDGETNAME);
-ALTER TABLE aqbudget RENAME`aqbudgets`
+ALTER TABLE aqbudget RENAME `aqbudgets`
BUDGETNAME
my $maxbudgetid=$dbh->selectcol_arrayref(<<IDsBUDGET);
SELECT MAX(aqbudgetid) from aqbudgets
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);
+}
+
+$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`
+ });
+ print "Upgrade done (added encoding for csv export)\n";
+ SetVersion ($DBversion);
+}
+
+$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";
+ SetVersion ($DBversion);
+}
+
=item DropAllForeignKeys($table)
Drop all foreign keys of the table $table
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=<!-- TMPL_VAR NAME="id" -->&op=add_form"},
{ text: _("Uncertain prices"), url: "/cgi-bin/koha/acqui/uncertainprice.pl?booksellerid=<!-- TMPL_VAR NAME="id" -->&owner=1"}
<!-- /TMPL_IF -->
]
- <!-- TMPL_IF NAME="id" -->new YAHOO.widget.Button("newbasket");
- new YAHOO.widget.Button("editsupplier");
- new YAHOO.widget.Button("receive");
- new YAHOO.widget.Button("editcontracts");
- new YAHOO.widget.Button({type: "menu", label: _("Manage orders"), name: "manageorders", menu: manageorders, container: "toolbar-list"});
+ <!-- TMPL_IF NAME="id" -->
+ <!-- TMPL_IF NAME="basketcount" -->
+ new YAHOO.widget.Button({type: "menu", label: _("Manage orders"), name: "manageorders", menu: manageorders, container: "toolbar-list"});
+ <!-- /TMPL_IF -->
<!-- /TMPL_IF -->
}
<ul id="toolbar-list" class="toolbar">
<!-- TMPL_IF NAME="id" -->
<li><a id="editsupplier" href="/cgi-bin/koha/acqui/supplier.pl?supplierid=<!--TMPL_VAR Name="id"-->&op=enter">Edit</a></li>
- <li><a id="editcontracts" href="/cgi-bin/koha/admin/aqcontract.pl?booksellerid=<!-- TMPL_VAR name="id" -->">Contracts</a></li>
+ <li><a id="newcontract" href="/cgi-bin/koha/admin/aqcontract.pl?op=add_form&booksellerid=<!-- TMPL_VAR name="id" -->">New Contract</a></li>
+ <!-- TMPL_UNLESS NAME="basketcount" -->
+ <li><a id="newbasket" href="/cgi-bin/koha/acqui/basketheader.pl?booksellerid=<!-- TMPL_VAR name="id" -->&op=add_form">New Basket</a></li>
+ <!-- /TMPL_UNLESS -->
<!-- TMPL_ELSE -->
<li><a id="newbudget" href="/cgi-bin/koha/acqui/supplier.pl?op=enter">New Vendor</a></li>
<!-- /TMPL_IF -->
+++ /dev/null
-<div class="dialog alert">
-<script type="text/javascript">
-//<![CDATA[
-
-function confirmnotdup(){
- $("#confirm_not_duplicate").attr("value","1");
- // alert(_("Not a duplicate confirmed. Please click on Add biblio to save the record"));
- var checkform = $("#f");
- Check(checkform);
-}
-//]]>
-</script>
-
-
-<h4>Duplicate suspected</h4>
-<p>Is this a duplicate of
- <ul><!--TMPL_LOOP Name="duplicates"-->
- <li><a href="<!--TMPL_VAR Name="url"-->?<!--TMPL_VAR Name="field_name"-->=<!-- TMPL_VAR name="dupid" -->" onclick="openWindow('<!--TMPL_VAR Name="url"-->?<!--TMPL_VAR Name="field_name"-->=<!-- TMPL_VAR name="dupid" -->&popup=1', 'Duplicate '; return false;)"><!-- TMPL_VAR name="duplicateinformation" --></a>?
- <form action="<!--TMPL_VAR Name="action_dup_yes_url"-->" method="get">
- <input type="hidden" name="<!--TMPL_VAR Name="field_name"-->" value="<!-- TMPL_VAR name="dupid" -->" />
- <input type="submit" class="edit" value="Yes: Edit existing" />
- </form>
- </li>
- <!--/TMPL_LOOP--></ul>
-</p>
-<form action="<!--TMPL_VAR Name="action_dup_no_url"-->" method="get">
- <input type="submit" class="save" onclick="confirmnotdup(); return false;" value="No: Save as New" />
-</form>
-</div>
-
var moremenu = [
{ text: _("Renew Patron"), onclick: { fn: confirm_reregistration } },
{ text: _("Set Permissions"), url: "/cgi-bin/koha/members/member-flags.pl?member=<!-- TMPL_VAR NAME="borrowernumber" -->"<!-- TMPL_UNLESS NAME="CAN_user_permissions" -->, disabled: true<!-- /TMPL_UNLESS -->},
- { text: _("Delete"), onclick: { fn: confirm_deletion}<!-- TMPL_UNLESS NAME="samebranch" -->, disabled: true<!-- /TMPL_IF --> },
+ { text: _("Delete"), onclick: { fn: confirm_deletion}<!-- TMPL_UNLESS NAME="CANDELETEUSER" -->, disabled: true<!-- /TMPL_UNLESS --> },
{ text: _("Update Child to Adult Patron") , onclick: { fn: update_child }<!-- TMPL_UNLESS NAME="is_child" -->, disabled: true<!-- /TMPL_UNLESS -->}
];
<div id="patron_search" class="residentsearch">
<p class="tip">Enter patron card number or partial name:</p>
<form action="/cgi-bin/koha/members/member.pl" method="post">
- <input id="searchmember" size="25" class="focus" name="member" type="text" />
+ <input id="searchmember" size="25" class="focus" name="member" type="text" value="<!--TMPL_VAR Name="member"-->"/>
+ <!--TMPL_IF Name="branchloop"-->
+ <span class="filteraction" id="filteraction_off"> <a href="#" onClick="$('#filters').toggle();$('.filteraction').toggle();">[-]</a></span>
+ <span class="filteraction" id="filteraction_on"> <a href="#" onClick="$('#filters').toggle();$('.filteraction').toggle();">[+]</a></span>
+ <!--/TMPL_IF -->
order by:
<select name="orderby" id="searchorderby">
- <option value="surname,firstname">Surname</option>
- <option value="cardnumber">Cardnumber</option>
+ <option value="surname,1">Surname</option>
+ <option value="cardnumber,1">Cardnumber</option>
</select>
<input value="Search" class="submit" type="submit" />
+ <!--TMPL_IF Name="branchloop"-->
+ <div id="filters"> <label for="branchcode"> Library :</label><select name="branchcode" id="branchcode">
+ <option value="">Any</option><!-- TMPL_LOOP name="branchloop" -->
+ <!-- TMPL_IF NAME="selected" -->
+ <option value="<!-- TMPL_VAR name="value" -->" selected="selected"><!-- TMPL_VAR name="branchname" --></option><!-- TMPL_ELSE -->
+ <option value="<!-- TMPL_VAR name="value" -->"><!-- TMPL_VAR name="branchname" --></option><!-- /TMPL_IF -->
+ <!-- /TMPL_LOOP --></select><br />
+ <label for="categorycode"> categorycode :</label><select name="categorycode" id="categorycode">
+ <option value="">Any</option><!-- TMPL_LOOP name="categoryloop" -->
+ <!-- TMPL_IF NAME="selected" -->
+ <option value="<!-- TMPL_VAR name="categorycode" -->" selected="selected"><!-- TMPL_VAR name="description" --></option><!-- TMPL_ELSE -->
+ <option value="<!-- TMPL_VAR name="categorycode" -->"><!-- TMPL_VAR name="description" --></option><!-- /TMPL_IF -->
+ <!-- /TMPL_LOOP --></select>
+ </div>
+ <!--/TMPL_IF -->
</form>
</div>
<!-- TMPL_IF NAME="CAN_user_circulate" -->
<!-- TMPL_IF NAME="CAN_user_catalogue" --><li><a href="/cgi-bin/koha/catalogue/search.pl#catalog_search">Search the Catalog</a></li><!-- /TMPL_IF -->
</ul>
</div>
-<!-- End Patrons Resident Search Box -->
\ No newline at end of file
+<script type="text/javascript">//<![CDATA[
+$(document).ready(function() {
+ $("#filters").toggle();
+ $("#filteraction_off").toggle();
+});
+//]]>
+</script>
+<!-- End Patrons Resident Search Box -->
<th>Owner</th>
<th>Branch</th>
<th>Amount</th>
+ <th>Ordered</th>
<th>Spent</th>
<th>Avail</th>
</tr>
<th> </th>
<th> </th>
<th align="right" ><!-- TMPL_VAR name="total" --></th>
+ <th align="right" ><!-- TMPL_VAR name="totordered" --></th>
<th align="right" ><!-- TMPL_VAR name="totspent" --></th>
<th align="right" ><!-- TMPL_VAR name="totavail" --></th>
</tr>
<td align="center"><!-- TMPL_VAR name="budget_owner" --></td>
<td align="center"><!-- TMPL_VAR name="budget_branchname" --></td>
<td align="right" ><!-- TMPL_VAR name="budget_amount" --></td>
+ <td align="right" ><!-- TMPL_VAR name="budget_ordered" --></td>
<td align="right" ><!-- TMPL_VAR name="budget_spent" --></td>
<td align="right" ><!-- TMPL_VAR name="budget_avail" --></td>
</tr>
<!-- /TMPL_IF -->
</title>
<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
+<script type="text/javascript" src="<!-- TMPL_VAR name="themelang" -->/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
+<script type="text/JavaScript">
+//<![CDATA[
+ $(document).ready(function() {
+ $("#files").tablesorter({
+ headers: {
+ 5: { sorter: false },
+ }
+ });
+ });
+//]]>
+</script>
+</head>
<body>
<!-- TMPL_INCLUDE NAME="header.inc" -->
<!-- TMPL_INCLUDE NAME="acquisitions-search.inc" -->
-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> ›<a href="/cgi-bin/koha/acqui/supplier.pl?supplierid=<!-- TMPL_VAR NAME="booksellerid" -->"><!-- TMPL_VAR NAME="booksellername" --></a> › <a href="/cgi-bin/koha/acqui/basket.pl?basketno=<!-- TMPL_VAR name="basketno" -->">Basket #<!-- TMPL_VAR name="basketno" --></a> › Add orders from iso2709 file</div>
+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> › <a href="/cgi-bin/koha/acqui/supplier.pl?supplierid=<!-- TMPL_VAR NAME="booksellerid" -->"><!-- TMPL_VAR NAME="booksellername" --></a> › <a href="/cgi-bin/koha/acqui/basket.pl?basketno=<!-- TMPL_VAR name="basketno" -->">Basket #<!-- TMPL_VAR name="basketno" --></a> › Add orders from iso2709 file</div>
<div id="doc3" class="yui-t2">
<div id="bd">
<div id="yui-main">
<!-- /TMPL_IF -->
<!-- TMPL_ELSE -->
<div>
- <table>
+ <table id="files">
+ <thead>
<tr>
<th>File name</th>
<th>Comments</th>
<th># Bibs</th>
<th> </th>
</tr>
+ </thead>
+ <tbody>
<!-- TMPL_LOOP name="batch_list" -->
<tr>
<td><!-- TMPL_VAR name="file_name" --></td>
<td><a href="<!-- TMPL_VAR name="scriptname" -->?import_batch_id=<!-- TMPL_VAR name="import_batch_id" -->&basketno=<!-- TMPL_VAR name="basketno" -->&booksellerid=<!-- TMPL_VAR name="booksellerid" -->">Add orders</a></td>
</tr>
<!-- /TMPL_LOOP -->
+ </tbody>
</table>
</div>
<!-- /TMPL_IF -->
</div>
</div>
</body>
-</html>
\ No newline at end of file
+</html>
new YAHOO.widget.Button("closebutton");
<!-- /TMPL_IF -->
new YAHOO.widget.Button("basketheadbutton");
+ new YAHOO.widget.Button("exportbutton");
new YAHOO.widget.Button("delbasketbutton");
}
//]]>
<!-- TMPL_ELSE -->
<li><a href="<!-- TMPL_VAR name="script_name" -->?op=close&basketno=<!-- TMPL_VAR name="basketno" -->&booksellerid=<!-- TMPL_VAR name="booksellerid" -->" class="button" id="closebutton">Close this basket</a></li>
<!-- /TMPL_IF -->
+ <li><a href="<!-- TMPL_VAR name="script_name" -->?op=export&basketno=<!-- TMPL_VAR name="basketno" -->&booksellerid=<!-- TMPL_VAR name="booksellerid" -->" class="button" id="exportbutton">Export this basket as CSV</a></li>
</ul>
</div>
<!-- TMPL_ELSE -->
<!-- TMPL_IF NAME="basketbooksellernote" --><p>Vendor note: <!-- TMPL_VAR NAME="basketbooksellernote" --></p><!-- /TMPL_IF -->
<!-- TMPL_IF NAME="basketcontractno" -->
<p>Contract number: <!-- TMPL_VAR NAME="basketcontractno" --></p>
- <p>Contract name: <a href="../admin/aqcontract.pl?op=add_form&contractnumber=<!-- TMPL_VAR NAME="basketcontractno" -->"><!-- TMPL_VAR NAME="basketcontractname" --></a></p>
+ <p>Contract name: <a href="../admin/aqcontract.pl?op=add_form&contractnumber=<!-- TMPL_VAR NAME="basketcontractno" -->&booksellerid=<!-- TMPL_VAR NAME="booksellerid" -->"><!-- TMPL_VAR NAME="basketcontractname" --></a></p>
<!-- /TMPL_IF -->
<!-- TMPL_IF NAME="authorisedbyname" --><p>Managed by: <!-- TMPL_VAR NAME="authorisedbyname" --></p><!-- /TMPL_IF -->
<!-- TMPL_IF NAME="creationdate" --><p>Open on: <!-- TMPL_VAR NAME="creationdate" --></p><!-- /TMPL_IF -->
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);
+ }
+}
+
</script>
</head>
<body>
</div>
<!-- TMPL_IF NAME="grouping" -->
<div id="bd">
- <div class="yui-gc">
- <div class="yui-u first">
+ <div class="yui-g">
+ <div class="yui-u grouping">
<form action="<!-- TMPL_VAR name="scriptname" -->" method="post" name="basketgroups" id="basketgroups">
<div id="groups">
</div>
- <div class="yui-u grouping">
- <form action="" method="post">
+ <div class="yui-u first">
+ <form action="" method="post" id="groupingform" onsubmit="return submitForm(this)">
<fieldset id="various" class='various' >
<h3><label for="basketgroupname">Basketgroup Name:</label></h3>
<input type="text" name="basketgroupname" id="basketgroupname" value="<!-- TMPL_VAR NAME="name" -->" />
<div class="yui-g">
<div id="bgtabs" class="yui-navset">
<ul class="yui-nav">
- <li class="selected"><a href="#opened"><em>Opened</em></a></li>
- <li><a href="#closed"><em>Closed</em></a></li>
+ <li<!-- TMPL_UNLESS NAME="closed" --> class="selected"<!-- /TMPL_UNLESS -->><a href="#opened"><em>Opened</em></a></li>
+ <li<!-- TMPL_IF NAME="closed" --> class="selected"<!-- /TMPL_IF -->><a href="#closed"><em>Closed</em></a></li>
</ul>
<div class="yui-content">
<div id="opened">
<div id="breadcrumbs">
<a href="/cgi-bin/koha/mainpage.pl">Home</a> ›
<a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> ›
+ <a href="/cgi-bin/koha/acqui/supplier.pl?supplierid=<!-- TMPL_VAR NAME="booksellerid" -->"><!-- TMPL_VAR name="booksellername" --></a> ›
<!-- TMPL_IF NAME="add_form" -->
<!-- TMPL_IF NAME="basketno" -->Edit basket '<!-- TMPL_VAR NAME="basketname" -->'
<!-- TMPL_ELSE -->add a basket to <!-- TMPL_VAR name="booksellername" -->
</li>
<!-- /TMPL_IF -->
<li>
- <label for="basketname">Basket name</label>
+ <label for="basketname" class="required">Basket name</label>
<input type="text" name="basketname" id="basketname" size="40" maxlength="80" value="<!-- TMPL_VAR NAME="basketname" -->" />
</li>
<li>
</fieldset>
</form>
<!-- /TMPL_IF -->
- <!-- TMPL_IF NAME="add_validate" -->
- <h3>Data recorded</h3>
- <META HTTP-EQUIV=Refresh CONTENT="0; URL=basket.pl?basketno=<!-- TMPL_VAR NAME="basketno" -->">
- <!-- /TMPL_IF -->
</div>
</div>
<div class="yui-b">
<th>Order</th>
<th>Summary</th>
<th>View Record</th>
- <th>Still on order</th>
+ <th>Quantity</th>
<th>Unit cost</th>
<th>Order cost</th>
<th> </th>
<!-- TMPL_IF NAME="publishercode" --><br />Publisher :<!-- TMPL_VAR NAME="publishercode" --><!--/TMPL_IF-->
</td>
<td><a href="/cgi-bin/koha/catalogue/showmarc.pl?id=<!-- TMPL_VAR NAME="biblionumber" -->" title="MARC" rel="gb_page_center[600,500]">MARC</a> | <a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&id=<!-- TMPL_VAR NAME="biblionumber" -->" title="MARC" rel="gb_page_center[600,500]">Card</a></td>
- <td><!-- TMPL_VAR NAME="quantrem" --> / <!-- TMPL_VAR NAME="quantity" --></td>
+ <td><!-- TMPL_VAR NAME="quantity" --></td>
<td><!-- TMPL_VAR NAME="ecost" --></td>
<td><!-- TMPL_VAR NAME="ordertotal" --></td>
<td>
<!--TMPL_ELSE-->
<h1><!-- TMPL_VAR NAME="name" --></h1>
<div class="yui-g">
- <div id="supplier-company-details" class="yui-u first">
- <p><strong>Company Name: </strong>
- <!-- TMPL_VAR NAME="name" --></p>
- <p><strong>Postal Address: </strong>
- <!-- TMPL_VAR NAME="postal" --></p>
- <p><strong>Physical Address: </strong>
- <!-- TMPL_VAR NAME="address1" --><!-- TMPL_VAR NAME="address2" --><!-- TMPL_VAR NAME="address3" --><!-- TMPL_VAR NAME="address4" --></p>
- <p><strong>Phone: </strong>
- <!-- TMPL_VAR NAME="phone" --></p>
- <p><strong>Fax: </strong>
- <!-- TMPL_VAR NAME="fax" --></p>
- <!-- TMPL_IF NAME="url" --> <p><strong>Web site: </strong>
- <a href="<!-- TMPL_VAR NAME="url" -->"><!-- TMPL_VAR NAME="url" --></a></p><!-- /TMPL_IF -->
- </div>
- <div id="supplier-contact-details" class="yui-u">
- <h3>Contact details</h3>
- <p><strong>Contact name: </strong>
- <!-- TMPL_VAR NAME="contact" --></p>
- <p><strong>Position: </strong>
- <!-- TMPL_VAR NAME="contpos" --></p>
- <p><strong>Phone: </strong>
- <!-- TMPL_VAR NAME="contphone" --></p>
- <p><strong>Alternative phone: </strong>
- <!-- TMPL_VAR NAME="contaltphone" --></p>
- <p><strong>Fax: </strong>
- <!-- TMPL_VAR NAME="contfax" --></p>
- <!-- TMPL_IF NAME="contemail" --><p><strong>Email: </strong>
- <a href="mailto:<!-- TMPL_VAR NAME="contemail" -->"><!-- TMPL_VAR NAME="contemail" --></a></p><!-- /TMPL_IF -->
- <!-- TMPL_IF NAME="contnotes" --><p><strong>Notes: </strong>
- <!-- TMPL_VAR NAME="contnotes" --></p><!-- /TMPL_IF -->
-
- </div>
+ <div id="supplier-company-details" class="yui-u first">
+ <h3>Supplier details</h3>
+ <div class="rows">
+ <ol>
+ <li><span class="label">Company Name: </span><!-- TMPL_VAR NAME="name" --></li>
+ <li><span class="label">Postal Address: </span><!-- TMPL_VAR NAME="postal" --></li>
+ <li><span class="label">Physical Address: </span><!-- TMPL_VAR NAME="address1" --><!-- TMPL_VAR NAME="address2" --><!-- TMPL_VAR NAME="address3" --><!-- TMPL_VAR NAME="address4" --></li>
+ <li><span class="label">Phone: </span><!-- TMPL_VAR NAME="phone" --></li>
+ <li><span class="label">Fax: </span><!-- TMPL_VAR NAME="fax" --></li>
+ <!-- TMPL_IF NAME="url" -->
+ <li><span class="label">Web site: </span><a href="<!-- TMPL_VAR NAME="url" -->"><!-- TMPL_VAR NAME="url" --></a></li>
+ <!-- /TMPL_IF -->
+ </ol>
+ </div>
+ </div>
+ <div id="supplier-contact-details" class="yui-u">
+ <h3>Contact details</h3>
+ <div class="rows">
+ <ol>
+ <li><span class="label">Contact name: </span><!-- TMPL_VAR NAME="contact" --></li>
+ <li><span class="label">Position: </span><!-- TMPL_VAR NAME="contpos" --></li>
+ <li><span class="label">Phone: </span><!-- TMPL_VAR NAME="contphone" --></li>
+ <li><span class="label">Alternative phone: </span><!-- TMPL_VAR NAME="contaltphone" --></li>
+ <li><span class="label">Fax: </span><!-- TMPL_VAR NAME="contfax" --></li>
+ <!-- TMPL_IF NAME="contemail" -->
+ <li><span class="label">Email: </span><a href="mailto:<!-- TMPL_VAR NAME="contemail" -->"><!-- TMPL_VAR NAME="contemail" --></a></li>
+ <!-- /TMPL_IF -->
+ <!-- TMPL_IF NAME="contnotes" -->
+ <li><span class="label">Notes: </span><!-- TMPL_VAR NAME="contnotes" --></li>
+ <!-- /TMPL_IF -->
+ </ol>
+ </div>
+ </div>
</div>
<div id="supplier-ordering-information" class="yui-g">
<h3>Ordering information</h3>
<!-- TMPL_IF NAME="notes" --><p><strong>Notes: </strong>
<!-- TMPL_VAR NAME="notes" --></p><!-- /TMPL_IF -->
</div>
+
+ <!-- TMPL_IF name="contracts" -->
+ <h3>Contract(s)</h3>
+ <table>
+ <tr>
+ <th scope="col">Name</th>
+ <th scope="col">Description</th>
+ <th scope="col">Start date</th>
+ <th scope="col">End date</th>
+ <th scope="col" colspan="2"> </th>
+ </tr>
+ <!-- TMPL_LOOP NAME="contracts" -->
+ <!-- TMPL_IF NAME="__even__" --><tr class="highlight"><!-- TMPL_ELSE --><tr><!-- /TMPL_IF -->
+ <td>
+ <a href="/cgi-bin/koha/admin/aqcontract.pl?op=add_form&contractnumber=<!-- TMPL_VAR NAME="contractnumber" -->&booksellerid=<!-- TMPL_VAR name="booksellerid" -->"><!-- TMPL_VAR NAME="contractname" --></a>
+ </td>
+ <td><!-- TMPL_VAR NAME="contractdescription" --></td>
+ <td><!-- TMPL_VAR NAME="contractstartdate" --></td>
+ <td><!-- TMPL_VAR NAME="contractenddate" --></td>
+ <td><a href="/cgi-bin/koha/admin/aqcontract.pl?op=add_form&contractnumber=<!-- TMPL_VAR NAME="contractnumber" -->&booksellerid=<!-- TMPL_VAR name="booksellerid" -->">Edit</a></td>
+ <td><a href="/cgi-bin/koha/admin/aqcontract.pl?op=delete_confirm&contractnumber=<!-- TMPL_VAR NAME="contractnumber" -->&booksellerid=<!-- TMPL_VAR name="booksellerid" -->">Delete</a></td>
+ </tr>
+ <!-- /TMPL_LOOP -->
+ </table>
+ <!-- /TMPL_IF -->
+
<!--/TMPL_IF-->
</div>
<!-- TMPL_IF name="add_form" -->
<!-- add or modify a budget period -->
-<!--TMPL_IF Name="duplicates"--><!--TMPL_INCLUDE Name="duplicates.inc"--><!--/TMPL_IF-->
+
<!-- TMPL_IF name="budget_period_id" -->
<h3>Modify root budget</h3>
<!-- TMPL_ELSE -->
<!-- display information about the budget period that must be added or modified -->
<!-- ################################################################################# -->
<input type="hidden" name="op" value="add_validate" />
- <input type="hidden" name="confirm_not_duplicate" value="<!--TMPL_VAR Name="confirm_not_duplicate"-->" />
<input type="hidden" name="budget_period_id" value="<!-- TMPL_VAR name="budget_period_id" -->" />
<ol>
<li>
<!-- DEFAULT display budget periods list -->
<!-- TMPL_IF name="else" -->
<h2>Root budgets administration</h2>
- <!-- TMPL_IF name="cur" --><b>Currency = <!-- TMPL_VAR name="cur" --></b><!-- /TMPL_IF -->
+ <p><!-- TMPL_IF name="cur" --><b>Currency = <!-- TMPL_VAR name="cur" --></b><!-- /TMPL_IF --></p>
<table id="periodsh">
<thead>
<tr>
<td><a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=<!-- TMPL_VAR name="budget_period_id" -->" title="View budgets for <!-- TMPL_VAR name="budget_period_description" -->"><!-- TMPL_VAR name="budget_period_description" --></a></td>
<td><!-- TMPL_VAR name="budget_period_startdate" --></td>
<td><!-- TMPL_VAR name="budget_period_enddate" --></td>
- <td><!-- TMPL_IF name="budget_period_active" --><span style="color:#669900;">Active</span> <!-- TMPL_ELSE --><!-- /TMPL_IF --> </td>
- <td> <!-- TMPL_IF name="budget_period_locked" --><span style="color:#cc0000;">Locked</span> <!-- TMPL_ELSE --><!-- /TMPL_IF --> </td>
+ <td><!-- TMPL_IF name="budget_period_active" --><span style="color:green;">Active</span> <!-- TMPL_ELSE --><!-- /TMPL_IF --> </td>
+ <td> <!-- TMPL_IF name="budget_period_locked" --><span style="color:green;">Locked</span> <!-- TMPL_ELSE --><!-- /TMPL_IF --> </td>
<td align='right'><!-- TMPL_VAR NAME="budget_period_total" --></td>
<td>
<a href="<!-- TMPL_VAR name="script_name" -->?op=add_form&budget_period_id=<!-- TMPL_VAR name="budget_period_id" escape="HTML" -->">Edit</a>
<!-- TMPL_IF name="add_form" -->
<script type="text/javascript">
//<![CDATA[
-
- var actTotal ="";
+//
+ var actTotal ="";
function ownerRemove(f) {
document.getElementById('budget_owner_name').innerHTML = '';
<!-- TMPL_IF name="else" -->
<h1>Budgets for '<!-- TMPL_VAR name="budget_period_description" -->'</h1>
-
<table id="budgeth">
<thead>
<tr>
<th>Base-level<br />spent</th>
<th>Base-level<br />remaining</th>
<th class="tooltipcontent"> </th>
- <!-- Owner</th>
- <th>Branch</th>
- <th>Note</th> -->
<th>Actions</th>
</tr>
</thead>
</tr>
<!-- /TMPL_LOOP -->
<!-- TMPL_ELSE -->
- <tr><td colspan="9">No budget found</td></tr>
+ <tr><td colspan="12">No budget found</td></tr>
<!-- /TMPL_IF -->
</tbody>
</table>
-<p><b>Currency = <!-- TMPL_VAR NAME="cur" --> <!-- TMPL_VAR NAME="cur_format" --></b></p>
+<!-- TMPL_IF name="cur" --><p><b>Currency = <!-- TMPL_VAR NAME="cur" --> <!-- TMPL_VAR NAME="cur_format" --></b></p><!-- /TMPL_IF -->
<!-- TMPL_IF NAME="pagination_bar" --><div class="paginationBar"><!-- TMPL_VAR NAME="pagination_bar" --></div><!-- /TMPL_IF -->
<!-- /TMPL_IF --> <!-- else -->
<li>
<span class="label">Budget Parent: </span>
<!-- TMPL_VAR NAME="budget_parent_name" -->
+ <!-- TMPL_VAR NAME="budget_parent_id" --> - <!-- TMPL_VAR NAME="budget_parent_name" -->
<input type="hidden" name="budget_parent_id" value="<!-- TMPL_VAR NAME="budget_parent_id" -->" />
</li>
<!-- /TMPL_IF -->
›
<a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
›
- <a href="/cgi-bin/koha/acqui/supplier.pl?supplierid=<!--TMPL_VAR name="booksellerid" -->"><!-- TMPL_VAR name="name" --></a>
+ <a href="/cgi-bin/koha/acqui/supplier.pl?supplierid=<!--TMPL_VAR name="booksellerid" -->"><!-- TMPL_VAR name="booksellername" --></a>
›
<!-- TMPL_IF NAME="add_form" -->
- <a href="/cgi-bin/koha/admin/aqcontract.pl">Contracts</a>
+ <a href="/cgi-bin/koha/admin/aqcontract.pl?booksellerid=<!-- TMPL_VAR NAME="booksellerid" -->">Contracts</a>
›
<!-- TMPL_IF NAME="contractnumber" -->Modify contract '<!-- TMPL_VAR NAME="contractname" -->'
<!-- TMPL_ELSE -->New contract
<!-- /TMPL_IF -->
<!-- /TMPL_IF -->
<!-- TMPL_IF NAME="add_validate" -->
- <a href="/cgi-bin/koha/admin/aqcontract.pl">Contracts</a>
+ <a href="/cgi-bin/koha/admin/aqcontract.pl?booksellerid=<!-- TMPL_VAR NAME="booksellerid" -->">Contracts</a>
› Data recorded
<!-- /TMPL_IF -->
<!-- TMPL_IF NAME="delete_confirm" -->
- <a href="/cgi-bin/koha/admin/aqcontract.pl">Contracts</a>
+ <a href="/cgi-bin/koha/admin/aqcontract.pl?booksellerid=<!-- TMPL_VAR NAME="booksellerid" -->">Contracts</a>
› Confirm Deletion of Contract <!-- TMPL_VAR NAME="contractnumber" -->
<!-- /TMPL_IF -->
<!-- TMPL_IF NAME="delete_confirmed" -->
- <a href="/cgi-bin/koha/admin/aqcontract.pl">Contracts</a> › Contract Deleted
+ <a href="/cgi-bin/koha/admin/aqcontract.pl?booksellerid=<!-- TMPL_VAR NAME="booksellerid" -->">Contracts</a> › Contract Deleted
<!-- /TMPL_IF -->
<!-- TMPL_IF NAME="else" -->Contracts<!-- /TMPL_IF -->
</div>
<!-- TMPL_IF NAME="add_form" -->
<form name="Aform" action="<!-- TMPL_VAR NAME="script_name" -->" method="post">
<input type="hidden" name="op" value="add_validate" />
+ <input type="hidden" name="booksellerid" value="<!-- TMPL_VAR NAME="booksellerid" -->" />
<input type="hidden" name="checked" value="0" />
<!-- TMPL_IF NAME="contractnumber" -->
- <h1>Modify contract <!-- TMPL_VAR NAME="contractname" -->
- <select id="booksellerid" name="booksellerid">
- <!-- TMPL_LOOP NAME="booksellerloop" -->
- <!-- TMPL_IF NAME="selected" -->
- <option value="<!-- TMPL_VAR NAME="id" -->" selected="selected"><!-- TMPL_VAR NAME="name" --></option>
- <!-- TMPL_ELSE -->
- <option value="<!-- TMPL_VAR NAME="id" -->"><!-- TMPL_VAR NAME="name" --></option>
- <!-- /TMPL_IF -->
- <!-- /TMPL_LOOP -->
- </select>
- </h1>
+ <h1>Modify contract <!-- TMPL_VAR NAME="contractname" --> for <!-- TMPL_VAR NAME="booksellername" --></h1>
<!-- TMPL_ELSE -->
- <h1>New contract</h1>
+ <h1>New contract for <!-- TMPL_VAR NAME="booksellername" --></h1>
<!-- /TMPL_IF -->
<fieldset class="rows">
<ol>
<li><label for="contractdescription">Description</label>
<input type="text" name="contractdescription" id="contractdescription" size="40" maxlength="80" value="<!-- TMPL_VAR NAME="contractdescription" -->" />
</li>
- <li><label for="booksellerid">Vendor</label>
- <select id="booksellerid" name="booksellerid">
- <!-- TMPL_LOOP NAME="booksellerloop" -->
- <!-- TMPL_IF NAME="selected" -->
- <option value="<!-- TMPL_VAR NAME="id" -->" selected="selected"><!-- TMPL_VAR NAME="name" --></option>
- <!-- TMPL_ELSE -->
- <option value="<!-- TMPL_VAR NAME="id" -->"><!-- TMPL_VAR NAME="name" --></option>
- <!-- /TMPL_IF -->
- <!-- /TMPL_LOOP -->
- </select>
- </li>
<li><label for="contractstartdate" class="required">Start date *</label>
<input type="text" name="contractstartdate" id="contractstartdate" value="<!-- TMPL_VAR NAME="contractstartdate" -->" maxlength="10" size="10"/>
<img src="<!-- TMPL_VAR Name="themelang" -->/lib/calendar/cal.gif" id="contractstartdate_button" alt="Show Calendar" />
<li><a id="newcontract" href="/cgi-bin/koha/admin/aqcontract.pl?op=add_form&booksellerid=<!-- TMPL_VAR name="booksellerid" -->">New Contract</a></li>
</ul>
</div>
- <h2>Contract(s) of <!-- TMPL_VAR name="name" --></h2>
+ <h2>Contract(s) of <!-- TMPL_VAR name="booksellername" --></h2>
<!-- TMPL_IF name="loop" -->
<table>
<tr>
<th scope="col" colspan="2"> </th>
</tr>
<!-- TMPL_LOOP NAME="loop" -->
- <!-- TMPL_IF NAME="toggle" -->
- <tr class="highlight">
- <!-- TMPL_ELSE -->
- <tr>
- <!-- /TMPL_IF -->
- <td>
- <a href="<!-- TMPL_VAR NAME="script_name" -->?op=add_form&contractnumber=<!-- TMPL_VAR NAME="contractnumber" -->"><!-- TMPL_VAR NAME="contractname" --></a>
+ <!-- TMPL_IF NAME="__even__" --><tr class="highlight"><!-- TMPL_ELSE --><tr><!-- /TMPL_IF -->
+ <td>
+ <a href="<!-- TMPL_VAR NAME="script_name" -->?op=add_form&contractnumber=<!-- TMPL_VAR NAME="contractnumber" -->"><!-- TMPL_VAR NAME="contractname" --></a>
</td>
<td><!-- TMPL_VAR NAME="contractdescription" --></td>
<td><!-- TMPL_VAR NAME="contractstartdate" --></td>
<link href="<!-- TMPL_VAR NAME="yuipath" -->/menu/assets/menu.css" rel="stylesheet" type="text/css" />
<link href="<!-- TMPL_VAR NAME="yuipath" -->/container/assets/skins/sam/container.css" rel="stylesheet" type="text/css" />
-</head>
-<body>
-<!-- TMPL_INCLUDE NAME="header.inc" -->
-<!-- TMPL_INCLUDE NAME="budgets-admin-search.inc" -->
-
<script src="<!-- TMPL_VAR NAME="yuipath" -->/yahoo/yahoo.js" type="text/javascript"></script>
<script src="<!-- TMPL_VAR NAME="yuipath" -->/event/event.js" type="text/javascript"></script>
<script src="<!-- TMPL_VAR NAME="yuipath" -->/dom/dom.js" type="text/javascript"></script>
<script src="<!-- TMPL_VAR NAME="yuipath" -->/container/menu.js" type="text/javascript"></script>
<script src="<!-- TMPL_VAR NAME="yuipath" -->/yahoo-dom-event/yahoo-dom-event.js" type="text/javascript"></script>
-
<script type="text/javascript" src="<!-- TMPL_VAR NAME='themelang' -->/js/acq.js"></script>
<script type="text/javascript">
// ---------------------------------------------------------------------
</script>
-
+<title>
+Budget planning
+</title>
+</head>
+<body>
+<!-- TMPL_INCLUDE NAME="header.inc" -->
+<!-- TMPL_INCLUDE NAME="budgets-admin-search.inc" -->
<div id="breadcrumbs">
<a href="/cgi-bin/koha/mainpage.pl">Home</a> ›
<!-- TMPL_IF NAME="budget_lines" -->
+ <!-- TMPL_IF name="cur" --><p><b>Currency = <!-- TMPL_VAR name="cur" --> <!-- TMPL_VAR NAME="cur_format" --></b></p><!-- /TMPL_IF -->
+
<table id="plan" width="100%">
<thead>
<tr>
<!-- TMPL_ELSE -->
<span><b>Cells contain estimated values only.</b></span><br />
<!-- /TMPL_IF -->
- <span><b>Currency = <!-- TMPL_VAR NAME="cur" --> <!-- TMPL_VAR NAME="cur_format" --></b></span><br />
<!-- TMPL_IF name="budget_period_locked" -->
<!-- <input STYLE="background: gray;" type="submit" value="Save" disabled='disabled'/> -->
<!-- TMPL_ELSE -->
<!-- TMPL_IF NAME="delete_confirm" --><!-- TMPL_IF NAME="totalgtzero" -->Cannot Delete: Category <!-- TMPL_VAR NAME="categorycode" escape="html" --> in Use<!-- TMPL_ELSE -->Confirm Deletion of Category '<!-- TMPL_VAR NAME="categorycode" escape="html" -->'<!-- /TMPL_IF --><!-- /TMPL_IF -->
<!-- TMPL_IF NAME="delete_confirmed" -->Category Deleted<!-- /TMPL_IF --></title>
<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
+<!-- TMPL_INCLUDE NAME="calendar.inc" -->
<script type="text/javascript">
//<![CDATA[
//
_alertString += "- upperagelimit is not a number\n";
}
+ if(ff.enrolmentperioddate.value && ff.enrolmentperiod.value){
+ document.getElementById('enrolmentmessage').className = "error";
+ return false;
+ }
if (ok) { // if there is a problem
alert(_alertString);
<li><label for="categorycode">Category code: </label> <input type="text" name="categorycode" id="categorycode" size="10" maxlength="10" onblur="toUC(this)" /></li>
<!-- /TMPL_IF -->
<li><label for="description">Description: </label> <input type="text" name="description" id="description" size="40" maxlength="80" value="<!-- TMPL_VAR NAME="description" escape="html" -->" /></li>
- <li><label for="enrolmentperiod">Enrollment period: </label> <input type="text" name="enrolmentperiod" id="enrolmentperiod" size="3" maxlength="3" value="<!-- TMPL_VAR NAME="enrolmentperiod" -->" /> months</li>
+ <li><label for="enrolmentperiod">Enrollment period: </label>
+ <input type="text" name="enrolmentperiod" id="enrolmentperiod" size="3" maxlength="3" value="<!-- TMPL_IF NAME="enrolmentperiod" --><!-- TMPL_VAR NAME="enrolmentperiod" --><!-- /TMPL_IF -->" /> months <br />
+ <label for="enrolmentperioddate">Until date: </label>
+ <input type="text" name="enrolmentperioddate" id="enrolmentperioddate" value="<!-- TMPL_VAR NAME="enrolmentperioddate" -->" /> <img src="<!-- TMPL_VAR Name="themelang" -->/lib/calendar/cal.gif" id="enrolmentperioddate_button" alt="Show Calendar" />
+ <script type="text/javascript">
+ //<![CDATA[
+ Calendar.setup({
+ inputField : "enrolmentperioddate",
+ ifFormat : "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->",
+ button : "enrolmentperioddate_button"
+ });
+ //]]>
+ </script>
+ <div id="enrolmentmessage" class="hint">Cannot have "months" and "until date" at the same time</div>
+ </li>
<li><label for="dateofbirthrequired">Age required: </label> <input type="text" name="dateofbirthrequired" id="dateofbirthrequired" value="<!-- TMPL_VAR NAME="dateofbirthrequired" -->" size="3" maxlength="3" /> years</li>
<li><label for="upperagelimit">Upperage limit: </label> <input type="text" name="upperagelimit" id="upperagelimit" size="3" maxlength="3" value="<!-- TMPL_VAR NAME="upperagelimit" -->" /> years</li>
<li><label for="enrolmentfee">Enrollment fee: </label><input type="text" name="enrolmentfee" id="enrolmentfee" size="6" value="<!-- TMPL_VAR NAME="enrolmentfee" -->" /></li>
<table>
<tr><th scope="row">Category code: </th><td><!-- TMPL_VAR NAME="categorycode" escape="html" --></td></tr>
<tr><th scope="row">Description: </th><td><!-- TMPL_VAR NAME="description" escape="html" --></td></tr>
- <tr><th scope="row">Enrollment period: </th><td><!-- TMPL_VAR NAME="enrolmentperiod" --> months</td></tr>
+ <tr><th scope="row">Enrollment period: </th>
+ <td>
+ <!-- TMPL_IF NAME="enrolmentperiod" -->
+ <!-- TMPL_VAR NAME="enrolmentperiod" --> months
+ <!-- TMPL_ELSE -->
+ until <!-- TMPL_VAR NAME="enrolmentperioddate" -->
+ <!-- /TMPL_IF -->
+ </td>
+ </tr>
<tr><th scope="row">Age required: </th><td><!-- TMPL_VAR NAME="dateofbirthrequired" --> years</td></tr>
<tr><th scope="row">Upperage limit: </th><td><!-- TMPL_VAR NAME="upperagelimit" --> years</td></tr>
<tr><th scope="row">Enrollment fee: </th><td><!-- TMPL_VAR NAME="enrolmentfee" --></td></tr>
<!-- TMPL_IF NAME="type_S" -->Staff<!-- /TMPL_IF -->
<!-- TMPL_IF NAME="type_X" -->Statistical<!-- /TMPL_IF -->
</td>
- <td><!-- TMPL_VAR NAME="enrolmentperiod" --> months</td>
+ <td>
+ <!-- TMPL_IF NAME="enrolmentperiod" -->
+ <!-- TMPL_VAR NAME="enrolmentperiod" --> months
+ <!-- TMPL_ELSE -->
+ until <!-- TMPL_VAR NAME="enrolmentperioddate" -->
+ <!-- /TMPL_IF -->
+
+ </td>
<td><!-- TMPL_VAR NAME="dateofbirthrequired" --> years</td>
<td><!-- TMPL_VAR NAME="upperagelimit" --> years</td>
<td><!-- TMPL_VAR NAME="enrolmentfee" --></td>
<p>NEKLS also has a great page (<a href="http://www.nexpresslibrary.org/training/reports-training/" target="_new">http://www.nexpresslibrary.org/training/reports-training/</a>) with a list of reports they have written.</p>
+<p><strong>Can I have run-time defined parameters?</strong></p>
-<!-- TMPL_INCLUDE NAME="help-bottom.inc" -->
\ No newline at end of file
+<p>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>>.</p>
+<ul>
+<li>The << and >> are just delimiters. You must put << at the beginning and >> at the end of your parameter</li>
+<li>The <strong>Question to ask</strong> will be displayed on the left of the string to enter.
+<li>The <strong>authorised_value</strong> can be omitted if not applicable. If it contains an authorised value category, or <strong>branches</strong> or <strong>itemtype</strong> or <strong>categorycode</strong>, a list with the Koha authorised values will be displayed instead of a free field</li>
+</ul>
+<p>Note that you can have more than one parameter in a given SQL</p>
+<p>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</p>
+<p>Sample :</p>
+<ul><li>SELECT surname,firstname FROM borrowers WHERE branchcode=<<Enter patrons library|branches>> AND surname like <<Enter filter for patron surname (% if none)>></li></ul>
+
+<!-- TMPL_INCLUDE NAME="help-bottom.inc" -->
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
<title>Koha › Patrons <!-- TMPL_IF NAME="searching" -->› Search Results<!-- /TMPL_IF --></title>
<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
-<script type="text/javascript" src="<!-- TMPL_VAR name="themelang" -->/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
-<script type="text/javascript">//<![CDATA[
-$(document).ready(function() {
- $("#memberresultst").tablesorter({
- sortList: [[1,0]],
- widgets: ['zebra']
- });
-});
-//]]>
-</script>
</head>
<body>
<!-- TMPL_INCLUDE NAME="header.inc" -->
<div class="browse">
Browse by last name:
- <a href="/cgi-bin/koha/members/member.pl?surname=a">A</a>
- <a href="/cgi-bin/koha/members/member.pl?surname=b">B</a>
- <a href="/cgi-bin/koha/members/member.pl?surname=c">C</a>
- <a href="/cgi-bin/koha/members/member.pl?surname=d">D</a>
- <a href="/cgi-bin/koha/members/member.pl?surname=e">E</a>
- <a href="/cgi-bin/koha/members/member.pl?surname=f">F</a>
- <a href="/cgi-bin/koha/members/member.pl?surname=g">G</a>
- <a href="/cgi-bin/koha/members/member.pl?surname=h">H</a>
- <a href="/cgi-bin/koha/members/member.pl?surname=i">I</a>
- <a href="/cgi-bin/koha/members/member.pl?surname=j">J</a>
- <a href="/cgi-bin/koha/members/member.pl?surname=k">K</a>
- <a href="/cgi-bin/koha/members/member.pl?surname=l">L</a>
- <a href="/cgi-bin/koha/members/member.pl?surname=m">M</a>
- <a href="/cgi-bin/koha/members/member.pl?surname=n">N</a>
- <a href="/cgi-bin/koha/members/member.pl?surname=o">O</a>
- <a href="/cgi-bin/koha/members/member.pl?surname=p">P</a>
- <a href="/cgi-bin/koha/members/member.pl?surname=q">Q</a>
- <a href="/cgi-bin/koha/members/member.pl?surname=r">R</a>
- <a href="/cgi-bin/koha/members/member.pl?surname=s">S</a>
- <a href="/cgi-bin/koha/members/member.pl?surname=t">T</a>
- <a href="/cgi-bin/koha/members/member.pl?surname=u">U</a>
- <a href="/cgi-bin/koha/members/member.pl?surname=v">V</a>
- <a href="/cgi-bin/koha/members/member.pl?surname=w">W</a>
- <a href="/cgi-bin/koha/members/member.pl?surname=x">X</a>
- <a href="/cgi-bin/koha/members/member.pl?surname=y">Y</a>
- <a href="/cgi-bin/koha/members/member.pl?surname=z">Z</a>
+ <!-- TMPL_LOOP name="letters" -->
+ <a href="/cgi-bin/koha/members/member.pl?quicksearch=1&surname=<!-- TMPL_VAR NAME="letter" -->"><!-- TMPL_VAR NAME="letter" --></a>
+ <!-- /TMPL_LOOP -->
</div>
</div>
</div>
- <div role="search" class="yui-b">
- <!-- TMPL_INCLUDE NAME="search.tmpl" -->
- </div>
</div>
</div>
+<script type="text/javascript" src="<!-- TMPL_VAR name="themelang" -->/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
+<script type="text/javascript">//<![CDATA[
+$(document).ready(function() {
+ $("#memberresultst").tablesorter({
+ sortList: [[1,0]],
+ widgets: ['zebra']
+ });
+});
+//]]>
+</script>
<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->
<td>
<select name="<!-- TMPL_VAR NAME="name" -->_value">
<!-- TMPL_LOOP NAME="values" -->
- <option value="<!-- TMPL_VAR NAME="availablevalues"-->"><!-- TMPL_IF name="default" -->Default<!-- TMPL_ELSE --><!-- TMPL_VAR NAME="availablevalues" --><!-- /TMPL_IF --></option>
+ <option value="<!-- TMPL_VAR NAME="availablevalues"-->"><!-- TMPL_IF name="default" -->Default<!-- TMPL_ELSE --><!-- TMPL_VAR NAME="availablevalues" ESCAPE="HTML"--><!-- /TMPL_IF --></option>
<!-- /TMPL_LOOP -->
</select>
</td>
<h1>Confirm Custom Report</h1>
<p>Your report will be generated with the following SQL statement.</p>
<p>
-<!-- TMPL_VAR NAME="sql" -->
+<!-- TMPL_VAR NAME="sql" ESCAPE="HTML" -->
</p>
<form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
-<input type="hidden" name="sql" value="<!-- TMPL_VAR NAME="sql" ESCAPE="html" -->" />
+<input type="hidden" name="sql" value="<!-- TMPL_VAR NAME="sql" -->" />
<input type="hidden" name="type" value="<!-- TMPL_VAR NAME="type" -->" />
<p>You will need to save the report before you can execute it</p>
<fieldset class="action"><input type="hidden" name="phase" value="Save" />
</form>
<!-- /TMPL_IF -->
+<!-- TMPL_IF name="enter_params" -->
+ <form action='/cgi-bin/koha/reports/guided_reports.pl'>
+ <input type='hidden' name='phase' value='Run this report' />
+ <input type='hidden' name='reports' value="<!--TMPL_VAR name='reports' -->" />
+ <h1>Enter parameters for report <!-- TMPL_VAR name="name" -->:</h1>
+ <!-- TMPL_IF NAME="notes" --><p><!-- TMPL_VAR NAME="notes" --></p><!-- /TMPL_IF -->
+ <!-- TMPL_LOOP name="sql_params" -->
+ <p><!-- TMPL_VAR name="entry" -->: <!-- TMPL_VAR name='input' --></p>
+ <!-- /TMPL_LOOP -->
+ <input type='submit' value='Run the report'/>
+ </form>
+<!-- /TMPL_IF -->
+
<!-- TMPL_IF NAME="execute" -->
<h1><!-- TMPL_VAR NAME="name" --></h1>
<!-- TMPL_IF NAME="notes" --><p><!-- TMPL_VAR NAME="notes" --></p><!-- /TMPL_IF -->
<!-- TMPL_IF NAME="unlimited_total" --><p>Total number of rows matching the (unlimited) query is <!-- TMPL_VAR NAME="unlimited_total" -->.</p><!-- /TMPL_IF -->
+<!-- TMPL_VAR name="sql" -->
<!-- TMPL_VAR NAME='pagination_bar' DEFAULT="" -->
<!-- TMPL_UNLESS name="errors" -->
<table>
<li><label for="profile_description">Profile description :</label>
<textarea cols="50" rows="2" name="profile_description" id="profile_description"></textarea></li>
- <li><label for="profile_content" class="required">Profile marcfields :</label>
+ <label for="csv">CSV separator :</label>
+ <select name="csv_separator">
+ <option value=";">Colon (:)</option>
+ <option value="," selected="selected">Comma (,)</option>
+ <option value="|">Pipe (|)</option>
+ <option value=";">Semi-colon (;)</option>
+ <option value="#">Sharp (#)</option>
+ <option value=" ">Space ( )</option>
+ <option value="\t">Tabulation (\t)</option>
+ </select>
+ <br /><br />
+
+ <label for="field_separator">Field separator :</label>
+ <select name="field_separator">
+ <option value=";">Colon (:)</option>
+ <option value=",">Comma (,)</option>
+ <option value="|">Pipe (|)</option>
+ <option value=";">Semi-colon (;)</option>
+ <option value="#" selected="selected">Sharp (#)</option>
+ <option value=" ">Space ( )</option>
+ <option value="\t">Tabulation (\t)</option>
+ </select>
+ <br /><br />
+
+ <label for="subfield_separator">Subfield separator :</label>
+ <select name="subfield_separator">
+ <option value=";">Colon (:)</option>
+ <option value=",">Comma (,)</option>
+ <option value="|" selected="selected">Pipe (|)</option>
+ <option value=";">Semi-colon (;)</option>
+ <option value="#">Sharp (#)</option>
+ <option value=" ">Space ( )</option>
+ <option value="\t">Tabulation (\t)</option>
+ </select>
+ <br /><br />
+
+ <label for="csv">CSV separator :</label>
+ <select name="csv_separator">
+ <option value=";">Colon (:)</option>
+ <option value="," selected="selected">Comma (,)</option>
+ <option value="|">Pipe (|)</option>
+ <option value=";">Semi-colon (;)</option>
+ <option value="#">Sharp (#)</option>
+ <option value=" ">Space ( )</option>
+ <option value="\t">Tabulation (\t)</option>
+ </select>
+ <br /><br />
+
+ <label for="field_separator">Field separator :</label>
+ <select name="field_separator">
+ <option value=";">Colon (:)</option>
+ <option value=",">Comma (,)</option>
+ <option value="|">Pipe (|)</option>
+ <option value=";">Semi-colon (;)</option>
+ <option value="#" selected="selected">Sharp (#)</option>
+ <option value=" ">Space ( )</option>
+ <option value="\t">Tabulation (\t)</option>
+ </select>
+ <br /><br />
+
+ <label for="subfield_separator">Subfield separator :</label>
+ <select name="subfield_separator">
+ <option value=";">Colon (:)</option>
+ <option value=",">Comma (,)</option>
+ <option value="|" selected="selected">Pipe (|)</option>
+ <option value=";">Semi-colon (;)</option>
+ <option value="#">Sharp (#)</option>
+ <option value=" ">Space ( )</option>
+ <option value="\t">Tabulation (\t)</option>
+ </select>
+ <br /><br />
+
+ <label for="encoding">Encoding :</label>
+ <select name="encoding">
+ <!-- TMPL_LOOP NAME="encodings" -->
+ <option<!-- TMPL_IF EXPR="encoding eq 'utf8'" --> selected="selected" <!-- /TMPL_IF -->><!-- TMPL_VAR NAME="encoding" --></option>
+ <!-- /TMPL_LOOP -->
+ </select>
+ <br /><br />
+
+
+ <label for="profile_content">Profile marcfields :</label>
<textarea cols="50" rows="2" name="profile_content" id="profile_content"></textarea>
- <p>Define which fields or subfields you want to export, separated by pipes.<br />
- For example: 200|210$a|301
- </p></li></ol>
+ <p>You have to define which fields or subfields you want to export, separated by pipes.<br />
+ 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.<br />
+ Example : Personal name=200|Entry element=210$a|300|009
+ </p>
</fieldset>
<input type="hidden" name="action" value="create" />
<input type="submit" value="Submit" />
<li><label for="modify_profile_description">Profile description :</label>
<textarea cols="50" rows="2" name="profile_description" id="modify_profile_description"><!-- TMPL_VAR NAME="selected_profile_description" --></textarea>
+ <label for="csv">CSV separator :</label>
+ <select name="csv_separator">
+ <option value=";">Colon (:)</option>
+ <option value=","<!-- TMPL_IF EXPR="selected_csv_separator eq ','" --> selected="selected"<!-- /TMPL_IF -->>Comma (,)</option>
+ <option value="|"<!-- TMPL_IF EXPR="selected_csv_separator eq '|'" --> selected="selected"<!-- /TMPL_IF -->>Pipe (|)</option>
+ <option value=";"<!-- TMPL_IF EXPR="selected_csv_separator eq ';'" --> selected="selected"<!-- /TMPL_IF -->>Semi-colon (;)</option>
+ <option value="#"<!-- TMPL_IF EXPR="selected_csv_separator eq '#'" --> selected="selected"<!-- /TMPL_IF -->>Sharp (#)</option>
+ <option value=" "<!-- TMPL_IF EXPR="selected_csv_separator eq ' '" --> selected="selected"<!-- /TMPL_IF -->>Space ( )</option>
+ <option value="\t"<!-- TMPL_IF EXPR="selected_csv_separator eq '\t'" --> selected="selected"<!-- /TMPL_IF -->>Tabulation (\t)</option>
+ </select>
+ <br /><br />
+
+
+ <label for="field_separator">Field separator :</label>
+ <select name="field_separator">
+ <option value=";">Colon (:)</option>
+ <option value=","<!-- TMPL_IF EXPR="selected_field_separator eq ','" --> selected="selected"<!-- /TMPL_IF -->>Comma (,)</option>
+ <option value="|"<!-- TMPL_IF EXPR="selected_field_separator eq '|'" --> selected="selected"<!-- /TMPL_IF -->>Pipe (|)</option>
+ <option value=";"<!-- TMPL_IF EXPR="selected_field_separator eq ';'" --> selected="selected"<!-- /TMPL_IF -->>Semi-colon (;)</option>
+ <option value="#"<!-- TMPL_IF EXPR="selected_field_separator eq '#'" --> selected="selected"<!-- /TMPL_IF -->>Sharp (#)</option>
+ <option value=" "<!-- TMPL_IF EXPR="selected_field_separator eq ' '" --> selected="selected"<!-- /TMPL_IF -->>Space ( )</option>
+ <option value="\t"<!-- TMPL_IF EXPR="selected_field_separator eq '\t'" --> selected="selected"<!-- /TMPL_IF -->>Tabulation (\t)</option>
+ </select>
+ <br /><br />
+
+ <label for="subfield_separator">Subfield separator :</label>
+ <select name="subfield_separator">
+ <option value=";">Colon (:)</option>
+ <option value=","<!-- TMPL_IF EXPR="selected_subfield_separator eq ','" --> selected="selected"<!-- /TMPL_IF -->>Comma (,)</option>
+ <option value="|"<!-- TMPL_IF EXPR="selected_subfield_separator eq '|'" --> selected="selected"<!-- /TMPL_IF -->>Pipe (|)</option>
+ <option value=";"<!-- TMPL_IF EXPR="selected_subfield_separator eq ';'" --> selected="selected"<!-- /TMPL_IF -->>Semi-colon (;)</option>
+ <option value="#"<!-- TMPL_IF EXPR="selected_subfield_separator eq '#'" --> selected="selected"<!-- /TMPL_IF -->>Sharp (#)</option>
+ <option value=" "<!-- TMPL_IF EXPR="selected_subfield_separator eq ' '" --> selected="selected"<!-- /TMPL_IF -->>Space ( )</option>
+ <option value="\t"<!-- TMPL_IF EXPR="selected_subfield_separator eq '\t'" --> selected="selected"<!-- /TMPL_IF -->>Tabulation (\t)</option>
+ </select>
+ <br /><br />
+
+
+ <label for="csv">CSV separator :</label>
+ <select name="csv_separator">
+ <option value=";">Colon (:)</option>
+ <option value=","<!-- TMPL_IF EXPR="selected_csv_separator eq ','" --> selected="selected"<!-- /TMPL_IF -->>Comma (,)</option>
+ <option value="|"<!-- TMPL_IF EXPR="selected_csv_separator eq '|'" --> selected="selected"<!-- /TMPL_IF -->>Pipe (|)</option>
+ <option value=";"<!-- TMPL_IF EXPR="selected_csv_separator eq ';'" --> selected="selected"<!-- /TMPL_IF -->>Semi-colon (;)</option>
+ <option value="#"<!-- TMPL_IF EXPR="selected_csv_separator eq '#'" --> selected="selected"<!-- /TMPL_IF -->>Sharp (#)</option>
+ <option value=" "<!-- TMPL_IF EXPR="selected_csv_separator eq ' '" --> selected="selected"<!-- /TMPL_IF -->>Space ( )</option>
+ <option value="\t"<!-- TMPL_IF EXPR="selected_csv_separator eq '\t'" --> selected="selected"<!-- /TMPL_IF -->>Tabulation (\t)</option>
+ </select>
+ <br /><br />
+
+
+ <label for="field_separator">Field separator :</label>
+ <select name="field_separator">
+ <option value=";">Colon (:)</option>
+ <option value=","<!-- TMPL_IF EXPR="selected_field_separator eq ','" --> selected="selected"<!-- /TMPL_IF -->>Comma (,)</option>
+ <option value="|"<!-- TMPL_IF EXPR="selected_field_separator eq '|'" --> selected="selected"<!-- /TMPL_IF -->>Pipe (|)</option>
+ <option value=";"<!-- TMPL_IF EXPR="selected_field_separator eq ';'" --> selected="selected"<!-- /TMPL_IF -->>Semi-colon (;)</option>
+ <option value="#"<!-- TMPL_IF EXPR="selected_field_separator eq '#'" --> selected="selected"<!-- /TMPL_IF -->>Sharp (#)</option>
+ <option value=" "<!-- TMPL_IF EXPR="selected_field_separator eq ' '" --> selected="selected"<!-- /TMPL_IF -->>Space ( )</option>
+ <option value="\t"<!-- TMPL_IF EXPR="selected_field_separator eq '\t'" --> selected="selected"<!-- /TMPL_IF -->>Tabulation (\t)</option>
+ </select>
+ <br /><br />
+
+ <label for="subfield_separator">Subfield separator :</label>
+ <select name="subfield_separator">
+ <option value=";">Colon (:)</option>
+ <option value=","<!-- TMPL_IF EXPR="selected_subfield_separator eq ','" --> selected="selected"<!-- /TMPL_IF -->>Comma (,)</option>
+ <option value="|"<!-- TMPL_IF EXPR="selected_subfield_separator eq '|'" --> selected="selected"<!-- /TMPL_IF -->>Pipe (|)</option>
+ <option value=";"<!-- TMPL_IF EXPR="selected_subfield_separator eq ';'" --> selected="selected"<!-- /TMPL_IF -->>Semi-colon (;)</option>
+ <option value="#"<!-- TMPL_IF EXPR="selected_subfield_separator eq '#'" --> selected="selected"<!-- /TMPL_IF -->>Sharp (#)</option>
+ <option value=" "<!-- TMPL_IF EXPR="selected_subfield_separator eq ' '" --> selected="selected"<!-- /TMPL_IF -->>Space ( )</option>
+ <option value="\t"<!-- TMPL_IF EXPR="selected_subfield_separator eq '\t'" --> selected="selected"<!-- /TMPL_IF -->>Tabulation (\t)</option>
+ </select>
+ <br /><br />
+
+ <label for="encoding">Encoding :</label>
+ <select name="encoding">
+ <!-- TMPL_LOOP NAME="encodings" -->
+ <option<!-- TMPL_IF EXPR="selected_encoding eq encoding" --> selected="selected" <!-- /TMPL_IF -->><!-- TMPL_VAR NAME="encoding" --></option>
+ <!-- /TMPL_LOOP -->
+ </select>
+ <br /><br />
+
+
+
<label for="modify_profile_content">Profile marcfields :</label>
<textarea cols="50" rows="2" name="profile_content" id="modify_profile_content"><!-- TMPL_VAR NAME="selected_profile_marcfields" --></textarea></li>
<dd>the type of the identifier, possible values:
<ul>
<li>cardnumber</li>
- <li>firstname</li>
- <li>userid</li>
+ <li>surname</li>
<li>borrowernumber</li>
</ul>
</dd>
<th scope="row">Location(s)</th>
<td><!-- TMPL_IF NAME="ITEM_RESULTS" --><!-- TMPL_LOOP NAME="ITEM_RESULTS" -->
<p>
- <!-- TMPL_VAR NAME="branchname" --> <!-- TMPL_VAR NAME="location_description" -->
+ <!-- TMPL_VAR NAME="branchname" --><!-- TMPL_IF NAME="location" -->, <!-- TMPL_VAR NAME="location" --><!-- /TMPL_IF -->
<!-- TMPL_IF name="itemcallnumber" -->
(<!-- TMPL_VAR NAME="itemcallnumber" -->)
<!-- /TMPL_IF -->
<thead><tr>
<th> </th>
<th>Title</th>
- <th>Item Type</th>
+ <th>Author</th>
+ <th>Year</th>
<th>Location</th>
</tr></thead>
<input type="checkbox" value="<!-- TMPL_VAR NAME="biblionumber" -->" name="bib<!-- TMPL_VAR NAME="biblionumber" -->" id="bib<!-- TMPL_VAR NAME="biblionumber" -->" onclick="selRecord(value,checked);" />
</td> <!-- /TMPL_UNLESS -->
- <td><a href="#" onclick="openBiblio('<!-- TMPL_VAR name="dest" -->',<!-- TMPL_VAR name="biblionumber" -->)">
+ <td>
+ <a href="#" onclick="openBiblio('<!-- TMPL_VAR name="dest" -->',<!-- TMPL_VAR name="biblionumber" -->)">
<!-- TMPL_VAR NAME="title" escape="html" -->
- </a>
- <!-- TMPL_VAR NAME="author" -->
- <p><!-- TMPL_IF name="publishercode" -->- <!-- TMPL_VAR name="publishercode" -->
- <!-- TMPL_IF name="place" --> <!-- TMPL_VAR name="place" --><!-- /TMPL_IF --><!-- /TMPL_IF -->
- <!-- TMPL_IF name="pages" --> - <!-- TMPL_VAR name="pages" --><!-- TMPL_IF name="size" --> <!-- TMPL_VAR name="size" -->
- <!-- /TMPL_IF -->
- <!-- /TMPL_IF --></p>
- <!-- TMPL_IF name="notes" -->
- <p><!-- TMPL_VAR name="notes" --></p>
- <!-- /TMPL_IF -->
- <!-- COinS / OpenURL -->
- <span class="Z3988" title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.au=<!-- TMPL_VAR NAME="author" -->&rft.btitle=<!-- TMPL_VAR NAME="title" ESCAPE="url" -->&rft.date=<!-- TMPL_VAR NAME="publicationyear" -->&rft.tpages=<!-- TMPL_VAR NAME="size" -->&rft.isbn=<!-- TMPL_VAR NAME="isbn" ESCAPE="url" -->&rft.aucorp=&rft.place=<!-- TMPL_VAR NAME="place" -->&rft.pub=<!-- TMPL_VAR NAME="publisher" ESCAPE="url" -->&rft.edition=<!-- TMPL_VAR NAME="edition" -->&rft.series=<!-- TMPL_VAR NAME="series" -->&rft.genre="></span>
- <div id="newtag<!-- TMPL_VAR NAME="biblionumber">_status" class="tagstatus results_summary" style="display:none">Tag status here.</div>
-
- </td>
- <td><!-- TMPL_VAR name="description" --></td>
+ </a>
+ <!-- COinS / OpenURL -->
+ <span class="Z3988" title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.au=<!-- TMPL_VAR NAME="author" -->&rft.btitle=<!-- TMPL_VAR NAME="title" ESCAPE="url" -->&rft.date=<!-- TMPL_VAR NAME="publicationyear" -->&rft.tpages=<!-- TMPL_VAR NAME="size" -->&rft.isbn=<!-- TMPL_VAR NAME="isbn" ESCAPE="url" -->&rft.aucorp=&rft.place=<!-- TMPL_VAR NAME="place" -->&rft.pub=<!-- TMPL_VAR NAME="publisher" ESCAPE="url" -->&rft.edition=<!-- TMPL_VAR NAME="edition" -->&rft.series=<!-- TMPL_VAR NAME="series" -->&rft.genre="></span>
+ <div id="newtag<!-- TMPL_VAR NAME="biblionumber">_status" class="tagstatus results_summary" style="display:none">Tag status here.</div>
+ </td>
+ <td><!-- TMPL_VAR NAME="author" --></td>
+ <td>
+ <!-- TMPL_IF NAME="publicationyear" -->
+ <!-- TMPL_VAR NAME="publicationyear" -->
+ <!-- TMPL_ELSE -->
+ <!-- TMPL_VAR NAME="copyrightdate" -->
+ <!-- /TMPL_IF -->
+ </td>
<td><!-- TMPL_IF NAME="ITEM_RESULTS" --><!-- TMPL_LOOP NAME="ITEM_RESULTS" -->
<p>
- <!-- TMPL_VAR NAME="branchname" --> <!-- TMPL_VAR NAME="location_description" -->
+ <!-- TMPL_VAR NAME="branchname" --><!-- TMPL_IF NAME="location" -->, <!-- TMPL_VAR NAME="location" --><!-- /TMPL_IF -->
<!-- TMPL_IF name="itemcallnumber" -->
(<!-- TMPL_VAR NAME="itemcallnumber" -->)
<!-- /TMPL_IF -->
<th>Title</th>
<th>Author</th>
<th>Year</th>
+ <th>Location</th>
</tr></thead>
<tbody>
<!-- TMPL_LOOP NAME="itemsloop" -->
<!-- TMPL_VAR NAME="copyrightdate" -->
<!-- /TMPL_IF -->
</td>
+ <td>
+ <!-- TMPL_IF NAME="ITEM_RESULTS" --><!-- TMPL_LOOP NAME="ITEM_RESULTS" -->
+ <p>
+ <!-- TMPL_VAR NAME="branchname" --><!-- TMPL_IF NAME="location" -->, <!-- TMPL_VAR NAME="location" --><!-- /TMPL_IF -->
+ <!-- TMPL_IF name="itemcallnumber" -->
+ (<!-- TMPL_VAR NAME="itemcallnumber" -->)
+ <!-- /TMPL_IF -->
+ </p>
+ <!-- /TMPL_LOOP --><!-- TMPL_ELSE -->This record has no items.<!-- /TMPL_IF -->
+ </td>
</tr>
<!-- /TMPL_LOOP --><!-- /itemsloop -->
</tbody>
use strict;
sub kohaversion {
- our $VERSION = '3.01.00.107';
+ 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
use C4::Branch;
use C4::Category;
use File::Basename;
+use YAML;
my $input = new CGI;
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;
}
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 = ({firstname=>1},{surname=>1});
+}
+
$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);
+ 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);
}
}
my %parameters=
( %$patron
- , 'orderby' => $orderby
+ , 'orderby' => $orderbyparams
, 'resultsperpage' => $resultsperpage
, 'type'=> 'intranet');
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,
$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;
$_->{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
detailview => 1,
AllowRenewalLimitOverride => C4::Context->preference("AllowRenewalLimitOverride"),
DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),
+ CANDELETEUSER => $candeleteuser,
roaddetails => $roaddetails,
borrowernumber => $borrowernumber,
categoryname => $data->{'description'},
--- /dev/null
+#!/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
# 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=?
use C4::Context;
use C4::Biblio;
use C4::Koha;
+use C4::Debug;
use C4::Charset;
use C4::Items;
use Unicode::Normalize;
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;
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;
}
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;
# 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
} 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
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;
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;
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;
}
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");
$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]' " ;
my $sth2 = $dbh->prepare( $strsth2 );
$sth2->execute;
-
while (my ($celvalue) = $sth2->fetchrow) {
my %cell;
# my %ft;
$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);
} else { $max=$line;}
$strcalc .= " LIMIT 0,$max";
}
-# warn "SQL :". $strcalc;
my $dbcalc = $dbh->prepare($strcalc);
$dbcalc->execute;
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");
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/ ) ;
$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]);
@$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]);
$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) {
$table[$indice{$col}]->{$col}->{'name'}=$row;
$table[$indice{$col}]->{$col}->{'count'}=$rank;
$table[$indice{$col}]->{$col}->{'link'}=$id;
-# warn " ".$i." ".$col. " ".$row;
$indice{$col}++;
}
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;
$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;
}
use C4::Output;
use C4::Dates;
use C4::Debug;
+use C4::Branch; # XXX subfield_is_koha_internal_p
=head1 NAME
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;
}
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 );
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;
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";
+ # if we have at least 1 parameter, and it's not filled, then don't execute but ask for parameters
+ if ($sql =~ /<</ && !@sql_params) {
+ # 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 ($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;
+ }
+
+ #---- "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 = "<input type='text' name='sql_params'/>";
+ }
+ push @tmpl_parameters, {'entry' => $text, 'input' => $input };
+ }
+ $template->param('sql' => $sql,
+ 'name' => $name,
+ 'sql_params' => \@tmpl_parameters,
+ 'enter_params' => 1,
+ 'reports' => $report,
+ );
} 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 };
+ # 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,
- );
-}
+ 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';
# 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',
--- /dev/null
+#!/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");
+
use C4::Debug;
use C4::SQLHelper qw(:all);
-use Test::More tests => 15;
+use Test::More tests => 19;
+#1
BEGIN {
use_ok('C4::SQLHelper');
}
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);
-$borrtmp=InsertInTable("borrowers",{firstname=>"Jean",surname=>"cocteau",city=>" ",zipcode=>" ",email=>"email",categorycode=>$categories[0]->{categorycode}, branchcode=>$branchcodes[0]});
ok($borrid=InsertInTable("borrowers",{firstname=>"Jean",surname=>"Valjean",city=>" ",zipcode=>" ",email=>"email",categorycode=>$categories[0]->{categorycode}, branchcode=>$branchcodes[0]}),"Insert In Table");
+$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
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",{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");
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");
+$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
ok($status>0 && !($@), "DeleteInTable OK");
$status=DeleteInTable("borrowers",{borrowernumber=>$borrtmp});
--- /dev/null
+#!/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};
+}
+
+
my $totalDel;
my $membersToDelete;
if ($checkboxes{borrower}) {
- $membersToDelete = GetBorrowersWhoHaveNotBorrowedSince($filterdate1);
+ $membersToDelete = GetBorrowersWhoHaveNotBorrowedSince($filterdate1, 1);
$totalDel = scalar @$membersToDelete;
}
# delete members
if ($do_delete) {
- my $membersToDelete = GetBorrowersWhoHaveNotBorrowedSince($filterdate1);
+ my $membersToDelete = GetBorrowersWhoHaveNotBorrowedSince($filterdate1, 1);
$totalDel = scalar(@$membersToDelete);
$radio = $params->{'radio'};
if ( $radio eq 'trash' ) {
use strict;
use Data::Dumper;
+use Encode;
use C4::Auth;
use C4::Context;
}
);
+# 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");
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");
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, encoding) 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, $encoding);
}
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=?, encoding=? 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, $encoding, $profile_name);
}
if ($action eq "delete") {
# 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, encoding FROM export_format WHERE export_format_id = ?";
my $sth;
$sth = $dbh->prepare($query);
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],
+ selected_encoding => $selected_profile->[7]
);
}
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;
}
--- /dev/null
+#!/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
+