Coding by Rick Welykochy <[email protected]>

[1] Three new system preferences to enable particular
bib record views in the staff interface:

viewMARC
viewLabeledMARC
viewISBD

Implements enhancement 2642.

[2] New button in the regular and cataloging search results
   pages in the staff interface to allow the operator to redo
   the search against Z39.50 targets instead of the Koha database.

[3] Added copyright date and edition to cataloging and Z39.50 search results.
    Implements enhancement 2640.

Feature sponsored by MassCat.
---
 C4/Search.pm                                       |   96 +++++++++++++++++++-
 catalogue/ISBDdetail.pl                            |    4 +-
 catalogue/MARCdetail.pl                            |    3 +
 catalogue/detail.pl                                |    6 ++
 catalogue/issuehistory.pl                          |    2 +
 catalogue/moredetail.pl                            |    3 +
 catalogue/search.pl                                |   29 ++++++-
 cataloguing/addbooks.pl                            |    3 +
 cataloguing/z3950_search.pl                        |    2 +
 koha-tmpl/intranet-tmpl/prog/en/css/addbiblio.css  |    2 +-
 .../intranet-tmpl/prog/en/css/staff-global.css     |   36 ++++++++
 .../prog/en/includes/biblio-view-menu.inc          |   12 +++
 .../intranet-tmpl/prog/en/includes/cat-toolbar.inc |   31 +++++++
 .../prog/en/includes/cataloging-toolbar.inc        |   31 ++++++-
 .../prog/en/modules/catalogue/results.tmpl         |   47 ++++++++++
 .../prog/en/modules/cataloguing/addbooks.tmpl      |    6 ++
 .../prog/en/modules/cataloguing/z3950_search.tmpl  |    4 +
 reserve/request.pl                                 |    2 +
 tools/viewlog.pl                                   |    2 +
 19 files changed, 314 insertions(+), 7 deletions(-)

diff --git a/C4/Search.pm b/C4/Search.pm
index 9229746..13f504f 100644
--- a/C4/Search.pm
+++ b/C4/Search.pm
@@ -19,7 +19,7 @@ use strict;
 # use warnings; # FIXME
 require Exporter;
 use C4::Context;
-use C4::Biblio;    # GetMarcFromKohaField
+use C4::Biblio;    # GetMarcFromKohaField, GetBiblioData
 use C4::Koha;      # getFacets
 use Lingua::Stem;
 use C4::Search::PazPar2;
@@ -27,6 +27,7 @@ use XML::Simple;
 use C4::Dates qw(format_date);
 use C4::XSLT;
 use C4::Branch;
+use URI::Escape;
 
 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $DEBUG);
 
@@ -1250,6 +1251,9 @@ sub searchResults {
                $oldbiblio->{normalized_oclc} = 
GetNormalizedOCLCNumber($marcrecord,$marcflavour);
                $oldbiblio->{normalized_isbn} = 
GetNormalizedISBN(undef,$marcrecord,$marcflavour);
                $oldbiblio->{content_identifier_exists} = 1 if 
($oldbiblio->{normalized_isbn} or $oldbiblio->{normalized_oclc} or 
$oldbiblio->{normalized_ean} or $oldbiblio->{normalized_upc});
+
+               # edition information, if any
+        $oldbiblio->{edition} = $oldbiblio->{editionstatement};
                $oldbiblio->{description} = $itemtypes{ $oldbiblio->{itemtype} 
}->{description};
  # Build summary if there is one (the summary is defined in the itemtypes 
table)
  # FIXME: is this used anywhere, I think it can be commented out? -- JF
@@ -2109,6 +2113,96 @@ sub NZorder {
     }
 }
 
+=head2 enabled_staff_search_views
+
+%hash = enabled_staff_search_views()
+
+This function returns a hash that contains three flags obtained from the system
+preferences, used to determine whether a particular staff search results view
+is enabled.
+
+=over 2
+
+=item C<Output arg:>
+
+    * $hash{can_view_MARC} is true only if the MARC view is enabled
+    * $hash{can_view_ISBD} is true only if the ISBD view is enabled
+    * $hash{can_view_labeledMARC} is true only if the Labeled MARC view is 
enabled
+
+=item C<usage in the script:>
+
+=back
+
+$template->param ( C4::Search::enabled_staff_search_views );
+
+=cut
+
+sub enabled_staff_search_views
+{
+       return (
+               can_view_MARC                   => 
C4::Context->preference('viewMARC'),                 # 1 if the staff search 
allows the MARC view
+               can_view_ISBD                   => 
C4::Context->preference('viewISBD'),                 # 1 if the staff search 
allows the ISBD view
+               can_view_labeledMARC    => 
C4::Context->preference('viewLabeledMARC'),  # 1 if the staff search allows the 
Labeled MARC view
+       );
+}
+
+
+=head2 z3950_search_args
+
+$arrayref = z3950_search_args($matchpoints)
+
+This function returns an array reference that contains the search parameters 
to be
+passed to the Z39.50 search script (z3950_search.pl). The array elements
+are hash refs whose keys are name, value and encvalue, and whose values are the
+name of a search parameter, the value of that search parameter and the URL 
encoded
+value of that parameter.
+
+The search parameter names are lccn, isbn, issn, title, author, dewey and 
subject.
+
+The search parameter values are obtained from the bibliographic record whose
+data is in a hash reference in $matchpoints, as returned by 
Biblio::GetBiblioData().
+
+If $matchpoints is a scalar, it is assumed to be an unnamed query descriptor, 
e.g.
+a general purpose search argument. In this case, the returned array contains 
only
+entry: the key is 'title' and the value and encvalue are derived from 
$matchpoints.
+
+If a search parameter value is undefined or empty, it is not included in the 
returned
+array.
+
+The returned array reference may be passed directly to the template parameters.
+
+=over 2
+
+=item C<Output arg:>
+
+    * $array containing hash refs as described above
+
+=item C<usage in the script:>
+
+=back
+
+$data = Biblio::GetBiblioData($bibno);
+$template->param ( MYLOOP => C4::Search::z3950_search_args($data) )
+
+*OR*
+
+$template->param ( MYLOOP => C4::Search::z3950_search_args($searchscalar) )
+
+=cut
+
+sub z3950_search_args {
+    my $bibrec = shift;
+    $bibrec = { title => $bibrec } if !ref $bibrec;
+    my $array = [];
+    for my $field (qw/ lccn isbn issn title author dewey subject /)
+    {
+        my $encvalue = URI::Escape::uri_escape_utf8($bibrec->{$field});
+        push @$array, { name=>$field, value=>$bibrec->{$field}, 
encvalue=>$encvalue } if defined $bibrec->{$field};
+    }
+    return $array;
+}
+
+
 END { }    # module clean-up code here (global destructor)
 
 1;
diff --git a/catalogue/ISBDdetail.pl b/catalogue/ISBDdetail.pl
index d9eea6d..b2dea40 100755
--- a/catalogue/ISBDdetail.pl
+++ b/catalogue/ISBDdetail.pl
@@ -45,7 +45,7 @@ use C4::Biblio;
 use C4::Items;
 use C4::Branch;     # GetBranchDetail
 use C4::Serials;    # CountSubscriptionFromBiblionumber
-
+use C4::Search;                # enabled_staff_search_views
 
 #---- Internal function
 
@@ -88,6 +88,8 @@ $template->param (
     ISBD                => $res,
     biblionumber        => $biblionumber,
        isbdview => 1,
+       z3950_search_params     => 
C4::Search::z3950_search_args(GetBiblioData($biblionumber)),
+       C4::Search::enabled_staff_search_views,
 );
 
 output_html_with_http_headers $query, $cookie, $template->output;
diff --git a/catalogue/MARCdetail.pl b/catalogue/MARCdetail.pl
index f569763..5b209a6 100755
--- a/catalogue/MARCdetail.pl
+++ b/catalogue/MARCdetail.pl
@@ -55,6 +55,7 @@ use C4::Biblio;
 use C4::Items;
 use C4::Acquisition;
 use C4::Serials;    #uses getsubscriptionsfrombiblionumber 
GetSubscriptionsFromBiblionumber
+use C4::Search;                # enabled_staff_search_views
 
 
 my $query        = new CGI;
@@ -316,6 +317,8 @@ $template->param (
     popup                   => $popup,
     hide_marc               => C4::Context->preference('hide_marc'),
        marcview => 1,
+       z3950_search_params             => 
C4::Search::z3950_search_args($biblio),
+       C4::Search::enabled_staff_search_views,
 );
 
 output_html_with_http_headers $query, $cookie, $template->output;
diff --git a/catalogue/detail.pl b/catalogue/detail.pl
index 649c46f..a9c7f0e 100755
--- a/catalogue/detail.pl
+++ b/catalogue/detail.pl
@@ -34,6 +34,7 @@ use C4::Members;
 use C4::Serials;
 use C4::XISBN qw(get_xisbns get_biblionumber_from_isbn);
 use C4::External::Amazon;
+use C4::Search;                # enabled_staff_search_views
 
 # use Smart::Comments;
 
@@ -195,6 +196,8 @@ $template->param(
        itemdata_enumchron  => $itemfields{enumchron},
        itemdata_copynumber => $itemfields{copynumber},
        volinfo                         => $itemfields{enumchron} || 
$dat->{'serial'} ,
+       z3950_search_params     => C4::Search::z3950_search_args($dat),
+       C4::Search::enabled_staff_search_views,
 );
 
 my @results = ( $dat, );
@@ -202,6 +205,9 @@ foreach ( keys %{$dat} ) {
     $template->param( "$_" => defined $dat->{$_} ? $dat->{$_} : '' );
 }
 
+# does not work: my %views_enabled = map { $_ => 1 } $template->query(loop => 
'EnableViews');
+# method query not found?!?!
+
 $template->param(
     itemloop        => \...@itemloop,
     biblionumber        => $biblionumber,
diff --git a/catalogue/issuehistory.pl b/catalogue/issuehistory.pl
index 0a5db95..8790bb5 100755
--- a/catalogue/issuehistory.pl
+++ b/catalogue/issuehistory.pl
@@ -25,6 +25,7 @@ use C4::Output;
 use C4::Circulation;    # GetBiblioIssues
 use C4::Biblio;    # GetBiblio GetBiblioFromItemNumber
 use C4::Dates qw/format_date/;
+use C4::Search;                # enabled_staff_search_views
 
 my $query = new CGI;
 my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
@@ -70,6 +71,7 @@ $template->param(
     total        => scalar @$issues,
     issues       => $issues,
        issuehistoryview => 1,
+       C4::Search::enabled_staff_search_views,
 );
 
 output_html_with_http_headers $query, $cookie, $template->output;
diff --git a/catalogue/moredetail.pl b/catalogue/moredetail.pl
index 6f62661..0b339dc 100755
--- a/catalogue/moredetail.pl
+++ b/catalogue/moredetail.pl
@@ -30,6 +30,7 @@ use C4::Auth;
 use C4::Serials;
 use C4::Dates qw/format_date/;
 use C4::Circulation;  # to use itemissues
+use C4::Search;                # enabled_staff_search_views
 
 my $query=new CGI;
 
@@ -119,6 +120,7 @@ foreach my $item (@items){
 $template->param(count => $data->{'count'},
        subscriptionsnumber => $subscriptionsnumber,
     subscriptiontitle   => $data->{title},
+       C4::Search::enabled_staff_search_views,
 );
 $template->param(BIBITEM_DATA => \...@results);
 $template->param(ITEM_DATA => \...@items);
@@ -128,6 +130,7 @@ $template->param(biblionumber => $biblionumber);
 $template->param(biblioitemnumber => $bi);
 $template->param(itemnumber => $itemnumber);
 $template->param(ONLY_ONE => 1) if ( $itemnumber && $count != @items );
+$template->param(z3950_search_params => 
C4::Search::z3950_search_args(GetBiblioData($biblionumber)));
 
 output_html_with_http_headers $query, $cookie, $template->output;
 
diff --git a/catalogue/search.pl b/catalogue/search.pl
index a5beb6d..afc32a5 100755
--- a/catalogue/search.pl
+++ b/catalogue/search.pl
@@ -403,6 +403,25 @@ if ($params->{'limit-yr'}) {
     #FIXME: Should return a error to the user, incorect date format specified
 }
 
+# convert indexes and operands to corresponding parameter names for the z3950 
search
+# $ %z3950p will be a hash ref if the indexes are present (advacned search), 
otherwise undef
+my $z3950par;
+my $indexes2z3950 = {
+       kw=>'title', au=>'author', 'au,phr'=>'author', nb=>'isbn', ns=>'issn',
+       'lcn,phr'=>'dewey', su=>'subject', 'su,phr'=>'subject', 
+       ti=>'title', 'ti,phr'=>'title', se=>'title'
+};
+for (my $ii = 0; $ii < @operands; ++$ii)
+{
+       my $name = $indexes2z3950->{$indexes[$ii]};
+       if (defined $name && defined $operands[$ii])
+       {
+               $z3950par ||= {};
+               $z3950par->{$name} = $operands[$ii] if !exists 
$z3950par->{$name};
+       }
+}
+
+
 # Params that can only have one value
 my $scan = $params->{'scan'};
 my $count = C4::Context->preference('numSearchResults') || 20;
@@ -494,10 +513,14 @@ for (my $i=0;$i<@servers;$i++) {
         ## If there's just one result, redirect to the detail page
         if ($total == 1) {         
             my $biblionumb...@newresults[0]->{biblionumber};
-            if (C4::Context->preference('IntranetBiblioDefaultView') eq 
'isbd') {
+                       my $defaultview = 
C4::Context->preference('IntranetBiblioDefaultView');
+                       my $views = { C4::Search::enabled_staff_search_views }; 
+            if ($defaultview eq 'isbd' && $views->{can_view_ISBD}) {
                 print 
$cgi->redirect("/cgi-bin/koha/catalogue/ISBDdetail.pl?biblionumber=$biblionumber");
-            } elsif  (C4::Context->preference('IntranetBiblioDefaultView') eq 
'marc') {
+            } elsif  ($defaultview eq 'marc' && $views->{can_view_MARC}) {
                 print 
$cgi->redirect("/cgi-bin/koha/catalogue/MARCdetail.pl?biblionumber=$biblionumber");
+            } elsif  ($defaultview eq 'labeled_marc' && 
$views->{can_view_labeledMARC}) {
+                print 
$cgi->redirect("/cgi-bin/koha/catalogue/labeledMARCdetail.pl?biblionumber=$biblionumber");
             } else {
                 print 
$cgi->redirect("/cgi-bin/koha/catalogue/detail.pl?biblionumber=$biblionumber");
             } 
@@ -515,6 +538,7 @@ for (my $i=0;$i<@servers;$i++) {
             $template->param(query_cgi => $query_cgi);
             $template->param(query_desc => $query_desc);
             $template->param(limit_desc => $limit_desc);
+                       $template->param (z3950_search_params => 
C4::Search::z3950_search_args($query_desc));
             if ($query_desc || $limit_desc) {
                 $template->param(searchdesc => 1);
             }
@@ -580,6 +604,7 @@ for (my $i=0;$i<@servers;$i++) {
         # no hits
         else {
             $template->param(searchdesc => 1,query_desc => 
$query_desc,limit_desc => $limit_desc);
+                       $template->param (z3950_search_params => 
C4::Search::z3950_search_args($z3950par || $query_desc));
         }
 
 
diff --git a/cataloguing/addbooks.pl b/cataloguing/addbooks.pl
index 2f43feb..045a4ee 100755
--- a/cataloguing/addbooks.pl
+++ b/cataloguing/addbooks.pl
@@ -113,6 +113,8 @@ for ( my $i = 0 ; $i <= $#resultsbr ; $i++ ) {
     $row_data{toggle} = $toggle;
     $row_data{id}     = $resultsbr[$i]->{'id'};
     $row_data{isbn}   = $resultsbr[$i]->{'isbn'};
+    $row_data{copyrightdate}   = $resultsbr[$i]->{'copyrightdate'};
+    $row_data{editionstatement}   = $resultsbr[$i]->{'editionstatement'};
     $row_data{file}   = $resultsbr[$i]->{'file'};
     $row_data{title}  = $resultsbr[$i]->{'title'};
     $row_data{author} = $resultsbr[$i]->{'author'};
@@ -123,6 +125,7 @@ $template->param(
     frameworkcodeloop => \...@frameworkcodeloop,
     breeding_count    => $countbr,
     breeding_loop     => \...@breeding_loop,
+    z3950_search_params => C4::Search::z3950_search_args($query),
 );
 
 output_html_with_http_headers $input, $cookie, $template->output;
diff --git a/cataloguing/z3950_search.pl b/cataloguing/z3950_search.pl
index c73b5f9..6f117f4 100755
--- a/cataloguing/z3950_search.pl
+++ b/cataloguing/z3950_search.pl
@@ -244,6 +244,8 @@ warn "query ".$query  if $DEBUG;
                         $row_data{lccn}         = $oldbiblio->{lccn};
                         $row_data{title}        = $oldbiblio->{title};
                         $row_data{author}       = $oldbiblio->{author};
+                        $row_data{date}         = $oldbiblio->{copyrightdate};
+                        $row_data{edition}      = 
$oldbiblio->{editionstatement};
                         $row_data{breedingid}   = $breedingid;
                         $row_data{biblionumber} = $biblionumber;
                         push( @breeding_loop, \%row_data );
diff --git a/koha-tmpl/intranet-tmpl/prog/en/css/addbiblio.css 
b/koha-tmpl/intranet-tmpl/prog/en/css/addbiblio.css
index 6e0a58c..25135ac 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/css/addbiblio.css
+++ b/koha-tmpl/intranet-tmpl/prog/en/css/addbiblio.css
@@ -115,4 +115,4 @@ div.subfield_line label {
 }
 #cataloguing_additem_newitem .input_marceditor {
        width : auto;
-}
\ No newline at end of file
+}
diff --git a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css 
b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css
index 2bec4ea..a94ee1e 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css
+++ b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css
@@ -844,6 +844,11 @@ fieldset.rows .inputnote {
        background-position : center left;
        background-repeat : no-repeat;
 }
+#z3950searcht table {
+       /* doesn't have desired effect in catalogue/results.tmpl - I'll leave 
this here for now but there do seem to be casscading CSS errors in this and 
other CSS fiels - RICKW 20081118 */
+       padding: 20px;
+       border: none;
+}
 #printbiblio button, #printbiblio a, #printmenuc .first-child {
        padding-left : 34px;
        background-image: url("../../img/toolbar-print.gif");
@@ -1324,6 +1329,18 @@ overflow :  hidden;
        float : right;
 }
 
+#searchheader form.fz3950 {
+       float : right;
+       font-size : 125%;
+       padding : 0 0 0 5em;
+}
+
+#searchheader form.fz3950bigrpad {
+       float : right;
+       font-size : 125%;
+       padding : 5px 25em 0 0;
+}
+
 #search-facets ul {
        margin : 0;
        padding : .3em;
@@ -1642,3 +1659,22 @@ span.permissiondesc {
        margin-top : .5em;
        padding : .5em;
 }
+
+.labeledmarc-table {
+       border: 0;
+}
+
+.labeledmarc-label {
+       border: 0;
+       padding: 5;
+       font-size: 11pt;
+       color: darkblue;
+}
+
+.labeledmarc-value {
+       border: 0;
+       padding: 5;
+       font-size: 10pt;
+       color: black;
+}
+
diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/biblio-view-menu.inc 
b/koha-tmpl/intranet-tmpl/prog/en/includes/biblio-view-menu.inc
index 3f021f9..e3ccc8b 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/biblio-view-menu.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/biblio-view-menu.inc
@@ -2,10 +2,22 @@
 <ul>
     <!-- TMPL_IF NAME="detailview" --><li class="active"><!-- TMPL_ELSE 
--><li><!-- /TMPL_IF -->
     <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=<!-- TMPL_IF 
NAME="object" --><!-- TMPL_VAR NAME="object" --><!-- TMPL_ELSE --><!-- TMPL_VAR 
NAME="biblionumber" --><!-- /TMPL_IF -->">Normal</a></li>
+
+<!-- TMPL_IF NAME="can_view_MARC" -->
 <!-- TMPL_IF NAME="marcview" --><li class="active"><!-- TMPL_ELSE --><li><!-- 
/TMPL_IF -->
 <a href="/cgi-bin/koha/catalogue/MARCdetail.pl?biblionumber=<!-- TMPL_IF 
NAME="object" --><!-- TMPL_VAR NAME="object" --><!-- TMPL_ELSE --><!-- TMPL_VAR 
NAME="biblionumber" --><!-- /TMPL_IF -->">MARC</a></li>
+<!-- /TMPL_IF -->
+
+<!-- TMPL_IF NAME="can_view_labeledMARC" -->
+    <!-- TMPL_IF NAME="labeledmarcview" --><li class="active"><!-- TMPL_ELSE 
--><li><!-- /TMPL_IF -->
+       <a href="/cgi-bin/koha/catalogue/labeledMARCdetail.pl?biblionumber=<!-- 
TMPL_IF NAME="object" --><!-- TMPL_VAR NAME="object" --><!-- TMPL_ELSE --><!-- 
TMPL_VAR NAME="biblionumber" --><!-- /TMPL_IF -->">Labeled MARC</a></li>
+<!-- /TMPL_IF -->
+
+<!-- TMPL_IF NAME="can_view_ISBD" -->
     <!-- TMPL_IF NAME="isbdview" --><li class="active"><!-- TMPL_ELSE 
--><li><!-- /TMPL_IF -->
     <a href="/cgi-bin/koha/catalogue/ISBDdetail.pl?biblionumber=<!-- TMPL_IF 
NAME="object" --><!-- TMPL_VAR NAME="object" --><!-- TMPL_ELSE --><!-- TMPL_VAR 
NAME="biblionumber" --><!-- /TMPL_IF -->">ISBD</a></li>
+<!-- /TMPL_IF -->
+
     <!-- TMPL_IF NAME="moredetailview" --><li class="active"><!-- TMPL_ELSE 
--><li><!-- /TMPL_IF -->
     <a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=<!-- TMPL_IF 
NAME="object" --><!-- TMPL_VAR NAME="object" --><!-- TMPL_ELSE --><!-- TMPL_VAR 
NAME="biblionumber" --><!-- /TMPL_IF -->">Items</a></li>
     <!-- TMPL_IF NAME="CAN_user_reserveforothers" -->
diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc 
b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc
index e6a26bf..9a6d614 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc
@@ -3,6 +3,23 @@
        <script type="text/javascript">
        //<![CDATA[
        
+       /* this function open a popup to search on z3950 server.  */
+       function PopupZ3950() {
+               var strQuery = GetZ3950Terms();
+               if(strQuery){
+                       
window.open("/cgi-bin/koha/cataloguing/z3950_search.pl?biblionumber=<!-- 
TMPL_VAR NAME="biblionumber" 
-->"+strQuery,"z3950search",'width=740,height=450,location=yes,toolbar=no,scrollbars=yes,resize=yes');
+               } 
+       }
+
+       /* provide Z3950 search points */
+       function GetZ3950Terms(){
+               var strQuery="&frameworkcode=";
+               <!-- TMPL_LOOP NAME='z3950_search_params' -->
+                       strQuery += "&" + "<!-- TMPL_VAR NAME="name" -->" + "=" 
+ "<!-- TMPL_VAR NAME="encvalue" -->";
+               <!-- /TMPL_LOOP -->
+               return strQuery;
+       }
+
        function addToShelf() { 
window.open('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?biblionumber=<!--
 TMPL_VAR NAME="biblionumber" 
-->','Add_to_virtualshelf','width=500,height=400,toolbar=false,scrollbars=yes');
        }
        function printBiblio() 
{window.open('/cgi-bin/koha/catalogue/detailprint.pl?biblionumber=<!-- TMPL_VAR 
NAME="biblionumber" 
-->','Print_Biblio','width=700,height=500,toolbar=false,scrollbars=yes');
@@ -41,6 +58,7 @@ function confirm_deletion() {
                $("#printbiblioc").empty();
                $("#export").remove();
                $("#addtoshelfc").before("<li id=\"savemenuc\"><\/li>");
+               $("#z3950searchc").empty();
            yuiToolbar();
         });
 
@@ -92,6 +110,14 @@ function confirm_deletion() {
                container: "newmenuc"
            });
                
+               new YAHOO.widget.Button({
+                       id: "z3950search", 
+                       type: "button", 
+                       label: _("z39.50 Search"), 
+                       container: "z3950searchc",
+                       onclick: {fn:function(){PopupZ3950()}}
+               });
+
                var addtoshelfButton = new YAHOO.widget.Button({
                                             id: "addtoshelf", 
                                             type: "button", 
@@ -116,6 +142,8 @@ function confirm_deletion() {
        //]]>
        </script>
        
+<form method="post" name="f" id="f" 
action="/cgi-bin/koha/cataloguing/addbiblio.pl" onsubmit="return Check();">
+
 <ul class="toolbar">
        <!-- TMPL_IF NAME="CAN_user_editcatalogue" -->
        <li id="newmenuc"><a id="newbiblio" 
href="/cgi-bin/koha/cataloguing/addbiblio.pl">New Record</a></li>
@@ -132,4 +160,7 @@ function confirm_deletion() {
         <!-- TMPL_UNLESS name="bi_notforloan" -->
        <!-- TMPL_UNLESS NAME="norequests" --><li><a id="placehold" 
href="/cgi-bin/koha/reserve/request.pl?biblionumber=<!-- TMPL_VAR 
NAME="biblionumber" -->">Place Hold</a></li><!-- /TMPL_UNLESS --><!-- 
/TMPL_UNLESS -->
        <!-- /TMPL_IF -->
+       <li id="z3950searchc"><input type="button" id="z3950search" 
value="z39.50 Search" onclick="PopupZ3950(); return false;" /></li>
+</form>
 </ul></div>
+
diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/cataloging-toolbar.inc 
b/koha-tmpl/intranet-tmpl/prog/en/includes/cataloging-toolbar.inc
index f1dae2d..d20789e 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/cataloging-toolbar.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cataloging-toolbar.inc
@@ -9,11 +9,12 @@
         $(document).ready(function() {
            $("#newmenuc").empty();
            yuiToolbar();
+        yuiZ3950button();
         });
 
        // YUI Toolbar Functions
 
-       function yuiToolbar() {   
+       function yuiToolbar() {
        
     <!-- TMPL_IF NAME="NOTMARC" -->
            new YAHOO.widget.Button("newrecord");
@@ -34,7 +35,31 @@
            });  
        }
 
-                       <!-- /TMPL_IF -->
+    /* this function open a popup to search on z3950 server.  */
+    function PopupZ3950() {
+        var strQuery = GetZ3950Terms();
+        if(strQuery){
+            
window.open("/cgi-bin/koha/cataloguing/z3950_search.pl?biblionumber=<!-- 
TMPL_VAR NAME="biblionumber" 
-->"+strQuery,"z3950search",'width=740,height=450,location=yes,toolbar=no,scrollbars=yes,resize=yes');
+        }
+    }
+    /* provide Z3950 search points */
+    function GetZ3950Terms(){
+        var strQuery="&frameworkcode=";
+        <!-- TMPL_LOOP NAME='z3950_search_params' -->
+            strQuery += "&" + "<!-- TMPL_VAR NAME="name" -->" + "=" + "<!-- 
TMPL_VAR NAME="encvalue" -->";
+        <!-- /TMPL_LOOP -->
+        return strQuery;
+    }
+    /* prepare DOM for Z39.50 Search Button */
+    function yuiZ3950button() {
+        new YAHOO.widget.Button({
+                id: "z3950search",
+                type: "button",
+                label: _("z39.50 Search"),
+                container: "newmenuc",
+                onclick: {fn:function(){PopupZ3950()}}
+        });
+    }
        //]]>
        </script>
        
@@ -54,6 +79,8 @@
                        </select>
                        <input type="submit" value="Add Record Without Search" 
/>
                </form>
+        <a id="z3950search" onclick="PopupZ3950(); return false;">z39.50 
Search</a>
     <!-- /TMPL_IF -->  
+
   </div>
 </div>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tmpl 
b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tmpl
index 1f4ba4e..2fb76c3 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tmpl
@@ -20,12 +20,20 @@ function verify_images() {
            }
         });
         }
+<!-- /TMPL_IF -->
+
 $(document).ready(function() {
+<!-- TMPL_IF NAME="AmazonContent" -->
     $('#sortbyform').find("input:submit").hide();
     $('#sort_by').change(function() {
         $('#sortbyform').submit();
     });
+<!-- /TMPL_IF -->
+       $("#z3950searchc").empty();
+       yuiZ3950button();
 });
+
+<!-- TMPL_IF NAME="AmazonContent" -->
 $(window).load(function() {
         verify_images();
      });
@@ -79,6 +87,32 @@ function addToList () {
        window.open(url, 'Add_to_virtualshelf', 'width=500, height=400, 
toolbar=false, scrollbars=yes');
     return false;
 }
+
+/* this function open a popup to search on z3950 server.  */
+function PopupZ3950() {
+    var strQuery = GetZ3950Terms();
+    if(strQuery){
+        
window.open("/cgi-bin/koha/cataloguing/z3950_search.pl?biblionumber=<!-- 
TMPL_VAR NAME="biblionumber" 
-->"+strQuery,"z3950search",'width=740,height=450,location=yes,toolbar=no,scrollbars=yes,resize=yes');
+    }
+}
+/* provide Z3950 search points */
+function GetZ3950Terms(){
+       var strQuery="&frameworkcode=";
+       <!-- TMPL_LOOP NAME='z3950_search_params' -->
+               strQuery += "&" + "<!-- TMPL_VAR NAME="name" -->" + "=" + "<!-- 
TMPL_VAR NAME="encvalue" -->";
+       <!-- /TMPL_LOOP -->
+       return strQuery;
+}
+/* prepare DOM for Z39.50 Search Button */
+function yuiZ3950button() {
+       new YAHOO.widget.Button({
+                       id: "z3950search",
+                       type: "button",
+                       label: _("z39.50 Search"),
+                       container: "z3950searchc",
+                       onclick: {fn:function(){PopupZ3950()}}
+       });
+}
 //]]>
 </script>
 </head>
@@ -112,6 +146,9 @@ function addToList () {
 
     <!-- TMPL_IF NAME="total" -->
         <div id="searchheader">
+                       <form method="post" name="fz3950" class="fz3950">
+                                       <span id="z3950searchc"><input 
type="button" id="z3950search" value="z39.50 Search" onclick="PopupZ3950(); 
return false;" /></span>
+                       </form>
             <form action="/cgi-bin/koha/catalogue/search.pl" method="get" 
id="sortbyform">
                 <!-- TMPL_IF NAME="searchdesc" -->
                     <!-- TMPL_LOOP NAME="QUERY_INPUTS"-->
@@ -144,6 +181,10 @@ function addToList () {
         </div>
     <!-- TMPL_IF NAME="stopwords_removed" --><div><p class="tip">Ignored the 
following common words: "<!-- TMPL_VAR NAME="stopwords_removed" 
-->"<p></div><!-- /TMPL_IF -->
     <!-- TMPL_ELSE -->
+        <div id="searchheader">
+                       <form method="post" name="fz3950" class="fz3950bigrpad">
+                               <span id="z3950searchc"><input type="button" 
id="z3950search" value="z39.50 Search" onclick="PopupZ3950(); return false;" 
/></span>
+                       </form>
         <!-- TMPL_IF NAME="searchdesc" -->
             <h3>No results found</h3>
             <p>
@@ -155,6 +196,7 @@ function addToList () {
             You did not specify any search criteria.
             </p>
         <!-- /TMPL_IF -->
+               </div>
     <!-- /TMPL_IF -->
     
     <!-- TMPL_IF NAME="query_error" -->
@@ -290,6 +332,10 @@ function addToList () {
                                             <b><!-- TMPL_IF NAME="title" 
--><!-- TMPL_VAR NAME="title" --><!-- TMPL_ELSE -->No title<!-- /TMPL_IF --></b>
                                         </a> <!-- TMPL_VAR NAME="subtitle" -->
 <!-- TMPL_IF name="volume" -->,<!-- TMPL_VAR name="volume" --><!-- /TMPL_IF 
--> <!-- TMPL_IF name="volumeddesc" -->, <!-- TMPL_VAR name="volumeddesc" 
--><!-- /TMPL_IF -->
+                                    <!-- TMPL_ELSIF 
NAME="BiblioDefaultViewlabeled_marc" -->
+                                            <a class="title" 
href="/cgi-bin/koha/catalogue/labeledMARCdetail.pl?biblionumber=<!-- TMPL_VAR 
NAME="biblionumber" ESCAPE="URL" -->">
+                                                <!-- TMPL_VAR NAME="title" --> 
+                                            </a> <!-- TMPL_VAR NAME="subtitle" 
--><!-- TMPL_IF name="volume" -->,<!-- TMPL_VAR name="volume" --><!-- /TMPL_IF 
--> <!-- TMPL_IF name="volumeddesc" -->, <!-- TMPL_VAR name="volumeddesc" 
--><!-- /TMPL_IF -->
                                     <!-- TMPL_ELSIF 
NAME="BiblioDefaultViewisbd" -->
                                             <a class="title" 
href="/cgi-bin/koha/catalogue/ISBDdetail.pl?biblionumber=<!-- TMPL_VAR 
NAME="biblionumber" ESCAPE="URL" -->">
                                                 <!-- TMPL_IF NAME="title" 
--><!-- TMPL_VAR NAME="title" --><!-- TMPL_ELSE -->No title<!-- /TMPL_IF -->
@@ -328,6 +374,7 @@ function addToList () {
                                         <!-- /TMPL_IF -->
                                         
                                         <!-- TMPL_IF name="publishercode" 
--><!-- TMPL_VAR name="publishercode" --><!-- /TMPL_IF -->
+                                                                               
<!-- TMPL_IF NAME="edition" -->Edition: <!-- TMPL_VAR NAME="edition" --><!-- 
/TMPL_IF -->
                                         Description: 
                                         <!-- TMPL_IF name="place" --> ; <!-- 
TMPL_VAR name="place" --><!-- /TMPL_IF -->
                                                                                
<!-- TMPL_IF name="publicationyear" -->, <!-- TMPL_VAR name="publicationyear" 
-->
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tmpl 
b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tmpl
index e5d7af8..ed5bd42 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tmpl
@@ -62,6 +62,8 @@
                        <!-- TMPL_IF NAME="isbn" --> - <!-- TMPL_VAR 
NAME="isbn" --> <!-- /TMPL_IF -->
                         <!-- TMPL_IF name="publicationyear" --> - <!-- 
TMPL_VAR name="publicationyear" --><!-- /TMPL_IF -->
                         <!-- TMPL_IF name="publishercode" -->- <!-- TMPL_VAR 
name="publishercode" --><!-- /TMPL_IF -->
+                        <!-- TMPL_IF name="copyrightdate" --> - <!-- TMPL_VAR 
name="copyrightdate" --><!-- /TMPL_IF -->
+                        <!-- TMPL_IF NAME="edition" -->Edition: <!-- TMPL_VAR 
NAME="edition" --><!-- /TMPL_IF -->
                         <!-- TMPL_IF name="place" --> ; <!-- TMPL_VAR 
name="place" --><!-- /TMPL_IF -->
                         <!-- TMPL_IF name="pages" --> - <!-- TMPL_VAR 
name="pages" --><!-- /TMPL_IF -->
                         <!-- TMPL_IF name="size" --> ; <!-- TMPL_VAR 
name="size" --><!-- /TMPL_IF -->
@@ -125,6 +127,8 @@
             <tr>
                 <th>Title</th>
                 <th>ISBN</th>
+                <th>Date</th>
+                <th>Edition</th>
                 <th>coming from</th>
                 <th>preview</th>
                 <th>&nbsp;</th>
@@ -134,6 +138,8 @@
                 <td><!-- TMPL_VAR NAME="title" escape="html" -->
                 <!-- TMPL_VAR NAME="author" --></td>
                 <td><!-- TMPL_VAR NAME="isbn" --></td>
+                <td><!-- TMPL_VAR NAME="copyrightdate" --></td>
+                <td><!-- TMPL_VAR NAME="edition" --></td>
                 <td><!-- TMPL_VAR NAME="file" --></td>
                 <td> <a 
href="/cgi-bin/koha/catalogue/showmarc.pl?importid=<!-- TMPL_VAR NAME="id" -->" 
title="MARC" rel="gb_page_center[600,500]">MARC</a> | <a 
href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&amp;importid=<!-- 
TMPL_VAR NAME="id" -->" title="MARC" rel="gb_page_center[600,500]">Card</a>
                                </td>
diff --git 
a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/z3950_search.tmpl 
b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/z3950_search.tmpl
index bfdaf34..4aac772 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/z3950_search.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/z3950_search.tmpl
@@ -94,6 +94,8 @@ $(document).ready(function(){
         <th>Server</th>
         <th>Title</th>
         <th>Author</th>
+        <th>Date</th>
+        <th>Edition</th>
         <th>ISBN</th>
         <th>LCCN</th>
         <th colspan="2">Preview</th>
@@ -106,6 +108,8 @@ $(document).ready(function(){
             <td><!-- TMPL_VAR name="server" --></td>
             <td><!-- TMPL_VAR NAME="title" escape="html" --></td>
             <td><!-- TMPL_VAR NAME="author" --></td>
+            <td><!-- TMPL_VAR NAME="date" --></td>
+            <td><!-- TMPL_VAR NAME="edition" --></td>
             <td><!-- TMPL_VAR NAME="isbn" --></td>
             <td><!-- TMPL_VAR NAME="lccn" --></td>
             <td><a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=<!-- 
TMPL_VAR NAME="breedingid" -->" title="MARC" 
rel="gb_page_center[600,500]">MARC</a></td><td><a 
href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&amp;importid=<!-- 
TMPL_VAR NAME="breedingid" -->" title="MARC" 
rel="gb_page_center[600,500]">Card</a></td>
diff --git a/reserve/request.pl b/reserve/request.pl
index 496962f..6812d78 100755
--- a/reserve/request.pl
+++ b/reserve/request.pl
@@ -40,6 +40,7 @@ use C4::Koha;
 use C4::Circulation;
 use C4::Dates qw/format_date/;
 use C4::Members;
+use C4::Search;                # enabled_staff_search_views
 
 my $dbh = C4::Context->dbh;
 my $sth;
@@ -526,6 +527,7 @@ foreach my $biblionumber (@biblionumbers) {
                      holdsview => 1,
                      borrower_branchname => 
$branches->{$borrowerinfo->{'branchcode'}}->{'branchname'},
                      borrower_branchcode => $borrowerinfo->{'branchcode'},
+                     C4::Search::enabled_staff_search_views,
                     );
 
     $biblioloopiter{biblionumber} = $biblionumber;
diff --git a/tools/viewlog.pl b/tools/viewlog.pl
index e3bdc73..a08c73f 100755
--- a/tools/viewlog.pl
+++ b/tools/viewlog.pl
@@ -30,6 +30,7 @@ use C4::Items;
 use C4::Branch;
 use C4::Debug;
 # use Data::Dumper;
+use C4::Search;                # enabled_staff_search_views
 
 use vars qw($debug $cgi_debug);
 
@@ -98,6 +99,7 @@ $template->param(
        DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),
                      dateformat => C4::Dates->new()->format(),
                                       debug => $debug,
+       C4::Search::enabled_staff_search_views,
 );
 #
 #### This code was never really used - maybe some day some will fix it ###
-- 
1.5.6.5

_______________________________________________
Koha-patches mailing list
[email protected]
http://lists.koha.org/mailman/listinfo/koha-patches

Reply via email to