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

--- Comment #158 from Emily Lamancusa (emlam) 
<[email protected]> ---
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.)

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://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