[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] koha/cataloguing addbooks.pl isbnsearch.pl
From: |
Tumer Garip |
Subject: |
[Koha-cvs] koha/cataloguing addbooks.pl isbnsearch.pl |
Date: |
Fri, 01 Sep 2006 22:28:34 +0000 |
CVSROOT: /sources/koha
Module name: koha
Changes by: Tumer Garip <tgarip1957> 06/09/01 22:28:34
Modified files:
cataloguing : addbooks.pl isbnsearch.pl
Log message:
Z3950 search when adding a bibblio using ZOOM.
Servers chosen on the fly
If during a modification allows imported file to replace existing biblio
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/cataloguing/addbooks.pl?cvsroot=koha&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/koha/cataloguing/isbnsearch.pl?cvsroot=koha&r1=1.3&r2=1.4
Patches:
Index: addbooks.pl
===================================================================
RCS file: /sources/koha/koha/cataloguing/addbooks.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- addbooks.pl 19 Jan 2006 12:48:00 -0000 1.2
+++ addbooks.pl 1 Sep 2006 22:28:34 -0000 1.3
@@ -1,19 +1,6 @@
#!/usr/bin/perl
-# $Id: addbooks.pl,v 1.2 2006/01/19 12:48:00 tipaul Exp $
-
-#
-# Modified address@hidden 12:00 01 April 2001
-# The biblioitemnumber was not correctly initialised
-# The max(barcode) value was broken - koha 'barcode' is a string value!
-# - If left blank, barcode value now defaults to max(biblionumber)
-
-#
-# TODO
-#
-# Add info on biblioitems and items already entered as you enter new ones
-#
-# Add info on biblioitems and items already entered as you enter new ones
+# $Id: addbooks.pl,v 1.3 2006/09/01 22:28:34 tgarip1957 Exp $
# Copyright 2000-2002 Katipo Communications
#
@@ -35,11 +22,9 @@
use strict;
use CGI;
use C4::Auth;
-# use C4::Catalogue;
use C4::Biblio;
use C4::Output;
use C4::Interface::CGI::Output;
-use HTML::Template;
use C4::Koha;
my $query = new CGI;
Index: isbnsearch.pl
===================================================================
RCS file: /sources/koha/koha/cataloguing/isbnsearch.pl,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- isbnsearch.pl 10 Aug 2006 13:08:28 -0000 1.3
+++ isbnsearch.pl 1 Sep 2006 22:28:34 -0000 1.4
@@ -19,24 +19,32 @@
use strict;
use CGI;
+
use C4::Auth;
use C4::Biblio;
use C4::Search;
-use C4::Breeding;
use C4::Output;
use C4::Interface::CGI::Output;
-use HTML::Template;
+use C4::Breeding;
use C4::Koha;
my $input = new CGI;
+my $isbn = $input->param('isbn');
+my $title = $input->param('title');
my $offset = $input->param('offset');
my $num = $input->param('num');
-# my $total;
-# my $count;
-# my @results;
+my $showoffset = $offset + 1;
+my $total;
+my $count;
+my @results;
+my %search;
+my $toggle;
my $marc_p = C4::Context->boolean_preference("marc");
-my $dbh = C4::Context->dbh;
-
+my $SQLorZEBRA=C4::Context->preference("SQLorZEBRA");
+if ( !$isbn && !$title ) {
+ print $input->redirect('addbooks.pl');
+}
+else {
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
{
template_name => "cataloguing/isbnsearch.tmpl",
@@ -51,127 +59,107 @@
# fill with books in ACTIVE DB (biblio)
if ( !$offset ) {
$offset = 0;
+ $showoffset = 1;
}
if ( !$num ) { $num = 10 }
- my @marclist = $input->param('marclist');
- my @and_or = $input->param('and_or');
- my @excluding = $input->param('excluding');
- my @operator = $input->param('operator');
- my @value = $input->param('value');
- my $title= @value[0];
- my $isbn = @value[1];
- my $resultsperpage= $input->param('resultsperpage');
- $resultsperpage = 10 if(!defined $resultsperpage);
- my $startfrom=$input->param('startfrom');
- $startfrom=0 if(!defined $startfrom);
- my $orderby = $input->param('orderby');
- my $desc_or_asc = $input->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 ($results,$total) = catalogsearch($dbh,
address@hidden,address@hidden,
-
address@hidden, address@hidden, address@hidden,
-
$startfrom*$resultsperpage, $resultsperpage,'biblio.title','ASC');
- warn "NB::::".$total;
-
-# @results = @$resultsref;
-
-# my @loop_data = ();
-# my $toggle;
-# for ( my $i = $offset ; $i < $total ; $i++ ) {
-# if ( $i % 2 ) {
-# $toggle = 0;
-# } else {
-# $toggle = 1;
-# }
-# my %row_data; # get a fresh hash for the row data
-# $row_data{toggle} = $toggle;
-# $row_data{biblionumber} = $results[$i]->{'biblionumber'};
-# $row_data{title} = $results[$i]->{'title'};
-# $row_data{author} = $results[$i]->{'author'};
-# $row_data{copyrightdate} = $results[$i]->{'copyrightdate'};
-# $row_data{classification} = $results[$i]->{'classification'};
-# $row_data{NOTMARC} = !$marc_p;
-# push ( @loop_data, \%row_data );
-# }
- # 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 <= $#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 @kohafield;
+my @value;
+my @relation;
+my @and_or;
+my $order="title";
+if ($isbn){
+$search{'isbn'}=$isbn;
+push @kohafield, "isbn";
+push @value,$isbn;
+}else{
+$search{'title'}=$title;
+push @kohafield, "title";
+push @value,$title;
+push @relation, "address@hidden 5=1 address@hidden 6=3 address@hidden 4=1
address@hidden 3=1 ";
+ }
+$search{avoidquerylog}=1;
+if ($SQLorZEBRA eq "sql"){
+($count, @results) =cataloguing_search(\%search,$num,$offset);
+}else{
+($count,@results) =ZEBRAsearch_kohafields(address@hidden,address@hidden,
address@hidden,$order, address@hidden, 1,"",$offset, $num,"intranet");
+
+}
+my $grandtotal=$count;
+ if ( $count < ( $offset + $num ) ) {
+ $total = $count;
}
+ else {
+ $total = $offset + $num;
+ } # else
+
+ my @loop_data;
+ @address@hidden if $count >0;;
+ $template->param( startfrom => $offset + 1 );
+ ( $offset + $num <= $count )
+ ? ( $template->param( endat => $offset + $num ) )
+ : ( $template->param( endat => $count ) );
+ $template->param( numrecords => $count );
+ my $nextstartfrom = ( $offset + $num < $count ) ? ( $offset + $num ) :
(-1);
+ my $prevstartfrom = ( $offset - $num >= 0 ) ? ( $offset - $num ) : (-1);
+ $template->param( nextstartfrom => $nextstartfrom );
+ my $displaynext = 1;
+ my $displayprev = 0;
+ ( $nextstartfrom == -1 ) ? ( $displaynext = 0 ) : ( $displaynext = 1 );
+ ( $prevstartfrom == -1 ) ? ( $displayprev = 0 ) : ( $displayprev = 1 );
+ $template->param( displaynext => $displaynext );
+ $template->param( displayprev => $displayprev );
my @numbers = ();
+ my $term;
+ my $value;
- 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)};
- }
+ if ($isbn) {
+ $term = "isbn";
+ $value = $isbn;
}
+ else {
+ $term = "title";
+ $value = $title;
}
- my $from = $startfrom*$resultsperpage+1;
- my $to;
-
- if($total < (($startfrom+1)*$resultsperpage))
+ if ( $count > 10 ) {
+ for ( my $i = 1 ; $i < $count / 10 + 1 ; $i++ ) {
+ if ( $i < 16 ) {
+ my $highlight = 0;
+ ( $offset == ( $i - 1 ) * 10 ) && ( $highlight = 1 );
+ push @numbers,
{
- $to = $total;
- } else {
- $to = (($startfrom+1)*$resultsperpage);
+ number => $i,
+ highlight => $highlight,
+ term => $term,
+ value => $value,
+ startfrom => ( $i - 1 ) * 10
+ };
+ }
+ }
}
# fill with books in breeding farm
- my $toggle=0;
- my ( $countbr, @resultsbr ) = BreedingSearch( @value[0], @value[1] );
+ ( $count, @results ) = BreedingSearch( $title, $isbn );
my @breeding_loop = ();
- for ( my $i = 0 ; $i <= $#resultsbr ; $i++ ) {
+ for ( my $i = 0 ; $i <= $#results ; $i++ ) {
my %row_data;
if ( $i % 2 ) {
- $toggle = 0;
+ $toggle = "#ffffcc";
}
else {
- $toggle = 1;
+ $toggle = "white";
}
$row_data{toggle} = $toggle;
- $row_data{id} = $resultsbr[$i]->{'id'};
- $row_data{isbn} = $resultsbr[$i]->{'isbn'};
- $row_data{file} = $resultsbr[$i]->{'file'};
- $row_data{title} = $resultsbr[$i]->{'title'};
- $row_data{author} = $resultsbr[$i]->{'author'};
- $row_data{NOTMARC}= !$marc_p;
+ $row_data{id} = $results[$i]->{'id'};
+ $row_data{isbn} = $results[$i]->{'isbn'};
+ $row_data{file} = $results[$i]->{'file'};
+ $row_data{title} = $results[$i]->{'title'};
+ $row_data{author} = $results[$i]->{'author'};
+ $row_data{classification} = $results[$i]->{'classification'};
+ $row_data{subclass} = $results[$i]->{'subclass'};
push ( @breeding_loop, \%row_data );
}
-
- # get framework list
+# get framework list
my $frameworks = getframeworks;
my @frameworkcodeloop;
foreach my $thisframeworkcode (keys %$frameworks) {
@@ -181,29 +169,21 @@
push @frameworkcodeloop, \%row;
}
+
$template->param(
- title => $title,
isbn => $isbn,
- startfrom=> $startfrom,
- displaynext=>
$displaynext,
- displayprev=>
$displayprev,
- resultsperpage =>
$resultsperpage,
- startfromnext =>
$startfrom+1,
- startfromprev =>
$startfrom-1,
-
searchdata=>address@hidden,
- numbers=>address@hidden,
- from => $from,
- to => $to,
+ title => $title,
+ showoffset => $showoffset,
total => $total,
-# offset => $offset,
- loop => $results,
+ grandtotal => $grandtotal,
+ offset => $offset,
+ results_loop => address@hidden,
breeding_loop => address@hidden,
- NOTMARC => !$marc_p,
- frameworkcodeloop => address@hidden,
+ numbers => address@hidden,
+ term => $term,
+ value => $value,
+ frameworkcodeloop => address@hidden
);
- print $input->header(
- -type => guesstype( $template->output ),
- -cookie => $cookie
- ),
- $template->output;
+ output_html_with_http_headers $input, $cookie, $template->output;
+} # else
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Koha-cvs] koha/cataloguing addbooks.pl isbnsearch.pl,
Tumer Garip <=