Bug 22720 - Including branchcode in PatronSelfModificationBorrowerUnwantedField causes internal server error on self registration page
Summary: Including branchcode in PatronSelfModificationBorrowerUnwantedField causes in...
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Patrons (show other bugs)
Version: 18.05
Hardware: All All
: P5 - low normal (vote)
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-04-16 21:47 UTC by Barton Chittenden
Modified: 2019-11-24 22:07 UTC (History)
5 users (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 Barton Chittenden 2019-04-16 21:47:44 UTC
If the system preference PatronSelfModificationBorrowerUnwantedField contains branchcode, the branch drop-down isn't populated on the self reigistration page (koha/opac-memberentry.pl). This causes a foreign key constraint violation when the new borrower is added to the borrowers table:

[Tue Apr 16 13:56:02.588293 2019] [cgi:error] [pid 12231] [client 10.208.131.107:37284] AH01215: [Tue Apr 16 13:56:02 2019] opac-memberentry.pl: DBD::mysql::st execute failed: Cannot add or update a child row: a foreign key constraint fails (`load08`.`borrowers`, CONSTRAINT `borrowers_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`)) [for Statement "INSERT INTO `borrowers` ( `address`, `borrowernumber`, `categorycode`, `city`, `dateenrolled`, `dateexpiry`, `dateofbirth`, `email`, `firstname`, `password`, `privacy`, `state`, `surname`, `userid`, `zipcode`) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" with ParamValues: 0="foo", 1=undef, 2='OBR', 3="foo", 4='2019-04-16T13:56:02', 5='2019-05-16T13:56:02', 6='1970-01-01', 7="foo@example.com", 8="foo", 9='foo', 10=1, 11="CA", 12="foo", 13='foo.foo', 14="99999"] at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1832., referer: https://foo.bywatersolutions.com/cgi-bin/koha/opac-memberentry.pl

To re-create

1) add branchcode to the field list in PatronSelfModificationBorrowerUnwantedField 
2) Click 'Register here' link on the front page of the opac
3) Fill out patron data and click 'Submit' => internal server error.
Comment 1 Barton Chittenden 2019-04-16 22:05:22 UTC
Note that the desire to add branchcode to the PatronSelfModificationBorrowerUnwantedField is common among single branch libraries -- the branches drop-down doesn't serve any purpose there from an end-user perspective.
Comment 2 Jonathan Druart 2019-04-27 00:56:43 UTC
Hi Barton, why do you suggest? Which library to you pick if there is more than one?

A workaround could be to hide it with JS.
Comment 3 Katrin Fischer 2019-11-24 22:07:16 UTC
Maybe we could make it a hidden form element for libraries with only one branch. For libraries with more than one branch, we could make the library pull down always show and display a note about the 'misconfiguration' on the About page?