[Bug 6796] Overnight checkouts taking into account opening and closing hours
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=6796 --- Comment #159 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- (In reply to Emily Lamancusa (emlam) from comment #158)
Hmmm...I'm seeing a few errors in this part of the dbrev:
+ my $branches = + $dbh->selectall_arrayref( "SELECT branchcode FROM branches", { Slice => {} } ); + for my $branch (@$branches) { + my $branchcode = $branch->{branchcode}; + + my @indexes = ( 0 .. 6 ); + for my $i (@indexes) { + $dbh->do( + q{ INSERT INTO library_hours (library_id, day) VALUES ( ?, ? ) }, undef, $branchcode, + $i + ); + }
1. The parameter bindings in the INSERT statement are reversed - the order in the SQL is (library_id, day), but the order of the parameter bindings is undef, $branchcode.
2. The INSERT statement isn't idempotent - should be INSERT IGNORE
3. The dbrev is using a Koha object, which goes against the coding guidelines
The section of the dbrev that adds the syspref comes after the above section. I would think #1 would crash the dbrev, which would explain why the syspref didn't get added...but I'm surprised someone didn't notice it sooner if that was happening consistently. (Unless someone did notice and there's already a follow-up that isn't linked - I didn't dig for one.)
Great that you had a closer look ! I think that the binding is correct btw. There is always an undef in the middle in those statements (room for attributes hash). The $i is on the next line. Agree with 2 and 3. -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org