From f55e808ec02cc43bf24f99080bb7b63b74d77df1 Mon Sep 17 00:00:00 2001 From: tipaul Date: Mon, 20 Jun 2005 14:33:32 +0000 Subject: [PATCH] synch'ing 2.2 and head --- MARCdetail.pl | 30 +++- help.pl | 2 +- mainpage.pl | 12 ++ opac/opac-detail.pl | 4 +- opac/opac-dictionary.pl | 250 ++++++++++++++++++++++++++++++++ opac/opac-main.pl | 1 + opac/opac-search.pl | 4 +- opac/opac-sendbasket.pl | 244 +++++++++++++++++-------------- opac/opac-serial-issues.pl | 74 +++++++--- opac/opac-user.pl | 7 +- pay.pl | 5 +- reports/borrowers_out.pl | 22 ++- search.marc/dictionary.pl | 2 +- search.pl | 9 +- updater/updatedatabase | 52 ++++++- z3950/processz3950queue | 9 +- z3950/server/zed-koha-server.pl | 125 ++-------------- 17 files changed, 583 insertions(+), 269 deletions(-) create mode 100755 opac/opac-dictionary.pl diff --git a/MARCdetail.pl b/MARCdetail.pl index 0288241ce5..0c4dc5f6d6 100755 --- a/MARCdetail.pl +++ b/MARCdetail.pl @@ -65,11 +65,15 @@ my $dbh=C4::Context->dbh; my $biblionumber=$query->param('bib'); my $bibid = $query->param('bibid'); +my $itemtype = $query->param('frameworkcode'); my $popup = $query->param('popup'); # if set to 1, then don't insert links, it's just to show the biblio $bibid = &MARCfind_MARCbibid_from_oldbiblionumber($dbh,$biblionumber) unless $bibid; $biblionumber = &MARCfind_oldbiblionumber_from_MARCbibid($dbh,$bibid) unless $biblionumber; -my $itemtype = &MARCfind_frameworkcode($dbh,$bibid); +$itemtype = &MARCfind_frameworkcode($dbh,$bibid) if not ($itemtype); +$itemtype = '' if ($itemtype eq 'Default'); +warn "itemtype :".$itemtype; + my $tagslib = &MARCgettagslib($dbh,1,$itemtype); my $record =MARCgetbiblio($dbh,$bibid); @@ -83,6 +87,30 @@ my ($template, $loggedinuser, $cookie) debug => 1, }); +#Getting the list of all frameworks +my $queryfwk =$dbh->prepare("select frameworktext, frameworkcode from biblio_framework"); +$queryfwk->execute; +my %select_fwk; +my @select_fwk; +my $curfwk; +push @select_fwk,"Default"; +$select_fwk{"Default"} = "Default"; +while (my ($description, $fwk) =$queryfwk->fetchrow) { + push @select_fwk, $fwk; + $select_fwk{$fwk} = $description; +} +$curfwk=$itemtype; +warn "current fwk :".$curfwk ; +my $framework=CGI::scrolling_list( -name => 'Frameworks', + -id => 'Frameworks', + -default => $curfwk, + -OnChange => 'Changefwk(this);', + -values => \@select_fwk, + -labels => \%select_fwk, + -size => 1, + -multiple => 0 ); + +$template->param( framework => $framework); # fill arrays my @loop_data =(); my $tag; diff --git a/help.pl b/help.pl index f06d7aa0e1..ec909ce244 100755 --- a/help.pl +++ b/help.pl @@ -29,7 +29,7 @@ sub gethelptemplate { my ($theme, $lang) = themelanguage($htdocs, $tmplbase, "intranet"); unless (-e "$htdocs/$theme/$lang/$tmplbase") { $tmplbase="help/nohelp.tmpl"; - my ($theme, $lang) = themelanguage($htdocs, $tmplbase, "intranet"); + ($theme, $lang) = themelanguage($htdocs, $tmplbase, "intranet"); } my $template = HTML::Template->new(filename => "$htdocs/$theme/$lang/$tmplbase", die_on_bad_params => 0, diff --git a/mainpage.pl b/mainpage.pl index 5ce77fb8a5..c58e505af7 100755 --- a/mainpage.pl +++ b/mainpage.pl @@ -7,8 +7,19 @@ use C4::Output; # contains gettemplate use C4::Interface::CGI::Output; use CGI; use C4::Auth; +use C4::AuthoritiesMarc; +use C4::Koha; my $query = new CGI; +my $authtypes = getauthtypes; +my @authtypesloop; +foreach my $thisauthtype (sort { $authtypes->{$a} <=> $authtypes->{$b} } keys %$authtypes) { + my %row =(value => $thisauthtype, + authtypetext => $authtypes->{$thisauthtype}{'authtypetext'}, + ); + push @authtypesloop, \%row; +} + my ($template, $loggedinuser, $cookie) = get_template_and_user({template_name => "intranet-main.tmpl", query => $query, @@ -24,5 +35,6 @@ my ($template, $loggedinuser, $cookie) my $marc_p = C4::Context->boolean_preference("marc"); $template->param(NOTMARC => !$marc_p); +$template->param(authtypesloop => \@authtypesloop); output_html_with_http_headers $query, $cookie, $template->output; diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index feb377a58d..91ac4d9f8e 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -29,6 +29,7 @@ my $dat = &bibdata($biblionumber); my ($authorcount, $addauthor) = &addauthor($biblionumber); my ($webbiblioitemcount, @webbiblioitems) = &getwebbiblioitems($biblionumber); my ($websitecount, @websites) = &getwebsites($biblionumber); +my $subscriptionsnumber = getsubscriptionfrombiblionumber($biblionumber); $dat->{'count'}=@items; @@ -84,7 +85,6 @@ $template->param(BIBLIO_RESULTS => $resultsarray, WEB_RESULTS => $webarray, SITE_RESULTS => $sitearray, subscriptionsnumber => $subscriptionsnumber, - subscriptions => \@subs, LibraryName => C4::Context->preference("LibraryName"), suggestion => C4::Context->preference("suggestion"), virtualshelves => C4::Context->preference("virtualshelves"), @@ -123,3 +123,5 @@ output_html_with_http_headers $query, $cookie, $template->output; #output_html_with_http_headers $query, $cookie, $template->output; +output_html_with_http_headers $query, $cookie, $template->output; + diff --git a/opac/opac-dictionary.pl b/opac/opac-dictionary.pl new file mode 100755 index 0000000000..4e35c36cee --- /dev/null +++ b/opac/opac-dictionary.pl @@ -0,0 +1,250 @@ +#!/usr/bin/perl + + +# Copyright 2000-2002 Katipo Communications +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, +# Suite 330, Boston, MA 02111-1307 USA + +use strict; +use C4::Output; +use C4::Interface::CGI::Output; +use C4::Auth; +use CGI; +use C4::Search; +use C4::SearchMarc; +use C4::AuthoritiesMarc; +use C4::Context; +use C4::Biblio; +use HTML::Template; + +=head1 NAME + +dictionnary.pl : script to search in biblio & authority an existing value + +=head1 SYNOPSIS + +useful when the user want to search a term before running a query. For example, to see if "computer" is used in the database + +The parameter "marclist" tells which field is searched (title, author, subject, but could be anything else) + +This script searches in both biblios & authority +* in biblio, the script search in all marc fields related to what the user is looking for (for example, if the dictionnary is used on "author", the script searches in biblio.author, but also in additional authors & any MARC field related to author (through the "seealso" MARC constraint) +* in authority, the script search everywhere. Thus, the accepted & rejected forms are found. + +The script shows all results & the user can choose what he want, that is copied into search form. + +=cut + +my $input = new CGI; +my $field =$input->param('marclist'); +#warn "field :$field"; +my ($tablename, $kohafield)=split /./,$field; +#my $tablename=$input->param('tablename'); +$tablename="biblio" unless ($tablename); +#my $kohafield = $input->param('kohafield'); +my @search = $input->param('search'); +# warn " ".$search[0]; +my $index = $input->param('index'); +# warn " index: ".$index; +my $op=$input->param('op'); +if (($search[0]) and not ($op eq 'do_search')){ + $op='do_search'; +} +my $script_name = 'opac-dictionary.pl'; +my $query; +my $type=$input->param('type'); +#warn " ".$type; + +my $dbh = C4::Context->dbh; +my ($template, $loggedinuser, $cookie); + +my $env; + +my $startfrom=$input->param('startfrom'); +$startfrom=0 if(!defined $startfrom); +my $searchdesc; +my $resultsperpage; + +#warn "Starting process"; + +if ($op eq "do_search") { + # + # searching in biblio + # + my $sth=$dbh->prepare("Select distinct tagfield,tagsubfield from marc_subfield_structure where kohafield = ?"); + $sth->execute("$field"); + my (@tags, @and_or, @operator, @excluding,@value); + + while ((my $tagfield,my $tagsubfield,my $liblibrarian) = $sth->fetchrow) { + push @tags, $dbh->quote("$tagfield$tagsubfield"); + } + + $resultsperpage= $input->param('resultsperpage'); + $resultsperpage = 19 if(!defined $resultsperpage); + my $orderby = $input->param('orderby'); + + findseealso($dbh,\@tags); + + my @results, my $total; + my $strsth="select distinct subfieldvalue, count(marc_subfield_table.bibid) from marc_subfield_table,marc_word where marc_word.word like ? and marc_subfield_table.bibid=marc_word.bibid and marc_subfield_table.tagorder=marc_word.tagorder and marc_word.tagsubfield in "; + my $listtags="("; + foreach my $tag (@tags){ + $listtags .= $tag .","; + } + $listtags =~s/,$/)/; + $strsth .= $listtags." and marc_word.tagsubfield=concat(marc_subfield_table.tag,marc_subfield_table.subfieldcode) group by subfieldvalue "; +# warn "search in biblio : ".$strsth; + my $value = uc($search[0]); + $value=~s/\*/%/g; + $value.= "%" if not($value=~m/%/); +# warn " texte : ".$value; + + $sth=$dbh->prepare($strsth); + $sth->execute($value); + my $total; + my @catresults; + while (my ($value,$ctresults)=$sth->fetchrow) { +# warn "countresults : ".$ctresults; + push @catresults,{value=> $value, + even=>($total-$startfrom*$resultsperpage)%2, + count=>$ctresults + } if (($total>=$startfrom*$resultsperpage) and ($total<($startfrom+1)*$resultsperpage)); + $total++; + } + + + my $strsth="Select distinct authtypecode from marc_subfield_structure where ("; + foreach my $listtags (@tags){ + my @taglist=split /,/,$listtags; + foreach my $curtag (@taglist){ + $strsth.="(tagfield='".substr($curtag,1,3)."' AND tagsubfield='".substr($curtag,4,1)."') OR"; + } + } + + $strsth=~s/ OR$/)/; + my $strsth = $strsth." and authtypecode is not NULL"; +# warn $strsth; + my $sth=$dbh->prepare($strsth); + $sth->execute; + + # + # searching in authorities + # + my @authresults; + my $authnbresults; + while ((my $authtypecode) = $sth->fetchrow) { + my ($curauthresults,$nbresults) = authoritysearch($dbh,[''],[''],[''],['contains'], + \@search,$startfrom*$resultsperpage, $resultsperpage,$authtypecode); + push @authresults, @$curauthresults; + $authnbresults+=$nbresults; +# warn "auth : $authtypecode nbauthresults : $nbresults"; + } + + # + # OK, filling the template with authorities & biblio entries found. + # + ($template, $loggedinuser, $cookie) + = get_template_and_user({template_name => "opac-dictionary.tmpl", + query => $input, + type => 'opac', + authnotrequired => 1, + debug => 1, + }); + + # multi page display gestion + my $displaynext=0; + my $displayprev=$startfrom; + if(($total - (($startfrom+1)*($resultsperpage))) > 0 ) { + $displaynext = 1; + } + + my @field_data = (); + + for(my $i = 0 ; $i <= $#tags ; $i++) { + push @field_data, { term => "marclist", val=>$tags[$i] }; + push @field_data, { term => "and_or", val=>$and_or[$i] }; + push @field_data, { term => "excluding", val=>$excluding[$i] }; + push @field_data, { term => "operator", val=>$operator[$i] }; + push @field_data, { term => "value", val=>$value[$i] }; + } + + my @numbers = (); + + if ($total>$resultsperpage) { + for (my $i=1; $i<$total/$resultsperpage+1; $i++) { + if ($i<16) { + my $highlight=0; + ($startfrom==($i-1)) && ($highlight=1); + push @numbers, { number => $i, + highlight => $highlight , + searchdata=> \@field_data, + startfrom => ($i-1)}; + } + } + } + + my $from = $startfrom*$resultsperpage+1; + my $to; + + if($total < (($startfrom+1)*$resultsperpage)) + { + $to = $total; + } else { + $to = (($startfrom+1)*$resultsperpage); + } + $template->param(anindex => $input->param('index')); + $template->param(result => \@results, + catresult=> \@catresults, + search => $search[0], + marclist =>$field, + authresult => \@authresults, + nbresults => $authnbresults, + startfrom=> $startfrom, + displaynext=> $displaynext, + displayprev=> $displayprev, + resultsperpage => $resultsperpage, + startfromnext => $startfrom+1, + startfromprev => $startfrom-1, + searchdata=>\@field_data, + total=>$total, + from=>$from, + to=>$to, + numbers=>\@numbers, + MARC_ON => C4::Context->preference("marc"), + ); + + } else { + ($template, $loggedinuser, $cookie) + = get_template_and_user({template_name => "opac-dictionary.tmpl", + query => $input, + type => 'opac', + authnotrequired => 1, + debug => 1, + }); +#warn "type : $type"; + + } +$template->param(search => $search[0], + marclist =>$field, + type=>$type, + anindex => $input->param('index')); + +# Print the page +output_html_with_http_headers $input, $cookie, $template->output; + +# Local Variables: +# tab-width: 4 +# End: diff --git a/opac/opac-main.pl b/opac/opac-main.pl index 4220928742..b2691e05bf 100755 --- a/opac/opac-main.pl +++ b/opac/opac-main.pl @@ -52,5 +52,6 @@ $template->param(CGIitemtype => $CGIitemtype, virtualshelves => C4::Context->preference("virtualshelves"), languages => \@options, textmessaging => $borrower->{textmessaging}, + opaclargeimage => C4::Context->preference("opaclargeimage"), ); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/opac/opac-search.pl b/opac/opac-search.pl index 25d032117e..bec8013784 100755 --- a/opac/opac-search.pl +++ b/opac/opac-search.pl @@ -8,7 +8,7 @@ use C4::Context; use CGI; use C4::Database; use HTML::Template; -use C4::SearchMarc; +use C4::SearchMarcTest; use C4::Acquisition; use C4::Biblio; my @spsuggest; # the array for holding suggestions @@ -411,7 +411,7 @@ $template->param( phraseorterm => $phraseorterm ); ); } # ADDED BY JF -if ($totalresults == 1){ +#if ($totalresults == 1){ # if its a barcode search by definition we will only have one result. # And if we have a result # lets jump straight to the detail.pl page diff --git a/opac/opac-sendbasket.pl b/opac/opac-sendbasket.pl index 01f4515e06..bb0f466a22 100755 --- a/opac/opac-sendbasket.pl +++ b/opac/opac-sendbasket.pl @@ -7,6 +7,7 @@ use MIME::QuotedPrint; use MIME::Base64; use C4::Context; use C4::Search; +use C4::Biblio; use C4::Auth; use C4::Interface::CGI::Output; use C4::Biblio; @@ -14,101 +15,116 @@ use HTML::Template; my $query = new CGI; -my ( $template, $borrowernumber, $cookie ) = get_template_and_user( - { - template_name => "opac-sendbasketform.tmpl", - query => $query, - type => "opac", - authnotrequired => 1, - flagsrequired => { borrow => 1 }, - } -); +my ($template, $borrowernumber, $cookie) + = get_template_and_user({template_name => "opac-sendbasketform.tmpl", + query => $query, + type => "opac", + authnotrequired => 1, + flagsrequired => {borrow => 1}, + }); -my $bib_list = $query->param('bib_list'); -my $email_add = $query->param('email_add'); -my $email_sender = $query->param('email_sender'); +my $bib_list=$query->param('bib_list'); +my $email_add=$query->param('email_add'); +my $email_sender=$query->param('email_sender'); +my $dbh=C4::Context->dbh; +my $sth; +$sth=$dbh->prepare("select bibid from marc_biblio where biblionumber=? order by bibid"); -my $dbh = C4::Context->dbh(); if ($email_add) { - my $email_from = C4::Context->preference('KohaAdminEmailAddress'); - - my %mail = ( - To => $email_add, - From => $email_from - ); - - my ( $template2, $borrowernumber, $cookie ) = get_template_and_user( - { - template_name => "opac-sendbasket.tmpl", - query => $query, - type => "opac", - authnotrequired => 1, - flagsrequired => { borrow => 1 }, - } - ); - - my @bibs = split ( /\//, $bib_list ); - my @results; - my $iso2709; - foreach my $biblionumber (@bibs) { - $template2->param( biblionumber => $biblionumber ); - - my $dat = &bibdata($biblionumber); - my ( $authorcount, $addauthor ) = &addauthor($biblionumber); - my @items = &ItemInfo( undef, $biblionumber, 'opac' ); - - $dat->{'additional'} = $addauthor->[0]->{'author'}; - for ( my $i = 1 ; $i < $authorcount ; $i++ ) { - $dat->{'additional'} .= "|" . $addauthor->[$i]->{'author'}; - } - - $dat->{'biblionumber'} = $biblionumber; - $dat->{ITEM_RESULTS} = \@items; - my $record = MARCgetbiblio( $dbh, $biblionumber ); - $iso2709 .= $record->as_usmarc(); - - push ( @results, $dat ); - } - - my $resultsarray = \@results; - $template2->param( - BIBLIO_RESULTS => $resultsarray, - email_sender => $email_sender - ); - - # Getting template result - my $template_res = $template2->output(); - - # Analysing information and getting mail properties - if ( $template_res =~ /\n(.*)\n/s ) { - $mail{'subject'} = $1; - } - else { $mail{'subject'} = "no subject"; } - - my $email_header = ""; - if ( $template_res =~ /
\n(.*)\n/s ) { - $email_header = $1; - } - - my $email_file = "basket.txt"; - if ( $template_res =~ /\n(.*)\n/s ) { - $email_file = $1; - } - - if ( $template_res =~ /\n(.*)\n/s ) { - $mail{'body'} = $1; - } - - my $boundary = "====" . time() . "===="; - $mail{'content-type'} = "multipart/mixed; boundary=\"$boundary\""; + my $email_from = C4::Context->preference('KohaAdminEmailAddress'); + + my %mail = ( To => $email_add, + From => $email_from); + + my ($template2, $borrowernumber, $cookie) + = get_template_and_user({template_name => "opac-sendbasket.tmpl", + query => $query, + type => "opac", + authnotrequired => 1, + flagsrequired => {borrow => 1}, + }); + + my @bibs = split(/\//, $bib_list); + my @results; + my $iso2709; + foreach my $biblionumber (@bibs) { + $template2->param(biblionumber => $biblionumber); + + my $dat = &bibdata($biblionumber); + my ($authorcount, $addauthor) = &addauthor($biblionumber); + my @items = &ItemInfo(undef, $biblionumber, 'opac'); + + $dat->{'additional'}=$addauthor->[0]->{'author'}; + for (my $i = 1; $i < $authorcount; $i++) { + $dat->{'additional'} .= "|" . $addauthor->[$i]->{'author'}; + } + + $dat->{'biblionumber'} = $biblionumber; + $dat->{ITEM_RESULTS} = \@items; + $sth->execute($biblionumber); + my ($bibid) = $sth->fetchrow; + my $record = MARCgetbiblio($dbh,$bibid); + $iso2709 .= $record->as_usmarc(); + + push (@results, $dat); + } $email_header = encode_qp($email_header); $boundary = "--" . $boundary; - # Writing mail - $mail{body} = <\n(.*)\n/s) { $mail{'subject'} = $1; } + else { $mail{'subject'} = "no subject"; } + + my $email_header = ""; + if ($template_res =~ /
\n(.*)\n/s) { $email_header = $1; } + + my $email_file = "basket.txt"; + if ($template_res =~ /\n(.*)\n/s) { $email_file = $1; } + + if ($template_res =~ /\n(.*)\n/s) { $mail{'body'} = $1; } + + my $boundary = "====" . time() . "===="; +# $mail{'content-type'} = "multipart/mixed; boundary=\"$boundary\""; +# +# $email_header = encode_qp($email_header); +# +# $boundary = "--".$boundary; +# +# # Writing mail +# $mail{body} = + $mail{'content-type'} = "multipart/mixed; boundary=\"$boundary\""; + + my $message = encode_qp( "" ); + +# $file = $^X; # This is the perl executable +# +# open (F, $file) or die "Cannot read $file: $!"; +# binmode F; undef $/; +$mail{body} = encode_base64($iso2709); +# close F; + +$boundary = '--'.$boundary; +$mail{body} = <param( SENT => "1" ); - $template->param( email_add => $email_add ); - } - else { - - # do something if it doesnt work.... - warn "Error sending mail: $Mail::Sendmail::error \n"; - warn "$mail{'body'}"; - } +$mail{attachment} = $iso2709; +# $mail{body} = <param(SENT => "1"); + $template->param(email_add => $email_add); + } else { + # do something if it doesnt work.... + warn "Error sending mail: $Mail::Sendmail::error \n"; + } output_html_with_http_headers $query, $cookie, $template->output; } else { - $template->param( bib_list => $bib_list ); - $template->param( - url => "/cgi-bin/koha/opac-sendbasket.pl", - suggestion => C4::Context->preference("suggestion"), - virtualshelves => C4::Context->preference("virtualshelves"), - ); - output_html_with_http_headers $query, $cookie, $template->output; + $template->param(bib_list => $bib_list); + $template->param(url => "/cgi-bin/koha/opac-sendbasket.pl", + suggestion => C4::Context->preference("suggestion"), + virtualshelves => C4::Context->preference("virtualshelves"), + ); + output_html_with_http_headers $query, $cookie, $template->output; } diff --git a/opac/opac-serial-issues.pl b/opac/opac-serial-issues.pl index 12aedfb3ba..e8cba7dc89 100755 --- a/opac/opac-serial-issues.pl +++ b/opac/opac-serial-issues.pl @@ -14,28 +14,64 @@ use HTML::Template; my $query = new CGI; my $op = $query->param('op'); my $dbh = C4::Context->dbh; +my $selectview = $query->param('selectview'); +$selectview = C4::Context->preference("SubscriptionHistory") unless $selectview; + my $sth; # my $id; my ($template, $loggedinuser, $cookie); my $biblionumber = $query->param('biblionumber'); -my $subscriptions = get_subscription_list_from_biblionumber($biblionumber); - -($template, $loggedinuser, $cookie) -= get_template_and_user({template_name => "opac-serial-issues.tmpl", - query => $query, - type => "opac", - authnotrequired => 1, - debug => 1, - }); - -# replace CR by
in librarian note -# $subscription->{opacnote} =~ s/\n/\/g; - -$template->param( - biblionumber => $query->param('biblionumber'), - subscription_LOOP => $subscriptions - suggestion => C4::Context->preference("suggestion"), - virtualshelves => C4::Context->preference("virtualshelves"), - ); +if ($selectview eq "full"){ + my $subscriptions = get_full_subscription_list_from_biblionumber($biblionumber); + + my $title = $subscriptions->[0]{bibliotitle}; +# warn "title ".$title; + my $yearmin=$subscriptions->[0]{year}; +# warn "yearmin ".$yearmin; + my $yearmax=$subscriptions->[scalar(@$subscriptions)-1]{year}; +# warn "yearmax ".$yearmax; + + + ($template, $loggedinuser, $cookie) + = get_template_and_user({template_name => "opac-full-serial-issues.tmpl", + query => $query, + type => "opac", + authnotrequired => 1, + debug => 1, + }); + + # replace CR by
in librarian note + # $subscription->{opacnote} =~ s/\n/\/g; + + $template->param( + biblionumber => $query->param('biblionumber'), + years => $subscriptions, + yearmin => $yearmin, + yearmax =>$yearmax, + bibliotitle => $title, + suggestion => C4::Context->preference("suggestion"), + virtualshelves => C4::Context->preference("virtualshelves"), + ); +} else { + my $subscriptions = get_subscription_list_from_biblionumber($biblionumber); + + ($template, $loggedinuser, $cookie) + = get_template_and_user({template_name => "opac-serial-issues.tmpl", + query => $query, + type => "opac", + authnotrequired => 1, + debug => 1, + }); + + # replace CR by
in librarian note + # $subscription->{opacnote} =~ s/\n/\/g; + + $template->param( + biblionumber => $query->param('biblionumber'), + subscription_LOOP => $subscriptions, + suggestion => C4::Context->preference("suggestion"), + virtualshelves => C4::Context->preference("virtualshelves"), + ); +} output_html_with_http_headers $query, $cookie, $template->output; diff --git a/opac/opac-user.pl b/opac/opac-user.pl index e749ee5748..2e5bcfeef6 100755 --- a/opac/opac-user.pl +++ b/opac/opac-user.pl @@ -136,9 +136,10 @@ foreach my $res (@$reserves) { $template->param(WAITING => \@waiting); $template->param(waiting_count => $wcount, - LibraryName => C4::Context->preference("LibraryName"), - suggestion => C4::Context->preference("suggestion"), - virtualshelves => C4::Context->preference("virtualshelves"), + LibraryName => C4::Context->preference("LibraryName"), + suggestion => C4::Context->preference("suggestion"), + virtualshelves => C4::Context->preference("virtualshelves"), + textmessaging => $borr->{textmessaging}, ); output_html_with_http_headers $query, $cookie, $template->output; diff --git a/pay.pl b/pay.pl index 68f8ad5ea8..80ad2279e2 100755 --- a/pay.pl +++ b/pay.pl @@ -55,7 +55,7 @@ my @names=$input->param; my %inp; my $check=0; for (my $i=0;$i<@names;$i++){ - my$temp=$input->param($names[$i]); + my $temp=$input->param($names[$i]); if ($temp eq 'wo'){ $inp{$names[$i]}=$temp; $check=1; @@ -64,6 +64,7 @@ for (my $i=0;$i<@names;$i++){ $user=~ s/Levin/C/i; $user=~ s/Foxton/F/i; $user=~ s/Shannon/S/i; + # FIXME : using array +4, +5, +6 is dirty. Should use arrays for each accountline my $amount=$input->param($names[$i+4]); my $bornum=$input->param($names[$i+5]); my $accountno=$input->param($names[$i+6]); @@ -145,7 +146,7 @@ if ($check ==0){ } } $bornum=$input->param('bornum'); - print $input->redirect("/cgi-bin/koha/pay.pl?bornum=$bornum"); + print $input->redirect("/cgi-bin/koha/members/moremember.pl?bornum=$bornum"); } diff --git a/reports/borrowers_out.pl b/reports/borrowers_out.pl index 0718c6bade..66cfc82669 100755 --- a/reports/borrowers_out.pl +++ b/reports/borrowers_out.pl @@ -159,7 +159,7 @@ sub calculate { # Checking filters # my @loopfilter; - for (my $i=0;$i<=6;$i++) { + for (my $i=0;$i<=2;$i++) { my %cell; if ( @$filters[$i] ) { if (($i==1) and (@$filters[$i-1])) { @@ -167,6 +167,7 @@ sub calculate { } $cell{filter} .= @$filters[$i]; $cell{crit} .="Bor Cat" if ($i==0); + $cell{crit} .="Without issues since" if ($i==1); push @loopfilter, \%cell; } } @@ -228,13 +229,26 @@ sub calculate { # preparing calculation my $strcalc ; -# Processing average loanperiods +# Processing calculation $strcalc .= "SELECT CONCAT( borrowers.surname , \"\\t\",borrowers.firstname, \"\\t\", borrowers.cardnumber)"; $strcalc .= " , $colfield " if ($colfield); - $strcalc .= " FROM borrowers LEFT JOIN issues ON issues.borrowernumber=borrowers.borrowernumber WHERE issues.borrowernumber is null"; + $strcalc .= " FROM borrowers "; + $strcalc .= "WHERE 1 "; @$filters[0]=~ s/\*/%/g if (@$filters[0]); $strcalc .= " AND borrowers.categorycode like '" . @$filters[0] ."'" if ( @$filters[0] ); - + if (@$filters[1]){ + my $queryfilter = $dbh->prepare("SELECT DISTINCT borrowernumber FROM issues where issues.timestamp>?"); + $queryfilter->execute(@$filters[1]); + while (my ($bornum)=$queryfilter->fetchrow){ + $strcalc .= " AND borrowers.borrowernumber <> $bornum "; + } + } else { + my $queryfilter = $dbh->prepare("SELECT DISTINCT borrowernumber FROM issues "); + $queryfilter->execute; + while (my ($bornum)=$queryfilter->fetchrow){ + $strcalc .= " AND borrowers.borrowernumber <> $bornum "; + } + } $strcalc .= " group by borrowers.borrowernumber"; $strcalc .= ", $colfield" if ($column); $strcalc .= " order by $colfield " if ($colfield); diff --git a/search.marc/dictionary.pl b/search.marc/dictionary.pl index 802518c5b2..1a10ee2b94 100755 --- a/search.marc/dictionary.pl +++ b/search.marc/dictionary.pl @@ -105,7 +105,7 @@ if ($op eq "do_search") { $listtags .= $tag .","; } $listtags =~s/,$/)/; - $strsth .= $listtags." and marc_word.tagsubfield=marc_subfield_table.tag+marc_subfield_table.subfieldcode group by subfieldvalue "; + $strsth .= $listtags." and marc_word.tagsubfield=concat(marc_subfield_table.tag,marc_subfield_table.subfieldcode) group by subfieldvalue "; # warn "search in biblio : ".$strsth; my $value = uc($search[0]); $value=~s/\*/%/g; diff --git a/search.pl b/search.pl index a933b49ba1..53d1f8de93 100755 --- a/search.pl +++ b/search.pl @@ -19,6 +19,13 @@ # Suite 330, Boston, MA 02111-1307 USA # $Log$ +# Revision 1.36 2005/06/20 14:39:11 tipaul +# synch'ing 2.2 and head +# +# Revision 1.35.2.1 2005/05/27 10:02:50 hdl +# Bug Fixing : Using old search.pl with subjectitems In normal mode display. +# Problem : Changing Page doesn't work. +# # Revision 1.35 2004/04/07 22:43:04 rangi # Fix for bug 217 # @@ -99,7 +106,7 @@ my @forminputs; # This is used in the form template. foreach my $term (qw(keyword subject author illustrator itemnumber isbn date-before class dewey branch title abstract - publisher ttype)) + publisher ttype subjectitems)) { my $value = $query->param($term); next unless defined $value && $value ne ""; diff --git a/updater/updatedatabase b/updater/updatedatabase index 9e41f96eac..247f1f0eea 100755 --- a/updater/updatedatabase +++ b/updater/updatedatabase @@ -831,6 +831,24 @@ my %tabledata = ( explanation => 'Enter a complete URL to use an alternate stylesheet in OPAC', type => 'free', }, + { + uniquefieldrequired => 'variable', + variable => 'opacsmallimage', + value => '', + forceupdate => { 'explanation' => 1, + 'type' => 1}, + explanation => 'Enter a complete URL to an image, will be on top/left instead of the Koha logo', + type => 'free', + }, + { + uniquefieldrequired => 'variable', + variable => 'opaclargeimage', + value => '', + forceupdate => { 'explanation' => 1, + 'type' => 1}, + explanation => 'Enter a complete URL to an image, will be on the main page, instead of the Koha logo', + type => 'free', + }, { uniquefieldrequired => 'variable', variable => 'delimiter', @@ -862,6 +880,26 @@ my %tabledata = ( type => 'Choice', options => ';|tabulation|,|/|\|#' }, + { + uniquefieldrequired => 'variable', + variable => 'SubscriptionHistory', + value => ';', + forceupdate => { 'explanation' => 1, + 'type' => 1, + 'options' => 1}, + explanation => 'Define the information level for serials history in OPAC', + type => 'Choice', + options => 'simplified|full' + }, + { + uniquefieldrequired => 'variable', + variable => 'hidelostitems', + value => 'No', + forceupdate => { 'explanation' => 1, + 'type' => 1}, + explanation => 'show or hide "lost" items in OPAC.', + type => 'YesNo', + }, ], ); @@ -1447,12 +1485,18 @@ $sth->finish; exit; # $Log$ -# Revision 1.104 2005/06/01 21:35:05 genjimoto -# New Feature: catalogsearch() has a new parameter, $sqlstring. A developer puts into it whatever they want to tack onto the end of the where statement. See usage in opac-search.pl -# -# Revision 1.103 2005/05/04 09:04:52 tipaul +# Revision 1.105 2005/06/20 14:36:44 tipaul # synch'ing 2.2 and head # +# Revision 1.100.2.5 2005/06/06 15:23:36 tipaul +# adding a systempref to choose either to show or hide "lost" items. Note that "lost items" can be related to an authorised value list, so does not necessary mean "item definetly lost". Even here, some libraries want to see lost items, and some don't want. This parameter will make everybody happy ! +# +# Revision 1.100.2.4 2005/06/06 14:15:55 tipaul +# adding 2 systemparameters to define an alternate image as logo in opac (the image on main page & on each top-left page) +# +# Revision 1.100.2.3 2005/06/02 21:05:34 hdl +# adding variable SubscriptionHistory +# # Revision 1.100.2.2 2005/03/29 15:41:43 tipaul # * new permissions : management & tools. You now have 2 new permissions : # - management : means the user can manage library parameters, but NOT system parameters. diff --git a/z3950/processz3950queue b/z3950/processz3950queue index 543aaa76e9..65c4d3cf2b 100755 --- a/z3950/processz3950queue +++ b/z3950/processz3950queue @@ -280,14 +280,7 @@ while (1) { my $scantimerstart=time(); for ($i=1; $i<=(($numresults<80) ? ($numresults) : (80)); $i++) { my $rec=$rs->record($i); - my $marcdata; - # use render() or rawdata() depending on the type of the returned record - if (ref($rec) eq "Net::Z3950::Record::USMARC") { - $marcdata = $rec->rawdata(); - } - if (ref($rec) eq "Net::Z3950::Record::UNIMARC") { - $marcdata = $rec->rawdata(); - } + my $marcdata = $rec->rawdata(); $globalencoding = ref($rec); $result.=$marcdata; } diff --git a/z3950/server/zed-koha-server.pl b/z3950/server/zed-koha-server.pl index cb1555fcd3..a315dfdb08 100755 --- a/z3950/server/zed-koha-server.pl +++ b/z3950/server/zed-koha-server.pl @@ -57,7 +57,7 @@ use MARC::Record; use C4::Context; use C4::Biblio; use strict; -my $dbh = C4::Context->dbh; +# my $dbh = C4::Context->dbh; my @bib_list; ## Stores the list of biblionumbers in a query ## I should eventually move this to different scope @@ -85,6 +85,7 @@ sub init_handler { sub run_query { ## Run the query and store the biblionumbers: my ($sql_query, $query, $args) = @_; + my $dbh = C4::Context->dbh; my $sth_get = $dbh->prepare("$sql_query"); ## Send the query to the database: @@ -144,7 +145,7 @@ sub search_handler { print "$term\n"; print "The query was:\n"; print "$query\n"; - my $sql_query = "SELECT marc_biblio.bibid FROM marc_biblio RIGHT JOIN biblio ON marc_biblio.biblionumber = biblio.biblionumber WHERE biblio.isbn LIKE ?"; + my $sql_query = "SELECT marc_biblio.bibid FROM marc_biblio RIGHT JOIN biblioitems ON marc_biblio.biblionumber = biblioitems.biblionumber WHERE biblioitems.isbn LIKE ?"; &run_query($sql_query, $query, $args); } @@ -268,126 +269,20 @@ sub fetch_handler { my $offset = $args->{OFFSET}; $offset -= 1; ## because $args->{OFFSET} 1 = record #1 chomp (my $bibid = $bib_list[$offset]); ## Not sure about this - ## print "the bibid is:$bibid\n"; - my $MARCRecord = &MARCgetbiblio($dbh,$bibid); - my $recordstring=$MARCRecord->as_usmarc(); - ## print "here is my record: $recordstring\n"; - - ## Troubleshooting: - ## use Data::Dumper; - ## Dumper $recordstring; - ## open (MARC, ">/root/marc.dump"); - ## print MARC "$recordstring"; - ## close MARC; - - ## Convert from 852/4 to 952: - ## 942a --> 852a Organization code - ## 952b --> 852b Home branch - ## 942k --> 852h Classification - ## 952p --> 852p Barcode - -my $record = MARC::Record->new_from_usmarc($recordstring); - my @fields942 = $record->field('942'); - my $field842 = $fields942[0]; - my ($field952, $sub852a, $sub852k, $sub852b, $sub852p, $sub852h); - - -## while ( my $record = $batch->next() ) { - ## my @fields942 = $record->field('942'); - ## my $field842 = $fields942[0]; - ## #grab first 942 (only need one, they are same for all items) - ## my $sub852a = ($field842->subfield('a') || ''); - ## my $sub852h = ($field842->subfield('k') || ''); - - ## my @fields952 = $record->field('952'); - ## foreach my $field952 (@fields952) { #get all 952s - ## my $sub852b = ($field952->subfield('b') || ''); - ## my $sub852p = ($field952->subfield('p') || ''); - - -#grab first 942 (only need one, they are same for all items) - unless (! $field952){ - $sub852a = ($field952->subfield('a') || '') ; -} - unless (! $field952){ #->subfield('k')) { - $sub852k = ($field952->subfield('k') || '') ; - -} - - my @fields952 = $record->field('952'); - foreach my $field952 (@fields952) { #get all 952s - - unless (! $field952) { #->subfield('b')) { - $sub852b = ($field952->subfield('b') || '') ; -} - unless (! $field952) { #->subfield('p')) { - $sub852p = ($field952->subfield('p') || '') ; -} - #make it one big happy family - my $new852 = MARC::Field->new( - 852,'','', - 'a' => $sub852a, - 'b' => $sub852b, - 'h' => $sub852h, - 'p' => $sub852p, - ); - $record->append_fields($new852); - -} - -my $recordstringdone = $record->as_usmarc(); - + ## print "the bibid is:$bibid\n"; + my $dbh = C4::Context->dbh; + my $MARCRecord = &MARCgetbiblio($dbh,$bibid); + $MARCRecord->leader(' nac 22 1u 4500'); ## Set the REP_FORM - $args->{REP_FORM} = &Net::Z3950::OID::usmarc; + $args->{REP_FORM} = &Net::Z3950::OID::unimarc; ## Return the record string to the client - $args->{RECORD} = $recordstringdone; + $args->{RECORD} = $MARCRecord->as_usmarc(); +# $args->{RECORD} = $recordstringdone; } -# That's all folks! -# -# OLD OLD OLD OLD - -sub fetch_handler_old { - my ($args) = @_; - # warn "in fetch_handler"; ## troubleshooting - my $offset = $args->{OFFSET}; - $offset -= 1; ## because $args->{OFFSET} 1 = record #1 - chomp (my $bibid = $bib_list[$offset]); ## Not sure about this - my $sql_query = "SELECT tag, subfieldcode, subfieldvalue FROM marc_subfield_table where bibid=?"; - my $sth_get = $dbh->prepare("$sql_query"); - $sth_get->execute($bibid); - - ## create a MARC::Record object - my $rec = MARC::Record->new(); - - ## create the fields - while (my @data=$sth_get->fetchrow_array) { - - my $tag = $data[0]; - my $subfieldcode = $data[1]; - my $subfieldvalue = $data[2]; - my $field = MARC::Field->new( - $tag,'','', - $subfieldcode => $subfieldvalue, - ); - - $rec->append_fields($field); - - ## build the marc string and put into $record - my $tmp_record = $rec->as_usmarc(); - my $reclen = length $tmp_record; - my $baseaddr = "$reclen + dirlen"; -# set_leader_lengths($reclen,$baseaddr); - my $record = $rec->as_usmarc(); - $args->{RECORD} = $record; - } - -} - - ## This stuff doesn't work yet...I should include boolean searching someday ## though package Net::Z3950::RPN::Term; -- 2.39.2