Bug 17831

Summary: Remove non-existing bibliosubject.subject mapping from frameworks
Product: Koha Reporter: Nick Clemens (kidclamp) <nick>
Component: MARC Bibliographic data supportAssignee: Nick Clemens (kidclamp) <nick>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: 1joynelson, jonathan.druart, lucas, martin.renvoize
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
20.05.00, 19.11.01
Circulation function:
Attachments: Bug 17831 - Item Search fails on custom subject search field
Bug 17831: Remove non-existig bibliosubject.subject mapping from frameworks
Bug 17831: Database update - Tidy up frameworks in existing installations
Bug 17831: Remove non-existig bibliosubject.subject mapping from frameworks
Bug 17831: Database update - Tidy up frameworks in existing installations

Description Nick Clemens (kidclamp) 2016-12-29 17:09:01 UTC
If I add an Item Search Field:
    Name: Subj
    Label: Subj Head
    MARC field: 650
    MARC subfield: a
    Auth values: N/A

I get an error when doing the item search:
DBD::mysql::st execute failed: Unknown column 'bibliosubject.subject' in 'where clause' [for Statement "
        SELECT SQL_CALC_FOUND_ROWS items.*
        FROM items
          LEFT JOIN biblio ON biblio.biblionumber = items.biblionumber
          LEFT JOIN biblioitems ON biblioitems.biblioitemnumber = items.biblioitemnumber
          LEFT JOIN biblio_metadata ON biblio_metadata.biblionumber = biblio.biblionumber
          WHERE 1
     AND (bibliosubject.subject like ?)  AND biblio_metadata.format = 'marcxml' AND biblio_metadata.marcflavour = ?  ORDER BY title ASC  LIMIT ?, ? " with ParamValues: 0="juvnile%", 1='MARC21', 2=0, 3=20] at /home/vagrant/kohaclone/C4/Items.pm line 2798.
Comment 1 Katrin Fischer 2016-12-30 00:36:23 UTC
We just fixed bug 17743 - could this be it?
Comment 2 Nick Clemens (kidclamp) 2016-12-30 19:47:25 UTC
No, it appears to be bad data in our sample install files:

SELECT * FROM marc_subfield_structure WHERE tagfield=650 AND tagsubfield='a' AND frameworkcode=''\G;


The kohafield is set to bibliosubject.subject, I am guessing this is cruft


(In reply to Katrin Fischer from comment #1)
> We just fixed bug 17743 - could this be it?
Comment 3 Katrin Fischer 2017-01-07 23:11:29 UTC
Can you detail the problem a bit more? Should we change this bug to be a clean-up bug for bibliosubject.subject in our default files?
Comment 4 Nick Clemens (kidclamp) 2017-01-10 17:20:09 UTC
Created attachment 58769 [details] [review]
Bug 17831 - Item Search fails on custom subject search field

This patch removes the assignment of non-existent koha field
'bibliosubject.subject' to MARC subject fields in the installer data
for koha

To test:
You'll want a new fresh db

1 - Apply patch
2 - Run websintaller
3 - Ensure that thigns go smoothly
4 - Add/delete/edit some records and ensure that things are working with
the installed frameworks
Comment 5 Nick Clemens (kidclamp) 2017-01-10 17:21:56 UTC
(In reply to Katrin Fischer from comment #3)
> Can you detail the problem a bit more? Should we change this bug to be a
> clean-up bug for bibliosubject.subject in our default files?

Yes, I think that is what we need to do, I threw it together quikc but haven't tested - wondering if I need to do  '' instead of null - need to test but thought the patch would better illustrate the issue.
Comment 6 Katrin Fischer 2019-10-16 06:40:48 UTC
Hi Nick, should this be NSO?
Comment 7 Nick Clemens (kidclamp) 2019-10-16 12:57:29 UTC
(In reply to Katrin Fischer from comment #6)
> Hi Nick, should this be NSO?

I think so, I just didn't test it myself, it should be a simple fix
Comment 8 Katrin Fischer 2019-11-24 12:42:44 UTC
Created attachment 95760 [details] [review]
Bug 17831: Remove non-existig bibliosubject.subject mapping from frameworks

This patch removes the assignment of non-existent koha field
'bibliosubject.subject' to MARC subject fields in the installer data
for koha

To test:
You'll want a new fresh db

1 - Apply patch
2 - Run websintaller
3 - Ensure that thigns go smoothly
4 - Add/delete/edit some records and ensure that things are working with
the installed frameworks

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 9 Katrin Fischer 2019-11-24 12:42:48 UTC
Created attachment 95761 [details] [review]
Bug 17831: Database update - Tidy up frameworks in existing installations

The mapped table and column doesn't exist, so we should also remove
it from existing installations.
Comment 10 Jonathan Druart 2019-12-05 11:35:40 UTC
Created attachment 96011 [details] [review]
Bug 17831: Remove non-existig bibliosubject.subject mapping from frameworks

This patch removes the assignment of non-existent koha field
'bibliosubject.subject' to MARC subject fields in the installer data
for koha

To test:
You'll want a new fresh db

1 - Apply patch
2 - Run websintaller
3 - Ensure that thigns go smoothly
4 - Add/delete/edit some records and ensure that things are working with
the installed frameworks

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 11 Jonathan Druart 2019-12-05 11:35:43 UTC
Created attachment 96012 [details] [review]
Bug 17831: Database update - Tidy up frameworks in existing installations

The mapped table and column doesn't exist, so we should also remove
it from existing installations.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 12 Martin Renvoize (ashimema) 2019-12-09 14:56:58 UTC
Nice work everyone!

Pushed to master for 20.05
Comment 13 Joy Nelson 2019-12-19 21:19:05 UTC
Pushed to 19.11.01
Comment 14 Lucas Gass (lukeg) 2019-12-20 19:06:51 UTC
backported to 19.05.x for 19.05.06