Line 0
Link Here
|
0 |
- |
1 |
use Modern::Perl; |
|
|
2 |
|
3 |
use C4::Context; |
4 |
use Koha::Reports; |
5 |
use Term::ANSIColor qw(:constants); |
6 |
|
7 |
return { |
8 |
bug_number => "35570", |
9 |
description => "Update 'FreeForm' ILL backend to 'Standard'", |
10 |
up => sub { |
11 |
my ($args) = @_; |
12 |
my ( $dbh, $out ) = @$args{qw(dbh out)}; |
13 |
|
14 |
my ($illbatches) = $dbh->selectrow_array( |
15 |
q| |
16 |
SELECT count(*) from illbatches where backend = 'FreeForm'; |
17 |
| |
18 |
); |
19 |
|
20 |
if ($illbatches) { |
21 |
$dbh->do("UPDATE illbatches SET backend = 'Standard' where backend = 'FreeForm'"); |
22 |
say $out GREEN, "Bug 35570: Updated ILL batches from 'FreeForm' to 'Standard"; |
23 |
} |
24 |
|
25 |
my ($illrequestattributes) = $dbh->selectrow_array( |
26 |
q| |
27 |
SELECT count(*) from illrequestattributes where backend = 'FreeForm'; |
28 |
| |
29 |
); |
30 |
|
31 |
if ($illrequestattributes) { |
32 |
$dbh->do("UPDATE illrequestattributes SET backend = 'Standard' where backend = 'FreeForm'"); |
33 |
say $out GREEN, "Bug 35570: Updated ILL request attributes from 'FreeForm' to 'Standard"; |
34 |
} |
35 |
|
36 |
my ($illrequests) = $dbh->selectrow_array( |
37 |
q| |
38 |
SELECT count(*) from illrequests where backend = 'FreeForm'; |
39 |
| |
40 |
); |
41 |
|
42 |
if ($illrequests) { |
43 |
$dbh->do("UPDATE illrequests SET backend = 'Standard' where backend = 'FreeForm'"); |
44 |
say $out GREEN, "Bug 35570: Updated ILL requests from 'FreeForm' to 'Standard"; |
45 |
} |
46 |
|
47 |
my $reports = join( |
48 |
"\n", |
49 |
map( "\tReport ID: " |
50 |
. $_->id |
51 |
. ' | Edit link: ' |
52 |
. C4::Context->preference('staffClientBaseURL') |
53 |
. '/cgi-bin/koha/reports/guided_reports.pl?reports=' |
54 |
. $_->id |
55 |
. "&phase=Edit%20SQL", |
56 |
Koha::Reports->search( { savedsql => { -like => "%FreeForm%" } } )->as_list ) |
57 |
); |
58 |
|
59 |
if ($reports) { |
60 |
say $out YELLOW, |
61 |
"Bug 35570: **ACTION REQUIRED**: Saved SQL reports containing occurrences of 'FreeForm' were found.\nThe following reports MUST be updated accordingly ('FreeForm' -> 'Standard'):"; |
62 |
say $out BRIGHT_YELLOW, |
63 |
$reports; |
64 |
}else{ |
65 |
say $out "Bug 35570: Finished database update."; |
66 |
} |
67 |
|
68 |
|
69 |
}, |
70 |
}; |