From e1d907c688499de689ed613014261c761a0158c8 Mon Sep 17 00:00:00 2001 From: tipaul Date: Fri, 4 May 2007 16:24:08 +0000 Subject: [PATCH] various bugfixes on parameters modules + adding default NoZebraIndexes systempreference if it's empty --- C4/Branch.pm | 3 +- C4/Search.pm | 3 ++ admin/branches.pl | 2 +- admin/checkmarc.pl | 6 +-- admin/marc_subfields_structure.pl | 9 +++-- admin/systempreferences.pl | 4 ++ .../value_builder/unimarc_field_210c.pl | 12 +++--- .../prog/en/admin/admin-home.tmpl | 4 ++ .../intranet-tmpl/prog/en/admin/currency.tmpl | 2 +- .../en/admin/marc_subfields_structure.tmpl | 33 ++++++++-------- .../22_to_30/rebuild_unimarc_100.pl | 8 ++-- misc/migration_tools/rebuild_nozebra.pl | 29 ++++++++++++-- updater/updatedatabase | 38 ++++++++++++++++++- 13 files changed, 113 insertions(+), 40 deletions(-) diff --git a/C4/Branch.pm b/C4/Branch.pm index 615ca06a03..4a540be3f4 100644 --- a/C4/Branch.pm +++ b/C4/Branch.pm @@ -56,6 +56,7 @@ The functions in this module deal with branches. &GetBranchInfo &ModBranchCategoryInfo &DelBranch + &DelBranchCategory ); =head2 GetBranches @@ -407,7 +408,7 @@ DeleteBranchCategory($categorycode); =cut -sub DeleteBranchCategory { +sub DelBranchCategory { my ($categorycode) = @_; my $dbh = C4::Context->dbh; my $sth = $dbh->prepare("delete from branchcategories where categorycode = ?"); diff --git a/C4/Search.pm b/C4/Search.pm index 2caaf40b31..2c3bdc479d 100755 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -1221,6 +1221,9 @@ sub NZanalyse { my $results; if ($operator) { #do a specific search + # automatic replace for short operator + $operator='title' if $operator eq 'ti'; + $operator='author' if $operator eq 'au'; my $dbh = C4::Context->dbh; $operator='LIKE' if $operator eq '=' and $right=~ /%/; my $sth = $dbh->prepare("SELECT biblionumbers FROM nozebra WHERE indexname=? AND value $operator ?"); diff --git a/admin/branches.pl b/admin/branches.pl index 3217c34df4..6f5d828f67 100755 --- a/admin/branches.pl +++ b/admin/branches.pl @@ -183,7 +183,7 @@ elsif ( $op eq 'delete_category' ) { elsif ( $op eq 'categorydelete_confirmed' ) { # actually delete branch and return to the main screen.... - DeleteBranchCategory($categorycode); + DelBranchCategory($categorycode); $template->param( else => 1 ); default("MESSAGE6",$template); diff --git a/admin/checkmarc.pl b/admin/checkmarc.pl index 2405c70b86..e5df99b2da 100755 --- a/admin/checkmarc.pl +++ b/admin/checkmarc.pl @@ -67,7 +67,7 @@ if ($res && $res2 && $tab==-1 && $tab2==-1) { # checks all item fields are in the same tag and in tab 10 -$sth = $dbh->prepare("select tagfield,tab,kohafield from marc_subfield_structure where kohafield like \"items.%\""); +$sth = $dbh->prepare("select tagfield,tab,kohafield from marc_subfield_structure where kohafield like \"items.%\" and tab >=0"); $sth->execute; my $field; ($res,$res2,$field) = $sth->fetchrow; @@ -77,7 +77,7 @@ my $subtotal=0; #warn "TAGF : $tagfield"; while (($res,$res2,$field) = $sth->fetchrow) { # (ignore itemnumber, that must be in -1 tab) - if (($res ne $tagfield or $res2 ne $tab ) && $res2 ne -1) { + if (($res ne $tagfield) or ($res2 ne $tab)) { $subtotal++; } } @@ -89,7 +89,7 @@ while (($res2) = $sth->fetchrow) { $subtotal++; } } -if ($subtotal eq 0) { +if ($subtotal == 0) { $template->param(itemfields => 0); } else { $template->param(itemfields => 1); diff --git a/admin/marc_subfields_structure.pl b/admin/marc_subfields_structure.pl index 42f9a9ec07..376273e0a5 100755 --- a/admin/marc_subfields_structure.pl +++ b/admin/marc_subfields_structure.pl @@ -277,8 +277,10 @@ if ( $op eq 'add_form' ) { } # add more_subfields empty lines for add if needed - for ( my $j = $i ; $j <= $more_subfields + $i ; $j++ ) { + for ( my $j = 1 ; $j <= 1 ; $j++ ) { my %row_data; # get a fresh hash for the row data + $row_data{'subfieldcode'} = ''; + $row_data{tab} = CGI::scrolling_list( -name => 'tab', -id => "tab$j", @@ -373,6 +375,8 @@ if ( $op eq 'add_form' ) { $row_data{toggle} = $toggle; $row_data{row} = $j; push( @loop_data, \%row_data ); + use Data::Dumper; + warn "push : ".Dumper(%row_data); } $template->param( 'use-heading-flags-p' => 1 ); $template->param( 'heading-edit-subfields-p' => 1 ); @@ -468,8 +472,7 @@ elsif ( $op eq 'delete_confirm' ) { "select * from marc_subfield_structure where tagfield=? and tagsubfield=? and frameworkcode=?" ); - #FIXME : called with 2 bind variables when 3 are needed - $sth->execute( $tagfield, $tagsubfield ); + $sth->execute( $tagfield, $tagsubfield, $frameworkcode ); my $data = $sth->fetchrow_hashref; $sth->finish; $template->param( diff --git a/admin/systempreferences.pl b/admin/systempreferences.pl index e772838f81..acac5c9c04 100755 --- a/admin/systempreferences.pl +++ b/admin/systempreferences.pl @@ -90,6 +90,9 @@ my %tabsysprefs; $tabsysprefs{Stemming}="Catalogue"; $tabsysprefs{WeightFields}="Catalogue"; $tabsysprefs{expandedSearchOption}="Catalogue"; + $tabsysprefs{NoZebra}="Catalogue"; + $tabsysprefs{NoZebraIndexes}="Catalogue"; + $tabsysprefs{ReceiveBackIssues}="Catalogue"; # Circulation $tabsysprefs{maxoutstanding}="Circulation"; @@ -123,6 +126,7 @@ my %tabsysprefs; $tabsysprefs{borrowerRelationship}="Members"; $tabsysprefs{BorrowersTitles}="Members"; $tabsysprefs{patronimages}="Members"; + $tabsysprefs{MinPasswordLength}="Members"; # OPAC $tabsysprefs{AmazonAssocTag}="OPAC"; diff --git a/cataloguing/value_builder/unimarc_field_210c.pl b/cataloguing/value_builder/unimarc_field_210c.pl index 82a44336f6..34fea240cd 100755 --- a/cataloguing/value_builder/unimarc_field_210c.pl +++ b/cataloguing/value_builder/unimarc_field_210c.pl @@ -63,12 +63,12 @@ my $function_name= "210c".(int(rand(100000))+1); #---- 200$a for isbn #---- 200$b for editor #---- 200$c (repeated) for collections - my $sth; -#= $dbh->prepare("select auth_subfield_table.authid,subfieldvalue from auth_subfield_table -# left join auth_header on auth_subfield_table.authid=auth_header.authid -# where authtypecode='EDITORS' and tag='200' and subfieldcode='a'"); - my $sth2; - # = $dbh->prepare("select subfieldvalue from auth_subfield_table where tag='200' and subfieldcode='b' and authid=?"); + my $sth += $dbh->prepare("select auth_subfield_table.authid,subfieldvalue from auth_subfield_table + left join auth_header on auth_subfield_table.authid=auth_header.authid + where authtypecode='EDITORS' and tag='200' and subfieldcode='a'"); + my $sth2 + = $dbh->prepare("select subfieldvalue from auth_subfield_table where tag='200' and subfieldcode='b' and authid=?"); $sth->execute; my @editors; my $authoritysep = C4::Context->preference("authoritysep"); diff --git a/koha-tmpl/intranet-tmpl/prog/en/admin/admin-home.tmpl b/koha-tmpl/intranet-tmpl/prog/en/admin/admin-home.tmpl index 96d52b4d66..a9c9ce66b0 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/admin/admin-home.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/admin/admin-home.tmpl @@ -56,6 +56,10 @@ Issuing rules Define issuing rules in a matrix for branches / borrowers / item types (number of issues, duration, cost...). + + Fines rules + Define fines in a matrix for branches / borrowers / item types (cost, grace period...). + Catalogue diff --git a/koha-tmpl/intranet-tmpl/prog/en/admin/currency.tmpl b/koha-tmpl/intranet-tmpl/prog/en/admin/currency.tmpl index 832f8f7449..d4f6b53c6f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/admin/currency.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/admin/currency.tmpl @@ -98,7 +98,7 @@ - '; return false;" /> + '; return false;" /> diff --git a/koha-tmpl/intranet-tmpl/prog/en/admin/marc_subfields_structure.tmpl b/koha-tmpl/intranet-tmpl/prog/en/admin/marc_subfields_structure.tmpl index dca65b7097..b1ba6cccdb 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/admin/marc_subfields_structure.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/admin/marc_subfields_structure.tmpl @@ -20,12 +20,13 @@ " /> -

Tag

- Edit subfields : +

Tag

+

Edit subfield - - " /> + + " /> + - - + +

-
" class="content_hidden">

Basic constaints

-

" type="text" name="liblibrarian" value="" size="40" maxlength="80" />

-

" name="libopac" value="" size="40" maxlength="80" />

-

 

-

 

-

(ignore means that the subfield is NOT managed by Koha)

- - ')">display more constraints - + +

Subfield code: " />

+ +

" type="text" name="liblibrarian" value="" size="40" maxlength="80" />

+

" name="libopac" value="" size="40" maxlength="80" />

+

 

+

 

+

(ignore means that the subfield is NOT managed by Koha)

+ + ')">display more constraints " class="content_hidden">

Advanced constraint

@@ -69,7 +71,6 @@

-
diff --git a/misc/migration_tools/22_to_30/rebuild_unimarc_100.pl b/misc/migration_tools/22_to_30/rebuild_unimarc_100.pl index 4dac0a58c6..a36355d20b 100755 --- a/misc/migration_tools/22_to_30/rebuild_unimarc_100.pl +++ b/misc/migration_tools/22_to_30/rebuild_unimarc_100.pl @@ -19,9 +19,9 @@ my $sth=$dbh->prepare("select biblionumber,timestamp from biblioitems"); while (my ($biblionumber,$time)=$sth->fetchrow ){ # my $record; - my $record = GetMarcBiblio($biblionumber); + my $record = GetMarcBiblio($biblionumber); #print $record->as_marc; - MARCmodrecord($biblionumber,$record,$time); + MARCmodrecord($biblionumber,$record,$time); # } @@ -43,14 +43,14 @@ sub MARCmodrecord { } substr($string,22,6,"frey50"); unless ($record->subfield(100,"a")){ - $record->insert_fields_ordered(MARC::Field->new(100,"","","a"=>$string)); + $record->insert_fields_ordered(MARC::Field->new(100,"","","a"=>"$string")); } # warn "APRES : ".$record->as_formatted; # delete all items related fields foreach ($record->field('995')) { $record->delete_field($_); } - if ($update){ + if ($update){ &ModBiblioMarc($record,$biblionumber,''); print "$biblionumber \n"; } diff --git a/misc/migration_tools/rebuild_nozebra.pl b/misc/migration_tools/rebuild_nozebra.pl index bf34b6d65b..4d3989e3cb 100755 --- a/misc/migration_tools/rebuild_nozebra.pl +++ b/misc/migration_tools/rebuild_nozebra.pl @@ -14,7 +14,7 @@ use strict; $|=1; # flushes output # limit for database dumping -my $limit = "LIMIT 100"; +my $limit;# = "LIMIT 100"; my $directory; my $skip_export; my $keep_export; @@ -49,6 +49,27 @@ my %result; my %index = GetNoZebraIndexes(); +unless (%index) { + if (C4::Context->preference('marcflavour') eq 'UNIMARC') { + $dbh->do("UPDATE systempreferences SET value=\"'title' => '200a,200c,200d,200e,225a,225d,225e,225f,225h,225i,225v,500*,501*,503*,510*,512*,513*,514*,515*,516*,517*,518*,519*,520*,530*,531*,532*,540*,541*,545*,604t,610t,605a', + 'author' =>'200f,600a,601a,604a,700a,700b,700c,700d,700a,701b,701c,701d,702a,702b,702c,702d,710a,710b,710c,710d,711a,711b,711c,711d,712a,712b,712c,712d', + 'isbn' => '010a', + 'issn' => '011a', + 'biblionumber' =>'0909', + 'itemtype' => '200b', + 'language' => '010a', + 'publisher' => '210x', + 'date' => '210d', + 'note' => '300a,301a,302a,303a,304a,305a,306az,307a,308a,309a,310a,311a,312a,313a,314a,315a,316a,317a,318a,319a,320a,321a,322a,323a,324a,325a,326a,327a,328a,330a,332a,333a,336a,337a,345a', + 'Koha-Auth-Number' => '6009,6019,6029,6039,6049,6059,6069,6109', + 'subject' => '600*,601*,606*,610*', + 'dewey' => '676a', + 'host-item' => '995a,995c',\" where variable='NoZebraIndexes'"); + %index = GetNoZebraIndexes(); + } else { + # build a MARC21 default index file + } +} $|=1; while (my ($biblionumber) = $sth->fetchrow) { $i++; @@ -117,9 +138,9 @@ while (my ($biblionumber) = $sth->fetchrow) { my $sth = $dbh->prepare("INSERT INTO nozebra (indexname,value,biblionumbers) VALUES (?,?,?)"); foreach my $key (keys %result) { foreach my $index (keys %{$result{$key}}) { - $sth->execute($key,$index,$result{$key}->{$index}); - if (length($result{$key}->{$index}) > 40000) { - print length($result{$key}->{$index})."\n for $key / $index\n"; + if (length($result{$key}->{$index}) > 1000000) { + print "very long index (".length($result{$key}->{$index}).")for $key / $index. update mySQL config file if you have an error just after this warning (max_paquet_size parameter)\n"; } + $sth->execute($key,$index,$result{$key}->{$index}); } } diff --git a/updater/updatedatabase b/updater/updatedatabase index f7ac5cc683..ef14454b81 100755 --- a/updater/updatedatabase +++ b/updater/updatedatabase @@ -1098,7 +1098,26 @@ my %indexes = ( { indexname => 'branchcode', content => 'branchcode', - + type => 'PRI', + } + ], + branchrelations => [ + { + indexname => 'PRIMARY', + content => 'categorycode', + type => 'PRI', + } + ], + branchrelations => [ + { indexname => 'PRIMARY', + content => 'branchcode,categorycode', + type => 'PRI', + }, + { indexname => 'branchcode', + content => 'branchcode', + }, + { indexname => 'categorycode', + content => 'categorycode', } ], currency => [ @@ -1152,6 +1171,20 @@ my %foreign_keys = ( # onDelete => 'CASCADE|SET NULL|NO ACTION| RESTRICT', # } # ], + branchrelations => [ + { key => 'branchcode', + foreigntable => 'branches', + foreignkey => 'branchcode', + onUpdate => 'CASCADE', + onDelete => 'CASCADE', + }, + { key => 'categorycode', + foreigntable => 'branchcategories', + foreignkey => 'categorycode', + onUpdate => 'CASCADE', + onDelete => 'CASCADE', + }, + ], shelfcontents => [ { key => 'shelfnumber', foreigntable => 'bookshelf', @@ -2001,6 +2034,9 @@ $sth->finish; exit; # $Log$ +# Revision 1.164 2007/05/04 16:24:09 tipaul +# various bugfixes on parameters modules + adding default NoZebraIndexes systempreference if it's empty +# # Revision 1.163 2007/05/02 16:44:31 tipaul # NoZebra SQL index management : # * adding 3 subs in Biblio.pm -- 2.39.5