[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] koha opac/getfromintranet.PL opac/opac-membersh...
From: |
paul poulain |
Subject: |
[Koha-cvs] koha opac/getfromintranet.PL opac/opac-membersh... |
Date: |
Fri, 09 Mar 2007 15:25:37 +0000 |
CVSROOT: /sources/koha
Module name: koha
Changes by: paul poulain <tipaul> 07/03/09 15:25:37
Removed files:
opac : getfromintranet.PL opac-membership.pl
opac-moredetail.pl opac-search-biblio.pl
opac-searchresults.pl opac-sidebar.pl
opac-zoomsearch.pl searchoptions.pl
reports : borrowers_stats.plugin overdue.pl stats.pl
transfers.plugin
Log message:
rel_3_0 moved to HEAD (removing useless file)
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/opac/getfromintranet.PL?cvsroot=koha&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/opac/opac-membership.pl?cvsroot=koha&r1=1.5&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/opac/opac-moredetail.pl?cvsroot=koha&r1=1.9&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/opac/opac-search-biblio.pl?cvsroot=koha&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/opac/opac-searchresults.pl?cvsroot=koha&r1=1.19&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/opac/opac-sidebar.pl?cvsroot=koha&r1=1.6&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/opac/opac-zoomsearch.pl?cvsroot=koha&r1=1.2&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/opac/searchoptions.pl?cvsroot=koha&r1=1.2&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/reports/borrowers_stats.plugin?cvsroot=koha&r1=1.2&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/reports/overdue.pl?cvsroot=koha&r1=1.2&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/reports/stats.pl?cvsroot=koha&r1=1.2&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/reports/transfers.plugin?cvsroot=koha&r1=1.1&r2=0
Patches:
Index: opac/getfromintranet.PL
===================================================================
RCS file: opac/getfromintranet.PL
diff -N opac/getfromintranet.PL
--- opac/getfromintranet.PL 19 Jul 2005 02:38:12 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,7 +0,0 @@
-# New installer helper file
-# Copies detail, moredetail, search, subjectsearch and logout from intranet to
opac
-
-$dest = $ARGV[0];
-$src = $dest;
-$src =~ s/opac/intranet/;
-system("cp","-v",$src,$dest);
Index: opac/opac-membership.pl
===================================================================
RCS file: opac/opac-membership.pl
diff -N opac/opac-membership.pl
--- opac/opac-membership.pl 19 Mar 2003 15:14:42 -0000 1.5
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,19 +0,0 @@
-#!/usr/bin/perl
-use strict;
-require Exporter;
-use CGI;
-use C4::Auth; # get_template_and_user
-use HTML::Template;
-use C4::Interface::CGI::Output;
-
-my $query = new CGI;
-
-my ($template, $borrowernumber, $cookie)
- = get_template_and_user({template_name => "opac-membership.tmpl",
- query => $query,
- type => "opac",
- authnotrequired => 1,
- flagsrequired => {borrow => 1},
- });
-
-output_html_with_http_headers $query, $cookie, $template->output;
Index: opac/opac-moredetail.pl
===================================================================
RCS file: opac/opac-moredetail.pl
diff -N opac/opac-moredetail.pl
--- opac/opac-moredetail.pl 1 Aug 2006 08:50:11 -0000 1.9
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,204 +0,0 @@
-#!/usr/bin/perl
-
-#script to display detailed information
-#written 8/11/99
-
-use strict;
-#use DBI;
-use C4::Search;
-use C4::Koha;
-use C4::Output;
-use C4::Acquisition;
-use C4::Biblio;
-use C4::Date;
-use HTML::Template;
-
-use CGI;
-my $input = new CGI;
-print $input->header;
-#whether it is called from the opac of the intranet
-my $type=$input->param('type');
-#setup colours
-my $main;
-my $secondary;
-if ($type eq 'opac'){
- $main='#99cccc';
- $secondary='#efe5ef';
-} else {
- $main='#cccc99';
- $secondary='#ffffcc';
-}
-print startpage();
-print startmenu($type);
-my $blah;
-
-my $bib=$input->param('bib');
-my $title=$input->param('title');
-my $bi=$input->param('bi');
-my $data=bibitemdata($bi);
-
-my (@items)=itemissues($bi);
-
-my $ordernum = GetOrderNumber($bib,$bi);
-my $order = GetOrder($ordernum);
-
-#print @items;
-my address@hidden;
-
-my $i=0;
-print center();
-
-my $dewey = $data->{'dewey'};
-$dewey =~ s/0+$//;
-if ($dewey eq "000.") { $dewey = "";};
-if ($dewey < 10){$dewey='00'.$dewey;}
-if ($dewey < 100 && $dewey > 10){$dewey='0'.$dewey;}
-if ($dewey <= 0){
- $dewey='';
-}
-$dewey=~ s/\.$//;
-print <<printend
-<br>
-<a href=/cgi-bin/koha/request.pl?bib=$bib><img src=/images/requests.gif
width=120 height=42 border=0 align=right border=0></a>
-printend
-;
-if ($type eq 'catmain'){
- print "<FONT SIZE=6><em>Catalogue Maintenance</em></FONT><br>";
-}
-print <<printend
-<FONT SIZE=6><em><a
href=/cgi-bin/koha/detail.pl?bib=$bib&type=intra>$data->{'title'}
($data->{'author'})</a></em></FONT><P>
-<p>
-<form action=/cgi-bin/koha/modbibitem.pl>
-<input type=hidden name=bibitem value=$bi>
-<input type=hidden name=biblio value=$bib>
-<!-------------------BIBLIO ITEM------------>
-<TABLE CELLSPACING=0 CELLPADDING=5 border=1 align=left>
-<TR VALIGN=TOP>
-<td bgcolor="99cc33" background="/images/background-mem.gif"
><B>$data->{'biblioitemnumber'} GROUP - $data->{'description'} </b> </TD>
-</TR>
-<tr VALIGN=TOP >
-<TD width=210 >
-<INPUT TYPE="image" name="submit" VALUE="modify" height=42 WIDTH=93 BORDER=0
src="/images/modify-mem.gif">
-<INPUT TYPE="image" name="delete" VALUE="delete" height=42 WIDTH=93 BORDER=0
src="/images/delete-mem.gif">
-<br>
-<FONT SIZE=2 face="arial, helvetica">
-<b>Biblionumber:</b> $bib<br>
-<b>Item Type:</b> $data->{'itemtype'}<br>
-<b>Loan Length:</b> $data->{'loanlength'}<br>
-<b>Rental Charge:</b> $data->{'rentalcharge'}<br>
-<b>Classification:</b> $data->{'classification'}$dewey$data->{'subclass'}<br>
-<b>ISBN:</b> $data->{'isbn'}<br>
-<b>Publisher:</b> $data->{'publishercode'} <br>
-<b>Place:</b> $data->{'place'}<br>
-<b>Date:</b> $data->{'publicationyear'}<br>
-<b>Volume:</b> $data->{'volumeddesc'}<br>
-<b>Pages:</b> $data->{'pages'}<br>
-<b>Illus:</b> $data->{'illus'}<br>
-<b>Size:</b> $data->{'size'}<br>
-<b>Notes:</b> $data->{'bnotes'}<br>
-<b>No. of Items:</b> $count
-
-printend
-;
-if ($type eq 'catmain'){
- print "<br><a
href=/cgi-bin/koha/maint/shiftbib.pl?bi=$data->{'biblioitemnumber'}&bib=$data->{'biblionumber'}>Shift
to another biblio</a>";
-
-}
-print <<printend
-
-</font>
-</TD>
-</tr>
-</table>
-</form>
-printend
-;
-
-for (my $i=0;$i<$count;$i++){
-print <<printend
-<img src="/images/holder.gif" width=16 height=300 align=left>
-<TABLE CELLSPACING=0 CELLPADDING=5 border=1 align=left width=220 >
-<TR VALIGN=TOP>
-<td bgcolor="99cc33" background="/images/background-mem.gif"><B>BARCODE
$items[$i]->{'barcode'}</b></TD>
-</TR>
-<tr VALIGN=TOP >
-<TD width=220 >
-<form action=/cgi-bin/koha/moditem.pl method=post>
-<input type=hidden name=bibitem value=$bi>
-<input type=hidden name=item value=$items[$i]->{'itemnumber'}>
-<input type=hidden name=type value=$type>
-<INPUT TYPE="image" name="submit" VALUE="modify" height=42 WIDTH=93 BORDER=0
src="/images/modify-mem.gif">
-<INPUT TYPE="image" name="delete" VALUE="delete" height=42 WIDTH=93 BORDER=0
src="/images/delete-mem.gif">
-<br>
-printend
-;
-$items[$i]->{'itemlost'}=~ s/0/No/;
-$items[$i]->{'itemlost'}=~ s/1/Yes/;
-$items[$i]->{'withdrawn'}=~ s/0/No/;
-$items[$i]->{'withdrawn'}=~ s/1/Yes/;
-$items[$i]->{'replacementprice'}+=0.00;
-
-my $year=substr($items[$i]->{'timestamp0'},0,4);
-my $mon=substr($items[$i]->{'timestamp0'},4,2);
-my $day=substr($items[$i]->{'timestamp0'},6,2);
-$items[$i]->{'timestamp0'}="$day/$mon/$year";
-
-$items[$i]->{'dateaccessioned'} = format_date($items[$i]->{'dateaccessioned'});
-$items[$i]->{'datelastseen'} = format_date($items[$i]->{'datelastseen'});
-
-print <<printend
-<FONT SIZE=2 face="arial, helvetica">
-<b>Home Branch:</b> $items[$i]->{'homebranch'}<br>
-<b>Last seen:</b> $items[$i]->{'datelastseen'}<br>
-<b>Last borrowed:</b> $items[$i]->{'timestamp0'}<br>
-printend
-;
-if ($items[$i] eq 'Available'){
- print "<b>Currently on issue to:</b><br>";
-} else {
- print "<b>Currently on issue to:</b> <a
href=/cgi-bin/koha/moremember.pl?bornum=$items[$i]->{'borrower0'}>$items[$i]->{'card'}</a><br>";
-}
-print <<printend
-<b>Last Borrower 1:</b> $items[$i]->{'card0'}<br>
-<b>Last Borrower 2:</b> $items[$i]->{'card1'}<br>
-<b>Current Branch:</b> $items[$i]->{'holdingbranch'}<br>
-<b>Replacement Price:</b> $items[$i]->{'replacementprice'}<br>
-<b>Item lost:</b> $items[$i]->{'itemlost'}<br>
-<b>Paid for:</b> $items[$i]->{'paidfor'}<br>
-<b>Notes:</b> $items[$i]->{'itemnotes'}<br>
-<b>Renewals:</b> $items[$i]->{'renewals'}<br>
-<b><a
href=/cgi-bin/koha/acqui/orderreceive.pl?recieve=$ordernum&biblio=$bib&invoice=$order->{'booksellerinvoicenumber'}&catview=yes>Accession</a>
Date: $items[$i]->{'dateaccessioned'}<br>
-printend
-;
-if ($items[$i]->{'wthdrawn'} eq '1'){
- $items[$i]->{'wthdrawn'}="Yes";
-} else {
- $items[$i]->{'wthdrawn'}="No";
-}
-print <<printend
-<b>Cancelled: $items[$i]->{'wthdrawn'}<br>
-<b>Total Issues:</b> $items[$i]->{'issues'}<br>
-<b>Group Number:</b> $bi <br>
-<b>Biblio number:</b> $bib <br>
-
-
-
-</font>
-</TD>
-</tr>
-</table>
-</form>
-printend
-;
-}
-print <<printend
-<p>
-</form>
-printend
-;
-
-
-print endcenter();
-
-print endmenu($type);
-print endpage();
Index: opac/opac-search-biblio.pl
===================================================================
RCS file: opac/opac-search-biblio.pl
diff -N opac/opac-search-biblio.pl
--- opac/opac-search-biblio.pl 3 Jun 2005 17:01:53 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,415 +0,0 @@
-#!/usr/bin/perl
-use strict;
-require Exporter;
-
-use C4::Auth;
-use C4::Interface::CGI::Output;
-use C4::Context;
-use CGI;
-use C4::Database;
-use HTML::Template;
-use C4::SearchBiblio;
-use C4::Acquisition;
-use C4::Biblio;
-my @spsuggest; # the array for holding suggestions
-my $suggest; # a flag to be set (if there are suggestions it's 1)
-my $firstbiblionumber; # needed for directly sending user to first item
-# use C4::Search;
-
-
-my $itemtypelist;
-my $brancheslist;
-my $categorylist;
-my $subcategorylist;
-my $mediatypelist;
-# added by Gavin
-my $totalresults;
-
-my $dbh=C4::Context->dbh;
-my $sth=$dbh->prepare("select description,itemtype from itemtypes order by
description");
-$sth->execute;
-while (my ($description,$itemtype) = $sth->fetchrow) {
- $itemtypelist.="<option value=\"$itemtype\">$description</option>\n";
-}
-my $sth=$dbh->prepare("select description,subcategorycode from
subcategorytable order by description");
-$sth->execute;
-while (my ($description,$subcategorycode) = $sth->fetchrow) {
- $subcategorylist.="<option
value=\"$subcategorycode\">$description</option>\n";
-}
-my $sth=$dbh->prepare("select description,mediatypecode from mediatypetable
order by description");
-$sth->execute;
-while (my ($description,$mediatypecode) = $sth->fetchrow) {
- $mediatypelist.="<option value=\"$mediatypecode\">$description</option>\n";
-}
-my $sth=$dbh->prepare("select description,categorycode from categorytable
order by description");
-$sth->execute;
-while (my ($description,$categorycode) = $sth->fetchrow) {
- $categorylist .= '<input type="radio" name="categorylist"
value="'.$categorycode.'">'.$description.'<br>';
-}
-my $sth=$dbh->prepare("select branchname,branchcode from branches order by
branchname");
-$sth->execute;
-
-while (my ($branchname,$branchcode) = $sth->fetchrow) {
- $brancheslist.="<option value=\"$branchcode\">$branchname</option>\n";
-}
-my $query = new CGI;
-my $op = $query->param("op");
-my $type=$query->param('type');
-
-my $itemtypesstring=$query->param("itemtypesstring");
-$itemtypesstring =~s/"//g;
-my @itemtypes = split ( /\|/, $itemtypesstring);
-my $branchesstring=$query->param("branchesstring");
-$branchesstring =~s/"//g;
-my @branches = split (/\|/, $branchesstring);
-
-my $startfrom=$query->param('startfrom');
-$startfrom=0 if(!defined $startfrom);
-my ($template, $loggedinuser, $cookie);
-my $resultsperpage;
-my $searchdesc;
-
-if ($op eq "do_search") {
- my @marclist = $query->param('marclist');
- my @and_or = $query->param('and_or');
- my @excluding = $query->param('excluding');
- my @operator = $query->param('operator');
- my @value = $query->param('value');
-
- for (my $i=0;$i<=$#marclist;$i++) {
- if ($searchdesc) { # don't put the and_or on the 1st search term
- $searchdesc .= $and_or[$i]." ".$excluding[$i]."
".($marclist[$i]?$marclist[$i]:"*")." ".$operator[$i]." ".$value[$i]." " if
($value[$i]);
- } else {
- $searchdesc = $excluding[$i]."
".($marclist[$i]?$marclist[$i]:"*")." ".$operator[$i]." ".$value[$i]." " if
($value[$i]);
- }
- }
- if ($itemtypesstring ne ''){
- $searchdesc .= 'filtered by itemtypes ';
- $searchdesc .= join(" ",@itemtypes)
- }
- if ($branchesstring ne ''){
- $searchdesc .= ' in branches ';
- $searchdesc .= join(" ",@branches)
- }
- $resultsperpage= $query->param('resultsperpage');
- $resultsperpage = 19 if(!defined $resultsperpage);
- my $orderby = $query->param('orderby');
- my $desc_or_asc = $query->param('desc_or_asc');
- # builds tag and subfield arrays
- my @tags;
-
- foreach my $marc (@marclist) {
- if ($marc) {
- my ($tag,$subfield) =
MARCfind_marc_from_kohafield($dbh,$marc,'');
- if ($tag) {
- push @tags,$dbh->quote("$tag$subfield");
- } else {
- push @tags, $dbh->quote(substr($marc,0,4));
- }
- } else {
- push @tags, "";
- }
- }
- findseealso($dbh,address@hidden);
- my $sqlstring;
- if ($itemtypesstring ne ''){
- $sqlstring = 'and (biblioitems.itemtype IN (';
- my $itemtypeloop=0;
- foreach my $itemtype (@itemtypes){
- if ($itemtype ne ''){
- if ($itemtypeloop != 0){
- $sqlstring .=','
- }
- $sqlstring .= '"'.$itemtype.'"';
- $itemtypeloop++;
- }
- }
- $sqlstring .= '))'
- }
- if ($branchesstring ne ''){
- $sqlstring .= 'and biblio.biblionumber=items.biblionumber and
(items.holdingbranch IN (';
- my $branchesloop=0;
- foreach my $branch (@branches){
- if ($branch ne ''){
- if ($branchesloop != 0){
- $sqlstring .=','
- }
- $sqlstring .= '"'.$branch.'"';
- $branchesloop++;
- }
- }
- $sqlstring .= '))'
- }
-
- my ($results,$total) = catalogsearch1($dbh,
address@hidden,address@hidden,
-
address@hidden, address@hidden, address@hidden,
-
$startfrom*$resultsperpage, $resultsperpage,$orderby,$desc_or_asc,$sqlstring);
- if ($total ==1) {
- if (C4::Context->preference("BiblioDefaultView") eq "normal") {
- print
$query->redirect("/cgi-bin/koha/opac-detail.pl?bib="address@hidden>{biblionumber});
- } elsif (C4::Context->preference("BiblioDefaultView") eq "MARC") {
- print
$query->redirect("/cgi-bin/koha/MARCdetail.pl?bib="address@hidden>{biblionumber});
- } else {
- print
$query->redirect("/cgi-bin/koha/ISBDdetail.pl?bib="address@hidden>{biblionumber});
- }
- exit;
- }
- ($template, $loggedinuser, $cookie)
- = get_template_and_user({template_name =>
"opac-searchresults.tmpl",
- query => $query,
- 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 = ();
-
-### Added by JF
-## This next does a number of things:
-# 1. It allows you to track all the searches made for stats, etc.
-# 2. It fixes the 'searchdesc' variable problem by introducing
-# a. 'searchterms' which comes out as 'Keyword: neal stephenson'
-# b. 'phraseorterm' which comes out as 'neal stephenson'
-# both of these are useful for differen purposes ... I use searchterms
-# for display purposes and phraseorterm for passing the search terms
-# to an external source through a url (like a database search)
-# 3. It provides the variables necessary for the spellchecking (look below for
-# how this is done
-# 4.
-
-$totalresults = $total;
-
-## This formats the 'search results' string and populates
-## the 'OPLIN' variable as well as the 'spellcheck' variable
-## with appropriate values based on the user's search input
-
-my $searchterms; #returned in place of searchdesc for 'results for search'
- # as a string (can format if need be)
-
-my @spphrases;
-my $phraseorterm;
-my %searchtypehash = ( # used only for the searchterms string formation
- # and for spellcheck string
- '0' => 'keyword',
- '1' => 'title',
- '2' => 'author',
- '3' => 'subject',
- '4' => 'series',
- '5' => 'format',
- );
-
-my @searchterm = $query->param('value');
-
-for (my $i=0; $i <= $#searchterm; $i++) {
- my $searchtype = $searchtypehash{$i};
- push @spphrases, $searchterm[$i];
- if ($searchterms) { #don't put and in again
- if ($searchterm[$i]) {
- $phraseorterm.=$searchterm[$i];
- $searchterms.=" AND ".$searchtype." : \'".$searchterm[$i]."\'";
- }
- } else {
- if ($searchterm[$i]) {
- $phraseorterm.=$searchterm[$i];
- $searchterms.=$searchtype.": \'".$searchterm[$i]."\'";
- }
- }
-}
-
-# Spellchecck stuff ... needs to use above scheme but must change
-# cgi script first
-my $phrases = $query->param('value');
-#my $searchterms = $query->param('value');
-# warn "here is searchterms:".$searchterms;
-
-# FIXME: should be obvious ;-)
-#foreach my $phrases (@spphrases) {
-$phrases =~ s/(\.|\?|\:|\!|\'|,|\-|\"|\(|\)|\[|\]|\{|\})/ /g;
-$phrases =~ s/(\Athe |\Aa |\Aan |)//g;
-my $spchkphraseorterm = $phraseorterm;
- $spchkphraseorterm =~ tr/A-Z/a-z/;
- $spchkphraseorterm =~ s/(\.|\?|\:|\!|\'|,|\-|\"|\(|\)|\[|\]|\{|\})/ /g;
- $spchkphraseorterm =~s/(\Aand-or |\Aand\/or |\Aanon |\Aan |\Aa |\Abut
|\Aby |\Ade |\Ader |\Adr |\Adu|et |\Afor |\Afrom |\Ain |\Ainto |\Ait |\Amy
|\Anot |\Aon |\Aor |\Aper |\Apt |\Aspp |\Ato |\Avs |\Awith |\Athe )/ /g;
- $spchkphraseorterm =~s/( and-or | and\/or | anon | an | a | but | by |
de | der | dr | du|et | for | from | in | into | it | my | not | on | or | per
| pt | spp | to | vs | with | the )/ /g;
-
- $spchkphraseorterm =~s/ / /g;
-my $resultcount = $total;
-my $ipaddress = $query->remote_host();
-#
-
-if (
-#need to create a table to record the search info
-#...FIXME: add the script name that creates the table
-#
-my $dbhpop=DBI->connect("DBI:mysql:demosuggest:localhost","auth","YourPass")) {
-
-# insert the search info query
-my $insertpop = "INSERT INTO phrase_log(phr_phrase,phr_resultcount,phr_ip)
VALUES(?,?,?)";
-
-# grab spelling suggestions query
-my $getsugg = "SELECT display FROM spellcheck WHERE
strcmp(soundex(suggestion), soundex(?)) = 0 order by soundex(suggestion) limit
0,5";
-
-#get spelling suggestions when there are no results
-if ($resultcount eq 0) {
- my $sthgetsugg=$dbhpop->prepare($getsugg);
- $sthgetsugg->execute($spchkphraseorterm);
- while (my ($spsuggestion)=$sthgetsugg->fetchrow_array) {
-# warn "==>$spsuggestion";
- #push @spsuggest, +{ spsuggestion => $spsuggestion };
- my %line;
- $line{spsuggestion} = $spsuggestion;
- push @spsuggest,\%line;
- $suggest = 1;
- }
-# warn "==>".$#spsuggest;
- $sthgetsugg->finish;
-}
-# end of spelling suggestions
-
-my $sthpop=$dbhpop->prepare($insertpop);
-
-#$sthpop->execute($phrases,$resultcount,$ipaddress);
-$sthpop->finish;
-}
-#
-### end of tracking stuff -- jmf at kados dot org
-#
-$template->param(suggest => $suggest );
-$template->param( SPELL_SUGGEST => address@hidden );
-$template->param( searchterms => $searchterms );
-$template->param( phraseorterm => $phraseorterm );
-#warn "here's the search terms: ".$searchterms;
-#
-### end of spelling suggestions
-### /Added by JF
-
- for(my $i = 0 ; $i <= $#marclist ; $i++)
- {
- push @field_data, { term => "marclist", val=>$marclist[$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=> address@hidden,
- startfrom => ($i-1)};
- }
- }
- }
-
- my $from = $startfrom*$resultsperpage+1;
- my $to;
-
- if($total < (($startfrom+1)*$resultsperpage))
- {
- $to = $total;
- } else {
- $to = (($startfrom+1)*$resultsperpage);
- }
- my $defaultview =
'BiblioDefaultView'.C4::Context->preference('BiblioDefaultView');
- $template->param(results => $results,
- startfrom=> $startfrom,
- displaynext=>
$displaynext,
- displayprev=>
$displayprev,
- resultsperpage =>
$resultsperpage,
- orderby => $orderby,
- startfromnext =>
$startfrom+1,
- startfromprev =>
$startfrom-1,
-
searchdata=>address@hidden,
- total=>$total,
- from=>$from,
- to=>$to,
- numbers=>address@hidden,
- searchdesc=>
$searchdesc,
- $defaultview => 1,
- suggestion =>
C4::Context->preference("suggestion"),
- virtualshelves =>
C4::Context->preference("virtualshelves"),
- itemtypelist => $itemtypelist,
- subcategorylist => $subcategorylist,
- brancheslist => $brancheslist,
- categorylist => $categorylist,
- mediatypelist => $mediatypelist,
- itemtypesstring => $itemtypesstring,
- );
-
-} else {
- ($template, $loggedinuser, $cookie)
- = get_template_and_user({template_name => "opac-search.tmpl",
- query => $query,
- type => "opac",
- authnotrequired => 1,
- });
-
-
- $sth=$dbh->prepare("Select itemtype,description from itemtypes order by
description");
- $sth->execute;
- my @itemtype;
- my %itemtypes;
- push @itemtype, "";
- $itemtypes{''} = "";
- while (my ($value,$lib) = $sth->fetchrow_array) {
- push @itemtype, $value;
- $itemtypes{$value}=$lib;
- }
-
- my $CGIitemtype=CGI::scrolling_list( -name => 'value',
- -values => address@hidden,
- -labels => \%itemtypes,
- -size => 1,
- -multiple => 0 );
- $sth->finish;
-
- my @branches;
- my @select_branch;
- my %select_branches;
- my ($count2,@branches)=branches();
- push @select_branch, "";
- $select_branches{''} = "";
- for (my $i=0;$i<$count2;$i++){
- push @select_branch, $branches[$i]->{'branchcode'};#
- $select_branches{$branches[$i]->{'branchcode'}} =
$branches[$i]->{'branchname'};
- }
- my $CGIbranch=CGI::scrolling_list( -name => 'value',
- -values => address@hidden,
- -labels => \%select_branches,
- -size => 1,
- -multiple => 0 );
- $sth->finish;
-
- $template->param(itemtypelist => $itemtypelist,
- CGIitemtype => $CGIitemtype,
- CGIbranch => $CGIbranch,
- suggestion =>
C4::Context->preference("suggestion"),
- virtualshelves =>
C4::Context->preference("virtualshelves"),
- );
-}
-# ADDED BY JF
-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
- print
$query->redirect("/cgi-bin/koha/opac-detail.pl?bib=$firstbiblionumber");
-}
-else {
- output_html_with_http_headers $query, $cookie, $template->output;
-}
Index: opac/opac-searchresults.pl
===================================================================
RCS file: opac/opac-searchresults.pl
diff -N opac/opac-searchresults.pl
--- opac/opac-searchresults.pl 4 Jul 2006 14:36:52 -0000 1.19
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,128 +0,0 @@
-#!/usr/bin/perl
-use strict;
-require Exporter;
-use CGI;
-use C4::Search;
-use C4::Biblio;
-use C4::Auth;
-use C4::Interface::CGI::Output;
-use HTML::Template;
-
-my $query=new CGI;
-
-my ($template, $borrowernumber, $cookie)
- = get_template_and_user({template_name => "opac-searchresults.tmpl",
- query => $query,
- type => "opac",
- authnotrequired => 1,
- });
-
-
-my $subject=$query->param('subject');
-
-
-
-if ($subject) {
- $template->param(subjectsearch => $subject);
-}
-
-# get all the search variables
-# we assume that C4::Search will validate these values for us
-my @fields = ('keyword', 'subject', 'author', 'illustrator', 'itemnumber',
'isbn', 'date-before', 'date-after', 'class', 'dewey', 'branch', 'title',
'abstract', 'publisher');
-
-# collect all the fields ...
-my %search;
-
-my $forminputs;
-my $searchdesc = '';
-foreach my $field (@fields) {
- $search{$field} = $query->param($field);
- if ($field eq 'keyword'){
- $search{$field} = $query->param('words') unless $search{$field};
- }
- if ($search{$field}) {
- push @$forminputs, {field => $field, value => $search{$field}};
- $searchdesc .= "$field = $search{$field}, ";
- }
-}
-
-$search{'ttype'} = $query->param('ttype');
-push @$forminputs, {field => 'ttype', value => $search{'ttype'}};
-
-if (my $subjectitems=$query->param('subjectitems')){
- $search{'subject'} = $subjectitems;
- $searchdesc.="subject = $subjectitems, ";
-}
-
address@hidden() unless $forminputs;
-$template->param(FORMINPUTS => $forminputs);
-
-# do the searchs ....
-my $env;
-$env->{itemcount}=1;
-my $number_of_results = 20;
-my @results;
-my $count;
-my $startfrom = $query->param('startfrom');
-my $subjectitems=$query->param('subjectitems');
-if ($subjectitems) {
- address@hidden = subsearch($env,$subjectitems, $number_of_results,
$startfrom);
- @results = subsearch($env, $subjectitems);
- $count = $#results+1;
-} else {
- ($count, @results) =
catalogsearch($env,'',\%search,$number_of_results,$startfrom);
-}
-
-my $num = 1;
-foreach my $res (@results) {
- my @items = ItemInfo(undef, $res->{'biblionumber'}, "intra");
- my $norequests = 1;
- foreach my $itm (@items) {
- $norequests = 0 unless $itm->{'notforloan'};
- }
- $res->{'norequests'} = $norequests;
- # set up the even odd elements....
- $res->{'even'} = 1 if $num % 2 == 0;
- $res->{'odd'} = 1 if $num % 2 == 1;
- $num++;
-}
-
-
-my $startfrom=$query->param('startfrom');
-($startfrom) || ($startfrom=0);
-
-my address@hidden;
-($resultsarray) || (@$resultsarray=());
-
-
-# sorting out which results to display.
-$template->param(startfrom => $startfrom+1);
-($startfrom+$num<=$count) ? ($template->param(endat => $startfrom+$num)) :
($template->param(endat => $count));
-$template->param(numrecords => $count);
-my $nextstartfrom=($startfrom+$num<$count) ? ($startfrom+$num) : (-1);
-my $prevstartfrom=($startfrom-$num>=0) ? ($startfrom-$number_of_results) :
(-1);
-$template->param(nextstartfrom => $nextstartfrom);
-my $displaynext=($nextstartfrom==-1) ? 0 : 1;
-my $displayprev=($prevstartfrom==-1) ? 0 : 1;
-$template->param(displaynext => $displaynext);
-$template->param(displayprev => $displayprev);
-$template->param(prevstartfrom => $prevstartfrom);
-
-$template->param(searchdesc => $searchdesc);
-$template->param(SEARCH_RESULTS => $resultsarray);
-
-my $numbers;
address@hidden = ();
-if ($count>$number_of_results) {
- for (my $i=1; $i<$count/$number_of_results+1; $i++) {
- my $highlight=0;
- my $themelang = $template->param('themelang');
- ($startfrom==($i-1)*$number_of_results+1) && ($highlight=1);
- push @$numbers, { number => $i, highlight => $highlight , startfrom =>
($i-1)*$number_of_results+1 };
- }
-}
-
-$template->param(numbers => $numbers,
-);
-
-output_html_with_http_headers $query, $cookie, $template->output;
Index: opac/opac-sidebar.pl
===================================================================
RCS file: opac/opac-sidebar.pl
diff -N opac/opac-sidebar.pl
--- opac/opac-sidebar.pl 21 May 2006 02:30:53 -0000 1.6
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,32 +0,0 @@
-#!/usr/bin/perl
-use strict;
-require Exporter;
-use CGI;
-
-use C4::Auth; # get_template_and_user
-use HTML::Template;
-
-my $query = new CGI;
-
-my ($template, $borrowernumber, $cookie)
- = get_template_and_user({template_name => "loggedin.tmpl",
- query => $query,
- type => "opac",
- authnotrequired => 1,
- flagsrequired => {borrow => 1},
- });
-
-my @inputs =();
-foreach my $name (param $query) {
- (next) if ($name eq 'userid' || $name eq 'password');
- my $value = $query->param($name);
- push @inputs, {name => $name , value => $value};
-}
-
-$template->param(INPUTS => address@hidden);
-
-my $self_url = $query->url(-absolute => 1);
-$template->param(url => $self_url,
-);
-
-output_html_with_http_headers $query, $cookie, $template->output;
Index: opac/opac-zoomsearch.pl
===================================================================
RCS file: opac/opac-zoomsearch.pl
diff -N opac/opac-zoomsearch.pl
--- opac/opac-zoomsearch.pl 11 Aug 2006 15:55:45 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,501 +0,0 @@
-#!/usr/bin/perl
-
-# Copyright 2006 Liblime
-#
-# 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
-
-# load our Koha modules
-use C4::Context;
-use C4::Interface::CGI::Output;
-use C4::Auth;
-use C4::Search;
-use C4::Biblio;
-use C4::Koha;
-use POSIX qw(ceil floor);
-
-# load other modules
-use HTML::Template;
-use CGI;
-use strict;
-
-my $query=new CGI;
-my $op = $query->param('op'); # show the search form or execute the search
-
-# expanded facet?
-my $expanded_facet = $query->param('expand');
-
-### Gather up all our search queries
-## CQL
-my $cql_query = $query->param('cql_query');
-
-## CCL
-my @previous_ccl_queries; # array of hashes
-my @previous_ccl_queries_array = $query->param('previous_ccl_queries');
-
-my @ccl_query = $query->param('ccl_query');
-my $ccl_query;
-foreach my $ccl (@ccl_query) {
- $ccl_query.="$ccl " if $ccl;
-}
-push @previous_ccl_queries_array, $ccl_query;
-# put the queries in a form the template can use
-my $previous_ccl_queries_hash;
-foreach my $ccl (@previous_ccl_queries_array) {
- if ($ccl) {
- my %row =(
- value => $ccl
- );
- push @previous_ccl_queries, %row;
- }
-}
-## PQF
-my $pqf_query = $query->param('pqf_query');
-
-my @newresults;
-my ($template,$borrowernumber,$cookie);
-my @forminputs; # this is for the links to navigate among the
results when they are more than the maximum number of results per page
-my $searchdesc;
-my $search_type = $query->param('search_type');
-
-my $dbh = C4::Context->dbh;
-## Get Itemtypes (Collection Codes)
-my $itemtypequery="Select itemtype,description from itemtypes order by
description";
-my $sth=$dbh->prepare($itemtypequery);
-$sth->execute;
-my @itemtypeloop;
-my %itemtypes;
-while (my ($value,$lib) = $sth->fetchrow_array) {
- my %row =(
- value => $value,
- description => $lib,
- );
- push @itemtypeloop, \%row;
-
-}
-$sth->finish;
-
-## Get Branches
-my @branches;
-my @select_branch;
-my %select_branches;
-my $branches = getallbranches();
-my @branchloop;
-foreach my $thisbranch (keys %$branches) {
- my $selected = 1 if (C4::Context->userenv && ($thisbranch eq
C4::Context->userenv->{branch}));
- my %row =(
- value => $thisbranch,
- selected => $selected,
- branchname => $branches->{$thisbranch}->{'branchname'},
- );
- push @branchloop, \%row;
-}
-
-## Check if we're searching
-if ($op eq 'get_results') { # Yea, we're searching, load the results template
- ($template, $borrowernumber, $cookie)
- = get_template_and_user({template_name => "opac-results.tmpl",
- query => $query,
- type => "opac",
- authnotrequired => 1,});
-
- my $number_of_results = $query->param('results_per_page');
- $number_of_results = 20 unless ($number_of_results); #this could be a
parameter with 20 50 or 100 results per page
- my $startfrom = $query->param('startfrom');
- ($startfrom) || ($startfrom=0);
-
- ## OK, WE'RE SEARCHING
- # STEP 1. We're a CGI script,so first thing to do is get the
- # query into PQF format so we can use the Koha API properly
- my ($error,$pqf_sort_by, $pqf_prox_ops, $pqf_bool_ops, $nice_query);
- ($error,$pqf_sort_by, $pqf_prox_ops, $pqf_bool_ops, $pqf_query,
$nice_query)= cgi2pqf($query);
- my $then_sort_by = $query->param('then_sort_by');
- # implement a query history
-
- # lets store the query details in an array for later
- push @forminputs, { field => "cql_query" , value => $cql_query} ;
- push @forminputs, { field => "ccl_query" , value => $ccl_query} ;
- push @forminputs, { field => 'pqf_sort_by', value => $pqf_sort_by} ;
- push @forminputs, { field => 'pqf_prox_ops', value => $pqf_prox_ops};
- push @forminputs, { field => 'pqf_bool_ops' , value => $pqf_bool_ops};
- push @forminputs, { field => 'pqf_query' , value => $pqf_query };
- $searchdesc=$cql_query.$ccl_query.$nice_query; # FIXME: this should be
a more use-friendly string
-
- # STEP 2. OK, now we have PQF, so we can pass off the query to
- # the API
- my ($count,@results,$facets);
-
- # queries are handled differently, so alert our API and pass in the
variables
- if ($ccl_query) { # CCL
- if ($query->param('scan')) {
- ($error,$count, $facets,@results) =
searchZOOM('scan','ccl',$ccl_query,$number_of_results,$startfrom,$then_sort_by,$expanded_facet);
- $template->param(scan => 1);
- } else {
- ($error,$count,$facets,@results) =
searchZOOM('search','ccl',$ccl_query,$number_of_results,$startfrom,$then_sort_by,$expanded_facet);
- }
- } elsif ($query->param('cql_query')) { # CQL
- if ($query->param('scan')) {
- ($error,$count,$facets,@results) =
searchZOOM('scan','cql',$cql_query,$number_of_results,$startfrom,$then_sort_by,$expanded_facet);
- $template->param(scan => 1);
- } else {
- ($error,$count,$facets,@results) =
searchZOOM('search','cql',$cql_query,$number_of_results,$startfrom,$then_sort_by,$expanded_facet);
- }
- } else { # we're in PQF territory now
- if ($query->param('scan')) {
- $template->param(scan => 1);
- ($error,$count,$facets,@results) =
searchZOOM('scan','pqf',"$pqf_sort_by $pqf_prox_ops $pqf_bool_ops
$pqf_query",$number_of_results,$startfrom,$then_sort_by,$expanded_facet);
- } else {
- ($error,$count,$facets,@results) =
searchZOOM('search','pqf',"$pqf_sort_by $pqf_prox_ops $pqf_bool_ops
$pqf_query",$number_of_results,$startfrom,$then_sort_by,$expanded_facet);
- }
- }
- @newresults=searchResults(
$searchdesc,$number_of_results,$count,@results) ;
-
- # How many did we get back?
- my $num = scalar(@newresults);
-
- # sorting out which results to display.
- # the result number to start to show
- $template->param(starting => $startfrom+1);
- $template->param(ending => $startfrom+$number_of_results);
- # the result number to end to show
- ($startfrom+$num<=$count) ? ($template->param(endat =>
$startfrom+$num)) : ($template->param(endat => $count));
- # the total results found
- $template->param(total => $count);
- $template->param(FORMINPUTS => address@hidden);
- #$template->param(pqf_query => $pqf_query);
- $template->param(ccl_query => $ccl_query);
- $template->param(searchdesc => $searchdesc );
- $template->param(results_per_page => $number_of_results );
- $template->param(SEARCH_RESULTS => address@hidden);
- $template->param(PREVIOUS_CCL_QUERIES => address@hidden);
- $template->param(facets_loop => $facets);
-
- #this is to show the page numbers to navigate among the results,
whether it has to show the number highlighted or not
- my $numbers;
- @$numbers = ();
- my $pg = 1;
- if (defined($query->param('pg'))) {
- $pg = $query->param('pg');
- }
- my $start = 0;
-
- $start = ($pg - 1) * $number_of_results;
- my $pages = ceil($count / $number_of_results);
- my $total_pages = ceil($count / $number_of_results);
- my $url;
- if ($pg > 1) {
- $url = $pg - 1;
- push @$numbers, {
- number => "<<",
- highlight => 0 ,
- startfrom => 0,
- pg => '1' };
-
- push @$numbers, {
- number => "<",
- highlight => 0 ,
- startfrom => ($url-1)*$number_of_results,
- pg => $url };
- }
- my $current_ten = $pg / 10;
- if ($current_ten == 0) {
- $current_ten = 0.1; # In case it's in ten = 0
- }
- my $from = $current_ten * 10; # Calculate the initial page
- my $end_ten = $from + 9;
- my $to;
- if ($pages > $end_ten) {
- $to = $end_ten;
- } else {
- $to = $pages;
- }
- for (my $i =$from; $i <= $to ; $i++) {
- if ($i == $pg) {
- if ($count > $number_of_results) {
- push @$numbers, {
- number => $i,
- highlight => 1 ,
- startfrom =>
($i-1)*$number_of_results ,
- pg => $i };
- }
- } else {
- push @$numbers, {
- number => $i,
- highlight => 0 ,
- startfrom =>
($i-1)*$number_of_results ,
- pg => $i };
- }
- }
- if ($pg < $pages) {
- $url = $pg + 1;
- push @$numbers, {
- number => ">",
- highlight => 0 ,
- startfrom =>
($url-1)*$number_of_results,
- pg => $url };
-
- push @$numbers, {
- number => ">>",
- highlight => 0 ,
- startfrom =>
($total_pages-1)*$number_of_results,
- pg => $total_pages};
- }
-
- $template->param(
- pqf_sort_by => $pqf_sort_by,
- pqf_query => "$pqf_prox_ops
$pqf_bool_ops $pqf_query",
- numbers => $numbers);
-
-
-
$template->param('Disable_Dictionary'=>C4::Context->preference("Disable_Dictionary"))
if (C4::Context->preference("Disable_Dictionary"));
- my $scan_use = $query->param('use1');
- $template->param(
- #classlist => $classlist,
- suggestion => C4::Context->preference("suggestion"),
- virtualshelves =>
C4::Context->preference("virtualshelves"),
- LibraryName => C4::Context->preference("LibraryName"),
- OpacNav => C4::Context->preference("OpacNav"),
- opaccredits => C4::Context->preference("opaccredits"),
- AmazonContent =>
C4::Context->preference("AmazonContent"),
- opacsmallimage =>
C4::Context->preference("opacsmallimage"),
- opaclayoutstylesheet =>
C4::Context->preference("opaclayoutstylesheet"),
- opaccolorstylesheet =>
C4::Context->preference("opaccolorstylesheet"),
- scan_use => $scan_use,
- search_error => $error,
- );
-
- ## Now let's find out if we have any supplemental data to show the user
- # and in the meantime, save the current query for statistical
purposes, etc.
- my $koha_spsuggest; # a flag to tell if we've got suggestions coming
from Koha
- my @koha_spsuggest; # place we store the suggestions to be returned to
the template as LOOP
- my $phrases = $searchdesc;
- my $ipaddress;
-
- if ( C4::Context->preference("kohaspsuggest") ) {
- eval {
- my $koha_spsuggest_dbh;
- eval {
-
$koha_spsuggest_dbh=DBI->connect("DBI:mysql:suggest:66.213.78.76","auth","Free2cirC");
- };
- if ($@) { warn "can't connect to spsuggest db";
- }
- else {
- my $koha_spsuggest_insert = "INSERT INTO
phrase_log(phr_phrase,phr_resultcount,phr_ip) VALUES(?,?,?)";
- my $koha_spsuggest_query = "SELECT display FROM
distincts WHERE strcmp(soundex(suggestion), soundex(?)) = 0 order by
soundex(suggestion) limit 0,5";
- my $koha_spsuggest_sth =
$koha_spsuggest_dbh->prepare($koha_spsuggest_query);
- $koha_spsuggest_sth->execute($phrases);
- while (my $spsuggestion =
$koha_spsuggest_sth->fetchrow_array) {
- $spsuggestion =~ s/(:|\/)//g;
- my %line;
- $line{spsuggestion} = $spsuggestion;
- push @koha_spsuggest,\%line;
- $koha_spsuggest = 1;
- }
-
- # Now save the current query
-
$koha_spsuggest_sth=$koha_spsuggest_dbh->prepare($koha_spsuggest_insert);
-
#$koha_spsuggest_sth->execute($phrases,$count,$ipaddress);
- $koha_spsuggest_sth->finish;
-
- $template->param( koha_spsuggest =>
$koha_spsuggest ) unless $num;
- $template->param( SPELL_SUGGEST =>
address@hidden,
- branchloop=>address@hidden,
-
itemtypeloop=>address@hidden,
- );
- }
- };
- if ($@) {
- warn "Kohaspsuggest failure:".$@;
- }
- }
-
- ## Spellchecking using Google API
- ## Did you mean? Suggestions using spsuggest table
- #
- # Related Searches
- #
-## OK, we're not searching, load the search template
-} else {
-
- ($template, $borrowernumber, $cookie)
- = get_template_and_user({template_name => "opac-zoomsearch.tmpl",
- query => $query,
- type => "opac",
- authnotrequired => 1,
- });
-
- # set the default tab, etc.
- my $search_type = $query->param('query_form');
- if ((!$search_type) || ($search_type eq 'advanced')) {
- $template->param(advanced_search => 1);
- } elsif ($search_type eq 'format') {
- $template->param(format_search => 1);
- } elsif ($search_type eq 'power') {
- $template->param(power_search => 1);
- } elsif ($search_type eq 'cql') {
- $template->param(power_search => 1);
- } elsif ($search_type eq 'pqf') {
- $template->param(power_search => 1);
- } elsif ($search_type eq 'proximity') {
- $template->param(proximity_search => 1);
- }
-
- $template->param(
- branchloop=>address@hidden,
- itemtypeloop=>address@hidden,
- );
-
-}
-output_html_with_http_headers $query, $cookie, $template->output;
-
-=head2 cgi2pdf
-=cut
-# build a valid PQF query from a CGI form
-sub cgi2pqf {
- my ($query) = @_;
- my $nice_query; # just a string storing a nicely formatted query
- my @default_attributes = ('sort_by');
- # attributes specific to the advanced search - a search_point is
actually a combination of
- # several bib1 attributes
- my @advanced_attributes = ('search_point','op','query');
- # attributes specific to the power search
- my @power_attributes = (
'use','relation','structure','truncation','completeness','op','query');
- # attributes specific to the proximity search
- my @proximity_attributes =
('prox_op','prox_exclusion','prox_distance','prox_ordered','prox_relation','prox_which-code','prox_unit-code','query');
-
- my @specific_attributes; # these will be looped as many times as needed
-
- my $query_form = $query->param('query_form');
-
- # bunch of places to store the various queries we're working with
- my $cql_query = $query->param('cql_query');
-
- my $pqf_query = $query->param('pqf_query');
-
- my @pqf_query_array;
- my @counting_pqf_query_array;
-
- my $pqf_prox_ops = $query->param('pqf_prox_ops');
- my @pqf_prox_ops_array;
-
- my $pqf_bool_ops = $query->param('pqf_bool_ops');
- my @pqf_bool_ops_array;
-
- my $pqf_sort_by = $query->param('pqf_sort_by');
-
- # operators:
-
- # ADVANCED SEARCH
- if (($query_form) eq 'advanced') {
- @specific_attributes = @advanced_attributes;
- # POWER SEARCH
- } elsif (($query_form) eq 'power') {
- @specific_attributes = @power_attributes;
- # PROXIMITY SEARCH
- } elsif (($query_form) eq 'proximity') {
- @specific_attributes = @proximity_attributes;
- }
-
-
- # load the default attributes, set once per query
- foreach my $def_attr (@default_attributes) {
- $pqf_sort_by .= " ".$query->param($def_attr);
- }
- # these are attributes specific to this query_form, set many times per
query
- # First, process the 'operators' and put them in an array
- # proximity and boolean
- foreach my $spec_attr (@specific_attributes) {
- for (my $i=1;$i<15;$i++) {
- if ($query->param("query$i")) { # make sure this set
should be used
- if ($spec_attr =~ /^op/) { # process the
operators separately
- push @pqf_bool_ops_array,
$query->param("$spec_attr$i");
- $nice_query .="
".$query->param("$spec_attr$i")." ".$query->param("query$i");
- $nice_query =~ s/address@hidden/AND/g;
- $nice_query =~ s/address@hidden/OR/g;
- } elsif ($spec_attr =~ /^prox/) { # process the
proximity operators separately
- if ($query->param("$spec_attr$i")) {
- #warn
"PQF:".$query->param("$spec_attr$i");
- push
@pqf_prox_ops_array,$query->param("$spec_attr$i");
- } else {
- if (($spec_attr =~
/^prox_exclusion/) || ($spec_attr =~ /^prox_ordered/)) { # this is an
exception, sloppy way to handle it
- if ($i==2) {
- push
@pqf_prox_ops_array,0;
- }
- }
- }
- }
- }
- }
- }
- # by now, we have two operator arrays: @pqf_bool_ops_array (boolean)
and @pqf_prox_ops_array (proximity)
-
- # Next, we process the attributes (operands)
- for (my $i=1;$i<15;$i++) {
- foreach my $spec_attr (@specific_attributes) {
- if ($query->param("query$i")) {
- if ($spec_attr =~ /^query/) {
- push
@counting_pqf_query_array,$query->param("$spec_attr$i") if
$query->param("$spec_attr$i");
- push
@pqf_query_array,$query->param("$spec_attr$i") if $query->param("$spec_attr$i")
- } elsif ($spec_attr =~ /^op/) { # don't process
the operators again
- } elsif ($spec_attr =~ /^prox/) {
- } else {
- push
@pqf_query_array,$query->param("$spec_attr$i") if $query->param("$spec_attr$i");
- }
- }
- }
- }
-
- # we have to make sure that there # of operators == # of operands-1
- # because second, third, etc queries, come in with an operator attached
- # ...but if there is no previous queries, it should be dropped ...
- # that's what we're doing here
- my $count_pqf_query = @counting_pqf_query_array;
- my $count_pqf_bool_ops = @pqf_bool_ops_array;
-
- if ($count_pqf_bool_ops == $count_pqf_query-1) {
- for (my $i=$count_pqf_query;$i>=0;$i--) {
- $pqf_bool_ops.=" ".$pqf_bool_ops_array[$i];
- }
- } else {
- for (my $i=$count_pqf_query;$i>=1;$i--) {
- $pqf_bool_ops.=" ".$pqf_bool_ops_array[$i];
- }
- }
- foreach my $que(@pqf_query_array) {
- if ($que =~ /@/) {
- $pqf_query .=" ".$que;
- } else {
- $que =~ s/(\"|\'|\.)//g;
- $pqf_query .=" \"".$que."\"";
- }
- }
- foreach my $prox(@pqf_prox_ops_array) {
- $pqf_prox_ops.=" ".$prox;
- }
-
- # finally, nice_query needs to be populated if it hasn't been
- $nice_query = $pqf_query unless $nice_query;
- # and cleaned up FIXME: bad bad ...
- $nice_query =~ s/address@hidden//g;
- $nice_query =~ s/\d+=\d+//g;
- # OK, done with that, now lets have a look
- #warn "Boolean Operators: ".$pqf_bool_ops if $pqf_bool_ops;
- #warn "Proximigy Operators: ".$pqf_prox_ops if $pqf_prox_ops;
- #warn "Sort by: ".$pqf_sort_by;
- #warn "PQF:".$pqf_query;
- #warn "Full PQF: $pqf_sort_by $pqf_prox_ops $pqf_bool_ops $pqf_query";
- #warn "NICE: $nice_query";
- return ('',$pqf_sort_by, $pqf_prox_ops, $pqf_bool_ops, $pqf_query,
$nice_query);
-}
Index: opac/searchoptions.pl
===================================================================
RCS file: opac/searchoptions.pl
diff -N opac/searchoptions.pl
--- opac/searchoptions.pl 2 Jun 2005 04:36:22 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,121 +0,0 @@
-#!/usr/bin/perl
-use strict;
-require Exporter;
-# Searching within results is done by simply adding on parameters onto the
query, being careful to have the requried marclist etc fields.
-use C4::Database;
-use C4::Interface::CGI::Output;
-use C4::Context;
-use CGI;
-my $query = new CGI;
-my $newquery='';
-my $allitemtypesbool = $query->param("allitemtypes");
-my $allbranchesbool = $query->param("allbranches");
-my $allcategoriesbool = $query->param("allcategories");
-my $allsubcategoriesbool = $query->param("allsubcategories");
-my $allmediatypesbool = $query->param("allmediatypes");
-my $nbstatements = $query->param("nbstatementsori");
-my $orderby = $query->param("orderbyori");
-my @keywords = $query->param("keyword");
-my @marclist = $query->param('marclist');
-my @and_or = $query->param('and_or');
-my @excluding = $query->param('excluding');
-my @operator = $query->param('operator');
-my @value = $query->param('value');
-my $searchtype = $query->param('searchtype');
-my $category = $query->param('categorylist');
-my @itemtypeswanted = $query->param("itemtypeswanted");
-my $itemtypessearched = $query->param("itemtypessearched");
-my @mediatypeswanted = $query->param("mediatypeswanted");
-my @subcategorieswanted = $query->param("subcategorieswanted");
-my @brancheswanted = $query->param("brancheswanted");
-my $avail = $query->param("avail");
-
-my $brancheslist;
-my $count=0;
-my $newquery='';
-my $keywordfoundbool=0;
-my $itemtypeslist;
-my $itemtypescatlist;
-my $itemtypessubcatlist;
-my $mediatypeslist;
-
-$count=0;
-my $dbh=C4::Context->dbh;
-$newquery='op=do_search&nbstatements='.$nbstatements;
-if ($allcategoriesbool == 0 && $category ne ''){
-
- my $sth=$dbh->prepare("select itemtypecodes from categorytable where
categorycode=?");
- $sth->execute($category);
- $itemtypescatlist = $sth->fetchrow .'|';
- $sth->finish;
-}
-if ($allmediatypesbool == 0 && @mediatypeswanted ne ''){
- foreach my $mediatype (@mediatypeswanted){
- my $sth=$dbh->prepare("select itemtypecodes from mediatypetable where
mediatypecode=?");
- $sth->execute($mediatype);
- $mediatypeslist .= $sth->fetchrow.'|';
- $sth->finish;
-
- }
-}
-if ($allsubcategoriesbool == 0 && @subcategorieswanted ne ''){
- foreach my $subcategory (@subcategorieswanted){
- my $sth=$dbh->prepare("select itemtypecodes from subcategorytable
where subcategorycode=?");
- $sth->execute($subcategory);
- $itemtypessubcatlist .= $sth->fetchrow.'|';
- $sth->finish;
-
- }
-}
-if ($allitemtypesbool == 0){
-
-$itemtypeslist
.=$itemtypescatlist.$itemtypessubcatlist.$mediatypeslist.$itemtypessearched.join
("|", @itemtypeswanted)
-} else {
-$itemtypeslist
.=$itemtypescatlist.$itemtypessubcatlist.$mediatypeslist.$itemtypessearched
-}
-
-if ($allbranchesbool == 0){
- $brancheslist = join("|",@brancheswanted)
-}
-
-if ($searchtype eq 'NewSearch'){
-
- $newquery .= '&marclist=';
- $newquery .= '&and_or=and';
- $newquery .= '&excluding=';
- $newquery .= '&operator=contains';
- $newquery .= '&value=';
- $newquery .=join(" ",@keywords)
-} elsif ($searchtype eq 'SearchWithin'){
- foreach my $marclistitem (@marclist) {
- $newquery .= '&marclist='.$marclist[$count];
- $newquery .= '&and_or='.$and_or[$count];
- $newquery .= '&excluding='.$excluding[$count];
- $newquery .= '&operator=';
- $newquery .= $operator[$count];
- $newquery .= '&value='.$value[$count];
- if ($marclist[$count] eq ''){
- if ($keywordfoundbool=0){
- $keywordfoundbool=1;
- $newquery .=" ".join(" ",@keywords)
- }
- }
- $count++;
-
- }
- if ($keywordfoundbool == 0 && $query->param('keysub') ne ''){
- $newquery .=
'&marclist=&and_or=and&excluding=&operator=contains&value=';
- $newquery .=join(" ",@keywords)
- }
-}
-$newquery .= '&orderby='.$orderby;
-if ($itemtypeslist ne ''){
- $newquery .= '&itemtypesstring="'.$itemtypeslist.'"'
-}
-if ($brancheslist ne ''){
- $newquery .= '&branchesstring="'.$brancheslist.'"';
-}
-if ($avail ne ''){
- $newquery .= '&avail=1'
-}
-print $query->redirect("/cgi-bin/koha/opac-search.pl?$newquery");
Index: reports/borrowers_stats.plugin
===================================================================
RCS file: reports/borrowers_stats.plugin
diff -N reports/borrowers_stats.plugin
--- reports/borrowers_stats.plugin 11 Sep 2006 17:41:55 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,183 +0,0 @@
-#!/usr/bin/perl
-
-# $Id: borrowers_stats.plugin,v 1.2 2006/09/11 17:41:55 tgarip1957 Exp $
-
-# 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::Auth;
-use CGI;
-use C4::Context;
-use HTML::Template;
-use C4::Search;
-use C4::Output;
-use C4::Koha;
-
-=head1 NAME
-
-plugin that shows a stats on borrowers
-
-=head1 DESCRIPTION
-
-
-=over2
-
-=cut
-
-sub set_parameters {
- my ($template) = @_;
- my $dbh = C4::Context->dbh;
- return $template;
-}
-
-sub calculate {
- my ($line, $column, $filters) = @_;
- my @results =();
- my @mainloop;
- my @loopfooter;
- my @loopcol;
- my @looprow;
- my %globalline;
- my $grantotal =0;
-# extract parameters
- my $dbh = C4::Context->dbh;
-# build the SQL query & execute it
- my $linefilter = "";
- $linefilter = @$filters[0] if ($line =~ /categorycode/ ) ;
- $linefilter = @$filters[4] if ($line =~ /zipcode/ ) ;
- $linefilter = @$filters[2] if ($line =~ /sort1/ ) ;
- $linefilter = @$filters[3] if ($line =~ /sort2/ ) ;
-
- my $colfilter = "";
- $colfilter = @$filters[0] if ($column =~ /categorycode/);
- $colfilter = @$filters[4] if ($column =~ /zipcode/);
- $colfilter = @$filters[2] if ($column =~ /sort1/);
- $colfilter = @$filters[3] if ($column =~ /sort2/);
-
- my @loopfilter;
- for (my $i=0;$i<=4;$i++) {
- my %cell;
- if ( @$filters[$i] ) {
- $cell{filter} .= @$filters[$i];
- $cell{crit} .="Category Code " if ($i==0);
- $cell{crit} .="Status" if ($i==1);
- $cell{crit} .="Sort1" if ($i==2);
- $cell{crit} .="Sort2" if ($i==3);
- $cell{crit} .="Zip Code" if ($i==4);
- push @loopfilter, \%cell;
- }
- }
-# 1st, loop rows.
-#problem with NULL Values.
- my $strsth;
- $strsth .= "select distinctrow $line from borrowers";
- $linefilter =~ s/\*/%/g;
- if ( $linefilter ) {
- $strsth .= " where $line LIKE ? and $line is not null" ;
- } else {
- $strsth .= " where $line is not null" ;
- }
- $strsth .=" order by $line";
- my $sth = $dbh->prepare( $strsth );
- if ( $linefilter ) {
- $sth->execute($linefilter);
- } else {
- $sth->execute;
- }
- while ( my ($celvalue) = $sth->fetchrow) {
- my %cell;
- if ($celvalue) {
- $cell{rowtitle} = $celvalue;
- } else {
- $cell{rowtitle} = "";
- }
- $cell{totalrow} = 0;
- push @looprow, \%cell;
- }
-
-# 2nd, loop cols.
- my $strsth2;
- $colfilter =~ s/\*/%/g;
- $strsth2 .= "select distinctrow $column from borrowers";
- if ( $colfilter ) {
- $strsth2 .= " where $column LIKE ? and $column is not null";
- } else {
- $strsth2 .= " where $column is not null";
- }
- $strsth2 .= " order by $column";
- my $sth2 = $dbh->prepare( $strsth2 );
- if ($colfilter) {
- $sth2->execute($colfilter);
- } else {
- $sth2->execute;
- }
- while (my ($celvalue) = $sth2->fetchrow) {
- my %cell;
- my %ft;
- $cell{coltitle} = $celvalue;
- $ft{totalcol} = 0;
- push @loopcol, \%cell;
- push @loopfooter, \%ft;
- }
-# now, parse each category. Before filling the result array, fill it with 0 to
have every itemtype column.
- my $strcalc .= "SELECT count( * ) FROM borrowers WHERE $line = ? and
$column= ? ";
- $strcalc .= " AND categorycode like '" . @$filters[1] ."%' " if (
@$filters[1] );
- $strcalc .= " AND sort1 like ' " . @$filters[2] ."%'" if ( @$filters[2]
);
- $strcalc .= " AND sort2 like ' " . @$filters[3] ."%'" if ( @$filters[3]
);
- $strcalc .= " AND zipcode like ' " . @$filters[4] ."%'" if (
@$filters[4] );
- my $dbcalc = $dbh->prepare($strcalc);
- my $i=0;
- my @totalcol;
- my $hilighted=-1;
- # for each line
- for (my $i=0; $i<=$#looprow; $i++) {
- my $row = $looprow[$i]->{'rowtitle'};
- my @loopcell;
- my $totalrow=0;
- # for each column
- for (my $j=0;$j<=$#loopcol;$j++) {
- my $col = $loopcol[$j]->{'coltitle'};
- $dbcalc->execute($row,$col);
- my ($value) = $dbcalc->fetchrow;
-# warn "$row / $col / $value";
- $totalrow += $value;
- $grantotal += $value;
- $loopfooter[$j]->{'totalcol'} +=$value;
- push @loopcell,{value => $value};
- }
- $looprow[$i]->{'totalrow'}=$totalrow;
- $looprow[$i]->{'loopcell'address@hidden;
- $looprow[$i]->{'hilighted'} = 1 if $hilighted eq 1;
- $hilighted = -$hilighted;
- }
-
-# # the header of the table
- address@hidden;
- $globalline{looprow} = address@hidden;
-# # the core of the table
- $globalline{loopcol} = address@hidden;
-# # the foot (totals by borrower type)
- $globalline{loopfooter} = address@hidden;
- $globalline{total}= $grantotal;
- $globalline{line} = $line;
- $globalline{column} = $column;
- push @mainloop,\%globalline;
- return address@hidden;
-}
-
-1;
\ No newline at end of file
Index: reports/overdue.pl
===================================================================
RCS file: reports/overdue.pl
diff -N reports/overdue.pl
--- reports/overdue.pl 11 Sep 2006 17:41:55 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,126 +0,0 @@
-#!/usr/bin/perl
-
-# $Id: overdue.pl,v 1.2 2006/09/11 17:41:55 tgarip1957 Exp $
-
-# 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::Context;
-use CGI;
-
-use C4::Auth;
-use C4::Date;
-use C4::Biblio;
-use C4::Search;
-use C4::Interface::CGI::Output;
-use C4::Date;
-my $input = new CGI;
-my $type=$input->param('type');
-
-my $theme = $input->param('theme'); # only used if allowthemeoverride is set
-
-my ($template, $loggedinuser, $cookie)
- = get_template_and_user({template_name => "reports/overdue.tmpl",
- query => $input,
- type => "intranet",
- authnotrequired => 0,
- flagsrequired => {borrowers => 1},
- debug => 1,
- });
-my $duedate;
-my $bornum;
-my $itemnumber;
-my $barcode;
-my $data1;
-my $data2;
-my $data3;
-my $name;
-my $categorycode;
-my $phone;
-my $email;
-my $biblionumber;
-my $title;
-my $author;
-my @datearr = localtime(time());
-my $todaysdate = (1900+$datearr[5]).'-'.sprintf ("%0.2d",
($datearr[4]+1)).'-'.sprintf ("%0.2d", $datearr[3]);
-my $dateformatted= sprintf ("%0.2d", $datearr[3]).'-'.sprintf ("%0.2d",
($datearr[4]+1)).'-'.(1900+$datearr[5]);
-my $dbh = C4::Context->dbh;
-my $count=0;
-my @results;
-my @kohafields;
-my @values;
-my @relations;
-my $sort;
-my @and_or;
-push @kohafields, "date_due","date_due";
-push @values,$todaysdate,"0000-00-00";
-push @relations ,"address@hidden 2=1","address@hidden 2=5"; ##
-push @and_or,"address@hidden";
-
($count,@results)=ZEBRAsearch_kohafields(address@hidden,address@hidden,address@hidden,$sort,address@hidden);
-
-
-
-my @overduedata;
-foreach my $xml(@results) {
-my @kohafields; ## just parse the fields required
-push
@kohafields,"title","author","biblionumber","itemnumber","barcode","date_due","borrowernumber";
-my ($biblio,@itemrecords) = XMLmarc2koha($dbh,$xml,"",@kohafields);
- foreach my $data(@itemrecords){
- if ($data->{'date_due'} lt $todaysdate && $data->{'date_due'} gt
"0000-00-00" ){
- $duedate=format_date($data->{'date_due'});
- $bornum=$data->{'borrowernumber'};
- $itemnumber=$data->{'itemnumber'};
- $biblionumber=$data->{'biblionumber'};
- $barcode=$data->{'barcode'};
-
- my $sth1=$dbh->prepare("select concat(firstname,'
',surname),phone,emailaddress,categorycode from borrowers where
borrowernumber=?");
- $sth1->execute($bornum);
- $data1=$sth1->fetchrow_hashref;
- $name=$data1->{'concat(firstname,\' \',surname)'};
- $phone=$data1->{'phone'};
- $categorycode=$data1->{'categorycode'};
- $email=$data1->{'emailaddress'};
- $sth1->finish;
-
-
-
-
-
- $title=$biblio->{'title'};
- $author=$biblio->{'author'};
- push (@overduedata, { duedate => format_date($duedate),
- bornum => $bornum,
- itemnum => $itemnumber,
- name => $name,
- categorycode => $categorycode,
- phone => $phone,
- email => $email,
- biblionumber => $biblionumber,
-
- barcode =>$barcode,
- title => $title,
- author => $author });
- }## if overdue
-
- }##foreach item
-}## for each biblio
-
-$template->param( dateformatted => $dateformatted,
count=>$count,
- overdueloop => address@hidden );
-
-output_html_with_http_headers $input, $cookie, $template->output;
Index: reports/stats.pl
===================================================================
RCS file: reports/stats.pl
diff -N reports/stats.pl
--- reports/stats.pl 11 Sep 2006 17:41:55 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,138 +0,0 @@
-#!/usr/bin/perl
-
-# $Id: stats.pl,v 1.2 2006/09/11 17:41:55 tgarip1957 Exp $
-
-#written 14/1/2000
-#script to display reports
-
-
-# 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 CGI;
-use C4::Output;
-use C4::Auth;
-use C4::Interface::CGI::Output;
-use C4::Context;
-use Date::Manip;
-use C4::Stats;
-
-my $input=new CGI;
-my $time=$input->param('time');
-my $date=$input->param('from');
-my $date2=$input->param('to');
-my ($template, $loggedinuser, $cookie)
- = get_template_and_user({template_name => "stats.tmpl",
- query => $input,
- type => "intranet",
- authnotrequired => 0,
- flagsrequired => {borrowers => 1},
- debug => 1,
- });
-
-
-
-my @payments=TotalPaid($date,$date2);
-my address@hidden;
-my $total=0;
-my $oldtime;
-my $totalw=0;
-my @loop;
-my %row;
-my $i=0;
-while ($i<$count){
-# warn " pay : ".$payments[$i]{'timestamp'};
- my $time=$payments[$i]{'datetime'};
- my $payments=$payments[$i]{'value'};
- my $charge=0;
- my @temp=split(/ /,$payments[$i]{'datetime'});
- my $date=$payments[$i]{'date'};
-
- my
@charges=getcharges($payments[$i]{'borrowernumber'},$payments[$i]{'date'});
- my address@hidden;
-warn "$count2";
- my $temptotalf=0;
- my $temptotalr=0;
- my $temptotalres=0;
- my $temptotalren=0;
- my $temptotalw=0;
- for (my $i2=0;$i2<$count2;$i2++){
- $charge+=$charges[$i2]->{'amount'};
- %row = ( name => $charges[$i2]->{'description'},
- type =>
$charges[$i2]->{'accounttype'},
- time => $charges[$i2]->{'timestamp'},
- amount => $charges[$i2]->{'amount'},
- branch =>
$charges[$i2]->{'amountoutstanding'} );
- push(@loop, \%row);
- if ($payments[$i]{'accountytpe'} ne 'W'){
- if ($charges[$i2]->{'accounttype'} eq 'Rent'){
-
$temptotalr+=$charges[$i2]->{'amount'}-$charges[$i2]->{'amountoutstanding'};
- }
- if ($charges[$i2]->{'accounttype'} eq 'F' ||
$charges[$i2]->{'accounttype'} eq 'FU' || $charges[$i2]->{'accounttype'} eq
'FN' ){
-
$temptotalf+=$charges[$i2]->{'amount'}-$charges[$i2]->{'amountoutstanding'};
- }
- if ($charges[$i2]->{'accounttype'} eq 'Res'){
-
$temptotalres+=$charges[$i2]->{'amount'}-$charges[$i2]->{'amountoutstanding'};
- }
- if ($charges[$i2]->{'accounttype'} eq 'R'){
-
$temptotalren+=$charges[$i2]->{'amount'}-$charges[$i2]->{'amountoutstanding'};
- }
- }
- }
- my $hour=substr($payments[$i]{'timestamp'},8,2);
- my $min=substr($payments[$i]{'timestamp'},10,2);
- my $sec=substr($payments[$i]{'timestamp'},12,2);
- my $time="$hour:$min:$sec";
- my $time2="$payments[$i]{'date'}";
- my $branch=Getpaidbranch($time2,$payments[$i]{'borrowernumber'});
- my $bornum=$payments[$i]{'borrowernumber'};
- my $oldtime=$payments[$i]{'timestamp'};
- my $oldtype=$payments[$i]{'accounttype'};
- while ($bornum eq $payments[$i]{'borrowernumber'} && $oldtype ==
$payments[$i]{'accounttype'} && $oldtime eq $payments[$i]{'timestamp'}){
- my $hour=substr($payments[$i]{'timestamp'},8,2);
- my $min=substr($payments[$i]{'timestamp'},10,2);
- my $sec=substr($payments[$i]{'timestamp'},12,2);
- my $time="$hour:$min:$sec";
- my $time2="$payments[$i]{'date'}";
- my
$branch=Getpaidbranch($time2,$payments[$i]{'borrowernumber'});
- if ($payments[$i]{'accounttype'} eq 'W'){
- $totalw+=$payments[$i]{'amount'};
- } else {
- $payments[$i]{'amount'}=$payments[$i]{'amount'}*-1;
- $total+=$payments[$i]{'amount'};
- }
-
- %row = ( name =>
"<b>".$payments[$i]{'firstname'}.$payments[$i]{'surname'} . "</b>",
- type => $payments[$i]{'accounttype'},
time => $payments[$i]{'date'},
- amount => $payments[$i]{'amount'},
branch => $branch );
- push(@loop, \%row);
- $oldtype=$payments[$i]{'accounttype'};
- $oldtime=$payments[$i]{'timestamp'};
- $bornum=$payments[$i]{'borrowernumber'};
- $i++;
- }
-
-}
-
-$template->param( loop1 => address@hidden,
- totalw => $totalw,
- total => $total );
-
-output_html_with_http_headers $input, $cookie, $template->output;
-
-
Index: reports/transfers.plugin
===================================================================
RCS file: reports/transfers.plugin
diff -N reports/transfers.plugin
--- reports/transfers.plugin 11 Sep 2006 17:41:55 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,105 +0,0 @@
-#!/usr/bin/perl
-
-# $Id: transfers.plugin,v 1.1 2006/09/11 17:41:55 tgarip1957 Exp $
-
-# 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::Auth;
-use CGI;
-use C4::Context;
-use C4::Search;
-use C4::Output;
-use C4::Koha;
-
-=head1
-
-=cut
-
-sub set_parameters {
- my ($template) = @_;
- my $dbh = C4::Context->dbh;
- my $branches=GetBranches();
- my @branches;
- my @select_branch;
- my %select_branches;
- push @select_branch,"";
- $select_branches{""} = "";
- foreach my $branch (keys %$branches) {
- push @select_branch, $branch;
- $select_branches{$branch} =
$branches->{$branch}->{'branchname'};
- }
- my $CGIbranch=CGI::scrolling_list( -name => 'value',
- -id => 'value',
- -values => address@hidden,
- -labels => \%select_branches,
- -size => 1,
- -multiple => 0 );
- $template->param(CGIbranch => $CGIbranch);
- return $template;
-}
-sub calculate {
- my ($parameters) = @_;
- my @results =();
- my $branch = @$parameters[0];
- my $dbh = C4::Context->dbh;
- my $sth;
- if ($branch) {
- $sth = $dbh->prepare("SELECT
i.itemnumber,i.barcode,i.biblionumber,ms.tobranch,ms.frombranch,ms.datearrived,ms.comments
FROM `items` i
- left join branchtransfers as ms on i.itemnumber=ms.itemnumber
- where ms.frombranch=? order by ms.datearrived desc");
- $sth->execute($branch);
- } else {
- $sth = $dbh->prepare("SELECT
i.itemnumber,i.barcode,i.biblionumber,ms.tobranch,ms.frombranch,ms.datearrived,ms.comments
FROM `items` i, branchtransfers as ms
- where i.itemnumber=ms.itemnumber and ms.itemnumber is not null
order by ms.datearrived desc");
- $sth->execute;
- }
-
- my
($itemnumber,$barcode,$biblionumber,$currentbranch,$origbranch,$date,$by);
- my $nbresult=$dbh->prepare("SELECT FOUND_ROWS()");
- $nbresult->execute;
- my $grantotal = $nbresult->fetchrow;
- my $count = 0;
- while
(($itemnumber,$barcode,$biblionumber,$currentbranch,$origbranch,$date,$by) =
$sth->fetchrow) {
- my %line;
- if($count % 2){
- $line{toggle} = 1;
- } else {
- $line{toggle} = 0;
- }
- $line{itemnumber} = $itemnumber;
- $line{barcode} = $barcode;
- $line{biblionumber} = $biblionumber;
-
- $line{currentb} = $currentbranch;
- $line{origb} = $origbranch;
- $line{date} = $date;
- $line{by} = $by;
- push @results,\%line;
- $count ++;
- }
- my @mainloop;
- my %globalline;
- $globalline{loopitemtype} = address@hidden;
- $globalline{total} = $grantotal;
- $globalline{branch} = $branch;
- push @mainloop,\%globalline;
- return address@hidden;
-}
-
-1;
\ No newline at end of file
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Koha-cvs] koha opac/getfromintranet.PL opac/opac-membersh...,
paul poulain <=