Bug 30290: (QA follow-up) Sample notices/database update: Change phrasing to Yes/No
[koha.git] / installer / data / mysql / atomicupdate / bug_30290.pl
1 use Modern::Perl;
2
3 return {
4     bug_number => 30290,
5     description => "Modify AR notices, include TOC line",
6     up => sub {
7         my ($args) = @_;
8         my ($dbh, $out) = @$args{qw(dbh out)};
9         my $sql = q|
10 UPDATE letter
11 SET content=REPLACE(content, '\nPages:', '\nTOC: [% IF article_request.toc_request %]Yes[% ELSE %]No[% END %]\nPages:')
12 WHERE code RLIKE '^AR_'  AND module='circulation' AND content NOT RLIKE '\nTOC:';
13         |;
14         $dbh->do( $sql );
15
16         # Warn if we find translated notices (educated guess with word Pages)
17         $sql=q|
18 SELECT COUNT(*)
19 FROM letter
20 WHERE code RLIKE '^AR_'  AND module='circulation' AND content NOT RLIKE '\nPages:';
21         |;
22         my ( $count ) = $dbh->selectrow_array( $sql );
23         say $out "WARNING: If you have translated AR notices, please add TOC lines yourself." if $count;
24     },
25 };