[Koha-bugs] [Bug 17364] New: branchcode should not be allowed in BorrowerUnwantedField , PatronSelfRegistrationBorrowerUnwantedField

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Tue Sep 27 22:42:45 CEST 2016


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17364

            Bug ID: 17364
           Summary: branchcode should not be allowed in
                    BorrowerUnwantedField,
                    PatronSelfRegistrationBorrowerUnwantedField
 Change sponsored?: ---
           Product: Koha
           Version: master
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P5 - low
         Component: Patrons
          Assignee: koha-bugs at lists.koha-community.org
          Reporter: barton at bywatersolutions.com
        QA Contact: testopia at bugs.koha-community.org
                CC: gmcharlt at gmail.com, kyle.m.hall at gmail.com

If branchcode is among the fields in BorrowerUnwantedField, saving the borrower
record in members/memberentry.pl will generate an Internal Server Error because
there is a foreign key constraint on borrowers.branchcode.

To replicate the issue:

1/ Set the syspref BorrowerUnwantedField so that it contains branchcode
2/ Create a patron on members/memberentry.pl
3/ Save the patron, you will get "Internal Server Error".

It follows that PatronSelfRegistrationBorrowerUnwantedField should not contain
branchcode either -- it's necessary to create a record in the borrowers table,
so we shouldn't be able to exclude it.

Details for those who like that sort of thing:

If you're watching the plack error logs,you'll see something like this:

DBD::mysql::st execute failed: Cannot add or update a child row: a foreign key
constraint fails (`koha_salinas`.`borrowers`, CONSTRAINT `borrowers_ibfk_2`
FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`)) [for Statement
"INSERT INTO `borrowers` ( `address`, `address2`, `borrowernotes`,
`cardnumber`, `categorycode`, `city`, `contactnote`, `country`, `dateenrolled`,
`dateexpiry`, `dateofbirth`, `debarred`, `email`, `emailpro`, `fax`,
`firstname`, `initials`, `mobile`, `opacnote`, `othernames`, `password`,
`phone`, `phonepro`, `privacy`, `sex`, `sort1`, `sort2`, `state`, `surname`,
`title`, `userid`, `zipcode`) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" with ParamValues:
0="1234 MAIN ST", 1="", 2="", 3="TESTYTESTERSON", 4="STAFF", 5="Bradley, CA",
6="", 7="", 8='2016-09-27', 9='2024-12-27', 10=undef, 11=undef, 12="", 13="",
14="", 15="TESTY", 16="", 17="", 18="", 19="", 20='!', 21="555 555 1212",
22="", 23=1, 24="", 25="C", 26="", 27="", 28="TESTERSON", 29="",
30='testy.testerson', 31="93426"] at /usr/share/perl5/DBIx/Class/Storage/DBI.pm
line 1832.
DBIx::Class::Storage::DBI::_dbh_execute(): Cannot add or update a child row: a
foreign key constraint fails (`koha_salinas`.`borrowers`, CONSTRAINT
`borrowers_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches`
(`branchcode`)) at /usr/share/koha/lib/C4/Members.pm line 769

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.


More information about the Koha-bugs mailing list