Update of /cvsroot/koha/koha/acqui.simple In directory usw-pr-cvs1:/tmp/cvs-serv29170 Modified Files: addbooks.pl addbookslccn.pl Log Message: More work on the addbooks scripts, committing on behalf of Roger Need testing before use in a production environment Index: addbooks.pl =================================================================== RCS file: /cvsroot/koha/koha/acqui.simple/addbooks.pl,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** addbooks.pl 31 Mar 2002 06:50:08 -0000 1.4 --- addbooks.pl 3 Apr 2002 08:44:23 -0000 1.5 *************** *** 2,9 **** # # TODO # ! # Add info on biblioitems and items already entered as you enter new ones # use C4::Database; --- 2,16 ---- # + # Modified saas@users.sf.net 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 # ! # Error checking for pre-existing barcodes, biblionumbers and maybe others # + # Add info on biblioitems and items already entered as you enter new ones use C4::Database; *************** *** 17,21 **** my $dbh=C4Connect; - my $isbn=$input->param('isbn'); my $q_isbn=$dbh->quote($isbn); --- 24,27 ---- *************** *** 139,144 **** wrap=physical></textarea></td></tr> - - </table> <input type=submit value="Add New Bibliography Item"> --- 145,148 ---- *************** *** 199,202 **** --- 203,207 ---- ($biblioitemnumber) = $sth->fetchrow; $biblioitemnumber++; + # print STDERR "NEW BiblioItemNumber: $biblioitemnumber \n"; ($q_isbn='') if ($q_isbn eq 'NULL'); my $query="insert into biblioitems (biblioitemnumber, *************** *** 273,280 **** my $sth; if ($isbn eq 'NULL') { $sth=$dbh->prepare("select biblionumber,biblioitemnumber from biblioitems where biblioitemnumber=$biblioitemnumber"); } else { ! $sth=$dbh->prepare("select biblionumber,biblioitemnumber from biblioitems where isbn=$q_isbn"); } --- 278,293 ---- my $sth; if ($isbn eq 'NULL') { + # set biblioitemnumber if not already initialised... + if ($biblioitemnumber eq '') { + $sth=$dbh->prepare("select max(biblioitemnumber) from biblioitems"); + $sth->execute; + ($biblioitemnumber) = $sth->fetchrow; + $biblioitemnumber++; + # print STDERR "BiblioItemNumber was missing: $biblioitemnumber \n"; + } $sth=$dbh->prepare("select biblionumber,biblioitemnumber from biblioitems where biblioitemnumber=$biblioitemnumber"); } else { ! $sth=$dbh->prepare("select biblionumber, biblioitemnumber from biblioitems where isbn=$q_isbn"); } *************** *** 289,292 **** --- 302,306 ---- } + if ($itemdata) { print << "EOF"; *************** *** 305,312 **** EOF } ! my $sth=$dbh->prepare("select max(barcode) from items"); ! $sth->execute; ! my ($maxbarcode) = $sth->fetchrow; ! $maxbarcode++; print << "EOF"; <center> --- 319,327 ---- EOF } ! # my $sth=$dbh->prepare("select max(barcode) from items"); ! # $sth->execute; ! # my ($maxbarcode) = $sth->fetchrow; ! # $maxbarcode++; ! # print STDERR "MaxBarcode: $maxbarcode \n"; print << "EOF"; <center> *************** *** 317,321 **** <input type=hidden name=biblioitemnumber value=$biblioitemnumber> <table> ! <tr><td>BARCODE</td><td><input name=barcode size=10 value=$maxbarcode> Home Branch: <select name=homebranch> EOF --- 332,337 ---- <input type=hidden name=biblioitemnumber value=$biblioitemnumber> <table> ! <!-- tr><td>BARCODE</td><td><input name=barcode size=10 value=\$maxbarcode --> ! <tr><td>BARCODE</td><td><input name=barcode size=10 value=$biblionumber> Home Branch: <select name=homebranch> EOF *************** *** 381,387 **** print endmenu(); print endpage(); - - - --- 397,400 ---- Index: addbookslccn.pl =================================================================== RCS file: /cvsroot/koha/koha/acqui.simple/addbookslccn.pl,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** addbookslccn.pl 31 Mar 2002 06:50:08 -0000 1.3 --- addbookslccn.pl 3 Apr 2002 08:44:23 -0000 1.4 *************** *** 2,9 **** # # TODO # ! # Add info on biblioitems and items already entered as you enter new ones # use C4::Database; --- 2,16 ---- # + # Modified saas@users.sf.net 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 # ! # Error checking for pre-existing barcodes, biblionumbers and maybe others # + # Add info on biblioitems and items already entered as you enter new ones use C4::Database; *************** *** 17,21 **** my $dbh=C4Connect; - my $lccn=$input->param('lccn'); my $q_lccn=$dbh->quote($lccn); --- 24,27 ---- *************** *** 197,200 **** --- 203,207 ---- ($biblioitemnumber) = $sth->fetchrow; $biblioitemnumber++; + # print STDERR "NEW BiblioItemNumber: $biblioitemnumber \n"; ($q_lccn='') if ($q_lccn eq 'NULL'); $sth=$dbh->prepare("insert into biblioitems (biblioitemnumber, *************** *** 267,270 **** --- 274,285 ---- my $sth; if ($lccn eq 'NULL') { + # set biblioitemnumber if not already initialised... + if ($biblioitemnumber eq '') { + $sth=$dbh->prepare("select max(biblioitemnumber) from biblioitems"); + $sth->execute; + ($biblioitemnumber) = $sth->fetchrow; + $biblioitemnumber++; + # print STDERR "BiblioItemNumber was missing: $biblioitemnumber \n"; + } $sth=$dbh->prepare("select biblionumber,biblioitemnumber from biblioitems where biblioitemnumber=$biblioitemnumber"); *************** *** 299,306 **** EOF } ! my $sth=$dbh->prepare("select max(barcode) from items"); ! $sth->execute; ! my ($maxbarcode) = $sth->fetchrow; ! $maxbarcode++; print << "EOF"; <center> --- 314,322 ---- EOF } ! # my $sth=$dbh->prepare("select max(barcode) from items"); ! # $sth->execute; ! # my ($maxbarcode) = $sth->fetchrow; ! # $maxbarcode++; ! # print STDERR "MaxBarCode: $maxbarcode"; print << "EOF"; <center> *************** *** 311,315 **** <input type=hidden name=biblioitemnumber value=$biblioitemnumber> <table> ! <tr><td>BARCODE</td><td><input name=barcode size=10 value=$maxbarcode> Home Branch: <select name=homebranch> EOF my $branches=getbranches(); --- 327,333 ---- <input type=hidden name=biblioitemnumber value=$biblioitemnumber> <table> ! <!-- tr><td>BARCODE</td><td><input name=barcode size=10 value=\$maxbarcode --> ! <tr><td>BARCODE</td><td><input name=barcode size=10 value=$biblionumber> ! Home Branch: <select name=homebranch> EOF my $branches=getbranches();
participants (1)
-
Chris Cormack