|
Lines 204-210
sub _add_exception {
Link Here
|
| 204 |
$schema->storage->txn_rollback; |
204 |
$schema->storage->txn_rollback; |
| 205 |
|
205 |
|
| 206 |
subtest 'copy_to_branch' => sub { |
206 |
subtest 'copy_to_branch' => sub { |
| 207 |
|
207 |
|
| 208 |
plan tests => 8; |
208 |
plan tests => 8; |
| 209 |
|
209 |
|
| 210 |
$schema->storage->txn_begin; |
210 |
$schema->storage->txn_begin; |
|
Lines 281-292
subtest 'copy_to_branch' => sub {
Link Here
|
| 281 |
|
281 |
|
| 282 |
#Select all rows with same values from database |
282 |
#Select all rows with same values from database |
| 283 |
my $dbh = C4::Context->dbh; |
283 |
my $dbh = C4::Context->dbh; |
| 284 |
my $get_repeatable_holidays = "SELECT a.* FROM repeatable_holidays a |
284 |
my $get_repeatable_holidays = "SELECT a.* FROM repeatable_holidays a |
| 285 |
JOIN (SELECT branchcode, weekday, day, month, COUNT(*) |
285 |
JOIN (SELECT branchcode, weekday, day, month, COUNT(*) |
| 286 |
FROM repeatable_holidays |
286 |
FROM repeatable_holidays |
| 287 |
GROUP BY branchcode, weekday, day, month HAVING count(*) > 1) b |
287 |
GROUP BY branchcode, weekday, day, month HAVING count(*) > 1) b |
| 288 |
ON a.branchcode = b.branchcode |
288 |
ON a.branchcode = b.branchcode |
| 289 |
AND ( a.weekday = b.weekday OR (a.day = b.day AND a.month = b.month)) |
289 |
AND ( a.weekday = b.weekday OR (a.day = b.day AND a.month = b.month)) |
| 290 |
ORDER BY a.branchcode;"; |
290 |
ORDER BY a.branchcode;"; |
| 291 |
my $sth = $dbh->prepare($get_repeatable_holidays); |
291 |
my $sth = $dbh->prepare($get_repeatable_holidays); |
| 292 |
$sth->execute; |
292 |
$sth->execute; |
|
Lines 295-308
subtest 'copy_to_branch' => sub {
Link Here
|
| 295 |
while(my $row = $sth->fetchrow_hashref){ |
295 |
while(my $row = $sth->fetchrow_hashref){ |
| 296 |
push @repeatable_holidays, $row |
296 |
push @repeatable_holidays, $row |
| 297 |
} |
297 |
} |
| 298 |
|
298 |
|
| 299 |
is( scalar(@repeatable_holidays), 0, "None of the repeatable holidays were doubled"); |
299 |
is( scalar(@repeatable_holidays), 0, "None of the repeatable holidays were doubled"); |
| 300 |
|
300 |
|
| 301 |
my $get_special_holidays = "SELECT a.* FROM special_holidays a |
301 |
my $get_special_holidays = "SELECT a.* FROM special_holidays a |
| 302 |
JOIN (SELECT branchcode, day, month, year, isexception, COUNT(*) |
302 |
JOIN (SELECT branchcode, day, month, year, isexception, COUNT(*) |
| 303 |
FROM special_holidays |
303 |
FROM special_holidays |
| 304 |
GROUP BY branchcode, day, month, year, isexception HAVING count(*) > 1) b |
304 |
GROUP BY branchcode, day, month, year, isexception HAVING count(*) > 1) b |
| 305 |
ON a.branchcode = b.branchcode |
305 |
ON a.branchcode = b.branchcode |
| 306 |
AND a.day = b.day AND a.month = b.month AND a.year = b.year AND a.isexception = b.isexception |
306 |
AND a.day = b.day AND a.month = b.month AND a.year = b.year AND a.isexception = b.isexception |
| 307 |
ORDER BY a.branchcode;"; |
307 |
ORDER BY a.branchcode;"; |
| 308 |
$sth = $dbh->prepare($get_special_holidays); |
308 |
$sth = $dbh->prepare($get_special_holidays); |
|
Lines 317-320
subtest 'copy_to_branch' => sub {
Link Here
|
| 317 |
|
317 |
|
| 318 |
$schema->storage->txn_rollback; |
318 |
$schema->storage->txn_rollback; |
| 319 |
|
319 |
|
| 320 |
} |
320 |
}; |
| 321 |
- |
|
|