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 / +18 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(
32
                        q{ INSERT INTO library_hours (library_id, day) VALUES ( ?, ? ) }, undef, $branchcode,
33
                        $i
34
                    );
35
                }
30
            }
36
            }
31
37
32
            say $out "Added table `library_hours`";
38
            say $out "Added table `library_hours`";
39
40
            $dbh->do(
41
                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' ) }
42
            );
43
44
            say $out "Added system preference 'ConsiderLibraryHoursInCirculation'";
33
        }
45
        }
34
    },
46
    },
35
};
47
};
36
- 

Return to bug 6796