[Koha-bugs] [Bug 1406] New: Auto barcode generation for simple aquis

bugzilla-daemon at pippin.metavore.com bugzilla-daemon at pippin.metavore.com
Wed Aug 22 18:18:06 CEST 2007


http://bugs.koha.org/cgi-bin/bugzilla/show_bug.cgi?id=1406

           Summary: Auto barcode generation for simple aquis
           Product: Koha
           Version: 2.2.9
          Platform: PC
        OS/Version: Linux - Debian
            Status: NEW
          Severity: normal
          Priority: P3
         Component: Acquisitions (Simple)
        AssignedTo: chris.cormack at liblime.com
        ReportedBy: roger at hrothgar.co.uk
         QAContact: koha-bugs at nongnu.org


I mentioned this on a Koha list and was referred here.
The auto barcode generation does not work on simple aquis. The reason is that 
the code checks whether the barcode is present before it is generated. 
The following appears to effect a cure. I have not fully tested it: only with 
autoBarcode ON and with simple new biblios (and simple entries). And I am not 
capable of producing diffs ...

The first point is that the template after the Copyright page should not have 
space for a barcode to be entered if autoBarcode is ON: presumably one should 
not mix auto barcodes with manual barcodes.

In aqui-simple/additem-nomarc.pl I have added 

# Added RH 22 Aug 2007
# Used to decide whether to display slot for barcode in form

        if (C4::Context->boolean_preference('autoBarcode')){
           $template->param( AUTOUPDATEBARCODE => 1 )}
        else {$template->param( AUTOUPDATEBARCODE => 0 )};

(I think the last line is unnecessary: it was used for debugging.)

In the template file aqui-simple/additem-nomarc.tmpl I have added
after

  <div id="bloc25">
    <form action="saveitem.pl" method="post">
    <input type="hidden" name="biblionumber" value="<!-- TMPL_VAR NAME="BIBNUM"
-->">
    <h2 class="catalogue">ADD NEW ITEM:</h2>
    <p><i>For a website add the group only</i></p>

this (or rather changed to it this):
                <!-- TMPL_UNLESS NAME="AUTOUPDATEBARCODE" -->
                <p><label>Item Barcode:</label><input type="text"
name="barcode" size="40"></p>
                <!-- /TMPL_UNLESS -->

    <p>

It does upset the formatting of the page a bit.

I then added to aqui-simple/saveitem.pl a simple barcode generator:

if ( (! $website) && (C4::Context->boolean_preference('autoBarcode'))){
$barcode=$biblionumber+1;
}

I am not sure why the +1: I think other code had it in and I left it ... Is
biblionumber unique? 

I tried 
#    {
#    my $sth;
#    $sth=$dbh->prepare("Select max(barcode) from items");
#    $sth->execute;
#    my $data=$sth->fetchrow_hashref;
#    $barcode = $results[0]->{'barcode'}+1;
#    $sth->finish;
#  }

and commented it out because it didn't work (using C4::Context etc).
The result always seemed to be 1. 

Wouldn't a better solution be to have a slot in the db for an autoBarcode
number which was automatically increased by 1 each time and then checked 
automatically for duplicates (and recursively increased by 1 if duplicates 
were found). It seems to me to be odd that if a duplicate barcode is found
the code reports the fact but does nothing about it.

Anyway, the above works here and enables me to enter simple biblios 
manually: I do not have z3950 working atm and full cataloguing is not 
something I am keen to spend my time doing.

Roger




------- You are receiving this mail because: -------
You are the QA contact for the bug, or are watching the QA contact.





More information about the Koha-bugs mailing list