From cc840a7bfa0c1a3ea74e939055c4c5d8ccd704e4 Mon Sep 17 00:00:00 2001 From: truth_nz Date: Wed, 22 May 2002 18:35:25 +0000 Subject: [PATCH] Update to acqui.simple system. Hopefully this is a lot more user friendly. Probably a few bug fixes to come still. --- C4/Acquisitions.pm | 75 +++---- acqui.simple/addbiblioitem.pl | 126 ----------- acqui.simple/addbooks.pl | 12 +- acqui.simple/additem.pl | 285 ++++++++++++++++++++---- acqui.simple/isbnsearch.pl | 98 +++++++- acqui.simple/keywordsearch.pl | 10 +- acqui.simple/savebiblio.pl | 2 +- acqui.simple/savebiblioitem.pl | 44 ---- acqui.simple/saveitem.pl | 68 ++++-- acqui.simple/websitesearch.pl | 4 +- detail.pl | 393 ++++++--------------------------- moredetail.pl | 269 ++++++++-------------- 12 files changed, 579 insertions(+), 807 deletions(-) delete mode 100755 acqui.simple/addbiblioitem.pl delete mode 100755 acqui.simple/savebiblioitem.pl diff --git a/C4/Acquisitions.pm b/C4/Acquisitions.pm index c31e137b73..fa22e409ae 100644 --- a/C4/Acquisitions.pm +++ b/C4/Acquisitions.pm @@ -18,7 +18,8 @@ $VERSION = 0.01; &findall &needsmod &delitem &deletebiblioitem &delbiblio &delorder &branches &getallorders &getrecorders &updatecurrencies &getorder &getcurrency &updaterecorder &updatecost &checkitems &modnote &getitemtypes &getbiblio -&getbiblioitem &getitemsbybiblioitem &isbnsearch &keywordsearch +&getbiblioitembybiblionumber +&getbiblioitem &getitemsbybiblioitem &isbnsearch &websitesearch &addwebsite &updatewebsite &deletewebsite); %EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ], @@ -959,6 +960,7 @@ sub newitems { foreach my $barcode (@barcodes) { $barcode = uc($barcode); + $barcode = $dbh->quote($barcode); $query = "Insert into items set itemnumber = $itemnumber, biblionumber = $item->{'biblionumber'}, @@ -1201,6 +1203,7 @@ sub delbiblio{ $dbh->disconnect; } + sub getitemtypes { my $dbh = C4Connect; my $query = "select * from itemtypes"; @@ -1266,6 +1269,28 @@ biblioitemnumber = $biblioitemnum"; } # sub getbiblioitem +sub getbiblioitembybiblionumber { + my ($biblionumber) = @_; + my $dbh = C4Connect; + my $query = "Select * from biblioitems where biblionumber = +$biblionumber"; + my $sth = $dbh->prepare($query); + my $count = 0; + my @results; + + $sth->execute; + + while (my $data = $sth->fetchrow_hashref) { + $results[$count] = $data; + $count++; + } # while + + $sth->finish; + $dbh->disconnect; + return($count, @results); +} # sub + + sub getitemsbybiblioitem { my ($biblioitemnum) = @_; my $dbh = C4Connect; @@ -1299,7 +1324,9 @@ sub isbnsearch { my @results; $isbn = $dbh->quote($isbn); - $query = "Select * from biblioitems where isbn = $isbn"; + $query = "Select biblio.* from biblio, biblioitems where +biblio.biblionumber = biblioitems.biblionumber +and isbn = $isbn"; $sth = $dbh->prepare($query); $sth->execute; @@ -1314,50 +1341,6 @@ sub isbnsearch { } # sub isbnsearch -sub keywordsearch { - my ($keywordlist) = @_; - my $dbh = C4Connect; - my $query = "Select * from biblio where"; - my $count = 0; - my $sth; - my @results; - my @keywords = split(/ +/, $keywordlist); - my $keyword = shift(@keywords); - - $keyword =~ s/%/\\%/g; - $keyword =~ s/_/\\_/; - $keyword = "%" . $keyword . "%"; - $keyword = $dbh->quote($keyword); - $query .= " (author like $keyword) or -(title like $keyword) or (unititle like $keyword) or -(notes like $keyword) or (seriestitle like $keyword) or -(abstract like $keyword)"; - - foreach $keyword (@keywords) { - $keyword =~ s/%/\\%/; - $keyword =~ s/_/\\_/; - $keyword = "%" . $keyword . "%"; - $keyword = $dbh->quote($keyword); - $query .= " or (author like $keyword) or -(title like $keyword) or (unititle like $keyword) or -(notes like $keyword) or (seriestitle like $keyword) or -(abstract like $keyword)"; - } # foreach - - $sth = $dbh->prepare($query); - $sth->execute; - - while (my $data = $sth->fetchrow_hashref) { - $results[$count] = $data; - $count++; - } # while - - $sth->finish; - $dbh->disconnect; - return($count, @results); -} # sub keywordsearch - - sub websitesearch { my ($keywordlist) = @_; my $dbh = C4Connect; diff --git a/acqui.simple/addbiblioitem.pl b/acqui.simple/addbiblioitem.pl deleted file mode 100755 index fc019dba39..0000000000 --- a/acqui.simple/addbiblioitem.pl +++ /dev/null @@ -1,126 +0,0 @@ -#!/usr/bin/perl - -use CGI; -use strict; -use C4::Acquisitions; -use C4::Output; - -my $input = new CGI; -my $biblionumber = $input->param('biblionumber'); -my $title; -my $count; -my @results; - -if (! $biblionumber) { - print $input->redirect('addbooks.pl'); -} else { - - ($count, @results) = &getbiblio($biblionumber); - - if (! $count) { - print $input->redirect('addbooks.pl'); - } else { - $title = @results[0]->{'title'}; - - print $input->header; - print startpage(); - print startmenu('acquisitions'); - - print << "EOF"; -Adding New Group Information - $title - - - -
Section Two: Publication information
-

-

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Publisher:
Publication Year:Place of Publication:
Illustrator:
ISBN:
Additional Authors:
One Author per line
Subject Headings:
One Subject per line
Format:
URL:
Dewey:Dewey Subclass:
ISSN:LCCN: -
Volume:Number:
Volume Description:
Pages:Size:
Notes:
-EOF - - print endmenu(); - print endpage(); - } # else -} # else diff --git a/acqui.simple/addbooks.pl b/acqui.simple/addbooks.pl index 07a1ddf376..958cbd477c 100755 --- a/acqui.simple/addbooks.pl +++ b/acqui.simple/addbooks.pl @@ -50,16 +50,16 @@ EOF - - - + + + - - - + + + diff --git a/acqui.simple/additem.pl b/acqui.simple/additem.pl index b91c516955..ab064b0ca1 100755 --- a/acqui.simple/additem.pl +++ b/acqui.simple/additem.pl @@ -6,99 +6,288 @@ use C4::Acquisitions; use C4::Output; my $input = new CGI; -my $biblioitemnum = $input->param('biblioitemnum'); +my $biblionumber = $input->param('biblionumber'); +my $error = $input->param('error'); my $maxbarcode; my $isbn; -my $count; -my @results; +my $bibliocount; +my @biblios; +my $biblioitemcount; +my @biblioitems; my $branchcount; my @branches; +my %branchnames; +my $itemcount; +my @items; +my $itemtypecount; +my @itemtypes; +my %itemtypedescriptions; -if (! $biblioitemnum) { +if (! $biblionumber) { print $input->redirect('addbooks.pl'); } else { - ($count, @results) = &getbiblioitem($biblioitemnum); - - if (! $count) { + ($bibliocount, @biblios) = &getbiblio($biblionumber); + + if (! $bibliocount) { print $input->redirect('addbooks.pl'); } else { - $isbn = $results[0]->{'isbn'}; - $maxbarcode = $results[0]->{'biblionumber'}; - + + ($biblioitemcount, @biblioitems) = &getbiblioitembybiblionumber($biblionumber); + ($branchcount, @branches) = &branches; + ($itemtypecount, @itemtypes) = &getitemtypes; + + for (my $i = 0; $i < $itemtypecount; $i++) { + $itemtypedescriptions{$itemtypes[$i]->{'itemtype'}} = $itemtypes[$i]->{'description'}; + } # for + + for (my $i = 0; $i < $branchcount; $i++) { + $branchnames{$branches[$i]->{'branchcode'}} = $branches[$i]->{'branchname'}; + } # for + print $input->header; print startpage(); print startmenu('acquisitions'); - - ($count, @results) = &getitemsbybiblioitem($biblioitemnum); - ($branchcount, @branches) = &branches; - if ($count) { + print << "EOF"; +$biblios[0]->{'title'} +

+EOF + + if ($error eq "nobarcode") { print << "EOF"; -

+You must give the item a barcode

-

ISBN:Keyword:
Keyword:ISBN:
- - +EOF + } elsif ($error eq "nobiblioitem") { + print << "EOF"; +You must create a new group for your item to be added to +

+EOF + } elsif ($error eq "barcodeinuse") { + print << "EOF"; +Sorry, that barcode is already in use +

+EOF + } # elsif + print << "EOF"; +

Existing Items with ISBN $isbn
+ + + + + - - EOF - for (my $i = 0; $i < $count; $i++) { + for (my $i = 0; $i < $biblioitemcount; $i++) { + if ($biblioitems[$i]->{'itemtype'} eq "WEB") { + print << "EOF"; - - - - - + + + + + EOF - } # for - print << "EOF"; -
BIBLIO RECORD $biblionumber
Author: $biblios[0]->{'author'}
+Copyright: $biblios[0]->{'copyrightdate'}
+Series Title: $biblios[0]->{'seriestitle'}
+Notes: $biblios[0]->{'notes'}
BarcodeTitleAuthorNotes
$results[$i]->{'barcode'}$results[$i]->{'title'}$results[$i]->{'author'}$results[$i]->{'itemnotes'}
$biblioitems[$i]->{'biblioitemnumber'} GROUP - $itemtypedescriptions{$biblioitems[$i]->{'itemtype'}}
URL: $biblioitems[$i]->{'url'}
+Date: $biblioitems[$i]->{'publicationyear'}
+Notes: $biblioitems[$i]->{'notes'}
- + } else { + $biblioitems[$i]->{'dewey'} =~ /(\d*\.\d\d)/; + $biblioitems[$i]->{'dewey'} = $1; + + print << "EOF"; + +$biblioitems[$i]->{'biblioitemnumber'} GROUP - $itemtypedescriptions{$biblioitems[$i]->{'itemtype'}} + + +ISBN: $biblioitems[$i]->{'isbn'}
+Dewey: $biblioitems[$i]->{'dewey'}
+Publisher: $biblioitems[$i]->{'publishercode'}
+Place: $biblioitems[$i]->{'place'}
+Date: $biblioitems[$i]->{'publicationyear'} + +EOF + + ($itemcount, @items) = &getitemsbybiblioitem($biblioitems[$i]->{'biblioitemnumber'}); + + for (my $j = 0; $j < $itemcount; $j++) { + print << "EOF"; + +Item: $items[$j]->{'barcode'}
+Home Branch: $branchnames{$items[$j]->{'homebranch'}}
+Notes: $items[$j]->{'itemnotes'} + EOF - } # if + } # for + } # else + } # for print << "EOF"; + + +
-

Section Three: Specific Item Information

+
- - - - - - + +
BARCODE:Home Branch:
+ + + + + + + + + - - - + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ADD NEW ITEM:
+For a website add the group only
Item Barcode:
Branch:
Replacement Price:
Replacement Price:
Notes:Notes:
Add to existing group:
Group:
OR Add to a new Group:
Format:
ISBN:
Publisher:
Publication Year:
Place of Publication:
Illustrator:
Additional Authors:
One Author per line
Subject Headings:
One Subject per line
Website URL:
Dewey:
Dewey Subclass:
ISSN:
LCCN: +
Volume:
Number:
Volume Description:
Pages:
Size:
Notes:
- +
EOF - - print endmenu(); + + print endmenu('acquisitions'); print endpage(); } # if } # if diff --git a/acqui.simple/isbnsearch.pl b/acqui.simple/isbnsearch.pl index 5610c2d1be..55adb6db0f 100755 --- a/acqui.simple/isbnsearch.pl +++ b/acqui.simple/isbnsearch.pl @@ -3,24 +3,104 @@ use CGI; use strict; use C4::Acquisitions; +use C4::Search; +use C4::Output; -my $input = new CGI; -my $isbn = $input->param('isbn'); -my $biblioitemnum; +my $input = new CGI; +my $isbn = $input->param('isbn'); +my $offset = $input->param('offset'); +my $num = $input->param('num'); +my $showoffset = $offset + 1; +my $total; my $count; my @results; if (! $isbn) { print $input->redirect('addbooks.pl'); } else { + if (! $offset) { + $offset = 0; + $showoffset = 1; + }; + if (! $num) { $num = 10 }; + ($count, @results) = isbnsearch($isbn); - ($count, @results) = &isbnsearch($isbn); - if (! $count) { - print $input->redirect("addbooks.pl?error=notfound"); + if ($count < ($offset + $num)) { + $total = $count; } else { + $total = $offset + $num; + } # else - $biblioitemnum = $results[0]->{'biblioitemnumber'}; - print $input->redirect("additem.pl?biblioitemnum=$biblioitemnum"); + print $input->header; + print startpage(); + print startmenu('acquisitions'); - } # else + print << "EOF"; +Biblio Search Results
+
+You searched on ISBN $isbn, $count results found
+Results $showoffset to $total displayed +
+

Add New Biblio

+
+

+ + + + + + +EOF + + for (my $i = $offset; $i < $total; $i++) { + if ($i % 2) { + print << "EOF"; + +EOF + } else { + print << "EOF"; + +EOF + } # else + + print << "EOF"; + + + + +EOF + } # for + + print << "EOF"; + + + + + +
TITLEAUTHOR©
$results[$i]->{'title'}$results[$i]->{'author'}$results[$i]->{'copyrightdate'}
   
+
+EOF + + for (my $i = 0; ($i * $num) < $count; $i++) { + my $newoffset = $i * $num; + my $shownumber = $i + 1; + print << "EOF"; +$shownumber +EOF + } # for + + print << "EOF"; +

+Results per page: +5 +10 +20 +50 +

+
+

 

+EOF + + print endmenu(); + print endpage(); } # else diff --git a/acqui.simple/keywordsearch.pl b/acqui.simple/keywordsearch.pl index efd4022f02..fef1a13cab 100755 --- a/acqui.simple/keywordsearch.pl +++ b/acqui.simple/keywordsearch.pl @@ -50,7 +50,7 @@ Results $offset to $total displayed EOF - for (my $i = $offset; $i < $total; $i++) { + for (my $i = 0; $i < ($total - $offset); $i++) { if ($i % 2) { print << "EOF"; @@ -62,12 +62,13 @@ EOF } # else print << "EOF"; -$results[$i]->{'title'} -$results[$i]->{'author'} +$results[$i]->{'title'} +$results[$i]->{'author'} $results[$i]->{'copyrightdate'} EOF } # for + print << "EOF";   @@ -80,8 +81,9 @@ EOF for (my $i = 0; ($i * $num) < $count; $i++) { my $newoffset = $i * $num; + my $shownumber = $i + 1; print << "EOF"; -$i +$shownumber EOF } # for diff --git a/acqui.simple/savebiblio.pl b/acqui.simple/savebiblio.pl index 97a4b17d5c..005c98d72c 100755 --- a/acqui.simple/savebiblio.pl +++ b/acqui.simple/savebiblio.pl @@ -23,5 +23,5 @@ if (! $biblio->{'title'}) { $biblionumber = &newbiblio($biblio); &newsubtitle($biblionumber, $biblio->{'subtitle'}); - print $input->redirect("addbiblioitem.pl?biblionumber=$biblionumber"); + print $input->redirect("additem.pl?biblionumber=$biblionumber"); } # else diff --git a/acqui.simple/savebiblioitem.pl b/acqui.simple/savebiblioitem.pl deleted file mode 100755 index 39704300c1..0000000000 --- a/acqui.simple/savebiblioitem.pl +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/perl - -use CGI; -use strict; -use C4::Acquisitions; - -my $input = new CGI; -my $biblionumber = $input->param('biblionumber'); -my $biblioitem = { - biblionumber => $biblionumber, - publishercode => $input->param('publishercode')?$input->param('publishercode'):"", - publicationyear => $input->param('publicationyear')?$input->param('publicationyear'):"", - place => $input->param('year')?$input->param('year'):"", - illus => $input->param('illus')?$input->param('illus'):"", - isbn => $input->param('isbn')?$input->param('isbn'):"", - additionalauthors => $input->param('additionalauthors')?$input->param('additionalauthors'):"", - subjectheadings => $input->param('subjectheadings')?$input->param('subjectheadings'):"", - itemtype => $input->param('itemtype')?$input->param('itemtype'):"", - url => $input->param('url')?$input->param('url'):"", - dewey => $input->param('dewey')?$input->param('dewey'):"", - subclass => $input->param('subclass')?$input->param('subclass'):"", - issn => $input->param('issn')?$input->param('issn'):"", - lccn => $input->param('lccn')?$input->param('lccn'):"", - volume => $input->param('volume')?$input->param('volume'):"", - number => $input->param('number')?$input->param('number'):"", - volumeddesc => $input->param('volumeddesc')?$input->param('volumeddesc'):"", - pages => $input->param('pages')?$input->param('pages'):"", - size => $input->param('size')?$input->param('size'):"", - notes => $input->param('notes')?$input->param('notes'):"" -}; -my $biblioitemnum; - -if (! $biblionumber) { - print $input->redirect('addbooks.pl'); -} else { - - $biblioitemnum = &newbiblioitem($biblioitem); - - if ($input->param('itemtype') eq "WEB") { - print $input->redirect("addbooks.pl?biblioitem=added"); - } else { - print $input->redirect("additem.pl?biblioitemnum=$biblioitemnum"); - } # else -} # else diff --git a/acqui.simple/saveitem.pl b/acqui.simple/saveitem.pl index 6ed496fc3b..cea1e77953 100755 --- a/acqui.simple/saveitem.pl +++ b/acqui.simple/saveitem.pl @@ -4,32 +4,72 @@ use CGI; use strict; use C4::Acquisitions; -my $input = new CGI; -my $barcode = $input->param('barcode'); -my $biblioitemnum = $input->param('biblioitemnum'); -my $item = { - biblioitemnumber => $biblioitemnum, +my $input = new CGI; +my $barcode = $input->param('barcode'); +my $biblionumber = $input->param('biblionumber'); +my $biblioitemnumber = $input->param('biblioitemnumber'); +my $item = { + biblionumber => $biblionumber, + biblioitemnumber => $biblioitemnumber?$biblioitemnumber:"", homebranch => $input->param('homebranch'), replacementprice => $input->param('replacementprice')?$input->param('replacementprice'):"", itemnotes => $input->param('notes')?$input->param('notes'):"" }; # my $item +my $biblioitem = { + biblionumber => $biblionumber, + itemtype => $input->param('itemtype'), + isbn => $input->param('isbn')?$input->param('isbn'):"", + publishercode => $input->param('publishercode')?$input->param('publishercode'):"", + publicationyear => $input->param('publicationyear')?$input->param('publicationyear'):"", + place => $input->param('place')?$input->param('place'):"", + illus => $input->param('illus')?$input->param('illus'):"", + additionalauthors => $input->param('additionalauthors')?$input->param('additionalauthors'):"", + subjectheadings => $input->param('subjectheadings')?$input->param('subjectheadings'):"", + url => $input->param('url')?$input->param('url'):"", + dewey => $input->param('dewey')?$input->param('dewey'):"", + subclass => $input->param('subclass')?$input->param('subclass'):"", + issn => $input->param('issn')?$input->param('issn'):"", + lccn => $input->param('lccn')?$input->param('lccn'):"", + volume => $input->param('volume')?$input->param('volume'):"", + number => $input->param('number')?$input->param('number'):"", + volumeddesc => $input->param('volumeddesc')?$input->param('volumeddesc'):"", + pages => $input->param('pages')?$input->param('pages'):"", + size => $input->param('size')?$input->param('size'):"", + notes => $input->param('notes')?$input->param('notes'):"" +}; # my biblioitem +my $newgroup = 0; +my $website = 0; my $count; my @results; -if (! $barcode) { - print $input->redirect('additem.pl?error=nobarcode'); -} elsif (! $biblioitemnum) { +if ($input->param('newgroup')) { + $newgroup = 1; + if ($biblioitem->{'itemtype'} eq "WEB") { + $website = 1; + } # if +} # if + +if (! $biblionumber) { print $input->redirect('addbooks.pl'); +} elsif ((! $barcode) && (! $website)) { + print $input->redirect("additem.pl?biblionumber=$biblionumber&error=nobarcode"); +} elsif ((! $newgroup) && (! $biblioitemnumber)) { + print $input->redirect("additem.pl?biblionumber=$biblionumber&error=nobiblioitem"); } else { - - ($count, @results) = &getbiblioitem($biblioitemnum); - if (! $count) { - print->redirect('addbooks.pl'); + + if ($website) { + &newbiblioitem($biblioitem); + } elsif (&checkitems(1,$barcode)) { + print $input->redirect("additem.pl?biblionumber=$biblionumber&error=barcodeinuse"); } else { - $item->{'biblionumber'} = $results[0]->{'biblionumber'}; + if ($newgroup) { + $biblioitemnumber = &newbiblioitem($biblioitem); + $item->{'biblioitemnumber'} = $biblioitemnumber; + } # if + &newitems($item, ($barcode)); - print $input->redirect("additem.pl?biblioitemnum=$biblioitemnum"); + print $input->redirect("additem.pl?biblionumber=$biblionumber"); } # else } # else diff --git a/acqui.simple/websitesearch.pl b/acqui.simple/websitesearch.pl index 2dd6d14322..f106381f66 100755 --- a/acqui.simple/websitesearch.pl +++ b/acqui.simple/websitesearch.pl @@ -60,8 +60,8 @@ EOF } # else print << "EOF"; -$results[$i]->{'title'} -$results[$i]->{'author'} +$results[$i]->{'title'} +$results[$i]->{'author'} $results[$i]->{'copyrightdate'} EOF diff --git a/detail.pl b/detail.pl index 1090d600a9..324bd1b82e 100755 --- a/detail.pl +++ b/detail.pl @@ -1,343 +1,88 @@ #!/usr/bin/perl - -#script to display detailed information -#written 8/11/99 - +use HTML::Template; use strict; -use C4::Search; +require Exporter; +use C4::Database; +use C4::Output; # contains picktemplate use CGI; -use C4::Output; - -my $input = new CGI; -my $type = $input->param('type'); -my $bib = $input->param('bib'); -my @items = &ItemInfo(undef, $bib, $type); -my @temp = split('\t', $items[0]); -my $count = @items; -my $dat = &bibdata($bib); -my ($websitecount, @websites) = &getwebsites($bib); -my ($authorcount, $addauthor) = &addauthor($bib); -my ($webbiblioitemcount, @webbiblioitems) = &getwebbiblioitems($bib); -my $additional = $addauthor->[0]->{'author'}; -my $main; -my $secondary; -my $colour; - - -if ($type eq '') { - $type = 'opac'; -} # if - -# setup colours -if ($type eq 'opac') { - $main = '#99cccc'; - $secondary = '#efe5ef'; -} else { - $main = '#cccc99'; - $secondary = '#ffffcc'; -} # else -$colour = $secondary; - -for (my $i = 1; $i < $authorcount; $i++) { - $additional .= "|" . $addauthor->[$i]->{'author'}; -} # for - -print $input->header; -print startpage(); -print startmenu($type); - -if ($type ne 'opac'){ - print << "EOF"; - -EOF -} # if - -if ($type eq 'catmain'){ - print mkheadr(3,"Catalogue Maintenance"); -} # if - -if ($dat->{'author'} ne ''){ - print mkheadr(3,"$dat->{'title'} ($dat->{'author'}) $temp[4]"); -} else { - print mkheadr(3,"$dat->{'title'} $temp[4]"); -} # if - -print << "EOF"; - - - -EOF - -if ($type ne 'opac') { - print << "EOF"; - - - - - -
-EOF -} else { - print << "EOF"; - -EOF -} # else - -print << "EOF"; -BIBLIO RECORD -EOF - -if ($type ne 'opac') { - print "$bib"; +use C4::Search; + +my $query=new CGI; + + +my $language='french'; + + +my %configfile; +open (KC, "/etc/koha.conf"); +while () { + chomp; + (next) if (/^\s*#/); + if (/(.*)\s*=\s*(.*)/) { + my $variable=$1; + my $value=$2; + # Clean up white space at beginning and end + $variable=~s/^\s*//g; + $variable=~s/\s*$//g; + $value=~s/^\s*//g; + $value=~s/\s*$//g; + $configfile{$variable}=$value; + } } -print << "EOF"; -
-EOF - -if ($type ne 'opac') { - print << "EOF"; -
- - - -
-EOF -} # if - -print << "EOF"; -
- -EOF +my $biblionumber=$query->param('bib'); +my $type='intra'; +# change back when ive fixed request.pl +my @items = ItemInfo(undef, $biblionumber, $type); +my $dat=bibdata($biblionumber); +my ($authorcount, $addauthor)= &addauthor($biblionumber); +my ($webbiblioitemcount, @webbiblioitems) = &getwebbiblioitems($biblionumber); +my ($websitecount, @websites) = &getwebsites($biblionumber); -if ($type ne 'opac') { - print << "EOF"; -Subtitle: $dat->{'subtitle'}
-Author: $dat->{'author'}
-Additional Author: $additional
-Series Title: $dat->{'seriestitle'}
-Subject: $dat->{'subject'}
-Copyright: $dat->{'copyrightdate'}
-Notes: $dat->{'notes'}
-Unititle: $dat->{'unititle'}
-Analytical Author:
-Analytical Title:
-Serial: $dat->{'serial'}
-Total Number of Items: $count -

-EOF +$dat->{'count'}=@items; -} else { - if ($dat->{'subtitle'} ne ''){ - print "Subtitle: $dat->{'subtitle'}
"; - } # if - if ($dat->{'author'} ne ''){ - print "Author: $dat->{'author'}
"; - } # if - -# Additional Author:
- if ($dat->{'seriestitle'} ne '') { - print "Seriestitle: $dat->{'seriestitle'}
"; - } # if - if ($dat->{'subject'} ne '') { - print "Subject: $dat->{'subject'}
"; - } # if - if ($dat->{'copyrightdate'} ne '') { - print "Copyright: $dat->{'copyrightdate'}
"; - } # if - if ($dat->{'notes'} ne '') { - print "Notes: $dat->{'notes'}
"; - } # if - if ($dat->{'unititle'} ne '') { - print "Unititle: $dat->{'unititle'}
"; - } # if - -# Analytical Author:
-# Analytical Title:
- if ($dat->{'serial'} ne '0') { - print "Serial: Yes
"; - } # if - - print << "EOF"; -Total Number of Items: $count -

-EOF - -} # if - -print << "EOF"; -

- - -EOF - -print center(); -print mktablehdr; - -if ($type eq 'opac') { - print mktablerow(6,$main,'Item Type','Class','Branch','Date Due','Last Seen'); -} else { - print mktablerow(7,$main,'Itemtype','Class','Location','Date Due','Last Seen','Barcode',"","/images/background-mem.gif"); -} # else - -$colour = 'white'; -for (my $i = 0; $i < $count; $i ++) { - - my @results = split('\t', $items[$i]); - - if ($type ne 'opac') { - $results[1] = mklink("/cgi-bin/koha/moredetail.pl?item=$results[5]&bib=$bib&bi=$results[8]&type=$type",$results[1]); - } # if - - if ($results[2] eq '') { - $results[2] = 'Available'; - } # if - - if ($type eq 'catmain'){ - $results[10] = mklink("/cgi-bin/koha/maint/catmaintain.pl?type=fixitemtype&bi=$results[8]&item=$results[6]","Fix Itemtype"); - } # if - - if ($type ne 'opac'){ - if ($type eq 'catmain'){ - print mktablerow(8,$colour,$results[6],$results[4],$results[3],$results[2],$results[7],$results[1],$results[9],$results[10]); - } else { - print mktablerow(7,$colour,$results[6],$results[4],$results[3],$results[2],$results[7],$results[1],$results[9]); - } # else - } else { - $results[6] = ItemType($results[6]); - print mktablerow(6,$colour,$results[6],$results[4],$results[3],$results[2],$results[7],$results[9]); - } # else - - if ($colour eq $secondary) { - $colour = 'white'; - } else { - $colour = $secondary; - } # else - -} # for - - -for (my $i = 0; $i < $webbiblioitemcount; $i++) { - if ($type eq 'opac') { - $webbiblioitems[$i]->{'url'} =~ s/^http:\/\///; - print mktablerow(6, $colour, 'Website', 'WEB', 'Online', 'Available', "http://$webbiblioitems[$i]->{'url'}"); - } else { - $webbiblioitems[$i]->{'url'} =~ s/^http:\/\///; - print mktablerow(7, $colour, 'WEB', '', 'Online', 'Available', "", "http://$webbiblioitems[$i]->{'url'}"); - } # else +$dat->{'additional'}=$addauthor->[0]->{'author'}; +for (my $i = 1; $i < $authorcount; $i++) { + $dat->{'additional'} .= "|" . $addauthor->[$i]->{'author'}; } # for +my @results; -print mktableft(); -print "

"; -print mktablehdr(); - -if ($type ne 'opac') { - print << "EOF"; - -

HELP
-Update Biblio for all Items: Click on the Modify button [left] to amend the biblio. Any changes you make will update the record for all the items listed above.

-Updating the Biblio for only ONE or SOME Items: -EOF - - if ($type eq 'catmain') { - print << "EOF"; -If some of the items listed above need a different biblio, -you need to click on the wrong item, then shift the group it belongs to, to the correct biblio. -You will need to know the correct biblio number -

- -EOF +$results[0]=$dat; - } else { - print << "EOF"; -If some of the items listed above need a different biblio, or are on the wrong biblio, you must use the acquisitions process to fix this. You will need to "re-order" the items, and delete them from this biblio. -

- -EOF +my $resultsarray=\@results; +my $itemsarray=\@items; +my $webarray=\@webbiblioitems; +my $sitearray=\@websites; - } # else -} # if +my $includes=$configfile{'includes'}; +($includes) || ($includes="/usr/local/www/hdl/htdocs/includes"); +my $templatebase="catalogue/detail.tmpl"; +my $startfrom=$query->param('startfrom'); +($startfrom) || ($startfrom=0); +my $theme=picktemplate($includes, $templatebase); -print mktableft(); -print endcenter(); -print << "EOF"; -
-

-EOF +my $template = HTML::Template->new(filename => "$includes/templates/$theme/$templatebase", die_on_bad_params => 0, path => [$includes]); -if ($type ne 'opac') { - print << "EOF"; - - - - - - - -
Abstract
$dat->{'abstract'}
-

- - - - -EOF +my $count=1; - for (my $i = 0; $i < $websitecount; $i++) { - $websites[$i]->{'url'} =~ s/^http:\/\///; - print << "EOF"; - - - -EOF - } # for +# now to get the items into a hash we can use and whack that thru - print << "EOF"; -
Links to Associated Websites
Title: $websites[$i]->{'title'}
-Description: $websites[$i]->{'description'}
-URL: http://$websites[$i]->{'url'}
-
-EOF -} else { - if ($dat->{'abstract'} ne '') { - print << "EOF"; - - - - - - - -
Abstract
$dat->{'abstract'}
-

-EOF - } # if - if ($websitecount) { - print << "EOF"; - - - - -EOF - for (my $i = 0; $i < $websitecount; $i++) { - $websites[$i]->{'url'} =~ s/^http:\/\///; - print << "EOF"; - - - -EOF - } # for - - print << "EOF"; -
Link to Associated Websites
Title: $websites[$i]->{'title'}
-Description: $websites[$i]->{'description'}
-URL: http://$websites[$i]->{'url'}
-
-EOF - } # if -} # else +$template->param(startfrom => $startfrom+1); +$template->param(endat => $startfrom+20); +$template->param(numrecords => $count); +my $nextstartfrom=($startfrom+20<$count-20) ? ($startfrom+20) : ($count-20); +my $prevstartfrom=($startfrom-20>0) ? ($startfrom-20) : (0); +$template->param(nextstartfrom => $nextstartfrom); +$template->param(prevstartfrom => $prevstartfrom); +# $template->param(template => $templatename); +# $template->param(search => $search); +$template->param(includesdir => $includes); +$template->param(BIBLIO_RESULTS => $resultsarray); +$template->param(ITEM_RESULTS => $itemsarray); +$template->param(WEB_RESULTS => $webarray); +$template->param(SITE_RESULTS => $sitearray); +print "Content-Type: text/html\n\n", $template->output; -print endmenu($type); -print endpage(); diff --git a/moredetail.pl b/moredetail.pl index 4333d104d9..5757e0a52f 100755 --- a/moredetail.pl +++ b/moredetail.pl @@ -1,199 +1,102 @@ #!/usr/bin/perl - -#script to display detailed information -#written 8/11/99 - +use HTML::Template; use strict; -use C4::Search; +require Exporter; use C4::Koha; -use C4::Output; -use C4::Acquisitions; use CGI; +use C4::Search; +use C4::Acquisitions; +use C4::Output; # contains picktemplate + +my $query=new CGI; + + +my $language='french'; + + +my %configfile; +open (KC, "/etc/koha.conf"); +while () { + chomp; + (next) if (/^\s*#/); + if (/(.*)\s*=\s*(.*)/) { + my $variable=$1; + my $value=$2; + # Clean up white space at beginning and end + $variable=~s/^\s*//g; + $variable=~s/\s*$//g; + $value=~s/^\s*//g; + $value=~s/\s*$//g; + $configfile{$variable}=$value; + } +} -my $input = new CGI; -my $type=$input->param('type'); - -print $input->header; - -# setup colours -my $main; -my $secondary; -if ($type eq 'opac'){ - $main='#99cccc'; - $secondary='#efe5ef'; -} else { - $main='#cccc99'; - $secondary='#ffffcc'; +my $includes=$configfile{'includes'}; +($includes) || ($includes="/usr/local/www/hdl/htdocs/includes"); +my $templatebase="catalogue/moredetail.tmpl"; +my $startfrom=$query->param('startfrom'); +($startfrom) || ($startfrom=0); +my $theme=picktemplate($includes, $templatebase); + +my $subject=$query->param('subject'); +# if its a subject we need to use the subject.tmpl +if ($subject){ + $templatebase=~ s/searchresults\.tmpl/subject\.tmpl/; } -print startpage(); -print startmenu($type); -my $blah; +my $template = HTML::Template->new(filename => "$includes/templates/$theme/$templatebase", die_on_bad_params => 0, path => [$includes]); -my $bib=$input->param('bib'); -my $title=$input->param('title'); -my $bi=$input->param('bi'); -my $data=bibitemdata($bi); +# get variables -my (@items)=itemissues($bi); -my ($order,$ordernum)=getorder($bi,$bib); -#print @items; -my $count=@items; +my $biblionumber=$query->param('bib'); +my $title=$query->param('title'); +my $bi=$query->param('bi'); -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;} +my $data=bibitemdata($bi); +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 -; -if ($type eq 'catmain'){ - print "Catalogue Maintenance
"; -} -print <$data->{'title'} ($data->{'author'})

-

-

- - - - - - - - - - -
$data->{'biblioitemnumber'} GROUP - $data->{'description'}
- - -
- -Biblionumber: $bib
-Item Type: $data->{'itemtype'}
-URL: $data->{'url'}
-Loan Length: $data->{'loanlength'}
-Rental Charge: $data->{'rentalcharge'}
-Classification: $data->{'classification'}$dewey$data->{'subclass'}
-ISBN: $data->{'isbn'}
-Publisher: $data->{'publishercode'}
-Place: $data->{'place'}
-Date: $data->{'publicationyear'}
-Volume: $data->{'volumeddesc'}
-Pages: $data->{'pages'}
-Illus: $data->{'illus'}
-Size: $data->{'size'}
-Notes: $data->{'bnotes'}
-No. of Items: $count - -printend -; -if ($type eq 'catmain'){ - print "
{'biblioitemnumber'}&bib=$data->{'biblionumber'}>Shift to another biblio"; - -} -print < -
-
-printend -; - -for (my $i=0;$i<$count;$i++){ -print < - - - - - - - -
BARCODE $items[$i]->{'barcode'}
-
- -{'itemnumber'}> - - - -
-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'} = slashifyDate($items[$i]->{'dateaccessioned'}); -$items[$i]->{'datelastseen'} = slashifyDate($items[$i]->{'datelastseen'}); - -print < -Home Branch: $items[$i]->{'homebranch'}
-Last seen: $items[$i]->{'datelastseen'}
-Last borrowed: $items[$i]->{'timestamp0'}
-printend -; -if ($items[$i] eq 'Available'){ - print "Currently on issue to:
"; -} else { - print "Currently on issue to: {'borrower0'}>$items[$i]->{'card'}
"; -} -print <Last Borrower 1: $items[$i]->{'card0'}
-Last Borrower 2: $items[$i]->{'card1'}
-Current Branch: $items[$i]->{'holdingbranch'}
-Replacement Price: $items[$i]->{'replacementprice'}
-Item lost: $items[$i]->{'itemlost'}
-Paid for: $items[$i]->{'paidfor'}
-Notes: $items[$i]->{'itemnotes'}
-Renewals: $items[$i]->{'renewals'}
-{'booksellerinvoicenumber'}&catview=yes>Accession Date: $items[$i]->{'dateaccessioned'}
-printend -; -if ($items[$i]->{'wthdrawn'} eq '1'){ - $items[$i]->{'wthdrawn'}="Yes"; -} else { - $items[$i]->{'wthdrawn'}="No"; + $dewey=''; } -print <Cancelled: $items[$i]->{'wthdrawn'}
-{'itemnumber'}>Total Issues: $items[$i]->{'issues'}
-Group Number: $bi
-Biblio number: $bib
- +$dewey=~ s/\.$//; +$data->{'dewey'}=$dewey; +my @results; - -
- -printend -; +my (@items)=itemissues($bi); +my $count=@items; +$data->{'count'}=$count; +my ($order,$ordernum)=getorder($bi,$biblionumber); + +my $env; +$env->{itemcount}=1; + +$results[0]=$data; + +foreach my $item (@items){ + $item->{'itemlost'}=~ s/0/No/; + $item->{'itemlost'}=~ s/1/Yes/; + $item->{'withdrawn'}=~ s/0/No/; + $item->{'withdrawn'}=~ s/1/Yes/; + $item->{'replacementprice'}+=0.00; + my $year=substr($item->{'timestamp0'},0,4); + my $mon=substr($item->{'timestamp0'},4,2); + my $day=substr($item->{'timestamp0'},6,2); + $item->{'timestamp0'}="$day/$mon/$year"; + $item->{'dateaccessioned'} = slashifyDate($item->{'dateaccessioned'}); + $item->{'datelastseen'} = slashifyDate($item->{'datelastseen'}); + if ($item->{'date_due'} = 'Available'){ + $item->{'issue'}="Currently on issue to:
"; + } else { + $item->{'issue'}="Currently on issue to: {'borrower0'}>$item->{'card'}
"; + } + } -print < - -printend -; - -print endcenter(); +$template->param(includesdir => $includes); +$template->param(BIBITEM_DATA => \@results); +$template->param(ITEM_DATA => \@items); +print "Content-Type: text/html\n\n", $template->output; -print endmenu($type); -print endpage(); -- 2.39.5