Commit graph

289 commits

Author SHA1 Message Date
Galen Charlton
bc9ee0cff9 item rework: moved ModItemInMarc
* Moved exported ModItemInMarc from C4::Biblio to
  C4::Items and renamed to _replace_item_field_in_biblio.
  Function is now private and is not exported, as
  ModItem is now the sole entry point for updating
  an item record.
* Replaced calls to ModItemInMarc in C4::Circulation
  with appropriate ModItem calls.

Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-01-03 16:23:23 -06:00
Galen Charlton
c6c8e80a73 start of BIB change -- introduce C4::Items
Introduced C4::Items module to separate items API
from biblio API.  Details on changes will be
put in later commit messages.

Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-01-03 16:23:12 -06:00
Joshua Ferraro
5c23369af2 Fixing Database Definitions for Statuses *PARTIAL*
Prior to this fix, the status fields had three 'off' values, NULL, "",
and 0. I've reduced it to two in the db, removing the option for NULL, and
setting the default value to 0, however, we need to verify that we don't ever
write out as "" as this needlessly complicates the indexing process,
critical for searching or limiting by status (e.g., availability). Also,
queries that attempt to write a NULL value to one of these fields will fail
(based on my tests).

This patch includes the following changes:

* Updated the database definition for notforloan, damaged, itemlost, and
wthdrawn in kohastructure.sql to forbid NULL and default to 0; MySQL
can't forbid other values (such as empty ""), so this has to be handled
at the application layer and REQUIRES further patching.

* Fixed the 'limit by availability' query node in Search.pm to use a
much less confusing definition of 'available'

* Added code to set values to 0 where they are NULL or empty ( "" ) for
notforloan, damaged, itemlost or wthdrawn in both the MARC and the items
table:

  * Biblio.pm -> AddBiblioAndItems
  * catalogue/updateitem.pl
  * SEE NOTE BELOW, REQUIRES UPDATE TO THE REST OF KOHA'S ITEM MGT!

* Removed code in bulkmarcimport.pl that sets notforloan status depending
  on item-level or bib-level itemtype -- that flag is designed to be set
  only to override the notforloan setting for the item's (or bib's,
  depending on the syspref) assigned itemtype (it doesn't need to override
  to 'for loan', only to 'not for loan').

  added $dbh->do("truncate zebraqueue"); when operation is 'delete'

* I updated some notes in catalogue/updateitem.pl as to why ModItem can't be
used -- we don't have _a_ place where we can change the item and marc :/

  I've tested the following:

  bulkmarcimport.pl..........................MARC/items OK
  Staged Records Import......................NOT OK
  updateitem.pl (via moredetail.pl)..........MARC/items OK
  circulation.pl.............................NOT OK
  returns.pl.................................NOT OK
  addbiblio.pl...............................NOT OK
  additem.pl.................................NOT OK

Basically, there isn't a single place to apply this patch that will
update both item data and MARC data in one place ... a future patch
needs to address this issue.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-01-03 16:23:04 -06:00
Mason James
5dacccedec TransformHtmlToXml() now checks from UNIMARC flavour, before inserting encoding info to 100$a
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-01-02 07:54:30 -06:00
Galen Charlton
281c1e2454 only munge copyrightdate and publicationyear if they exist
Prior to this fix, those two keys were always
created by TransformMarcToKoha even when
not appropriate (e.g., for items).

Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-12-28 12:39:44 -06:00
Chris Cormack
3ae2edde0a Getting rid of noisy warn
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-12-27 17:21:56 -06:00
Galen Charlton
0456e457dc IMPORTANT - replaced TransformMarcToKoha
Replaced with FasterTransformMarcToKoha
from a previous commit.  Main differences are:

[1] At least twice as fast because of improvement
    in algorithm for processing the MARC record --
    each tag is processed only once.
[2] Fixed bug where biblio.notes would end up with
    an extra ' | ' at the end.

Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-12-25 09:08:39 -06:00
Galen Charlton
cb6cf680bc improved error detection in AddBiblioAndItems
Introduced new C4::Biblio function CheckItemPreSave,
which checks for duplicate barcodes and invalid
branch codes.  Not yet sure whether this function
needs to be exported or whether it will just be
used internally to C4::Bibli.

Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-12-25 09:08:34 -06:00
Galen Charlton
f60f4987a3 C4::Biblio::AddBiblioAndItems - added duplicate barcode check
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-12-25 09:08:30 -06:00
Galen Charlton
7d47666f7e bulk MARC record import - speed improved
Changes to improve speed of MARC bib and item
imports:

[1] Turn off autocommit and commit database
    transactions in larger batches.
[2] Introduce a new C4::Biblio function (AddBiblioAndItems)
    to combine AddBiblio and AddItems -- this is faster
    because we are not parsing the MARC XML of the biblio
    every time we add an item.
[3] Introduce FasterTransformMarcToKoha, which is much
    faster than TransformMarcToKoha.  The new version,
    which will replace the old one once it has been
    fully tested, scans through each field in the
    MARC record just once, instead of potentially
    dozens of times.
[4] Remove code in bulkmarcexport that moved the
    item tags to separate MARC::Record objects.

Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-12-25 09:08:28 -06:00
Joshua Ferraro
e4799032d2 Warning: big commit Fixing moredetail.pl
Previously, about 50% of the data on this page was either incorrect or missing.

Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-12-23 20:32:34 -06:00
Joshua Ferraro
31f45434e3 fixing additional authors links on detail pages in opac and staff catalogs
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-12-18 19:34:45 -06:00
Mason James
e7c05a9c3c mod to GetAuthorisedValueDesc() to simply take $category and $value args, and get a desc. back.
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-12-14 23:06:17 -06:00
Joe Atzberger
377db43117 C4 and misc: permissions fixes
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-12-13 19:00:34 -06:00
Galen Charlton
d46581b8f0 bugfix: do not try to set items.cn_sort twice
The way this API is used by additem.pl, the $item hasref
already contains a 'items.cn_sort' key whose value is
undef.  Setting $item->{'cn_sort'} instead of $item->{'items.cn_sort'}
ends putting with items.cn_sort and cn_sort in the UPDATE
items statement, making the final value of cn_sort in the DB
dependent on the order produced by Perl's keys function.

Also added a comment explaining a subtle (perhaps too subtle)
point in the code.

Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-12-13 17:30:25 -06:00
Ryan Higgins
0734f8fca0 Clean up moredetail.pl and updateitem.pl
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-12-12 08:03:10 -06:00
Mason James
33349093cb fix for ModZebra() trying to delete an existing bib - that doesnt exist, during an add.
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-12-06 11:34:32 -06:00
Galen Charlton
6bb4eb130d bug 1615: AddItem() now sets issues, renewals, and reserves
When an item was created,  the renewals, issues, and reserves columns
were not set from the MARC data.  This was noticed particularly
in the context of batch loads, where a user might supply
data for those fields.

Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-12-02 15:06:23 -06:00
Galen Charlton
1854ad60a3 bug 1614: revise GetMarcItem so that info dervies from items table
This should help make the items table more authoritative, and ensures
that the items editor does not blank circulation fields such as
issues.

Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-11-27 17:05:56 -06:00
Galen Charlton
fe9106af0b bugfix: handle subfield $0 in MARC for an item
Note: C4::Biblio::GetMarcFromKohaField returns (0, 0) if
the kohafield is not defined in the MARC framework, but
in may places the return value is not checked correctly
and does not recognize a subfield $0 (zero).  It
would be better if GetMarcFromKohaField returned (undef, undef)
in that circumstance, but because of the number of places
where that function is used, the changed is deferred for
post 3.0.

Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-11-27 15:52:41 -06:00
Galen Charlton
eb52fe26c3 bug 1616: update bib MARC and zebraqueue on item update
Fixed so that when using updateitem.pl to change an
item's lost, damaged, or withdrawn status, the
bib's MARC XML is updated and an entry is added
to zebraqueue.

As part of the fix, C4::Biblio::ModItemInMarconefield
now works correctly.

Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-11-27 15:51:47 -06:00
Paul POULAIN
327ae4ff84 include 700 (author) in authority author list
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-11-25 17:06:42 -06:00
Mason James
0d610f5427 GetNoZebraIndexes() regex now handles naughty whitespace (read: tabs)
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-11-20 16:29:33 -06:00
Paul POULAIN
3253372339 changing the way subjects are build in detail.pl
If you have a $9 as authority, then you can directly search on an=<koha-auth-number>

For example, if you have :
600$912045$aEurope$xFrance$xMarseille (Europe--France--Marseille as subject of the biblio)

The link must be "an=12045"

The link is not changed in case there is no $9 (still apply on each term, one by one)

Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-11-17 11:37:25 -06:00
Chris Cormack
24ba695b2b Fix so with independent branches a staff member cant see who has items out if the borrower is from another library/branch
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-11-13 17:33:10 -06:00
Ryan Higgins
9c2d58a470 update item-at-wrong-branch error message to show homebranch.
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-11-13 12:46:45 -06:00
Galen Charlton
5c882558a4 bugfixes for reindexing problems
* now properly deletes deleted authorities from index
* now actually ignores duplicate work
* standardized on recordDelete instead of delete_record
  for bibs and recordDelete for authorities

Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-11-12 18:32:33 -06:00
Ryan Higgins
805d8c8f4d changes to item-level itype reintroduce items.itype (had been removed by updatedatabase but still in kohastructure) populate itype with bi.itemtype. fix error in getbiblio
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-11-11 18:40:04 -06:00
Galen Charlton
0863abf07b Revert "leader must be 25 and not 24 char long"
This reverts commit 991ae79bb6.

Note: the MARC21 (and UNIMARC) leader length is *24* characters,
not 25.

Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-11-08 17:14:48 -06:00
Ryan Higgins
bb8aa23730 fix typos on syspref
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-11-08 17:14:32 -06:00
Ryan Higgins
5a65c60683 further item-level itype changes
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-11-08 17:12:55 -06:00
Ryan Higgins
e44b409b16 notforloan from items.ccode->itemtypes.notforloan instead of bi.itemtype
(by syspref)

Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-11-08 17:12:01 -06:00
Joshua Ferraro
8e01ae8e18 fixing subject link on detail pages and searching API
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-11-07 08:24:06 -06:00
Paul POULAIN
991ae79bb6 leader must be 25 and not 24 char long
The test was wrong, thus any leader defined by the library was discarded
(chris/kados : check for MARC21 that size should be 25 as in UNIMARC)

Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-11-07 08:16:40 -06:00
Galen Charlton
5fabddfe38 made several PKs be auto_increment columns
* biblio.biblionumber
* biblioitems.biblioitemnumber
* items.itemnumber

These IDs are no longer increment by the Perl code, thus
allowing better concurrency during bib/item editing.

Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-11-01 17:31:33 -05:00
Galen Charlton
e90115293a bugfix: deletedbiblioitems row now added upon delete of a biblio
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-10-31 19:44:00 -05:00
Paul POULAIN
973adba104 dealing with empty XML : return an empty string, and not an empty MARC::Record
(Useful for zebraque_start)

Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-10-31 19:39:21 -05:00
Galen Charlton
5f972e33ab quelled perl -w variable masking warnings
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-10-31 05:56:31 -05:00
Galen Charlton
b5e18fe431 Biblio.pm - restored after duplicate application of
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-10-31 05:54:38 -05:00
Chris Cormack
0483e34162 Fix for broken Biblio.pm
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-10-29 17:11:42 -05:00
Chris Cormack
031dc49098 Tidying up TransformMarctoKoha
Still some work to do, but people can see the idea and decide if its good

Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-10-29 16:12:21 -05:00
Galen Charlton
960db4e458 Biblio.pm bugfixes
- uses new C4::Dates instead of C4::Date
- start work on TransformMarcToKoha
  * handle ambiguities in certain column names
  * part of patch inspired by Chris Cormack
- fix bugs preventing biblioitems and items
  from being properly updated
- ensure that biblionumber and biblioitemnumber
  always get mapped to MARC

Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-10-24 17:00:00 -05:00
Galen Charlton
af9dfd9cda bib and item editing bugfixes
- bugfix: update items.cn_sort upon edit of item
- bugfix: make failure of a value_builder plugin non-fatal
- bugfix: remove references to non-existent plugins
          from optional MARC21 frameworks
             bookseller.pl
             marc21_callnumber.pl
             marc21_classcodes.pl
             marc21_locationqualifier.pl
- bugfix: corrected trying to enter 'u*' fields twice in the 'CF'
          format in the optional MARC21 frameworks; resulted in
          most of the framework not being loaded

Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-10-22 19:56:53 -05:00
Paul POULAIN
10eb85455b bugfix (security flaw) : the additem template was open AFTER doing actions
when Logguing was ON, this resulted in an internal server error, thus the discovery of this bug.

Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-10-22 07:24:49 -05:00
Paul POULAIN
b25ace0be4 bugfix : handling biblionumber in a field < 010
the bug occur only if we have a malformed biblio, so it should "never" happend, but i've seen it once ;-)

Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-10-22 07:20:22 -05:00
Galen Charlton
fc8b44a967 call number work part 3 -- now using new routines to generate call number sort keys
C4/Biblio.pm - removed following functions:

_biblioitem_cn_sort
_items_cn_sort

TODO: add a new call number filing routine to emulate logic of
_biblioitem_cn_sort for compatibility purposes

Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-10-21 22:11:40 -05:00
Galen Charlton
af466ca41a start of reworking call number handling and other Biblio changes
Most of this commit by Joshua Ferraro.
updatedatabase changes by Galen Charlton.

Major changes:

This commit includes a lot of fairly major changes
to Koha's Biblio handling, largest is the addition
and deletion of several columns in the biblioitems,
items tables, as well as cleanup of deletedbiblioitems,
deleteditems tables. Some of the changes are simple
cleanup, but most have to do with improvements to
storage of call numbers in Koha.

Also, I had to clean up the _koha_* routines quite a
lot to make them work -- there was lots of data just
being lost because columns weren't being updated.

I'm still not completely convinced that the items
table is being treated as authoritative for items
data, investigating further.

DB Changes (updated in kohastructure.sql and in
updatedatabases):

ADDED:
biblioitems.cn_source   ( auth value, CN_SOURCE, stores the source of the
                          call number: DDC, LCC, NLM, etc.)
biblioitems.cn_class    ( plugin, marc21_callnumber.pl, helps fill in
                          the rest of the biblio-level fields)
biblioitems.cn_item
biblioitems.cn_suffix
biblioitems.cn_sort     ( for zebra sorting, stored as a decimal number)
biblioitems.totalissues ( for counting the total times issued )

items.cn_source         ( auth value, CN_SOURCE, stores DDC, LCC, NLM, etc.)
items.itemcallnumber    ( plugin, marc21_itemcallnumber.pl, helps fill in
                          the itemcallnumber based on the record data )
items.cn_sort           ( for zebra sorting, stored as a decimal number)
items.ccode             ( auth value, CCODE, stores the Collection Code
                          of the item, can be used as call number prefix
                          by some libraries )
items.uri
items.materials
items.damaged

DELETED:
items.itype
items.cutterextra
biblioitems.classification
biblioitems.subclass
biblioitems.dewey
biblioitems.lcsort
biblioitems.lccn
biblioitems.ccode

DB version now 3.00.00.009.

Minor changes:

* Drop revision history from C4/Biblio.pm
* GetMarcAuthors now returns additional authors (7XX), not
  main authors (1XX)
* Debug warnings in C4/Search.pm commented out

Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-10-18 20:19:56 -05:00
Paul POULAIN
b426ecb4f2 BUGfixes in availability management
- the availability status was not available on result list. This patch reintroduces that
- notforloan as itemtype was not properly managed : an itemtype that was notforloan resulted in nothing in detail. Not, the user can't place a reserve anymore, and the status is correctly displayed

the fix is for OPAC as well as staff

(owen, pls, validate cat-toolbar.inc & catalogue/detail.tmpl)

Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-10-14 19:10:53 -05:00
Ryan Higgins
1c2adfe7ff adding GetMarcUrls() fcn to display 856's - adding also output to opac-detail.
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-10-12 07:24:53 -05:00
Chris Cormack
e8528be8cb Delbiblio no longer deletes items.
It will only delete biblios that have no items attached.
You must delete the items first then delete the biblio

Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-10-12 07:23:45 -05:00