Browse Source

various bugfixes on parameters modules + adding default NoZebraIndexes systempreference if it's empty

3.0.x
tipaul 15 years ago
parent
commit
e1d907c688
  1. 3
      C4/Branch.pm
  2. 3
      C4/Search.pm
  3. 2
      admin/branches.pl
  4. 6
      admin/checkmarc.pl
  5. 9
      admin/marc_subfields_structure.pl
  6. 4
      admin/systempreferences.pl
  7. 12
      cataloguing/value_builder/unimarc_field_210c.pl
  8. 4
      koha-tmpl/intranet-tmpl/prog/en/admin/admin-home.tmpl
  9. 2
      koha-tmpl/intranet-tmpl/prog/en/admin/currency.tmpl
  10. 33
      koha-tmpl/intranet-tmpl/prog/en/admin/marc_subfields_structure.tmpl
  11. 8
      misc/migration_tools/22_to_30/rebuild_unimarc_100.pl
  12. 29
      misc/migration_tools/rebuild_nozebra.pl
  13. 38
      updater/updatedatabase

3
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 = ?");

3
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 ?");

2
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);

6
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);

9
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(

4
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";

12
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");

4
koha-tmpl/intranet-tmpl/prog/en/admin/admin-home.tmpl

@ -56,6 +56,10 @@
<td><a href="/cgi-bin/koha/admin/issuingrules.pl">Issuing rules</a></td>
<td>Define issuing rules in a matrix for branches / borrowers / item types (number of issues, duration, cost...).</td>
</tr>
<tr>
<td><a href="/cgi-bin/koha/admin/finesrules.pl">Fines rules</a></td>
<td>Define fines in a matrix for branches / borrowers / item types (cost, grace period...).</td>
</tr>
<tr>
<th colspan="2">Catalogue</th>
</tr>

2
koha-tmpl/intranet-tmpl/prog/en/admin/currency.tmpl

@ -98,7 +98,7 @@
</tr>
</table>
<input type="button" value="Update" onClick="Check(this.form)" /> <input type="button" value="Cancel" onclick="location.href='<!-- TMPL_VAR NAME="script_name" -->'; return false;" />
<input type="button" value="OK" onClick="Check(this.form)" /> <input type="button" value="Cancel" onclick="location.href='<!-- TMPL_VAR NAME="script_name" -->'; return false;" />
</form>
<!-- /TMPL_IF -->

33
koha-tmpl/intranet-tmpl/prog/en/admin/marc_subfields_structure.tmpl

@ -20,12 +20,13 @@
<input type="hidden" name="frameworkcode" value="<!-- TMPL_VAR NAME="frameworkcode" -->" />
<input type="submit" value="Save Changes" />
<h3>Tag <!-- TMPL_VAR NAME="tagfield" --></h3>
<b>Edit subfields :</b>
<h2>Tag <!-- TMPL_VAR NAME="tagfield" --></h2>
<div id="tabs">
<p>Edit subfield
<!-- TMPL_LOOP NAME="loop" -->
<!-- TMPL_IF NAME="subfieldcode"-->
<input type="hidden" name="tagsubfield" value="<!-- TMPL_VAR NAME="subfieldcode" -->" />
<!-- TMPL_IF name="subfieldcode" -->
<input type="hidden" name="tagsubfield" value="<!-- TMPL_VAR NAME="subfieldcode" -->" />
<!-- /TMPL_IF -->
<a
href="javascript:active('sub<!-- TMPL_VAR NAME='subfieldcode' -->');"
class="tab_inactive"
@ -34,24 +35,25 @@
>
<!-- TMPL_VAR NAME="subfieldcode" -->
</a>
<!-- /TMPL_IF -->
<!-- /TMPL_LOOP -->
<!-- /TMPL_LOOP -->
</p>
</div>
<div id="content" style="display:block">
<!-- TMPL_LOOP NAME="loop" -->
<!-- TMPL_IF NAME="subfieldcode"-->
<div id="content_sub<!-- TMPL_VAR NAME="subfieldcode" -->" class="content_hidden">
<h3>Basic constaints</h3>
<p><label for="liblibrarian<!-- TMPL_VAR NAME="row" -->">Text for librarian</label><input id="liblibrarian<!-- TMPL_VAR NAME="row" -->" type="text" name="liblibrarian" value="<!-- TMPL_VAR NAME="liblibrarian" -->" size="40" maxlength="80" /></p>
<p><label for="libopac<!-- TMPL_VAR NAME="row" -->">Text for OPAC</label><input type="text" id="libopac<!-- TMPL_VAR NAME="row" -->" name="libopac" value="<!-- TMPL_VAR NAME="libopac" -->" size="40" maxlength="80" /></p>
<p><label for="repeatable<!-- TMPL_VAR NAME="row" -->">Repeatable</label><!-- TMPL_VAR NAME="repeatable" -->&nbsp;</p>
<p><label for="mandatory<!-- TMPL_VAR NAME="row" -->">Mandatory</label><!-- TMPL_VAR NAME="mandatory" -->&nbsp;</p>
<p><label for="tab<!-- TMPL_VAR NAME="row" -->">Managed in tab</label><!-- TMPL_VAR NAME="tab" --> (ignore means that the subfield is NOT managed by Koha)</p>
<a href="javascript:displayMoreConstraint('more<!-- TMPL_VAR NAME="subfieldcode" -->')">display more constraints</a>
<!-- TMPL_UNLESS name="subfieldcode" -->
<p>Subfield code: <input type="text" name="tagsubfield" value="<!-- TMPL_VAR NAME="subfieldcode" -->" /></p>
<!-- /TMPL_UNLESS -->
<p><label for="liblibrarian<!-- TMPL_VAR NAME="row" -->">Text for librarian</label><input id="liblibrarian<!-- TMPL_VAR NAME="row" -->" type="text" name="liblibrarian" value="<!-- TMPL_VAR NAME="liblibrarian" -->" size="40" maxlength="80" /></p>
<p><label for="libopac<!-- TMPL_VAR NAME="row" -->">Text for OPAC</label><input type="text" id="libopac<!-- TMPL_VAR NAME="row" -->" name="libopac" value="<!-- TMPL_VAR NAME="libopac" -->" size="40" maxlength="80" /></p>
<p><label for="repeatable<!-- TMPL_VAR NAME="row" -->">Repeatable</label><!-- TMPL_VAR NAME="repeatable" -->&nbsp;</p>
<p><label for="mandatory<!-- TMPL_VAR NAME="row" -->">Mandatory</label><!-- TMPL_VAR NAME="mandatory" -->&nbsp;</p>
<p><label for="tab<!-- TMPL_VAR NAME="row" -->">Managed in tab</label><!-- TMPL_VAR NAME="tab" --> (ignore means that the subfield is NOT managed by Koha)</p>
<a href="javascript:displayMoreConstraint('more<!-- TMPL_VAR NAME="subfieldcode" -->')">display more constraints</a>
<span id="more<!-- TMPL_VAR NAME="subfieldcode" -->" class="content_hidden">
<h3>Advanced constraint</h3>
<p>
@ -69,7 +71,6 @@
<p><label for="kohafield<!-- TMPL_VAR NAME="row" -->">Koha link</label><!-- TMPL_VAR NAME="kohafield" --></p>
</span>
</div>
<!-- /TMPL_IF -->
<!-- /TMPL_LOOP -->
</div>
</form>

8
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";
}

29
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});
}
}

38
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

Loading…
Cancel
Save