[Koha-bugs] [Bug 23217] New: Batch patron modification shows database errors when no Attribute provided

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Wed Jun 26 09:01:41 CEST 2019


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

            Bug ID: 23217
           Summary: Batch patron modification shows database errors when
                    no Attribute provided
 Change sponsored?: ---
           Product: Koha
           Version: 18.11
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P5 - low
         Component: Patrons
          Assignee: koha-bugs at lists.koha-community.org
          Reporter: dcook at prosentient.com.au
        QA Contact: testopia at bugs.koha-community.org
                CC: gmcharlt at gmail.com, kyle.m.hall at gmail.com
  Target Milestone: ---

I think that I've found a regression caused by
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19673. 

I'm investigating at the moment. I have the default SHOW_BCODE attribute
category set up, and when running with the Environmental Variable DEBUG=1 in
Apache and using Chrome on Windows 10, I'm getting database errors like this:

DBD::mysql::st execute failed: Cannot add or update a child row: a foreign key
constraint fails (`kohadb`.`borrower_attributes`, CONSTRAINT
`borrower_attributes_ibfk_2` FOREIGN KEY (`code`) REFERENCES
`borrower_attribute_types` (`code`) ON DELETE CASCADE ON UPDATE CASCADE) [for
Statement "INSERT INTO borrower_attributes SET attribute = ?, code = ?,
borrowernumber = ?" with ParamValues: 0=undef, 1="", 2="1"] at
/koha/lib/C4/Members/Attributes.pm line 294.

Note this is a modified Koha so the line number may not be relevant. It points
to the final line of this function:

sub UpdateBorrowerAttribute {
    my ( $borrowernumber, $attribute ) = @_;

    DeleteBorrowerAttribute $borrowernumber, $attribute;

    my $dbh = C4::Context->dbh;
    my $query = "INSERT INTO borrower_attributes SET attribute = ?, code = ?,
borrowernumber = ?";
    my @params = ( $attribute->{attribute}, $attribute->{code}, $borrowernumber
);
    my $sth = $dbh->prepare( $query );

    $sth->execute( @params );
}

-- 
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