Koha How-To
Koha Question of the Week: Why Can't I Delete an Item Type After Deleting All of its Items?
Each Friday, we will bring you a new Koha Question of the Week. We will select real questions that we receive and share the answers with you!
Question: Why Can't I Delete an Item Type After Deleting All of its Items?
Answer: Koha has some guard rails in place to prevent deletions that would impact system functions, and one of those guard rails is that item types that are in use cannot be deleted, since item types are so integral.
If a library attempts to delete an item type in use, libraries will see an error message reading: "Cannot delete this item type. This record is in use. Deletion is not possible." It may be confusing to see this error message if a library has already deleted or changed item types to a new category, so why is this message showing?
Item types appear in a couple places on a bibliographic record. The first one, and the place that is most intuitive, is in the item holding data - if this record has three items on it, each item has an item type; they're often the same, but not always depending on local cataloging practices. This is the first thing librarians probably modified.
The other place on a bibliographic record that has an item type is in the 942$c, the biblio-level item type. This lets Koha know if a record is eligible for record-level holds, and it sets a default item type for any new items added to that record. In general, bib-level item types and item-level item types often match, but if a library has been creating new item types or phasing out old ones, records may have items with a new item type, while the bibliographic record is still using an old item type.
This is why a library cannot delete that item type - individual items may no longer be using it, but at least one record in Koha is. Here is a sample report to find records using a particular bib-level item type for this situation.
SELECT biblio.biblionumber, title, ExtractValue( metadata, '//datafield[@tag="942"]/subfield[@code="c"]' ) as 'Bib-level itemtype'
from biblio
left join biblio_metadata on (biblio.biblionumber=biblio_metadata.biblionumber)
WHERE ExtractValue( metadata, '//datafield[@tag="942"]/subfield[@code="c"]' ) = <<Item Type|itemtypes>>
Pair the report of biblionumbers with a Marc modification template to update that 942$c, and voila, a library can batch update those records and finally clear out that item type no longer in use.
Additional Resources
Batch Modify Items right from your SQL Report (works for records using biblionumber instead of itemnumber)
Monday Minutes: Marc Modification Templates
Read more by Hebah Amin-Headley