[Koha-cvs] CVS: koha/acqui.simple addbiblio-nomarc.pl,NONE,1.1 additem-nomarc.pl,NONE,1.1 savebiblio.pl,1.7,1.8 addbooks.pl,1.18,1.19 saveitem.pl,1.7,1.8

Chris Cormack rangi at users.sourceforge.net
Sun May 4 05:16:18 CEST 2003


Update of /cvsroot/koha/koha/acqui.simple
In directory sc8-pr-cvs1:/tmp/cvs-serv11435

Modified Files:
	addbooks.pl saveitem.pl 
Added Files:
	addbiblio-nomarc.pl additem-nomarc.pl savebiblio.pl 
Log Message:
We have a simple acquisitions system without marc mostly going now.
You can add a new biblio/biblioitem/item  now.

Currently you can only do this by using the   Add biblio without ISBN/ISSN
link. The next task is to get the isbnsearch and title search linking to the
nonmarc scripts if marc support is off, and then to template them all.


--- NEW FILE ---
#!/usr/bin/perl

# $Id: addbiblio-nomarc.pl,v 1.1 2003/05/04 03:16:15 rangi Exp $

#
# TODO
#
# Add info on biblioitems and items already entered as you enter new ones
#

# 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 CGI;
use strict;
use C4::Output;

my $input = new CGI;
my $error = $input->param('error');

print $input->header;
print startpage();
print startmenu('acquisitions');

print << "EOF";
<FONT SIZE=6><em>Adding a new Biblio</em></FONT><br>
  
<table bgcolor="#ffcc00" width="80%" cellpadding="5">
  <tr>
  <td><FONT SIZE=5>Section One: Copyright Information </font></td>
  </tr>
  </table>
EOF

if ( $error eq "notitle" ) {
    print << "EOF";
    <p />
      <center>
      <font color="#FF0000">Please Specify a Title</font>
      </center>
EOF
}    # if

print << "EOF";
<FORM action="savebiblio.pl" method="post">
  <table align="center">
  <tr>
  <td>Title: *</td>
  <td><INPUT name="title" size="40" /></td>
  </tr>
  <tr>
  <td>Subtitle:</td>
  <td><INPUT name="subtitle" size="40" /></td>
  </tr>
  <tr>
  <td>Author:</td>
  <td><INPUT name="author" size="40" /></td>
  </tr>
      <tr valign="top">
          <td>Series Title:<br />
          <i>(if applicable)</i></td>
          <td><INPUT name="seriestitle" size="40" /></td>
      </tr>
  <tr>
  <td>Copyright Date:</td>
  <td><INPUT name="copyrightdate" size="40" /></td>
  </tr>
  <tr valign="top">
  <td>Abstract:</td>
  <td><textarea cols="30" rows="6" name="abstract"></textarea></td>
  </tr>
      <tr valign="top">
          <td>Notes:</td>
          <td><textarea cols="30" rows="6" name="notes"></textarea></td>
      </tr>
  <tr valign="top">
  <td colspan="2"><center><input type="submit" value="Submit"></center></td>
  </tr>
  </table>
  </FORM>
  * Required
EOF

print endmenu();
print endpage();

--- NEW FILE ---
#!/usr/bin/perl

# $Id: additem-nomarc.pl,v 1.1 2003/05/04 03:16:15 rangi 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 CGI;
use strict;
use C4::Catalogue;
use C4::Biblio;
use C4::Output;

my $input = new CGI;
my $biblionumber = $input->param('biblionumber');
my $error        = $input->param('error');
my $maxbarcode;
my $isbn;
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 (! $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


Index: addbooks.pl
===================================================================
RCS file: /cvsroot/koha/koha/acqui.simple/addbooks.pl,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -r1.18 -r1.19
*** addbooks.pl	2 Feb 2003 07:18:38 -0000	1.18
--- addbooks.pl	4 May 2003 03:16:15 -0000	1.19
***************
*** 16,20 ****
  # Add info on biblioitems and items already entered as you enter new ones
  
- 
  # Copyright 2000-2002 Katipo Communications
  #
--- 16,19 ----
***************
*** 47,57 ****
  my $error   = $query->param('error');
  my $success = $query->param('biblioitem');
! my ($template, $loggedinuser, $cookie)
!     = get_template_and_user({template_name => "acqui.simple/addbooks.tmpl",
! 			     query => $query,
! 			     type => "intranet",
! 			     authnotrequired => 0,
! 			     flagsrequired => {catalogue => 1},
! 			     debug => 1,
! 			     });
  output_html_with_http_headers $query, $cookie, $template->output;
--- 46,61 ----
  my $error   = $query->param('error');
  my $success = $query->param('biblioitem');
! my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
!     {
!         template_name   => "acqui.simple/addbooks.tmpl",
!         query           => $query,
!         type            => "intranet",
!         authnotrequired => 0,
!         flagsrequired   => { catalogue => 1 },
!         debug           => 1,
!     }
! );
! my $marc_p = C4::Context->boolean_preference("marc");
! $template->param( NOTMARC => !$marc_p );
! 
  output_html_with_http_headers $query, $cookie, $template->output;

Index: saveitem.pl
===================================================================
RCS file: /cvsroot/koha/koha/acqui.simple/saveitem.pl,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** saveitem.pl	13 Oct 2002 07:39:56 -0000	1.7
--- saveitem.pl	4 May 2003 03:16:15 -0000	1.8
***************
*** 73,79 ****
      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 {
  
--- 73,79 ----
      print $input->redirect('addbooks.pl');
  } elsif ((! $barcode) && (! $website)) {
!     print $input->redirect("additem-nomarc.pl?biblionumber=$biblionumber&error=nobarcode");
  } elsif ((! $newgroup) && (! $biblioitemnumber)) {
!     print $input->redirect("additem-nomarc.pl?biblionumber=$biblionumber&error=nobiblioitem");
  } else {
  
***************
*** 81,85 ****
  	&newbiblioitem($biblioitem);
      } elsif (&checkitems(1,$barcode)) {
! 	print $input->redirect("additem.pl?biblionumber=$biblionumber&error=barcodeinuse");
      } else {
  
--- 81,85 ----
  	&newbiblioitem($biblioitem);
      } elsif (&checkitems(1,$barcode)) {
! 	print $input->redirect("additem-nomarc.pl?biblionumber=$biblionumber&error=barcodeinuse");
      } else {
  
***************
*** 91,95 ****
  	&newitems($item, ($barcode));
  
! 	print $input->redirect("additem.pl?biblionumber=$biblionumber");
      } # else
  } # else
--- 91,95 ----
  	&newitems($item, ($barcode));
  
! 	print $input->redirect("additem-nomarc.pl?biblionumber=$biblionumber");
      } # else
  } # else





More information about the Koha-cvs mailing list