[Koha-cvs] CVS: koha/acqui.simple additem-nomarc.pl,1.1,1.2
Chris Cormack
rangi at users.sourceforge.net
Sun May 11 08:59:15 CEST 2003
Update of /cvsroot/koha/koha/acqui.simple
In directory sc8-pr-cvs1:/tmp/cvs-serv25147/acqui.simple
Modified Files:
additem-nomarc.pl
Log Message:
Mostly templated.
Still needs some work
Index: additem-nomarc.pl
===================================================================
RCS file: /cvsroot/koha/koha/acqui.simple/additem-nomarc.pl,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** additem-nomarc.pl 4 May 2003 03:16:15 -0000 1.1
--- additem-nomarc.pl 11 May 2003 06:59:11 -0000 1.2
***************
*** 20,23 ****
--- 20,29 ----
# 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;
***************
*** 25,30 ****
use C4::Biblio;
use C4::Output;
! my $input = new CGI;
my $biblionumber = $input->param('biblionumber');
my $error = $input->param('error');
--- 31,39 ----
use C4::Biblio;
use C4::Output;
+ use HTML::Template;
+ use C4::Auth;
+ use C4::Interface::CGI::Output;
! my $input = new CGI;
my $biblionumber = $input->param('biblionumber');
my $error = $input->param('error');
***************
*** 44,313 ****
my %itemtypedescriptions;
! 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";
! <font size="6"><em>$biblios[0]->{'title'}</em></font>
! <p>
! EOF
!
! if ($error eq "nobarcode") {
! print << "EOF";
! <font size="5" color="red">You must give the item a barcode</font>
! <p>
! EOF
! } elsif ($error eq "nobiblioitem") {
! print << "EOF";
! <font size="5" color="red">You must create a new group for your item to be added to</font>
! <p>
! EOF
! } elsif ($error eq "barcodeinuse") {
! print << "EOF";
! <font size="5" color="red">Sorry, that barcode is already in use</font>
! <p>
! EOF
! } # elsif
! print << "EOF";
! <table align="left" cellpadding="5" cellspacing="0" border="1" width="220">
! <tr valign="top" bgcolor="#CCCC99">
! <td background="/images/background-mem.gif"><b>BIBLIO RECORD $biblionumber</b></td>
! </tr>
! <tr valign="top">
! <td><b>Author:</b> $biblios[0]->{'author'}<br>
! <b>Copyright:</b> $biblios[0]->{'copyrightdate'}<br>
! <b>Series Title:</b> $biblios[0]->{'seriestitle'}<br>
! <b>Notes:</b> $biblios[0]->{'notes'}</td>
! </tr>
! EOF
!
! for (my $i = 0; $i < $biblioitemcount; $i++) {
! if ($biblioitems[$i]->{'itemtype'} eq "WEB") {
!
! print << "EOF";
! <tr valign="top" bgcolor="#CCCC99">
! <td background="/images/background-mem.gif"><b>$biblioitems[$i]->{'biblioitemnumber'} GROUP - $itemtypedescriptions{$biblioitems[$i]->{'itemtype'}}</b></td>
! </tr>
! <tr valign="top">
! <td><b>URL:</b> $biblioitems[$i]->{'url'}<br>
! <b>Date:</b> $biblioitems[$i]->{'publicationyear'}<br>
! <b>Notes:</b> $biblioitems[$i]->{'notes'}</td>
! </tr>
! EOF
!
! } else {
! $biblioitems[$i]->{'dewey'} =~ /(\d*\.\d\d)/;
! $biblioitems[$i]->{'dewey'} = $1;
!
! print << "EOF";
! <tr valign="top" bgcolor="#CCCC99">
! <td background="/images/background-mem.gif"><b>$biblioitems[$i]->{'biblioitemnumber'} GROUP - $itemtypedescriptions{$biblioitems[$i]->{'itemtype'}}</b></td>
! </tr>
! <tr valign="top">
! <td><b>ISBN:</b> $biblioitems[$i]->{'isbn'}<br>
! <b>Dewey:</b> $biblioitems[$i]->{'dewey'}<br>
! <b>Publisher:</b> $biblioitems[$i]->{'publishercode'}<br>
! <b>Place:</b> $biblioitems[$i]->{'place'}<br>
! <b>Date:</b> $biblioitems[$i]->{'publicationyear'}</td>
! </tr>
! EOF
!
! ($itemcount, @items) = &getitemsbybiblioitem($biblioitems[$i]->{'biblioitemnumber'});
!
! for (my $j = 0; $j < $itemcount; $j++) {
! print << "EOF";
! <tr valign="top" bgcolor="#FFFFCC">
! <td><b>Item:</b> $items[$j]->{'barcode'}<br>
! <b>Home Branch:</b> $branchnames{$items[$j]->{'homebranch'}}<br>
! <b>Notes:</b> $items[$j]->{'itemnotes'}</td>
! </tr>
! EOF
! } # for
! } # else
! } # for
!
! print << "EOF";
! </table>
! <img src="/images/holder.gif" width="16" height="650" align="left">
!
! <center>
!
! <form action="saveitem.pl" method="post">
! <input type="hidden" name="biblionumber" value="$biblionumber">
! <table border="1" cellspacing="0" cellpadding="5">
! <tr valign="top" bgcolor="#CCCC99">
! <td background="/images/background-mem.gif" colspan="2"><b>ADD NEW ITEM:</b><br>
! <small><i>For a website add the group only</i></small></td>
! </tr>
! <tr valign="top">
! <td>Item Barcode:</td>
! <td><input type="text" name="barcode" size="40"></td>
! </tr>
! <tr valign="top">
! <td>Branch:</td>
! <td><select name="homebranch">
! EOF
!
! for (my $i = 0; $i < $branchcount; $i++) {
! print << "EOF";
! <option value="$branches[$i]->{'branchcode'}">$branches[$i]->{'branchname'}</option>
! EOF
! } # for
!
! print << "EOF";
! </select></td>
! </tr>
! <tr valign="top">
! <td>Replacement Price:</td>
! <td><input type="text" name="replacementprice" size="40"></td>
! </tr>
! <tr valign="top">
! <td>Notes:</td>
! <td><textarea name="itemnotes" cols="30" rows="6"></textarea></td>
! </tr>
! <tr valign="top" bgcolor="#CCCC99">
! <td colspan="2" background="/images/background-mem.gif"><b>Add to existing group:</b></td>
! </tr>
! <tr valign="top">
! <td>Group:</td>
! <td><select name="biblioitemnumber">
! EOF
!
! for (my $i = 0; $i < $biblioitemcount; $i++) {
! if ($biblioitems[$i]->{'itemtype'} ne "WEB") {
! print << "EOF";
! <option value="$biblioitems[$i]->{'biblioitemnumber'}">$itemtypedescriptions{$biblioitems[$i]->{'itemtype'}}</option>
! EOF
! } # if
! } # for
!
! print << "EOF";
! </select></td>
! </tr>
! <tr valign="top">
! <td colspan="2" align="center"><input type="submit" name="existinggroup" value="Add New Item to Existing Group"></td>
! </tr>
! <tr valign="top" bgcolor="#CCCC99">
! <td colspan="2" background="/images/background-mem.gif"><b>OR Add to a new Group:</b></td>
! </tr>
! <tr valign="top">
! <td>Format:</td>
! <td><select name="itemtype">
! EOF
!
! for (my $i = 0; $i < $itemtypecount; $i++) {
! print << "EOF";
! <option value="$itemtypes[$i]->{'itemtype'}">$itemtypes[$i]->{'description'}</option>
! EOF
! } # for
!
! print << "EOF";
! </select></td>
! </tr>
! <tr valign="top">
! <td>ISBN:</td>
! <td><input name="isbn" size="40"></td>
! </tr>
! <tr valign="top">
! <td>Publisher:</td>
! <td><input name="publishercode" size="40"></td>
! </tr>
! <tr valign="top">
! <td>Publication Year:</td>
! <td><input name="publicationyear" size="40"></td>
! </tr>
! <tr valign="top">
! <td>Place of Publication:</td>
! <td><input name="place" size="40"></td>
! </tr>
! <tr valign="top">
! <td>Illustrator:</td>
! <td><INPUT name="illus" size="40"></td>
! </tr>
! <tr valign="top">
! <td>Additional Authors:<br><i>One Author per line</i></td>
! <td><textarea name="additionalauthors" cols="30" rows="6"></textarea></td>
! </tr>
! <tr valign="top">
! <td>Subject Headings:<br><i>One Subject per line</i></td>
! <td><textarea name="subjectheadings" cols="30" rows="6"></textarea></td>
! </tr>
! <tr valign="top">
! <td>Website URL:</td>
! <td><INPUT name="url" size="40"></td>
! </tr>
! <tr valign="top">
! <td>Dewey:</td>
! <td><INPUT name="dewey" size="40"></td>
! </tr>
! <tr valign="top">
! <td>Dewey Subclass:</td>
! <td><input name="subclass" size="40"></td>
! </tr>
! <tr valign="top">
! <td>ISSN:</td>
! <td><input name="issn" size="40"></td>
! </tr>
! <tr valign="top">
! <td>LCCN:</td>
! <td><input name="lccn" size="40"</td>
! </tr>
! <tr valign="top">
! <td>Volume:</td>
! <td><input name="volume" size="40"></td>
! </tr>
! <tr valign="top">
! <td>Number:</td>
! <td><input name="number" size="40"></td>
! </tr>
! <tr valign="top">
! <td>Volume Description:</td>
! <td><input name="volumeddesc" size="40"></td>
! </tr>
! <tr valign="top">
! <td>Pages:</td>
! <td><input name="pages" size="40"></td>
! </tr>
! <tr valign="top">
! <td>Size:</td>
! <td><input name="size" size="40"></td>
! </tr>
! <tr valign="top">
! <td>Notes:</td>
! <td><textarea name="notes" cols="30" rows="6"></textarea></td>
! </tr>
! <tr valign="top">
! <td colspan="2" align="center"><input type="submit" name="newgroup" value="Add New Item to New Group"></td>
! </tr>
! </table>
!
! </form>
! </center>
! EOF
!
! print endmenu('acquisitions');
! print endpage();
! } # if
! } # if
--- 53,133 ----
my %itemtypedescriptions;
! 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');
! 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
More information about the Koha-cvs
mailing list