[Koha-devel] Re: how to automate adding of items.
Alex King
alex at king.net.nz
Fri Nov 24 00:09:18 CET 2006
I'm replying to my own message (below,) to let folks know where I got to
and to re-ask the same questions on -devel, because it got nowhere on
the user list (perhaps not surprisingly)
What follows relates to Koha 2.2, and is probably all simple stuff to
people who are actually involved in Koha devel stuff. However I thought
it might be useful to others in my position.
Records in the Koha "reservoir" (uploaded through the "upload MARC
records in reservoir" function in the ui) exist in the marc_breeding
table, with an ISBN and a "breedingid" key.
To add an item manually through the ui, the user goes first to
"Catalogue", "Add Biblio", which corresponds to
acqui.simple/addbooks.pl. A search on the ISBN calls
acqui.simple/isbnsearch.pl which in my case brings up one result if the
ISBN is in the reservoir. I can do this automatically easily enough by
searching for the ISBN in the marc_breeding table.
Next the user clicks "Add biblio" next to the listed item. This calls
acqui.simple/addbiblio.pl with the breeding_id set which takes them to a
screen with all the cataloguing details in the browser window. This is
presumably so the user can check and correct those details for their
library. In our case, all the details in the reservoir have come from a
single trusted source and no details need to be changed. The user then
clicks an "Add biblio" (which I believe POSTs to
acqui.simple/addbiblio.pl), and actually adds the biblio record in the db.
modules/C4/Biblio.pm is helpfully documented with an explanation of the
old-DB and MARC-DB databases. I don't know without further research
whether koha2.2 still keeps up two parallel data sets, but it certainly
seems it would be simpler to manipulate Biblio data through the API
provided than through direct DB access.
I also suspect the complete MARC data is transferred to the browser for
the user to review, then it is transferred back to
acqui.simple/addbiblio.pl via a post (with "op" set to "addbiblio"). So
in other words the data probably goes from the marc_breeding table to a
biblio entry only via the browser and there is probably no API call to
transfer this data directly. I this is what is making me think what I
am trying to do is too difficult.
Once the biblio is added, the browser redirects to
acqui.simple/additem.pl, with a bibid set to reflect the newly added
biblio. This screen allows the user to set data related to the item
(barcode being the most important one for me.) This then POSTs back to
acqui.simple/additem.pl to add the item (calling NEWnewitem).
My lack of perl is hindering a comprehensive understanding, but it seems
to me what I am trying to do isn't going to be straightforward. It's
probably going to be cheaper for the client to manually enter their
items (~2000) than for me to work out how to automate the process.
Cheers,
Alex
Alex King wrote:
> I'm needing some assistance with adding (biblios & items) into koha
> automatically.
>
> The biblio data is (for the most part) already in the reservoir.
>
> I have a list of matched ISBNs and barcodes, and I need to "create" a
> biblio from data in the reservoir and add an item.
>
> I can do this easily enough through the web UI, but there has to be a
> better way to enter the data automatically, given that I have the list
> of ISBNs and barcodes already in a text file.
>
> I am comfortable enough with scripting and accessing the mysql tables
> directly. I'm not though familiar enough with the koha database to
> know what to do there. I know it's not simply a matter of adding
> records in a single table.
>
> Can anyone point me to any scripts I can start from or suggest better
> ways to achieve what I'm trying to do? My thinking is to look at the
> cgi scripts and see what they are doing behind the scenes and write
> non-interactive scripts that do the same thing. My guess is they
> probably call library routines in the "C4" directory, and I could hook
> into the same library routines.
>
> Cheers,
>
> Alex
>
More information about the Koha-devel
mailing list