Bug 11045 - Wrong query in C4/Biblios.pm : join between biblioitems.itemtypes and itemtypes table
Summary: Wrong query in C4/Biblios.pm : join between biblioitems.itemtypes and itemty...
Status: CLOSED WONTFIX
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: Main
Hardware: All All
: P3 normal
Assignee: Galen Charlton
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-13 16:33 UTC by Mathieu Saby
Modified: 2024-07-04 20:37 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:
Circulation function:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mathieu Saby 2013-10-13 16:33:26 UTC
C4::Biblios::GetBiblioData and GetBiblioItemData are doing : 
SELECT [...] itemtypes.notforloan  [...]
[...]
LEFT JOIN itemtypes ON biblioitems.itemtype = itemtypes.itemtype

This is wrong becaause itemtypes table could be linked with items.itype (as in my library) and not with biblioitems.itemtype.

M. Saby
Comment 1 Jared Camins-Esakov 2013-10-13 16:51:13 UTC
(In reply to mathieu saby from comment #0)
> C4::Biblios::GetBiblioData and GetBiblioItemData are doing : 
> SELECT [...] itemtypes.notforloan  [...]
> [...]
> LEFT JOIN itemtypes ON biblioitems.itemtype = itemtypes.itemtype
> 
> This is wrong becaause itemtypes table could be linked with items.itype (as
> in my library) and not with biblioitems.itemtype.

Actually, I think this is correct, since this is for biblio-level item types, rather than item-level, which are treated elsewhere. You toggle between the two with the item-level_itypes syspref.
Comment 2 Mathieu Saby 2013-10-13 18:52:44 UTC
(In reply to Jared Camins-Esakov from comment #1)
> (In reply to mathieu saby from comment #0)
> > C4::Biblios::GetBiblioData and GetBiblioItemData are doing : 
> > SELECT [...] itemtypes.notforloan  [...]
> > [...]
> > LEFT JOIN itemtypes ON biblioitems.itemtype = itemtypes.itemtype
> > 
> > This is wrong becaause itemtypes table could be linked with items.itype (as
> > in my library) and not with biblioitems.itemtype.
> 
> Actually, I think this is correct, since this is for biblio-level item
> types, rather than item-level, which are treated elsewhere. You toggle
> between the two with the item-level_itypes syspref.

In my library, I have 'LIVRE' (book), 'REVUE' etc. in biblioitems.itemtypes.
I have "DPN", "DPL" (normal/long check out length) etc in items.itype
We have "DPN","DPL" etc itemtypes table 
We use item level type for issuing rules.

So when these subs are making a JOIN between biblioitems.itemtype and itemtypes.itemtype, it means trying to join "LIVRE,REVUE" and "DPN,DPL" etc.
So it will never get anything.

What I was wondering is : is Koha's code calling this sub supposing that some value should always be retreived from the join, and using these values for some purpose ?
If it is not the case, that's not an issue. But I was not sure...

Mathieu
Comment 3 Katrin Fischer 2014-11-10 23:53:37 UTC
I think the situation you describe, that the biblioitems.itypes don't match the itemtypes.itemtype list is a non-standard configuration that is potentially problematic in a lot of places. I think dividing them would need a lot more work and thought.
Comment 4 Mathieu Saby 2014-11-11 21:53:05 UTC
OK Katrin
Do you know if it is written somewhere in the documentation that the biblioitems.itypes should match the itemtypes.itemtype list?

Mathieu
Comment 5 Mathieu Saby 2014-11-11 21:56:22 UTC
May I add that this non standard configuration of ours was suggested by our vendor, so at that time, it was not so obvious for them (and of course not for the library) that biblioitems.itypes should match the itemtypes.itemtype list ?

Mathieu
Comment 6 Katrin Fischer 2014-11-11 22:06:16 UTC
Hi Mathieu, I think it's not explicitly documented and it would be good to get more opinions and look at the code some more.
Comment 7 Mathieu Saby 2014-11-11 23:46:40 UTC
You understood my mind ;-)
Maybe it is a wontfix, but in that case, libraries should be warned somewhere not to use the same configuration pattern as we did (and that's a pity, because it was well fitted for our rules).

Mathieu
Comment 8 Katrin Fischer 2023-07-08 21:45:17 UTC
Linking the biblioitems.itemtype to an AV instead of itemtypes will mean a lot of features won't work as intended. I still believe we should not support this, now less than before.

biblioitems.itemtype is used for:
* pre-selecting itemtype when cataloguing items
* max holds limits for record level holds
* circulation rules for article requests
* search: itype and itemtype will both be found when using the itemtype search
* there is code to display the itemtype icons in results list etc.

For this I believe this is indeed a WONTFIX.