various bugfixes on parameters modules + adding default NoZebraIndexes systempreferen...
authortipaul <tipaul>
Fri, 4 May 2007 16:24:08 +0000 (16:24 +0000)
committertipaul <tipaul>
Fri, 4 May 2007 16:24:08 +0000 (16:24 +0000)
13 files changed:
C4/Branch.pm
C4/Search.pm
admin/branches.pl
admin/checkmarc.pl
admin/marc_subfields_structure.pl
admin/systempreferences.pl
cataloguing/value_builder/unimarc_field_210c.pl
koha-tmpl/intranet-tmpl/prog/en/admin/admin-home.tmpl
koha-tmpl/intranet-tmpl/prog/en/admin/currency.tmpl
koha-tmpl/intranet-tmpl/prog/en/admin/marc_subfields_structure.tmpl
misc/migration_tools/22_to_30/rebuild_unimarc_100.pl
misc/migration_tools/rebuild_nozebra.pl
updater/updatedatabase

index 615ca06..4a540be 100644 (file)
@@ -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 = ?");
index 2caaf40..2c3bdc4 100755 (executable)
@@ -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 ?");
index 3217c34..6f5d828 100755 (executable)
@@ -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);
 
index 2405c70..e5df99b 100755 (executable)
@@ -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);
index 42f9a9e..376273e 100755 (executable)
@@ -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(
index e772838..acac5c9 100755 (executable)
@@ -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";
index 82a4433..34fea24 100755 (executable)
@@ -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");
index 96d52b4..a9c9ce6 100644 (file)
        <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>
 <tr>
index 832f8f7..d4f6b53 100644 (file)
@@ -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 -->
index dca65b7..b1ba6cc 100644 (file)
     <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"
                 >
                     <!-- 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>
index 4dac0a5..a36355d 100755 (executable)
@@ -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";      
     }
index bf34b6d..4d3989e 100755 (executable)
@@ -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});
     }
 }
index f7ac5cc..ef14454 100755 (executable)
@@ -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