From becb6ce25c4407f140e8a7649267a0fb6283f409 Mon Sep 17 00:00:00 2001 From: rangi Date: Sun, 11 May 2003 06:59:11 +0000 Subject: [PATCH] Mostly templated. Still needs some work --- acqui.simple/additem-nomarc.pl | 356 +++++------------- .../en/acqui.simple/additem-nomarc.tmpl | 209 ++++++++++ 2 files changed, 297 insertions(+), 268 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/default/en/acqui.simple/additem-nomarc.tmpl diff --git a/acqui.simple/additem-nomarc.pl b/acqui.simple/additem-nomarc.pl index 9bffa2d959..5b8a0ab475 100755 --- a/acqui.simple/additem-nomarc.pl +++ b/acqui.simple/additem-nomarc.pl @@ -19,13 +19,22 @@ # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, # Suite 330, Boston, MA 02111-1307 USA +# $Log$ +# Revision 1.2 2003/05/11 06:59:11 rangi +# Mostly templated. +# Still needs some work +# + use CGI; use strict; use C4::Catalogue; use C4::Biblio; use C4::Output; +use HTML::Template; +use C4::Auth; +use C4::Interface::CGI::Output; -my $input = new CGI; +my $input = new CGI; my $biblionumber = $input->param('biblionumber'); my $error = $input->param('error'); my $maxbarcode; @@ -43,271 +52,82 @@ my $itemtypecount; my @itemtypes; my %itemtypedescriptions; -if (! $biblionumber) { +if ( !$biblionumber ) { print $input->redirect('addbooks.pl'); -} else { - - ($bibliocount, @biblios) = &getbiblio($biblionumber); - - if (! $bibliocount) { - print $input->redirect('addbooks.pl'); - } else { - - ($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'); - - print << "EOF"; -$biblios[0]->{'title'} -

-EOF - - if ($error eq "nobarcode") { - print << "EOF"; -You must give the item a barcode -

-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"; - - - - - - - -EOF - - for (my $i = 0; $i < $biblioitemcount; $i++) { - if ($biblioitems[$i]->{'itemtype'} eq "WEB") { - - print << "EOF"; - - - - - - -EOF - - } else { - $biblioitems[$i]->{'dewey'} =~ /(\d*\.\d\d)/; - $biblioitems[$i]->{'dewey'} = $1; - - print << "EOF"; - - - - - - -EOF - - ($itemcount, @items) = &getitemsbybiblioitem($biblioitems[$i]->{'biblioitemnumber'}); - - for (my $j = 0; $j < $itemcount; $j++) { - print << "EOF"; - - - -EOF - } # for - } # else - } # for - - print << "EOF"; -
BIBLIO RECORD $biblionumber
Author: $biblios[0]->{'author'}
-Copyright: $biblios[0]->{'copyrightdate'}
-Series Title: $biblios[0]->{'seriestitle'}
-Notes: $biblios[0]->{'notes'}
$biblioitems[$i]->{'biblioitemnumber'} GROUP - $itemtypedescriptions{$biblioitems[$i]->{'itemtype'}}
URL: $biblioitems[$i]->{'url'}
-Date: $biblioitems[$i]->{'publicationyear'}
-Notes: $biblioitems[$i]->{'notes'}
$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'}
Item: $items[$j]->{'barcode'}
-Home Branch: $branchnames{$items[$j]->{'homebranch'}}
-Notes: $items[$j]->{'itemnotes'}
- - -

- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ADD NEW ITEM:
-For a website add the group only
Item Barcode:
Branch:
Replacement Price:
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('acquisitions'); - print endpage(); - } # if -} # if +} +else { + + ( $bibliocount, @biblios ) = &getbiblio($biblionumber); + + if ( !$bibliocount ) { + print $input->redirect('addbooks.pl'); + } + else { + + ( $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'); + my $input = new CGI; + my ( $template, $loggedinuser, $cookie ) = get_template_and_user( + { + template_name => "acqui.simple/additem-nomarc.tmpl", + query => $input, + type => "intranet", + authnotrequired => 0, + flagsrequired => { catalogue => 1 }, + debug => 1, + } + ); + + if ( $error eq "nobarcode" ) { + $template->param( NOBARCODE => 1 ); + } + elsif ( $error eq "nobiblioitem" ) { + $template->param( NOBIBLIOITEM => 1 ); + } + elsif ( $error eq "barcodeinuse" ) { + $template->param( BARCODEINUSE => 1 ); + } # elsif + + for ( my $i = 0 ; $i < $biblioitemcount ; $i++ ) { + if ( $biblioitems[$i]->{'itemtype'} eq "WEB" ) { + $biblioitems[$i]->{'WEB'} = 1; + + } + $biblioitems[$i]->{'dewey'} =~ /(\d*\.\d\d)/; + $biblioitems[$i]->{'dewey'} = $1; + ( $itemcount, @items ) = + &getitemsbybiblioitem( $biblioitems[$i]->{'biblioitemnumber'} ); + $biblioitems[$i]->{'items'} = \@items; + } # for + $template->param( + BIBNUM => $biblionumber, + AUTHOR => $biblios[0]->{'author'}, + TITLE => $biblios[0]->{'title'}, + COPYRIGHT => $biblios[0]->{'copyrightdate'}, + SERIES => $biblios[0]->{'seriestitle'}, + NOTES => $biblios[0]->{'notes'}, + BIBITEMS => \@biblioitems, + BRANCHES => \@branches, + ITEMTYPES => \@itemtypes, + + ); + + output_html_with_http_headers $input, $cookie, $template->output; + } # if +} # if diff --git a/koha-tmpl/intranet-tmpl/default/en/acqui.simple/additem-nomarc.tmpl b/koha-tmpl/intranet-tmpl/default/en/acqui.simple/additem-nomarc.tmpl new file mode 100644 index 0000000000..719a846af2 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/default/en/acqui.simple/additem-nomarc.tmpl @@ -0,0 +1,209 @@ + +test + +

+ +You must give the item a barcode +

+ + +You must create a new group for your item to be +added to +

+ + +Sorry, that barcode is already in use +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
BIBLIO RECORD
Author:
+Copyright:
+Series Title:
+Notes:
GROUP - +$itemtypedescriptions{$biblioitems[$i]->{'itemtype'}}
URL:
+Date:
+Notes:
+GROUP - $itemtypedescriptions{$biblioitems[$i]->{'itemtype'}}
ISBN:
+Dewey:
+Publisher:
+Place:
+Date:
Item:
+Home Branch: $branchnames{$items[$j]->{'homebranch'}}
+Notes:
+ + +

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ADD NEW +ITEM:
+For a website add the group only
Item Barcode:
Branch:
Replacement Price:
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:
+ +
+
+ -- 2.39.5