bugfixes (various), handling utf-8 without guessencoding (as suggested by joshua...
authortipaul <tipaul>
Wed, 6 Jun 2007 13:08:35 +0000 (13:08 +0000)
committertipaul <tipaul>
Wed, 6 Jun 2007 13:08:35 +0000 (13:08 +0000)
12 files changed:
C4/Auth.pm
C4/AuthoritiesMarc.pm
cataloguing/addbooks.pl
cataloguing/value_builder/unimarc_leader.pl
koha-tmpl/intranet-tmpl/prog/en/authorities/authorities.tmpl
koha-tmpl/intranet-tmpl/prog/en/catalogue/results.tmpl
koha-tmpl/intranet-tmpl/prog/en/cataloguing/addbooks.tmpl
koha-tmpl/intranet-tmpl/prog/en/cataloguing/value_builder/unimarc_field_100.tmpl
koha-tmpl/intranet-tmpl/prog/en/includes/intranet2.css
koha-tmpl/intranet-tmpl/prog/en/includes/menus.inc
misc/migration_tools/rebuild_zebra.pl
misc/zebra/sort-string-utf_french.chr

index 23f7e08..8a250b1 100644 (file)
@@ -260,7 +260,7 @@ sub get_template_and_user {
             OpacTopissue       => C4::Context->preference("OpacTopissue"),
             OpacAuthorities    => C4::Context->preference("OpacAuthorities"),
             OpacBrowser        => C4::Context->preference("OpacBrowser"),
-            RequestOnOpac        => C4::Context->preference("RequestOnOpac"),
+            RequestOnOpac      => C4::Context->preference("RequestOnOpac"),
             reviewson          => C4::Context->preference("reviewson"),
             hide_marc          => C4::Context->preference("hide_marc"),
             patronimages       => C4::Context->preference("patronimages"),
index bbde916..3bc3fad 100644 (file)
@@ -502,16 +502,16 @@ sub AddAuthority {
     $record->add_fields('152','','','b'=>$authtypecode) unless $record->field('152');
 #     warn $record->as_formatted;
     $dbh->do("lock tables auth_header WRITE");
-    $sth=$dbh->prepare("insert into auth_header (authid,datecreated,authtypecode,marc) values (?,now(),?,?)");
-    $sth->execute($authid,$authtypecode,$record->as_usmarc);    
+    $sth=$dbh->prepare("insert into auth_header (authid,datecreated,authtypecode,marc,marcxml) values (?,now(),?,?,?)");
+    $sth->execute($authid,$authtypecode,$record->as_usmarc,$record->as_xml);
     $sth->finish;
   }else{
       $record->add_fields('001',$authid) unless ($record->field('001'));
       $record->add_fields('100',$authid) unless ($record->field('100'));
       $record->add_fields('152','','','b'=>$authtypecode) unless ($record->field('152'));
       $dbh->do("lock tables auth_header WRITE");
-      my $sth=$dbh->prepare("update auth_header set marc=? where authid=?");
-      $sth->execute($record->as_usmarc,$authid);
+      my $sth=$dbh->prepare("update auth_header set marc=?,marcxml=? where authid=?");
+      $sth->execute($record->as_usmarc,$record->as_xml,$authid);
       $sth->finish;
   }
   $dbh->do("unlock tables");
@@ -1157,6 +1157,9 @@ Paul POULAIN paul.poulain@free.fr
 
 # $Id$
 # $Log$
+# Revision 1.47  2007/06/06 13:08:35  tipaul
+# bugfixes (various), handling utf-8 without guessencoding (as suggested by joshua, fixing some zebra config files -for french but should be interesting for other languages-
+#
 # Revision 1.46  2007/05/10 14:45:15  tipaul
 # Koha NoZebra :
 # - support for authorities
index 44d96c0..1559609 100755 (executable)
@@ -71,6 +71,7 @@ foreach my $thisframeworkcode (keys %$frameworks) {
 
 # Searching the catalog.
 if($query) {
+    # find results
     my ($error, $marcresults) = SimpleSearch($query);
 
     if (defined $error) {
@@ -79,38 +80,13 @@ if($query) {
         output_html_with_http_headers $input, $cookie, $template->output;
         exit;
     }
-
+    # format output
     my $total = scalar @$marcresults;
-    my @results;
-
-    for(my $i=0;$i<$total;$i++) {
-        my %resultsloop;
-        my $marcrecord = MARC::File::USMARC::decode($marcresults->[$i]);
-        my $biblio = TransformMarcToKoha(C4::Context->dbh,$marcrecord,'');
-    
-        #hilight the result
-        $biblio->{'title'} =~ s/$query/<span class=term>$&<\/span>/gi;
-        $biblio->{'subtitle'} =~ s/$query/<span class=term>$&<\/span>/gi;
-        $biblio->{'biblionumber'} =~ s/$query/<span class=term>$&<\/span>/gi;
-        $biblio->{'author'} =~ s/$query/<span class=term>$&<\/span>/gi;
-        $biblio->{'publishercode'} =~ s/$query/<span class=term>$&<\/span>/gi;
-        $biblio->{'publicationyear'} =~ s/$query/<span class=term>$&<\/span>/gi;
-    
-        #build the hash for the template.
-        $resultsloop{highlight}       = ($i % 2)?(1):(0);
-        $resultsloop{title}           = $biblio->{'title'};
-        $resultsloop{subtitle}        = $biblio->{'subtitle'};
-        $resultsloop{biblionumber}    = $biblio->{'biblionumber'};
-        $resultsloop{author}          = $biblio->{'author'};
-        $resultsloop{publishercode}   = $biblio->{'publishercode'};
-        $resultsloop{publicationyear} = $biblio->{'publicationyear'};
-
-        push @results, \%resultsloop;
-    }
+    my @newresults = searchResults($query, $total, $total , 0, @$marcresults);
     $template->param(
         total => $total,
         query => $query,
-        resultsloop => \@results,
+        resultsloop => \@newresults,
     );
 }
 
index 2bc93f5..8fcb35f 100755 (executable)
@@ -47,7 +47,10 @@ return 1;
 }
 
 function Blur$function_name(subfield_managed) {
-       return 1;
+    if (document.forms['f'].field_value[subfield_managed].value.length != 24) {
+        alert('leader has an incorrect size: ' + document.forms['f'].field_value[subfield_managed].value.length + ' instead of 24 chars');
+    }
+    return 1;
 }
 
 function Clic$function_name(i) {
index e473b59..4ff89b1 100644 (file)
     <!-- /TMPL_IF -->
     <div>
     <!-- TMPL_LOOP NAME="subfield_loop" -->
+        <p class="subfield">
         <!-- TMPL_IF NAME="visibility" -->
             <a tabindex="1" style="color: grey; font-size: 80%; cursor: se-resize;" id="label<!-- TMPL_VAR name="index" -->" onclick="unHideSubfield('subfield<!-- TMPL_VAR NAME="tag" --><!-- TMPL_VAR name="index" -->','label<!-- TMPL_VAR name="index" -->')">
                 <!-- TMPL_VAR NAME="subfield" -->
             </a>
         <!-- /TMPL_IF -->
-        <p class="subfield">
         <div style="<!-- TMPL_VAR NAME='visibility' -->;" id="subfield<!-- TMPL_VAR NAME='tag' --><!-- TMPL_VAR NAME='index' -->">
+            <p>
             <!-- TMPL_UNLESS NAME="advancedMARCEditor" -->
                 <label <!-- TMPL_IF NAME="fixedfield" --> style="display:none;" <!-- /TMPL_IF --> class="labelsubfield"> 
             <!-- /TMPL_UNLESS -->
index 2899415..dc9f0b1 100644 (file)
                                 <p>
                                     <!-- TMPL_IF name="BiblioDefaultViewmarc" -->
                                         <a class="title" href="/cgi-bin/koha/catalogue/MARCdetail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" ESCAPE="URL" -->">
-                                            <!-- TMPL_VAR NAME="title" --> <!-- TMPL_VAR NAME="subtitle" -->
-                                        </a>
+                                            <!-- TMPL_VAR NAME="title" -->
+                                        </a> <!-- TMPL_VAR NAME="subtitle" -->
                                     <!-- TMPL_ELSE -->
                                         <!-- TMPL_IF name="BiblioDefaultViewisbd" -->
                                             <a class="title" href="/cgi-bin/koha/catalogue/ISBDdetail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" ESCAPE="URL" -->">
-                                                <!-- TMPL_VAR NAME="title" --> <!-- TMPL_VAR NAME="subtitle" -->
-                                            </a>
+                                                <!-- TMPL_VAR NAME="title" --> 
+                                            </a> <!-- TMPL_VAR NAME="subtitle" -->
                                         <!-- TMPL_ELSE -->
                                             <a class="title" href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" ESCAPE="URL" -->">
-                                                <!-- TMPL_VAR NAME="title" --> <!-- TMPL_VAR NAME="subtitle" -->
-                                            </a>
+                                                <!-- TMPL_VAR NAME="title" --> 
+                                            </a> <!-- TMPL_VAR NAME="subtitle" -->
                                         <!-- /TMPL_IF -->
                                     <!-- /TMPL_IF -->
                                 </p>
index 5b2d8fb..d4765a0 100644 (file)
 <!-- TMPL_VAR NAME="total"--> Results found in catalogue.
 <div class="searchresults">
     <table>
-    <tr>
-       <th>Title</th>
-    </tr>
-    <!-- TMPL_LOOP NAME="resultsloop" -->
         <tr>
+            <th>Title</th>
+            <th>Location</th>
+            <th>&nbsp;</th>
+        </tr>
+    <!-- TMPL_LOOP NAME="resultsloop" -->
+        <!-- TMPL_IF name="even" -->
+            <tr class="highlight">
+        <!-- TMPL_ELSE -->
+            <tr>
+        <!-- /TMPL_IF -->
             <td>
-                <a href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->">
+                <p>
                     <!-- TMPL_VAR NAME="title" -->
-                </a>
+                <!-- TMPL_VAR NAME="subtitle" -->
                 <!-- TMPL_IF name="summary" -->
                     <p><!-- TMPL_VAR name="summary" --></p>
                 <!-- TMPL_ELSE -->
                         <!-- TMPL_IF name="timestamp" --> <i>(modified on <!-- TMPL_VAR name="timestamp" -->)</i><!-- /TMPL_IF -->
                     </p>
                 <!-- /TMPL_IF -->
-</tr>
+                </td>
+                <td>
+                    <!-- TMPL_IF NAME="items_loop" -->
+                        <span class="available">
+                        <!-- TMPL_LOOP NAME="items_loop" -->
+                            <!-- TMPL_VAR NAME="count" --> <!-- TMPL_VAR NAME="branchname" -->
+                            <i>
+                        <!-- TMPL_IF name="location" --><!-- TMPL_VAR name="location" --><!-- /TMPL_IF -->
+                        <!-- TMPL_IF name="itemcallnumber" --><!-- TMPL_VAR name="itemcallnumber" --><!-- /TMPL_IF -->
+                            <!-- TMPL_IF name="classification" -->
+                            <a href="/cgi-bin/koha/catalogue/search.pl?q=callnum:<!-- TMPL_VAR NAME="classification" ESCAPE="URL" -->">
+                                <!-- TMPL_VAR NAME="classification" -->
+                            </a>
+                        <!-- /TMPL_IF -->
+                        </i>
+                            <br />
+                        <!-- /TMPL_LOOP -->
+                        </span>
+                    <!-- /TMPL_IF -->
+                    <span class="unavailable">
+                        <!-- TMPL_IF NAME="onloancount" --> On loan (<!-- TMPL_VAR NAME="onloancount" -->),<br /> <!-- /TMPL_IF -->
+                        <!-- TMPL_IF NAME="wthdrawncount" --> Withdrawn (<!-- TMPL_VAR NAME="wthdrawncount" -->),<br /> <!-- /TMPL_IF -->
+                        <!-- TMPL_IF NAME="itemlostcount" --> Lost (<!-- TMPL_VAR NAME="itemlostcount" -->)<br /><!-- /TMPL_IF -->
+                        <!-- TMPL_IF NAME="orderedcount" --> On order (<!-- TMPL_VAR NAME="orderedcount" -->)<!-- /TMPL_IF -->
+                    </span>
+                </td>
+                <td>
+                    <a href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->">Edit biblio</a>
+                </td>
+            </tr>
     <!-- /TMPL_LOOP -->
     </table>
 </div>
index 206b2ec..1e5028f 100644 (file)
     var fields          = doc.f.field_value;
     var NbFields        = fields.length;
 
-    GetPublicationDate(); // running directly.
-
-    /**
-     *  GetPublicationDate.
-     *  This function get the publication date if it's writen on 210d
-     */
-    function GetPublicationDate() {
-        var PublicationDate = null;
-        
-        for (i=0 ; i<NbFields ; i++) {
-            if (doc.f.tag[i].value == '210' && doc.f.subfield[i].value == 'd') {
-                if (doc.f.field_value[i].value != ""){
-                    PublicationDate = doc.f.field_value[i].value;
-                    document.getElementById('pubdate1').value = PublicationDate;
-                }
-                return;
-            }
-        }
-    }
-    
-    /**
-     *  SetPublicationDate.
-     *  This function set the publication date here
-     */
-    function SetPublicationDate() {
-        var PublicationDate = document.getElementById('pubdate1').value;
-        if (PublicationDate == "    " || !PublicationDate){
-            return ;
-        }
-        for (i=0 ; i<NbFields ; i++) {
-            if (doc.f.tag[i].value == '210' && doc.f.subfield[i].value == 'd') {
-                doc.f.field_value[i].value = PublicationDate;
-                break;
-            }
-        }
-    }
+//     GetPublicationDate(); // running directly.
+// 
+//     /**
+//      *  GetPublicationDate.
+//      *  This function get the publication date if it's writen on 210d
+//      */
+//     function GetPublicationDate() {
+//         var PublicationDate = null;
+//         
+//         for (i=0 ; i<NbFields ; i++) {
+//             if (doc.f.tag[i].value == '210' && doc.f.subfield[i].value == 'd') {
+//                 if (doc.f.field_value[i].value != ""){
+//                     PublicationDate = doc.f.field_value[i].value;
+//                     document.getElementById('pubdate1').value = PublicationDate;
+//                 }
+//                 return;
+//             }
+//         }
+//     }
+//     
+//     /**
+//      *  SetPublicationDate.
+//      *  This function set the publication date here
+//      */
+//     function SetPublicationDate() {
+//         var PublicationDate = document.getElementById('pubdate1').value;
+//         if (PublicationDate == "    " || !PublicationDate){
+//             return ;
+//         }
+//         for (i=0 ; i<NbFields ; i++) {
+//             if (doc.f.tag[i].value == '210' && doc.f.subfield[i].value == 'd') {
+//                 doc.f.field_value[i].value = PublicationDate;
+//                 break;
+//             }
+//         }
+//     }
     
     function report() {
 
         document.f_pop.f2.value +document.f_pop.f3.value
         +document.f_pop.f4.value+document.f_pop.f5.value+document.f_pop.f6.value+document.f_pop.f7.value+document.f_pop.f8.value+document.f_pop.f9.value+document.f_pop.f10.value+document.f_pop.f11.value+document.f_pop.f12.value+document.f_pop.f13.value+document.f_pop.f14.value+document.f_pop.f15.value;
         
-        SetPublicationDate();
+//         SetPublicationDate();
         self.close();
         return false;
     }
index 0e88920..9cab932 100644 (file)
@@ -190,14 +190,22 @@ legend {
 #kohalogo {
     position:fixed;
     left:20px;
-    top:20px;
+    top:10px;
+}
+
+#kohalogo h3 {
+    padding-top:5px;
+    margin-left:0px;
+}
+#kohalogo h3 a {
+    color:white;
 }
 /* MAIN MENU STYLES */
 #mainmenu {
     display:block;
     position:fixed;
     font-weight : normal;
-    margin-top:20px;
+    margin-top:30px;
     margin-right: 5px;
     padding-right: 5px;
     font-size:0.9em;
index 6183cf5..8a09c6f 100644 (file)
@@ -1,11 +1,12 @@
 <div id="kohalogo">
     <img src="/intranet-tmpl/prog/images/koha-logo.png" height="60px"/>
+    <h3><a href="/cgi-bin/koha/mainpage.pl">Koha Staff Client</a></h3>
 </div>
 <div id="onlinehelp">
     <a href="#" onclick="javascript:window.open('/cgi-bin/koha/help.pl','Koha_Help','width=600,height=600,toolbar=false,scrollbars=yes');">[?]</a>
 </div>
 <div id="mainmenu">
-<h3><a href="/cgi-bin/koha/mainpage.pl">Koha Staff Client</a></h3>
+
     <!-- TMPL_IF NAME="CAN_user_circulate" -->
     <a href="/cgi-bin/koha/circ/circulation.pl">Circulation</a>
     <ul>
         <li><a href="/cgi-bin/koha/cataloguing/addbiblio.pl">Add MARC</a></li>
         <li><a href="/cgi-bin/koha/authorities/authorities-home.pl">Authorities</a></li>
         <li><a href="/cgi-bin/koha/serials/serials-home.pl">Serials</a></li>
-        <li><a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a></li>
     </ul>
+    <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a>
     <!-- /TMPL_IF -->
-    <!-- TMPL_IF NAME="CAN_user_catalogue" -->
-    <ul>
-    <li><a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a></li>
-    </ul>
+    <!-- TMPL_IF NAME="CAN_user_reports" -->
+        <a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a></li>
     <!-- /TMPL_IF -->
     <!-- TMPL_IF NAME="CAN_user_parameters" -->
     <a href="/cgi-bin/koha/admin/admin-home.pl">Koha administration</a>
index 5e705a3..9c33092 100755 (executable)
@@ -293,6 +293,12 @@ rank:rank-1
             my $record = GetAuthority($authid);
             print ".";
             print "\r$i" unless ($i++ %100);
+            # remove leader length, that could be wrong, it will be calculated automatically by as_usmarc
+            # otherwise, if it's wron, zebra will fail miserabily (and never index what is after the failing record)
+            my $leader=$record->leader;
+            substr($leader,0,5)='     ';
+            substr($leader,10,7)='22     ';
+            $record->leader(substr($leader,0,24));
             print OUT $record->as_usmarc();
         }
         close(OUT);
@@ -475,7 +481,7 @@ rank:rank-1
         open(OUT,">:utf8 ","$directory/biblios/export") or die $!;
         my $dbh=C4::Context->dbh;
         my $sth;
-        $sth=$dbh->prepare("select biblionumber from biblioitems order by biblionumber $limit");
+        $sth=$dbh->prepare("select biblionumber from biblioitems where biblionumber >54000 order by biblionumber $limit");
         $sth->execute();
         my $i=0;
         while (my ($biblionumber) = $sth->fetchrow) {
@@ -546,6 +552,12 @@ rank:rank-1
             }
             print ".";
             print "\r$i" unless ($i++ %100);
+            # remove leader length, that could be wrong, it will be calculated automatically by as_usmarc
+            # otherwise, if it's wron, zebra will fail miserabily (and never index what is after the failing record)
+            my $leader=$record->leader;
+            substr($leader,0,5)='     ';
+            substr($leader,10,7)='22     ';
+            $record->leader(substr($leader,0,24));
             print OUT $record->as_usmarc();
         }
         close(OUT);
index cff3d22..7123ce4 100644 (file)
@@ -6,12 +6,12 @@ encoding utf-8
 
 # Define the basic value-set. *Beware* of changing this without re-indexing
 # your databases.
-lowercase {0-9}aæäåâàbcdeéêèëfghiîïjklmnoôöpqrstuüûùvwxyŷÿ
-uppercase {0-9}AÆÄÂÀÅBCDEÊËÉÈFGHIÎÏJKLMNOÖÔPQRSTUÜÛVWXYŶŸ
+lowercase {0-9}aæbcdefghijklmnopqrstuvwxy
+uppercase {0-9}AÆBCDEFGHIJKLMNOPQRSTUVWXY
 
 # Breaking characters
 
-space {\001-\040}!"#$%&'\()*+,-./:;<=>?@\[\\]^_`\{|}~
+space {\001-\040}!"#$%&'\()*+,-/:;<=>?@\[\\]^_`\{|}~
 
 # Characters to be considered equivalent for searching purposes.
 equivalent æä(ae)
@@ -22,16 +22,16 @@ equivalent y(i)
 
 # Supplemental mappings
 
-map (&auml;)       ä
+map (&auml;)       a
 map (&aelig;)      æ
 map (&oslash;)     ø
-map (&aring;)      å
-map (&ouml;)       ö
-map (&Auml;)       Ä
+map (&aring;)      a
+map (&ouml;)       o
+map (&Auml;)       A
 map (&Aelig;)      Æ
 map (&Oslash;)     Ø
-map (&Aring;)      Å
-map (&Ouml;)       Ö
+map (&Aring;)      A
+map (&Ouml;)       O
 
 map âàáäÂÀ             a
 map êèéëÊÈÉË           e
@@ -50,4 +50,4 @@ map (^Les\s)      @
 map (^Un\s)      @
 map (^Une\s)     @
 map (^De\s)     @
-map (^Des\s)     @
\ No newline at end of file
+map (^Des\s)     @