Bug 29432 - Item type deletion should test frameworks
Summary: Item type deletion should test frameworks
Status: CLOSED INVALID
Alias: None
Product: Koha
Classification: Unclassified
Component: MARC Bibliographic data support (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-11-06 02:30 UTC by Fridolin Somers
Modified: 2022-12-12 21:24 UTC (History)
1 user (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fridolin Somers 2021-11-06 02:30:48 UTC
Actually the test to allow deleting an item type is :

sub can_be_deleted {
    my ($self) = @_;
    my $nb_items = Koha::Items->search( { itype => $self->itemtype } )->count;
    my $nb_biblioitems = Koha::Biblioitems->search( { itemtype => $self->itemtype } )->count;
    return $nb_items + $nb_biblioitems == 0 ? 1 : 0;
}

But using item types on biblioitems.itemtype is not mandatory (for items.itype I do not know), so we should test if this DB column is configured in frameworks to use item types.
Comment 1 Jonathan Druart 2021-11-18 09:13:21 UTC
I am not sure I understand. In which cases it's a problem?

You want to delete itemtype 'BOOK', 'BOOK' is used in biblioitems.itemtype but not using the 'itemtype' plugin and so you want to be able to delete the itemtype?
Comment 2 Katrin Fischer 2021-11-18 10:46:05 UTC
I think the problem here is something that we will encounter again and again. You can remove the plugin from the frameworks and use another list of authorised values for biblioitems.itemtype and I know some Biblibre libraries have done this, but I really believe that it's a terrible idea.

Because on the other side we have hold features, article requests features, search and display features relying on this to be an actual item type. Note: I am speaking of features for item level itypes!

We can change the check here... but I believe that we should not support this use case. It's harmful to the libraries locking them out of functionality and will keep having us add code and workarounds. 

... and instead of changing the check you could use different codes to fix the issue locally in this case?
Comment 3 Fridolin Somers 2022-03-04 21:20:04 UTC
OK I close.

We have a local fix :

https://git.biblibre.com/biblibre/kohac/commit/c1a54004bff33174bde56c2ae3adad6eb417bc79