View | Details | Raw Unified | Return to bug 6796
Collapse All | Expand All

(-)a/installer/data/mysql/atomicupdate/bug_6796_-_add_ConsiderLibraryHoursInCirculation_syspref.pl (-16 lines)
Lines 1-16 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number  => "6796",
5
    description => "Overnight checkouts taking into account opening and closing hours",
6
    up          => sub {
7
        my ($args) = @_;
8
        my ( $dbh, $out ) = @$args{qw(dbh out)};
9
10
        $dbh->do(
11
            q{ INSERT IGNORE INTO systempreferences ( variable, value, options, explanation, type ) VALUES ( 'ConsiderLibraryHoursInCirculation', 'ignore', 'close|open|ignore', "Take library opening hours into consideration to calculate due date when circulating.", 'Choice' ) }
12
        );
13
14
        say $out "Added system preference 'ConsiderLibraryHoursInCirculation'";
15
    },
16
};
(-)a/installer/data/mysql/atomicupdate/bug_6796_-_add_library_hours_table.pl (-7 / +15 lines)
Lines 21-35 return { Link Here
21
            }
21
            }
22
            );
22
            );
23
23
24
            my @indexes = ( 0 .. 6 );
24
            my $branches =
25
            for my $i (@indexes) {
25
                $dbh->selectall_arrayref( "SELECT branchcode FROM branches", { Slice => {} } );
26
                $dbh->do(
26
            for my $branch (@$branches) {
27
                    q{ INSERT INTO library_hours (library_id, day) SELECT branchcode, ? FROM branches }, undef,
27
                my $branchcode = $branch->{branchcode};
28
                    $i
28
29
                );
29
                my @indexes    = ( 0 .. 6 );
30
                for my $i (@indexes) {
31
                    $dbh->do( q{ INSERT INTO library_hours (library_id, day) VALUES ( ?, ? ) }, undef, $branchcode, $i );
32
                }
30
            }
33
            }
31
34
32
            say $out "Added table `library_hours`";
35
            say $out "Added table `library_hours`";
36
37
            $dbh->do(
38
                q{ INSERT IGNORE INTO systempreferences ( variable, value, options, explanation, type ) VALUES ( 'ConsiderLibraryHoursInCirculation', 'ignore', 'close|open|ignore', "Take library opening hours into consideration to calculate due date when circulating.", 'Choice' ) }
39
            );
40
41
            say $out "Added system preference 'ConsiderLibraryHoursInCirculation'";
33
        }
42
        }
34
    },
43
    },
35
};
44
};
36
- 

Return to bug 6796