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: [email protected]
          Reporter: [email protected]
        QA Contact: [email protected]
                CC: [email protected], [email protected]
  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.
_______________________________________________
Koha-bugs mailing list
[email protected]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to