[Koha-bugs] [Bug 12626] SQLHelper replacement - C4::Acquisition

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Mon Sep 8 17:07:22 CEST 2014


http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=12626

Dobrica Pavlinusic <dpavlin at rot13.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dpavlin at rot13.org

--- Comment #8 from Dobrica Pavlinusic <dpavlin at rot13.org> ---
This bug introduced regression for acquisition in acqui/neworderempty.pl.

In logs, I see error messages like:

addorder.pl: DBD::mysql::st execute failed: Cannot add or update a child row: a
foreign key constraint fails (`koha`.`aqorders_items`, CONSTRAINT
`aqorders_items_ibfk_1` FOREIGN KEY (`ordernumber`) REFERENCES `aqorders`
(`ordernumber`) ON DELETE CASCADE ON UPDATE CASCADE) at
/srv/koha_ffzg//C4/Acquisition.pm line 1317., referer:
https://koha.ffzg.hr:8443/cgi-bin/koha/acqui/neworderempty.pl?booksellerid=54&basketno=3764&biblionumber=237202

And indeed, adding additional debug warns all over the place, it seems that
code inside C4/Acquisition.pm sub NewOrder does:

my $ordernumber = $rs->create($new_order)->id;

which doesn't return ordernumber but instead empty string "" and all hell
breaks loose (resulting in missing entries in aqorders_items.

My DBIC foo isn't that good, but cookbook suggest that above code is correct:

http://search.cpan.org/~danieltwc/DBIx-Class-0.07002/lib/DBIx/Class/Manual/Cookbook.pod#Getting_the_value_of_the_primary_key_for_the_last_database_insert

I'm puzzled and confused how to fix this.

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


More information about the Koha-bugs mailing list