Bug 6796: Merge and correct database update
Sponsored-by: PTFS Europe Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
parent
e2a48eff6d
commit
688a551e70
|
|
@ -1,16 +0,0 @@
|
|||
use Modern::Perl;
|
||||
|
||||
return {
|
||||
bug_number => "6796",
|
||||
description => "Overnight checkouts taking into account opening and closing hours",
|
||||
up => sub {
|
||||
my ($args) = @_;
|
||||
my ( $dbh, $out ) = @$args{qw(dbh out)};
|
||||
|
||||
$dbh->do(
|
||||
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' ) }
|
||||
);
|
||||
|
||||
say $out "Added system preference 'ConsiderLibraryHoursInCirculation'";
|
||||
},
|
||||
};
|
||||
|
|
@ -21,15 +21,27 @@ return {
|
|||
}
|
||||
);
|
||||
|
||||
my @indexes = ( 0 .. 6 );
|
||||
for my $i (@indexes) {
|
||||
$dbh->do(
|
||||
q{ INSERT INTO library_hours (library_id, day) SELECT branchcode, ? FROM branches }, undef,
|
||||
$i
|
||||
);
|
||||
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
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
say $out "Added table `library_hours`";
|
||||
|
||||
$dbh->do(
|
||||
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' ) }
|
||||
);
|
||||
|
||||
say $out "Added system preference 'ConsiderLibraryHoursInCirculation'";
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue